JingsongLi opened a new pull request, #10498: URL: https://github.com/apache/paimon/pull/10498
### Purpose Catalog locks currently guard atomic snapshot publication while reading the head, detecting conflicts and preparing manifests happen outside that scope. Acquire a table lock before reading the head and hold it through validation, preparation and publication on every attempt. APPEND and COMPACT publications use separate scopes, and post-commit callbacks run after release. Manifest replacement and rollback publication use the same contract. Expose table-bound locks through `Catalog.createLock`, carrying the table UUID, branch, exact commit user and runtime table options. `CatalogLock` extends the shared `Lock` contract while keeping the existing named callback and `CatalogLockFactory` SPI through default adapters. Nested publication reuses the current scope and checks validity before publishing. Direct `CatalogEnvironment.snapshotCommit(manager)` callers retain their existing publication-lock behavior. Longer preparation requires renewable leases: Hive heartbeats and checks the server before publication; JDBC renews and releases by an internal owner and rejects expired renewal. Zero changed-row renewal results recheck the unexpired owner rather than treating an unchanged timestamp as lost ownership. Existing JDBC lock tables receive a nullable `lock_owner` column on catalog initialization, requiring ALTER permission. All JDBC writers should upgrade before relying on owner-checked release after expiry. The client Hive transaction timeout must match the metastore timeout. This extracts the generic locking prerequisite from #10489 so the subsequent REST implementation in #10491 can use the same interfaces. It adds no REST endpoints, request models, table options or owner-aware REST rollback API. Snapshot and file conflict validation remain required; this does not add a storage fencing token. ### Tests - JDK 8 and JDK 11: 265 core tests and 6 Hive tests passed on each JDK with normal Maven checks enabled. - Coverage includes acquisition before head reads, locking every attempt, separate APPEND/COMPACT scopes, callbacks after release, invalid leases preventing publication, direct publisher and legacy factory compatibility, JDBC expiry/owner takeover/schema upgrade/changed-row reporting, Hive lease expiry, and interleaved heartbeat responses. - Updated four fault-injection factory overrides without relaxing conflict, row-ID reassignment or lost-response assertions. - MySQL/PostgreSQL container integration was not run locally because the Docker daemon is unavailable. -- 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]
