Skip to content

Commit

Permalink
enhance:add support for partition stats for major compaction test(mil…
Browse files Browse the repository at this point in the history
…vus-io#276)

Signed-off-by: MrPresent-Han <[email protected]>
  • Loading branch information
MrPresent-Han committed Jun 21, 2024
1 parent c9bcfdb commit 417b472
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions models/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ type Segment struct {
// Semantic version
Version string

//PartitionStats version
PartitionStatsVersion int64

// etcd segment key
key string

Expand Down Expand Up @@ -126,6 +129,7 @@ func NewSegmentFromV2_2(info *datapbv2.SegmentInfo, key string,
}

s.Version = ">=2.2.0"
s.PartitionStatsVersion = info.GetPartitionStatsVersion()
return s
}

Expand Down
3 changes: 3 additions & 0 deletions models/segment_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion states/etcd/show/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 417b472

Please sign in to comment.