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

kv: remove EvalContext.DB #67094

Merged
merged 1 commit into from
Jul 1, 2021
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
1 change: 0 additions & 1 deletion pkg/kv/kvserver/batcheval/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ go_library(
deps = [
"//pkg/clusterversion",
"//pkg/keys",
"//pkg/kv",
"//pkg/kv/kvserver/abortspan",
"//pkg/kv/kvserver/batcheval/result",
"//pkg/kv/kvserver/closedts",
Expand Down
5 changes: 0 additions & 5 deletions pkg/kv/kvserver/batcheval/eval_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"context"
"fmt"

"github.com/cockroachdb/cockroach/pkg/kv"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/abortspan"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/closedts"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/concurrency"
Expand Down Expand Up @@ -53,7 +52,6 @@ type EvalContext interface {

Engine() storage.Engine
Clock() *hlc.Clock
DB() *kv.DB
AbortSpan() *abortspan.AbortSpan
GetConcurrencyManager() concurrency.Manager

Expand Down Expand Up @@ -178,9 +176,6 @@ func (m *mockEvalCtxImpl) Engine() storage.Engine {
func (m *mockEvalCtxImpl) Clock() *hlc.Clock {
return m.MockEvalCtx.Clock
}
func (m *mockEvalCtxImpl) DB() *kv.DB {
panic("unimplemented")
}
func (m *mockEvalCtxImpl) AbortSpan() *abortspan.AbortSpan {
return m.MockEvalCtx.AbortSpan
}
Expand Down
9 changes: 2 additions & 7 deletions pkg/kv/kvserver/replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,11 +807,6 @@ func (r *Replica) Clock() *hlc.Clock {
return r.store.Clock()
}

// DB returns the Replica's client DB.
func (r *Replica) DB() *kv.DB {
return r.store.DB()
}

// Engine returns the Replica's underlying Engine. In most cases the
// evaluation Batch should be used instead.
func (r *Replica) Engine() storage.Engine {
Expand Down Expand Up @@ -1647,7 +1642,7 @@ func (r *Replica) maybeWatchForMergeLocked(ctx context.Context) (bool, error) {
PusheeTxn: intent.Txn,
PushType: roachpb.PUSH_ABORT,
})
if err := r.DB().Run(ctx, b); err != nil {
if err := r.store.DB().Run(ctx, b); err != nil {
select {
case <-r.store.stopper.ShouldQuiesce():
// The server is shutting down. The error while pushing the
Expand Down Expand Up @@ -1682,7 +1677,7 @@ func (r *Replica) maybeWatchForMergeLocked(ctx context.Context) (bool, error) {
var getRes *roachpb.GetResponse
for retry := retry.Start(base.DefaultRetryOptions()); retry.Next(); {
metaKey := keys.RangeMetaKey(desc.EndKey)
res, pErr := kv.SendWrappedWith(ctx, r.DB().NonTransactionalSender(), roachpb.Header{
res, pErr := kv.SendWrappedWith(ctx, r.store.DB().NonTransactionalSender(), roachpb.Header{
// Use READ_UNCOMMITTED to avoid trying to resolve intents, since
// resolving those intents might involve sending requests to this
// range, and that could deadlock. See the comment on
Expand Down
6 changes: 0 additions & 6 deletions pkg/kv/kvserver/replica_eval_context_span.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"context"

"github.com/cockroachdb/cockroach/pkg/keys"
"github.com/cockroachdb/cockroach/pkg/kv"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/abortspan"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/batcheval"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/closedts"
Expand Down Expand Up @@ -72,11 +71,6 @@ func (rec *SpanSetReplicaEvalContext) Clock() *hlc.Clock {
return rec.i.Clock()
}

// DB returns the Replica's client DB.
func (rec *SpanSetReplicaEvalContext) DB() *kv.DB {
return rec.i.DB()
}

// GetConcurrencyManager returns the concurrency.Manager.
func (rec *SpanSetReplicaEvalContext) GetConcurrencyManager() concurrency.Manager {
return rec.i.GetConcurrencyManager()
Expand Down