enhance:Remove msgbase unnecessary assignments (#28511)

remove some unnecessary assignments, for the reason that
commonpbutil.NewMsgBase has default value.

Signed-off-by: lixinguo <xinguo.li@zilliz.com>
Co-authored-by: lixinguo <xinguo.li@zilliz.com>
pull/28804/head
smellthemoon 2023-11-24 15:02:39 +08:00 committed by GitHub
parent 824e278219
commit 79c0edb1d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 1 additions and 32 deletions

View File

@ -93,7 +93,6 @@ func (ia *IDAllocator) syncID() (bool, error) {
req := &rootcoordpb.AllocIDRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_RequestID),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(ia.PeerID),
),
Count: need,

View File

@ -53,7 +53,6 @@ func (alloc *rootCoordAllocator) allocTimestamp(ctx context.Context) (Timestamp,
resp, err := alloc.AllocTimestamp(ctx, &rootcoordpb.AllocTimestampRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_RequestTSO),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
),
Count: 1,
@ -69,7 +68,6 @@ func (alloc *rootCoordAllocator) allocID(ctx context.Context) (UniqueID, error)
resp, err := alloc.AllocID(ctx, &rootcoordpb.AllocIDRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_RequestID),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
),
Count: 1,

View File

@ -76,7 +76,6 @@ func (b *CoordinatorBroker) ShowPartitionsInternal(ctx context.Context, collecti
resp, err := b.rootCoord.ShowPartitionsInternal(ctx, &milvuspb.ShowPartitionsRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_ShowPartitions),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
),
// please do not specify the collection name alone after database feature.

View File

@ -68,7 +68,6 @@ func (dc *dataCoordBroker) GetSegmentInfo(ctx context.Context, segmentIDs []int6
infoResp, err := dc.client.GetSegmentInfo(ctx, &datapb.GetSegmentInfoRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_SegmentInfo),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
),
SegmentIDs: segmentIDs,

View File

@ -712,8 +712,6 @@ func saveSegmentFunc(node *DataNode, req *datapb.ImportTaskRequest, res *rootcoo
RowNum: rowCount,
SaveBinlogPathReq: &datapb.SaveBinlogPathsRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(0),
commonpbutil.WithMsgID(0),
commonpbutil.WithTimeStamp(ts),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
),

View File

@ -62,7 +62,6 @@ func (u *mqStatsUpdater) send(ts Timestamp, segmentIDs []int64) error {
DataNodeTtMsg: msgpb.DataNodeTtMsg{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_DataNodeTt),
commonpbutil.WithMsgID(0),
commonpbutil.WithTimeStamp(ts),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
),

View File

@ -167,8 +167,6 @@ func (b *brokerMetaWriter) UpdateSyncV2(pack *SyncTaskV2) error {
req := &datapb.SaveBinlogPathsRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(0),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
),
SegmentID: pack.segmentID,
@ -218,8 +216,6 @@ func (b *brokerMetaWriter) DropChannel(channelName string) error {
err := retry.Do(context.Background(), func() error {
status, err := b.broker.DropVirtualChannel(context.Background(), &datapb.DropVirtualChannelRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(0), // TODO msg type
commonpbutil.WithMsgID(0), // TODO msg id
commonpbutil.WithSourceID(paramtable.GetNodeID()),
),
ChannelName: channelName,

View File

@ -1608,7 +1608,6 @@ func (node *Proxy) GetLoadingProgress(ctx context.Context, request *milvuspb.Get
msgBase := commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_SystemInfo),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
)
if request.Base == nil {
@ -1695,7 +1694,6 @@ func (node *Proxy) GetLoadState(ctx context.Context, request *milvuspb.GetLoadSt
msgBase := commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_SystemInfo),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
)
if request.Base == nil {
@ -2223,7 +2221,6 @@ func (node *Proxy) Insert(ctx context.Context, request *milvuspb.InsertRequest)
InsertRequest: msgpb.InsertRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_Insert),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
),
DbName: request.GetDbName(),
@ -3283,7 +3280,6 @@ func (node *Proxy) GetPersistentSegmentInfo(ctx context.Context, req *milvuspb.G
infoResp, err := node.dataCoord.GetSegmentInfo(ctx, &datapb.GetSegmentInfoRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_SegmentInfo),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
),
SegmentIDs: getSegmentsByStatesResponse.Segments,
@ -3357,7 +3353,6 @@ func (node *Proxy) GetQuerySegmentInfo(ctx context.Context, req *milvuspb.GetQue
infoResp, err := node.queryCoord.GetSegmentInfo(ctx, &querypb.GetSegmentInfoRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_SegmentInfo),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
),
CollectionID: collID,
@ -3508,7 +3503,6 @@ func (node *Proxy) GetMetrics(ctx context.Context, req *milvuspb.GetMetricsReque
req.Base = commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_SystemInfo),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
)
if metricType == metricsinfo.SystemInfoMetrics {
@ -3570,7 +3564,6 @@ func (node *Proxy) GetProxyMetrics(ctx context.Context, req *milvuspb.GetMetrics
req.Base = commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_SystemInfo),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
)
@ -3627,7 +3620,6 @@ func (node *Proxy) LoadBalance(ctx context.Context, req *milvuspb.LoadBalanceReq
infoResp, err := node.queryCoord.LoadBalance(ctx, &querypb.LoadBalanceRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_LoadBalanceSegments),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
),
SourceNodeIDs: []int64{req.SrcNodeID},
@ -4578,7 +4570,6 @@ func (node *Proxy) RenameCollection(ctx context.Context, req *milvuspb.RenameCol
req.Base = commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_RenameCollection),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(paramtable.GetNodeID()),
)
resp, err := node.rootCoord.RenameCollection(ctx, req)

