未验证 提交 c25b337c 编写于 作者: J jaime 提交者: GitHub

Remove AddTenant from meta table (#16717)

Signed-off-by: Nyun.zhang <yun.zhang@zilliz.com>
上级 0b5a593d
......@@ -554,17 +554,6 @@ In most cases, a data definition task need to
###### 6.6.1 Meta
- Tenant Meta
```protobuf
message TenantMeta {
uint64 id = 1;
uint64 num_query_nodes = 2;
repeated string insert_channel_names = 3;
string query_channel_name = 4;
}
```
- Proxy Meta
```protobuf
......@@ -621,7 +610,6 @@ message SegmentIndexInfo {
###### 6.6.2 KV pairs in EtcdKV
```go
"tenant/$tenantId" string -> tenantMetaBlob string
"proxy/$proxyId" string -> proxyMetaBlob string
"collection/$collectionId" string -> collectionInfoBlob string
"partition/$collectionId/$partitionId" string -> partitionInfoBlob string
......@@ -631,7 +619,7 @@ message SegmentIndexInfo {
Note that _tenantId_, _proxyId_, _collectionId_, _partitionId_, _indexId_, _segmentId_ are unique strings converted from int64.
_tenantMetaBlob_, _proxyMetaBlob_, _collectionInfoBlob_, _partitionInfoBlob_, _IndexInfoBlob_, _segmentIndexInfoBlog_ are serialized protos.
_proxyMetaBlob_, _collectionInfoBlob_, _partitionInfoBlob_, _IndexInfoBlob_, _segmentIndexInfoBlog_ are serialized protos.
###### 6.6.3 Meta Table
......@@ -639,7 +627,6 @@ _tenantMetaBlob_, _proxyMetaBlob_, _collectionInfoBlob_, _partitionInfoBlob_, _I
type metaTable struct {
txn kv.TxnKV // client of a reliable txnkv service, i.e. etcd client
snapshot kv.SnapShotKV // client of a reliable snapshotkv service, i.e. etcd client
tenantID2Meta map[typeutil.UniqueID]pb.TenantMeta // tenant id to tenant meta
proxyID2Meta map[typeutil.UniqueID]pb.ProxyMeta // proxy id to proxy meta
collID2Meta map[typeutil.UniqueID]pb.CollectionInfo // collection_id -> meta
collName2ID map[string]typeutil.UniqueID // collection name to collection id
......@@ -648,14 +635,12 @@ type metaTable struct {
segID2IndexMeta map[typeutil.UniqueID]map[typeutil.UniqueID]pb.SegmentIndexInfo // collection_id/index_id/partition_id/segment_id -> meta
indexID2Meta map[typeutil.UniqueID]pb.IndexInfo // collection_id/index_id -> meta
tenantLock sync.RWMutex
proxyLock sync.RWMutex
ddLock sync.RWMutex
}
func NewMetaTable(kv kv.SnapShotKV) (*metaTable, error)
func (mt *metaTable) AddTenant(te *pb.TenantMeta) (typeutil.Timestamp, error)
func (mt *metaTable) AddProxy(po *pb.ProxyMeta) (typeutil.Timestamp, error)
func (mt *metaTable) AddCollection(coll *pb.CollectionInfo, part *pb.PartitionInfo, idx []*pb.IndexInfo, ddOpStr func(ts typeutil.Timestamp) (string, error)) (typeutil.Timestamp, error)
func (mt *metaTable) DeleteCollection(collID typeutil.UniqueID, ddOpStr func(ts typeutil.Timestamp) (string, error)) (typeutil.Timestamp, error)
......
......@@ -5,13 +5,6 @@ option go_package="github.com/milvus-io/milvus/internal/proto/etcdpb";
import "common.proto";
import "schema.proto";
message TenantMeta {
int64 ID = 1;
int64 num_query_nodes = 2;
repeated string insert_channelIDs = 3;
string query_channelID = 4;
}
message ProxyMeta {
int64 ID = 1;
common.Address address = 2;
......
......@@ -22,69 +22,6 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type TenantMeta struct {
ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
NumQueryNodes int64 `protobuf:"varint,2,opt,name=num_query_nodes,json=numQueryNodes,proto3" json:"num_query_nodes,omitempty"`
InsertChannelIDs []string `protobuf:"bytes,3,rep,name=insert_channelIDs,json=insertChannelIDs,proto3" json:"insert_channelIDs,omitempty"`
QueryChannelID string `protobuf:"bytes,4,opt,name=query_channelID,json=queryChannelID,proto3" json:"query_channelID,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *TenantMeta) Reset() { *m = TenantMeta{} }
func (m *TenantMeta) String() string { return proto.CompactTextString(m) }
func (*TenantMeta) ProtoMessage() {}
func (*TenantMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_975d306d62b73e88, []int{0}
}
func (m *TenantMeta) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TenantMeta.Unmarshal(m, b)
}
func (m *TenantMeta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TenantMeta.Marshal(b, m, deterministic)
}
func (m *TenantMeta) XXX_Merge(src proto.Message) {
xxx_messageInfo_TenantMeta.Merge(m, src)
}
func (m *TenantMeta) XXX_Size() int {
return xxx_messageInfo_TenantMeta.Size(m)
}
func (m *TenantMeta) XXX_DiscardUnknown() {
xxx_messageInfo_TenantMeta.DiscardUnknown(m)
}
var xxx_messageInfo_TenantMeta proto.InternalMessageInfo
func (m *TenantMeta) GetID() int64 {
if m != nil {
return m.ID
}
return 0
}
func (m *TenantMeta) GetNumQueryNodes() int64 {
if m != nil {
return m.NumQueryNodes
}
return 0
}
func (m *TenantMeta) GetInsertChannelIDs() []string {
if m != nil {
return m.InsertChannelIDs
}
return nil
}
func (m *TenantMeta) GetQueryChannelID() string {
if m != nil {
return m.QueryChannelID
}
return ""
}
type ProxyMeta struct {
ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"`
Address *commonpb.Address `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
......@@ -98,7 +35,7 @@ func (m *ProxyMeta) Reset() { *m = ProxyMeta{} }
func (m *ProxyMeta) String() string { return proto.CompactTextString(m) }
func (*ProxyMeta) ProtoMessage() {}
func (*ProxyMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_975d306d62b73e88, []int{1}
return fileDescriptor_975d306d62b73e88, []int{0}
}
func (m *ProxyMeta) XXX_Unmarshal(b []byte) error {
......@@ -153,7 +90,7 @@ func (m *IndexInfo) Reset() { *m = IndexInfo{} }
func (m *IndexInfo) String() string { return proto.CompactTextString(m) }
func (*IndexInfo) ProtoMessage() {}
func (*IndexInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_975d306d62b73e88, []int{2}
return fileDescriptor_975d306d62b73e88, []int{1}
}
func (m *IndexInfo) XXX_Unmarshal(b []byte) error {
......@@ -207,7 +144,7 @@ func (m *FieldIndexInfo) Reset() { *m = FieldIndexInfo{} }
func (m *FieldIndexInfo) String() string { return proto.CompactTextString(m) }
func (*FieldIndexInfo) ProtoMessage() {}
func (*FieldIndexInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_975d306d62b73e88, []int{3}
return fileDescriptor_975d306d62b73e88, []int{2}
}
func (m *FieldIndexInfo) XXX_Unmarshal(b []byte) error {
......@@ -264,7 +201,7 @@ func (m *CollectionInfo) Reset() { *m = CollectionInfo{} }
func (m *CollectionInfo) String() string { return proto.CompactTextString(m) }
func (*CollectionInfo) ProtoMessage() {}
func (*CollectionInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_975d306d62b73e88, []int{4}
return fileDescriptor_975d306d62b73e88, []int{3}
}
func (m *CollectionInfo) XXX_Unmarshal(b []byte) error {
......@@ -386,7 +323,7 @@ func (m *SegmentIndexInfo) Reset() { *m = SegmentIndexInfo{} }
func (m *SegmentIndexInfo) String() string { return proto.CompactTextString(m) }
func (*SegmentIndexInfo) ProtoMessage() {}
func (*SegmentIndexInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_975d306d62b73e88, []int{5}
return fileDescriptor_975d306d62b73e88, []int{4}
}
func (m *SegmentIndexInfo) XXX_Unmarshal(b []byte) error {
......@@ -472,7 +409,7 @@ func (m *CollectionMeta) Reset() { *m = CollectionMeta{} }
func (m *CollectionMeta) String() string { return proto.CompactTextString(m) }
func (*CollectionMeta) ProtoMessage() {}
func (*CollectionMeta) Descriptor() ([]byte, []int) {
return fileDescriptor_975d306d62b73e88, []int{6}
return fileDescriptor_975d306d62b73e88, []int{5}
}
func (m *CollectionMeta) XXX_Unmarshal(b []byte) error {
......@@ -536,7 +473,6 @@ func (m *CollectionMeta) GetPartitionIDs() []int64 {
}
func init() {
proto.RegisterType((*TenantMeta)(nil), "milvus.proto.etcd.TenantMeta")
proto.RegisterType((*ProxyMeta)(nil), "milvus.proto.etcd.ProxyMeta")
proto.RegisterType((*IndexInfo)(nil), "milvus.proto.etcd.IndexInfo")
proto.RegisterType((*FieldIndexInfo)(nil), "milvus.proto.etcd.FieldIndexInfo")
......@@ -548,54 +484,50 @@ func init() {
func init() { proto.RegisterFile("etcd_meta.proto", fileDescriptor_975d306d62b73e88) }
var fileDescriptor_975d306d62b73e88 = []byte{
// 777 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x54, 0x4d, 0x6f, 0xeb, 0x44,
0x14, 0x95, 0x9b, 0x34, 0x79, 0xbe, 0x71, 0xd3, 0x76, 0xf8, 0xd0, 0xa8, 0x2a, 0xe0, 0x67, 0xe9,
0x3d, 0x2c, 0x21, 0x5a, 0xd1, 0x87, 0xd8, 0x21, 0x01, 0xb5, 0x9e, 0x14, 0x01, 0x55, 0x99, 0x57,
0xb1, 0x60, 0x63, 0x4d, 0xec, 0xdb, 0x66, 0x24, 0xcf, 0x38, 0x78, 0xc6, 0xd5, 0xcb, 0x8e, 0x35,
0x3f, 0x81, 0x3f, 0xc8, 0x82, 0xff, 0x80, 0x90, 0x67, 0x6c, 0xe7, 0xa3, 0xe9, 0x92, 0x5d, 0xee,
0xb9, 0x1f, 0xbe, 0xf7, 0xcc, 0x39, 0x81, 0x63, 0x34, 0x59, 0x9e, 0x4a, 0x34, 0xfc, 0x62, 0x59,
0x95, 0xa6, 0x24, 0xa7, 0x52, 0x14, 0x8f, 0xb5, 0x76, 0xd1, 0x45, 0x93, 0x3d, 0x0b, 0xb2, 0x52,
0xca, 0x52, 0x39, 0xe8, 0x2c, 0xd0, 0xd9, 0x02, 0x65, 0x5b, 0x1e, 0xfd, 0xe5, 0x01, 0xdc, 0xa1,
0xe2, 0xca, 0xfc, 0x8c, 0x86, 0x93, 0x29, 0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0x35, 0x04, 0x9d, 0xad, 0xc5, 0x2c, 0x90, 0x74, 0x56, 0xc7, 0x6c, 0xbf, 0x41, 0x6f, 0xe8,
0x4c, 0xdc, 0x4b, 0x6c, 0xfb, 0x7e, 0x62, 0x3f, 0x5d, 0x7c, 0x7f, 0x33, 0xe3, 0x72, 0x5e, 0x4c,
0x4a, 0x2f, 0x0c, 0xf4, 0x35, 0x5e, 0xf3, 0xac, 0xfa, 0x35, 0xe0, 0xa9, 0x64, 0x79, 0x4a, 0xe3,
0x81, 0xba, 0xd9, 0xa0, 0x4c, 0xe4, 0x62, 0x32, 0x69, 0xab, 0xea, 0xe2, 0x6f, 0x00, 0x00, 0x00,
0xff, 0xff, 0xf7, 0x5a, 0x33, 0x47, 0x2c, 0x06, 0x00, 0x00,
}
......@@ -41,9 +41,6 @@ const (
// ComponentPrefix prefix for rootcoord component
ComponentPrefix = "root-coord"
// TenantMetaPrefix prefix for tenant meta
TenantMetaPrefix = ComponentPrefix + "/tenant"
// ProxyMetaPrefix prefix for proxy meta
ProxyMetaPrefix = ComponentPrefix + "/proxy"
......@@ -97,7 +94,6 @@ const (
type MetaTable struct {
txn kv.TxnKV // client of a reliable txnkv service, i.e. etcd client
snapshot kv.SnapShotKV // client of a reliable snapshotkv service, i.e. etcd client
tenantID2Meta map[typeutil.UniqueID]pb.TenantMeta // tenant id to tenant meta
proxyID2Meta map[typeutil.UniqueID]pb.ProxyMeta // proxy id to proxy meta
collID2Meta map[typeutil.UniqueID]pb.CollectionInfo // collection_id -> meta
collName2ID map[string]typeutil.UniqueID // collection name to collection id
......@@ -106,7 +102,6 @@ type MetaTable struct {
segID2IndexMeta map[typeutil.UniqueID]map[typeutil.UniqueID]pb.SegmentIndexInfo // collection_id/index_id/partition_id/segment_id -> meta
indexID2Meta map[typeutil.UniqueID]pb.IndexInfo // collection_id/index_id -> meta
tenantLock sync.RWMutex
proxyLock sync.RWMutex
ddLock sync.RWMutex
credLock sync.RWMutex
......@@ -118,7 +113,6 @@ func NewMetaTable(txn kv.TxnKV, snap kv.SnapShotKV) (*MetaTable, error) {
mt := &MetaTable{
txn: txn,
snapshot: snap,
tenantLock: sync.RWMutex{},
proxyLock: sync.RWMutex{},
ddLock: sync.RWMutex{},
credLock: sync.RWMutex{},
......@@ -131,7 +125,6 @@ func NewMetaTable(txn kv.TxnKV, snap kv.SnapShotKV) (*MetaTable, error) {
}
func (mt *MetaTable) reloadFromKV() error {
mt.tenantID2Meta = make(map[typeutil.UniqueID]pb.TenantMeta)
mt.proxyID2Meta = make(map[typeutil.UniqueID]pb.ProxyMeta)
mt.collID2Meta = make(map[typeutil.UniqueID]pb.CollectionInfo)
mt.collName2ID = make(map[string]typeutil.UniqueID)
......@@ -140,21 +133,7 @@ func (mt *MetaTable) reloadFromKV() error {
mt.segID2IndexMeta = make(map[typeutil.UniqueID]map[typeutil.UniqueID]pb.SegmentIndexInfo)
mt.indexID2Meta = make(map[typeutil.UniqueID]pb.IndexInfo)
_, values, err := mt.snapshot.LoadWithPrefix(TenantMetaPrefix, 0)
if err != nil {
return err
}
for _, value := range values {
tenantMeta := pb.TenantMeta{}
err := proto.Unmarshal([]byte(value), &tenantMeta)
if err != nil {
return fmt.Errorf("rootcoord Unmarshal pb.TenantMeta err:%w", err)
}
mt.tenantID2Meta[tenantMeta.ID] = tenantMeta
}
_, values, err = mt.txn.LoadWithPrefix(ProxyMetaPrefix)
_, values, err := mt.txn.LoadWithPrefix(ProxyMetaPrefix)
if err != nil {
return err
}
......@@ -257,27 +236,6 @@ func (mt *MetaTable) reloadFromKV() error {
return nil
}
// AddTenant add tenant
func (mt *MetaTable) AddTenant(te *pb.TenantMeta, ts typeutil.Timestamp) error {
mt.tenantLock.Lock()
defer mt.tenantLock.Unlock()
k := fmt.Sprintf("%s/%d", TenantMetaPrefix, te.ID)
v, err := proto.Marshal(te)
if err != nil {
log.Error("Failed to marshal TenantMeta in AddTenant", zap.Error(err))
return err
}
err = mt.snapshot.Save(k, string(v), ts)
if err != nil {
log.Error("Failed to save TenantMeta in AddTenant", zap.Error(err))
return err
}
mt.tenantID2Meta[te.ID] = *te
return nil
}
// AddProxy add proxy
func (mt *MetaTable) AddProxy(po *pb.ProxyMeta) error {
mt.proxyLock.Lock()
......
......@@ -118,23 +118,12 @@ func Test_MockKV(t *testing.T) {
assert.NotNil(t, err)
assert.EqualError(t, err, "load prefix error")
// tenant
prefix[TenantMetaPrefix] = []string{"tenant-prefix"}
_, err = NewMetaTable(kt, k1)
assert.NotNil(t, err)
value, err := proto.Marshal(&pb.TenantMeta{})
assert.Nil(t, err)
prefix[TenantMetaPrefix] = []string{string(value)}
_, err = NewMetaTable(kt, k1)
assert.NotNil(t, err)
// proxy
prefix[ProxyMetaPrefix] = []string{"porxy-meta"}
_, err = NewMetaTable(kt, k1)
assert.NotNil(t, err)
value, err = proto.Marshal(&pb.ProxyMeta{})
value, err := proto.Marshal(&pb.ProxyMeta{})
assert.Nil(t, err)
prefix[ProxyMetaPrefix] = []string{string(value)}
_, err = NewMetaTable(kt, k1)
......@@ -180,21 +169,10 @@ func Test_MockKV(t *testing.T) {
assert.EqualError(t, err, "load prefix error")
prefix[CollectionAliasMetaPrefix] = []string{"alias-meta"}
k1.save = func(key string, value string, ts typeutil.Timestamp) error {
return fmt.Errorf("save tenant error")
}
assert.Panics(t, func() { m1.AddTenant(&pb.TenantMeta{}, 0) })
//err = m1.AddTenant(&pb.TenantMeta{}, 0)
//assert.NotNil(t, err)
//assert.EqualError(t, err, "save tenant error")
k1.save = func(key string, value string, ts typeutil.Timestamp) error {
return fmt.Errorf("save proxy error")
}
assert.Panics(t, func() { m1.AddProxy(&pb.ProxyMeta{}) })
//err = m1.AddProxy(&pb.ProxyMeta{}, 0)
//assert.NotNil(t, err)
//assert.EqualError(t, err, "save proxy error")
}
func TestMetaTable(t *testing.T) {
......@@ -493,11 +471,6 @@ func TestMetaTable(t *testing.T) {
wg.Add(1)
t.Run("reload meta", func(t *testing.T) {
defer wg.Done()
te := pb.TenantMeta{
ID: 100,
}
err := mt.AddTenant(&te, 0)
assert.Nil(t, err)
po := pb.ProxyMeta{
ID: 101,
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册