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 2021/07/14 22:36:35 UTC

[GitHub] [hbase] huaxiangsun commented on a change in pull request #3490: HBASE-24984 WAL corruption due to early DBBs re-use when Durability.A…

huaxiangsun commented on a change in pull request #3490:
URL: https://github.com/apache/hbase/pull/3490#discussion_r669999412



##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerCall.java
##########
@@ -175,23 +178,17 @@ private void release(int mask) {
     }
   }
 
-  @Override
-  public void cleanup() {
-    release(0b01);
+  public void retainByWAL() {
+    reference.incrementAndGet();
   }
 
-  public void retainByWAL() {
-    for (;;) {
-      int ref = reference.get();
-      int nextRef = ref | 0b10;
-      if (reference.compareAndSet(ref, nextRef)) {
-        return;
+  public void releaseByWAL() {

Review comment:
       I saw the review request is closed. Let me post one comment here. I think there is one corner case here.
   batch() -> FSWEntry (increase refCount)
   consume() -> sync done, decrease refCount -> cleanup()
   next FSWEntry(increase refCount) --> referring to the buffer which has been released.
   
   In this case, it is better to pre-calculate how many refCount is there and set it at the very begin.




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