Repository navigation
Conversation
Smart test selectionpytest smoke testsMode: shadow. The selection below is computed but not applied; this PR still runs the default matrix (
Medium confidence: a wrong tag means tests are skipped, so check the tags above against what this PR touches. Selected scopes (25 files or classes, 125 tests)
Add the Playwright E2E testsThis run:
Specs selected because of this PR (6)
Add the commit |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
PR SummaryOverview This adds
Reviewed by Cursor Bugbot for commit 9d0e626. Bugbot is set up for automated code reviews on this repo. Configure here. |
…belongs to another run A hard rollback deletes an entity the run created only while the run still owns all of it. EntityServiceImpl.ownedOnlyByRun reads only the aspects this version's registry knows, so after a rollback it missed an aspect only the newer version knows, written under another run: the entity was deleted with that row, although the dry run (built from the system-metadata index) said it would be kept. With entity and aspect tolerance on, ownedOnlyByRun now also reads the latest row of every aspect stored for the urn (new AspectDao.getLatestRowsOfUrn; Ebean through the routing seam, Cassandra within the urn's partition) and keeps the entity if one of the unknown aspects other than status belongs to someone else. With tolerance off nothing changes.
a28c339 to
9d0e626
Compare
Follows #20280. After a zero-downtime upgrade rollback, a hard rollback of an ingestion run keeps the entity the run created when a newer version's row on it belongs to another run, instead of deleting that row with the entity. Only applies with entity and aspect tolerance on, which is off by default.
What was wrong
EntityServiceImpl.ownedOnlyByRunmakes that check, and it reads only the aspects this version's registry knows.DELETE … WHERE urn = ?. On Cassandra it was introduced by fix(zdu): tolerate unknown entity types, aspects and references after a rollback #20280, whose tolerant delete removes the whole partition so that a newer version's rows don't come back after re-upgrading.Changes
AspectDao.getLatestRowsOfUrn(new): the latest row of every aspect stored for a urn, as stored, including aspects the registry doesn't know.WHERE urn = :urn AND version = 0, through the routing seam likebatchGet(table fromtableResolver, database fromresolveBatchGetDatabasewith write intent, since the caller decides a delete from it).version = 0.EntityServiceImpl.ownedOnlyByRun: while entity and aspect tolerance is on, it also reads those rows for aspects the registry doesn't know. The entity is kept if any of them, other thanstatus, belongs to someone other than the run. Those rows are read without a lock; the rows the registry knows are still locked, as before. The run's own aspects are still rolled back one by one, as for any kept entity.docs/how/breaking-changes.md: an entry for the change.Flags off
Gated on entity and aspect tolerance, so with it off nothing changes, including the MySQL behaviour that predates #20280. It only ever makes the rollback keep more, never delete more.
Testing
EntityServiceTest, run for Ebean (H2) and Cassandra (Testcontainers): another run's newer-version row keeps the entity and the row; the run's own newer-version row lets the entity be deleted, row included; with strict handling the entity is deleted as before. The "keeps" test fails without the fix.EbeanAspectDaoSeamRoutingTest: the new read resolves the table and transaction scope from the caller's context, and returns every latest row of the urn (including an unknown aspect) and no older versions or other urns.EbeanEntityServiceTest180,CassandraEntityServiceTest82,CassandraAspectDaoTest32,AspectDaoTest13,EbeanAspectDaoSeamRoutingTest5,EbeanAspectDaoTransactionRetryTest6,EbeanTimelineServiceTest3,CassandraTimelineServiceTest3: all pass.entitiesDeleted: 0entitiesDeleted: 1)entitiesDeleted: 0)datasetKeyand R2's rowWith tolerance off, the branch matches master, including the MySQL behaviour that predates #20280. Cassandra is covered by the Testcontainers tests, not a live deployment.
Performance
With entity and aspect tolerance on: one extra read per hard rollback of a run-created entity, and only once every row the registry knows belongs to the run. On Cassandra the
version = 0filter needsALLOW FILTERING, so it reads the urn's partition, older versions included.Questions for reviewers