Fix compaction produces empty segment (#19936)

Signed-off-by: yah01 <yang.cen@zilliz.com>

Signed-off-by: yah01 <yang.cen@zilliz.com>
pull/19912/head
yah01 2022-10-20 22:49:28 +08:00 committed by GitHub
parent 5350b4aef5
commit e8ca754dca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -255,9 +255,13 @@ func (c *compactionPlanHandler) handleMergeCompactionResult(plan *datapb.Compact
}
log.Debug("handleCompactionResult: altering metastore after compaction")
if err := c.meta.alterMetaStoreAfterCompaction(modInfos, newSegment.SegmentInfo); err != nil {
log.Warn("handleCompactionResult: fail to alter metastore after compaction", zap.Error(err))
return fmt.Errorf("fail to alter metastore after compaction, err=%w", err)
if newSegment.GetNumOfRows() > 0 {
if err := c.meta.alterMetaStoreAfterCompaction(modInfos, newSegment.SegmentInfo); err != nil {
log.Warn("handleCompactionResult: fail to alter metastore after compaction", zap.Error(err))
return fmt.Errorf("fail to alter metastore after compaction, err=%w", err)
}
} else {
log.Warn("compaction produced an empty segment")
}
var nodeID = c.plans[plan.GetPlanID()].dataNodeID