Skip to content

Conversation

@katzyn
Copy link
Contributor

@katzyn katzyn commented Jul 31, 2024

Closes #3894.

There were two query cache related races with identical manifestation.

  1. A simple one. Table and database data modification id was updated before actual data modification, so it was possible to associate an old data with the new data modification id in a query cache.

  2. A complex one:

  • Connection 1 starts a query and takes snapshot of all related tables.
  • Connection 2 modifies a row in this table and commits this modification.
  • The query from connection 1 takes data modification ID already modified by connection 2.
  • The query is executed over this already outdated snapshot and results are put into cache with new data modification ID and old data.
  • Connection 1 executes the same queries again and again, new snapshots contain changes from connection 2, but queries take the same data modification id every time and therefore return an outdated cached result until some other modification arrives.

@katzyn katzyn merged commit 253177a into h2database:master Jul 31, 2024
@katzyn katzyn deleted the concurrency branch July 31, 2024 12:57
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.

Race condition causing stale data in query last result cache

1 participant