LuciferYang opened a new pull request, #10270:
URL: https://github.com/apache/paimon/pull/10270

   ### Purpose
   
   `JdbcCatalog` mishandled three failure paths.
   
   1. Cascade `dropDatabaseImpl` removed only the four JDBC row sets and never 
deleted the database directory, leaking `warehouse/<db>.db/` (schema and data) 
and desyncing the catalog from the filesystem. Recreating the same database and 
table then collided with the stale `schema-0`. It now deletes the directory, 
matching `FileSystemCatalog`. This runs only after the `dropDatabase` override 
has already done the existence and cascade/empty checks, so the recursive 
delete is safe.
   
   2. `alterDatabaseImpl` did no existence check: altering a missing database 
with `ignoreIfNotExists = false` inserted a property row and returned success 
instead of throwing `DatabaseNotExistException`, and `databaseExists` then 
reported the database as present, materializing a phantom database. It now 
verifies existence first.
   
   3. `createTableImplWithLock` leaked the created directory when a create 
failed after the schema was committed to the filesystem but before the JDBC row 
was inserted. It now removes the directory on that path, guarded so it deletes 
only a directory this call created and then failed to register (a 
`schemaCreated` flag combined with the existing `registered` flag). A table 
that already exists on the filesystem but is absent from the JDBC catalog (the 
state `repairTable` recovers) is left untouched.
   
   This closes #10269.
   
   ### Tests
   
   - `testDropDatabaseCascadeDeletesWarehouseDirectory` pins that a cascade 
drop removes the database directory.
   - `testAlterDatabaseOnMissingDatabaseThrows` pins that altering a missing 
database throws instead of creating a phantom entry.
   - `testCreateTablePreservesUnregisteredOnDiskTableOnFailure` pins that a 
failed create does not delete a pre-existing on-disk table that is absent from 
the JDBC catalog, and that it stays recoverable via `repairTable`.
   
   ### API and Format
   
   No.
   
   ### Documentation
   
   No.
   


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