-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: specify time range via TIME_RANGE hint for metrics/inspection tables #14874
Conversation
Signed-off-by: Lonng <heng@lonng.org>
/run-all-tests |
Signed-off-by: Lonng <heng@lonng.org>
Signed-off-by: Lonng <heng@lonng.org>
Signed-off-by: Lonng <heng@lonng.org>
executor/inspection_summary.go
Outdated
return nil, meta.ErrTableNotExists | ||
def, found := infoschema.MetricTableMap[name] | ||
if !found { | ||
sctx.GetSessionVars().StmtCtx.AppendWarning(fmt.Errorf("metrics table: %s not found34", name)) |
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.
sctx.GetSessionVars().StmtCtx.AppendWarning(fmt.Errorf("metrics table: %s not found34", name)) | |
sctx.GetSessionVars().StmtCtx.AppendWarning(fmt.Errorf("metrics table: %s not found", name)) |
@@ -2739,7 +2746,40 @@ func (b *PlanBuilder) buildDataSource(ctx context.Context, tn *ast.TableName, as | |||
return result, nil | |||
} | |||
|
|||
func (b *PlanBuilder) buildMemTable(ctx context.Context, dbName model.CIStr, tableInfo *model.TableInfo) (LogicalPlan, error) { | |||
func (b *PlanBuilder) timeRangeForSummaryTable() QueryTimeRange { | |||
const defaultSummaryDuration = 30 * time.Minute |
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.
Make this a global variable.
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.
It's not a good idea because this const will not share with other functions.
} | ||
e.LabelConditions = extractCols |
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.
Should we store extractCols
to e.LabelConditions
, even skipRequest
is true?
For avoiding check e.LabelConditions == nil
after use this Extract
function
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.
The cols
always nil if skipRequest==true
.
Signed-off-by: Lonng <heng@lonng.org>
Signed-off-by: Lonng <heng@lonng.org>
LGTM |
/run-all-tests |
/run-common-test tidb-test=pr/992 |
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.
LGTM
/run-integration-common-test tidb-test=pr/992 |
Signed-off-by: Lonng heng@lonng.org
What problem does this PR solve?
This PR refactors
inspection/metrics
system tables and improve internal consistency:instance
to an individual column from labels.metric_schema
tometrics_schema
.TIME_RANGE
hint to specify the time range for metrics summary tables instead of using a redundant columntime
.What is changed and how it works?
Add a
QueryTimeRange
for memory table executor and give the hint to retrievers.Check List
Tests
Release note