-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
SQL: Add is_active to sys.segments, update examples and docs. #11550
Changes from 5 commits
c7929ba
cb3e983
8e134b9
a012760
06564e9
7a0ec04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,6 +123,8 @@ public class SystemSchema extends AbstractSchema | |
* where 1 = true and 0 = false to make it easy to count number of segments | ||
* which are published, available etc. | ||
*/ | ||
private static final long IS_ACTIVE_FALSE = 0L; | ||
private static final long IS_ACTIVE_TRUE = 1L; | ||
private static final long IS_PUBLISHED_FALSE = 0L; | ||
private static final long IS_PUBLISHED_TRUE = 1L; | ||
private static final long IS_AVAILABLE_TRUE = 1L; | ||
|
@@ -140,6 +142,7 @@ public class SystemSchema extends AbstractSchema | |
.add("partition_num", ColumnType.LONG) | ||
.add("num_replicas", ColumnType.LONG) | ||
.add("num_rows", ColumnType.LONG) | ||
.add("is_active", ColumnType.LONG) | ||
.add("is_published", ColumnType.LONG) | ||
.add("is_available", ColumnType.LONG) | ||
.add("is_realtime", ColumnType.LONG) | ||
|
@@ -313,7 +316,10 @@ public Enumerable<Object[]> scan(DataContext root) | |
(long) segment.getShardSpec().getPartitionNum(), | ||
numReplicas, | ||
numRows, | ||
IS_PUBLISHED_TRUE, //is_published is true for published segments | ||
//is_active is true for published segments that are not overshadowed | ||
val.isOvershadowed() ? IS_ACTIVE_FALSE : IS_ACTIVE_TRUE, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mmm.. isn't it a requirement for being active that is_overshadow and is_publish both be true? Oh...got it. We already know that it is published if we are here. So it is fine...never mind. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's the idea. The branch is for published segments only. |
||
//is_published is true for published segments | ||
IS_PUBLISHED_TRUE, | ||
isAvailable, | ||
isRealtime, | ||
val.isOvershadowed() ? IS_OVERSHADOWED_TRUE : IS_OVERSHADOWED_FALSE, | ||
|
@@ -350,8 +356,10 @@ public Enumerable<Object[]> scan(DataContext root) | |
(long) val.getValue().getSegment().getShardSpec().getPartitionNum(), | ||
numReplicas, | ||
val.getValue().getNumRows(), | ||
IS_PUBLISHED_FALSE, | ||
// is_active is true for unpublished segments iff they are realtime | ||
val.getValue().isRealtime() /* is_active */, | ||
// is_published is false for unpublished segments | ||
IS_PUBLISHED_FALSE, | ||
// is_available is assumed to be always true for segments announced by historicals or realtime tasks | ||
IS_AVAILABLE_TRUE, | ||
val.getValue().isRealtime(), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1593,6 +1593,7 @@ error_msg | |
exprs | ||
group_id | ||
interval_expr | ||
is_active | ||
is_available | ||
is_leader | ||
is_overshadowed | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.