Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dummy writes for get-all to check the confict #126

Merged
merged 1 commit into from
May 31, 2024
Merged

Conversation

yito88
Copy link
Member

@yito88 yito88 commented May 25, 2024

Description

The get-all transaction to get all records for the consistency check gets some inconsistency results.
In a Jepsen test, the final-generator generates the operation after the main generator finishes, but it doesn't check the completion.
So, get-all generated by final-generator could start before the all transactions were completed.
They were just a read-only transactions and didn't check the conflict with in-flight transactions.

This PR adds the dummy writes to these get-all transactions to check the conflict.

Related issues and/or PRs

Changes made

  • Add dummy writes and commit to get-all transactions

Checklist

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

Provide any additional information or notes that may be relevant to the reviewers or stakeholders.

Comment on lines +133 to +140
;; Need Storage API to read the transaction metadata
(let [tx-result (.get tx (prepare-get i))
result (.get storage (prepare-get i))]
;; Put the same balance to check conflicts with in-flight transactions
(->> (calc-new-balance tx-result 0)
(prepare-put i)
(.put tx))
result)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I missed something, but I thought the transactional Get can also detect conflicts with in-flight transactions (by throwing UncommittedRecordException). Why do we need this additional dummy write?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read skew could happen because this is a read-only transaction when the isolation level is snapshot isolation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. So it's like a manual EXTRA_WRITE. Thanks.

Copy link
Contributor

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@feeblefakie feeblefakie merged commit b3d1e66 into master May 31, 2024
3 checks passed
@feeblefakie feeblefakie deleted the fix/get-all branch May 31, 2024 02:10
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.

3 participants