Zhen Ye 19e5e9f910
enhance: broadcaster will lock resource until message acked (#44508)
issue: #43897

- Return LastConfirmedMessageID when wal append operation.
- Add resource-key-based locker for broadcast-ack operation to protect
the coord state when executing ddl.
- Resource-key-based locker is held until the broadcast operation is
acked.
- ResourceKey support shared and exclusive lock.
- Add FastAck execute ack right away after the broadcast done to speed
up ddl.
- Ack callback will support broadcast message result now.
- Add tombstone for broadcaster to avoid to repeatedly commit DDL and
ABA issue.

---------

Signed-off-by: chyezh <chyezh@outlook.com>
2025-09-24 20:58:05 +08:00

28 lines
682 B
Go

package broadcaster
import (
"context"
"github.com/milvus-io/milvus/pkg/v2/streaming/util/message"
"github.com/milvus-io/milvus/pkg/v2/streaming/util/types"
)
type broadcasterWithRK struct {
broadcaster *broadcastTaskManager
broadcastID uint64
guards *lockGuards
}
func (b *broadcasterWithRK) Broadcast(ctx context.Context, msg message.BroadcastMutableMessage) (*types.BroadcastAppendResult, error) {
// consume the guards after the broadcast is called to avoid double unlock.
guards := b.guards
b.guards = nil
return b.broadcaster.broadcast(ctx, msg, b.broadcastID, guards)
}
func (b *broadcasterWithRK) Close() {
if b.guards != nil {
b.guards.Unlock()
}
}