Skip to content

Commit

Permalink
kv: Goland-move to kvclient/kvcoord
Browse files Browse the repository at this point in the history
Release note: None
  • Loading branch information
tbg committed Mar 9, 2020
1 parent bed2d67 commit b48fa5a
Show file tree
Hide file tree
Showing 83 changed files with 242 additions and 240 deletions.
4 changes: 2 additions & 2 deletions pkg/ccl/backupccl/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/jobs"
"github.com/cockroachdb/cockroach/pkg/jobs/jobspb"
"github.com/cockroachdb/cockroach/pkg/keys"
"github.com/cockroachdb/cockroach/pkg/kv"
"github.com/cockroachdb/cockroach/pkg/kv/kvclient/kvcoord"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/security"
Expand Down Expand Up @@ -2476,7 +2476,7 @@ func TestRestoreAsOfSystemTimeGCBounds(t *testing.T) {
Threshold: tc.Server(0).Clock().Now(),
}
if _, err := client.SendWrapped(
ctx, tc.Server(0).DistSenderI().(*kv.DistSender), &gcr,
ctx, tc.Server(0).DistSenderI().(*kvcoord.DistSender), &gcr,
); err != nil {
t.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/ccl/changefeedccl/kvfeed/kv_feed.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/gossip"
"github.com/cockroachdb/cockroach/pkg/internal/client"
"github.com/cockroachdb/cockroach/pkg/jobs/jobspb"
"github.com/cockroachdb/cockroach/pkg/kv"
"github.com/cockroachdb/cockroach/pkg/kv/kvclient/kvcoord"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
"github.com/cockroachdb/cockroach/pkg/sql"
Expand Down Expand Up @@ -83,7 +83,7 @@ func Run(ctx context.Context, cfg Config) error {
var pff physicalFeedFactory
{
sender := cfg.DB.NonTransactionalSender()
distSender := sender.(*client.CrossRangeTxnWrapperSender).Wrapped().(*kv.DistSender)
distSender := sender.(*client.CrossRangeTxnWrapperSender).Wrapped().(*kvcoord.DistSender)
pff = rangefeedFactory(distSender.RangeFeed)
}
bf := func() EventBuffer {
Expand Down
4 changes: 2 additions & 2 deletions pkg/ccl/followerreadsccl/followerreads.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/ccl/utilccl"
"github.com/cockroachdb/cockroach/pkg/internal/client"
"github.com/cockroachdb/cockroach/pkg/kv"
"github.com/cockroachdb/cockroach/pkg/kv/kvclient/kvcoord"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/closedts"
"github.com/cockroachdb/cockroach/pkg/roachpb"
Expand Down Expand Up @@ -145,5 +145,5 @@ var followerReadAwareChoice = replicaoracle.RegisterPolicy(newOracleFactory)
func init() {
sql.ReplicaOraclePolicy = followerReadAwareChoice
builtins.EvalFollowerReadOffset = evalFollowerReadOffset
kv.CanSendToFollower = canSendToFollower
kvcoord.CanSendToFollower = canSendToFollower
}
4 changes: 2 additions & 2 deletions pkg/kv/bulk/buffering_adder.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"sort"
"time"

"github.com/cockroachdb/cockroach/pkg/kv"
"github.com/cockroachdb/cockroach/pkg/kv/kvclient/kvcoord"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/storagebase"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
Expand Down Expand Up @@ -72,7 +72,7 @@ var _ storagebase.BulkAdder = &BufferingAdder{}
func MakeBulkAdder(
ctx context.Context,
db SSTSender,
rangeCache *kv.RangeDescriptorCache,
rangeCache *kvcoord.RangeDescriptorCache,
settings *cluster.Settings,
timestamp hlc.Timestamp,
opts storagebase.BulkAdderOptions,
Expand Down
4 changes: 2 additions & 2 deletions pkg/kv/bulk/sst_batcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

"github.com/cockroachdb/cockroach/pkg/clusterversion"
"github.com/cockroachdb/cockroach/pkg/keys"
"github.com/cockroachdb/cockroach/pkg/kv"
"github.com/cockroachdb/cockroach/pkg/kv/kvclient/kvcoord"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/storagebase"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/settings"
Expand Down Expand Up @@ -53,7 +53,7 @@ func (b sz) String() string {
// expensive on-split retries.
type SSTBatcher struct {
db SSTSender
rc *kv.RangeDescriptorCache
rc *kvcoord.RangeDescriptorCache
settings *cluster.Settings
maxSize func() int64
splitAfter func() int64
Expand Down
6 changes: 3 additions & 3 deletions pkg/kv/bulk/sst_batcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/internal/client"
"github.com/cockroachdb/cockroach/pkg/keys"
"github.com/cockroachdb/cockroach/pkg/kv"
"github.com/cockroachdb/cockroach/pkg/kv/kvclient/kvcoord"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/bulk"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/storagebase"
"github.com/cockroachdb/cockroach/pkg/roachpb"
Expand Down Expand Up @@ -162,12 +162,12 @@ func runTestImport(t *testing.T, batchSizeValue int64) {
// splits to exercise that codepath, but we also want to make sure we
// still handle an unexpected split, so we make our own range cache and
// only populate it with one of our two splits.
mockCache := kv.NewRangeDescriptorCache(s.ClusterSettings(), nil, func() int64 { return 2 << 10 })
mockCache := kvcoord.NewRangeDescriptorCache(s.ClusterSettings(), nil, func() int64 { return 2 << 10 })
addr, err := keys.Addr(key(0))
if err != nil {
t.Fatal(err)
}
r, _, err := s.DistSenderI().(*kv.DistSender).RangeDescriptorCache().LookupRangeDescriptorWithEvictionToken(
r, _, err := s.DistSenderI().(*kvcoord.DistSender).RangeDescriptorCache().LookupRangeDescriptorWithEvictionToken(
ctx, addr, nil, false)
if err != nil {
t.Fatal(err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"github.com/cockroachdb/cockroach/pkg/keys"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/dist_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/dist_sender_rangefeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"context"
Expand Down
32 changes: 16 additions & 16 deletions pkg/kv/kvclient/kvcoord/dist_sender_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv_test
package kvcoord_test

import (
"bytes"
Expand All @@ -25,7 +25,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/gossip"
"github.com/cockroachdb/cockroach/pkg/internal/client"
"github.com/cockroachdb/cockroach/pkg/keys"
"github.com/cockroachdb/cockroach/pkg/kv"
"github.com/cockroachdb/cockroach/pkg/kv/kvclient/kvcoord"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/storagebase"
"github.com/cockroachdb/cockroach/pkg/roachpb"
Expand Down Expand Up @@ -87,8 +87,8 @@ func TestRangeLookupWithOpenTransaction(t *testing.T) {
// Create a new DistSender and client.DB so that the Get below is guaranteed
// to not hit in the range descriptor cache forcing a RangeLookup operation.
ambient := log.AmbientContext{Tracer: s.ClusterSettings().Tracer}
ds := kv.NewDistSender(
kv.DistSenderConfig{
ds := kvcoord.NewDistSender(
kvcoord.DistSenderConfig{
AmbientCtx: ambient,
Clock: s.Clock(),
RPCContext: s.RPCContext(),
Expand All @@ -97,8 +97,8 @@ func TestRangeLookupWithOpenTransaction(t *testing.T) {
},
s.(*server.TestServer).Gossip(),
)
tsf := kv.NewTxnCoordSenderFactory(
kv.TxnCoordSenderFactoryConfig{
tsf := kvcoord.NewTxnCoordSenderFactory(
kvcoord.TxnCoordSenderFactoryConfig{
AmbientCtx: ambient,
Clock: s.Clock(),
Stopper: s.Stopper(),
Expand Down Expand Up @@ -957,8 +957,8 @@ func TestMultiRangeScanReverseScanInconsistent(t *testing.T) {
} {
manual := hlc.NewManualClock(ts[0].WallTime + 1)
clock := hlc.NewClock(manual.UnixNano, time.Nanosecond)
ds := kv.NewDistSender(
kv.DistSenderConfig{
ds := kvcoord.NewDistSender(
kvcoord.DistSenderConfig{
AmbientCtx: log.AmbientContext{Tracer: s.ClusterSettings().Tracer},
Clock: clock,
RPCContext: s.RPCContext(),
Expand Down Expand Up @@ -1014,7 +1014,7 @@ func TestParallelSender(t *testing.T) {
}

getPSCount := func() int64 {
return s.DistSenderI().(*kv.DistSender).Metrics().AsyncSentCount.Count()
return s.DistSenderI().(*kvcoord.DistSender).Metrics().AsyncSentCount.Count()
}
psCount := getPSCount()

Expand Down Expand Up @@ -1163,8 +1163,8 @@ func TestBatchPutWithConcurrentSplit(t *testing.T) {

// Now, split further at the given keys, but use a new dist sender so
// we don't update the caches on the default dist sender-backed client.
ds := kv.NewDistSender(
kv.DistSenderConfig{
ds := kvcoord.NewDistSender(
kvcoord.DistSenderConfig{
AmbientCtx: log.AmbientContext{Tracer: s.ClusterSettings().Tracer},
Clock: s.Clock(),
RPCContext: s.RPCContext(),
Expand Down Expand Up @@ -1686,7 +1686,7 @@ func TestTxnCoordSenderRetries(t *testing.T) {
// This is not an issue because we refresh before tracking their
// spans.
keybase := strings.Repeat("a", 1024)
maxRefreshBytes := kv.MaxTxnRefreshSpansBytes.Get(&s.ClusterSettings().SV)
maxRefreshBytes := kvcoord.MaxTxnRefreshSpansBytes.Get(&s.ClusterSettings().SV)
scanToExceed := int(maxRefreshBytes) / len(keybase)
b := txn.NewBatch()
// Hit the uncertainty error at the beginning of the batch.
Expand Down Expand Up @@ -1722,7 +1722,7 @@ func TestTxnCoordSenderRetries(t *testing.T) {
// account for them. The txn has no refresh spans, so it can
// forward its timestamp while committing.
keybase := strings.Repeat("a", 1024)
maxRefreshBytes := kv.MaxTxnRefreshSpansBytes.Get(&s.ClusterSettings().SV)
maxRefreshBytes := kvcoord.MaxTxnRefreshSpansBytes.Get(&s.ClusterSettings().SV)
scanToExceed := int(maxRefreshBytes) / len(keybase)
b := txn.NewBatch()
for i := 0; i < scanToExceed; i++ {
Expand Down Expand Up @@ -1756,7 +1756,7 @@ func TestTxnCoordSenderRetries(t *testing.T) {
// account for them until the final batch, at which time we
// perform a span refresh and successfully commit.
keybase := strings.Repeat("a", 1024)
maxRefreshBytes := kv.MaxTxnRefreshSpansBytes.Get(&s.ClusterSettings().SV)
maxRefreshBytes := kvcoord.MaxTxnRefreshSpansBytes.Get(&s.ClusterSettings().SV)
scanToExceed := int(maxRefreshBytes) / len(keybase)
b := txn.NewBatch()
for i := 0; i < scanToExceed; i++ {
Expand Down Expand Up @@ -2418,7 +2418,7 @@ func TestTxnCoordSenderRetries(t *testing.T) {
defer filterFn.Store((func(storagebase.FilterArgs) *roachpb.Error)(nil))
}

var metrics kv.TxnMetrics
var metrics kvcoord.TxnMetrics
var lastAutoRetries int64
var hadClientRetry bool
epoch := 0
Expand All @@ -2444,7 +2444,7 @@ func TestTxnCoordSenderRetries(t *testing.T) {
}
}

metrics = txn.Sender().(*kv.TxnCoordSender).TxnCoordSenderFactory.Metrics()
metrics = txn.Sender().(*kvcoord.TxnCoordSender).TxnCoordSenderFactory.Metrics()
lastAutoRetries = metrics.AutoRetries.Count()

return tc.retryable(ctx, txn)
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/dist_sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ Package kv implements the logic necessary to locate appropriate nodes
based on keys being read or written. In some cases, requests may span
a range of keys, in which case multiple RPCs may be sent out.
*/
package kv
package kvcoord
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv_test
package kvcoord_test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/leaseholder_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/leaseholder_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/local_test_cluster_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv_test
package kvcoord_test

import (
"os"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/range_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/range_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/range_iter.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/range_iter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/replica_slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/replica_slice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/send_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/split_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package kv
package kvcoord

import (
"context"
Expand Down
Loading

0 comments on commit b48fa5a

Please sign in to comment.