[
https://issues.apache.org/jira/browse/HBASE-10294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13870994#comment-13870994
]
stack commented on HBASE-10294:
-------------------------------
Volunteering the justification for the change this far into the issue is just
totally warped process.
bq. The comment about getOnlineServersList() is that there is already code in
ServerManager which iterates onlineServers without using synchronized.
Are you arguing that it is ok to break it more because it broke elsewhere?
bq. Yeah, from description of keySet()
That the iteration of the Map is 'weakly consistent' is orthogonal to what is
going on here. Look elsewhere in SM where the Map is intensively iterated and
operated on under the synchronization. Undoing the sync here widens the window
during which the client may encounter a Map in transition in AM, our most
fragile code base.
-1 on this patch and I refuse to waste any more time discussing this minor --
should be trivial -- issue.
> Some synchronization on ServerManager#onlineServers can be removed
> ------------------------------------------------------------------
>
> Key: HBASE-10294
> URL: https://issues.apache.org/jira/browse/HBASE-10294
> Project: HBase
> Issue Type: Task
> Reporter: Ted Yu
> Assignee: Ted Yu
> Priority: Minor
> Fix For: 0.99.0
>
> Attachments: 10294-v1.txt
>
>
> ServerManager#onlineServers is a ConcurrentHashMap
> Yet I found that some accesses to it are synchronized and unnecessary.
> Here is one example:
> {code}
> public Map<ServerName, ServerLoad> getOnlineServers() {
> // Presumption is that iterating the returned Map is OK.
> synchronized (this.onlineServers) {
> return Collections.unmodifiableMap(this.onlineServers);
> {code}
> Note: not all accesses to ServerManager#onlineServers are synchronized.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)