From 417b472b59ad4a7c394408eeaa5d4b3886fae5bb Mon Sep 17 00:00:00 2001 From: MrPresent-Han Date: Fri, 21 Jun 2024 02:47:00 -0400 Subject: [PATCH] enhance:add support for partition stats for major compaction test(#276) Signed-off-by: MrPresent-Han --- models/segment.go | 4 ++++ models/segment_state.go | 3 +++ states/etcd/show/segment.go | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/models/segment.go b/models/segment.go index 4939051..0145435 100644 --- a/models/segment.go +++ b/models/segment.go @@ -34,6 +34,9 @@ type Segment struct { // Semantic version Version string + //PartitionStats version + PartitionStatsVersion int64 + // etcd segment key key string @@ -126,6 +129,7 @@ func NewSegmentFromV2_2(info *datapbv2.SegmentInfo, key string, } s.Version = ">=2.2.0" + s.PartitionStatsVersion = info.GetPartitionStatsVersion() return s } diff --git a/models/segment_state.go b/models/segment_state.go index fe5f2d2..68d75d7 100644 --- a/models/segment_state.go +++ b/models/segment_state.go @@ -45,18 +45,21 @@ const ( SegmentLevelLegacy SegmentLevel = 0 SegmentLevelL0 SegmentLevel = 1 SegmentLevelL1 SegmentLevel = 2 + SegmentLevelL2 SegmentLevel = 3 ) var SegmentLevelName = map[int32]string{ 0: "Legacy", 1: "L0", 2: "L1", + 3: "L2", } var SegmentLevelValue = map[string]int32{ "Legacy": 0, "L0": 1, "L1": 2, + "L2": 3, } func (x SegmentLevel) String() string { diff --git a/states/etcd/show/segment.go b/states/etcd/show/segment.go index 936da22..3f3af6c 100644 --- a/states/etcd/show/segment.go +++ b/states/etcd/show/segment.go @@ -82,7 +82,8 @@ func (c *ComponentShow) SegmentCommand(ctx context.Context, p *SegmentParam) err case "table": PrintSegmentInfo(info, p.Detail) case "line": - fmt.Printf("SegmentID: %d State: %s, Level: %s, Row Count:%d\n", info.ID, info.State.String(), info.Level.String(), info.NumOfRows) + fmt.Printf("SegmentID: %d State: %s, Level: %s, Row Count:%d, PartitionStatsVersion:%d \n", info.ID, info.State.String(), + info.Level.String(), info.NumOfRows, info.PartitionStatsVersion) case "statistics": if info.State != models.SegmentStateDropped { for _, binlog := range info.GetBinlogs() {