Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IsSorted field for segment #312

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading