Skip to content

test: Give testConcurrentIncrementsWithSelectForUpdate room to retry on MariaDB - #2944

Open
Oleg Babichev (obabichevjb) wants to merge 1 commit into
mainfrom
obabichev/flaky-concurrent-increments-select-for-update
Open

Oleg Babichev (obabichevjb) wants to merge 1 commit into
mainfrom
obabichev/flaky-concurrent-increments-select-for-update

Conversation

@obabichevjb

Copy link
Copy Markdown
Collaborator

Description

Summary of the change: EntityCacheRefreshTests.testConcurrentIncrementsWithSelectForUpdate
fails intermittently on CI against MariaDB with error 1020 (ER_CHECKREAD); this gives its
transactions enough retry attempts and a randomised backoff to absorb the conflict that MariaDB's
innodb_snapshot_isolation now raises by design.

Detailed description:

  • Why: MariaDB has defaulted innodb_snapshot_isolation to ON since 11.6.2 (MDEV-35124), and
    the CI container reports 12.1.2-MariaDB with the setting ON. Under it, a locking read of a row
    that has changed since the transaction's snapshot no longer blocks and re-reads — it raises
    ER_CHECKREAD, "Record has changed since last read", and rolls the transaction back. MariaDB's
    guidance is to restart the transaction.

    This test is maximally exposed to that, and by its own design. Its first statement is a deliberate
    plain read whose only purpose is to make the DAO cache a stale value, and that read is exactly
    what establishes the transaction's snapshot:

    // This is important line, because it forces DAO to cache
    // the value from the beginning of transaction
    TestEntity.find { TestTable.id eq entityIdValue }.single()

    The forUpdate() read immediately after is the locking read. With 20 transactions incrementing a
    single row, another transaction committing inside that window is routine rather than exceptional.
    So the mechanism the test uses to prove the DAO refreshes its cache is the one that snapshot
    isolation rejects.


Type of Change

Please mark the relevant options with an "X":

  • Bug fix

Affected databases:

  • MariaDB

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant