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: stats log lost after disable stats log loading on flush #36592

Merged
merged 1 commit into from
Sep 29, 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
41 changes: 17 additions & 24 deletions internal/flushcommon/pipeline/data_sync_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@
return dsService.metacache
}

func getMetaCacheForStreaming(initCtx context.Context, params *util.PipelineParams, info *datapb.ChannelWatchInfo, unflushed, flushed []*datapb.SegmentInfo) (metacache.MetaCache, error) {
return initMetaCache(initCtx, params.ChunkManager, info, nil, unflushed, flushed)
}

func getMetaCacheWithTickler(initCtx context.Context, params *util.PipelineParams, info *datapb.ChannelWatchInfo, tickler *util.Tickler, unflushed, flushed []*datapb.SegmentInfo) (metacache.MetaCache, error) {
tickler.SetTotal(int32(len(unflushed) + len(flushed)))
return initMetaCache(initCtx, params.ChunkManager, info, tickler, unflushed, flushed)
Expand Down Expand Up @@ -161,7 +165,7 @@
return nil, err
}
segmentPks.Insert(segment.GetID(), pkoracle.NewBloomFilterSet(stats...))
if !streamingutil.IsStreamingServiceEnabled() {
if tickler != nil {
tickler.Inc()
}

Expand All @@ -180,8 +184,11 @@
}
}

// growing segments's stats should always be loaded, for generating merged pk bf.
loadSegmentStats("growing", unflushed)
loadSegmentStats("sealed", flushed)
if !(streamingutil.IsStreamingServiceEnabled() || paramtable.Get().DataNodeCfg.SkipBFStatsLoad.GetAsBool()) {
loadSegmentStats("sealed", flushed)

Check warning on line 190 in internal/flushcommon/pipeline/data_sync_service.go

View check run for this annotation

Codecov / codecov/patch

internal/flushcommon/pipeline/data_sync_service.go#L190

Added line #L190 was not covered by tests
}

// use fetched segment info
info.Vchan.FlushedSegments = flushed
Expand Down Expand Up @@ -344,29 +351,18 @@
}
}

if paramtable.Get().DataNodeCfg.SkipBFStatsLoad.GetAsBool() {
// In SkipBFStatsLoad mode, flushed segments no longer maintain a bloom filter.
// So, here we skip loading the bloom filter for flushed segments.
info.Vchan.FlushedSegments = flushedSegmentInfos
info.Vchan.UnflushedSegments = unflushedSegmentInfos
metaCache = metacache.NewMetaCache(info, func(segment *datapb.SegmentInfo) pkoracle.PkStat {
return pkoracle.NewBloomFilterSet()
}, metacache.NoneBm25StatsFactory)
} else {
// init metaCache meta
metaCache, err = getMetaCacheWithTickler(initCtx, pipelineParams, info, tickler, unflushedSegmentInfos, flushedSegmentInfos)
if err != nil {
return nil, err
}
// init metaCache meta
if metaCache, err = getMetaCacheWithTickler(initCtx, pipelineParams, info, tickler, unflushedSegmentInfos, flushedSegmentInfos); err != nil {
return nil, err

Check warning on line 356 in internal/flushcommon/pipeline/data_sync_service.go

View check run for this annotation

Codecov / codecov/patch

internal/flushcommon/pipeline/data_sync_service.go#L356

Added line #L356 was not covered by tests
}

return getServiceWithChannel(initCtx, pipelineParams, info, metaCache, unflushedSegmentInfos, flushedSegmentInfos, nil)
}

func NewStreamingNodeDataSyncService(initCtx context.Context, pipelineParams *util.PipelineParams, info *datapb.ChannelWatchInfo, input <-chan *msgstream.MsgPack) (*DataSyncService, error) {
// recover segment checkpoints
var (
err error
metaCache metacache.MetaCache
unflushedSegmentInfos []*datapb.SegmentInfo
flushedSegmentInfos []*datapb.SegmentInfo
)
Expand All @@ -383,13 +379,10 @@
}
}

// In streaming service mode, flushed segments no longer maintain a bloom filter.
// So, here we skip loading the bloom filter for flushed segments.
info.Vchan.UnflushedSegments = unflushedSegmentInfos
metaCache := metacache.NewMetaCache(info, func(segment *datapb.SegmentInfo) pkoracle.PkStat {
return pkoracle.NewBloomFilterSet()
}, metacache.NoneBm25StatsFactory)

// init metaCache meta
if metaCache, err = getMetaCacheForStreaming(initCtx, pipelineParams, info, unflushedSegmentInfos, flushedSegmentInfos); err != nil {
return nil, err

Check warning on line 384 in internal/flushcommon/pipeline/data_sync_service.go

View check run for this annotation

Codecov / codecov/patch

internal/flushcommon/pipeline/data_sync_service.go#L384

Added line #L384 was not covered by tests
}
return getServiceWithChannel(initCtx, pipelineParams, info, metaCache, unflushedSegmentInfos, flushedSegmentInfos, input)
}

Expand Down
Loading