mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 01:58:34 +08:00
fix: bm25 import segment without bm25 stats meta (#38855)
relate: https://github.com/milvus-io/milvus/issues/38854 Signed-off-by: aoiasd <zhicheng.yue@zilliz.com>
This commit is contained in:
parent
341d6c1eb7
commit
9cb4c4e8ac
@ -314,13 +314,13 @@ func (s *importScheduler) processInProgressImport(task ImportTask) {
|
|||||||
if resp.GetState() == datapb.ImportTaskStateV2_Completed {
|
if resp.GetState() == datapb.ImportTaskStateV2_Completed {
|
||||||
for _, info := range resp.GetImportSegmentsInfo() {
|
for _, info := range resp.GetImportSegmentsInfo() {
|
||||||
// try to parse path and fill logID
|
// try to parse path and fill logID
|
||||||
err = binlog.CompressBinLogs(info.GetBinlogs(), info.GetDeltalogs(), info.GetStatslogs())
|
err = binlog.CompressBinLogs(info.GetBinlogs(), info.GetDeltalogs(), info.GetStatslogs(), info.GetBm25Logs())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn("fail to CompressBinLogs for import binlogs",
|
log.Warn("fail to CompressBinLogs for import binlogs",
|
||||||
WrapTaskLog(task, zap.Int64("segmentID", info.GetSegmentID()), zap.Error(err))...)
|
WrapTaskLog(task, zap.Int64("segmentID", info.GetSegmentID()), zap.Error(err))...)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
op1 := UpdateBinlogsOperator(info.GetSegmentID(), info.GetBinlogs(), info.GetStatslogs(), info.GetDeltalogs())
|
op1 := UpdateBinlogsOperator(info.GetSegmentID(), info.GetBinlogs(), info.GetStatslogs(), info.GetDeltalogs(), info.GetBm25Logs())
|
||||||
op2 := UpdateStatusOperator(info.GetSegmentID(), commonpb.SegmentState_Flushed)
|
op2 := UpdateStatusOperator(info.GetSegmentID(), commonpb.SegmentState_Flushed)
|
||||||
err = s.meta.UpdateSegmentsInfo(context.TODO(), op1, op2)
|
err = s.meta.UpdateSegmentsInfo(context.TODO(), op1, op2)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -919,7 +919,7 @@ func AddBinlogsOperator(segmentID int64, binlogs, statslogs, deltalogs, bm25logs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func UpdateBinlogsOperator(segmentID int64, binlogs, statslogs, deltalogs []*datapb.FieldBinlog) UpdateOperator {
|
func UpdateBinlogsOperator(segmentID int64, binlogs, statslogs, deltalogs, bm25logs []*datapb.FieldBinlog) UpdateOperator {
|
||||||
return func(modPack *updateSegmentPack) bool {
|
return func(modPack *updateSegmentPack) bool {
|
||||||
segment := modPack.Get(segmentID)
|
segment := modPack.Get(segmentID)
|
||||||
if segment == nil {
|
if segment == nil {
|
||||||
@ -931,6 +931,7 @@ func UpdateBinlogsOperator(segmentID int64, binlogs, statslogs, deltalogs []*dat
|
|||||||
segment.Binlogs = binlogs
|
segment.Binlogs = binlogs
|
||||||
segment.Statslogs = statslogs
|
segment.Statslogs = statslogs
|
||||||
segment.Deltalogs = deltalogs
|
segment.Deltalogs = deltalogs
|
||||||
|
segment.Bm25Statslogs = bm25logs
|
||||||
modPack.increments[segmentID] = metastore.BinlogsIncrement{
|
modPack.increments[segmentID] = metastore.BinlogsIncrement{
|
||||||
Segment: segment.SegmentInfo,
|
Segment: segment.SegmentInfo,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -840,7 +840,7 @@ func TestUpdateSegmentsInfo(t *testing.T) {
|
|||||||
|
|
||||||
err = meta.UpdateSegmentsInfo(
|
err = meta.UpdateSegmentsInfo(
|
||||||
context.TODO(),
|
context.TODO(),
|
||||||
UpdateBinlogsOperator(1, nil, nil, nil),
|
UpdateBinlogsOperator(1, nil, nil, nil, nil),
|
||||||
)
|
)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
|||||||
@ -143,6 +143,7 @@ func UpdateSegmentInfo(info *datapb.ImportSegmentInfo) UpdateAction {
|
|||||||
segmentsInfo[segment].Binlogs = mergeFn(segmentsInfo[segment].Binlogs, info.GetBinlogs())
|
segmentsInfo[segment].Binlogs = mergeFn(segmentsInfo[segment].Binlogs, info.GetBinlogs())
|
||||||
segmentsInfo[segment].Statslogs = mergeFn(segmentsInfo[segment].Statslogs, info.GetStatslogs())
|
segmentsInfo[segment].Statslogs = mergeFn(segmentsInfo[segment].Statslogs, info.GetStatslogs())
|
||||||
segmentsInfo[segment].Deltalogs = mergeFn(segmentsInfo[segment].Deltalogs, info.GetDeltalogs())
|
segmentsInfo[segment].Deltalogs = mergeFn(segmentsInfo[segment].Deltalogs, info.GetDeltalogs())
|
||||||
|
segmentsInfo[segment].Bm25Logs = mergeFn(segmentsInfo[segment].Bm25Logs, info.GetBm25Logs())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
segmentsInfo[segment] = info
|
segmentsInfo[segment] = info
|
||||||
|
|||||||
@ -105,7 +105,7 @@ func NewSyncTask(ctx context.Context,
|
|||||||
|
|
||||||
func NewImportSegmentInfo(syncTask syncmgr.Task, metaCaches map[string]metacache.MetaCache) (*datapb.ImportSegmentInfo, error) {
|
func NewImportSegmentInfo(syncTask syncmgr.Task, metaCaches map[string]metacache.MetaCache) (*datapb.ImportSegmentInfo, error) {
|
||||||
segmentID := syncTask.SegmentID()
|
segmentID := syncTask.SegmentID()
|
||||||
insertBinlogs, statsBinlog, deltaLog := syncTask.(*syncmgr.SyncTask).Binlogs()
|
insertBinlogs, statsBinlog, deltaLog, bm25Log := syncTask.(*syncmgr.SyncTask).Binlogs()
|
||||||
metaCache := metaCaches[syncTask.ChannelName()]
|
metaCache := metaCaches[syncTask.ChannelName()]
|
||||||
segment, ok := metaCache.GetSegmentByID(segmentID)
|
segment, ok := metaCache.GetSegmentByID(segmentID)
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -120,6 +120,7 @@ func NewImportSegmentInfo(syncTask syncmgr.Task, metaCaches map[string]metacache
|
|||||||
ImportedRows: segment.FlushedRows(),
|
ImportedRows: segment.FlushedRows(),
|
||||||
Binlogs: lo.Values(insertBinlogs),
|
Binlogs: lo.Values(insertBinlogs),
|
||||||
Statslogs: lo.Values(statsBinlog),
|
Statslogs: lo.Values(statsBinlog),
|
||||||
|
Bm25Logs: lo.Values(bm25Log),
|
||||||
Deltalogs: deltaLogs,
|
Deltalogs: deltaLogs,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -414,8 +414,8 @@ func (t *SyncTask) IsFlush() bool {
|
|||||||
return t.isFlush
|
return t.isFlush
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *SyncTask) Binlogs() (map[int64]*datapb.FieldBinlog, map[int64]*datapb.FieldBinlog, *datapb.FieldBinlog) {
|
func (t *SyncTask) Binlogs() (map[int64]*datapb.FieldBinlog, map[int64]*datapb.FieldBinlog, *datapb.FieldBinlog, map[int64]*datapb.FieldBinlog) {
|
||||||
return t.insertBinlogs, t.statsBinlogs, t.deltaBinlog
|
return t.insertBinlogs, t.statsBinlogs, t.deltaBinlog, t.bm25Binlogs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *SyncTask) MarshalJSON() ([]byte, error) {
|
func (t *SyncTask) MarshalJSON() ([]byte, error) {
|
||||||
|
|||||||
@ -131,7 +131,7 @@ func (c *channelLifetime) Run() error {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if tt, ok := t.(*syncmgr.SyncTask); ok {
|
if tt, ok := t.(*syncmgr.SyncTask); ok {
|
||||||
insertLogs, _, _ := tt.Binlogs()
|
insertLogs, _, _, _ := tt.Binlogs()
|
||||||
resource.Resource().SegmentAssignStatsManager().UpdateOnSync(tt.SegmentID(), stats.SyncOperationMetrics{
|
resource.Resource().SegmentAssignStatsManager().UpdateOnSync(tt.SegmentID(), stats.SyncOperationMetrics{
|
||||||
BinLogCounterIncr: 1,
|
BinLogCounterIncr: 1,
|
||||||
BinLogFileCounterIncr: uint64(len(insertLogs)),
|
BinLogFileCounterIncr: uint64(len(insertLogs)),
|
||||||
|
|||||||
@ -850,6 +850,7 @@ message ImportSegmentInfo {
|
|||||||
repeated FieldBinlog binlogs = 3;
|
repeated FieldBinlog binlogs = 3;
|
||||||
repeated FieldBinlog statslogs = 4;
|
repeated FieldBinlog statslogs = 4;
|
||||||
repeated FieldBinlog deltalogs = 5;
|
repeated FieldBinlog deltalogs = 5;
|
||||||
|
repeated FieldBinlog bm25logs = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message QueryImportResponse {
|
message QueryImportResponse {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user