Skip to content

test: tolerate the #414 stale index row in the Cassandra put race tests - #801

Closed
LeeroyHannigan wants to merge 1 commit into
mainfrom
test/414-xfail-cassandra-index-race
Closed

LeeroyHannigan wants to merge 1 commit into
mainfrom
test/414-xfail-cassandra-index-race

Conversation

@LeeroyHannigan

Copy link
Copy Markdown
Collaborator

What

tests/test_put_item_create_race.py, on the Cassandra backend only:

Why

On Cassandra, each put commits the base row with a lightweight transaction and then writes its index rows in a separate batch. When puts to the same new key race, the row of a replaced item can be written after the put that replaced it deleted it (#414). Both tests then fail on PRs that change no Cassandra code, and pass on rerun:

#424 (Closes #414) is open. Until it merges, any PR's Cassandra job can fail on these two tests. The comment above XFAIL_STALE_INDEX_ROWS lists what to delete once #414 is fixed.

The file's XFAIL_UNTIL_MONGODB_FIX decorator uses raises=AssertionError. On Cassandra that would also hide a failed put, a broken chain of old images and a missing index entry, so the check is made in the test body and those still fail.

Refs #414

Testing done

  • pytest --collect-only tests/test_put_item_create_race.py collects the module's 9 tests.
  • Both tests, imported into a scratch module, ran against an in-memory client in seven modes, with the backend set to cassandra, set to sqlite, and with no endpoint:
    • cassandra: a clean index passed. Stale rows xfailed both tests, and the LSI test ran all 15 rounds. A failed put, a missing final row, a row of another key and a duplicated final row each failed. Stale rows followed by a failed put in round 5 xfailed the GSI test and failed the LSI test.
    • sqlite, and no endpoint: a clean index passed, and every mode that changes an index's contents or fails a put failed.
  • Not run against a Cassandra server here; the Cassandra CI job runs both tests on this branch.
  • No Rust code changed; cargo test --workspace and cargo fmt --check were not run.

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace)
  • Code is formatted (cargo fmt --check)

On Cassandra, each put commits the base row with a lightweight
transaction and then writes its index rows in a separate batch. When puts
to the same new key race, the row of a replaced item can be written after
the put that replaced it deleted it (#414). The LSI and GSI tests in
tests/test_put_item_create_race.py then fail on PRs that change no
Cassandra code, and pass on rerun.

On Cassandra only, each of the two tests now calls pytest.xfail citing
#414 when the stale row is its only failure: the final item's index entry
is there and the other entries are rows of the same key. The LSI test records such
rounds and goes on, so the puts, the old images and the final entry are
checked in all 15 rounds. Any other index mismatch, a failed put and a
broken chain of old images still fail there. The file's MongoDB marker
uses raises=AssertionError, which would hide those as well, so this check
is made in the test body instead.

Refs #414
@navareamol navareamol added the release-blocker Must ship for its milestone's release label Nov 3, 2026
@jcshepherd jcshepherd self-assigned this Nov 3, 2026
@jcshepherd

Copy link
Copy Markdown
Collaborator

This may be a work-around for the problem that #424 addresses directly. Recommend holding off on this until PR 424 is merged.

@jcshepherd jcshepherd added the duplicate This issue or pull request already exists label Nov 3, 2026
@jcshepherd

Copy link
Copy Markdown
Collaborator

Closing: #424 (merged as eaf16e8) fixes #414 directly, so the xfail is no longer needed.

Evidence:

Merging this now would result in a regression to #414's race condition not being surfaces as a CI failure.

@jcshepherd jcshepherd closed this Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists release-blocker Must ship for its milestone's release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

storage-cassandra: a PutItem that loses the create race can leave its LSI row behind

3 participants