mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-02 20:09:57 +08:00
6130a85444
Remove bf from streaming node: 1. When watching vchannels, skip loading bloom filters for segments. 2. Bypass bloom filter checks for delete messages, directly writing to L0 segments. 3. Remove flushed segments proactively after flush. issue: https://github.com/milvus-io/milvus/issues/33285, https://github.com/milvus-io/milvus/issues/34585 --------- Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package syncmgr
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/msgpb"
|
|
"github.com/milvus-io/milvus/pkg/util/conc"
|
|
"github.com/milvus-io/milvus/pkg/util/lock"
|
|
)
|
|
|
|
type Task interface {
|
|
SegmentID() int64
|
|
Checkpoint() *msgpb.MsgPosition
|
|
StartPosition() *msgpb.MsgPosition
|
|
ChannelName() string
|
|
Run(context.Context) error
|
|
HandleError(error)
|
|
IsFlush() bool
|
|
}
|
|
|
|
type keyLockDispatcher[K comparable] struct {
|
|
keyLock *lock.KeyLock[K]
|
|
workerPool *conc.Pool[struct{}]
|
|
}
|
|
|
|
func newKeyLockDispatcher[K comparable](maxParallel int) *keyLockDispatcher[K] {
|
|
dispatcher := &keyLockDispatcher[K]{
|
|
workerPool: conc.NewPool[struct{}](maxParallel, conc.WithPreAlloc(false)),
|
|
keyLock: lock.NewKeyLock[K](),
|
|
}
|
|
return dispatcher
|
|
}
|
|
|
|
func (d *keyLockDispatcher[K]) Submit(ctx context.Context, key K, t Task, callbacks ...func(error) error) *conc.Future[struct{}] {
|
|
d.keyLock.Lock(key)
|
|
|
|
return d.workerPool.Submit(func() (struct{}, error) {
|
|
defer d.keyLock.Unlock(key)
|
|
err := t.Run(ctx)
|
|
|
|
for _, callback := range callbacks {
|
|
err = callback(err)
|
|
}
|
|
|
|
return struct{}{}, err
|
|
})
|
|
}
|