View File

@ -1241,7 +1241,6 @@ func TestProxy_ReplicateMessage(t *testing.T) {
timeTickResult := msgpb.TimeTickMsg{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType(-1)),
commonpbutil.WithMsgID(0),
commonpbutil.WithTimeStamp(10),
commonpbutil.WithSourceID(-1),
),

View File

@ -338,8 +338,7 @@ func (node *Proxy) sendChannelsTimeTickLoop() {
req := &internalpb.ChannelTimeTickMsg{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_TimeTick), // todo
commonpbutil.WithMsgID(0), // todo
commonpbutil.WithMsgType(commonpb.MsgType_TimeTick),
commonpbutil.WithSourceID(node.session.ServerID),
),
ChannelNames: channels,

View File

@ -52,7 +52,6 @@ func (ta *timestampAllocator) alloc(ctx context.Context, count uint32) ([]Timest
req := &rootcoordpb.AllocTimestampRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_RequestTSO),
commonpbutil.WithMsgID(0),
commonpbutil.WithSourceID(ta.peerID),
),
Count: count,

View File

@ -70,8 +70,6 @@ func (c *Core) ExpireMetaCache(ctx context.Context, dbName string, collNames []s
for _, collName := range collNames {
req := proxypb.InvalidateCollMetaCacheRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(0), // TODO, msg type
commonpbutil.WithMsgID(0), // TODO, msg id
commonpbutil.WithTimeStamp(ts),
commonpbutil.WithSourceID(c.session.ServerID),
),

View File

@ -2031,8 +2031,6 @@ func (c *Core) ReportImport(ctx context.Context, ir *rootcoordpb.ImportResult) (
func (c *Core) ExpireCredCache(ctx context.Context, username string) error {
req := proxypb.InvalidateCredCacheRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(0), // TODO, msg type
commonpbutil.WithMsgID(0), // TODO, msg id
commonpbutil.WithSourceID(c.session.ServerID),
),
Username: username,
@ -2044,8 +2042,6 @@ func (c *Core) ExpireCredCache(ctx context.Context, username string) error {
func (c *Core) UpdateCredCache(ctx context.Context, credInfo *internalpb.CredentialInfo) error {
req := proxypb.UpdateCredCacheRequest{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(0), // TODO, msg type
commonpbutil.WithMsgID(0), // TODO, msg id
commonpbutil.WithSourceID(c.session.ServerID),
),
Username: credInfo.Username,

View File

@ -330,7 +330,6 @@ func (t *timetickSync) sendTimeTickToChannel(chanNames []string, ts typeutil.Tim
timeTickResult := msgpb.TimeTickMsg{
Base: commonpbutil.NewMsgBase(
commonpbutil.WithMsgType(commonpb.MsgType_TimeTick),
commonpbutil.WithMsgID(0),
commonpbutil.WithTimeStamp(ts),
commonpbutil.WithSourceID(t.sourceID),
),