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

feat: support cancellation safe future #1071

Merged
merged 3 commits into from
Jul 14, 2023

Conversation

ShiKaiWi
Copy link
Member

@ShiKaiWi ShiKaiWi commented Jul 12, 2023

Rationale

In some case, the future cancel safety must be guaranteed, but there is no such a mechanism to make it now.

Detailed Changes

Introduce CancellationSafeFuture to wrap a future to ensure it must be executed.

Test Plan

New unit tests.

Additional

This implementation refers to: https://github.com/influxdata/influxdb_iox/blob/885767aa0a6010de592bde9992945b01389eb994/cache_system/src/cancellation_safe_future.rs

common_util/src/future_cancel.rs Outdated Show resolved Hide resolved
common_util/src/future_cancel.rs Outdated Show resolved Hide resolved
@ShiKaiWi ShiKaiWi changed the title feat: support future cancel detection feat: support cancellation safe future Jul 14, 2023
Copy link
Contributor

@Rachelint Rachelint left a comment

Choose a reason for hiding this comment

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

LGTM

@baojinri baojinri merged commit cc290f2 into apache:main Jul 14, 2023
@ShiKaiWi ShiKaiWi deleted the feat-future-cancel-guard branch July 14, 2023 06:56
jiacai2050 pushed a commit that referenced this pull request Jul 17, 2023
## Rationale
If the first write request is canceled, the write request in the queue
will never be executed, until the queue is full, then an error will be
returned.

## Detailed Changes
Use `CancellationSafeFuture` to  execute the write requests, see #1071 

## Test Plan
Existing tests.
MichaelLeeHZ pushed a commit to MichaelLeeHZ/ceresdb that referenced this pull request Jul 18, 2023
In some case, the future cancel safety must be guaranteed, but there is
no such a mechanism to make it now.

Introduce `CancellationSafeFuture` to wrap a future to ensure it must be
executed.

New unit tests.

This implementation refers to:
https://github.com/influxdata/influxdb_iox/blob/885767aa0a6010de592bde9992945b01389eb994/cache_system/src/cancellation_safe_future.rs

---------

Co-authored-by: Ruixiang Tan <819464715@qq.com>
MichaelLeeHZ pushed a commit to MichaelLeeHZ/ceresdb that referenced this pull request Jul 18, 2023
## Rationale
If the first write request is canceled, the write request in the queue
will never be executed, until the queue is full, then an error will be
returned.

## Detailed Changes
Use `CancellationSafeFuture` to  execute the write requests, see apache#1071 

## Test Plan
Existing tests.
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