mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 09:38:39 +08:00
Enhance ID allocator in DataNode (#22905)
Signed-off-by: yangxuan <xuan.yang@zilliz.com>
This commit is contained in:
parent
5bf6e69381
commit
93bc805933
2
Makefile
2
Makefile
@ -347,6 +347,8 @@ mock-tnx-kv:
|
|||||||
mockery --name=TxnKV --dir=$(PWD)/internal/kv --output=$(PWD)/internal/kv/mocks --filename=TxnKV.go --with-expecter
|
mockery --name=TxnKV --dir=$(PWD)/internal/kv --output=$(PWD)/internal/kv/mocks --filename=TxnKV.go --with-expecter
|
||||||
|
|
||||||
generate-mockery: getdeps
|
generate-mockery: getdeps
|
||||||
|
# internal/datanode
|
||||||
|
$(PWD)/bin/mockery --name=Allocator --dir=$(PWD)/internal/datanode/allocator/ --output=$(PWD)/internal/datanode/allocator --filename=mock_allocator.go --with-expecter --structname=MockAllocator --outpkg=allocator --inpackage
|
||||||
# internal/querycoordv2
|
# internal/querycoordv2
|
||||||
$(PWD)/bin/mockery --name=QueryNodeServer --dir=$(PWD)/internal/proto/querypb/ --output=$(PWD)/internal/querycoordv2/mocks --filename=mock_querynode.go --with-expecter --structname=MockQueryNodeServer
|
$(PWD)/bin/mockery --name=QueryNodeServer --dir=$(PWD)/internal/proto/querypb/ --output=$(PWD)/internal/querycoordv2/mocks --filename=mock_querynode.go --with-expecter --structname=MockQueryNodeServer
|
||||||
$(PWD)/bin/mockery --name=Broker --dir=$(PWD)/internal/querycoordv2/meta --output=$(PWD)/internal/querycoordv2/meta --filename=mock_broker.go --with-expecter --structname=MockBroker --outpkg=meta
|
$(PWD)/bin/mockery --name=Broker --dir=$(PWD)/internal/querycoordv2/meta --output=$(PWD)/internal/querycoordv2/meta --filename=mock_broker.go --with-expecter --structname=MockBroker --outpkg=meta
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/cockroachdb/errors"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
||||||
"github.com/milvus-io/milvus/internal/proto/rootcoordpb"
|
"github.com/milvus-io/milvus/internal/proto/rootcoordpb"
|
||||||
"github.com/milvus-io/milvus/internal/util/commonpbutil"
|
"github.com/milvus-io/milvus/internal/util/commonpbutil"
|
||||||
@ -151,6 +152,9 @@ func (ia *IDAllocator) AllocOne() (UniqueID, error) {
|
|||||||
|
|
||||||
// Alloc allocates the id of the count number.
|
// Alloc allocates the id of the count number.
|
||||||
func (ia *IDAllocator) Alloc(count uint32) (UniqueID, UniqueID, error) {
|
func (ia *IDAllocator) Alloc(count uint32) (UniqueID, UniqueID, error) {
|
||||||
|
if ia.closed() {
|
||||||
|
return 0, 0, errors.New("fail to allocate ID, closed allocator")
|
||||||
|
}
|
||||||
req := &IDRequest{BaseRequest: BaseRequest{Done: make(chan error), Valid: false}}
|
req := &IDRequest{BaseRequest: BaseRequest{Done: make(chan error), Valid: false}}
|
||||||
|
|
||||||
req.count = count
|
req.count = count
|
||||||
@ -162,3 +166,13 @@ func (ia *IDAllocator) Alloc(count uint32) (UniqueID, UniqueID, error) {
|
|||||||
start, count := req.id, req.count
|
start, count := req.id, req.count
|
||||||
return start, start + int64(count), nil
|
return start, start + int64(count), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// preventing alloc from a closed allocator stucking forever
|
||||||
|
func (ia *IDAllocator) closed() bool {
|
||||||
|
select {
|
||||||
|
case <-ia.Ctx.Done():
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -23,6 +23,7 @@ import (
|
|||||||
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
||||||
"github.com/milvus-io/milvus/internal/proto/rootcoordpb"
|
"github.com/milvus-io/milvus/internal/proto/rootcoordpb"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockIDAllocator struct {
|
type mockIDAllocator struct {
|
||||||
@ -65,3 +66,16 @@ func TestIDAllocator(t *testing.T) {
|
|||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.Equal(t, id, int64(20002))
|
assert.Equal(t, id, int64(20002))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIDAllocatorClose(t *testing.T) {
|
||||||
|
a, err := NewIDAllocator(context.TODO(), newMockIDAllocator(), 1)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
err = a.Start()
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
a.Close()
|
||||||
|
|
||||||
|
_, _, err = a.Alloc(10)
|
||||||
|
assert.Error(t, err)
|
||||||
|
}
|
||||||
|
|||||||
@ -1,104 +0,0 @@
|
|||||||
// Licensed to the LF AI & Data foundation under one
|
|
||||||
// or more contributor license agreements. See the NOTICE file
|
|
||||||
// distributed with this work for additional information
|
|
||||||
// regarding copyright ownership. The ASF licenses this file
|
|
||||||
// to you under the Apache License, Version 2.0 (the
|
|
||||||
// "License"); you may not use this file except in compliance
|
|
||||||
// with the License. You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package datanode
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/cockroachdb/errors"
|
|
||||||
|
|
||||||
"github.com/milvus-io/milvus/internal/util/commonpbutil"
|
|
||||||
"github.com/milvus-io/milvus/internal/util/metautil"
|
|
||||||
"github.com/milvus-io/milvus/internal/util/paramtable"
|
|
||||||
|
|
||||||
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
|
||||||
"github.com/milvus-io/milvus/internal/proto/rootcoordpb"
|
|
||||||
"github.com/milvus-io/milvus/internal/types"
|
|
||||||
)
|
|
||||||
|
|
||||||
type allocatorInterface interface {
|
|
||||||
allocID() (UniqueID, error)
|
|
||||||
allocIDBatch(count uint32) (UniqueID, uint32, error)
|
|
||||||
genKey(ids ...UniqueID) (key string, err error)
|
|
||||||
}
|
|
||||||
|
|
||||||
type allocator struct {
|
|
||||||
rootCoord types.RootCoord
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if allocator implements allocatorInterface
|
|
||||||
var _ allocatorInterface = &allocator{}
|
|
||||||
|
|
||||||
func newAllocator(s types.RootCoord) *allocator {
|
|
||||||
return &allocator{
|
|
||||||
rootCoord: s,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// allocID allocates one ID from rootCoord
|
|
||||||
func (alloc *allocator) allocID() (UniqueID, error) {
|
|
||||||
ctx := context.TODO()
|
|
||||||
resp, err := alloc.rootCoord.AllocID(ctx, &rootcoordpb.AllocIDRequest{
|
|
||||||
Base: commonpbutil.NewMsgBase(
|
|
||||||
commonpbutil.WithMsgType(commonpb.MsgType_RequestID),
|
|
||||||
commonpbutil.WithMsgID(1), // GOOSE TODO
|
|
||||||
commonpbutil.WithSourceID(paramtable.GetNodeID()),
|
|
||||||
),
|
|
||||||
Count: 1,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if resp.GetStatus().GetErrorCode() != commonpb.ErrorCode_Success {
|
|
||||||
return 0, errors.New(resp.GetStatus().GetReason())
|
|
||||||
}
|
|
||||||
|
|
||||||
return resp.ID, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// allocIDBatch allocates IDs in batch from rootCoord
|
|
||||||
func (alloc *allocator) allocIDBatch(count uint32) (UniqueID, uint32, error) {
|
|
||||||
ctx := context.Background()
|
|
||||||
resp, err := alloc.rootCoord.AllocID(ctx, &rootcoordpb.AllocIDRequest{
|
|
||||||
Base: commonpbutil.NewMsgBase(
|
|
||||||
commonpbutil.WithMsgType(commonpb.MsgType_RequestID),
|
|
||||||
commonpbutil.WithSourceID(paramtable.GetNodeID()),
|
|
||||||
),
|
|
||||||
Count: count,
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return 0, 0, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if resp.GetStatus().GetErrorCode() != commonpb.ErrorCode_Success {
|
|
||||||
return 0, 0, errors.New(resp.GetStatus().GetReason())
|
|
||||||
}
|
|
||||||
|
|
||||||
return resp.GetID(), resp.GetCount(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// genKey gives a valid key string for lists of UniqueIDs:
|
|
||||||
func (alloc *allocator) genKey(ids ...UniqueID) (string, error) {
|
|
||||||
idx, err := alloc.allocID()
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
ids = append(ids, idx)
|
|
||||||
return metautil.JoinIDPath(ids...), nil
|
|
||||||
}
|
|
||||||
81
internal/datanode/allocator/allocator.go
Normal file
81
internal/datanode/allocator/allocator.go
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
// Licensed to the LF AI & Data foundation under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package allocator
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
gAllocator "github.com/milvus-io/milvus/internal/allocator"
|
||||||
|
"github.com/milvus-io/milvus/internal/types"
|
||||||
|
"github.com/milvus-io/milvus/internal/util/typeutil"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UniqueID = typeutil.UniqueID
|
||||||
|
|
||||||
|
type Allocator interface {
|
||||||
|
Start() error
|
||||||
|
Close()
|
||||||
|
AllocOne() (UniqueID, error)
|
||||||
|
Alloc(count uint32) (UniqueID, UniqueID, error)
|
||||||
|
GetGenerator(count int, done <-chan struct{}) (<-chan UniqueID, error)
|
||||||
|
GetIDAlloactor() *gAllocator.IDAllocator
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ Allocator = (*Impl)(nil)
|
||||||
|
|
||||||
|
type Impl struct {
|
||||||
|
// Start() error
|
||||||
|
// Close() error
|
||||||
|
// AllocOne() (UniqueID, error)
|
||||||
|
// Alloc(count uint32) (UniqueID, UniqueID, error)
|
||||||
|
*gAllocator.IDAllocator
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(ctx context.Context, rootCoord types.RootCoord, peerID UniqueID) (Allocator, error) {
|
||||||
|
idAlloc, err := gAllocator.NewIDAllocator(ctx, rootCoord, peerID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &Impl{idAlloc}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Impl) GetIDAlloactor() *gAllocator.IDAllocator {
|
||||||
|
return a.IDAllocator
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *Impl) GetGenerator(count int, done <-chan struct{}) (<-chan UniqueID, error) {
|
||||||
|
|
||||||
|
idStart, _, err := a.Alloc(uint32(count))
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
rt := make(chan UniqueID)
|
||||||
|
go func(rt chan<- UniqueID) {
|
||||||
|
for i := 0; i < count; i++ {
|
||||||
|
select {
|
||||||
|
case <-done:
|
||||||
|
close(rt)
|
||||||
|
return
|
||||||
|
case rt <- idStart + UniqueID(i):
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(rt)
|
||||||
|
}(rt)
|
||||||
|
|
||||||
|
return rt, nil
|
||||||
|
}
|
||||||
92
internal/datanode/allocator/allocator_test.go
Normal file
92
internal/datanode/allocator/allocator_test.go
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
// Licensed to the LF AI & Data foundation under one
|
||||||
|
// or more contributor license agreements. See the NOTICE file
|
||||||
|
// distributed with this work for additional information
|
||||||
|
// regarding copyright ownership. The ASF licenses this file
|
||||||
|
// to you under the Apache License, Version 2.0 (the
|
||||||
|
// "License"); you may not use this file except in compliance
|
||||||
|
// with the License. You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package allocator
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
||||||
|
"github.com/milvus-io/milvus/internal/proto/rootcoordpb"
|
||||||
|
"github.com/milvus-io/milvus/internal/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestGetGenerator(t *testing.T) {
|
||||||
|
tests := []struct {
|
||||||
|
isvalid bool
|
||||||
|
innumber int
|
||||||
|
|
||||||
|
expectedNo int
|
||||||
|
description string
|
||||||
|
}{
|
||||||
|
{true, 1, 1, "valid input n 1"},
|
||||||
|
{true, 3, 3, "valid input n 3 with cancel"},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, test := range tests {
|
||||||
|
rc := &RootCoordFactory{ID: 11111}
|
||||||
|
alloc, err := New(context.TODO(), rc, 100)
|
||||||
|
require.NoError(t, err)
|
||||||
|
err = alloc.Start()
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
t.Run(test.description, func(t *testing.T) {
|
||||||
|
done := make(chan struct{})
|
||||||
|
gen, err := alloc.GetGenerator(test.innumber, done)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
r := make([]UniqueID, 0)
|
||||||
|
for i := range gen {
|
||||||
|
r = append(r, i)
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.Equal(t, test.expectedNo, len(r))
|
||||||
|
|
||||||
|
if test.innumber > 1 {
|
||||||
|
donedone := make(chan struct{})
|
||||||
|
gen, err := alloc.GetGenerator(test.innumber, donedone)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
_, ok := <-gen
|
||||||
|
assert.True(t, ok)
|
||||||
|
|
||||||
|
donedone <- struct{}{}
|
||||||
|
|
||||||
|
_, ok = <-gen
|
||||||
|
assert.False(t, ok)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type RootCoordFactory struct {
|
||||||
|
types.RootCoord
|
||||||
|
ID UniqueID
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *RootCoordFactory) AllocID(ctx context.Context, in *rootcoordpb.AllocIDRequest) (*rootcoordpb.AllocIDResponse, error) {
|
||||||
|
resp := &rootcoordpb.AllocIDResponse{
|
||||||
|
ID: m.ID,
|
||||||
|
Count: in.GetCount(),
|
||||||
|
Status: &commonpb.Status{
|
||||||
|
ErrorCode: commonpb.ErrorCode_Success,
|
||||||
|
}}
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
278
internal/datanode/allocator/mock_allocator.go
Normal file
278
internal/datanode/allocator/mock_allocator.go
Normal file
@ -0,0 +1,278 @@
|
|||||||
|
// Code generated by mockery v2.16.0. DO NOT EDIT.
|
||||||
|
|
||||||
|
package allocator
|
||||||
|
|
||||||
|
import (
|
||||||
|
internalallocator "github.com/milvus-io/milvus/internal/allocator"
|
||||||
|
mock "github.com/stretchr/testify/mock"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MockAllocator is an autogenerated mock type for the Allocator type
|
||||||
|
type MockAllocator struct {
|
||||||
|
mock.Mock
|
||||||
|
}
|
||||||
|
|
||||||
|
type MockAllocator_Expecter struct {
|
||||||
|
mock *mock.Mock
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_m *MockAllocator) EXPECT() *MockAllocator_Expecter {
|
||||||
|
return &MockAllocator_Expecter{mock: &_m.Mock}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alloc provides a mock function with given fields: count
|
||||||
|
func (_m *MockAllocator) Alloc(count uint32) (int64, int64, error) {
|
||||||
|
ret := _m.Called(count)
|
||||||
|
|
||||||
|
var r0 int64
|
||||||
|
if rf, ok := ret.Get(0).(func(uint32) int64); ok {
|
||||||
|
r0 = rf(count)
|
||||||
|
} else {
|
||||||
|
r0 = ret.Get(0).(int64)
|
||||||
|
}
|
||||||
|
|
||||||
|
var r1 int64
|
||||||
|
if rf, ok := ret.Get(1).(func(uint32) int64); ok {
|
||||||
|
r1 = rf(count)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Get(1).(int64)
|
||||||
|
}
|
||||||
|
|
||||||
|
var r2 error
|
||||||
|
if rf, ok := ret.Get(2).(func(uint32) error); ok {
|
||||||
|
r2 = rf(count)
|
||||||
|
} else {
|
||||||
|
r2 = ret.Error(2)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1, r2
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockAllocator_Alloc_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Alloc'
|
||||||
|
type MockAllocator_Alloc_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alloc is a helper method to define mock.On call
|
||||||
|
// - count uint32
|
||||||
|
func (_e *MockAllocator_Expecter) Alloc(count interface{}) *MockAllocator_Alloc_Call {
|
||||||
|
return &MockAllocator_Alloc_Call{Call: _e.mock.On("Alloc", count)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockAllocator_Alloc_Call) Run(run func(count uint32)) *MockAllocator_Alloc_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(uint32))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockAllocator_Alloc_Call) Return(_a0 int64, _a1 int64, _a2 error) *MockAllocator_Alloc_Call {
|
||||||
|
_c.Call.Return(_a0, _a1, _a2)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllocOne provides a mock function with given fields:
|
||||||
|
func (_m *MockAllocator) AllocOne() (int64, error) {
|
||||||
|
ret := _m.Called()
|
||||||
|
|
||||||
|
var r0 int64
|
||||||
|
if rf, ok := ret.Get(0).(func() int64); ok {
|
||||||
|
r0 = rf()
|
||||||
|
} else {
|
||||||
|
r0 = ret.Get(0).(int64)
|
||||||
|
}
|
||||||
|
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(1).(func() error); ok {
|
||||||
|
r1 = rf()
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockAllocator_AllocOne_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AllocOne'
|
||||||
|
type MockAllocator_AllocOne_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllocOne is a helper method to define mock.On call
|
||||||
|
func (_e *MockAllocator_Expecter) AllocOne() *MockAllocator_AllocOne_Call {
|
||||||
|
return &MockAllocator_AllocOne_Call{Call: _e.mock.On("AllocOne")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockAllocator_AllocOne_Call) Run(run func()) *MockAllocator_AllocOne_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockAllocator_AllocOne_Call) Return(_a0 int64, _a1 error) *MockAllocator_AllocOne_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close provides a mock function with given fields:
|
||||||
|
func (_m *MockAllocator) Close() {
|
||||||
|
_m.Called()
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockAllocator_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
|
||||||
|
type MockAllocator_Close_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close is a helper method to define mock.On call
|
||||||
|
func (_e *MockAllocator_Expecter) Close() *MockAllocator_Close_Call {
|
||||||
|
return &MockAllocator_Close_Call{Call: _e.mock.On("Close")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockAllocator_Close_Call) Run(run func()) *MockAllocator_Close_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockAllocator_Close_Call) Return() *MockAllocator_Close_Call {
|
||||||
|
_c.Call.Return()
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetGenerator provides a mock function with given fields: count, done
|
||||||
|
func (_m *MockAllocator) GetGenerator(count int, done <-chan struct{}) (<-chan int64, error) {
|
||||||
|
ret := _m.Called(count, done)
|
||||||
|
|
||||||
|
var r0 <-chan int64
|
||||||
|
if rf, ok := ret.Get(0).(func(int, <-chan struct{}) <-chan int64); ok {
|
||||||
|
r0 = rf(count, done)
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(<-chan int64)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var r1 error
|
||||||
|
if rf, ok := ret.Get(1).(func(int, <-chan struct{}) error); ok {
|
||||||
|
r1 = rf(count, done)
|
||||||
|
} else {
|
||||||
|
r1 = ret.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0, r1
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockAllocator_GetGenerator_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGenerator'
|
||||||
|
type MockAllocator_GetGenerator_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetGenerator is a helper method to define mock.On call
|
||||||
|
// - count int
|
||||||
|
// - done <-chan struct{}
|
||||||
|
func (_e *MockAllocator_Expecter) GetGenerator(count interface{}, done interface{}) *MockAllocator_GetGenerator_Call {
|
||||||
|
return &MockAllocator_GetGenerator_Call{Call: _e.mock.On("GetGenerator", count, done)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockAllocator_GetGenerator_Call) Run(run func(count int, done <-chan struct{})) *MockAllocator_GetGenerator_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run(args[0].(int), args[1].(<-chan struct{}))
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockAllocator_GetGenerator_Call) Return(_a0 <-chan int64, _a1 error) *MockAllocator_GetGenerator_Call {
|
||||||
|
_c.Call.Return(_a0, _a1)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetIDAlloactor provides a mock function with given fields:
|
||||||
|
func (_m *MockAllocator) GetIDAlloactor() *internalallocator.IDAllocator {
|
||||||
|
ret := _m.Called()
|
||||||
|
|
||||||
|
var r0 *internalallocator.IDAllocator
|
||||||
|
if rf, ok := ret.Get(0).(func() *internalallocator.IDAllocator); ok {
|
||||||
|
r0 = rf()
|
||||||
|
} else {
|
||||||
|
if ret.Get(0) != nil {
|
||||||
|
r0 = ret.Get(0).(*internalallocator.IDAllocator)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockAllocator_GetIDAlloactor_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIDAlloactor'
|
||||||
|
type MockAllocator_GetIDAlloactor_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetIDAlloactor is a helper method to define mock.On call
|
||||||
|
func (_e *MockAllocator_Expecter) GetIDAlloactor() *MockAllocator_GetIDAlloactor_Call {
|
||||||
|
return &MockAllocator_GetIDAlloactor_Call{Call: _e.mock.On("GetIDAlloactor")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockAllocator_GetIDAlloactor_Call) Run(run func()) *MockAllocator_GetIDAlloactor_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockAllocator_GetIDAlloactor_Call) Return(_a0 *internalallocator.IDAllocator) *MockAllocator_GetIDAlloactor_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start provides a mock function with given fields:
|
||||||
|
func (_m *MockAllocator) Start() error {
|
||||||
|
ret := _m.Called()
|
||||||
|
|
||||||
|
var r0 error
|
||||||
|
if rf, ok := ret.Get(0).(func() error); ok {
|
||||||
|
r0 = rf()
|
||||||
|
} else {
|
||||||
|
r0 = ret.Error(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
return r0
|
||||||
|
}
|
||||||
|
|
||||||
|
// MockAllocator_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
|
||||||
|
type MockAllocator_Start_Call struct {
|
||||||
|
*mock.Call
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start is a helper method to define mock.On call
|
||||||
|
func (_e *MockAllocator_Expecter) Start() *MockAllocator_Start_Call {
|
||||||
|
return &MockAllocator_Start_Call{Call: _e.mock.On("Start")}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockAllocator_Start_Call) Run(run func()) *MockAllocator_Start_Call {
|
||||||
|
_c.Call.Run(func(args mock.Arguments) {
|
||||||
|
run()
|
||||||
|
})
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
func (_c *MockAllocator_Start_Call) Return(_a0 error) *MockAllocator_Start_Call {
|
||||||
|
_c.Call.Return(_a0)
|
||||||
|
return _c
|
||||||
|
}
|
||||||
|
|
||||||
|
type mockConstructorTestingTNewMockAllocator interface {
|
||||||
|
mock.TestingT
|
||||||
|
Cleanup(func())
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewMockAllocator creates a new instance of MockAllocator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||||
|
func NewMockAllocator(t mockConstructorTestingTNewMockAllocator) *MockAllocator {
|
||||||
|
mock := &MockAllocator{}
|
||||||
|
mock.Mock.Test(t)
|
||||||
|
|
||||||
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
||||||
|
|
||||||
|
return mock
|
||||||
|
}
|
||||||
@ -1,104 +0,0 @@
|
|||||||
// Licensed to the LF AI & Data foundation under one
|
|
||||||
// or more contributor license agreements. See the NOTICE file
|
|
||||||
// distributed with this work for additional information
|
|
||||||
// regarding copyright ownership. The ASF licenses this file
|
|
||||||
// to you under the Apache License, Version 2.0 (the
|
|
||||||
// "License"); you may not use this file except in compliance
|
|
||||||
// with the License. You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package datanode
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestAllocator_Basic(t *testing.T) {
|
|
||||||
ms := &RootCoordFactory{}
|
|
||||||
allocator := newAllocator(ms)
|
|
||||||
|
|
||||||
t.Run("Test allocID", func(t *testing.T) {
|
|
||||||
ms.setID(666)
|
|
||||||
_, err := allocator.allocID()
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
ms.setID(-1)
|
|
||||||
_, err = allocator.allocID()
|
|
||||||
assert.Error(t, err)
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("Test alloc ID batch", func(t *testing.T) {
|
|
||||||
// If id == 0, AllocID will return not successful status
|
|
||||||
// If id == -1, AllocID will return err with nil status
|
|
||||||
ms.setID(666)
|
|
||||||
_, count, err := allocator.allocIDBatch(10)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.EqualValues(t, 10, count)
|
|
||||||
|
|
||||||
ms.setID(0)
|
|
||||||
_, _, err = allocator.allocIDBatch(10)
|
|
||||||
assert.Error(t, err)
|
|
||||||
|
|
||||||
ms.setID(-1)
|
|
||||||
_, _, err = allocator.allocIDBatch(10)
|
|
||||||
assert.Error(t, err)
|
|
||||||
})
|
|
||||||
|
|
||||||
t.Run("Test genKey", func(t *testing.T) {
|
|
||||||
ms.setID(666)
|
|
||||||
|
|
||||||
type Test struct {
|
|
||||||
inIDs []UniqueID
|
|
||||||
outKey string
|
|
||||||
|
|
||||||
description string
|
|
||||||
}
|
|
||||||
|
|
||||||
tests := []Test{
|
|
||||||
{[]UniqueID{}, "666", "genKey with empty input ids"},
|
|
||||||
{[]UniqueID{1}, "1/666", "genKey with 1 input id"},
|
|
||||||
{[]UniqueID{1, 2, 3}, "1/2/3/666", "genKey with input 3 ids"},
|
|
||||||
{[]UniqueID{2, 2, 2}, "2/2/2/666", "genKey with input 3 ids"},
|
|
||||||
}
|
|
||||||
|
|
||||||
for i, test := range tests {
|
|
||||||
key, err := allocator.genKey(test.inIDs...)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.Equalf(t, test.outKey, key, "#%d", i)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Status.ErrorCode != Success
|
|
||||||
ms.setID(0)
|
|
||||||
tests = []Test{
|
|
||||||
{[]UniqueID{}, "", "error rpc status"},
|
|
||||||
{[]UniqueID{1}, "", "error rpc status"},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, test := range tests {
|
|
||||||
k, err := allocator.genKey(test.inIDs...)
|
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Equal(t, test.outKey, k)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Grpc error
|
|
||||||
ms.setID(-1)
|
|
||||||
tests = []Test{
|
|
||||||
{[]UniqueID{}, "", "error rpc"},
|
|
||||||
{[]UniqueID{1}, "", "error rpc"},
|
|
||||||
}
|
|
||||||
for _, test := range tests {
|
|
||||||
k, err := allocator.genKey(test.inIDs...)
|
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Equal(t, test.outKey, k)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@ -25,6 +25,7 @@ import (
|
|||||||
"github.com/cockroachdb/errors"
|
"github.com/cockroachdb/errors"
|
||||||
|
|
||||||
"github.com/milvus-io/milvus/internal/common"
|
"github.com/milvus-io/milvus/internal/common"
|
||||||
|
"github.com/milvus-io/milvus/internal/datanode/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/log"
|
"github.com/milvus-io/milvus/internal/log"
|
||||||
"github.com/milvus-io/milvus/internal/proto/datapb"
|
"github.com/milvus-io/milvus/internal/proto/datapb"
|
||||||
"github.com/milvus-io/milvus/internal/proto/etcdpb"
|
"github.com/milvus-io/milvus/internal/proto/etcdpb"
|
||||||
@ -60,7 +61,7 @@ type uploader interface {
|
|||||||
|
|
||||||
type binlogIO struct {
|
type binlogIO struct {
|
||||||
storage.ChunkManager
|
storage.ChunkManager
|
||||||
allocatorInterface
|
allocator.Allocator
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ downloader = (*binlogIO)(nil)
|
var _ downloader = (*binlogIO)(nil)
|
||||||
@ -241,10 +242,11 @@ func (b *binlogIO) genDeltaBlobs(data *DeleteData, collID, partID, segID UniqueI
|
|||||||
return "", nil, err
|
return "", nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
k, err := b.genKey(collID, partID, segID)
|
idx, err := b.AllocOne()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
}
|
}
|
||||||
|
k := metautil.JoinIDPath(collID, partID, segID, idx)
|
||||||
|
|
||||||
key := path.Join(b.ChunkManager.RootPath(), common.SegmentDeltaLogPath, k)
|
key := path.Join(b.ChunkManager.RootPath(), common.SegmentDeltaLogPath, k)
|
||||||
|
|
||||||
@ -268,7 +270,7 @@ func (b *binlogIO) genInsertBlobs(data *InsertData, partID, segID UniqueID, meta
|
|||||||
notifyGenIdx := make(chan struct{})
|
notifyGenIdx := make(chan struct{})
|
||||||
defer close(notifyGenIdx)
|
defer close(notifyGenIdx)
|
||||||
|
|
||||||
generator, err := b.idxGenerator(len(inlogs)+len(statslogs), notifyGenIdx)
|
generator, err := b.GetGenerator(len(inlogs)+len(statslogs), notifyGenIdx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
@ -309,29 +311,6 @@ func (b *binlogIO) genInsertBlobs(data *InsertData, partID, segID UniqueID, meta
|
|||||||
return kvs, inpaths, statspaths, nil
|
return kvs, inpaths, statspaths, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *binlogIO) idxGenerator(n int, done <-chan struct{}) (<-chan UniqueID, error) {
|
|
||||||
|
|
||||||
idStart, _, err := b.allocIDBatch(uint32(n))
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
rt := make(chan UniqueID)
|
|
||||||
go func(rt chan<- UniqueID) {
|
|
||||||
for i := 0; i < n; i++ {
|
|
||||||
select {
|
|
||||||
case <-done:
|
|
||||||
close(rt)
|
|
||||||
return
|
|
||||||
case rt <- idStart + UniqueID(i):
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(rt)
|
|
||||||
}(rt)
|
|
||||||
|
|
||||||
return rt, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *binlogIO) uploadInsertLog(
|
func (b *binlogIO) uploadInsertLog(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
segID UniqueID,
|
segID UniqueID,
|
||||||
|
|||||||
@ -18,32 +18,43 @@ package datanode
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"path"
|
"path"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/cockroachdb/errors"
|
|
||||||
|
|
||||||
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
||||||
|
|
||||||
"github.com/milvus-io/milvus/internal/common"
|
"github.com/milvus-io/milvus/internal/common"
|
||||||
"github.com/milvus-io/milvus/internal/log"
|
"github.com/milvus-io/milvus/internal/log"
|
||||||
"github.com/milvus-io/milvus/internal/storage"
|
"github.com/milvus-io/milvus/internal/storage"
|
||||||
"github.com/milvus-io/milvus/internal/util/typeutil"
|
"github.com/milvus-io/milvus/internal/util/typeutil"
|
||||||
|
|
||||||
|
"github.com/milvus-io/milvus/internal/datanode/allocator"
|
||||||
|
|
||||||
|
"github.com/cockroachdb/errors"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/mock"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
var binlogTestDir = "/tmp/milvus_test/test_binlog_io"
|
var binlogTestDir = "/tmp/milvus_test/test_binlog_io"
|
||||||
|
|
||||||
|
var validGeneratorFn = func(count int, done <-chan struct{}) <-chan UniqueID {
|
||||||
|
ret := make(chan UniqueID, count)
|
||||||
|
for i := 0; i < count; i++ {
|
||||||
|
ret <- int64(100 + i)
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
func TestBinlogIOInterfaceMethods(t *testing.T) {
|
func TestBinlogIOInterfaceMethods(t *testing.T) {
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
alloc := NewAllocatorFactory()
|
|
||||||
cm := storage.NewLocalChunkManager(storage.RootPath(binlogTestDir))
|
cm := storage.NewLocalChunkManager(storage.RootPath(binlogTestDir))
|
||||||
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
||||||
|
|
||||||
b := &binlogIO{cm, alloc}
|
|
||||||
t.Run("Test upload", func(t *testing.T) {
|
t.Run("Test upload", func(t *testing.T) {
|
||||||
f := &MetaFactory{}
|
f := &MetaFactory{}
|
||||||
meta := f.GetCollectionMeta(UniqueID(10001), "uploads", schemapb.DataType_Int64)
|
meta := f.GetCollectionMeta(UniqueID(10001), "uploads", schemapb.DataType_Int64)
|
||||||
@ -56,50 +67,82 @@ func TestBinlogIOInterfaceMethods(t *testing.T) {
|
|||||||
Pks: []primaryKey{pk},
|
Pks: []primaryKey{pk},
|
||||||
Tss: []uint64{666666},
|
Tss: []uint64{666666},
|
||||||
}
|
}
|
||||||
|
t.Run("Test upload one iData", func(t *testing.T) {
|
||||||
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().GetGenerator(mock.Anything, mock.Anything).Call.Return(validGeneratorFn, nil)
|
||||||
|
alloc.EXPECT().AllocOne().Call.Return(int64(11111), nil)
|
||||||
|
|
||||||
p, err := b.upload(context.TODO(), 1, 10, []*InsertData{iData}, dData, meta)
|
b := &binlogIO{cm, alloc}
|
||||||
assert.NoError(t, err)
|
p, err := b.upload(context.TODO(), 1, 10, []*InsertData{iData}, dData, meta)
|
||||||
assert.Equal(t, 12, len(p.inPaths))
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, 1, len(p.statsPaths))
|
assert.Equal(t, 12, len(p.inPaths))
|
||||||
assert.Equal(t, 1, len(p.inPaths[0].GetBinlogs()))
|
assert.Equal(t, 1, len(p.statsPaths))
|
||||||
assert.Equal(t, 1, len(p.statsPaths[0].GetBinlogs()))
|
assert.Equal(t, 1, len(p.inPaths[0].GetBinlogs()))
|
||||||
assert.NotNil(t, p.deltaInfo)
|
assert.Equal(t, 1, len(p.statsPaths[0].GetBinlogs()))
|
||||||
|
assert.NotNil(t, p.deltaInfo)
|
||||||
|
})
|
||||||
|
|
||||||
p, err = b.upload(context.TODO(), 1, 10, []*InsertData{iData, iData}, dData, meta)
|
t.Run("Test upload two iData", func(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
assert.Equal(t, 12, len(p.inPaths))
|
alloc.EXPECT().GetGenerator(mock.Anything, mock.Anything).Call.Return(validGeneratorFn, nil)
|
||||||
assert.Equal(t, 1, len(p.statsPaths))
|
alloc.EXPECT().AllocOne().Call.Return(int64(11111), nil)
|
||||||
assert.Equal(t, 2, len(p.inPaths[0].GetBinlogs()))
|
|
||||||
assert.Equal(t, 2, len(p.statsPaths[0].GetBinlogs()))
|
|
||||||
assert.NotNil(t, p.deltaInfo)
|
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
b := &binlogIO{cm, alloc}
|
||||||
|
p, err := b.upload(context.TODO(), 1, 10, []*InsertData{iData, iData}, dData, meta)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, 12, len(p.inPaths))
|
||||||
|
assert.Equal(t, 1, len(p.statsPaths))
|
||||||
|
assert.Equal(t, 2, len(p.inPaths[0].GetBinlogs()))
|
||||||
|
assert.Equal(t, 2, len(p.statsPaths[0].GetBinlogs()))
|
||||||
|
assert.NotNil(t, p.deltaInfo)
|
||||||
|
|
||||||
in, stats, err := b.uploadInsertLog(ctx, 1, 10, iData, meta)
|
})
|
||||||
assert.NoError(t, err)
|
|
||||||
assert.Equal(t, 12, len(in))
|
|
||||||
assert.Equal(t, 1, len(in[0].GetBinlogs()))
|
|
||||||
assert.Equal(t, 1, len(stats))
|
|
||||||
|
|
||||||
deltas, err := b.uploadDeltaLog(ctx, 1, 10, dData, meta)
|
t.Run("Test uploadInsertLog", func(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
assert.NotNil(t, deltas)
|
alloc.EXPECT().GetGenerator(mock.Anything, mock.Anything).Call.Return(validGeneratorFn, nil)
|
||||||
assert.Equal(t, 1, len(deltas[0].GetBinlogs()))
|
|
||||||
|
|
||||||
cancel()
|
b := &binlogIO{cm, alloc}
|
||||||
|
|
||||||
p, err = b.upload(ctx, 1, 10, []*InsertData{iData}, dData, meta)
|
in, stats, err := b.uploadInsertLog(ctx, 1, 10, iData, meta)
|
||||||
assert.EqualError(t, err, errUploadToBlobStorage.Error())
|
assert.NoError(t, err)
|
||||||
assert.Nil(t, p)
|
assert.Equal(t, 12, len(in))
|
||||||
|
assert.Equal(t, 1, len(in[0].GetBinlogs()))
|
||||||
|
assert.Equal(t, 1, len(stats))
|
||||||
|
})
|
||||||
|
t.Run("Test uploadDeltaLog", func(t *testing.T) {
|
||||||
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().AllocOne().Call.Return(int64(11111), nil)
|
||||||
|
|
||||||
in, _, err = b.uploadInsertLog(ctx, 1, 10, iData, meta)
|
b := &binlogIO{cm, alloc}
|
||||||
assert.EqualError(t, err, errUploadToBlobStorage.Error())
|
deltas, err := b.uploadDeltaLog(ctx, 1, 10, dData, meta)
|
||||||
assert.Nil(t, in)
|
assert.NoError(t, err)
|
||||||
|
assert.NotNil(t, deltas)
|
||||||
|
assert.Equal(t, 1, len(deltas[0].GetBinlogs()))
|
||||||
|
})
|
||||||
|
|
||||||
deltas, err = b.uploadDeltaLog(ctx, 1, 10, dData, meta)
|
t.Run("Test context Done", func(t *testing.T) {
|
||||||
assert.EqualError(t, err, errUploadToBlobStorage.Error())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
assert.Nil(t, deltas)
|
cancel()
|
||||||
|
|
||||||
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().GetGenerator(mock.Anything, mock.Anything).Call.Return(validGeneratorFn, nil)
|
||||||
|
alloc.EXPECT().AllocOne().Call.Return(int64(11111), nil)
|
||||||
|
|
||||||
|
b := &binlogIO{cm, alloc}
|
||||||
|
|
||||||
|
p, err := b.upload(ctx, 1, 10, []*InsertData{iData}, dData, meta)
|
||||||
|
assert.EqualError(t, err, errUploadToBlobStorage.Error())
|
||||||
|
assert.Nil(t, p)
|
||||||
|
|
||||||
|
in, _, err := b.uploadInsertLog(ctx, 1, 10, iData, meta)
|
||||||
|
assert.EqualError(t, err, errUploadToBlobStorage.Error())
|
||||||
|
assert.Nil(t, in)
|
||||||
|
|
||||||
|
deltas, err := b.uploadDeltaLog(ctx, 1, 10, dData, meta)
|
||||||
|
assert.EqualError(t, err, errUploadToBlobStorage.Error())
|
||||||
|
assert.Nil(t, deltas)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Test upload error", func(t *testing.T) {
|
t.Run("Test upload error", func(t *testing.T) {
|
||||||
@ -110,85 +153,74 @@ func TestBinlogIOInterfaceMethods(t *testing.T) {
|
|||||||
Tss: []uint64{},
|
Tss: []uint64{},
|
||||||
}
|
}
|
||||||
|
|
||||||
iData := genEmptyInsertData()
|
t.Run("Test upload empty insertData", func(t *testing.T) {
|
||||||
p, err := b.upload(context.TODO(), 1, 10, []*InsertData{iData}, dData, meta)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
assert.NoError(t, err)
|
b := &binlogIO{cm, alloc}
|
||||||
assert.Empty(t, p.inPaths)
|
|
||||||
assert.Empty(t, p.statsPaths)
|
|
||||||
assert.Empty(t, p.deltaInfo)
|
|
||||||
|
|
||||||
iData = &InsertData{Data: make(map[int64]storage.FieldData)}
|
iData := genEmptyInsertData()
|
||||||
p, err = b.upload(context.TODO(), 1, 10, []*InsertData{iData}, dData, meta)
|
p, err := b.upload(context.TODO(), 1, 10, []*InsertData{iData}, dData, meta)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Empty(t, p.inPaths)
|
assert.Empty(t, p.inPaths)
|
||||||
assert.Empty(t, p.statsPaths)
|
assert.Empty(t, p.statsPaths)
|
||||||
assert.Empty(t, p.deltaInfo)
|
assert.Empty(t, p.deltaInfo)
|
||||||
|
|
||||||
iData = genInsertData()
|
iData = &InsertData{Data: make(map[int64]storage.FieldData)}
|
||||||
dData = &DeleteData{
|
p, err = b.upload(context.TODO(), 1, 10, []*InsertData{iData}, dData, meta)
|
||||||
Pks: []primaryKey{},
|
assert.NoError(t, err)
|
||||||
Tss: []uint64{1},
|
assert.Empty(t, p.inPaths)
|
||||||
RowCount: 1,
|
assert.Empty(t, p.statsPaths)
|
||||||
}
|
assert.Empty(t, p.deltaInfo)
|
||||||
p, err = b.upload(context.TODO(), 1, 10, []*InsertData{iData}, dData, meta)
|
})
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Empty(t, p)
|
|
||||||
|
|
||||||
mkc := &mockCm{errMultiSave: true}
|
t.Run("Test deleta data not match", func(t *testing.T) {
|
||||||
bin := &binlogIO{mkc, alloc}
|
alloc := allocator.NewMockAllocator(t)
|
||||||
iData = genInsertData()
|
alloc.EXPECT().GetGenerator(mock.Anything, mock.Anything).Call.Return(validGeneratorFn, nil)
|
||||||
pk := newInt64PrimaryKey(1)
|
b := &binlogIO{cm, alloc}
|
||||||
dData = &DeleteData{
|
iData := genInsertData()
|
||||||
Pks: []primaryKey{pk},
|
dData := &DeleteData{
|
||||||
Tss: []uint64{1},
|
Pks: []primaryKey{},
|
||||||
RowCount: 1,
|
Tss: []uint64{1},
|
||||||
}
|
RowCount: 1,
|
||||||
ctx, cancel := context.WithTimeout(context.TODO(), 20*time.Millisecond)
|
}
|
||||||
p, err = bin.upload(ctx, 1, 10, []*InsertData{iData}, dData, meta)
|
p, err := b.upload(context.TODO(), 1, 10, []*InsertData{iData}, dData, meta)
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
assert.Empty(t, p)
|
assert.Empty(t, p)
|
||||||
|
})
|
||||||
|
|
||||||
in, _, err := b.uploadInsertLog(ctx, 1, 10, iData, meta)
|
t.Run("Test multisave error", func(t *testing.T) {
|
||||||
assert.Error(t, err)
|
mkc := &mockCm{errMultiSave: true}
|
||||||
assert.Empty(t, in)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().GetGenerator(mock.Anything, mock.Anything).Call.Return(validGeneratorFn, nil)
|
||||||
|
alloc.EXPECT().AllocOne().Call.Return(int64(11111), nil)
|
||||||
|
var (
|
||||||
|
b = &binlogIO{mkc, alloc}
|
||||||
|
iData = genInsertData()
|
||||||
|
pk = newInt64PrimaryKey(1)
|
||||||
|
dData = &DeleteData{
|
||||||
|
Pks: []primaryKey{pk},
|
||||||
|
Tss: []uint64{1},
|
||||||
|
RowCount: 1,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
ctx, cancel := context.WithTimeout(context.TODO(), 20*time.Millisecond)
|
||||||
|
p, err := b.upload(ctx, 1, 10, []*InsertData{iData}, dData, meta)
|
||||||
|
assert.Error(t, err)
|
||||||
|
assert.Empty(t, p)
|
||||||
|
|
||||||
deltas, err := b.uploadDeltaLog(ctx, 1, 10, dData, meta)
|
in, _, err := b.uploadInsertLog(ctx, 1, 10, iData, meta)
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
assert.Empty(t, deltas)
|
assert.Empty(t, in)
|
||||||
|
|
||||||
alloc.isvalid = false
|
deltas, err := b.uploadDeltaLog(ctx, 1, 10, dData, meta)
|
||||||
p, err = bin.upload(ctx, 1, 10, []*InsertData{iData}, dData, meta)
|
assert.Error(t, err)
|
||||||
assert.Error(t, err)
|
assert.Empty(t, deltas)
|
||||||
assert.Empty(t, p)
|
cancel()
|
||||||
|
})
|
||||||
in, _, err = b.uploadInsertLog(ctx, 1, 10, iData, meta)
|
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Empty(t, in)
|
|
||||||
|
|
||||||
deltas, err = b.uploadDeltaLog(ctx, 1, 10, dData, meta)
|
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Empty(t, deltas)
|
|
||||||
|
|
||||||
alloc.isvalid = true
|
|
||||||
for _, field := range meta.GetSchema().GetFields() {
|
|
||||||
field.IsPrimaryKey = false
|
|
||||||
}
|
|
||||||
p, err = bin.upload(ctx, 1, 10, []*InsertData{iData}, dData, meta)
|
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Empty(t, p)
|
|
||||||
|
|
||||||
in, _, err = b.uploadInsertLog(ctx, 1, 10, iData, meta)
|
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Empty(t, in)
|
|
||||||
|
|
||||||
deltas, err = b.uploadDeltaLog(ctx, 1, 10, dData, meta)
|
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Empty(t, deltas)
|
|
||||||
|
|
||||||
cancel()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Test download", func(t *testing.T) {
|
t.Run("Test download", func(t *testing.T) {
|
||||||
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
b := &binlogIO{cm, alloc}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
isvalid bool
|
isvalid bool
|
||||||
ks []string // for preparation
|
ks []string // for preparation
|
||||||
@ -232,6 +264,7 @@ func TestBinlogIOInterfaceMethods(t *testing.T) {
|
|||||||
|
|
||||||
t.Run("Test download twice", func(t *testing.T) {
|
t.Run("Test download twice", func(t *testing.T) {
|
||||||
mkc := &mockCm{errMultiLoad: true}
|
mkc := &mockCm{errMultiLoad: true}
|
||||||
|
alloc := allocator.NewMockAllocator(t)
|
||||||
b := &binlogIO{mkc, alloc}
|
b := &binlogIO{mkc, alloc}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.TODO(), time.Millisecond*20)
|
ctx, cancel := context.WithTimeout(context.TODO(), time.Millisecond*20)
|
||||||
@ -259,15 +292,14 @@ func prepareBlob(cm storage.ChunkManager, key string) ([]byte, string, error) {
|
|||||||
func TestBinlogIOInnerMethods(t *testing.T) {
|
func TestBinlogIOInnerMethods(t *testing.T) {
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
alloc := NewAllocatorFactory()
|
|
||||||
cm := storage.NewLocalChunkManager(storage.RootPath(binlogTestDir))
|
cm := storage.NewLocalChunkManager(storage.RootPath(binlogTestDir))
|
||||||
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
||||||
b := &binlogIO{
|
|
||||||
cm,
|
|
||||||
alloc,
|
|
||||||
}
|
|
||||||
|
|
||||||
t.Run("Test genDeltaBlobs", func(t *testing.T) {
|
t.Run("Test genDeltaBlobs", func(t *testing.T) {
|
||||||
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().AllocOne().Call.Return(int64(11111), nil)
|
||||||
|
|
||||||
|
b := &binlogIO{cm, alloc}
|
||||||
f := &MetaFactory{}
|
f := &MetaFactory{}
|
||||||
meta := f.GetCollectionMeta(UniqueID(10002), "test_gen_blobs", schemapb.DataType_Int64)
|
meta := f.GetCollectionMeta(UniqueID(10002), "test_gen_blobs", schemapb.DataType_Int64)
|
||||||
|
|
||||||
@ -302,23 +334,34 @@ func TestBinlogIOInnerMethods(t *testing.T) {
|
|||||||
|
|
||||||
t.Run("Test genDeltaBlobs error", func(t *testing.T) {
|
t.Run("Test genDeltaBlobs error", func(t *testing.T) {
|
||||||
pk := newInt64PrimaryKey(1)
|
pk := newInt64PrimaryKey(1)
|
||||||
k, v, err := b.genDeltaBlobs(&DeleteData{Pks: []primaryKey{pk}, Tss: []uint64{}}, 1, 1, 1)
|
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Empty(t, k)
|
|
||||||
assert.Empty(t, v)
|
|
||||||
|
|
||||||
errAlloc := NewAllocatorFactory()
|
t.Run("Test serialize error", func(t *testing.T) {
|
||||||
errAlloc.isvalid = false
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
b := &binlogIO{cm, alloc}
|
||||||
|
k, v, err := b.genDeltaBlobs(&DeleteData{Pks: []primaryKey{pk}, Tss: []uint64{}}, 1, 1, 1)
|
||||||
|
assert.Error(t, err)
|
||||||
|
assert.Empty(t, k)
|
||||||
|
assert.Empty(t, v)
|
||||||
|
})
|
||||||
|
|
||||||
bin := binlogIO{cm, errAlloc}
|
t.Run("Test AllocOne error", func(t *testing.T) {
|
||||||
k, v, err = bin.genDeltaBlobs(&DeleteData{Pks: []primaryKey{pk}, Tss: []uint64{1}}, 1, 1, 1)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
assert.Error(t, err)
|
alloc.EXPECT().AllocOne().Call.Return(int64(0), fmt.Errorf("mock AllocOne error"))
|
||||||
assert.Empty(t, k)
|
bin := binlogIO{cm, alloc}
|
||||||
assert.Empty(t, v)
|
k, v, err := bin.genDeltaBlobs(&DeleteData{Pks: []primaryKey{pk}, Tss: []uint64{1}}, 1, 1, 1)
|
||||||
|
assert.Error(t, err)
|
||||||
|
assert.Empty(t, k)
|
||||||
|
assert.Empty(t, v)
|
||||||
|
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Test genInsertBlobs", func(t *testing.T) {
|
t.Run("Test genInsertBlobs", func(t *testing.T) {
|
||||||
f := &MetaFactory{}
|
f := &MetaFactory{}
|
||||||
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().GetGenerator(mock.Anything, mock.Anything).Call.Return(validGeneratorFn, nil)
|
||||||
|
b := binlogIO{cm, alloc}
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
pkType schemapb.DataType
|
pkType schemapb.DataType
|
||||||
description string
|
description string
|
||||||
@ -353,81 +396,36 @@ func TestBinlogIOInnerMethods(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Test genInsertBlobs error", func(t *testing.T) {
|
t.Run("Test genInsertBlobs error", func(t *testing.T) {
|
||||||
kvs, pin, pstats, err := b.genInsertBlobs(&InsertData{}, 1, 1, nil)
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
assert.Error(t, err)
|
defer cancel()
|
||||||
assert.Empty(t, kvs)
|
cm := storage.NewLocalChunkManager(storage.RootPath(binlogTestDir))
|
||||||
assert.Empty(t, pin)
|
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
||||||
assert.Empty(t, pstats)
|
|
||||||
|
|
||||||
f := &MetaFactory{}
|
t.Run("serialize error", func(t *testing.T) {
|
||||||
meta := f.GetCollectionMeta(UniqueID(10001), "test_gen_blobs", schemapb.DataType_Int64)
|
bin := &binlogIO{cm, allocator.NewMockAllocator(t)}
|
||||||
|
kvs, pin, pstats, err := bin.genInsertBlobs(genEmptyInsertData(), 10, 1, nil)
|
||||||
|
|
||||||
kvs, pin, pstats, err = b.genInsertBlobs(genEmptyInsertData(), 10, 1, meta)
|
assert.Error(t, err)
|
||||||
assert.Error(t, err)
|
assert.Empty(t, kvs)
|
||||||
assert.Empty(t, kvs)
|
assert.Empty(t, pin)
|
||||||
assert.Empty(t, pin)
|
assert.Empty(t, pstats)
|
||||||
assert.Empty(t, pstats)
|
})
|
||||||
|
|
||||||
errAlloc := NewAllocatorFactory()
|
t.Run("GetGenerator error", func(t *testing.T) {
|
||||||
errAlloc.errAllocBatch = true
|
f := &MetaFactory{}
|
||||||
bin := &binlogIO{cm, errAlloc}
|
meta := f.GetCollectionMeta(UniqueID(10001), "test_gen_blobs", schemapb.DataType_Int64)
|
||||||
kvs, pin, pstats, err = bin.genInsertBlobs(genInsertData(), 10, 1, meta)
|
|
||||||
|
|
||||||
assert.Error(t, err)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
assert.Empty(t, kvs)
|
alloc.EXPECT().GetGenerator(mock.Anything, mock.Anything).Return(nil, fmt.Errorf("mock GetGenerator error"))
|
||||||
assert.Empty(t, pin)
|
bin := &binlogIO{cm, alloc}
|
||||||
assert.Empty(t, pstats)
|
kvs, pin, pstats, err := bin.genInsertBlobs(genInsertData(), 10, 1, meta)
|
||||||
|
|
||||||
|
assert.Error(t, err)
|
||||||
|
assert.Empty(t, kvs)
|
||||||
|
assert.Empty(t, pin)
|
||||||
|
assert.Empty(t, pstats)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Test idxGenerator", func(t *testing.T) {
|
|
||||||
tests := []struct {
|
|
||||||
isvalid bool
|
|
||||||
innumber int
|
|
||||||
|
|
||||||
expectedNo int
|
|
||||||
description string
|
|
||||||
}{
|
|
||||||
{false, 0, 0, "Invalid input count n"},
|
|
||||||
{true, 1, 1, "valid input n 1"},
|
|
||||||
{true, 3, 3, "valid input n 3 with cancel"},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, test := range tests {
|
|
||||||
t.Run(test.description, func(t *testing.T) {
|
|
||||||
done := make(chan struct{})
|
|
||||||
if test.isvalid {
|
|
||||||
gen, err := b.idxGenerator(test.innumber, done)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
r := make([]UniqueID, 0)
|
|
||||||
for i := range gen {
|
|
||||||
r = append(r, i)
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, test.expectedNo, len(r))
|
|
||||||
|
|
||||||
if test.innumber > 1 {
|
|
||||||
donedone := make(chan struct{})
|
|
||||||
gen, err := b.idxGenerator(test.innumber, donedone)
|
|
||||||
assert.NoError(t, err)
|
|
||||||
|
|
||||||
_, ok := <-gen
|
|
||||||
assert.True(t, ok)
|
|
||||||
|
|
||||||
donedone <- struct{}{}
|
|
||||||
|
|
||||||
_, ok = <-gen
|
|
||||||
assert.False(t, ok)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
gen, err := b.idxGenerator(test.innumber, done)
|
|
||||||
assert.Error(t, err)
|
|
||||||
assert.Nil(t, gen)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type mockCm struct {
|
type mockCm struct {
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import (
|
|||||||
|
|
||||||
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
||||||
"github.com/milvus-io/milvus/internal/common"
|
"github.com/milvus-io/milvus/internal/common"
|
||||||
|
"github.com/milvus-io/milvus/internal/datanode/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/log"
|
"github.com/milvus-io/milvus/internal/log"
|
||||||
"github.com/milvus-io/milvus/internal/metrics"
|
"github.com/milvus-io/milvus/internal/metrics"
|
||||||
"github.com/milvus-io/milvus/internal/proto/datapb"
|
"github.com/milvus-io/milvus/internal/proto/datapb"
|
||||||
@ -75,7 +76,7 @@ type compactionTask struct {
|
|||||||
compactor
|
compactor
|
||||||
Channel
|
Channel
|
||||||
flushManager
|
flushManager
|
||||||
allocatorInterface
|
allocator.Allocator
|
||||||
|
|
||||||
plan *datapb.CompactionPlan
|
plan *datapb.CompactionPlan
|
||||||
|
|
||||||
@ -97,7 +98,7 @@ func newCompactionTask(
|
|||||||
ul uploader,
|
ul uploader,
|
||||||
channel Channel,
|
channel Channel,
|
||||||
fm flushManager,
|
fm flushManager,
|
||||||
alloc allocatorInterface,
|
alloc allocator.Allocator,
|
||||||
plan *datapb.CompactionPlan,
|
plan *datapb.CompactionPlan,
|
||||||
chunkManager storage.ChunkManager) *compactionTask {
|
chunkManager storage.ChunkManager) *compactionTask {
|
||||||
|
|
||||||
@ -106,15 +107,15 @@ func newCompactionTask(
|
|||||||
ctx: ctx1,
|
ctx: ctx1,
|
||||||
cancel: cancel,
|
cancel: cancel,
|
||||||
|
|
||||||
downloader: dl,
|
downloader: dl,
|
||||||
uploader: ul,
|
uploader: ul,
|
||||||
Channel: channel,
|
Channel: channel,
|
||||||
flushManager: fm,
|
flushManager: fm,
|
||||||
allocatorInterface: alloc,
|
Allocator: alloc,
|
||||||
plan: plan,
|
plan: plan,
|
||||||
tr: timerecord.NewTimeRecorder("compactionTask"),
|
tr: timerecord.NewTimeRecorder("compactionTask"),
|
||||||
chunkManager: chunkManager,
|
chunkManager: chunkManager,
|
||||||
done: make(chan struct{}, 1),
|
done: make(chan struct{}, 1),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,7 +446,7 @@ func (t *compactionTask) compact() (*datapb.CompactionResult, error) {
|
|||||||
return nil, errIllegalCompactionPlan
|
return nil, errIllegalCompactionPlan
|
||||||
|
|
||||||
case t.plan.GetType() == datapb.CompactionType_MergeCompaction || t.plan.GetType() == datapb.CompactionType_MixCompaction:
|
case t.plan.GetType() == datapb.CompactionType_MergeCompaction || t.plan.GetType() == datapb.CompactionType_MixCompaction:
|
||||||
targetSegID, err = t.allocID()
|
targetSegID, err = t.AllocOne()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn("compact wrong", zap.Error(err))
|
log.Warn("compact wrong", zap.Error(err))
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@ -38,6 +38,8 @@ import (
|
|||||||
"github.com/milvus-io/milvus/internal/proto/etcdpb"
|
"github.com/milvus-io/milvus/internal/proto/etcdpb"
|
||||||
"github.com/milvus-io/milvus/internal/storage"
|
"github.com/milvus-io/milvus/internal/storage"
|
||||||
"github.com/milvus-io/milvus/internal/util/paramtable"
|
"github.com/milvus-io/milvus/internal/util/paramtable"
|
||||||
|
|
||||||
|
"github.com/milvus-io/milvus/internal/datanode/allocator"
|
||||||
)
|
)
|
||||||
|
|
||||||
var compactTestDir = "/tmp/milvus_test/compact"
|
var compactTestDir = "/tmp/milvus_test/compact"
|
||||||
@ -276,8 +278,10 @@ func TestCompactionTaskInnerMethods(t *testing.T) {
|
|||||||
Schema: meta.GetSchema(),
|
Schema: meta.GetSchema(),
|
||||||
}, nil)
|
}, nil)
|
||||||
channel := newChannel("a", collectionID, meta.GetSchema(), rc, nil)
|
channel := newChannel("a", collectionID, meta.GetSchema(), rc, nil)
|
||||||
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().GetGenerator(mock.Anything, mock.Anything).Call.Return(validGeneratorFn, nil)
|
||||||
t.Run("Merge without expiration", func(t *testing.T) {
|
t.Run("Merge without expiration", func(t *testing.T) {
|
||||||
alloc := NewAllocatorFactory(1)
|
|
||||||
mockbIO := &binlogIO{cm, alloc}
|
mockbIO := &binlogIO{cm, alloc}
|
||||||
paramtable.Get().Save(Params.CommonCfg.EntityExpirationTTL.Key, "0")
|
paramtable.Get().Save(Params.CommonCfg.EntityExpirationTTL.Key, "0")
|
||||||
iData := genInsertDataWithExpiredTS()
|
iData := genInsertDataWithExpiredTS()
|
||||||
@ -309,7 +313,6 @@ func TestCompactionTaskInnerMethods(t *testing.T) {
|
|||||||
assert.Equal(t, 1, len(statsPaths))
|
assert.Equal(t, 1, len(statsPaths))
|
||||||
})
|
})
|
||||||
t.Run("Merge without expiration2", func(t *testing.T) {
|
t.Run("Merge without expiration2", func(t *testing.T) {
|
||||||
alloc := NewAllocatorFactory(1)
|
|
||||||
mockbIO := &binlogIO{cm, alloc}
|
mockbIO := &binlogIO{cm, alloc}
|
||||||
paramtable.Get().Save(Params.CommonCfg.EntityExpirationTTL.Key, "0")
|
paramtable.Get().Save(Params.CommonCfg.EntityExpirationTTL.Key, "0")
|
||||||
BinLogMaxSize := Params.DataNodeCfg.BinLogMaxSize
|
BinLogMaxSize := Params.DataNodeCfg.BinLogMaxSize
|
||||||
@ -347,7 +350,6 @@ func TestCompactionTaskInnerMethods(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Merge with expiration", func(t *testing.T) {
|
t.Run("Merge with expiration", func(t *testing.T) {
|
||||||
alloc := NewAllocatorFactory(1)
|
|
||||||
mockbIO := &binlogIO{cm, alloc}
|
mockbIO := &binlogIO{cm, alloc}
|
||||||
|
|
||||||
iData := genInsertDataWithExpiredTS()
|
iData := genInsertDataWithExpiredTS()
|
||||||
@ -390,7 +392,6 @@ func TestCompactionTaskInnerMethods(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Merge with meta error", func(t *testing.T) {
|
t.Run("Merge with meta error", func(t *testing.T) {
|
||||||
alloc := NewAllocatorFactory(1)
|
|
||||||
mockbIO := &binlogIO{cm, alloc}
|
mockbIO := &binlogIO{cm, alloc}
|
||||||
paramtable.Get().Save(Params.CommonCfg.EntityExpirationTTL.Key, "0")
|
paramtable.Get().Save(Params.CommonCfg.EntityExpirationTTL.Key, "0")
|
||||||
iData := genInsertDataWithExpiredTS()
|
iData := genInsertDataWithExpiredTS()
|
||||||
@ -427,7 +428,6 @@ func TestCompactionTaskInnerMethods(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Merge with meta type param error", func(t *testing.T) {
|
t.Run("Merge with meta type param error", func(t *testing.T) {
|
||||||
alloc := NewAllocatorFactory(1)
|
|
||||||
mockbIO := &binlogIO{cm, alloc}
|
mockbIO := &binlogIO{cm, alloc}
|
||||||
paramtable.Get().Save(Params.CommonCfg.EntityExpirationTTL.Key, "0")
|
paramtable.Get().Save(Params.CommonCfg.EntityExpirationTTL.Key, "0")
|
||||||
iData := genInsertDataWithExpiredTS()
|
iData := genInsertDataWithExpiredTS()
|
||||||
@ -574,12 +574,14 @@ func TestCompactorInterfaceMethods(t *testing.T) {
|
|||||||
paramtable.Get().Save(Params.CommonCfg.EntityExpirationTTL.Key, "0") // Turn off auto expiration
|
paramtable.Get().Save(Params.CommonCfg.EntityExpirationTTL.Key, "0") // Turn off auto expiration
|
||||||
|
|
||||||
t.Run("Test compact invalid", func(t *testing.T) {
|
t.Run("Test compact invalid", func(t *testing.T) {
|
||||||
invalidAlloc := NewAllocatorFactory(-1)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().AllocOne().Call.Return(int64(11111), nil)
|
||||||
ctx, cancel := context.WithCancel(context.TODO())
|
ctx, cancel := context.WithCancel(context.TODO())
|
||||||
emptyTask := &compactionTask{
|
emptyTask := &compactionTask{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
cancel: cancel,
|
cancel: cancel,
|
||||||
done: make(chan struct{}, 1),
|
done: make(chan struct{}, 1),
|
||||||
|
Channel: &ChannelMeta{},
|
||||||
}
|
}
|
||||||
|
|
||||||
plan := &datapb.CompactionPlan{
|
plan := &datapb.CompactionPlan{
|
||||||
@ -596,7 +598,7 @@ func TestCompactorInterfaceMethods(t *testing.T) {
|
|||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
|
||||||
plan.Type = datapb.CompactionType_MergeCompaction
|
plan.Type = datapb.CompactionType_MergeCompaction
|
||||||
emptyTask.allocatorInterface = invalidAlloc
|
emptyTask.Allocator = alloc
|
||||||
plan.SegmentBinlogs = notEmptySegmentBinlogs
|
plan.SegmentBinlogs = notEmptySegmentBinlogs
|
||||||
_, err = emptyTask.compact()
|
_, err = emptyTask.compact()
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
@ -606,7 +608,9 @@ func TestCompactorInterfaceMethods(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("Test typeII compact valid", func(t *testing.T) {
|
t.Run("Test typeII compact valid", func(t *testing.T) {
|
||||||
alloc := NewAllocatorFactory(1)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().GetGenerator(mock.Anything, mock.Anything).Call.Return(validGeneratorFn, nil)
|
||||||
|
alloc.EXPECT().AllocOne().Call.Return(int64(19530), nil)
|
||||||
type testCase struct {
|
type testCase struct {
|
||||||
pkType schemapb.DataType
|
pkType schemapb.DataType
|
||||||
iData1 storage.FieldData
|
iData1 storage.FieldData
|
||||||
@ -702,7 +706,6 @@ func TestCompactorInterfaceMethods(t *testing.T) {
|
|||||||
Channel: "channelname",
|
Channel: "channelname",
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc.random = false // generated ID = 19530
|
|
||||||
task := newCompactionTask(context.TODO(), mockbIO, mockbIO, channel, mockfm, alloc, plan, nil)
|
task := newCompactionTask(context.TODO(), mockbIO, mockbIO, channel, mockfm, alloc, plan, nil)
|
||||||
result, err := task.compact()
|
result, err := task.compact()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
@ -775,7 +778,9 @@ func TestCompactorInterfaceMethods(t *testing.T) {
|
|||||||
// Both pk = 1 rows of the two segments are compacted.
|
// Both pk = 1 rows of the two segments are compacted.
|
||||||
var collID, partID, segID1, segID2 UniqueID = 1, 10, 200, 201
|
var collID, partID, segID1, segID2 UniqueID = 1, 10, 200, 201
|
||||||
|
|
||||||
alloc := NewAllocatorFactory(1)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().AllocOne().Call.Return(int64(19530), nil)
|
||||||
|
alloc.EXPECT().GetGenerator(mock.Anything, mock.Anything).Call.Return(validGeneratorFn, nil)
|
||||||
rc := &RootCoordFactory{
|
rc := &RootCoordFactory{
|
||||||
pkType: schemapb.DataType_Int64,
|
pkType: schemapb.DataType_Int64,
|
||||||
}
|
}
|
||||||
@ -838,7 +843,6 @@ func TestCompactorInterfaceMethods(t *testing.T) {
|
|||||||
Channel: "channelname",
|
Channel: "channelname",
|
||||||
}
|
}
|
||||||
|
|
||||||
alloc.random = false // generated ID = 19530
|
|
||||||
task := newCompactionTask(context.TODO(), mockbIO, mockbIO, channel, mockfm, alloc, plan, nil)
|
task := newCompactionTask(context.TODO(), mockbIO, mockbIO, channel, mockfm, alloc, plan, nil)
|
||||||
result, err := task.compact()
|
result, err := task.compact()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|||||||
@ -35,12 +35,13 @@ import (
|
|||||||
"github.com/cockroachdb/errors"
|
"github.com/cockroachdb/errors"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
|
||||||
v3rpc "go.etcd.io/etcd/api/v3/v3rpc/rpctypes"
|
v3rpc "go.etcd.io/etcd/api/v3/v3rpc/rpctypes"
|
||||||
clientv3 "go.etcd.io/etcd/client/v3"
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
allocator2 "github.com/milvus-io/milvus/internal/allocator"
|
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
||||||
|
|
||||||
|
"github.com/milvus-io/milvus/internal/datanode/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/kv"
|
"github.com/milvus-io/milvus/internal/kv"
|
||||||
etcdkv "github.com/milvus-io/milvus/internal/kv/etcd"
|
etcdkv "github.com/milvus-io/milvus/internal/kv/etcd"
|
||||||
"github.com/milvus-io/milvus/internal/log"
|
"github.com/milvus-io/milvus/internal/log"
|
||||||
@ -119,12 +120,12 @@ type DataNode struct {
|
|||||||
dataCoord types.DataCoord
|
dataCoord types.DataCoord
|
||||||
|
|
||||||
//call once
|
//call once
|
||||||
initOnce sync.Once
|
initOnce sync.Once
|
||||||
sessionMu sync.Mutex // to fix data race
|
sessionMu sync.Mutex // to fix data race
|
||||||
session *sessionutil.Session
|
session *sessionutil.Session
|
||||||
watchKv kv.MetaKv
|
watchKv kv.MetaKv
|
||||||
chunkManager storage.ChunkManager
|
chunkManager storage.ChunkManager
|
||||||
rowIDAllocator *allocator2.IDAllocator
|
allocator allocator.Allocator
|
||||||
|
|
||||||
closer io.Closer
|
closer io.Closer
|
||||||
|
|
||||||
@ -254,7 +255,7 @@ func (node *DataNode) Init() error {
|
|||||||
node.dispClient = msgdispatcher.NewClient(node.factory, typeutil.DataNodeRole, paramtable.GetNodeID())
|
node.dispClient = msgdispatcher.NewClient(node.factory, typeutil.DataNodeRole, paramtable.GetNodeID())
|
||||||
log.Info("DataNode server init dispatcher client done", zap.Int64("node ID", paramtable.GetNodeID()))
|
log.Info("DataNode server init dispatcher client done", zap.Int64("node ID", paramtable.GetNodeID()))
|
||||||
|
|
||||||
idAllocator, err := allocator2.NewIDAllocator(node.ctx, node.rootCoord, paramtable.GetNodeID())
|
alloc, err := allocator.New(context.Background(), node.rootCoord, paramtable.GetNodeID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("failed to create id allocator",
|
log.Error("failed to create id allocator",
|
||||||
zap.Error(err),
|
zap.Error(err),
|
||||||
@ -262,7 +263,7 @@ func (node *DataNode) Init() error {
|
|||||||
initError = err
|
initError = err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
node.rowIDAllocator = idAllocator
|
node.allocator = alloc
|
||||||
|
|
||||||
node.factory.Init(Params)
|
node.factory.Init(Params)
|
||||||
log.Info("DataNode server init succeeded",
|
log.Info("DataNode server init succeeded",
|
||||||
@ -489,7 +490,7 @@ func (node *DataNode) BackGroundGC(vChannelCh <-chan string) {
|
|||||||
|
|
||||||
// Start will update DataNode state to HEALTHY
|
// Start will update DataNode state to HEALTHY
|
||||||
func (node *DataNode) Start() error {
|
func (node *DataNode) Start() error {
|
||||||
if err := node.rowIDAllocator.Start(); err != nil {
|
if err := node.allocator.Start(); err != nil {
|
||||||
log.Error("failed to start id allocator", zap.Error(err), zap.String("role", typeutil.DataNodeRole))
|
log.Error("failed to start id allocator", zap.Error(err), zap.String("role", typeutil.DataNodeRole))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -565,14 +566,13 @@ func (node *DataNode) ReadyToFlush() error {
|
|||||||
func (node *DataNode) Stop() error {
|
func (node *DataNode) Stop() error {
|
||||||
// https://github.com/milvus-io/milvus/issues/12282
|
// https://github.com/milvus-io/milvus/issues/12282
|
||||||
node.UpdateStateCode(commonpb.StateCode_Abnormal)
|
node.UpdateStateCode(commonpb.StateCode_Abnormal)
|
||||||
|
|
||||||
node.cancel()
|
|
||||||
node.flowgraphManager.dropAll()
|
node.flowgraphManager.dropAll()
|
||||||
node.flowgraphManager.stop()
|
node.flowgraphManager.stop()
|
||||||
|
|
||||||
if node.rowIDAllocator != nil {
|
node.cancel()
|
||||||
|
if node.allocator != nil {
|
||||||
log.Info("close id allocator", zap.String("role", typeutil.DataNodeRole))
|
log.Info("close id allocator", zap.String("role", typeutil.DataNodeRole))
|
||||||
node.rowIDAllocator.Close()
|
node.allocator.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
if node.closer != nil {
|
if node.closer != nil {
|
||||||
|
|||||||
@ -242,7 +242,6 @@ func TestWatchChannel(t *testing.T) {
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
t.Run("test watch channel", func(t *testing.T) {
|
t.Run("test watch channel", func(t *testing.T) {
|
||||||
// GOOSE TODO
|
|
||||||
kv := etcdkv.NewEtcdKV(etcdCli, Params.EtcdCfg.MetaRootPath.GetValue())
|
kv := etcdkv.NewEtcdKV(etcdCli, Params.EtcdCfg.MetaRootPath.GetValue())
|
||||||
oldInvalidCh := "datanode-etcd-test-by-dev-rootcoord-dml-channel-invalid"
|
oldInvalidCh := "datanode-etcd-test-by-dev-rootcoord-dml-channel-invalid"
|
||||||
path := fmt.Sprintf("%s/%d/%s", Params.CommonCfg.DataCoordWatchSubPath.GetValue(), paramtable.GetNodeID(), oldInvalidCh)
|
path := fmt.Sprintf("%s/%d/%s", Params.CommonCfg.DataCoordWatchSubPath.GetValue(), paramtable.GetNodeID(), oldInvalidCh)
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import (
|
|||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
||||||
|
"github.com/milvus-io/milvus/internal/datanode/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/log"
|
"github.com/milvus-io/milvus/internal/log"
|
||||||
"github.com/milvus-io/milvus/internal/metrics"
|
"github.com/milvus-io/milvus/internal/metrics"
|
||||||
"github.com/milvus-io/milvus/internal/mq/msgdispatcher"
|
"github.com/milvus-io/milvus/internal/mq/msgdispatcher"
|
||||||
@ -48,9 +49,9 @@ type dataSyncService struct {
|
|||||||
cancelFn context.CancelFunc
|
cancelFn context.CancelFunc
|
||||||
fg *flowgraph.TimeTickedFlowGraph // internal flowgraph processes insert/delta messages
|
fg *flowgraph.TimeTickedFlowGraph // internal flowgraph processes insert/delta messages
|
||||||
flushCh chan flushMsg
|
flushCh chan flushMsg
|
||||||
resendTTCh chan resendTTMsg // chan to ask for resending DataNode time tick message.
|
resendTTCh chan resendTTMsg // chan to ask for resending DataNode time tick message.
|
||||||
channel Channel // channel stores meta of channel
|
channel Channel // channel stores meta of channel
|
||||||
idAllocator allocatorInterface // id/timestamp allocator
|
idAllocator allocator.Allocator // id/timestamp allocator
|
||||||
dispClient msgdispatcher.Client
|
dispClient msgdispatcher.Client
|
||||||
msFactory msgstream.Factory
|
msFactory msgstream.Factory
|
||||||
collectionID UniqueID // collection id of vchan for which this data sync service serves
|
collectionID UniqueID // collection id of vchan for which this data sync service serves
|
||||||
@ -73,7 +74,7 @@ func newDataSyncService(ctx context.Context,
|
|||||||
flushCh chan flushMsg,
|
flushCh chan flushMsg,
|
||||||
resendTTCh chan resendTTMsg,
|
resendTTCh chan resendTTMsg,
|
||||||
channel Channel,
|
channel Channel,
|
||||||
alloc allocatorInterface,
|
alloc allocator.Allocator,
|
||||||
dispClient msgdispatcher.Client,
|
dispClient msgdispatcher.Client,
|
||||||
factory msgstream.Factory,
|
factory msgstream.Factory,
|
||||||
vchan *datapb.VchannelInfo,
|
vchan *datapb.VchannelInfo,
|
||||||
@ -135,7 +136,7 @@ type nodeConfig struct {
|
|||||||
collectionID UniqueID
|
collectionID UniqueID
|
||||||
vChannelName string
|
vChannelName string
|
||||||
channel Channel // Channel info
|
channel Channel // Channel info
|
||||||
allocator allocatorInterface
|
allocator allocator.Allocator
|
||||||
serverID int64
|
serverID int64
|
||||||
// defaults
|
// defaults
|
||||||
parallelConfig
|
parallelConfig
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/mock"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ import (
|
|||||||
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
||||||
"github.com/milvus-io/milvus/internal/common"
|
"github.com/milvus-io/milvus/internal/common"
|
||||||
|
"github.com/milvus-io/milvus/internal/datanode/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/log"
|
"github.com/milvus-io/milvus/internal/log"
|
||||||
"github.com/milvus-io/milvus/internal/mq/msgdispatcher"
|
"github.com/milvus-io/milvus/internal/mq/msgdispatcher"
|
||||||
"github.com/milvus-io/milvus/internal/mq/msgstream"
|
"github.com/milvus-io/milvus/internal/mq/msgstream"
|
||||||
@ -113,7 +115,7 @@ type testInfo struct {
|
|||||||
description string
|
description string
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDataSyncService_newDataSyncService(te *testing.T) {
|
func TestDataSyncService_newDataSyncService(t *testing.T) {
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
@ -158,7 +160,7 @@ func TestDataSyncService_newDataSyncService(te *testing.T) {
|
|||||||
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
te.Run(test.description, func(t *testing.T) {
|
t.Run(test.description, func(t *testing.T) {
|
||||||
df := &DataCoordFactory{}
|
df := &DataCoordFactory{}
|
||||||
rc := &RootCoordFactory{pkType: schemapb.DataType_Int64}
|
rc := &RootCoordFactory{pkType: schemapb.DataType_Int64}
|
||||||
|
|
||||||
@ -172,7 +174,7 @@ func TestDataSyncService_newDataSyncService(te *testing.T) {
|
|||||||
make(chan flushMsg),
|
make(chan flushMsg),
|
||||||
make(chan resendTTMsg),
|
make(chan resendTTMsg),
|
||||||
channel,
|
channel,
|
||||||
NewAllocatorFactory(),
|
allocator.NewMockAllocator(t),
|
||||||
dispClient,
|
dispClient,
|
||||||
test.inMsgFactory,
|
test.inMsgFactory,
|
||||||
getVchanInfo(test),
|
getVchanInfo(test),
|
||||||
@ -224,7 +226,11 @@ func TestDataSyncService_Start(t *testing.T) {
|
|||||||
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
||||||
channel := newChannel(insertChannelName, collMeta.ID, collMeta.GetSchema(), mockRootCoord, cm)
|
channel := newChannel(insertChannelName, collMeta.ID, collMeta.GetSchema(), mockRootCoord, cm)
|
||||||
|
|
||||||
allocFactory := NewAllocatorFactory(1)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().Alloc(mock.Anything).Call.Return(int64(22222),
|
||||||
|
func(count uint32) int64 {
|
||||||
|
return int64(22222 + count)
|
||||||
|
}, nil)
|
||||||
factory := dependency.NewDefaultFactory(true)
|
factory := dependency.NewDefaultFactory(true)
|
||||||
dispClient := msgdispatcher.NewClient(factory, typeutil.DataNodeRole, paramtable.GetNodeID())
|
dispClient := msgdispatcher.NewClient(factory, typeutil.DataNodeRole, paramtable.GetNodeID())
|
||||||
defer os.RemoveAll("/tmp/milvus")
|
defer os.RemoveAll("/tmp/milvus")
|
||||||
@ -280,7 +286,7 @@ func TestDataSyncService_Start(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
sync, err := newDataSyncService(ctx, flushChan, resendTTChan, channel, allocFactory, dispClient, factory, vchan, signalCh, dataCoord, newCache(), cm, newCompactionExecutor(), genTestTickler(), 0)
|
sync, err := newDataSyncService(ctx, flushChan, resendTTChan, channel, alloc, dispClient, factory, vchan, signalCh, dataCoord, newCache(), cm, newCompactionExecutor(), genTestTickler(), 0)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
sync.flushListener = make(chan *segmentFlushPack)
|
sync.flushListener = make(chan *segmentFlushPack)
|
||||||
@ -401,13 +407,18 @@ func TestDataSyncService_Close(t *testing.T) {
|
|||||||
UnflushedSegmentIds: ufsIds,
|
UnflushedSegmentIds: ufsIds,
|
||||||
FlushedSegmentIds: fsIds,
|
FlushedSegmentIds: fsIds,
|
||||||
}
|
}
|
||||||
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().AllocOne().Call.Return(int64(11111), nil)
|
||||||
|
alloc.EXPECT().Alloc(mock.Anything).Call.Return(int64(22222),
|
||||||
|
func(count uint32) int64 {
|
||||||
|
return int64(22222 + count)
|
||||||
|
}, nil)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
flushChan = make(chan flushMsg, 100)
|
flushChan = make(chan flushMsg, 100)
|
||||||
resendTTChan = make(chan resendTTMsg, 100)
|
resendTTChan = make(chan resendTTMsg, 100)
|
||||||
signalCh = make(chan string, 100)
|
signalCh = make(chan string, 100)
|
||||||
|
|
||||||
allocFactory = NewAllocatorFactory(1)
|
|
||||||
factory = dependency.NewDefaultFactory(true)
|
factory = dependency.NewDefaultFactory(true)
|
||||||
dispClient = msgdispatcher.NewClient(factory, typeutil.DataNodeRole, paramtable.GetNodeID())
|
dispClient = msgdispatcher.NewClient(factory, typeutil.DataNodeRole, paramtable.GetNodeID())
|
||||||
mockDataCoord = &DataCoordFactory{}
|
mockDataCoord = &DataCoordFactory{}
|
||||||
@ -432,7 +443,7 @@ func TestDataSyncService_Close(t *testing.T) {
|
|||||||
paramtable.Get().Reset(Params.DataNodeCfg.FlushInsertBufferSize.Key)
|
paramtable.Get().Reset(Params.DataNodeCfg.FlushInsertBufferSize.Key)
|
||||||
|
|
||||||
channel := newChannel(insertChannelName, collMeta.ID, collMeta.GetSchema(), mockRootCoord, cm)
|
channel := newChannel(insertChannelName, collMeta.ID, collMeta.GetSchema(), mockRootCoord, cm)
|
||||||
sync, err := newDataSyncService(ctx, flushChan, resendTTChan, channel, allocFactory, dispClient, factory, vchan, signalCh, mockDataCoord, newCache(), cm, newCompactionExecutor(), genTestTickler(), 0)
|
sync, err := newDataSyncService(ctx, flushChan, resendTTChan, channel, alloc, dispClient, factory, vchan, signalCh, mockDataCoord, newCache(), cm, newCompactionExecutor(), genTestTickler(), 0)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
sync.flushListener = make(chan *segmentFlushPack, 10)
|
sync.flushListener = make(chan *segmentFlushPack, 10)
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import (
|
|||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
|
||||||
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
||||||
|
"github.com/milvus-io/milvus/internal/datanode/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/log"
|
"github.com/milvus-io/milvus/internal/log"
|
||||||
"github.com/milvus-io/milvus/internal/mq/msgstream"
|
"github.com/milvus-io/milvus/internal/mq/msgstream"
|
||||||
"github.com/milvus-io/milvus/internal/storage"
|
"github.com/milvus-io/milvus/internal/storage"
|
||||||
@ -39,7 +40,7 @@ type deleteNode struct {
|
|||||||
channelName string
|
channelName string
|
||||||
delBufferManager *DelBufferManager // manager of delete msg
|
delBufferManager *DelBufferManager // manager of delete msg
|
||||||
channel Channel
|
channel Channel
|
||||||
idAllocator allocatorInterface
|
idAllocator allocator.Allocator
|
||||||
flushManager flushManager
|
flushManager flushManager
|
||||||
|
|
||||||
clearSignal chan<- string
|
clearSignal chan<- string
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import (
|
|||||||
|
|
||||||
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
||||||
"github.com/milvus-io/milvus/internal/common"
|
"github.com/milvus-io/milvus/internal/common"
|
||||||
|
"github.com/milvus-io/milvus/internal/datanode/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/mq/msgstream"
|
"github.com/milvus-io/milvus/internal/mq/msgstream"
|
||||||
"github.com/milvus-io/milvus/internal/proto/datapb"
|
"github.com/milvus-io/milvus/internal/proto/datapb"
|
||||||
"github.com/milvus-io/milvus/internal/storage"
|
"github.com/milvus-io/milvus/internal/storage"
|
||||||
@ -181,10 +182,11 @@ func TestFlowGraphDeleteNode_Operate(t *testing.T) {
|
|||||||
|
|
||||||
t.Run("Test get segment by varChar primary keys", func(te *testing.T) {
|
t.Run("Test get segment by varChar primary keys", func(te *testing.T) {
|
||||||
channel := genMockChannel(segIDs, varCharPks, chanName)
|
channel := genMockChannel(segIDs, varCharPks, chanName)
|
||||||
fm := NewRendezvousFlushManager(NewAllocatorFactory(), cm, channel, func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
fm := NewRendezvousFlushManager(alloc, cm, channel, func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
||||||
c := &nodeConfig{
|
c := &nodeConfig{
|
||||||
channel: channel,
|
channel: channel,
|
||||||
allocator: &allocator{},
|
allocator: alloc,
|
||||||
vChannelName: chanName,
|
vChannelName: chanName,
|
||||||
}
|
}
|
||||||
delBufManager := &DelBufferManager{
|
delBufManager := &DelBufferManager{
|
||||||
@ -214,11 +216,12 @@ func TestFlowGraphDeleteNode_Operate(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
channel := genMockChannel(segIDs, int64Pks, chanName)
|
channel := genMockChannel(segIDs, int64Pks, chanName)
|
||||||
fm := NewRendezvousFlushManager(NewAllocatorFactory(), cm, channel, func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
fm := NewRendezvousFlushManager(alloc, cm, channel, func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
||||||
t.Run("Test get segment by int64 primary keys", func(te *testing.T) {
|
t.Run("Test get segment by int64 primary keys", func(te *testing.T) {
|
||||||
c := &nodeConfig{
|
c := &nodeConfig{
|
||||||
channel: channel,
|
channel: channel,
|
||||||
allocator: &allocator{},
|
allocator: alloc,
|
||||||
vChannelName: chanName,
|
vChannelName: chanName,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +263,7 @@ func TestFlowGraphDeleteNode_Operate(t *testing.T) {
|
|||||||
|
|
||||||
c := &nodeConfig{
|
c := &nodeConfig{
|
||||||
channel: channel,
|
channel: channel,
|
||||||
allocator: NewAllocatorFactory(),
|
allocator: allocator.NewMockAllocator(t),
|
||||||
vChannelName: chanName,
|
vChannelName: chanName,
|
||||||
}
|
}
|
||||||
delBufManager := &DelBufferManager{
|
delBufManager := &DelBufferManager{
|
||||||
@ -288,7 +291,7 @@ func TestFlowGraphDeleteNode_Operate(t *testing.T) {
|
|||||||
|
|
||||||
c := &nodeConfig{
|
c := &nodeConfig{
|
||||||
channel: channel,
|
channel: channel,
|
||||||
allocator: NewAllocatorFactory(),
|
allocator: allocator.NewMockAllocator(t),
|
||||||
vChannelName: chanName,
|
vChannelName: chanName,
|
||||||
}
|
}
|
||||||
delBufManager := &DelBufferManager{
|
delBufManager := &DelBufferManager{
|
||||||
@ -322,7 +325,7 @@ func TestFlowGraphDeleteNode_Operate(t *testing.T) {
|
|||||||
|
|
||||||
c := &nodeConfig{
|
c := &nodeConfig{
|
||||||
channel: channel,
|
channel: channel,
|
||||||
allocator: NewAllocatorFactory(),
|
allocator: allocator.NewMockAllocator(t),
|
||||||
vChannelName: chanName,
|
vChannelName: chanName,
|
||||||
}
|
}
|
||||||
delBufManager := &DelBufferManager{
|
delBufManager := &DelBufferManager{
|
||||||
@ -364,7 +367,7 @@ func TestFlowGraphDeleteNode_Operate(t *testing.T) {
|
|||||||
|
|
||||||
c := &nodeConfig{
|
c := &nodeConfig{
|
||||||
channel: channel,
|
channel: channel,
|
||||||
allocator: NewAllocatorFactory(),
|
allocator: allocator.NewMockAllocator(t),
|
||||||
vChannelName: chanName,
|
vChannelName: chanName,
|
||||||
}
|
}
|
||||||
delBufManager := &DelBufferManager{
|
delBufManager := &DelBufferManager{
|
||||||
@ -392,7 +395,7 @@ func TestFlowGraphDeleteNode_Operate(t *testing.T) {
|
|||||||
&DelDataBuf{delData: &DeleteData{}, item: bufItem})
|
&DelDataBuf{delData: &DeleteData{}, item: bufItem})
|
||||||
heap.Push(delNode.delBufferManager.delBufHeap, bufItem)
|
heap.Push(delNode.delBufferManager.delBufHeap, bufItem)
|
||||||
|
|
||||||
delNode.flushManager = NewRendezvousFlushManager(&allocator{}, cm, channel,
|
delNode.flushManager = NewRendezvousFlushManager(allocator.NewMockAllocator(t), cm, channel,
|
||||||
func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
||||||
|
|
||||||
var fgMsg flowgraph.Msg = &msg
|
var fgMsg flowgraph.Msg = &msg
|
||||||
@ -419,7 +422,7 @@ func TestFlowGraphDeleteNode_Operate(t *testing.T) {
|
|||||||
|
|
||||||
c := &nodeConfig{
|
c := &nodeConfig{
|
||||||
channel: channel,
|
channel: channel,
|
||||||
allocator: NewAllocatorFactory(),
|
allocator: allocator.NewMockAllocator(t),
|
||||||
vChannelName: chanName,
|
vChannelName: chanName,
|
||||||
}
|
}
|
||||||
delBufManager := &DelBufferManager{
|
delBufManager := &DelBufferManager{
|
||||||
@ -513,7 +516,7 @@ func TestFlowGraphDeleteNode_showDelBuf(t *testing.T) {
|
|||||||
cm := storage.NewLocalChunkManager(storage.RootPath(deleteNodeTestDir))
|
cm := storage.NewLocalChunkManager(storage.RootPath(deleteNodeTestDir))
|
||||||
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
||||||
|
|
||||||
fm := NewRendezvousFlushManager(NewAllocatorFactory(), cm, nil, func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
fm := NewRendezvousFlushManager(allocator.NewMockAllocator(t), cm, nil, func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
||||||
|
|
||||||
chanName := "datanode-test-FlowGraphDeletenode-showDelBuf"
|
chanName := "datanode-test-FlowGraphDeletenode-showDelBuf"
|
||||||
testPath := "/test/datanode/root/meta"
|
testPath := "/test/datanode/root/meta"
|
||||||
@ -525,7 +528,7 @@ func TestFlowGraphDeleteNode_showDelBuf(t *testing.T) {
|
|||||||
}
|
}
|
||||||
c := &nodeConfig{
|
c := &nodeConfig{
|
||||||
channel: channel,
|
channel: channel,
|
||||||
allocator: NewAllocatorFactory(),
|
allocator: allocator.NewMockAllocator(t),
|
||||||
vChannelName: chanName,
|
vChannelName: chanName,
|
||||||
}
|
}
|
||||||
delBufManager := &DelBufferManager{
|
delBufManager := &DelBufferManager{
|
||||||
@ -562,7 +565,7 @@ func TestFlowGraphDeleteNode_updateCompactedSegments(t *testing.T) {
|
|||||||
cm := storage.NewLocalChunkManager(storage.RootPath(deleteNodeTestDir))
|
cm := storage.NewLocalChunkManager(storage.RootPath(deleteNodeTestDir))
|
||||||
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
||||||
|
|
||||||
fm := NewRendezvousFlushManager(NewAllocatorFactory(), cm, nil, func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
fm := NewRendezvousFlushManager(allocator.NewMockAllocator(t), cm, nil, func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
||||||
|
|
||||||
chanName := "datanode-test-FlowGraphDeletenode-showDelBuf"
|
chanName := "datanode-test-FlowGraphDeletenode-showDelBuf"
|
||||||
testPath := "/test/datanode/root/meta"
|
testPath := "/test/datanode/root/meta"
|
||||||
@ -575,7 +578,7 @@ func TestFlowGraphDeleteNode_updateCompactedSegments(t *testing.T) {
|
|||||||
|
|
||||||
c := &nodeConfig{
|
c := &nodeConfig{
|
||||||
channel: &channel,
|
channel: &channel,
|
||||||
allocator: NewAllocatorFactory(),
|
allocator: allocator.NewMockAllocator(t),
|
||||||
vChannelName: chanName,
|
vChannelName: chanName,
|
||||||
}
|
}
|
||||||
delBufManager := &DelBufferManager{
|
delBufManager := &DelBufferManager{
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import (
|
|||||||
|
|
||||||
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
||||||
|
"github.com/milvus-io/milvus/internal/datanode/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/log"
|
"github.com/milvus-io/milvus/internal/log"
|
||||||
"github.com/milvus-io/milvus/internal/metrics"
|
"github.com/milvus-io/milvus/internal/metrics"
|
||||||
"github.com/milvus-io/milvus/internal/mq/msgstream"
|
"github.com/milvus-io/milvus/internal/mq/msgstream"
|
||||||
@ -50,7 +51,7 @@ type insertBufferNode struct {
|
|||||||
channelName string
|
channelName string
|
||||||
delBufferManager *DelBufferManager // manager of delete msg
|
delBufferManager *DelBufferManager // manager of delete msg
|
||||||
channel Channel
|
channel Channel
|
||||||
idAllocator allocatorInterface
|
idAllocator allocator.Allocator
|
||||||
|
|
||||||
flushMap sync.Map
|
flushMap sync.Map
|
||||||
flushChan <-chan flushMsg
|
flushChan <-chan flushMsg
|
||||||
|
|||||||
@ -27,6 +27,7 @@ import (
|
|||||||
"github.com/cockroachdb/errors"
|
"github.com/cockroachdb/errors"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/mock"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ import (
|
|||||||
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
|
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
||||||
|
"github.com/milvus-io/milvus/internal/datanode/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/mq/msgstream"
|
"github.com/milvus-io/milvus/internal/mq/msgstream"
|
||||||
"github.com/milvus-io/milvus/internal/proto/datapb"
|
"github.com/milvus-io/milvus/internal/proto/datapb"
|
||||||
"github.com/milvus-io/milvus/internal/proto/etcdpb"
|
"github.com/milvus-io/milvus/internal/proto/etcdpb"
|
||||||
@ -97,7 +99,8 @@ func TestFlowGraphInsertBufferNodeCreate(t *testing.T) {
|
|||||||
|
|
||||||
factory := dependency.NewDefaultFactory(true)
|
factory := dependency.NewDefaultFactory(true)
|
||||||
|
|
||||||
fm := NewRendezvousFlushManager(&allocator{}, cm, channel, func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
fm := NewRendezvousFlushManager(alloc, cm, channel, func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
||||||
|
|
||||||
flushChan := make(chan flushMsg, 100)
|
flushChan := make(chan flushMsg, 100)
|
||||||
resendTTChan := make(chan resendTTMsg, 100)
|
resendTTChan := make(chan resendTTMsg, 100)
|
||||||
@ -105,7 +108,7 @@ func TestFlowGraphInsertBufferNodeCreate(t *testing.T) {
|
|||||||
c := &nodeConfig{
|
c := &nodeConfig{
|
||||||
channel: channel,
|
channel: channel,
|
||||||
msFactory: factory,
|
msFactory: factory,
|
||||||
allocator: NewAllocatorFactory(),
|
allocator: alloc,
|
||||||
vChannelName: "string",
|
vChannelName: "string",
|
||||||
}
|
}
|
||||||
delBufManager := &DelBufferManager{
|
delBufManager := &DelBufferManager{
|
||||||
@ -201,14 +204,19 @@ func TestFlowGraphInsertBufferNode_Operate(t *testing.T) {
|
|||||||
|
|
||||||
factory := dependency.NewDefaultFactory(true)
|
factory := dependency.NewDefaultFactory(true)
|
||||||
|
|
||||||
fm := NewRendezvousFlushManager(NewAllocatorFactory(), cm, channel, func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().Alloc(mock.Anything).Call.Return(int64(22222),
|
||||||
|
func(count uint32) int64 {
|
||||||
|
return int64(22222 + count)
|
||||||
|
}, nil)
|
||||||
|
fm := NewRendezvousFlushManager(alloc, cm, channel, func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
||||||
|
|
||||||
flushChan := make(chan flushMsg, 100)
|
flushChan := make(chan flushMsg, 100)
|
||||||
resendTTChan := make(chan resendTTMsg, 100)
|
resendTTChan := make(chan resendTTMsg, 100)
|
||||||
c := &nodeConfig{
|
c := &nodeConfig{
|
||||||
channel: channel,
|
channel: channel,
|
||||||
msFactory: factory,
|
msFactory: factory,
|
||||||
allocator: NewAllocatorFactory(),
|
allocator: alloc,
|
||||||
vChannelName: "string",
|
vChannelName: "string",
|
||||||
}
|
}
|
||||||
delBufManager := &DelBufferManager{
|
delBufManager := &DelBufferManager{
|
||||||
@ -363,7 +371,12 @@ func TestFlowGraphInsertBufferNode_AutoFlush(t *testing.T) {
|
|||||||
|
|
||||||
cm := storage.NewLocalChunkManager(storage.RootPath(insertNodeTestDir))
|
cm := storage.NewLocalChunkManager(storage.RootPath(insertNodeTestDir))
|
||||||
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
||||||
fm := NewRendezvousFlushManager(NewAllocatorFactory(), cm, channel, func(pack *segmentFlushPack) {
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().Alloc(mock.Anything).Call.Return(int64(22222),
|
||||||
|
func(count uint32) int64 {
|
||||||
|
return int64(22222 + count)
|
||||||
|
}, nil)
|
||||||
|
fm := NewRendezvousFlushManager(alloc, cm, channel, func(pack *segmentFlushPack) {
|
||||||
fpMut.Lock()
|
fpMut.Lock()
|
||||||
flushPacks = append(flushPacks, pack)
|
flushPacks = append(flushPacks, pack)
|
||||||
fpMut.Unlock()
|
fpMut.Unlock()
|
||||||
@ -382,7 +395,7 @@ func TestFlowGraphInsertBufferNode_AutoFlush(t *testing.T) {
|
|||||||
c := &nodeConfig{
|
c := &nodeConfig{
|
||||||
channel: channel,
|
channel: channel,
|
||||||
msFactory: factory,
|
msFactory: factory,
|
||||||
allocator: NewAllocatorFactory(),
|
allocator: alloc,
|
||||||
vChannelName: "string",
|
vChannelName: "string",
|
||||||
}
|
}
|
||||||
delBufManager := &DelBufferManager{
|
delBufManager := &DelBufferManager{
|
||||||
@ -571,7 +584,7 @@ func TestFlowGraphInsertBufferNode_AutoFlush(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRollBF(t *testing.T) {
|
func TestInsertBufferNodeRollBF(t *testing.T) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@ -604,7 +617,12 @@ func TestRollBF(t *testing.T) {
|
|||||||
|
|
||||||
cm := storage.NewLocalChunkManager(storage.RootPath(insertNodeTestDir))
|
cm := storage.NewLocalChunkManager(storage.RootPath(insertNodeTestDir))
|
||||||
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
defer cm.RemoveWithPrefix(ctx, cm.RootPath())
|
||||||
fm := NewRendezvousFlushManager(NewAllocatorFactory(), cm, channel, func(pack *segmentFlushPack) {
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
alloc.EXPECT().Alloc(mock.Anything).Call.Return(int64(22222),
|
||||||
|
func(count uint32) int64 {
|
||||||
|
return int64(22222 + count)
|
||||||
|
}, nil)
|
||||||
|
fm := NewRendezvousFlushManager(alloc, cm, channel, func(pack *segmentFlushPack) {
|
||||||
fpMut.Lock()
|
fpMut.Lock()
|
||||||
flushPacks = append(flushPacks, pack)
|
flushPacks = append(flushPacks, pack)
|
||||||
fpMut.Unlock()
|
fpMut.Unlock()
|
||||||
@ -623,7 +641,7 @@ func TestRollBF(t *testing.T) {
|
|||||||
c := &nodeConfig{
|
c := &nodeConfig{
|
||||||
channel: channel,
|
channel: channel,
|
||||||
msFactory: factory,
|
msFactory: factory,
|
||||||
allocator: NewAllocatorFactory(),
|
allocator: alloc,
|
||||||
vChannelName: "string",
|
vChannelName: "string",
|
||||||
}
|
}
|
||||||
delBufManager := &DelBufferManager{
|
delBufManager := &DelBufferManager{
|
||||||
@ -992,14 +1010,15 @@ func TestInsertBufferNode_bufferInsertMsg(t *testing.T) {
|
|||||||
|
|
||||||
factory := dependency.NewDefaultFactory(true)
|
factory := dependency.NewDefaultFactory(true)
|
||||||
|
|
||||||
fm := NewRendezvousFlushManager(&allocator{}, cm, channel, func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
fm := NewRendezvousFlushManager(alloc, cm, channel, func(*segmentFlushPack) {}, emptyFlushAndDropFunc)
|
||||||
|
|
||||||
flushChan := make(chan flushMsg, 100)
|
flushChan := make(chan flushMsg, 100)
|
||||||
resendTTChan := make(chan resendTTMsg, 100)
|
resendTTChan := make(chan resendTTMsg, 100)
|
||||||
c := &nodeConfig{
|
c := &nodeConfig{
|
||||||
channel: channel,
|
channel: channel,
|
||||||
msFactory: factory,
|
msFactory: factory,
|
||||||
allocator: NewAllocatorFactory(),
|
allocator: alloc,
|
||||||
vChannelName: "string",
|
vChannelName: "string",
|
||||||
}
|
}
|
||||||
delBufManager := &DelBufferManager{
|
delBufManager := &DelBufferManager{
|
||||||
|
|||||||
@ -102,19 +102,18 @@ func (fm *flowgraphManager) execute(totalMemory uint64) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (fm *flowgraphManager) addAndStart(dn *DataNode, vchan *datapb.VchannelInfo, schema *schemapb.CollectionSchema, tickler *tickler) error {
|
func (fm *flowgraphManager) addAndStart(dn *DataNode, vchan *datapb.VchannelInfo, schema *schemapb.CollectionSchema, tickler *tickler) error {
|
||||||
|
log := log.With(zap.String("channel", vchan.GetChannelName()))
|
||||||
if _, ok := fm.flowgraphs.Load(vchan.GetChannelName()); ok {
|
if _, ok := fm.flowgraphs.Load(vchan.GetChannelName()); ok {
|
||||||
log.Warn("try to add an existed DataSyncService", zap.String("vChannelName", vchan.GetChannelName()))
|
log.Warn("try to add an existed DataSyncService")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
channel := newChannel(vchan.GetChannelName(), vchan.GetCollectionID(), schema, dn.rootCoord, dn.chunkManager)
|
channel := newChannel(vchan.GetChannelName(), vchan.GetCollectionID(), schema, dn.rootCoord, dn.chunkManager)
|
||||||
|
|
||||||
var alloc allocatorInterface = newAllocator(dn.rootCoord)
|
|
||||||
|
|
||||||
dataSyncService, err := newDataSyncService(dn.ctx, make(chan flushMsg, 100), make(chan resendTTMsg, 100), channel,
|
dataSyncService, err := newDataSyncService(dn.ctx, make(chan flushMsg, 100), make(chan resendTTMsg, 100), channel,
|
||||||
alloc, dn.dispClient, dn.factory, vchan, dn.clearSignal, dn.dataCoord, dn.segmentCache, dn.chunkManager, dn.compactionExecutor, tickler, dn.GetSession().ServerID)
|
dn.allocator, dn.dispClient, dn.factory, vchan, dn.clearSignal, dn.dataCoord, dn.segmentCache, dn.chunkManager, dn.compactionExecutor, tickler, dn.GetSession().ServerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn("new data sync service fail", zap.String("vChannelName", vchan.GetChannelName()), zap.Error(err))
|
log.Warn("fail to create new datasyncservice", zap.Error(err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
dataSyncService.start()
|
dataSyncService.start()
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import (
|
|||||||
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
||||||
"github.com/milvus-io/milvus/internal/common"
|
"github.com/milvus-io/milvus/internal/common"
|
||||||
|
"github.com/milvus-io/milvus/internal/datanode/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/log"
|
"github.com/milvus-io/milvus/internal/log"
|
||||||
"github.com/milvus-io/milvus/internal/metrics"
|
"github.com/milvus-io/milvus/internal/metrics"
|
||||||
"github.com/milvus-io/milvus/internal/proto/datapb"
|
"github.com/milvus-io/milvus/internal/proto/datapb"
|
||||||
@ -262,7 +263,7 @@ type dropHandler struct {
|
|||||||
|
|
||||||
// rendezvousFlushManager makes sure insert & del buf all flushed
|
// rendezvousFlushManager makes sure insert & del buf all flushed
|
||||||
type rendezvousFlushManager struct {
|
type rendezvousFlushManager struct {
|
||||||
allocatorInterface
|
allocator.Allocator
|
||||||
storage.ChunkManager
|
storage.ChunkManager
|
||||||
Channel
|
Channel
|
||||||
|
|
||||||
@ -371,7 +372,7 @@ func (m *rendezvousFlushManager) flushBufferData(data *BufferData, segmentID Uni
|
|||||||
}
|
}
|
||||||
|
|
||||||
// binlogs
|
// binlogs
|
||||||
start, _, err := m.allocIDBatch(uint32(len(binLogs) + len(statsBinlogs)))
|
start, _, err := m.Alloc(uint32(len(binLogs) + len(statsBinlogs)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -387,7 +388,6 @@ func (m *rendezvousFlushManager) flushBufferData(data *BufferData, segmentID Uni
|
|||||||
|
|
||||||
logidx := start + int64(idx)
|
logidx := start + int64(idx)
|
||||||
|
|
||||||
// no error raise if alloc=false
|
|
||||||
k := metautil.JoinIDPath(collID, partID, segmentID, fieldID, logidx)
|
k := metautil.JoinIDPath(collID, partID, segmentID, fieldID, logidx)
|
||||||
|
|
||||||
// [rootPath]/[insert_log]/key
|
// [rootPath]/[insert_log]/key
|
||||||
@ -413,7 +413,6 @@ func (m *rendezvousFlushManager) flushBufferData(data *BufferData, segmentID Uni
|
|||||||
|
|
||||||
logidx := start + UniqueID(len(binLogs)+idx)
|
logidx := start + UniqueID(len(binLogs)+idx)
|
||||||
|
|
||||||
// no error raise if alloc=false
|
|
||||||
k := metautil.JoinIDPath(collID, partID, segmentID, fieldID, logidx)
|
k := metautil.JoinIDPath(collID, partID, segmentID, fieldID, logidx)
|
||||||
|
|
||||||
key := path.Join(m.ChunkManager.RootPath(), common.SegmentStatslogPath, k)
|
key := path.Join(m.ChunkManager.RootPath(), common.SegmentStatslogPath, k)
|
||||||
@ -458,7 +457,7 @@ func (m *rendezvousFlushManager) flushDelData(data *DelDataBuf, segmentID Unique
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
logID, err := m.allocID()
|
logID, err := m.AllocOne()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("failed to alloc ID", zap.Error(err))
|
log.Error("failed to alloc ID", zap.Error(err))
|
||||||
return err
|
return err
|
||||||
@ -618,12 +617,12 @@ func (t *flushBufferDeleteTask) flushDeleteData() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewRendezvousFlushManager create rendezvousFlushManager with provided allocator and kv
|
// NewRendezvousFlushManager create rendezvousFlushManager with provided allocator and kv
|
||||||
func NewRendezvousFlushManager(allocator allocatorInterface, cm storage.ChunkManager, channel Channel, f notifyMetaFunc, drop flushAndDropFunc) *rendezvousFlushManager {
|
func NewRendezvousFlushManager(allocator allocator.Allocator, cm storage.ChunkManager, channel Channel, f notifyMetaFunc, drop flushAndDropFunc) *rendezvousFlushManager {
|
||||||
fm := &rendezvousFlushManager{
|
fm := &rendezvousFlushManager{
|
||||||
allocatorInterface: allocator,
|
Allocator: allocator,
|
||||||
ChunkManager: cm,
|
ChunkManager: cm,
|
||||||
notifyFunc: f,
|
notifyFunc: f,
|
||||||
Channel: channel,
|
Channel: channel,
|
||||||
dropHandler: dropHandler{
|
dropHandler: dropHandler{
|
||||||
flushAndDrop: drop,
|
flushAndDrop: drop,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import (
|
|||||||
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
||||||
|
"github.com/milvus-io/milvus/internal/datanode/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/proto/datapb"
|
"github.com/milvus-io/milvus/internal/proto/datapb"
|
||||||
"github.com/milvus-io/milvus/internal/storage"
|
"github.com/milvus-io/milvus/internal/storage"
|
||||||
"github.com/milvus-io/milvus/internal/util/retry"
|
"github.com/milvus-io/milvus/internal/util/retry"
|
||||||
@ -158,7 +159,8 @@ func TestRendezvousFlushManager(t *testing.T) {
|
|||||||
var counter atomic.Int64
|
var counter atomic.Int64
|
||||||
finish := sync.WaitGroup{}
|
finish := sync.WaitGroup{}
|
||||||
finish.Add(size)
|
finish.Add(size)
|
||||||
m := NewRendezvousFlushManager(&allocator{}, cm, newTestChannel(), func(pack *segmentFlushPack) {
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
m := NewRendezvousFlushManager(alloc, cm, newTestChannel(), func(pack *segmentFlushPack) {
|
||||||
counter.Inc()
|
counter.Inc()
|
||||||
finish.Done()
|
finish.Done()
|
||||||
}, emptyFlushAndDropFunc)
|
}, emptyFlushAndDropFunc)
|
||||||
@ -199,7 +201,8 @@ func TestRendezvousFlushManager_Inject(t *testing.T) {
|
|||||||
finish.Add(size)
|
finish.Add(size)
|
||||||
var packMut sync.Mutex
|
var packMut sync.Mutex
|
||||||
packs := make([]*segmentFlushPack, 0, size+3)
|
packs := make([]*segmentFlushPack, 0, size+3)
|
||||||
m := NewRendezvousFlushManager(&allocator{}, cm, newTestChannel(), func(pack *segmentFlushPack) {
|
alloc := allocator.NewMockAllocator(t)
|
||||||
|
m := NewRendezvousFlushManager(alloc, cm, newTestChannel(), func(pack *segmentFlushPack) {
|
||||||
packMut.Lock()
|
packMut.Lock()
|
||||||
packs = append(packs, pack)
|
packs = append(packs, pack)
|
||||||
packMut.Unlock()
|
packMut.Unlock()
|
||||||
@ -297,7 +300,7 @@ func TestRendezvousFlushManager_getSegmentMeta(t *testing.T) {
|
|||||||
|
|
||||||
channel := newTestChannel()
|
channel := newTestChannel()
|
||||||
channel.collSchema = &schemapb.CollectionSchema{}
|
channel.collSchema = &schemapb.CollectionSchema{}
|
||||||
fm := NewRendezvousFlushManager(NewAllocatorFactory(), cm, channel, func(*segmentFlushPack) {
|
fm := NewRendezvousFlushManager(allocator.NewMockAllocator(t), cm, channel, func(*segmentFlushPack) {
|
||||||
}, emptyFlushAndDropFunc)
|
}, emptyFlushAndDropFunc)
|
||||||
|
|
||||||
// non exists segment
|
// non exists segment
|
||||||
@ -330,7 +333,7 @@ func TestRendezvousFlushManager_waitForAllFlushQueue(t *testing.T) {
|
|||||||
var counter atomic.Int64
|
var counter atomic.Int64
|
||||||
var finish sync.WaitGroup
|
var finish sync.WaitGroup
|
||||||
finish.Add(size)
|
finish.Add(size)
|
||||||
m := NewRendezvousFlushManager(&allocator{}, cm, newTestChannel(), func(pack *segmentFlushPack) {
|
m := NewRendezvousFlushManager(allocator.NewMockAllocator(t), cm, newTestChannel(), func(pack *segmentFlushPack) {
|
||||||
counter.Inc()
|
counter.Inc()
|
||||||
finish.Done()
|
finish.Done()
|
||||||
}, emptyFlushAndDropFunc)
|
}, emptyFlushAndDropFunc)
|
||||||
@ -402,7 +405,7 @@ func TestRendezvousFlushManager_dropMode(t *testing.T) {
|
|||||||
var result []*segmentFlushPack
|
var result []*segmentFlushPack
|
||||||
signal := make(chan struct{})
|
signal := make(chan struct{})
|
||||||
|
|
||||||
m := NewRendezvousFlushManager(&allocator{}, cm, newTestChannel(), func(pack *segmentFlushPack) {
|
m := NewRendezvousFlushManager(allocator.NewMockAllocator(t), cm, newTestChannel(), func(pack *segmentFlushPack) {
|
||||||
}, func(packs []*segmentFlushPack) {
|
}, func(packs []*segmentFlushPack) {
|
||||||
mut.Lock()
|
mut.Lock()
|
||||||
result = packs
|
result = packs
|
||||||
@ -456,7 +459,7 @@ func TestRendezvousFlushManager_dropMode(t *testing.T) {
|
|||||||
var result []*segmentFlushPack
|
var result []*segmentFlushPack
|
||||||
signal := make(chan struct{})
|
signal := make(chan struct{})
|
||||||
|
|
||||||
m := NewRendezvousFlushManager(&allocator{}, cm, newTestChannel(), func(pack *segmentFlushPack) {
|
m := NewRendezvousFlushManager(allocator.NewMockAllocator(t), cm, newTestChannel(), func(pack *segmentFlushPack) {
|
||||||
}, func(packs []*segmentFlushPack) {
|
}, func(packs []*segmentFlushPack) {
|
||||||
mut.Lock()
|
mut.Lock()
|
||||||
result = packs
|
result = packs
|
||||||
@ -518,7 +521,7 @@ func TestRendezvousFlushManager_close(t *testing.T) {
|
|||||||
var counter atomic.Int64
|
var counter atomic.Int64
|
||||||
finish := sync.WaitGroup{}
|
finish := sync.WaitGroup{}
|
||||||
finish.Add(size)
|
finish.Add(size)
|
||||||
m := NewRendezvousFlushManager(&allocator{}, cm, newTestChannel(), func(pack *segmentFlushPack) {
|
m := NewRendezvousFlushManager(allocator.NewMockAllocator(t), cm, newTestChannel(), func(pack *segmentFlushPack) {
|
||||||
counter.Inc()
|
counter.Inc()
|
||||||
finish.Done()
|
finish.Done()
|
||||||
}, emptyFlushAndDropFunc)
|
}, emptyFlushAndDropFunc)
|
||||||
|
|||||||
@ -22,8 +22,6 @@ import (
|
|||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"math/rand"
|
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/cockroachdb/errors"
|
"github.com/cockroachdb/errors"
|
||||||
@ -46,7 +44,6 @@ import (
|
|||||||
"github.com/milvus-io/milvus/internal/types"
|
"github.com/milvus-io/milvus/internal/types"
|
||||||
"github.com/milvus-io/milvus/internal/util/dependency"
|
"github.com/milvus-io/milvus/internal/util/dependency"
|
||||||
"github.com/milvus-io/milvus/internal/util/etcd"
|
"github.com/milvus-io/milvus/internal/util/etcd"
|
||||||
"github.com/milvus-io/milvus/internal/util/metautil"
|
|
||||||
"github.com/milvus-io/milvus/internal/util/paramtable"
|
"github.com/milvus-io/milvus/internal/util/paramtable"
|
||||||
"github.com/milvus-io/milvus/internal/util/sessionutil"
|
"github.com/milvus-io/milvus/internal/util/sessionutil"
|
||||||
"github.com/milvus-io/milvus/internal/util/tsoutil"
|
"github.com/milvus-io/milvus/internal/util/tsoutil"
|
||||||
@ -967,57 +964,6 @@ func genFlowGraphDeleteMsg(pks []primaryKey, chanName string) flowGraphMsg {
|
|||||||
return *fgMsg
|
return *fgMsg
|
||||||
}
|
}
|
||||||
|
|
||||||
type AllocatorFactory struct {
|
|
||||||
sync.Mutex
|
|
||||||
r *rand.Rand
|
|
||||||
isvalid bool
|
|
||||||
random bool
|
|
||||||
errAllocBatch bool
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ allocatorInterface = &AllocatorFactory{}
|
|
||||||
|
|
||||||
func NewAllocatorFactory(id ...UniqueID) *AllocatorFactory {
|
|
||||||
f := &AllocatorFactory{
|
|
||||||
r: rand.New(rand.NewSource(time.Now().UnixNano())),
|
|
||||||
isvalid: len(id) == 0 || (len(id) > 0 && id[0] > 0),
|
|
||||||
}
|
|
||||||
return f
|
|
||||||
}
|
|
||||||
|
|
||||||
func (alloc *AllocatorFactory) allocID() (UniqueID, error) {
|
|
||||||
alloc.Lock()
|
|
||||||
defer alloc.Unlock()
|
|
||||||
|
|
||||||
if !alloc.isvalid {
|
|
||||||
return -1, errors.New("allocID error")
|
|
||||||
}
|
|
||||||
|
|
||||||
if alloc.random {
|
|
||||||
return alloc.r.Int63n(10000), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return 19530, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (alloc *AllocatorFactory) allocIDBatch(count uint32) (UniqueID, uint32, error) {
|
|
||||||
if count == 0 || alloc.errAllocBatch {
|
|
||||||
return 0, 0, errors.New("count should be greater than zero")
|
|
||||||
}
|
|
||||||
|
|
||||||
start, err := alloc.allocID()
|
|
||||||
return start, count, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (alloc *AllocatorFactory) genKey(ids ...UniqueID) (string, error) {
|
|
||||||
idx, err := alloc.allocID()
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
ids = append(ids, idx)
|
|
||||||
return metautil.JoinIDPath(ids...), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// If id == 0, AllocID will return not successful status
|
// If id == 0, AllocID will return not successful status
|
||||||
// If id == -1, AllocID will return err
|
// If id == -1, AllocID will return err
|
||||||
func (m *RootCoordFactory) setID(id UniqueID) {
|
func (m *RootCoordFactory) setID(id UniqueID) {
|
||||||
|
|||||||
@ -567,7 +567,7 @@ func (node *DataNode) Import(ctx context.Context, req *datapb.ImportTaskRequest)
|
|||||||
|
|
||||||
// parse files and generate segments
|
// parse files and generate segments
|
||||||
segmentSize := Params.DataCoordCfg.SegmentMaxSize.GetAsInt64() * 1024 * 1024
|
segmentSize := Params.DataCoordCfg.SegmentMaxSize.GetAsInt64() * 1024 * 1024
|
||||||
importWrapper := importutil.NewImportWrapper(newCtx, colInfo.GetSchema(), colInfo.GetShardsNum(), segmentSize, node.rowIDAllocator,
|
importWrapper := importutil.NewImportWrapper(newCtx, colInfo.GetSchema(), colInfo.GetShardsNum(), segmentSize, node.allocator.GetIDAlloactor(),
|
||||||
node.chunkManager, importResult, reportFunc)
|
node.chunkManager, importResult, reportFunc)
|
||||||
importWrapper.SetCallbackFunctions(assignSegmentFunc(node, req),
|
importWrapper.SetCallbackFunctions(assignSegmentFunc(node, req),
|
||||||
createBinLogsFunc(node, req, colInfo.GetSchema(), ts),
|
createBinLogsFunc(node, req, colInfo.GetSchema(), ts),
|
||||||
@ -922,8 +922,7 @@ func createBinLogs(rowNum int, schema *schemapb.CollectionSchema, ts Timestamp,
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var alloc allocatorInterface = newAllocator(node.rootCoord)
|
start, _, err := node.allocator.Alloc(uint32(len(binLogs)))
|
||||||
start, _, err := alloc.allocIDBatch(uint32(len(binLogs)))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
@ -940,7 +939,6 @@ func createBinLogs(rowNum int, schema *schemapb.CollectionSchema, ts Timestamp,
|
|||||||
|
|
||||||
logidx := start + int64(idx)
|
logidx := start + int64(idx)
|
||||||
|
|
||||||
// no error raise if alloc=false
|
|
||||||
k := metautil.JoinIDPath(colID, partID, segmentID, fieldID, logidx)
|
k := metautil.JoinIDPath(colID, partID, segmentID, fieldID, logidx)
|
||||||
|
|
||||||
key := path.Join(node.chunkManager.RootPath(), common.SegmentInsertLogPath, k)
|
key := path.Join(node.chunkManager.RootPath(), common.SegmentInsertLogPath, k)
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/mock"
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
clientv3 "go.etcd.io/etcd/client/v3"
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
@ -32,7 +33,9 @@ import (
|
|||||||
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
|
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
"github.com/milvus-io/milvus-proto/go-api/msgpb"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
"github.com/milvus-io/milvus-proto/go-api/schemapb"
|
||||||
|
allocator2 "github.com/milvus-io/milvus/internal/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/common"
|
"github.com/milvus-io/milvus/internal/common"
|
||||||
|
"github.com/milvus-io/milvus/internal/datanode/allocator"
|
||||||
"github.com/milvus-io/milvus/internal/log"
|
"github.com/milvus-io/milvus/internal/log"
|
||||||
"github.com/milvus-io/milvus/internal/mq/msgstream"
|
"github.com/milvus-io/milvus/internal/mq/msgstream"
|
||||||
"github.com/milvus-io/milvus/internal/proto/datapb"
|
"github.com/milvus-io/milvus/internal/proto/datapb"
|
||||||
@ -82,6 +85,16 @@ func (s *DataNodeServicesSuite) SetupTest() {
|
|||||||
err := s.node.Init()
|
err := s.node.Init()
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
|
alloc := &allocator.MockAllocator{}
|
||||||
|
alloc.EXPECT().Start().Return(nil).Maybe()
|
||||||
|
alloc.EXPECT().Close().Maybe()
|
||||||
|
alloc.EXPECT().GetIDAlloactor().Return(&allocator2.IDAllocator{}).Maybe()
|
||||||
|
alloc.EXPECT().Alloc(mock.Anything).Call.Return(int64(22222),
|
||||||
|
func(count uint32) int64 {
|
||||||
|
return int64(22222 + count)
|
||||||
|
}, nil).Maybe()
|
||||||
|
s.node.allocator = alloc
|
||||||
|
|
||||||
err = s.node.Start()
|
err = s.node.Start()
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
|
|||||||
@ -42,8 +42,8 @@ type MockBalancer_AssignChannel_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AssignChannel is a helper method to define mock.On call
|
// AssignChannel is a helper method to define mock.On call
|
||||||
// - channels []*meta.DmChannel
|
// - channels []*meta.DmChannel
|
||||||
// - nodes []int64
|
// - nodes []int64
|
||||||
func (_e *MockBalancer_Expecter) AssignChannel(channels interface{}, nodes interface{}) *MockBalancer_AssignChannel_Call {
|
func (_e *MockBalancer_Expecter) AssignChannel(channels interface{}, nodes interface{}) *MockBalancer_AssignChannel_Call {
|
||||||
return &MockBalancer_AssignChannel_Call{Call: _e.mock.On("AssignChannel", channels, nodes)}
|
return &MockBalancer_AssignChannel_Call{Call: _e.mock.On("AssignChannel", channels, nodes)}
|
||||||
}
|
}
|
||||||
@ -82,8 +82,8 @@ type MockBalancer_AssignSegment_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AssignSegment is a helper method to define mock.On call
|
// AssignSegment is a helper method to define mock.On call
|
||||||
// - segments []*meta.Segment
|
// - segments []*meta.Segment
|
||||||
// - nodes []int64
|
// - nodes []int64
|
||||||
func (_e *MockBalancer_Expecter) AssignSegment(segments interface{}, nodes interface{}) *MockBalancer_AssignSegment_Call {
|
func (_e *MockBalancer_Expecter) AssignSegment(segments interface{}, nodes interface{}) *MockBalancer_AssignSegment_Call {
|
||||||
return &MockBalancer_AssignSegment_Call{Call: _e.mock.On("AssignSegment", segments, nodes)}
|
return &MockBalancer_AssignSegment_Call{Call: _e.mock.On("AssignSegment", segments, nodes)}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,8 +56,8 @@ type MockBroker_GetCollectionSchema_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetCollectionSchema is a helper method to define mock.On call
|
// GetCollectionSchema is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - collectionID int64
|
// - collectionID int64
|
||||||
func (_e *MockBroker_Expecter) GetCollectionSchema(ctx interface{}, collectionID interface{}) *MockBroker_GetCollectionSchema_Call {
|
func (_e *MockBroker_Expecter) GetCollectionSchema(ctx interface{}, collectionID interface{}) *MockBroker_GetCollectionSchema_Call {
|
||||||
return &MockBroker_GetCollectionSchema_Call{Call: _e.mock.On("GetCollectionSchema", ctx, collectionID)}
|
return &MockBroker_GetCollectionSchema_Call{Call: _e.mock.On("GetCollectionSchema", ctx, collectionID)}
|
||||||
}
|
}
|
||||||
@ -103,9 +103,9 @@ type MockBroker_GetIndexInfo_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetIndexInfo is a helper method to define mock.On call
|
// GetIndexInfo is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - collectionID int64
|
// - collectionID int64
|
||||||
// - segmentID int64
|
// - segmentID int64
|
||||||
func (_e *MockBroker_Expecter) GetIndexInfo(ctx interface{}, collectionID interface{}, segmentID interface{}) *MockBroker_GetIndexInfo_Call {
|
func (_e *MockBroker_Expecter) GetIndexInfo(ctx interface{}, collectionID interface{}, segmentID interface{}) *MockBroker_GetIndexInfo_Call {
|
||||||
return &MockBroker_GetIndexInfo_Call{Call: _e.mock.On("GetIndexInfo", ctx, collectionID, segmentID)}
|
return &MockBroker_GetIndexInfo_Call{Call: _e.mock.On("GetIndexInfo", ctx, collectionID, segmentID)}
|
||||||
}
|
}
|
||||||
@ -151,8 +151,8 @@ type MockBroker_GetPartitions_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetPartitions is a helper method to define mock.On call
|
// GetPartitions is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - collectionID int64
|
// - collectionID int64
|
||||||
func (_e *MockBroker_Expecter) GetPartitions(ctx interface{}, collectionID interface{}) *MockBroker_GetPartitions_Call {
|
func (_e *MockBroker_Expecter) GetPartitions(ctx interface{}, collectionID interface{}) *MockBroker_GetPartitions_Call {
|
||||||
return &MockBroker_GetPartitions_Call{Call: _e.mock.On("GetPartitions", ctx, collectionID)}
|
return &MockBroker_GetPartitions_Call{Call: _e.mock.On("GetPartitions", ctx, collectionID)}
|
||||||
}
|
}
|
||||||
@ -207,9 +207,9 @@ type MockBroker_GetRecoveryInfo_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetRecoveryInfo is a helper method to define mock.On call
|
// GetRecoveryInfo is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - collectionID int64
|
// - collectionID int64
|
||||||
// - partitionID int64
|
// - partitionID int64
|
||||||
func (_e *MockBroker_Expecter) GetRecoveryInfo(ctx interface{}, collectionID interface{}, partitionID interface{}) *MockBroker_GetRecoveryInfo_Call {
|
func (_e *MockBroker_Expecter) GetRecoveryInfo(ctx interface{}, collectionID interface{}, partitionID interface{}) *MockBroker_GetRecoveryInfo_Call {
|
||||||
return &MockBroker_GetRecoveryInfo_Call{Call: _e.mock.On("GetRecoveryInfo", ctx, collectionID, partitionID)}
|
return &MockBroker_GetRecoveryInfo_Call{Call: _e.mock.On("GetRecoveryInfo", ctx, collectionID, partitionID)}
|
||||||
}
|
}
|
||||||
@ -262,8 +262,8 @@ type MockBroker_GetSegmentInfo_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetSegmentInfo is a helper method to define mock.On call
|
// GetSegmentInfo is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - segmentID ...int64
|
// - segmentID ...int64
|
||||||
func (_e *MockBroker_Expecter) GetSegmentInfo(ctx interface{}, segmentID ...interface{}) *MockBroker_GetSegmentInfo_Call {
|
func (_e *MockBroker_Expecter) GetSegmentInfo(ctx interface{}, segmentID ...interface{}) *MockBroker_GetSegmentInfo_Call {
|
||||||
return &MockBroker_GetSegmentInfo_Call{Call: _e.mock.On("GetSegmentInfo",
|
return &MockBroker_GetSegmentInfo_Call{Call: _e.mock.On("GetSegmentInfo",
|
||||||
append([]interface{}{ctx}, segmentID...)...)}
|
append([]interface{}{ctx}, segmentID...)...)}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// Code generated by mockery v2.14.0. DO NOT EDIT.
|
// Code generated by mockery v2.16.0. DO NOT EDIT.
|
||||||
|
|
||||||
package meta
|
package meta
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// Code generated by mockery v2.14.0. DO NOT EDIT.
|
// Code generated by mockery v2.16.0. DO NOT EDIT.
|
||||||
|
|
||||||
package mocks
|
package mocks
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// Code generated by mockery v2.14.0. DO NOT EDIT.
|
// Code generated by mockery v2.16.0. DO NOT EDIT.
|
||||||
|
|
||||||
package session
|
package session
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,7 @@ type MockScheduler_Add_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add is a helper method to define mock.On call
|
// Add is a helper method to define mock.On call
|
||||||
// - task Task
|
// - task Task
|
||||||
func (_e *MockScheduler_Expecter) Add(task interface{}) *MockScheduler_Add_Call {
|
func (_e *MockScheduler_Expecter) Add(task interface{}) *MockScheduler_Add_Call {
|
||||||
return &MockScheduler_Add_Call{Call: _e.mock.On("Add", task)}
|
return &MockScheduler_Add_Call{Call: _e.mock.On("Add", task)}
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ type MockScheduler_AddExecutor_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddExecutor is a helper method to define mock.On call
|
// AddExecutor is a helper method to define mock.On call
|
||||||
// - nodeID int64
|
// - nodeID int64
|
||||||
func (_e *MockScheduler_Expecter) AddExecutor(nodeID interface{}) *MockScheduler_AddExecutor_Call {
|
func (_e *MockScheduler_Expecter) AddExecutor(nodeID interface{}) *MockScheduler_AddExecutor_Call {
|
||||||
return &MockScheduler_AddExecutor_Call{Call: _e.mock.On("AddExecutor", nodeID)}
|
return &MockScheduler_AddExecutor_Call{Call: _e.mock.On("AddExecutor", nodeID)}
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ type MockScheduler_Dispatch_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dispatch is a helper method to define mock.On call
|
// Dispatch is a helper method to define mock.On call
|
||||||
// - node int64
|
// - node int64
|
||||||
func (_e *MockScheduler_Expecter) Dispatch(node interface{}) *MockScheduler_Dispatch_Call {
|
func (_e *MockScheduler_Expecter) Dispatch(node interface{}) *MockScheduler_Dispatch_Call {
|
||||||
return &MockScheduler_Dispatch_Call{Call: _e.mock.On("Dispatch", node)}
|
return &MockScheduler_Dispatch_Call{Call: _e.mock.On("Dispatch", node)}
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ type MockScheduler_GetNodeChannelDelta_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetNodeChannelDelta is a helper method to define mock.On call
|
// GetNodeChannelDelta is a helper method to define mock.On call
|
||||||
// - nodeID int64
|
// - nodeID int64
|
||||||
func (_e *MockScheduler_Expecter) GetNodeChannelDelta(nodeID interface{}) *MockScheduler_GetNodeChannelDelta_Call {
|
func (_e *MockScheduler_Expecter) GetNodeChannelDelta(nodeID interface{}) *MockScheduler_GetNodeChannelDelta_Call {
|
||||||
return &MockScheduler_GetNodeChannelDelta_Call{Call: _e.mock.On("GetNodeChannelDelta", nodeID)}
|
return &MockScheduler_GetNodeChannelDelta_Call{Call: _e.mock.On("GetNodeChannelDelta", nodeID)}
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ type MockScheduler_GetNodeSegmentDelta_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetNodeSegmentDelta is a helper method to define mock.On call
|
// GetNodeSegmentDelta is a helper method to define mock.On call
|
||||||
// - nodeID int64
|
// - nodeID int64
|
||||||
func (_e *MockScheduler_Expecter) GetNodeSegmentDelta(nodeID interface{}) *MockScheduler_GetNodeSegmentDelta_Call {
|
func (_e *MockScheduler_Expecter) GetNodeSegmentDelta(nodeID interface{}) *MockScheduler_GetNodeSegmentDelta_Call {
|
||||||
return &MockScheduler_GetNodeSegmentDelta_Call{Call: _e.mock.On("GetNodeSegmentDelta", nodeID)}
|
return &MockScheduler_GetNodeSegmentDelta_Call{Call: _e.mock.On("GetNodeSegmentDelta", nodeID)}
|
||||||
}
|
}
|
||||||
@ -199,7 +199,7 @@ type MockScheduler_RemoveByNode_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RemoveByNode is a helper method to define mock.On call
|
// RemoveByNode is a helper method to define mock.On call
|
||||||
// - node int64
|
// - node int64
|
||||||
func (_e *MockScheduler_Expecter) RemoveByNode(node interface{}) *MockScheduler_RemoveByNode_Call {
|
func (_e *MockScheduler_Expecter) RemoveByNode(node interface{}) *MockScheduler_RemoveByNode_Call {
|
||||||
return &MockScheduler_RemoveByNode_Call{Call: _e.mock.On("RemoveByNode", node)}
|
return &MockScheduler_RemoveByNode_Call{Call: _e.mock.On("RemoveByNode", node)}
|
||||||
}
|
}
|
||||||
@ -227,7 +227,7 @@ type MockScheduler_RemoveExecutor_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RemoveExecutor is a helper method to define mock.On call
|
// RemoveExecutor is a helper method to define mock.On call
|
||||||
// - nodeID int64
|
// - nodeID int64
|
||||||
func (_e *MockScheduler_Expecter) RemoveExecutor(nodeID interface{}) *MockScheduler_RemoveExecutor_Call {
|
func (_e *MockScheduler_Expecter) RemoveExecutor(nodeID interface{}) *MockScheduler_RemoveExecutor_Call {
|
||||||
return &MockScheduler_RemoveExecutor_Call{Call: _e.mock.On("RemoveExecutor", nodeID)}
|
return &MockScheduler_RemoveExecutor_Call{Call: _e.mock.On("RemoveExecutor", nodeID)}
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ type MockScheduler_Start_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Start is a helper method to define mock.On call
|
// Start is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
func (_e *MockScheduler_Expecter) Start(ctx interface{}) *MockScheduler_Start_Call {
|
func (_e *MockScheduler_Expecter) Start(ctx interface{}) *MockScheduler_Start_Call {
|
||||||
return &MockScheduler_Start_Call{Call: _e.mock.On("Start", ctx)}
|
return &MockScheduler_Start_Call{Call: _e.mock.On("Start", ctx)}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,7 +77,7 @@ type MockTSafeReplicaInterface_WatchChannel_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WatchChannel is a helper method to define mock.On call
|
// WatchChannel is a helper method to define mock.On call
|
||||||
// - channel string
|
// - channel string
|
||||||
func (_e *MockTSafeReplicaInterface_Expecter) WatchChannel(channel interface{}) *MockTSafeReplicaInterface_WatchChannel_Call {
|
func (_e *MockTSafeReplicaInterface_Expecter) WatchChannel(channel interface{}) *MockTSafeReplicaInterface_WatchChannel_Call {
|
||||||
return &MockTSafeReplicaInterface_WatchChannel_Call{Call: _e.mock.On("WatchChannel", channel)}
|
return &MockTSafeReplicaInterface_WatchChannel_Call{Call: _e.mock.On("WatchChannel", channel)}
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ type MockTSafeReplicaInterface_addTSafe_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// addTSafe is a helper method to define mock.On call
|
// addTSafe is a helper method to define mock.On call
|
||||||
// - vChannel string
|
// - vChannel string
|
||||||
func (_e *MockTSafeReplicaInterface_Expecter) addTSafe(vChannel interface{}) *MockTSafeReplicaInterface_addTSafe_Call {
|
func (_e *MockTSafeReplicaInterface_Expecter) addTSafe(vChannel interface{}) *MockTSafeReplicaInterface_addTSafe_Call {
|
||||||
return &MockTSafeReplicaInterface_addTSafe_Call{Call: _e.mock.On("addTSafe", vChannel)}
|
return &MockTSafeReplicaInterface_addTSafe_Call{Call: _e.mock.On("addTSafe", vChannel)}
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ type MockTSafeReplicaInterface_getTSafe_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// getTSafe is a helper method to define mock.On call
|
// getTSafe is a helper method to define mock.On call
|
||||||
// - vChannel string
|
// - vChannel string
|
||||||
func (_e *MockTSafeReplicaInterface_Expecter) getTSafe(vChannel interface{}) *MockTSafeReplicaInterface_getTSafe_Call {
|
func (_e *MockTSafeReplicaInterface_Expecter) getTSafe(vChannel interface{}) *MockTSafeReplicaInterface_getTSafe_Call {
|
||||||
return &MockTSafeReplicaInterface_getTSafe_Call{Call: _e.mock.On("getTSafe", vChannel)}
|
return &MockTSafeReplicaInterface_getTSafe_Call{Call: _e.mock.On("getTSafe", vChannel)}
|
||||||
}
|
}
|
||||||
@ -177,7 +177,7 @@ type MockTSafeReplicaInterface_removeTSafe_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// removeTSafe is a helper method to define mock.On call
|
// removeTSafe is a helper method to define mock.On call
|
||||||
// - vChannel string
|
// - vChannel string
|
||||||
func (_e *MockTSafeReplicaInterface_Expecter) removeTSafe(vChannel interface{}) *MockTSafeReplicaInterface_removeTSafe_Call {
|
func (_e *MockTSafeReplicaInterface_Expecter) removeTSafe(vChannel interface{}) *MockTSafeReplicaInterface_removeTSafe_Call {
|
||||||
return &MockTSafeReplicaInterface_removeTSafe_Call{Call: _e.mock.On("removeTSafe", vChannel)}
|
return &MockTSafeReplicaInterface_removeTSafe_Call{Call: _e.mock.On("removeTSafe", vChannel)}
|
||||||
}
|
}
|
||||||
@ -214,8 +214,8 @@ type MockTSafeReplicaInterface_setTSafe_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// setTSafe is a helper method to define mock.On call
|
// setTSafe is a helper method to define mock.On call
|
||||||
// - vChannel string
|
// - vChannel string
|
||||||
// - timestamp uint64
|
// - timestamp uint64
|
||||||
func (_e *MockTSafeReplicaInterface_Expecter) setTSafe(vChannel interface{}, timestamp interface{}) *MockTSafeReplicaInterface_setTSafe_Call {
|
func (_e *MockTSafeReplicaInterface_Expecter) setTSafe(vChannel interface{}, timestamp interface{}) *MockTSafeReplicaInterface_setTSafe_Call {
|
||||||
return &MockTSafeReplicaInterface_setTSafe_Call{Call: _e.mock.On("setTSafe", vChannel, timestamp)}
|
return &MockTSafeReplicaInterface_setTSafe_Call{Call: _e.mock.On("setTSafe", vChannel, timestamp)}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,8 +49,8 @@ type GarbageCollector_GcCollectionData_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GcCollectionData is a helper method to define mock.On call
|
// GcCollectionData is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - coll *model.Collection
|
// - coll *model.Collection
|
||||||
func (_e *GarbageCollector_Expecter) GcCollectionData(ctx interface{}, coll interface{}) *GarbageCollector_GcCollectionData_Call {
|
func (_e *GarbageCollector_Expecter) GcCollectionData(ctx interface{}, coll interface{}) *GarbageCollector_GcCollectionData_Call {
|
||||||
return &GarbageCollector_GcCollectionData_Call{Call: _e.mock.On("GcCollectionData", ctx, coll)}
|
return &GarbageCollector_GcCollectionData_Call{Call: _e.mock.On("GcCollectionData", ctx, coll)}
|
||||||
}
|
}
|
||||||
@ -94,9 +94,9 @@ type GarbageCollector_GcPartitionData_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GcPartitionData is a helper method to define mock.On call
|
// GcPartitionData is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - pChannels []string
|
// - pChannels []string
|
||||||
// - partition *model.Partition
|
// - partition *model.Partition
|
||||||
func (_e *GarbageCollector_Expecter) GcPartitionData(ctx interface{}, pChannels interface{}, partition interface{}) *GarbageCollector_GcPartitionData_Call {
|
func (_e *GarbageCollector_Expecter) GcPartitionData(ctx interface{}, pChannels interface{}, partition interface{}) *GarbageCollector_GcPartitionData_Call {
|
||||||
return &GarbageCollector_GcPartitionData_Call{Call: _e.mock.On("GcPartitionData", ctx, pChannels, partition)}
|
return &GarbageCollector_GcPartitionData_Call{Call: _e.mock.On("GcPartitionData", ctx, pChannels, partition)}
|
||||||
}
|
}
|
||||||
@ -124,8 +124,8 @@ type GarbageCollector_ReDropCollection_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ReDropCollection is a helper method to define mock.On call
|
// ReDropCollection is a helper method to define mock.On call
|
||||||
// - collMeta *model.Collection
|
// - collMeta *model.Collection
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *GarbageCollector_Expecter) ReDropCollection(collMeta interface{}, ts interface{}) *GarbageCollector_ReDropCollection_Call {
|
func (_e *GarbageCollector_Expecter) ReDropCollection(collMeta interface{}, ts interface{}) *GarbageCollector_ReDropCollection_Call {
|
||||||
return &GarbageCollector_ReDropCollection_Call{Call: _e.mock.On("ReDropCollection", collMeta, ts)}
|
return &GarbageCollector_ReDropCollection_Call{Call: _e.mock.On("ReDropCollection", collMeta, ts)}
|
||||||
}
|
}
|
||||||
@ -153,9 +153,9 @@ type GarbageCollector_ReDropPartition_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ReDropPartition is a helper method to define mock.On call
|
// ReDropPartition is a helper method to define mock.On call
|
||||||
// - pChannels []string
|
// - pChannels []string
|
||||||
// - partition *model.Partition
|
// - partition *model.Partition
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *GarbageCollector_Expecter) ReDropPartition(pChannels interface{}, partition interface{}, ts interface{}) *GarbageCollector_ReDropPartition_Call {
|
func (_e *GarbageCollector_Expecter) ReDropPartition(pChannels interface{}, partition interface{}, ts interface{}) *GarbageCollector_ReDropPartition_Call {
|
||||||
return &GarbageCollector_ReDropPartition_Call{Call: _e.mock.On("ReDropPartition", pChannels, partition, ts)}
|
return &GarbageCollector_ReDropPartition_Call{Call: _e.mock.On("ReDropPartition", pChannels, partition, ts)}
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ type GarbageCollector_RemoveCreatingCollection_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RemoveCreatingCollection is a helper method to define mock.On call
|
// RemoveCreatingCollection is a helper method to define mock.On call
|
||||||
// - collMeta *model.Collection
|
// - collMeta *model.Collection
|
||||||
func (_e *GarbageCollector_Expecter) RemoveCreatingCollection(collMeta interface{}) *GarbageCollector_RemoveCreatingCollection_Call {
|
func (_e *GarbageCollector_Expecter) RemoveCreatingCollection(collMeta interface{}) *GarbageCollector_RemoveCreatingCollection_Call {
|
||||||
return &GarbageCollector_RemoveCreatingCollection_Call{Call: _e.mock.On("RemoveCreatingCollection", collMeta)}
|
return &GarbageCollector_RemoveCreatingCollection_Call{Call: _e.mock.On("RemoveCreatingCollection", collMeta)}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,8 +48,8 @@ type IMetaTable_AddCollection_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddCollection is a helper method to define mock.On call
|
// AddCollection is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - coll *model.Collection
|
// - coll *model.Collection
|
||||||
func (_e *IMetaTable_Expecter) AddCollection(ctx interface{}, coll interface{}) *IMetaTable_AddCollection_Call {
|
func (_e *IMetaTable_Expecter) AddCollection(ctx interface{}, coll interface{}) *IMetaTable_AddCollection_Call {
|
||||||
return &IMetaTable_AddCollection_Call{Call: _e.mock.On("AddCollection", ctx, coll)}
|
return &IMetaTable_AddCollection_Call{Call: _e.mock.On("AddCollection", ctx, coll)}
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@ type IMetaTable_AddCredential_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddCredential is a helper method to define mock.On call
|
// AddCredential is a helper method to define mock.On call
|
||||||
// - credInfo *internalpb.CredentialInfo
|
// - credInfo *internalpb.CredentialInfo
|
||||||
func (_e *IMetaTable_Expecter) AddCredential(credInfo interface{}) *IMetaTable_AddCredential_Call {
|
func (_e *IMetaTable_Expecter) AddCredential(credInfo interface{}) *IMetaTable_AddCredential_Call {
|
||||||
return &IMetaTable_AddCredential_Call{Call: _e.mock.On("AddCredential", credInfo)}
|
return &IMetaTable_AddCredential_Call{Call: _e.mock.On("AddCredential", credInfo)}
|
||||||
}
|
}
|
||||||
@ -123,8 +123,8 @@ type IMetaTable_AddPartition_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AddPartition is a helper method to define mock.On call
|
// AddPartition is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - partition *model.Partition
|
// - partition *model.Partition
|
||||||
func (_e *IMetaTable_Expecter) AddPartition(ctx interface{}, partition interface{}) *IMetaTable_AddPartition_Call {
|
func (_e *IMetaTable_Expecter) AddPartition(ctx interface{}, partition interface{}) *IMetaTable_AddPartition_Call {
|
||||||
return &IMetaTable_AddPartition_Call{Call: _e.mock.On("AddPartition", ctx, partition)}
|
return &IMetaTable_AddPartition_Call{Call: _e.mock.On("AddPartition", ctx, partition)}
|
||||||
}
|
}
|
||||||
@ -161,10 +161,10 @@ type IMetaTable_AlterAlias_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AlterAlias is a helper method to define mock.On call
|
// AlterAlias is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - alias string
|
// - alias string
|
||||||
// - collectionName string
|
// - collectionName string
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *IMetaTable_Expecter) AlterAlias(ctx interface{}, alias interface{}, collectionName interface{}, ts interface{}) *IMetaTable_AlterAlias_Call {
|
func (_e *IMetaTable_Expecter) AlterAlias(ctx interface{}, alias interface{}, collectionName interface{}, ts interface{}) *IMetaTable_AlterAlias_Call {
|
||||||
return &IMetaTable_AlterAlias_Call{Call: _e.mock.On("AlterAlias", ctx, alias, collectionName, ts)}
|
return &IMetaTable_AlterAlias_Call{Call: _e.mock.On("AlterAlias", ctx, alias, collectionName, ts)}
|
||||||
}
|
}
|
||||||
@ -201,10 +201,10 @@ type IMetaTable_AlterCollection_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AlterCollection is a helper method to define mock.On call
|
// AlterCollection is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - oldColl *model.Collection
|
// - oldColl *model.Collection
|
||||||
// - newColl *model.Collection
|
// - newColl *model.Collection
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *IMetaTable_Expecter) AlterCollection(ctx interface{}, oldColl interface{}, newColl interface{}, ts interface{}) *IMetaTable_AlterCollection_Call {
|
func (_e *IMetaTable_Expecter) AlterCollection(ctx interface{}, oldColl interface{}, newColl interface{}, ts interface{}) *IMetaTable_AlterCollection_Call {
|
||||||
return &IMetaTable_AlterCollection_Call{Call: _e.mock.On("AlterCollection", ctx, oldColl, newColl, ts)}
|
return &IMetaTable_AlterCollection_Call{Call: _e.mock.On("AlterCollection", ctx, oldColl, newColl, ts)}
|
||||||
}
|
}
|
||||||
@ -241,7 +241,7 @@ type IMetaTable_AlterCredential_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AlterCredential is a helper method to define mock.On call
|
// AlterCredential is a helper method to define mock.On call
|
||||||
// - credInfo *internalpb.CredentialInfo
|
// - credInfo *internalpb.CredentialInfo
|
||||||
func (_e *IMetaTable_Expecter) AlterCredential(credInfo interface{}) *IMetaTable_AlterCredential_Call {
|
func (_e *IMetaTable_Expecter) AlterCredential(credInfo interface{}) *IMetaTable_AlterCredential_Call {
|
||||||
return &IMetaTable_AlterCredential_Call{Call: _e.mock.On("AlterCredential", credInfo)}
|
return &IMetaTable_AlterCredential_Call{Call: _e.mock.On("AlterCredential", credInfo)}
|
||||||
}
|
}
|
||||||
@ -278,10 +278,10 @@ type IMetaTable_ChangeCollectionState_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ChangeCollectionState is a helper method to define mock.On call
|
// ChangeCollectionState is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - collectionID int64
|
// - collectionID int64
|
||||||
// - state etcdpb.CollectionState
|
// - state etcdpb.CollectionState
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *IMetaTable_Expecter) ChangeCollectionState(ctx interface{}, collectionID interface{}, state interface{}, ts interface{}) *IMetaTable_ChangeCollectionState_Call {
|
func (_e *IMetaTable_Expecter) ChangeCollectionState(ctx interface{}, collectionID interface{}, state interface{}, ts interface{}) *IMetaTable_ChangeCollectionState_Call {
|
||||||
return &IMetaTable_ChangeCollectionState_Call{Call: _e.mock.On("ChangeCollectionState", ctx, collectionID, state, ts)}
|
return &IMetaTable_ChangeCollectionState_Call{Call: _e.mock.On("ChangeCollectionState", ctx, collectionID, state, ts)}
|
||||||
}
|
}
|
||||||
@ -318,11 +318,11 @@ type IMetaTable_ChangePartitionState_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ChangePartitionState is a helper method to define mock.On call
|
// ChangePartitionState is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - collectionID int64
|
// - collectionID int64
|
||||||
// - partitionID int64
|
// - partitionID int64
|
||||||
// - state etcdpb.PartitionState
|
// - state etcdpb.PartitionState
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *IMetaTable_Expecter) ChangePartitionState(ctx interface{}, collectionID interface{}, partitionID interface{}, state interface{}, ts interface{}) *IMetaTable_ChangePartitionState_Call {
|
func (_e *IMetaTable_Expecter) ChangePartitionState(ctx interface{}, collectionID interface{}, partitionID interface{}, state interface{}, ts interface{}) *IMetaTable_ChangePartitionState_Call {
|
||||||
return &IMetaTable_ChangePartitionState_Call{Call: _e.mock.On("ChangePartitionState", ctx, collectionID, partitionID, state, ts)}
|
return &IMetaTable_ChangePartitionState_Call{Call: _e.mock.On("ChangePartitionState", ctx, collectionID, partitionID, state, ts)}
|
||||||
}
|
}
|
||||||
@ -359,10 +359,10 @@ type IMetaTable_CreateAlias_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CreateAlias is a helper method to define mock.On call
|
// CreateAlias is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - alias string
|
// - alias string
|
||||||
// - collectionName string
|
// - collectionName string
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *IMetaTable_Expecter) CreateAlias(ctx interface{}, alias interface{}, collectionName interface{}, ts interface{}) *IMetaTable_CreateAlias_Call {
|
func (_e *IMetaTable_Expecter) CreateAlias(ctx interface{}, alias interface{}, collectionName interface{}, ts interface{}) *IMetaTable_CreateAlias_Call {
|
||||||
return &IMetaTable_CreateAlias_Call{Call: _e.mock.On("CreateAlias", ctx, alias, collectionName, ts)}
|
return &IMetaTable_CreateAlias_Call{Call: _e.mock.On("CreateAlias", ctx, alias, collectionName, ts)}
|
||||||
}
|
}
|
||||||
@ -399,8 +399,8 @@ type IMetaTable_CreateRole_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CreateRole is a helper method to define mock.On call
|
// CreateRole is a helper method to define mock.On call
|
||||||
// - tenant string
|
// - tenant string
|
||||||
// - entity *milvuspb.RoleEntity
|
// - entity *milvuspb.RoleEntity
|
||||||
func (_e *IMetaTable_Expecter) CreateRole(tenant interface{}, entity interface{}) *IMetaTable_CreateRole_Call {
|
func (_e *IMetaTable_Expecter) CreateRole(tenant interface{}, entity interface{}) *IMetaTable_CreateRole_Call {
|
||||||
return &IMetaTable_CreateRole_Call{Call: _e.mock.On("CreateRole", tenant, entity)}
|
return &IMetaTable_CreateRole_Call{Call: _e.mock.On("CreateRole", tenant, entity)}
|
||||||
}
|
}
|
||||||
@ -437,7 +437,7 @@ type IMetaTable_DeleteCredential_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DeleteCredential is a helper method to define mock.On call
|
// DeleteCredential is a helper method to define mock.On call
|
||||||
// - username string
|
// - username string
|
||||||
func (_e *IMetaTable_Expecter) DeleteCredential(username interface{}) *IMetaTable_DeleteCredential_Call {
|
func (_e *IMetaTable_Expecter) DeleteCredential(username interface{}) *IMetaTable_DeleteCredential_Call {
|
||||||
return &IMetaTable_DeleteCredential_Call{Call: _e.mock.On("DeleteCredential", username)}
|
return &IMetaTable_DeleteCredential_Call{Call: _e.mock.On("DeleteCredential", username)}
|
||||||
}
|
}
|
||||||
@ -474,9 +474,9 @@ type IMetaTable_DropAlias_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DropAlias is a helper method to define mock.On call
|
// DropAlias is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - alias string
|
// - alias string
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *IMetaTable_Expecter) DropAlias(ctx interface{}, alias interface{}, ts interface{}) *IMetaTable_DropAlias_Call {
|
func (_e *IMetaTable_Expecter) DropAlias(ctx interface{}, alias interface{}, ts interface{}) *IMetaTable_DropAlias_Call {
|
||||||
return &IMetaTable_DropAlias_Call{Call: _e.mock.On("DropAlias", ctx, alias, ts)}
|
return &IMetaTable_DropAlias_Call{Call: _e.mock.On("DropAlias", ctx, alias, ts)}
|
||||||
}
|
}
|
||||||
@ -513,8 +513,8 @@ type IMetaTable_DropGrant_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DropGrant is a helper method to define mock.On call
|
// DropGrant is a helper method to define mock.On call
|
||||||
// - tenant string
|
// - tenant string
|
||||||
// - role *milvuspb.RoleEntity
|
// - role *milvuspb.RoleEntity
|
||||||
func (_e *IMetaTable_Expecter) DropGrant(tenant interface{}, role interface{}) *IMetaTable_DropGrant_Call {
|
func (_e *IMetaTable_Expecter) DropGrant(tenant interface{}, role interface{}) *IMetaTable_DropGrant_Call {
|
||||||
return &IMetaTable_DropGrant_Call{Call: _e.mock.On("DropGrant", tenant, role)}
|
return &IMetaTable_DropGrant_Call{Call: _e.mock.On("DropGrant", tenant, role)}
|
||||||
}
|
}
|
||||||
@ -551,8 +551,8 @@ type IMetaTable_DropRole_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DropRole is a helper method to define mock.On call
|
// DropRole is a helper method to define mock.On call
|
||||||
// - tenant string
|
// - tenant string
|
||||||
// - roleName string
|
// - roleName string
|
||||||
func (_e *IMetaTable_Expecter) DropRole(tenant interface{}, roleName interface{}) *IMetaTable_DropRole_Call {
|
func (_e *IMetaTable_Expecter) DropRole(tenant interface{}, roleName interface{}) *IMetaTable_DropRole_Call {
|
||||||
return &IMetaTable_DropRole_Call{Call: _e.mock.On("DropRole", tenant, roleName)}
|
return &IMetaTable_DropRole_Call{Call: _e.mock.On("DropRole", tenant, roleName)}
|
||||||
}
|
}
|
||||||
@ -598,10 +598,10 @@ type IMetaTable_GetCollectionByID_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetCollectionByID is a helper method to define mock.On call
|
// GetCollectionByID is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - collectionID int64
|
// - collectionID int64
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
// - allowUnavailable bool
|
// - allowUnavailable bool
|
||||||
func (_e *IMetaTable_Expecter) GetCollectionByID(ctx interface{}, collectionID interface{}, ts interface{}, allowUnavailable interface{}) *IMetaTable_GetCollectionByID_Call {
|
func (_e *IMetaTable_Expecter) GetCollectionByID(ctx interface{}, collectionID interface{}, ts interface{}, allowUnavailable interface{}) *IMetaTable_GetCollectionByID_Call {
|
||||||
return &IMetaTable_GetCollectionByID_Call{Call: _e.mock.On("GetCollectionByID", ctx, collectionID, ts, allowUnavailable)}
|
return &IMetaTable_GetCollectionByID_Call{Call: _e.mock.On("GetCollectionByID", ctx, collectionID, ts, allowUnavailable)}
|
||||||
}
|
}
|
||||||
@ -647,9 +647,9 @@ type IMetaTable_GetCollectionByName_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetCollectionByName is a helper method to define mock.On call
|
// GetCollectionByName is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - collectionName string
|
// - collectionName string
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *IMetaTable_Expecter) GetCollectionByName(ctx interface{}, collectionName interface{}, ts interface{}) *IMetaTable_GetCollectionByName_Call {
|
func (_e *IMetaTable_Expecter) GetCollectionByName(ctx interface{}, collectionName interface{}, ts interface{}) *IMetaTable_GetCollectionByName_Call {
|
||||||
return &IMetaTable_GetCollectionByName_Call{Call: _e.mock.On("GetCollectionByName", ctx, collectionName, ts)}
|
return &IMetaTable_GetCollectionByName_Call{Call: _e.mock.On("GetCollectionByName", ctx, collectionName, ts)}
|
||||||
}
|
}
|
||||||
@ -688,7 +688,7 @@ type IMetaTable_GetCollectionVirtualChannels_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetCollectionVirtualChannels is a helper method to define mock.On call
|
// GetCollectionVirtualChannels is a helper method to define mock.On call
|
||||||
// - colID int64
|
// - colID int64
|
||||||
func (_e *IMetaTable_Expecter) GetCollectionVirtualChannels(colID interface{}) *IMetaTable_GetCollectionVirtualChannels_Call {
|
func (_e *IMetaTable_Expecter) GetCollectionVirtualChannels(colID interface{}) *IMetaTable_GetCollectionVirtualChannels_Call {
|
||||||
return &IMetaTable_GetCollectionVirtualChannels_Call{Call: _e.mock.On("GetCollectionVirtualChannels", colID)}
|
return &IMetaTable_GetCollectionVirtualChannels_Call{Call: _e.mock.On("GetCollectionVirtualChannels", colID)}
|
||||||
}
|
}
|
||||||
@ -734,7 +734,7 @@ type IMetaTable_GetCredential_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetCredential is a helper method to define mock.On call
|
// GetCredential is a helper method to define mock.On call
|
||||||
// - username string
|
// - username string
|
||||||
func (_e *IMetaTable_Expecter) GetCredential(username interface{}) *IMetaTable_GetCredential_Call {
|
func (_e *IMetaTable_Expecter) GetCredential(username interface{}) *IMetaTable_GetCredential_Call {
|
||||||
return &IMetaTable_GetCredential_Call{Call: _e.mock.On("GetCredential", username)}
|
return &IMetaTable_GetCredential_Call{Call: _e.mock.On("GetCredential", username)}
|
||||||
}
|
}
|
||||||
@ -778,9 +778,9 @@ type IMetaTable_GetPartitionByName_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetPartitionByName is a helper method to define mock.On call
|
// GetPartitionByName is a helper method to define mock.On call
|
||||||
// - collID int64
|
// - collID int64
|
||||||
// - partitionName string
|
// - partitionName string
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *IMetaTable_Expecter) GetPartitionByName(collID interface{}, partitionName interface{}, ts interface{}) *IMetaTable_GetPartitionByName_Call {
|
func (_e *IMetaTable_Expecter) GetPartitionByName(collID interface{}, partitionName interface{}, ts interface{}) *IMetaTable_GetPartitionByName_Call {
|
||||||
return &IMetaTable_GetPartitionByName_Call{Call: _e.mock.On("GetPartitionByName", collID, partitionName, ts)}
|
return &IMetaTable_GetPartitionByName_Call{Call: _e.mock.On("GetPartitionByName", collID, partitionName, ts)}
|
||||||
}
|
}
|
||||||
@ -824,9 +824,9 @@ type IMetaTable_GetPartitionNameByID_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetPartitionNameByID is a helper method to define mock.On call
|
// GetPartitionNameByID is a helper method to define mock.On call
|
||||||
// - collID int64
|
// - collID int64
|
||||||
// - partitionID int64
|
// - partitionID int64
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *IMetaTable_Expecter) GetPartitionNameByID(collID interface{}, partitionID interface{}, ts interface{}) *IMetaTable_GetPartitionNameByID_Call {
|
func (_e *IMetaTable_Expecter) GetPartitionNameByID(collID interface{}, partitionID interface{}, ts interface{}) *IMetaTable_GetPartitionNameByID_Call {
|
||||||
return &IMetaTable_GetPartitionNameByID_Call{Call: _e.mock.On("GetPartitionNameByID", collID, partitionID, ts)}
|
return &IMetaTable_GetPartitionNameByID_Call{Call: _e.mock.On("GetPartitionNameByID", collID, partitionID, ts)}
|
||||||
}
|
}
|
||||||
@ -863,7 +863,7 @@ type IMetaTable_IsAlias_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IsAlias is a helper method to define mock.On call
|
// IsAlias is a helper method to define mock.On call
|
||||||
// - name string
|
// - name string
|
||||||
func (_e *IMetaTable_Expecter) IsAlias(name interface{}) *IMetaTable_IsAlias_Call {
|
func (_e *IMetaTable_Expecter) IsAlias(name interface{}) *IMetaTable_IsAlias_Call {
|
||||||
return &IMetaTable_IsAlias_Call{Call: _e.mock.On("IsAlias", name)}
|
return &IMetaTable_IsAlias_Call{Call: _e.mock.On("IsAlias", name)}
|
||||||
}
|
}
|
||||||
@ -909,8 +909,8 @@ type IMetaTable_ListAbnormalCollections_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ListAbnormalCollections is a helper method to define mock.On call
|
// ListAbnormalCollections is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *IMetaTable_Expecter) ListAbnormalCollections(ctx interface{}, ts interface{}) *IMetaTable_ListAbnormalCollections_Call {
|
func (_e *IMetaTable_Expecter) ListAbnormalCollections(ctx interface{}, ts interface{}) *IMetaTable_ListAbnormalCollections_Call {
|
||||||
return &IMetaTable_ListAbnormalCollections_Call{Call: _e.mock.On("ListAbnormalCollections", ctx, ts)}
|
return &IMetaTable_ListAbnormalCollections_Call{Call: _e.mock.On("ListAbnormalCollections", ctx, ts)}
|
||||||
}
|
}
|
||||||
@ -949,7 +949,7 @@ type IMetaTable_ListAliasesByID_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ListAliasesByID is a helper method to define mock.On call
|
// ListAliasesByID is a helper method to define mock.On call
|
||||||
// - collID int64
|
// - collID int64
|
||||||
func (_e *IMetaTable_Expecter) ListAliasesByID(collID interface{}) *IMetaTable_ListAliasesByID_Call {
|
func (_e *IMetaTable_Expecter) ListAliasesByID(collID interface{}) *IMetaTable_ListAliasesByID_Call {
|
||||||
return &IMetaTable_ListAliasesByID_Call{Call: _e.mock.On("ListAliasesByID", collID)}
|
return &IMetaTable_ListAliasesByID_Call{Call: _e.mock.On("ListAliasesByID", collID)}
|
||||||
}
|
}
|
||||||
@ -1033,8 +1033,8 @@ type IMetaTable_ListCollections_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ListCollections is a helper method to define mock.On call
|
// ListCollections is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *IMetaTable_Expecter) ListCollections(ctx interface{}, ts interface{}) *IMetaTable_ListCollections_Call {
|
func (_e *IMetaTable_Expecter) ListCollections(ctx interface{}, ts interface{}) *IMetaTable_ListCollections_Call {
|
||||||
return &IMetaTable_ListCollections_Call{Call: _e.mock.On("ListCollections", ctx, ts)}
|
return &IMetaTable_ListCollections_Call{Call: _e.mock.On("ListCollections", ctx, ts)}
|
||||||
}
|
}
|
||||||
@ -1125,7 +1125,7 @@ type IMetaTable_ListPolicy_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ListPolicy is a helper method to define mock.On call
|
// ListPolicy is a helper method to define mock.On call
|
||||||
// - tenant string
|
// - tenant string
|
||||||
func (_e *IMetaTable_Expecter) ListPolicy(tenant interface{}) *IMetaTable_ListPolicy_Call {
|
func (_e *IMetaTable_Expecter) ListPolicy(tenant interface{}) *IMetaTable_ListPolicy_Call {
|
||||||
return &IMetaTable_ListPolicy_Call{Call: _e.mock.On("ListPolicy", tenant)}
|
return &IMetaTable_ListPolicy_Call{Call: _e.mock.On("ListPolicy", tenant)}
|
||||||
}
|
}
|
||||||
@ -1171,7 +1171,7 @@ type IMetaTable_ListUserRole_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ListUserRole is a helper method to define mock.On call
|
// ListUserRole is a helper method to define mock.On call
|
||||||
// - tenant string
|
// - tenant string
|
||||||
func (_e *IMetaTable_Expecter) ListUserRole(tenant interface{}) *IMetaTable_ListUserRole_Call {
|
func (_e *IMetaTable_Expecter) ListUserRole(tenant interface{}) *IMetaTable_ListUserRole_Call {
|
||||||
return &IMetaTable_ListUserRole_Call{Call: _e.mock.On("ListUserRole", tenant)}
|
return &IMetaTable_ListUserRole_Call{Call: _e.mock.On("ListUserRole", tenant)}
|
||||||
}
|
}
|
||||||
@ -1208,9 +1208,9 @@ type IMetaTable_OperatePrivilege_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// OperatePrivilege is a helper method to define mock.On call
|
// OperatePrivilege is a helper method to define mock.On call
|
||||||
// - tenant string
|
// - tenant string
|
||||||
// - entity *milvuspb.GrantEntity
|
// - entity *milvuspb.GrantEntity
|
||||||
// - operateType milvuspb.OperatePrivilegeType
|
// - operateType milvuspb.OperatePrivilegeType
|
||||||
func (_e *IMetaTable_Expecter) OperatePrivilege(tenant interface{}, entity interface{}, operateType interface{}) *IMetaTable_OperatePrivilege_Call {
|
func (_e *IMetaTable_Expecter) OperatePrivilege(tenant interface{}, entity interface{}, operateType interface{}) *IMetaTable_OperatePrivilege_Call {
|
||||||
return &IMetaTable_OperatePrivilege_Call{Call: _e.mock.On("OperatePrivilege", tenant, entity, operateType)}
|
return &IMetaTable_OperatePrivilege_Call{Call: _e.mock.On("OperatePrivilege", tenant, entity, operateType)}
|
||||||
}
|
}
|
||||||
@ -1247,10 +1247,10 @@ type IMetaTable_OperateUserRole_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// OperateUserRole is a helper method to define mock.On call
|
// OperateUserRole is a helper method to define mock.On call
|
||||||
// - tenant string
|
// - tenant string
|
||||||
// - userEntity *milvuspb.UserEntity
|
// - userEntity *milvuspb.UserEntity
|
||||||
// - roleEntity *milvuspb.RoleEntity
|
// - roleEntity *milvuspb.RoleEntity
|
||||||
// - operateType milvuspb.OperateUserRoleType
|
// - operateType milvuspb.OperateUserRoleType
|
||||||
func (_e *IMetaTable_Expecter) OperateUserRole(tenant interface{}, userEntity interface{}, roleEntity interface{}, operateType interface{}) *IMetaTable_OperateUserRole_Call {
|
func (_e *IMetaTable_Expecter) OperateUserRole(tenant interface{}, userEntity interface{}, roleEntity interface{}, operateType interface{}) *IMetaTable_OperateUserRole_Call {
|
||||||
return &IMetaTable_OperateUserRole_Call{Call: _e.mock.On("OperateUserRole", tenant, userEntity, roleEntity, operateType)}
|
return &IMetaTable_OperateUserRole_Call{Call: _e.mock.On("OperateUserRole", tenant, userEntity, roleEntity, operateType)}
|
||||||
}
|
}
|
||||||
@ -1287,9 +1287,9 @@ type IMetaTable_RemoveCollection_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RemoveCollection is a helper method to define mock.On call
|
// RemoveCollection is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - collectionID int64
|
// - collectionID int64
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *IMetaTable_Expecter) RemoveCollection(ctx interface{}, collectionID interface{}, ts interface{}) *IMetaTable_RemoveCollection_Call {
|
func (_e *IMetaTable_Expecter) RemoveCollection(ctx interface{}, collectionID interface{}, ts interface{}) *IMetaTable_RemoveCollection_Call {
|
||||||
return &IMetaTable_RemoveCollection_Call{Call: _e.mock.On("RemoveCollection", ctx, collectionID, ts)}
|
return &IMetaTable_RemoveCollection_Call{Call: _e.mock.On("RemoveCollection", ctx, collectionID, ts)}
|
||||||
}
|
}
|
||||||
@ -1326,10 +1326,10 @@ type IMetaTable_RemovePartition_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RemovePartition is a helper method to define mock.On call
|
// RemovePartition is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - collectionID int64
|
// - collectionID int64
|
||||||
// - partitionID int64
|
// - partitionID int64
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *IMetaTable_Expecter) RemovePartition(ctx interface{}, collectionID interface{}, partitionID interface{}, ts interface{}) *IMetaTable_RemovePartition_Call {
|
func (_e *IMetaTable_Expecter) RemovePartition(ctx interface{}, collectionID interface{}, partitionID interface{}, ts interface{}) *IMetaTable_RemovePartition_Call {
|
||||||
return &IMetaTable_RemovePartition_Call{Call: _e.mock.On("RemovePartition", ctx, collectionID, partitionID, ts)}
|
return &IMetaTable_RemovePartition_Call{Call: _e.mock.On("RemovePartition", ctx, collectionID, partitionID, ts)}
|
||||||
}
|
}
|
||||||
@ -1366,10 +1366,10 @@ type IMetaTable_RenameCollection_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RenameCollection is a helper method to define mock.On call
|
// RenameCollection is a helper method to define mock.On call
|
||||||
// - ctx context.Context
|
// - ctx context.Context
|
||||||
// - oldName string
|
// - oldName string
|
||||||
// - newName string
|
// - newName string
|
||||||
// - ts uint64
|
// - ts uint64
|
||||||
func (_e *IMetaTable_Expecter) RenameCollection(ctx interface{}, oldName interface{}, newName interface{}, ts interface{}) *IMetaTable_RenameCollection_Call {
|
func (_e *IMetaTable_Expecter) RenameCollection(ctx interface{}, oldName interface{}, newName interface{}, ts interface{}) *IMetaTable_RenameCollection_Call {
|
||||||
return &IMetaTable_RenameCollection_Call{Call: _e.mock.On("RenameCollection", ctx, oldName, newName, ts)}
|
return &IMetaTable_RenameCollection_Call{Call: _e.mock.On("RenameCollection", ctx, oldName, newName, ts)}
|
||||||
}
|
}
|
||||||
@ -1415,8 +1415,8 @@ type IMetaTable_SelectGrant_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SelectGrant is a helper method to define mock.On call
|
// SelectGrant is a helper method to define mock.On call
|
||||||
// - tenant string
|
// - tenant string
|
||||||
// - entity *milvuspb.GrantEntity
|
// - entity *milvuspb.GrantEntity
|
||||||
func (_e *IMetaTable_Expecter) SelectGrant(tenant interface{}, entity interface{}) *IMetaTable_SelectGrant_Call {
|
func (_e *IMetaTable_Expecter) SelectGrant(tenant interface{}, entity interface{}) *IMetaTable_SelectGrant_Call {
|
||||||
return &IMetaTable_SelectGrant_Call{Call: _e.mock.On("SelectGrant", tenant, entity)}
|
return &IMetaTable_SelectGrant_Call{Call: _e.mock.On("SelectGrant", tenant, entity)}
|
||||||
}
|
}
|
||||||
@ -1462,9 +1462,9 @@ type IMetaTable_SelectRole_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SelectRole is a helper method to define mock.On call
|
// SelectRole is a helper method to define mock.On call
|
||||||
// - tenant string
|
// - tenant string
|
||||||
// - entity *milvuspb.RoleEntity
|
// - entity *milvuspb.RoleEntity
|
||||||
// - includeUserInfo bool
|
// - includeUserInfo bool
|
||||||
func (_e *IMetaTable_Expecter) SelectRole(tenant interface{}, entity interface{}, includeUserInfo interface{}) *IMetaTable_SelectRole_Call {
|
func (_e *IMetaTable_Expecter) SelectRole(tenant interface{}, entity interface{}, includeUserInfo interface{}) *IMetaTable_SelectRole_Call {
|
||||||
return &IMetaTable_SelectRole_Call{Call: _e.mock.On("SelectRole", tenant, entity, includeUserInfo)}
|
return &IMetaTable_SelectRole_Call{Call: _e.mock.On("SelectRole", tenant, entity, includeUserInfo)}
|
||||||
}
|
}
|
||||||
@ -1510,9 +1510,9 @@ type IMetaTable_SelectUser_Call struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SelectUser is a helper method to define mock.On call
|
// SelectUser is a helper method to define mock.On call
|
||||||
// - tenant string
|
// - tenant string
|
||||||
// - entity *milvuspb.UserEntity
|
// - entity *milvuspb.UserEntity
|
||||||
// - includeRoleInfo bool
|
// - includeRoleInfo bool
|
||||||
func (_e *IMetaTable_Expecter) SelectUser(tenant interface{}, entity interface{}, includeRoleInfo interface{}) *IMetaTable_SelectUser_Call {
|
func (_e *IMetaTable_Expecter) SelectUser(tenant interface{}, entity interface{}, includeRoleInfo interface{}) *IMetaTable_SelectUser_Call {
|
||||||
return &IMetaTable_SelectUser_Call{Call: _e.mock.On("SelectUser", tenant, entity, includeRoleInfo)}
|
return &IMetaTable_SelectUser_Call{Call: _e.mock.On("SelectUser", tenant, entity, includeRoleInfo)}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// Code generated by mockery v2.14.0. DO NOT EDIT.
|
// Code generated by mockery v2.16.0. DO NOT EDIT.
|
||||||
|
|
||||||
package types
|
package types
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// Code generated by mockery v2.14.0. DO NOT EDIT.
|
// Code generated by mockery v2.16.0. DO NOT EDIT.
|
||||||
|
|
||||||
package types
|
package types
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user