HBASE-2040 Fixes to group commit

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@889775 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2009-12-11 19:15:10 +00:00
parent 2f968e1ce7
commit 21f8097353
2 changed files with 10 additions and 4 deletions

View File

@ -123,6 +123,7 @@ Release 0.21.0 - Unreleased
empty oldlogfile.log (Lars George via Stack)
HBASE-2022 NPE in housekeeping kills RS
HBASE-2033 Shell scan 'limit' is off by one
HBASE-2040 Fixes to group commit
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable

View File

@ -237,7 +237,7 @@ public class HLog implements HConstants, Syncable {
", flushlogentries=" + this.flushlogentries +
", optionallogflushinternal=" + this.optionalFlushInterval + "ms");
rollWriter();
logSyncerThread = new LogSyncer(this.flushlogentries);
logSyncerThread = new LogSyncer(this.optionalFlushInterval);
Threads.setDaemonThreadRunning(logSyncerThread,
Thread.currentThread().getName() + ".logSyncer");
}
@ -726,9 +726,9 @@ public class HLog implements HConstants, Syncable {
// Condition used to signal that the sync is done
private final Condition syncDone = lock.newCondition();
private final int optionalFlushInterval;
private final long optionalFlushInterval;
LogSyncer(int optionalFlushInterval) {
LogSyncer(long optionalFlushInterval) {
this.optionalFlushInterval = optionalFlushInterval;
}
@ -739,7 +739,12 @@ public class HLog implements HConstants, Syncable {
// Wait until something has to be synced or do it if we waited enough
// time (useful if something appends but does not sync).
queueEmpty.await(this.optionalFlushInterval, TimeUnit.MILLISECONDS);
if (!queueEmpty.await(this.optionalFlushInterval,
TimeUnit.MILLISECONDS)) {
forceSync = true;
}
// We got the signal, let's syncFS. We currently own the lock so new
// writes are waiting to acquire it in addToSyncQueue while the ones