HBASE-13063 Allow to turn off memstore replication for region replicas - ADDENDUM for turning of primary flush tigger when this is enabled
This commit is contained in:
parent
2adec36b2f
commit
c938267db3
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,19 @@ import org.apache.hadoop.hbase.util.Bytes;
|
|||
@InterfaceAudience.Private
|
||||
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
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -55,19 +55,6 @@ public class ServerRegionReplicaUtil extends RegionReplicaUtil {
|
|||
private static final boolean DEFAULT_REGION_REPLICA_REPLICATION = false;
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue