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

coprocessor: collect output counts for each executor #2607

Merged
merged 5 commits into from
Dec 22, 2017

Conversation

alivxxx
Copy link
Contributor

@alivxxx alivxxx commented Dec 21, 2017

We collect it so that we could this information to adjust statistics.
PTAL @coocood @hanfei1991 @winoros @AndreMouche

@@ -91,6 +93,9 @@ impl DAGContext {
let mut resp = Response::new();
let mut sel_resp = SelectResponse::new();
sel_resp.set_chunks(RepeatedField::from_vec(chunks));
let mut counts = Vec::with_capacity(self.num_execs);
Copy link
Contributor

@coocood coocood Dec 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can simply use a constant number like 4 for capacity.
It doesn't worth a field in context.

@coocood
Copy link
Contributor

coocood commented Dec 22, 2017

LGTM

@@ -170,6 +174,10 @@ impl Executor for IndexScanExecutor {
}
}

fn collect_output_counts(&mut self, counts: &mut Vec<i64>) {
counts.push(self.count - 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd better set self.count to zero after collect

@@ -145,6 +148,7 @@ impl IndexScanExecutor {

impl Executor for IndexScanExecutor {
fn next(&mut self) -> Result<Option<Row>> {
self.count += 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd better increase count only when meets some value since we will support stream in the future.

Copy link
Member

@AndreMouche AndreMouche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hicqu
Copy link
Contributor

hicqu commented Dec 22, 2017

LGTM.

@hicqu
Copy link
Contributor

hicqu commented Dec 22, 2017

/run-all-tests

@alivxxx alivxxx merged commit fc1cffc into tikv:master Dec 22, 2017
@alivxxx alivxxx deleted the output_counts branch December 22, 2017 08:57
sticnarf pushed a commit to sticnarf/tikv that referenced this pull request Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants