[
https://issues.apache.org/jira/browse/HUDI-1982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17377726#comment-17377726
]
ASF GitHub Bot commented on HUDI-1982:
--------------------------------------
chaplinthink commented on a change in pull request #3041:
URL: https://github.com/apache/hudi/pull/3041#discussion_r666633342
##########
File path:
hudi-timeline-service/src/main/java/org/apache/hudi/timeline/service/RequestHandler.java
##########
@@ -132,15 +132,13 @@ private boolean syncIfLocalViewBehind(Context ctx) {
String lastKnownInstantFromClient =
ctx.queryParam(RemoteHoodieTableFileSystemView.LAST_INSTANT_TS,
HoodieTimeline.INVALID_INSTANT_TS);
SyncableFileSystemView view = viewManager.getFileSystemView(basePath);
- synchronized (view) {
Review comment:
Thanks a lot for reply. Do you mean the `synchornized ` is to ensure
`HoodieTimeline newTimeline =
metaClient.reloadActiveTimeline().filterCompletedAndCompactionInstants();`
concurrently?
In fact, we are also to do this right ?
```
@Override
public void sync() {
HoodieTimeline oldTimeline = getTimeline();
try {
writeLock.lock();
HoodieTimeline newTimeline =
metaClient.reloadActiveTimeline().filterCompletedAndCompactionInstants();
runSync(oldTimeline, newTimeline);
} finally {
writeLock.unlock();
}
}
```
I am confused when I see the code that we use `synchornized` and
`writeLock` at the same time.
I agree to validate this with more concurrent testing. Currently i have not
encountered concurrency bottlenecks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
> Remove unnecessary synchronization
> ----------------------------------
>
> Key: HUDI-1982
> URL: https://issues.apache.org/jira/browse/HUDI-1982
> Project: Apache Hudi
> Issue Type: Improvement
> Components: Code Cleanup
> Reporter: Wei
> Assignee: Wei
> Priority: Minor
> Labels: pull-request-available
>
> synchronized is not necessary, because the sync operation already has
> WriteLock to ensure synchronization
--
This message was sent by Atlassian Jira
(v8.3.4#803005)