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
executor: add remain time for showAnalyzeStatus #43866
executor: add remain time for showAnalyzeStatus #43866
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
8793f1b
to
01b9751
Compare
654e989
to
6fe1de5
Compare
executor/infoschema_reader.go
Outdated
// setDataForAnalyzeStatus gets all the analyze jobs. | ||
func (e *memtableRetriever) setDataForAnalyzeStatus(sctx sessionctx.Context) (err error) { | ||
e.rows, err = dataForAnalyzeStatusHelper(sctx) | ||
e.rows, err = dataForAnalyzeStatusHelper(sctx, false) |
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.
I think it is also ok to add those fields for information_schema.analyze_status
.
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.
Yes, As the changes are extensive, it may be difficult to review all of them within a single pull request. information_schema.analyze_status
will be in the next PR.
4608f72
to
be97a66
Compare
/retest |
executor/infoschema_reader.go
Outdated
pt := tb.Meta().GetPartitionInfo() | ||
tid = pt.GetPartitionIDByName(partitionName) | ||
} else { | ||
statsTable := statistics.PseudoTable(tb.Meta()) |
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.
Maybe here we can call domain.GetDomain(sctx).StatsHandle().GetPartitionStats(tbl.Meta(), tid)
for both partition and non-partitioned table. (*Handle).GetTableStats
is just a thin wrapper of (*Handle).GetPartitionStats
.
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.
OK, I have refactored it.
8e57c73
to
5804ddb
Compare
pt := meta.GetPartitionInfo() | ||
tid = pt.GetPartitionIDByName(partitionName) | ||
statsTbl = statsHandle.GetPartitionStats(meta, tid) | ||
} |
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 seems that we need to exchange the two branches.
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.
Done
regionStats.Count = 1 | ||
// Set a very large approximate count. | ||
regionStats.StorageKeys = 1000000 | ||
}) |
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.
Will we add some tests using the failpoint?
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.
Yes, I will add tests by the other PR. This failpoint is from the old test.
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.
I hope it can be merged and included in today's nightly version so that I can test it manually.
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.
rest LGTM
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
7b522f8
to
da40a2c
Compare
/retest |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: da40a2c
|
/retest |
} | ||
} | ||
if tid > 0 && totalCnt == 0 { | ||
totalCnt, _ = internalutil.GetApproximateTableCountFromStorage(sctx, tid, dbName, tableName, partitionName) |
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.
This func will be called at getAdjustedSampleRate when we do the first analyze, and called again when show analyze status, right? Can we reuse, like persisting the ApproximateTableCount somewhere?
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.
UI will call showAnalyzeStatus many times to get fresh status. I'm afraid there will be frequent calls to internalutil.GetApproximateTableCountFromStorage.
duration = 1 * time.Second | ||
} | ||
i := float64(remainLine) * duration.Seconds() / float64(processedRows) | ||
persentage := float64(processedRows) / float64(totalCnt) |
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.
typo: persentage-> percentage
instance, // INSTANCE | ||
procID, // PROCESS_ID | ||
remainDurationStr, // REMAINING_SECONDS | ||
progressStr, // PROGRESS |
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 better to be a numeric type for UI to easily parse and aggregate.
What problem does this PR solve?
Issue Number: close #44033
Problem Summary:
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.