You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2014/01/15 19:49:55 UTC
svn commit: r1558506 -
/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
Author: tedyu
Date: Wed Jan 15 18:49:55 2014
New Revision: 1558506
URL: http://svn.apache.org/r1558506
Log:
HBASE-10344 Improve write performance by ignoring sync to hdfs when an asyncer's writes have been synced by other asyncer
Modified:
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java?rev=1558506&r1=1558505&r2=1558506&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java Wed Jan 15 18:49:55 2014
@@ -1203,6 +1203,15 @@ class FSHLog implements HLog, Syncable {
this.txidToSync = this.writtenTxid;
}
+ // if this syncer's writes have been synced by other syncer:
+ // 1. just set lastSyncedTxid
+ // 2. don't do real sync, don't notify AsyncNotifier, don't logroll check
+ // regardless of whether the writer is null or not
+ if (this.txidToSync <= syncedTillHere.get()) {
+ this.lastSyncedTxid = this.txidToSync;
+ continue;
+ }
+
// 2. do 'sync' to HDFS to provide durability
long now = EnvironmentEdgeManager.currentTimeMillis();
try {
@@ -1221,16 +1230,13 @@ class FSHLog implements HLog, Syncable {
// 6. t6: AsyncSyncer 1 starts to use writer to do sync... before
// rollWriter set writer to the newly created Writer
//
- // So when writer == null here:
- // 1. if txidToSync <= syncedTillHere, can safely ignore sync here;
- // 2. if txidToSync > syncedTillHere, we need fail all the writes with
- // txid <= txidToSync to avoid 'data loss' where user get successful
- // write response but can't read the writes!
- if (this.txidToSync > syncedTillHere.get()) {
- LOG.fatal("should never happen: has unsynced writes but writer is null!");
- asyncIOE = new IOException("has unsynced writes but writer is null!");
- failedTxid.set(this.txidToSync);
- }
+ // Now writer == null and txidToSync > syncedTillHere here:
+ // we need fail all the writes with txid <= txidToSync to avoid
+ // 'data loss' where user get successful write response but can't
+ // read the writes!
+ LOG.fatal("should never happen: has unsynced writes but writer is null!");
+ asyncIOE = new IOException("has unsynced writes but writer is null!");
+ failedTxid.set(this.txidToSync);
} else {
this.isSyncing = true;
writer.sync();