Repository navigation
test: tolerate the #414 stale index row in the Cassandra put race tests - #801
LeeroyHannigan wants to merge 1 commit into
Conversation
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
|
This may be a work-around for the problem that #424 addresses directly. Recommend holding off on this until PR 424 is merged. |
|
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. |
What
tests/test_put_item_create_race.py, on the Cassandra backend only:test_racing_puts_on_an_lsi_table_leave_only_the_final_entryrecords each round whose LSI query returns the final item's row plus other writers' rows for the same key, runs all 15 rounds, and then callspytest.xfailciting storage-cassandra: a PutItem that loses the create race can leave its LSI row behind #414. Any other mismatch fails at once, as before.test_racing_puts_on_a_gsi_table_leave_only_the_final_entrycallspytest.xfailciting storage-cassandra: a PutItem that loses the create race can leave its LSI row behind #414 when, after its 30 s wait, each key whose GSI entries are wrong has its final entry plus extra entries.XFAIL_STALE_INDEX_ROWSis true when an endpoint is set andconfigured_backend()iscassandra.devtools/run-tests --backend cassandraexportsEXTENDDB_TEST_BACKEND.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:
['l0', 'l6'] == ['l0']), and fix: validate secondary-index keys on UpdateItem and transaction writes the way the service does #416 in run 41633014419 (rowsl0andl4for one item).#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_ROWSlists what to delete once #414 is fixed.The file's
XFAIL_UNTIL_MONGODB_FIXdecorator usesraises=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.pycollects the module's 9 tests.cassandra, set tosqlite, 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.cargo test --workspaceandcargo fmt --checkwere not run.Checklist