Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 95FA3D801 for ; Tue, 17 Jul 2012 12:51:11 +0000 (UTC) Received: (qmail 88151 invoked by uid 500); 17 Jul 2012 12:51:11 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 87909 invoked by uid 500); 17 Jul 2012 12:51:08 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 87884 invoked by uid 99); 17 Jul 2012 12:51:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jul 2012 12:51:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jul 2012 12:51:05 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9831023888D2 for ; Tue, 17 Jul 2012 12:50:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@hbase.apache.org From: mbautin@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120717125046.9831023888D2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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);