markhoerth commented on issue #14420:
URL: https://github.com/apache/gravitino/issues/14420#issuecomment-6697634883

   Reproduced on main at commit 463296caca4082133bf12bad2bd4ed5d2572933e 
(2.0.0-SNAPSHOT) with authorization enabled, using plain curl, so the race is 
reachable at this commit although it did not show up on earlier runs. The 2.0 
OSS test suite check `test_drop_and_create_racing_on_one_name_stay_consistent` 
fails. No fix for it is on main: #14557 was closed without merging.
   
   Setup: a clean metalake with a `lakehouse-iceberg` catalog `ic` (memory 
backend) and a schema `s`. Six clients run in parallel, three of them sending 
10 creates of table `x` and three sending 10 drops of it:
   
   ```
   POST /api/metalakes/{metalake}/catalogs/ic/schemas/s/tables
   
{"name":"x","comment":"","columns":[{"name":"id","type":"long","nullable":true}],"properties":{}}
   
   DELETE /api/metalakes/{metalake}/catalogs/ic/schemas/s/tables/x
   ```
   
   Status counts over 60 requests in each of three rounds. All 30 drops in each 
round return 200.
   
   ```
   round 1, 30 creates:  6 x 200, 14 x 409, 10 x 404
   round 2, 30 creates:  3 x 200, 17 x 409, 10 x 404
   round 3, 30 creates:  3 x 200, 16 x 409, 11 x 404
   ```
   
   The 404 responses to the create look like this:
   
   ```
   HTTP 404
   {"code":1003,"type":"NotFoundException","message":"Failed to operate 
table(s) [x] operation [CREATE] under schema [s], reason [Metadata object 
ic.s.x or owner admin is not found]","stack":[
     "org.apache.gravitino.exceptions.NotFoundException: Metadata object ic.s.x 
or owner admin is not found",
     "at 
org.apache.gravitino.authorization.OwnerManager.setOwner(OwnerManager.java:117)",
   ```
   
   A smaller number of creates in the same window return 404 with 
`NoSuchMetadataObjectException` and the reason `The metadata object of ic.s.x 
isn't found`.
   
   Cause, matching the analysis above: 
`core/src/main/java/org/apache/gravitino/hook/TableHookDispatcher.java:94` sets 
the owner after the table create has returned, and a concurrent drop can remove 
the table in between, so 
`core/src/main/java/org/apache/gravitino/authorization/OwnerManager.java:115-117`
 turns the missing entity into a 404 for a create that succeeded.


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