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

   ### What changes were proposed in this pull request?
   
   The PostgreSQL `deleteTableVersionByLegacyTimeline` now selects physical 
rows with `WHERE ctid IN (SELECT ctid ... WHERE deleted_at > 0 AND deleted_at < 
#{legacyTimeline} LIMIT #{limit})`, matching the row-level delete the MySQL and 
H2 base SQL runs.
   
   ### Why are the changes needed?
   
   The previous PostgreSQL rewrite emulated `DELETE ... LIMIT` with `WHERE 
table_id IN (SELECT table_id ...)`. Because `table_version` holds one row per 
`(table_id, version)`, once any version of a table had an expired tombstone the 
delete removed every version row of that table, including the live rows, 
silently dropping the stored format, properties, partitioning, and comment of a 
live table.
   
   Fix: #13521
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Added `testLegacyTimelineDeleteKeepsLiveVersionsOfSameTable`, which seeds an 
expired tombstone plus a live version row for the same table and asserts only 
the tombstone is deleted. The regression is specific to the PostgreSQL backend, 
so the assertion exercises the fix when the suite runs against PostgreSQL; on 
H2 the base SQL is already row-level correct.


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