[ 
https://issues.apache.org/jira/browse/HBASE-9987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13849939#comment-13849939
 ] 

stack commented on HBASE-9987:
------------------------------

Is this ok?

+      Map<byte[], HRegionLocation> tableLocations = 
getTableLocations(tableName);
+      // start to examine the cache. we can only do cache actions
+      // if there's something in the cache for this table.
+      rl = getCachedLocation(tableName, row);
+      if (rl != null) {
+        tableLocations.remove(rl.getRegionInfo().getStartKey());
       }

Could another thread have set into tableLocations a good location and we are 
removing it here?  Previous it couldn't have happened because there was the 
sync block around the whole operation.

Ditto here:

+      result = this.cachedRegionLocations.get(tableName);
+      // if tableLocations for this table isn't built yet, make one
+      if (result == null) {
+        result = new ConcurrentSkipListMap<byte[], 
HRegionLocation>(Bytes.BYTES_COMPARATOR);
+        ConcurrentSkipListMap<byte[], HRegionLocation> old =
+            this.cachedRegionLocations.putIfAbsent(tableName, result);
+        if (old != null) {
+          return old;

Could another thread have inserted a result with perhaps some values in it?

I suppose it is not the end of the world if this happens.... We'll just miss 
the cache  a bit more often.

Could this be a problem?

-      synchronized(this.cachedRegionLocations) {
-        this.cachedRegionLocations.clear();
-        this.cachedServers.clear();
-      }
+      this.cachedRegionLocations.clear();
+      this.cachedServers.clear();


Could we give a bad location out if cachedRegionLocations is cleared but 
cachedServers is not?

There seems to be a bit of dodgy updating now we no longer have sync blocks. 
but perhaps it is ok; we just miss cache a few times more for a better perf 
overall?

> Remove some synchronisation points in HConnectionManager
> --------------------------------------------------------
>
>                 Key: HBASE-9987
>                 URL: https://issues.apache.org/jira/browse/HBASE-9987
>             Project: HBase
>          Issue Type: Bug
>          Components: Client
>    Affects Versions: 0.98.0, 0.96.0
>            Reporter: Nicolas Liochon
>            Assignee: Nicolas Liochon
>             Fix For: 0.98.0, 0.96.1
>
>         Attachments: 9987.v1.patch, 9987.v2.patch
>
>
> Change a Map to a concurrentMap
> Removed the "cachedServer (introduced in HBASE-4785). I suspect that this 
> function is not needed anymore as we also have a list of dead servers, and 
> accessing the list is not blocking. I will dig into this more however.
> The patch gives a 10% improvement with the NoClusterClient.



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to