ddupg commented on pull request #2463:
URL: https://github.com/apache/hbase/pull/2463#issuecomment-699739412


   > I think we'd better revist the synchronization in 
HBaseReplicationEndpoint. I can see the conn field is used in 
getReplicationSink where it is synchronized, but actually it is only used to 
protect sinkServers? So we can just synchroniza on sinkServers or a dedicated 
locking object? And we also have synchronized when accessing ZKWatcher, need to 
find out whether they need to use the same lock.
   
   Agreed to revist the synchronization. `conn` field is new in `doStart()` and 
close in `doStop()`, it should not be synchronized.
   
   For method `getReplicationSink()`, I guess synchronized is to avoid 
`sinkServers` changing, `conn` is not the point. If we synchroniza on 
`sinkServers`, set `sinkServers` final? avoid reassign like 
[here](https://github.com/apache/hbase/blob/c312760819ed185cab3a0717a1ea0ff6e8c47a23/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/HBaseReplicationEndpoint.java#L238)
   
   And for accessing ZKWatcher,  need synchronized while `reloadZkWatcher()`, 
but should not be same lock with `sinkServers`.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to