mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
issue: #41544 - add a lock interceptor at vchannel granularity. - make txn manager recoverable and add FailTxnAtVChannel operation. Signed-off-by: chyezh <chyezh@outlook.com>
33 lines
1.2 KiB
Go
33 lines
1.2 KiB
Go
package timetick
|
|
|
|
import (
|
|
"github.com/milvus-io/milvus/internal/streamingnode/server/resource"
|
|
"github.com/milvus-io/milvus/internal/streamingnode/server/wal/interceptors"
|
|
"github.com/milvus-io/milvus/internal/streamingnode/server/wal/interceptors/txn"
|
|
)
|
|
|
|
var _ interceptors.InterceptorBuilder = (*interceptorBuilder)(nil)
|
|
|
|
// NewInterceptorBuilder creates a new interceptor builder.
|
|
// 1. Add timetick to all message before append to wal.
|
|
// 2. Collect timetick info, and generate sync-timetick message to wal.
|
|
func NewInterceptorBuilder() interceptors.InterceptorBuilder {
|
|
return &interceptorBuilder{}
|
|
}
|
|
|
|
// interceptorBuilder is a builder to build timeTickAppendInterceptor.
|
|
type interceptorBuilder struct{}
|
|
|
|
// Build implements Builder.
|
|
func (b *interceptorBuilder) Build(param *interceptors.InterceptorBuildParam) interceptors.Interceptor {
|
|
operator := newTimeTickSyncOperator(param)
|
|
// initialize operation can be async to avoid block the build operation.
|
|
resource.Resource().TimeTickInspector().RegisterSyncOperator(operator)
|
|
|
|
return &timeTickAppendInterceptor{
|
|
operator: operator,
|
|
// TODO: it's just a placeholder, should be replaced after recovery storage is merged.
|
|
txnManager: txn.NewTxnManager(param.ChannelInfo, nil),
|
|
}
|
|
}
|