liuxiaocs7 commented on code in PR #7901:
URL: https://github.com/apache/hbase/pull/7901#discussion_r2938004540


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java:
##########
@@ -2347,8 +2347,21 @@ public BulkLoadHFileResponse bulkLoadHFile(final 
RpcController controller,
       return bulkLoadHFileInternal(request);
     }
 
-    // TODO: implement row cache logic for bulk load
-    return bulkLoadHFileInternal(request);
+    RowCache rowCache = region.getRegionServerServices().getRowCache();
+
+    // Since bulkload modifies the store files, the row cache should be 
disabled until the bulkload
+    // is finished.
+    rowCache.createRegionLevelBarrier(region);
+    try {
+      // We do not invalidate the entire row cache directly, as it contains a 
large number of
+      // entries and takes a long time. Instead, we increment rowCacheSeqNum, 
which is used when
+      // constructing a RowCacheKey, thereby making the existing row cache 
entries stale.
+      rowCache.increaseRowCacheSeqNum(region);
+      return bulkLoadHFileInternal(request);
+    } finally {
+      // The row cache for the region has been enabled again
+      rowCache.removeTableLevelBarrier(region);

Review Comment:
   ditto `region` level



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

Reply via email to