Zhen Ye 3dd9a1147b
enhance: add lock interceptor and recoverable txn manager (#41640)
issue: #41544

- add a lock interceptor at vchannel granularity.
- make txn manager recoverable and add FailTxnAtVChannel operation.

Signed-off-by: chyezh <chyezh@outlook.com>
2025-05-09 11:14:53 +08:00

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),
}
}