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

fix(mysql): index gap lock deadlock #12119

Merged

Conversation

david-leifker
Copy link
Collaborator

@david-leifker david-leifker commented Dec 13, 2024

Effects MySQL

Fix a condition where multiple transactions concurrently inserting new rows within the same index gap would result in a deadlock. Further details on the condition can be found here.

The solution involves changing the isolation level to READ_COMMITTED and relying on the read locks which were added using "select for update"

Added a smoke-test case with interleaved URNs with transaction concurrency.

Database transaction handling for all databases

  • Extend "for update" to the default aspects logic
  • Default aspects, if determined to exist later in the transaction will drop without exception
  • Validation exceptions conditional depending on the transaction's batch origin.
    • Client's synchronous request will return a validation exception and abort the transaction to the client per previous behavior
    • If the batch is a batch of MCPs read by the mce-consumer, a validation exception will not impact the entire batch to prevent non-related MCPs from being impacted by 1 validation error. This is disabled by default: MCP_CONSUMER_BATCH_ENABLED is not enabled by default.

Feature

Added header support to CREATE/CREATE_ENTITY change types to allow non-exception behavior if the write should be silently dropped if the CREATE/CREATE_ENTITY check fails. Clients can determine if the case is an error or simply ignored.

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

@github-actions github-actions bot added product PR or Issue related to the DataHub UI/UX smoke_test Contains changes related to smoke tests labels Dec 13, 2024
@datahub-cyborg datahub-cyborg bot added the pending-submitter-response Issue/request has been reviewed but requires a response from the submitter label Dec 13, 2024
@datahub-cyborg datahub-cyborg bot added pending-submitter-merge and removed pending-submitter-response Issue/request has been reviewed but requires a response from the submitter labels Dec 13, 2024
@david-leifker david-leifker force-pushed the fix-mysql-deadlock branch 2 times, most recently from 87b06ec to 0542177 Compare December 14, 2024 02:34
@david-leifker david-leifker merged commit ab15fb9 into datahub-project:master Dec 14, 2024
45 of 46 checks passed
sleeperdeep pushed a commit to sleeperdeep/datahub that referenced this pull request Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-submitter-merge product PR or Issue related to the DataHub UI/UX release-0.15.0 smoke_test Contains changes related to smoke tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants