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 transaction contention caused by serializable transaction isolation level #237

Merged
merged 5 commits into from
Oct 1, 2020

Conversation

jframe
Copy link
Contributor

@jframe jframe commented Oct 1, 2020

This fixes an issue where failures were occurring when on updating the slashing protection db.

  • Changes the transaction isolation to read committed
  • To allow for safe updates a database lock is used against the validator id so that transactions for the same validator id are effectively done serially
  • Add transaction retry, needed for the validator registration which still using serializable transaction isolation

Copy link
Contributor

@usmansaleem usmansaleem left a comment

Choose a reason for hiding this comment

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

LGTM - minor nit-pick suggestions.

@@ -23,6 +23,7 @@
import org.jdbi.v3.core.Jdbi;
import org.jdbi.v3.core.argument.Arguments;
import org.jdbi.v3.core.mapper.ColumnMappers;
import org.jdbi.v3.core.transaction.SerializableTransactionRunner;
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

need this for the register validators as it's still using serializable

@jframe jframe merged commit 278fb37 into Consensys:master Oct 1, 2020
@jframe jframe deleted the fix_transaction_contention branch October 1, 2020 04:50
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