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

Refine IndexHandler methods a bit to make them reentrant #9440

Merged
merged 1 commit into from
Sep 21, 2022

Conversation

klsince
Copy link
Contributor

@klsince klsince commented Sep 20, 2022

Use a defensive copy to make the IndexHandler methods reentrant and less confusing to use. This is not an issue today, as IndexHandler object is not reused.

@@ -74,22 +74,23 @@ public class FSTIndexHandler implements IndexHandler {
public FSTIndexHandler(SegmentMetadata segmentMetadata, IndexLoadingConfig indexLoadingConfig) {
_segmentMetadata = segmentMetadata;
_fstType = indexLoadingConfig.getFSTIndexType();
_columnsToAddIdx = new HashSet<>(indexLoadingConfig.getFSTIndexColumns());
_columnsToAddIdx = indexLoadingConfig.getFSTIndexColumns();
Copy link
Contributor

Choose a reason for hiding this comment

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

(nit) Isn't it probably cleaner and safer (from future changes) to not have _columnsToAddIdx as a private member? Instead just have _indexLoadingConfig as a private member and compute columnsToAddIdx in the respective methods?

This is the pattern followed in other handlers like BloomFilterHandler,H3IndexHandler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see BF/H3 hander doesn't hold indexLoadingConfig reference either, but configs for creating BF/H3.
The handlers in this PR don't have specific configs from indexLoadingConfig either, so not hold its reference.

Copy link
Contributor

@vvivekiyer vvivekiyer left a comment

Choose a reason for hiding this comment

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

minor comment. LGTM.

@somandal
Copy link
Contributor

lgtm overall

Copy link
Contributor

@jackjlli jackjlli left a comment

Choose a reason for hiding this comment

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

LGTM

@Jackie-Jiang Jackie-Jiang merged commit 44da348 into apache:master Sep 21, 2022
@klsince klsince deleted the refine_index_hander_abit branch September 21, 2022 23:06
61yao pushed a commit to 61yao/pinot that referenced this pull request Oct 3, 2022
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.

5 participants