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

Remove ErrorRequestHandler #4303

Merged
merged 10 commits into from
Mar 14, 2019
Merged

Remove ErrorRequestHandler #4303

merged 10 commits into from
Mar 14, 2019

Conversation

breezewish
Copy link
Member

@breezewish breezewish commented Mar 1, 2019

What have you changed? (mandatory)

Previously, we:

  1. Parse request (fn parse_request)
  2. If parse request failed, create an ErrorRequestHandler. If parse request succeeded, create a corresponding RequestHandler. Anyway, there will be a RequestHandler (let's call it R).
  3. Try to process in the read pool (fn handle_unary_request)
  4. If read pool is full, produce a future::ok(AResponseOfFullError). If read pool is not full, continue.
  5. Get a snapshot, and then feed snapshot to R to get a result.

This causes #4293 because the process "Get a snapshot" requires a correctly parsed request in real world.

Now we:

  1. Parse request (fn parse_request)
  2. If parse request fails, return error.
  3. Try to process in the read pool.
  4. If read pool is full, return error.
  5. Get a snapshot, and then feed snapshot to R to a correctly parsed RequestHandler to get a result.

What are the type of the changes? (mandatory)

  • Bug fix (change which fixes an issue)

How has this PR been tested? (mandatory)

Newly added some fail point tests.

breezewish and others added 7 commits March 1, 2019 18:06
Signed-off-by: Breezewish <breezewish@pingcap.com>
Signed-off-by: Breezewish <breezewish@pingcap.com>
Signed-off-by: Breezewish <breezewish@pingcap.com>
Signed-off-by: Breezewish <breezewish@pingcap.com>
Signed-off-by: Breezewish <breezewish@pingcap.com>
@breezewish
Copy link
Member Author

@AndreMouche @BusyJay @hicqu PTAL, thanks!

@siddontang
Copy link
Contributor

do we need to construct an error that exceeds the 1000 limit for the protobuf?

@rleungx rleungx added the type/bugfix This PR fixes a bug. label Mar 4, 2019
@@ -249,6 +250,14 @@ impl Engine for RocksEngine {
}

fn async_snapshot(&self, _: &Context, cb: Callback<Self::Snap>) -> Result<()> {
fail_point!("rockskv_async_snapshot", |_| Err(box_err!(
Copy link
Member

Choose a reason for hiding this comment

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

So many failpoints.

Copy link
Member Author

Choose a reason for hiding this comment

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

We have one for raftkv async snapshot. So let's add one for rocksdb kv as well. In coprocessor tests only rocksdb engine is used.

.future_execute(priority, move |ctxd| {
tracker.attach_ctxd(ctxd);
Self::handle_unary_request_impl(engine, tracker, handler_builder)
})
.map_err(|_| Error::Full)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think it's correct anymore. What if the returned error is a Error::Region?

Copy link
Member Author

Choose a reason for hiding this comment

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

@BusyJay future_execute itself returns Result<impl Future>. The map_err here only maps the out most Result, not the inner one. For the out most result, it can be only caused by read pool full. Does it solve your concern?

Copy link
Member

Choose a reason for hiding this comment

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

Why not impl From for the error returned by read_pool? So no one has the concern anymore.

Copy link
Member Author

@breezewish breezewish Mar 6, 2019

Choose a reason for hiding this comment

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

This solution was not accepted at that time. Reviewers said that it is not good to mix the sync part into the async interface.

@breezewish
Copy link
Member Author

@BusyJay @hicqu @AndreMouche PTAL, thanks!

@BusyJay
Copy link
Member

BusyJay commented Mar 14, 2019

@hicqu @overvenus @AndreMouche PTAL

AndreMouche
AndreMouche previously approved these changes Mar 14, 2019
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

@AndreMouche
Copy link
Member

@hicqu PTAL

Signed-off-by: Breezewish <breezewish@pingcap.com>
@breezewish
Copy link
Member Author

/run-integration-tests

@hicqu
Copy link
Contributor

hicqu commented Mar 14, 2019

LGTM.

Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

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

LGTM

@overvenus overvenus merged commit 9b7513e into tikv:master Mar 14, 2019
@breezewish breezewish deleted the fix-4293 branch March 14, 2019 10:07
breezewish added a commit to breezewish/tikv that referenced this pull request Mar 14, 2019
Signed-off-by: Breezewish <breezewish@pingcap.com>
@breezewish breezewish mentioned this pull request Mar 14, 2019
overvenus pushed a commit that referenced this pull request Mar 14, 2019
Signed-off-by: Breezewish <breezewish@pingcap.com>
sticnarf pushed a commit to sticnarf/tikv that referenced this pull request Oct 27, 2019
Signed-off-by: Breezewish <breezewish@pingcap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants