Skip to content

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

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/1pcMetric
Sep 26, 2019
Merged

kv: check for 1-phase commit after request, not before#41104
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/1pcMetric

Conversation

@nvb
Copy link
Copy Markdown
Contributor

@nvb nvb 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

@nvb nvb requested a review from andreimatei September 26, 2019 01:42
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
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
Copy Markdown
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
@nvb nvb force-pushed the nvanbenschoten/1pcMetric branch from 2dc1504 to 2dc5eb8 Compare September 26, 2019 16:26
@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Sep 26, 2019

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.

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Sep 26, 2019

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 <nvanbenschoten@gmail.com>
Co-authored-by: Yevgeniy Miretskiy <yevgeniy@cockroachlabs.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Sep 26, 2019

Build succeeded

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

Release note: None
nvb added a commit to nvb/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