Skip to content

Commit

Permalink
enhance: Rename preAllocatedSegments (#35871)
Browse files Browse the repository at this point in the history
Rename `preAllocatedSegments` to `preAllocatedSegmentIDs` to avoid
confusion.

Signed-off-by: bigsheeper <[email protected]>
  • Loading branch information
bigsheeper authored Sep 1, 2024
1 parent 2e090b2 commit 1413ffe
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion internal/datacoord/compaction_task_clustering.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (t *clusteringCompactionTask) BuildCompactionRequest() (*datapb.CompactionP
AnalyzeResultPath: path.Join(t.meta.(*meta).chunkManager.RootPath(), common.AnalyzeStatsPath, metautil.JoinIDPath(t.AnalyzeTaskID, t.AnalyzeVersion)),
AnalyzeSegmentIds: t.GetInputSegments(),
BeginLogID: beginLogID,
PreAllocatedSegments: &datapb.IDRange{
PreAllocatedSegmentIDs: &datapb.IDRange{
Begin: t.GetResultSegments()[0],
End: t.GetResultSegments()[1],
},
Expand Down
2 changes: 1 addition & 1 deletion internal/datacoord/compaction_task_mix.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func (t *mixCompactionTask) BuildCompactionRequest() (*datapb.CompactionPlan, er
TotalRows: t.GetTotalRows(),
Schema: t.GetSchema(),
BeginLogID: beginLogID,
PreAllocatedSegments: &datapb.IDRange{
PreAllocatedSegmentIDs: &datapb.IDRange{
Begin: t.GetResultSegments()[0],
End: t.GetResultSegments()[1],
},
Expand Down
16 changes: 8 additions & 8 deletions internal/datacoord/compaction_trigger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,14 +481,14 @@ func Test_compactionTrigger_force(t *testing.T) {
},
},
// StartTime: 0,
TimeoutInSeconds: Params.DataCoordCfg.CompactionTimeoutInSeconds.GetAsInt32(),
Type: datapb.CompactionType_MixCompaction,
Channel: "ch1",
TotalRows: 200,
Schema: schema,
PreAllocatedSegments: &datapb.IDRange{Begin: 100, End: 200},
SlotUsage: 8,
MaxSize: 1342177280,
TimeoutInSeconds: Params.DataCoordCfg.CompactionTimeoutInSeconds.GetAsInt32(),
Type: datapb.CompactionType_MixCompaction,
Channel: "ch1",
TotalRows: 200,
Schema: schema,
PreAllocatedSegmentIDs: &datapb.IDRange{Begin: 100, End: 200},
SlotUsage: 8,
MaxSize: 1342177280,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion internal/datanode/compaction/clustering_compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (t *clusteringCompactionTask) init() error {
t.partitionID = t.plan.GetSegmentBinlogs()[0].GetPartitionID()

logIDAlloc := allocator.NewLocalAllocator(t.plan.GetBeginLogID(), math.MaxInt64)
segIDAlloc := allocator.NewLocalAllocator(t.plan.GetPreAllocatedSegments().GetBegin(), t.plan.GetPreAllocatedSegments().GetEnd())
segIDAlloc := allocator.NewLocalAllocator(t.plan.GetPreAllocatedSegmentIDs().GetBegin(), t.plan.GetPreAllocatedSegmentIDs().GetEnd())
t.logIDAlloc = logIDAlloc
t.segIDAlloc = segIDAlloc

Expand Down
2 changes: 1 addition & 1 deletion internal/datanode/compaction/clustering_compactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (s *ClusteringCompactionTaskSuite) TestScalarCompactionNormal() {
s.task.plan.ClusteringKeyField = 100
s.task.plan.PreferSegmentRows = 2048
s.task.plan.MaxSegmentRows = 2048
s.task.plan.PreAllocatedSegments = &datapb.IDRange{
s.task.plan.PreAllocatedSegmentIDs = &datapb.IDRange{
Begin: time.Now().UnixMilli(),
End: time.Now().UnixMilli() + 1000,
}
Expand Down
2 changes: 1 addition & 1 deletion internal/datanode/compaction/mix_compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (t *mixCompactionTask) mergeSplit(

log := log.With(zap.Int64("planID", t.GetPlanID()))

segIDAlloc := allocator.NewLocalAllocator(t.plan.GetPreAllocatedSegments().GetBegin(), t.plan.GetPreAllocatedSegments().GetEnd())
segIDAlloc := allocator.NewLocalAllocator(t.plan.GetPreAllocatedSegmentIDs().GetBegin(), t.plan.GetPreAllocatedSegmentIDs().GetEnd())
logIDAlloc := allocator.NewLocalAllocator(t.plan.GetBeginLogID(), math.MaxInt64)
compAlloc := NewCompactionAllocator(segIDAlloc, logIDAlloc)
mWriter := NewMultiSegmentWriter(t.binlogIO, compAlloc, t.plan, t.maxRows, t.partitionID, t.collectionID)
Expand Down
12 changes: 6 additions & 6 deletions internal/datanode/compaction/mix_compactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ func (s *MixCompactionTaskSuite) SetupTest() {
Field2StatslogPaths: nil,
Deltalogs: nil,
}},
TimeoutInSeconds: 10,
Type: datapb.CompactionType_MixCompaction,
Schema: s.meta.GetSchema(),
BeginLogID: 19530,
PreAllocatedSegments: &datapb.IDRange{Begin: 19531, End: math.MaxInt64},
MaxSize: 64 * 1024 * 1024,
TimeoutInSeconds: 10,
Type: datapb.CompactionType_MixCompaction,
Schema: s.meta.GetSchema(),
BeginLogID: 19530,
PreAllocatedSegmentIDs: &datapb.IDRange{Begin: 19531, End: math.MaxInt64},
MaxSize: 64 * 1024 * 1024,
}

s.task = NewMixCompactionTask(context.Background(), s.mockBinlogIO, s.plan)
Expand Down
4 changes: 2 additions & 2 deletions internal/datanode/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func (node *DataNode) CompactionV2(ctx context.Context, req *datapb.CompactionPl
req,
)
case datapb.CompactionType_MixCompaction:
if req.GetPreAllocatedSegments() == nil || req.GetPreAllocatedSegments().GetBegin() == 0 {
if req.GetPreAllocatedSegmentIDs() == nil || req.GetPreAllocatedSegmentIDs().GetBegin() == 0 {
return merr.Status(merr.WrapErrParameterInvalidMsg("invalid pre-allocated segmentID range")), nil
}
task = compaction.NewMixCompactionTask(
Expand All @@ -243,7 +243,7 @@ func (node *DataNode) CompactionV2(ctx context.Context, req *datapb.CompactionPl
req,
)
case datapb.CompactionType_ClusteringCompaction:
if req.GetPreAllocatedSegments() == nil || req.GetPreAllocatedSegments().GetBegin() == 0 {
if req.GetPreAllocatedSegmentIDs() == nil || req.GetPreAllocatedSegmentIDs().GetBegin() == 0 {
return merr.Status(merr.WrapErrParameterInvalidMsg("invalid pre-allocated segmentID range")), nil
}
task = compaction.NewClusteringCompactionTask(
Expand Down
12 changes: 6 additions & 6 deletions internal/datanode/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ func (s *DataNodeServicesSuite) TestCompaction() {
{SegmentID: 102, Level: datapb.SegmentLevel_L0},
{SegmentID: 103, Level: datapb.SegmentLevel_L1},
},
Type: datapb.CompactionType_ClusteringCompaction,
BeginLogID: 100,
PreAllocatedSegments: &datapb.IDRange{Begin: 100, End: 200},
Type: datapb.CompactionType_ClusteringCompaction,
BeginLogID: 100,
PreAllocatedSegmentIDs: &datapb.IDRange{Begin: 100, End: 200},
}

resp, err := node.CompactionV2(ctx, req)
Expand Down Expand Up @@ -315,9 +315,9 @@ func (s *DataNodeServicesSuite) TestCompaction() {
{SegmentID: 102, Level: datapb.SegmentLevel_L0},
{SegmentID: 103, Level: datapb.SegmentLevel_L1},
},
Type: datapb.CompactionType_ClusteringCompaction,
BeginLogID: 100,
PreAllocatedSegments: &datapb.IDRange{Begin: 0, End: 0},
Type: datapb.CompactionType_ClusteringCompaction,
BeginLogID: 100,
PreAllocatedSegmentIDs: &datapb.IDRange{Begin: 0, End: 0},
}

resp, err := node.CompactionV2(ctx, req)
Expand Down
2 changes: 1 addition & 1 deletion internal/proto/data_coord.proto
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ message CompactionPlan {
repeated int64 analyze_segment_ids = 15;
int32 state = 16;
int64 begin_logID = 17;
IDRange pre_allocated_segments = 18; // only for clustering compaction
IDRange pre_allocated_segmentIDs = 18; // only for clustering compaction
int64 slot_usage = 19;
int64 max_size = 20;
}
Expand Down

0 comments on commit 1413ffe

Please sign in to comment.