Skip to content

Commit

Permalink
enhance: change message position print
Browse files Browse the repository at this point in the history
Signed-off-by: xiaofanluan <[email protected]>
  • Loading branch information
xiaofan-luan committed Sep 30, 2024
1 parent bd79106 commit 08cd89b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/mq/msgstream/mq_msgstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ func (ms *MqTtMsgStream) Seek(ctx context.Context, msgPositions []*MsgPosition,
zap.Int64("source", tsMsg.SourceID()),
zap.String("type", tsMsg.Type().String()),
zap.Int("size", tsMsg.Size()),
zap.Any("position", tsMsg.Position()),
zap.String("position", MsgPositionToString(tsMsg.Position())),
)
}
}
Expand Down
11 changes: 11 additions & 0 deletions pkg/mq/msgstream/msgstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package msgstream

import (
"context"
"fmt"

"github.com/milvus-io/milvus-proto/go-api/v2/msgpb"
"github.com/milvus-io/milvus/pkg/mq/common"
Expand Down Expand Up @@ -48,6 +49,16 @@ type MsgPack struct {
EndPositions []*MsgPosition
}

func MsgPositionToString(m *MsgPosition) string {
return fmt.Sprintf(
"MsgPosition{ChannelName: %s, MsgID: %x, MsgGroup: %s, Timestamp: %d}",
m.ChannelName,
m.MsgID,
m.MsgGroup,
m.Timestamp,
)
}

// RepackFunc is a function type which used to repack message after hash by primary key
type RepackFunc func(msgs []TsMsg, hashKeys [][]int32) (map[int32]*MsgPack, error)

Expand Down

0 comments on commit 08cd89b

Please sign in to comment.