Skip to content

Commit

Permalink
Add IsSorted field for segment (#312)
Browse files Browse the repository at this point in the history
Signed-off-by: Cai Zhang <[email protected]>
  • Loading branch information
xiaocai2333 authored Sep 13, 2024
1 parent 3a52682 commit b09603e
Show file tree
Hide file tree
Showing 4 changed files with 417 additions and 400 deletions.
4 changes: 4 additions & 0 deletions models/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ type Segment struct {
// PartitionStats version
PartitionStatsVersion int64

// sorted by PK
IsSorted bool

// etcd segment key
key string

Expand Down Expand Up @@ -107,6 +110,7 @@ func NewSegmentFromV2_2(info *datapbv2.SegmentInfo, key string,
s.StartPosition = NewMsgPosition(info.GetStartPosition())
s.DmlPosition = NewMsgPosition(info.GetDmlPosition())
s.Level = SegmentLevel(info.GetLevel())
s.IsSorted = info.GetIsSorted()

s.lazyLoad = func(s *Segment) {
mFunc := func(fbl datapbv2.FieldBinlog, _ int) *FieldBinlog {
Expand Down
5 changes: 4 additions & 1 deletion proto/v2.2/data_coord.proto
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,11 @@ message SegmentInfo {
int64 partition_stats_version = 22;
// use in major compaction, if compaction fail, should revert segment level to last value
SegmentLevel last_level = 23;
// use in major compaction, if compaction fail, should revert partition stats version to last value
// use in clustering compaction, if compaction fail, should revert partition stats version to last value
int64 last_partition_stats_version = 24;

// used to indicate whether the segment is sorted by primary key.
bool is_sorted = 25;
}

message SegmentStartPosition {
Expand Down
Loading

0 comments on commit b09603e

Please sign in to comment.