difin commented on PR #6930:
URL: https://github.com/apache/hive/pull/6930#issuecomment-6534024200

   Data loss is still possible on the lock path. When the hook takes 
`MetastoreLock`, it sends no CAS (`expectMetadataLocation` only adds it for 
`NoLock`). That is safe only if the lock excludes every other writer, and it 
doesn't. `MetastoreLock` stores the Iceberg catalog name as the lock's catalog:
   
   
   `MetastoreLock.java` - Ln 281–283:
   ```
   LockComponent lockComponent =
           new LockComponent(LockType.EXCL_WRITE, LockLevel.TABLE, 
databaseName);
   lockComponent.setCatName(catalogName);
   ```
   
   The metastore lock manager only treats locks as conflicting when that 
catalog value matches:
   
   
   `CheckLockFunction.java` - Ln 184–184:
   
   `" ON \"EX\".\"HL_CATALOG\" = \"REQ\".\"HL_CATALOG\""`
   
   So the hook's lock only blocks Hive writers that use the same Iceberg 
catalog name. It doesn't block Spark, Trino or Impala, whose locks normally 
carry the metastore's default catalog , or Hive sessions using a different 
catalog name for the same table. Those writers also send no CAS when their lock 
is enabled. That leaves the same revert scenario for `ALTER TABLE ... SET 
TBLPROPERTIES`, including a manual `metadata_location` change, on lock-enabled 
tables. 


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