hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mbau...@apache.org
Subject svn commit: r1362473 - /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
Date Tue, 17 Jul 2012 12:50:46 GMT
Author: mbautin
Date: Tue Jul 17 12:50:46 2012
New Revision: 1362473

URL: http://svn.apache.org/viewvc?rev=1362473&view=rev
Log:
[master] fix assertion failure in hflush

Author: pkhemani

Summary: follow up to D507512

Test Plan: unit tests

Reviewers: mbautin, kranganathan

Reviewed By: mbautin

CC: hbase-eng@

Differential Revision: https://phabricator.fb.com/D520949

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java?rev=1362473&r1=1362472&r2=1362473&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
(original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java
Tue Jul 17 12:50:46 2012
@@ -1021,15 +1021,17 @@ public class HLog implements Syncable {
           // writes are waiting to acquire it in addToSyncQueue while the ones
           // we hflush are waiting on await()
           hflush();
-          assert unflushedEntries.get() == syncTillHere :
-              "hflush should not have returned without flushing everything!";
           lastHFlushAt = EnvironmentEdgeManager.currentTimeMillis();
 
           // Release all the clients waiting on the hflush. Notice that we still
           // own the lock until we get back to await at which point all the
           // other threads waiting will first acquire and release locks
           syncDone.signalAll();
-        } while (!syncerShuttingDown);
+        } while (!syncerShuttingDown ||
+            (unflushedEntries.get() != syncTillHere));
+        // The check above involves synchronization between syncerShuttingDown
+        // and unflushedEntries in append(). The check for syncerShutDown has to
+        // come before.
       } catch (InterruptedException e) {
         LOG.debug(getName() + " interrupted while waiting for sync requests");
         if (unflushedEntries.get() != syncTillHere) {
@@ -1126,6 +1128,10 @@ public class HLog implements Syncable {
             // case this.writer will be NULL
             this.writer.sync();
           }
+          // A better name for syncTillHere variable would have been
+          // syncedAtLeastTillHere. Between the time unflushedEntries is
+          // snapshotted and writer.sync() is called, append can append more
+          // entries to the log.
           this.syncTillHere = doneUpto;
           syncTime.inc(System.currentTimeMillis() - now);
 



Mime
View raw message