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

Make DynamicFilter future resilient to cancel #5099

Merged
merged 1 commit into from
Sep 10, 2020

Conversation

raunaqmorarka
Copy link
Member

@raunaqmorarka raunaqmorarka commented Sep 8, 2020

Cancelling CompletableFuture returned by DynamicFilter#isBlocked
should not affect dynamic filter collection. If cancellation of
a future from a consumer of DynamicFilter is allowed to propgate
into DynamicFilterService or LocalDynamicFiltersCollector,
then it will prevent the completion of collection of that
dynamic filter and it's usage by other consumers.

@findepi
Copy link
Member

findepi commented Sep 8, 2020

Can you please add rationale to the commit message?

Also, would it be possible to cover the rogue effects of cancellation with an integration test too?

Copy link
Member

@sopel39 sopel39 left a comment

Choose a reason for hiding this comment

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

lgtm % comments

Cancelling CompletableFuture returned by DynamicFilter#isBlocked
should not affect dynamic filter collection. If cancellation of
a future from a consumer of DynamicFilter is allowed to propgate
into DynamicFilterService or LocalDynamicFiltersCollector,
then it will prevent the completion of collection of that
dynamic filter and it's usage by other consumers.
@raunaqmorarka
Copy link
Member Author

Can you please add rationale to the commit message?

Also, would it be possible to cover the rogue effects of cancellation with an integration test too?

@findepi I've updated the commit message with a more detailed description.
If TestDynamicFilterService#testDynamicFilterCancellation is run without the change to wrap futures in unmodifiableFuture (and some asserts around future state are ignored), then we can see that dynamic filter is marked complete even though the collection is not complete. We also get Same future set twice error when setting lazyDynamicFilters in addDynamicFilters in the storeSummary step after cancellation of future.

@findepi
Copy link
Member

findepi commented Sep 9, 2020

then we can see that dynamic filter is marked complete even though the collection is not complete.

should we cancel the collection (and release associated resources) when connector cancels the DF future?

@sopel39
Copy link
Member

sopel39 commented Sep 9, 2020

should we cancel the collection (and release associated resources) when connector cancels the DF future?

Same future might be used by multiple connectors. It would require us tracking that all DF consumers cancelled that future. We then could potentially forget that particular DF. However, we fetch DFs from workers regardless. I think such mechanism would incur extra complexity which might not be needed at this point.

@findepi
Copy link
Member

findepi commented Sep 9, 2020

Same future might be used by multiple connectors.

Like in

- Join
  - Union All
     - connector 1
     - connector 2

?

@sopel39
Copy link
Member

sopel39 commented Sep 9, 2020

Like in

More like:

- Join
  - Join
    - TS
    - TS
  - TS

but union works too

@sopel39
Copy link
Member

sopel39 commented Sep 9, 2020

@findepi if you don't have any more comments, I will merge it

@sopel39 sopel39 merged commit ef5d7ae into trinodb:master Sep 10, 2020
@sopel39
Copy link
Member

sopel39 commented Sep 10, 2020

merged, thanks!

@sopel39 sopel39 mentioned this pull request Sep 10, 2020
9 tasks
@raunaqmorarka raunaqmorarka deleted the cancel_df branch September 10, 2020 12:20
@martint martint added this to the 342 milestone Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants