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

[GLUTEN-6904] Remove additional synchronizations in JNILibLoader #6905

Closed

Conversation

ArnavBalyan
Copy link
Contributor

What changes were proposed in this pull request?

  • Since we already moved to synchronizedSet for thread safety, there are some additional synchronizations which are no longer needed, these are benign but can be removed for improved performance
  • Removed such synchronizations where we are already thread safe.

Fixes #6904

How was this patch tested?

  • Local build, and sample SQL queries.
  • UTs should cover the rest

@github-actions github-actions bot added the CORE works for Gluten Core label Aug 17, 2024
@ArnavBalyan
Copy link
Contributor Author

ArnavBalyan commented Aug 17, 2024

Thanks @zhztheplayer for pointing this out, if could please take a look and review

Copy link
Member

@zhztheplayer zhztheplayer left a comment

Choose a reason for hiding this comment

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

I see we use synchronized collections and synchronized keywords at the same time. Were they for similar purpose? If yes, can we only keep one of them? So the code will be easier to understand and maintain. Say if synchronized collections are not enough for our case, we can just use synchronized + normal collections.

In addition, if we decide to stay on synchronized keywords, I assume its usage in method mapAndLoad is not needed now. Since method load is already atomic (because mapLibraryName should be stateless?).

Copy link

Run Gluten Clickhouse CI

@ArnavBalyan
Copy link
Contributor Author

I see we use synchronized collections and synchronized keywords at the same time. Were they for similar purpose? If yes, can we only keep one of them? So the code will be easier to understand and maintain. Say if synchronized collections are not enough for our case, we can just use synchronized + normal collections.

In addition, if we decide to stay on synchronized keywords, I assume its usage in method mapAndLoad is not needed now. Since method load is already atomic (because mapLibraryName should be stateless?).

Updated thanks, we need synchronized since there were thread unsafe operations being done outside the collections. I have removed the synchronized collection and kept the keyword, there were not much changes so the code flow is more simple now. Also removed it from mapAndLoad, since we have load protected anyway thanks!

Copy link

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the stale stale label Oct 10, 2024
Copy link

This PR was auto-closed because it has been stalled for 10 days with no activity. Please feel free to reopen if it is still valid. Thanks.

@github-actions github-actions bot closed this Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CORE works for Gluten Core stale stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve JNILibLoader by removing redundant synchronizations
2 participants