forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kvserver: Add migration for interleaved intents to separated
Adds a long running migration, SeparatedIntentsMigration, that does the following steps: 1) Iterate through all range descriptors using a RangeIterator 2) Calls a new ranged write command, Barrier, that is a no-op during evaluation but waits on any other writes on that range to finish before returning 3) Call ScanInterleavedIntents, a new ranged read command, to return interleaved intents encountered over key range 4) Iterate over returned intents then push all those txns and resolve any intents returned. The barrier in step 2 ensures that no future writes after that point will write interleaved intents. The actual disabling of the setting to write interleaved intents happens in the next commit. Part of cockroachdb#41720. Release note: None.
- Loading branch information
Showing
45 changed files
with
4,695 additions
and
884 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2021 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package batcheval | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/batcheval/result" | ||
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/spanset" | ||
"github.com/cockroachdb/cockroach/pkg/roachpb" | ||
"github.com/cockroachdb/cockroach/pkg/storage" | ||
) | ||
|
||
func init() { | ||
RegisterReadWriteCommand(roachpb.Barrier, declareKeysBarrier, Barrier) | ||
} | ||
|
||
func declareKeysBarrier( | ||
rs ImmutableRangeState, | ||
h roachpb.Header, | ||
req roachpb.Request, | ||
latchSpans, lockSpans *spanset.SpanSet, | ||
) { | ||
// Barrier is special-cased in the concurrency manager to *not* actually | ||
// grab these latches. Instead, any conflicting latches with these are waited | ||
// on, but new latches aren't inserted. | ||
latchSpans.AddMVCC(spanset.SpanReadWrite, req.Header().Span(), h.Timestamp) | ||
} | ||
|
||
// Barrier evaluation is a no-op, as all the latch waiting happens in | ||
// the latch manager. | ||
func Barrier( | ||
_ context.Context, _ storage.ReadWriter, cArgs CommandArgs, response roachpb.Response, | ||
) (result.Result, error) { | ||
resp := response.(*roachpb.BarrierResponse) | ||
resp.Timestamp = cArgs.EvalCtx.Clock().Now() | ||
|
||
return result.Result{}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.