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

GC Txn entries through GC queue #3185

Merged
merged 2 commits into from
Nov 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions roachpb/api.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions roachpb/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ message ResolveIntentRequest {
optional Span header = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true];
// The transaction whose intent is being resolved.
optional Transaction intent_txn = 2 [(gogoproto.nullable) = false];
// Optionally poison the sequence cache for the transaction the intent's
// range.
optional bool poison = 3 [(gogoproto.nullable) = false];
}

// A ResolveIntentResponse is the return value from the
Expand All @@ -441,6 +444,9 @@ message ResolveIntentRangeRequest {
optional Span header = 1 [(gogoproto.nullable) = false, (gogoproto.embed) = true];
// The transaction whose intents are being resolved.
optional Transaction intent_txn = 2 [(gogoproto.nullable) = false];
// Optionally poison the sequence cache for the transaction on all ranges
// on which the intents reside.
optional bool poison = 3 [(gogoproto.nullable) = false];
}

// A NoopResponse is the return value from a no-op operation.
Expand Down
13 changes: 11 additions & 2 deletions roachpb/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -666,8 +666,7 @@ func (t Transaction) Short() string {
// nanoseconds since the Unix epoch.
func NewGCMetadata(nowNanos int64) *GCMetadata {
return &GCMetadata{
LastScanNanos: nowNanos,
OldestIntentNanos: proto.Int64(nowNanos),
LastScanNanos: nowNanos,
}
}

Expand Down Expand Up @@ -713,6 +712,16 @@ func (l Lease) OwnedBy(storeID StoreID) bool {
return l.Replica.StoreID == storeID
}

// AsIntents takes a slice of spans and returns it as a slice of intents for
// the given transaction.
func AsIntents(spans []Span, txn *Transaction) []Intent {
ret := make([]Intent, len(spans))
for i := range spans {
ret[i].Span, ret[i].Txn = spans[i], *txn
}
return ret
}

// RSpan is a key range with an inclusive start RKey and an exclusive end RKey.
type RSpan struct {
Key, EndKey RKey
Expand Down
33 changes: 2 additions & 31 deletions roachpb/data.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions roachpb/data.proto
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,11 @@ message Lease {

// GCMetadata holds information about the last complete key/value
// garbage collection scan of a range.
// TODO(tschottdorf): can avoid an extra message unless we're planning
// to add more content.
message GCMetadata {
// The last GC scan timestamp in nanoseconds since the Unix epoch.
optional int64 last_scan_nanos = 1 [(gogoproto.nullable) = false];
// The oldest unresolved write intent in nanoseconds since epoch.
// Null if there are no unresolved write intents.
optional int64 oldest_intent_nanos = 2;
}

// SequenceCacheEntry holds information which together with the key at which
Expand Down
Loading