Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Zero flushReq metric for all sealed segs #32404

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions internal/datanode/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,13 @@

func (node *DataNode) FlushSegments(ctx context.Context, req *datapb.FlushSegmentsRequest) (*commonpb.Status, error) {
serverID := node.GetNodeID()
metrics.DataNodeFlushReqCounter.WithLabelValues(fmt.Sprint(serverID), metrics.TotalLabel).Inc()

log := log.Ctx(ctx).With(
zap.Int64("nodeID", serverID),
zap.Int64("collectionID", req.GetCollectionID()),
zap.String("channelName", req.GetChannelName()),
zap.Int64s("segmentIDs", req.GetSegmentIDs()),
)
log.Info("receive FlushSegments request")

if err := merr.CheckHealthy(node.GetStateCode()); err != nil {
log.Warn("failed to FlushSegments", zap.Error(err))
return merr.Status(err), nil
Expand All @@ -101,8 +98,6 @@
}

log.Info("success to FlushSegments")

metrics.DataNodeFlushReqCounter.WithLabelValues(fmt.Sprint(serverID), metrics.SuccessLabel).Inc()
return merr.Success(), nil
}

Expand Down Expand Up @@ -371,12 +366,13 @@
}

func (node *DataNode) FlushChannels(ctx context.Context, req *datapb.FlushChannelsRequest) (*commonpb.Status, error) {
metrics.DataNodeFlushReqCounter.WithLabelValues(fmt.Sprint(node.GetNodeID()), metrics.TotalLabel).Inc()
log := log.Ctx(ctx).With(zap.Int64("nodeId", node.GetNodeID()),
zap.Time("flushTs", tsoutil.PhysicalTime(req.GetFlushTs())),
zap.Uint64("flushTs", req.GetFlushTs()),
zap.Time("flushTs in Time", tsoutil.PhysicalTime(req.GetFlushTs())),
zap.Strings("channels", req.GetChannels()))

log.Info("DataNode receives FlushChannels request")

if err := merr.CheckHealthy(node.GetStateCode()); err != nil {
log.Warn("DataNode.FlushChannels failed", zap.Error(err))
return merr.Status(err), nil
Expand All @@ -385,11 +381,13 @@
for _, channel := range req.GetChannels() {
err := node.writeBufferManager.FlushChannel(ctx, channel, req.GetFlushTs())
if err != nil {
log.Warn("failed to flush channel", zap.String("channel", channel), zap.Error(err))
log.Warn("WriteBufferManager failed to flush channel", zap.String("channel", channel), zap.Error(err))

Check warning on line 384 in internal/datanode/services.go

View check run for this annotation

Codecov / codecov/patch

internal/datanode/services.go#L384

Added line #L384 was not covered by tests
return merr.Status(err), nil
}
}

metrics.DataNodeFlushReqCounter.WithLabelValues(fmt.Sprint(node.GetNodeID()), metrics.SuccessLabel).Inc()
log.Info("success to FlushChannels")
return merr.Success(), nil
}

Expand Down
Loading