You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by en...@apache.org on 2015/03/11 22:57:03 UTC
hbase git commit: HBASE-13063 Allow to turn off memstore replication
for region replicas - ADDENDUM for turning of primary flush tigger when this
is enabled
Repository: hbase
Updated Branches:
refs/heads/master 2adec36b2 -> c938267db
HBASE-13063 Allow to turn off memstore replication for region replicas - ADDENDUM for turning of primary flush tigger when this is enabled
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c938267d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c938267d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c938267d
Branch: refs/heads/master
Commit: c938267db3bfe95908f97397f64ffc50933e4343
Parents: 2adec36
Author: Enis Soztutar <en...@apache.org>
Authored: Wed Mar 11 14:56:54 2015 -0700
Committer: Enis Soztutar <en...@apache.org>
Committed: Wed Mar 11 14:56:54 2015 -0700
----------------------------------------------------------------------
.../java/org/apache/hadoop/hbase/HTableDescriptor.java | 5 +++++
.../apache/hadoop/hbase/client/RegionReplicaUtil.java | 13 +++++++++++++
.../hadoop/hbase/regionserver/HRegionServer.java | 4 ++--
.../hadoop/hbase/util/ServerRegionReplicaUtil.java | 13 -------------
4 files changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/c938267d/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
index 2c0bd30..a0ab484 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/HTableDescriptor.java
@@ -38,6 +38,7 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.client.Durability;
+import org.apache.hadoop.hbase.client.RegionReplicaUtil;
import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.BytesBytesPair;
@@ -1101,6 +1102,10 @@ public class HTableDescriptor implements Comparable<HTableDescriptor> {
*/
public HTableDescriptor setRegionMemstoreReplication(boolean memstoreReplication) {
setValue(REGION_MEMSTORE_REPLICATION_KEY, memstoreReplication ? TRUE : FALSE);
+ // If the memstore replication is setup, we do not have to wait for observing a flush event
+ // from primary before starting to serve reads, because gaps from replication is not applicable
+ setConfiguration(RegionReplicaUtil.REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH_CONF_KEY,
+ Boolean.toString(memstoreReplication));
return this;
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/c938267d/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionReplicaUtil.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionReplicaUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionReplicaUtil.java
index 9cb0e48..c2dcbc0 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionReplicaUtil.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionReplicaUtil.java
@@ -32,6 +32,19 @@ import org.apache.hadoop.hbase.util.Bytes;
public class RegionReplicaUtil {
/**
+ * Whether or not the secondary region will wait for observing a flush / region open event
+ * from the primary region via async wal replication before enabling read requests. Since replayed
+ * edits from async wal replication from primary is not persisted in WAL, the memstore of the
+ * secondary region might be non-empty at the time of close or crash. For ensuring seqId's not
+ * "going back in time" in the secondary region replica, this should be enabled. However, in some
+ * cases the above semantics might be ok for some application classes.
+ * See HBASE-11580 for more context.
+ */
+ public static final String REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH_CONF_KEY
+ = "hbase.region.replica.wait.for.primary.flush";
+ protected static final boolean DEFAULT_REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH = true;
+
+ /**
* The default replicaId for the region
*/
static final int DEFAULT_REPLICA_ID = 0;
http://git-wip-us.apache.org/repos/asf/hbase/blob/c938267d/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
index 4b8939a..34c417d 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
@@ -1951,9 +1951,9 @@ public class HRegionServer extends HasThread implements
if (ServerRegionReplicaUtil.isDefaultReplica(region.getRegionInfo())) {
return;
}
- if (!ServerRegionReplicaUtil.isRegionReplicaReplicationEnabled(getConfiguration()) ||
+ if (!ServerRegionReplicaUtil.isRegionReplicaReplicationEnabled(region.conf) ||
!ServerRegionReplicaUtil.isRegionReplicaWaitForPrimaryFlushEnabled(
- getConfiguration())) {
+ region.conf)) {
region.setReadsEnabled(true);
return;
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/c938267d/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
index 4551722..67f8e84 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java
@@ -56,19 +56,6 @@ public class ServerRegionReplicaUtil extends RegionReplicaUtil {
private static final String REGION_REPLICA_REPLICATION_PEER = "region_replica_replication";
/**
- * Whether or not the secondary region will wait for observing a flush / region open event
- * from the primary region via async wal replication before enabling read requests. Since replayed
- * edits from async wal replication from primary is not persisted in WAL, the memstore of the
- * secondary region might be non-empty at the time of close or crash. For ensuring seqId's not
- * "going back in time" in the secondary region replica, this should be enabled. However, in some
- * cases the above semantics might be ok for some application classes.
- * See HBASE-11580 for more context.
- */
- public static final String REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH_CONF_KEY
- = "hbase.region.replica.wait.for.primary.flush";
- private static final boolean DEFAULT_REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH = true;
-
- /**
* Enables or disables refreshing store files of secondary region replicas when the memory is
* above the global memstore lower limit. Refreshing the store files means that we will do a file
* list of the primary regions store files, and pick up new files. Also depending on the store