fix: Set result storage version for sort compaction (#43521)

issue: #43520

Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
This commit is contained in:
cai.zhang 2025-07-23 19:04:53 +08:00 committed by GitHub
parent d64dceea47
commit 74c08069ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

View File

@ -2126,7 +2126,6 @@ func (m *meta) completeSortCompactionMutation(
StartPosition: oldSegment.GetStartPosition(),
DmlPosition: oldSegment.GetDmlPosition(),
IsImporting: oldSegment.GetIsImporting(),
StorageVersion: oldSegment.GetStorageVersion(),
State: oldSegment.GetState(),
Level: oldSegment.GetLevel(),
LastLevel: oldSegment.GetLastLevel(),
@ -2134,6 +2133,7 @@ func (m *meta) completeSortCompactionMutation(
LastPartitionStatsVersion: oldSegment.GetLastPartitionStatsVersion(),
CreatedByCompaction: oldSegment.GetCreatedByCompaction(),
IsInvisible: resultInvisible,
StorageVersion: resultSegment.GetStorageVersion(),
ID: resultSegment.GetSegmentID(),
NumOfRows: resultSegment.GetNumOfRows(),
Binlogs: resultSegment.GetInsertLogs(),

View File

@ -40,6 +40,7 @@ import (
mocks2 "github.com/milvus-io/milvus/internal/metastore/mocks"
"github.com/milvus-io/milvus/internal/metastore/model"
"github.com/milvus-io/milvus/internal/mocks"
"github.com/milvus-io/milvus/internal/storage"
"github.com/milvus-io/milvus/pkg/v2/common"
"github.com/milvus-io/milvus/pkg/v2/kv"
"github.com/milvus-io/milvus/pkg/v2/metrics"
@ -439,8 +440,9 @@ func (suite *MetaBasicSuite) TestCompleteCompactionMutation() {
Binlogs: []*datapb.FieldBinlog{getFieldBinlogIDs(0, 10000, 10001)},
Statslogs: []*datapb.FieldBinlog{getFieldBinlogIDs(0, 20000, 20001)},
// latest segment has 2 deltalogs, one submit for compaction, one is appended before compaction done
Deltalogs: []*datapb.FieldBinlog{getFieldBinlogIDs(0, 30000), getFieldBinlogIDs(0, 30001)},
NumOfRows: 2,
Deltalogs: []*datapb.FieldBinlog{getFieldBinlogIDs(0, 30000), getFieldBinlogIDs(0, 30001)},
NumOfRows: 2,
StorageVersion: storage.StorageV1,
}},
} {
latestSegments.SetSegment(segID, segment)
@ -455,6 +457,7 @@ func (suite *MetaBasicSuite) TestCompleteCompactionMutation() {
InsertLogs: []*datapb.FieldBinlog{getFieldBinlogIDs(0, 50000)},
Field2StatslogPaths: []*datapb.FieldBinlog{getFieldBinlogIDs(0, 50001)},
NumOfRows: 2,
StorageVersion: storage.StorageV2,
}
result := &datapb.CompactionPlanResult{
@ -482,6 +485,7 @@ func (suite *MetaBasicSuite) TestCompleteCompactionMutation() {
suite.EqualValues(2, info.GetID())
suite.Equal(datapb.SegmentLevel_L2, info.GetLevel())
suite.Equal(commonpb.SegmentState_Flushed, info.GetState())
suite.Equal(storage.StorageV2, info.GetStorageVersion())
binlogs := info.GetBinlogs()
for _, fbinlog := range binlogs {