zeroshade commented on code in PR #1489:
URL: https://github.com/apache/iceberg-go/pull/1489#discussion_r3647330685


##########
catalog/sql/sql.go:
##########
@@ -667,6 +680,22 @@ func (c *Catalog) CreateTable(ctx context.Context, ident 
table.Identifier, sc *i
                return nil, fmt.Errorf("%w: %s", catalog.ErrNoSuchNamespace, ns)
        }
 
+       viewExists, err := c.CheckViewExists(ctx, ident)

Review Comment:
   TOCTOU: `CheckViewExists`/`CheckTableExists` run in separate read 
transactions before the write-tx insert below. A concurrent `CreateView` can 
pass this check and race the insert; consider rechecking inside the same 
serializable write transaction (cf. #1466).



##########
catalog/sql/sql.go:
##########
@@ -1329,7 +1379,15 @@ func (c *Catalog) CreateView(ctx context.Context, 
identifier table.Identifier, s
                return err

Review Comment:
   (re: catalog/sql/sql.go:1377) Same TOCTOU on the `CreateView` path — a raced 
insert failure surfaces a raw dialect unique-constraint error rather than the 
intended catalog sentinel, so error semantics differ across 
sqlite/postgres/mysql.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to