mengw15 commented on code in PR #7754:
URL: https://github.com/apache/texera/pull/7754#discussion_r3817108150


##########
amber/src/main/scala/org/apache/texera/web/resource/dashboard/user/warehouse/WarehouseResource.scala:
##########
@@ -131,21 +134,35 @@ class WarehouseResource(client: LakekeeperClient, 
enabled: Boolean) extends Lazy
       throw new WebApplicationException(s"a warehouse named '$name' already 
exists", 409)
     }
 
-    val warehouseName = s"user-$uid-$name"
+    // Never derive the catalog name from `name`: it is also the S3 key prefix 
and a
+    // component of every result URI an execution wrote, so a name-derived one 
could
+    // never change again. Drawing the id up front keeps the creation order 
below
+    // intact. The sequence is looked up rather than named literally -- its 
generated
+    // name is not a stable contract.
+    val whid: Integer = context.fetchValue(
+      DSL.field(
+        "nextval(pg_get_serial_sequence({0}, {1}))",
+        classOf[Integer],
+        
DSL.inline(s"${USER_WAREHOUSE.getSchema.getName}.${USER_WAREHOUSE.getName}"),
+        DSL.inline(USER_WAREHOUSE.WHID.getName)
+      )
+    )

Review Comment:
   Lakekeeper's own UUID is the **output** of the create call, while the name 
is its **input** — so it can't be used here. A UUID would have to be one we 
mint ourselves, i.e. a random name. We picked the row id instead: `user-7-12` 
stays short in S3 prefixes and result URIs, is unique by construction, and maps 
straight back to the row when debugging — at the cost of one `SELECT 
nextval(...)`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to