You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2013/04/06 05:18:18 UTC
svn commit: r1465175 - in
/hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver:
HRegion.java wal/FSHLog.java
Author: larsh
Date: Sat Apr 6 03:18:18 2013
New Revision: 1465175
URL: http://svn.apache.org/r1465175
Log:
HBASE-8208 In some situations data is not replicated to slaves when deferredLogSync is enabled (Jeffrey Zhong)
Modified:
hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
Modified: hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=1465175&r1=1465174&r2=1465175&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java (original)
+++ hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java Sat Apr 6 03:18:18 2013
@@ -1496,6 +1496,12 @@ public class HRegion implements HeapSize
status.setStatus(s);
LOG.debug(s);
+ // sync unflushed WAL changes when deferred log sync is enabled
+ // see HBASE-8208 for details
+ if (wal != null && isDeferredLogSyncEnabled()) {
+ wal.sync();
+ }
+
// wait for all in-progress transactions to commit to HLog before
// we can start the flush. This prevents
// uncommitted transactions from being written into HFiles.
@@ -5382,13 +5388,19 @@ public class HRegion implements HeapSize
* @throws IOException If anything goes wrong with DFS
*/
private void syncOrDefer(long txid) throws IOException {
- if (this.getRegionInfo().isMetaRegion() ||
- !this.htableDescriptor.isDeferredLogFlush() || this.deferredLogSyncDisabled) {
+ if (this.getRegionInfo().isMetaRegion() || !isDeferredLogSyncEnabled()) {
this.log.sync(txid);
}
}
/**
+ * check if current region is deferred sync enabled.
+ */
+ private boolean isDeferredLogSyncEnabled() {
+ return (this.htableDescriptor.isDeferredLogFlush() && !this.deferredLogSyncDisabled);
+ }
+
+ /**
* A mocked list implementaion - discards all updates.
*/
private static final List<KeyValue> MOCKED_LIST = new AbstractList<KeyValue>() {
Modified: hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java?rev=1465175&r1=1465174&r2=1465175&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java (original)
+++ hbase/branches/0.95/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java Sat Apr 6 03:18:18 2013
@@ -1071,6 +1071,11 @@ class FSHLog implements HLog, Syncable {
// sync all transactions upto the specified txid
private void syncer(long txid) throws IOException {
+ // if the transaction that we are interested in is already
+ // synced, then return immediately.
+ if (txid <= this.syncedTillHere) {
+ return;
+ }
Writer tempWriter;
synchronized (this.updateLock) {
if (this.closed) return;
@@ -1080,11 +1085,6 @@ class FSHLog implements HLog, Syncable {
// See HBASE-4387, HBASE-5623, HBASE-7329.
tempWriter = this.writer;
}
- // if the transaction that we are interested in is already
- // synced, then return immediately.
- if (txid <= this.syncedTillHere) {
- return;
- }
try {
long doneUpto;
long now = EnvironmentEdgeManager.currentTimeMillis();