From 2755e16da88391e93622bafaa534eb92d6f6191c Mon Sep 17 00:00:00 2001 From: Davies Liu Date: Sat, 2 Apr 2022 12:43:57 +0800 Subject: [PATCH] scan keys in lineariable --- pkg/meta/tkv_etcd.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/pkg/meta/tkv_etcd.go b/pkg/meta/tkv_etcd.go index 8c376c587bab..de2b272eecbd 100644 --- a/pkg/meta/tkv_etcd.go +++ b/pkg/meta/tkv_etcd.go @@ -114,10 +114,7 @@ func (tx *etcdTxn) gets(keys ...[]byte) [][]byte { } func (tx *etcdTxn) scanRange(begin_, end_ []byte) map[string][]byte { - resp, err := tx.kv.Get(tx.ctx, - string(begin_), - etcd.WithRange(string(end_)), - etcd.WithSerializable()) + resp, err := tx.kv.Get(tx.ctx, string(begin_), etcd.WithRange(string(end_))) if err != nil { panic(fmt.Errorf("get range [%v-%v): %s", string(begin_), string(end_), err)) } @@ -145,11 +142,7 @@ func (tx *etcdTxn) scan(prefix []byte, handler func(key []byte, value []byte)) { } func (tx *etcdTxn) scanKeys(prefix []byte) [][]byte { - resp, err := tx.kv.Get(tx.ctx, - string(prefix), - etcd.WithPrefix(), - etcd.WithKeysOnly(), - etcd.WithSerializable()) + resp, err := tx.kv.Get(tx.ctx, string(prefix), etcd.WithPrefix(), etcd.WithKeysOnly()) if err != nil { panic(fmt.Errorf("get prefix %v with keys only: %s", string(prefix), err)) } @@ -165,7 +158,7 @@ func (tx *etcdTxn) scanValues(prefix []byte, limit int, filter func(k, v []byte) if limit == 0 { return nil } - resp, err := tx.kv.Get(tx.ctx, string(prefix), etcd.WithPrefix(), etcd.WithSerializable()) + resp, err := tx.kv.Get(tx.ctx, string(prefix), etcd.WithPrefix()) if err != nil { panic(fmt.Errorf("get prefix %s: %s", string(prefix), err)) } @@ -184,8 +177,7 @@ func (tx *etcdTxn) scanValues(prefix []byte, limit int, filter func(k, v []byte) } func (tx *etcdTxn) exist(prefix []byte) bool { - resp, err := tx.kv.Get(tx.ctx, string(prefix), etcd.WithPrefix(), - etcd.WithCountOnly(), etcd.WithSerializable()) + resp, err := tx.kv.Get(tx.ctx, string(prefix), etcd.WithPrefix(), etcd.WithCountOnly()) if err != nil { panic(fmt.Errorf("get prefix %v with count only: %s", string(prefix), err)) }