Skip to content

storage: remove span declaration for merges#40261

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
irfansharif:merge-spans-cleanup
Sep 3, 2019
Merged

storage: remove span declaration for merges#40261
craig[bot] merged 1 commit intocockroachdb:masterfrom
irfansharif:merge-spans-cleanup

Conversation

@irfansharif
Copy link
Copy Markdown
Contributor

@irfansharif irfansharif commented Aug 27, 2019

Prior to #28661, we used to include a snapshot of the RHS in the merge
trigger. Due to this, we declared a read only span over the RHS data
range. Now that we require ranges to be collocated during merges, we
didn't need to include the snapshot nor declare the span.
Also informs #32583.

Orthogonal to this are Subsume requests that block out concurrent
commands to the RHS, with the appropriate span declarations contained
therein.

Release note: None

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@irfansharif irfansharif force-pushed the merge-spans-cleanup branch 2 times, most recently from f1e52bc to 31e4f48 Compare August 29, 2019 19:41
@irfansharif irfansharif changed the title [dnr,dnm] storage: remove span declaration for merges storage: remove span declaration for merges Aug 29, 2019
@irfansharif irfansharif requested review from ajwerner and nvb August 29, 2019 19:45
@irfansharif
Copy link
Copy Markdown
Contributor Author

(Friendly ping.)

Copy link
Copy Markdown
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

Mostly comment nits.

It seems like this change makes merges less likely to block on pending writes. This change doesn't actually make merges less disruptive to other writes, right? If anything it seems like this change may lead to extra work for commands destined to fail after the merge applies. Any command which is evaluated prior to the merge before this change would lead to the merge blocking on its latches so that will be relieved. However, if I read this correctly, any command which will now be free to evaluate after the merge (and isn't reordered before it) will be destined to fail to apply and thus we'll end up replicating commands for no good reason.

Reviewed 2 of 3 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @ajwerner, @irfansharif, and @nvanbenschoten)


pkg/roachpb/data.go, line 173 at r1 (raw file):

// PrefixEnd determines the end key given key as a prefix, that is the
// key that sorts precisely behind all keys starting with prefix: "1"
// is added to the final byte and then carry propagated. The special

I think this was more correct before.


pkg/storage/batcheval/cmd_end_transaction.go, line 127 at r1 (raw file):

			}
			if mt := et.InternalCommitTrigger.MergeTrigger; mt != nil {
				// Merges only copy over the RHS abort span to the LHS, and computes

nit: s/computes/compute/ there's subject-verb number problem here with computes.

super nit: only doesn't add much meaning to me here.


pkg/storage/batcheval/cmd_end_transaction.go, line 1027 at r1 (raw file):

// mergeTrigger is called on a successful commit of an AdminMerge transaction.
// It recomputes stats for the LHS by merging in RHS stats, and copies over the

nit: calculates to me is clearer than recomputes which is the term we use to mean scanning the data to compute the stats.

@ajwerner
Copy link
Copy Markdown
Contributor

ajwerner commented Sep 3, 2019

This "destined to fail" comment I made now seems wrong. Rather, it's not clear how a write outside of the LHS's prior key range could be evaluated until the merge has been applied. I suppose there's an instant after which the merge has been applied before it has been acknowleged during which we'll not allow a proposal to be evaluated but by the time the updated range descriptor is visible to a request all durable work to the engine is done. I think I'm convinced that my previous concerns don't make sense.

Prior to cockroachdb#28661, we used to include a snapshot of the RHS in the merge
trigger. Due to this, we declared a read only span over the RHS data
range. Now that we require ranges to be collocated during merges, we
didn't need to include the snapshot nor declare the span.

Orthogonal to this are Subsume requests that block out concurrent
commands to the RHS, with the appropriate span declarations contained
therein.

Release note: None
Copy link
Copy Markdown
Contributor Author

@irfansharif irfansharif left a comment

Choose a reason for hiding this comment

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

Resolved comment nits.

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

Copy link
Copy Markdown
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

:lgtm: thanks for pushing on this

Reviewed 2 of 2 files at r2.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @nvanbenschoten)

@irfansharif
Copy link
Copy Markdown
Contributor Author

bors r+

craig bot pushed a commit that referenced this pull request Sep 3, 2019
40261: storage: remove span declaration for merges r=irfansharif a=irfansharif

Prior to #28661, we used to include a snapshot of the RHS in the merge
trigger. Due to this, we declared a read only span over the RHS data
range. Now that we require ranges to be collocated during merges, we
didn't need to include the snapshot nor declare the span. 
Also informs #32583.

Orthogonal to this are Subsume requests that block out concurrent
commands to the RHS, with the appropriate span declarations contained
therein.

Release note: None

Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Sep 3, 2019

Build succeeded

@craig craig bot merged commit 0e9bb0c into cockroachdb:master Sep 3, 2019
@irfansharif irfansharif deleted the merge-spans-cleanup branch September 3, 2019 21:57
@nvb
Copy link
Copy Markdown
Contributor

nvb commented Sep 3, 2019

Sorry about letting this review sit @irfansharif. The change LGTM based on my understanding of the synchronization before and after a merge trigger is applied, but I don't think we want to risk it for the next release given that we're in the stability period and there's not a pressing need to get this in. Do you mind reverting it temporarily until the release branch is cut and master opens back up for risky changes?

irfansharif added a commit to irfansharif/cockroach that referenced this pull request Sep 3, 2019
Reverts cockroachdb#40261. Holding off until release branch is cut.

Release note: None
@irfansharif irfansharif restored the merge-spans-cleanup branch September 3, 2019 22:10
@irfansharif
Copy link
Copy Markdown
Contributor Author

Sure, #40446.

craig bot pushed a commit that referenced this pull request Sep 3, 2019
40446: Revert "storage: remove span declaration for merges" r=irfansharif a=irfansharif

Reverts #40261. Holding off until release branch is cut.

Release note: None

Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
@irfansharif irfansharif deleted the merge-spans-cleanup branch September 24, 2019 18:30
craig bot pushed a commit that referenced this pull request Nov 11, 2019
41036: storage: remove span declaration for merges r=ajwerner a=irfansharif

I'm just re-sending #40261 (reverted in #40446). These changes are 
intended for 20.1 and will not be merged until after branching.

---

Prior to #28661, we used to include a snapshot of the RHS in the merge
trigger. Due to this, we declared a read only span over the RHS data
range. Now that we require ranges to be collocated during merges, we
didn't need to include the snapshot nor declare the span.

Orthogonal to this are Subsume requests that block out concurrent
commands to the RHS, with the appropriate span declarations contained
therein.

Release justification: N/A
Release note: None

Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
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