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

Remove synchronization for updateFinalTaskInfo() #24558

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

NikhilCollooru
Copy link
Contributor

@NikhilCollooru NikhilCollooru commented Feb 13, 2025

Description

Remove redundant synchronization for updateFinalTaskInfo()

Motivation and Context

During lock profiling we observed that there is some contention when calling SqlStageExecution.updateFinalTaskInfo(). runningTasks used inside this method is a thread safe hashset. Also the stateMachine.setAllTasksFinal() is thread safe, as it acquires locks before execution. So its safe to remove the "synchronized" for updateFinalTaskInfo().
langThread run (100)

Impact

None

Test Plan

Existing unit tests and verifier testing.

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

== NO RELEASE NOTE ==

During lock profiling we observed that there is some contention
when calling SqlStageExecution.updateFinalTaskInfo().
runningTasks used inside this method is a thread safe hashset.
Also the stateMachine.setAllTasksFinal() is thread safe, as it
acquires locks before execution. So its safe to remvoe the
"synchronized" for updateFinalTaskInfo().
@NikhilCollooru NikhilCollooru requested a review from a team as a code owner February 13, 2025 22:31
@prestodb-ci prestodb-ci added the from:Meta PR from Meta label Feb 13, 2025
@@ -718,13 +718,13 @@ private boolean isRecoverable(List<ExecutionFailureInfo> failures)
failedTasks.size() < allTasks.size() * maxFailedTaskPercentage;
}

private synchronized void updateFinalTaskInfo(TaskInfo finalTaskInfo)
private void updateFinalTaskInfo(TaskInfo finalTaskInfo)
{
runningTasks.remove(finalTaskInfo.getTaskId());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

runninTasks is a concurrent Hashset; so its thread safe.

@arhimondr arhimondr merged commit b190fe8 into prestodb:master Feb 14, 2025
54 checks passed
@NikhilCollooru NikhilCollooru deleted the delWSThrift branch February 14, 2025 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from:Meta PR from Meta
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants