Skip to content

kv: check for 1-phase commit after request, not before #41104

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

Merged
merged 1 commit into from
Sep 26, 2019

Conversation

nvanbenschoten
Copy link
Contributor

@nvanbenschoten nvanbenschoten commented Sep 26, 2019

Found while verifying that #40518 didn't negatively impact YCSB performance.
As it turns out, most txns that restart hit the check in DistSender instead,
and that ends up being critical for forward progress. Without it, transactions
appear to starve because they never write intents.

The commit doesn't make any changes there, but it does fix an issue where
1PC transactions were being incorrectly detected. The detection was ignoring
the fact that a 1PC attempt could be rejected by DistSender or a Replica.
We now tie the metric to whether an EndTransaction actually evaluated as
a 1PC txn instead of tying it to whether the EndTransaction wanted to
be evaluated as a 1PC txn.

Release justification: low risk and improves metric reporting

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@tbg tbg left a comment

Choose a reason for hiding this comment

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

I stared at this a bunch but still not sure I got it right. The previous code counted 1PC attempts instead of successes? I know that DistSender will prevent 1PC when the epoch is not zero any more. Are you saying that without that behavior there's starvation? Shouldn't the 1PC attempt at the replica also lay down an intent if it doesn't go through?

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @andreimatei)

Copy link
Contributor

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

LGTM

Tobi, this PR is strictly for the 1PC metric. Before the patch, we'd count 1pc attempts, with the patch we count 1pc successes.

Nathan, it does appear that that commit message could be improved :P

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @andreimatei)

Found while verifying that cockroachdb#40518 didn't negatively impact YCSB performance.
As it turns out, most txns that restart hit the check in DistSender instead,
and that ends up being critical for forward progress. Without it, transactions
appear to starve because they never write intents.

The commit doesn't make any changes there, but it does fix an issue where
1PC transactions were being incorrectly detected. The detection was ignoring
the fact that a 1PC attempt could be rejected by DistSender or a Replica.
We now tie the metric to whether an EndTransaction actually evaluated as
a 1PC txn instead of tying it to whether the EndTransaction _wanted_ to
be evaluated as a 1PC txn.

Release justification: low risk and improves metric reporting

Release note: None
@nvanbenschoten nvanbenschoten force-pushed the nvanbenschoten/1pcMetric branch from 2dc1504 to 2dc5eb8 Compare September 26, 2019 16:26
@nvanbenschoten
Copy link
Contributor Author

Nathan, it does appear that that commit message could be improved :P

Ah yes, you're right. I guess I still had the experiment on my mind and didn't realize I had failed to mention what the PR was actually changing. Updated.

@nvanbenschoten
Copy link
Contributor Author

bors r+

craig bot pushed a commit that referenced this pull request Sep 26, 2019
41098: roachtest/jepsen: don't fail test if retrieving invoke.log fails r=nvanbenschoten a=nvanbenschoten

Fixes #41062.

Release justification: Testing only.

Release note: None

41104: kv: check for 1-phase commit after request, not before r=nvanbenschoten a=nvanbenschoten

Found while verifying that #40518 didn't negatively impact YCSB performance.
As it turns out, most txns that restart hit the check in DistSender instead,
and that ends up being critical for forward progress. Without it, transactions
appear to starve because they never write intents.

The commit doesn't make any changes there, but it does fix an issue where
1PC transactions were being incorrectly detected. The detection was ignoring
the fact that a 1PC attempt could be rejected by DistSender or a Replica.
We now tie the metric to whether an EndTransaction actually evaluated as
a 1PC txn instead of tying it to whether the EndTransaction _wanted_ to
be evaluated as a 1PC txn.

Release justification: low risk and improves metric reporting

Release note: None

41127: Add myself to AUTHORS r=miretskiy a=miretskiy

Authors += Myself

Co-authored-by: Nathan VanBenschoten <[email protected]>
Co-authored-by: Yevgeniy Miretskiy <[email protected]>
@craig
Copy link
Contributor

craig bot commented Sep 26, 2019

Build succeeded

@craig craig bot merged commit 2dc5eb8 into cockroachdb:master Sep 26, 2019
@nvanbenschoten nvanbenschoten deleted the nvanbenschoten/1pcMetric branch October 17, 2019 20:42
nvanbenschoten added a commit to nvanbenschoten/cockroach that referenced this pull request Dec 4, 2019
This was no longer true, as of cockroachdb#41104.

Release note: None
nvanbenschoten added a commit to nvanbenschoten/cockroach that referenced this pull request Dec 4, 2019
This was no longer true, as of cockroachdb#41104.

Release note: None
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.

4 participants