diff --git a/examples/gcworker/go.mod b/examples/gcworker/go.mod index 1da7b81d4d..2159df8033 100644 --- a/examples/gcworker/go.mod +++ b/examples/gcworker/go.mod @@ -30,7 +30,7 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a // indirect - github.com/tikv/pd/client v0.0.0-20240229062430-b207e514ece1 // indirect + github.com/tikv/pd/client v0.0.0-20240320081713-c00c42e77b31 // indirect github.com/twmb/murmur3 v1.1.3 // indirect go.etcd.io/etcd/api/v3 v3.5.10 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect diff --git a/examples/rawkv/go.mod b/examples/rawkv/go.mod index a0ea6f67b6..45a1c4d08f 100644 --- a/examples/rawkv/go.mod +++ b/examples/rawkv/go.mod @@ -30,7 +30,7 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a // indirect - github.com/tikv/pd/client v0.0.0-20240229062430-b207e514ece1 // indirect + github.com/tikv/pd/client v0.0.0-20240320081713-c00c42e77b31 // indirect github.com/twmb/murmur3 v1.1.3 // indirect go.etcd.io/etcd/api/v3 v3.5.10 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect diff --git a/examples/txnkv/1pc_txn/go.mod b/examples/txnkv/1pc_txn/go.mod index 70825849b9..224ff0bb6d 100644 --- a/examples/txnkv/1pc_txn/go.mod +++ b/examples/txnkv/1pc_txn/go.mod @@ -30,7 +30,7 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a // indirect - github.com/tikv/pd/client v0.0.0-20240229062430-b207e514ece1 // indirect + github.com/tikv/pd/client v0.0.0-20240320081713-c00c42e77b31 // indirect github.com/twmb/murmur3 v1.1.3 // indirect go.etcd.io/etcd/api/v3 v3.5.10 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect diff --git a/examples/txnkv/async_commit/go.mod b/examples/txnkv/async_commit/go.mod index 046d68df60..1253bbde79 100644 --- a/examples/txnkv/async_commit/go.mod +++ b/examples/txnkv/async_commit/go.mod @@ -30,7 +30,7 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a // indirect - github.com/tikv/pd/client v0.0.0-20240229062430-b207e514ece1 // indirect + github.com/tikv/pd/client v0.0.0-20240320081713-c00c42e77b31 // indirect github.com/twmb/murmur3 v1.1.3 // indirect go.etcd.io/etcd/api/v3 v3.5.10 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect diff --git a/examples/txnkv/delete_range/go.mod b/examples/txnkv/delete_range/go.mod index 704dd51dae..504dd55adf 100644 --- a/examples/txnkv/delete_range/go.mod +++ b/examples/txnkv/delete_range/go.mod @@ -30,7 +30,7 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a // indirect - github.com/tikv/pd/client v0.0.0-20240229062430-b207e514ece1 // indirect + github.com/tikv/pd/client v0.0.0-20240320081713-c00c42e77b31 // indirect github.com/twmb/murmur3 v1.1.3 // indirect go.etcd.io/etcd/api/v3 v3.5.10 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect diff --git a/examples/txnkv/go.mod b/examples/txnkv/go.mod index bb1508e216..59cb804d77 100644 --- a/examples/txnkv/go.mod +++ b/examples/txnkv/go.mod @@ -30,7 +30,7 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a // indirect - github.com/tikv/pd/client v0.0.0-20240229062430-b207e514ece1 // indirect + github.com/tikv/pd/client v0.0.0-20240320081713-c00c42e77b31 // indirect github.com/twmb/murmur3 v1.1.3 // indirect go.etcd.io/etcd/api/v3 v3.5.10 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect diff --git a/examples/txnkv/pessimistic_txn/go.mod b/examples/txnkv/pessimistic_txn/go.mod index 491287ca24..4059cefa2b 100644 --- a/examples/txnkv/pessimistic_txn/go.mod +++ b/examples/txnkv/pessimistic_txn/go.mod @@ -30,7 +30,7 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a // indirect - github.com/tikv/pd/client v0.0.0-20240229062430-b207e514ece1 // indirect + github.com/tikv/pd/client v0.0.0-20240320081713-c00c42e77b31 // indirect github.com/twmb/murmur3 v1.1.3 // indirect go.etcd.io/etcd/api/v3 v3.5.10 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect diff --git a/examples/txnkv/unsafedestoryrange/go.mod b/examples/txnkv/unsafedestoryrange/go.mod index 39450ee27e..202531c6df 100644 --- a/examples/txnkv/unsafedestoryrange/go.mod +++ b/examples/txnkv/unsafedestoryrange/go.mod @@ -30,7 +30,7 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a // indirect - github.com/tikv/pd/client v0.0.0-20240229062430-b207e514ece1 // indirect + github.com/tikv/pd/client v0.0.0-20240320081713-c00c42e77b31 // indirect github.com/twmb/murmur3 v1.1.3 // indirect go.etcd.io/etcd/api/v3 v3.5.10 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.10 // indirect diff --git a/oracle/oracle.go b/oracle/oracle.go index a72cff7c4a..b5e974c9b9 100644 --- a/oracle/oracle.go +++ b/oracle/oracle.go @@ -59,7 +59,7 @@ type Oracle interface { GetExternalTimestamp(ctx context.Context) (uint64, error) SetExternalTimestamp(ctx context.Context, ts uint64) error - GetMinTimestamp(ctx context.Context) (uint64, error) + GetMinTimestampInAllTSOGroup(ctx context.Context) (uint64, error) } // Future is a future which promises to return a timestamp. diff --git a/oracle/oracles/local.go b/oracle/oracles/local.go index 018047de01..af5f1e1a8a 100644 --- a/oracle/oracles/local.go +++ b/oracle/oracles/local.go @@ -86,7 +86,7 @@ func (l *localOracle) GetTimestamp(ctx context.Context, _ *oracle.Option) (uint6 return ts, nil } -func (l *localOracle) GetMinTimestamp(ctx context.Context) (uint64, error) { +func (l *localOracle) GetMinTimestampInAllTSOGroup(ctx context.Context) (uint64, error) { l.Lock() defer l.Unlock() now := time.Now() diff --git a/oracle/oracles/mock.go b/oracle/oracles/mock.go index 6e23bd0f47..5de3caf178 100644 --- a/oracle/oracles/mock.go +++ b/oracle/oracles/mock.go @@ -93,8 +93,8 @@ func (o *MockOracle) GetTimestamp(ctx context.Context, _ *oracle.Option) (uint64 return ts, nil } -// GetMinTimestamp implements oracle.Oracle interface. -func (o *MockOracle) GetMinTimestamp(ctx context.Context) (uint64, error) { +// GetMinTimestampInAllTSOGroup implements oracle.Oracle interface. +func (o *MockOracle) GetMinTimestampInAllTSOGroup(ctx context.Context) (uint64, error) { o.RLock() defer o.RUnlock() diff --git a/oracle/oracles/pd.go b/oracle/oracles/pd.go index 01301fd3c7..61d540034f 100644 --- a/oracle/oracles/pd.go +++ b/oracle/oracles/pd.go @@ -115,9 +115,9 @@ func (o *pdOracle) GetTimestamp(ctx context.Context, opt *oracle.Option) (uint64 return ts, nil } -// GetMinTimestamp gets a minimum timestamp for all keyspace groups. -func (o *pdOracle) GetMinTimestamp(ctx context.Context) (uint64, error) { - return o.getMinTimestamp(ctx) +// GetMinTimestampInAllTSOGroup gets a minimum timestamp for all keyspace groups. +func (o *pdOracle) GetMinTimestampInAllTSOGroup(ctx context.Context) (uint64, error) { + return o.getMinTimestampInAllTSOGroup(ctx) } type tsFuture struct { @@ -171,7 +171,7 @@ func (o *pdOracle) getTimestamp(ctx context.Context, txnScope string) (uint64, e return oracle.ComposeTS(physical, logical), nil } -func (o *pdOracle) getMinTimestamp(ctx context.Context) (uint64, error) { +func (o *pdOracle) getMinTimestampInAllTSOGroup(ctx context.Context) (uint64, error) { now := time.Now() physical, logical, err := o.c.GetMinTS(ctx) diff --git a/tikv/kv.go b/tikv/kv.go index 172f6f614e..1e483ffe3e 100644 --- a/tikv/kv.go +++ b/tikv/kv.go @@ -425,10 +425,10 @@ func (s *KVStore) CurrentTimestamp(txnScope string) (uint64, error) { return startTS, nil } -// CurrentMinTimestamp returns current timestamp across all keyspace groups. -func (s *KVStore) CurrentMinTimestamp() (uint64, error) { +// CurrentMinTimestampInAllTSOGroup returns current timestamp across all TSO groups. +func (s *KVStore) CurrentMinTimestampInAllTSOGroup() (uint64, error) { bo := retry.NewBackofferWithVars(context.Background(), transaction.TsoMaxBackoff, nil) - startTS, err := s.getMinTimestampWithRetry(bo) + startTS, err := s.getMinTimestampInAllTSOGroupWithRetry(bo) if err != nil { return 0, err } @@ -469,15 +469,15 @@ func (s *KVStore) getTimestampWithRetry(bo *Backoffer, txnScope string) (uint64, } } -func (s *KVStore) getMinTimestampWithRetry(bo *Backoffer) (uint64, error) { +func (s *KVStore) getMinTimestampInAllTSOGroupWithRetry(bo *Backoffer) (uint64, error) { if span := opentracing.SpanFromContext(bo.GetCtx()); span != nil && span.Tracer() != nil { - span1 := span.Tracer().StartSpan("TiKVStore.getMinTimestampWithRetry", opentracing.ChildOf(span.Context())) + span1 := span.Tracer().StartSpan("TiKVStore.getMinTimestampInAllTSOGroupWithRetry", opentracing.ChildOf(span.Context())) defer span1.Finish() bo.SetCtx(opentracing.ContextWithSpan(bo.GetCtx(), span1)) } for { - minTS, err := s.oracle.GetMinTimestamp(bo.GetCtx()) + minTS, err := s.oracle.GetMinTimestampInAllTSOGroup(bo.GetCtx()) if err == nil { return minTS, nil }