From 2180e2cfaeb22028d98f6d0b7a5dc8dc6c894e98 Mon Sep 17 00:00:00 2001 From: aoiasd <45024769+aoiasd@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:09:01 +0800 Subject: [PATCH] fix: wrong segment binlog path cause load segment failed #30726 (#30959) DataCoord GetSegmentInfo should return binlog info with logpath instead logid when segment merge child segment's binlog. relate: https://github.com/milvus-io/milvus/issues/30366 https://github.com/milvus-io/milvus/issues/30165 https://github.com/milvus-io/milvus/issues/30550 Signed-off-by: aoiasd --- internal/datacoord/services.go | 2 ++ internal/datacoord/services_test.go | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/internal/datacoord/services.go b/internal/datacoord/services.go index 21e2b3c1ef..0921d767d5 100644 --- a/internal/datacoord/services.go +++ b/internal/datacoord/services.go @@ -418,6 +418,8 @@ func (s *Server) GetSegmentInfo(ctx context.Context, req *datapb.GetSegmentInfoR child := s.meta.GetCompactionTo(id) clonedInfo := info.Clone() if child != nil { + // child segment should decompress binlog path + binlog.DecompressBinLog(storage.DeleteBinlog, child.GetCollectionID(), child.GetPartitionID(), child.GetID(), child.GetDeltalogs()) clonedInfo.Deltalogs = append(clonedInfo.Deltalogs, child.GetDeltalogs()...) clonedInfo.DmlPosition = child.GetDmlPosition() } diff --git a/internal/datacoord/services_test.go b/internal/datacoord/services_test.go index 2b31fd3d92..c7a87ee308 100644 --- a/internal/datacoord/services_test.go +++ b/internal/datacoord/services_test.go @@ -603,6 +603,32 @@ func (s *ServerSuite) TestGetSegmentInfoChannel() { s.EqualValues(Params.CommonCfg.DataCoordSegmentInfo.GetValue(), resp.Value) } +func (s *ServerSuite) TestGetSegmentInfo() { + testSegmentID := int64(1) + s.testServer.meta.AddSegment(context.TODO(), &SegmentInfo{ + SegmentInfo: &datapb.SegmentInfo{ + ID: 1, + Deltalogs: []*datapb.FieldBinlog{{FieldID: 100, Binlogs: []*datapb.Binlog{{LogID: 100}}}}, + }, + }) + + s.testServer.meta.AddSegment(context.TODO(), &SegmentInfo{ + SegmentInfo: &datapb.SegmentInfo{ + ID: 2, + Deltalogs: []*datapb.FieldBinlog{{FieldID: 100, Binlogs: []*datapb.Binlog{{LogID: 101}}}}, + CompactionFrom: []int64{1}, + }, + }) + + resp, err := s.testServer.GetSegmentInfo(context.TODO(), &datapb.GetSegmentInfoRequest{ + SegmentIDs: []int64{testSegmentID}, + IncludeUnHealthy: true, + }) + s.NoError(err) + log.Info("test--", zap.Any("resp", resp)) + s.EqualValues(2, len(resp.Infos[0].Deltalogs)) +} + func (s *ServerSuite) TestAssignSegmentID() { s.TearDownTest() const collID = 100