You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2022/11/02 06:32:51 UTC

[GitHub] [hbase] Apache9 commented on a diff in pull request #4859: HBASE-27458 Use ReadWriteLock for region scanner readpoint map

Apache9 commented on code in PR #4859:
URL: https://github.com/apache/hbase/pull/4859#discussion_r1011243971


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RegionScannerImpl.java:
##########
@@ -130,19 +130,34 @@ private static boolean hasNonce(HRegion region, long nonce) {
     long mvccReadPoint = PackagePrivateFieldAccessor.getMvccReadPoint(scan);
     this.scannerReadPoints = region.scannerReadPoints;
     this.rsServices = region.getRegionServerServices();
-    synchronized (scannerReadPoints) {
-      if (mvccReadPoint > 0) {
-        this.readPt = mvccReadPoint;
-      } else if (hasNonce(region, nonce)) {
-        this.readPt = rsServices.getNonceManager().getMvccFromOperationContext(nonceGroup, nonce);
-      } else {
-        this.readPt = region.getReadPoint(isolationLevel);
+    if (region.useReadWriteLockForReadPoints) {
+      region.scannerReadPointsLock.readLock().lock();
+      try {
+        this.readPt = calculateReadPoint(isolationLevel, mvccReadPoint, nonceGroup, nonce);
+        scannerReadPoints.put(this, this.readPt);

Review Comment:
   Here we also modified the scannerReadPoints? Why just use read lock here?



-- 
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: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org