Skip to content

Fix close method of TopOperator and make close method of Operator an interface#11647

Merged
JackieTien97 merged 4 commits intomasterfrom
fixMemory
Nov 30, 2023
Merged

Fix close method of TopOperator and make close method of Operator an interface#11647
JackieTien97 merged 4 commits intomasterfrom
fixMemory

Conversation

@lancelly
Copy link
Contributor

@lancelly lancelly commented Nov 30, 2023

This PR adds a close method to TokOperator, ensuring that its child Operators are properly closed when it is closed, and guaranteeing that the SourceHandle and SinkChannel of the data transmission module are correctly cleaned up even when the query times out.
The close method of the Operator should be an interface, and the implementation of a new Operator must include logic for resource cleanup.

@lancelly lancelly changed the title Fix close method of TopOperator and add messages of Validate.notNull Fix close method of TopOperator and make close method of Operator an interface Nov 30, 2023
Copy link
Member

@Beyyes Beyyes left a comment

Choose a reason for hiding this comment

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

LGTM~

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.5% 0.5% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

public LocalSinkChannel(SharedTsBlockQueue queue, SinkListener sinkListener) {
this.sinkListener = Validate.notNull(sinkListener);
this.queue = Validate.notNull(queue);
this.sinkListener = Validate.notNull(sinkListener, "sinkListener can not be null.");
Copy link
Member

Choose a reason for hiding this comment

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

Use Validate.method(xx, string) may be time-consuming in cpu-bound situation such as benchant/tsbs, because it must construct a string object.

@codecov-commenter
Copy link

Codecov Report

Attention: 35 lines in your changes are missing coverage. Please review.

Comparison is base (bb20b5f) 49.01% compared to head (28033c5) 49.01%.
Report is 7 commits behind head on master.

Files Patch % Lines
...eryengine/execution/exchange/sink/SinkChannel.java 50.00% 18 Missing ⚠️
...gine/execution/exchange/sink/LocalSinkChannel.java 55.00% 9 Missing ⚠️
...ine/execution/exchange/sink/ShuffleSinkHandle.java 60.00% 6 Missing ⚠️
...ution/operator/schema/SchemaFetchScanOperator.java 0.00% 1 Missing ⚠️
...ecution/operator/source/LastCacheScanOperator.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #11647   +/-   ##
=========================================
  Coverage     49.01%   49.01%           
- Complexity    24898    24911   +13     
=========================================
  Files          2815     2815           
  Lines        176117   176177   +60     
  Branches      21125    21148   +23     
=========================================
+ Hits          86322    86357   +35     
- Misses        89795    89820   +25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JackieTien97 JackieTien97 merged commit 0cc841b into master Nov 30, 2023
@JackieTien97 JackieTien97 deleted the fixMemory branch November 30, 2023 10:30
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