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

[Java] keyPosition variable in ParallelSearcher should be marked volatile #36151

Closed
rtadepalli opened this issue Jun 17, 2023 · 1 comment · Fixed by #36152
Closed

[Java] keyPosition variable in ParallelSearcher should be marked volatile #36151

rtadepalli opened this issue Jun 17, 2023 · 1 comment · Fixed by #36152

Comments

@rtadepalli
Copy link
Contributor

Describe the enhancement requested

ParallelSearcher dispatches multiple threads to search a large vector. The main synchronization variable here is keyPosition, which can be read and written to by multiple threads. All threads should have a consistent view of the state of this variable, hence it should be marked volatile.

Component(s)

Java

@rtadepalli
Copy link
Contributor Author

take

rtadepalli added a commit to rtadepalli/arrow that referenced this issue Jun 17, 2023
@kou kou changed the title keyPosition variable in ParallelSearcher should be marked volatile [Java] keyPosition variable in ParallelSearcher should be marked volatile Jun 19, 2023
@lidavidm lidavidm added this to the 13.0.0 milestone Jun 19, 2023
lidavidm pushed a commit that referenced this issue Jun 19, 2023
…llelSearcher` (#36152)

### Rationale for this change

Multiple threads can read/write to the `keyPosition` variable. Thus, it should be declared `volatile` so that all threads have a consistent view of the value of this variable.

### What changes are included in this PR?

This PR just marks an instance member `volatile`.

### Are these changes tested?

Existing tests should suffice as no functionality is being changed.

### Are there any user-facing changes?

No, there are no user facing changes. There are no changes to the public API either.
* Closes: #36151

Authored-by: Ramasai <ramasai.tadepalli+3108@gmail.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants