regions = admin.getTableRegions(tableName);
+ if (regions == null || regions.isEmpty()) {
+ LOG.info("Table " + tableName + " doesn't have regions to split");
+ return;
+ }
+
+ HRegionInfo region = PolicyBasedChaosMonkey.selectRandomItem(
+ regions.toArray(new HRegionInfo[regions.size()]));
+ LOG.debug("Splitting region " + region.getRegionNameAsString());
+ try {
+ admin.splitRegion(region.getRegionName());
+ } catch (Exception ex) {
+ LOG.warn("Split failed, might be caused by other chaos: " + ex.getMessage());
+ }
+ if (sleepTime > 0) {
+ Thread.sleep(sleepTime);
+ }
+ }
+
+}
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/CalmMonkeyFactory.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/CalmMonkeyFactory.java
new file mode 100644
index 00000000000..bb2199d76f6
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/CalmMonkeyFactory.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.end2end.chaos.factories;
+
+import org.apache.hadoop.hbase.chaos.monkies.CalmChaosMonkey;
+import org.apache.hadoop.hbase.chaos.monkies.ChaosMonkey;
+
+public class CalmMonkeyFactory extends MonkeyFactory {
+
+ @Override
+ public ChaosMonkey build() {
+ return new CalmChaosMonkey();
+ }
+
+}
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/MonkeyFactory.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/MonkeyFactory.java
new file mode 100644
index 00000000000..88e1b297843
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/MonkeyFactory.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.end2end.chaos.factories;
+
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hbase.IntegrationTestingUtility;
+import org.apache.hadoop.hbase.chaos.monkies.ChaosMonkey;
+import org.apache.hadoop.hbase.util.ReflectionUtils;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
+ * Phoenix specific monkey factory. Supports a set of chaos monkeys that use
+ * hbase-it chaos actions but in combinations that make sense for Phoenix tests.
+ * For example, Phoenix utilizes multiple tables for global secondary indexes
+ * so we cannot not use monkeys that can protect only a single table while
+ * deleting others randomly. Nor can we use monkeys that mutate schema randomly.
+ * When building our monkeys we avoid such actions.
+ */
+public abstract class MonkeyFactory {
+
+ private static final Log LOG = LogFactory.getLog(MonkeyFactory.class);
+
+ public static final String CALM = "calm";
+ public static final String SLOW_DETERMINISTIC = "slowDeterministic";
+ public static final String SERVER_KILLING = "serverKilling";
+ public static final String NO_KILL = "noKill";
+
+ protected Properties properties;
+ protected IntegrationTestingUtility util;
+
+ private static Map FACTORIES = ImmutableMap.builder()
+ .put(CALM, new CalmMonkeyFactory())
+ .put(SLOW_DETERMINISTIC, new SlowDeterministicMonkeyFactory())
+ .put(SERVER_KILLING, new ServerKillingMonkeyFactory())
+ .put(NO_KILL, new NoKillMonkeyFactory())
+ .build();
+
+ public abstract ChaosMonkey build();
+
+ public MonkeyFactory setProperties(Properties props) {
+ this.properties = props;
+ return this;
+ }
+
+ public MonkeyFactory setUtil(IntegrationTestingUtility util) {
+ this.util = util;
+ return this;
+ }
+
+ public static MonkeyFactory getFactory(String factoryName) {
+ MonkeyFactory fact = FACTORIES.get(factoryName);
+ if (fact == null && factoryName != null && !factoryName.isEmpty()) {
+ Class> klass = null;
+ try {
+ klass = Class.forName(factoryName);
+ if (klass != null) {
+ fact = (MonkeyFactory) ReflectionUtils.newInstance(klass);
+ }
+ } catch (Exception e) {
+ LOG.error("Error trying to create " + factoryName + " could not load it by class name");
+ return null;
+ }
+ }
+ return fact;
+ }
+
+}
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/NoKillMonkeyFactory.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/NoKillMonkeyFactory.java
new file mode 100644
index 00000000000..1db010bde21
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/NoKillMonkeyFactory.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.end2end.chaos.factories;
+
+import org.apache.hadoop.hbase.chaos.actions.Action;
+import org.apache.hadoop.hbase.chaos.actions.DumpClusterStatusAction;
+import org.apache.hadoop.hbase.chaos.factories.MonkeyConstants;
+import org.apache.hadoop.hbase.chaos.monkies.ChaosMonkey;
+import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
+import org.apache.hadoop.hbase.chaos.policies.CompositeSequentialPolicy;
+import org.apache.hadoop.hbase.chaos.policies.DoActionsOncePolicy;
+import org.apache.hadoop.hbase.chaos.policies.PeriodicRandomActionPolicy;
+import org.apache.phoenix.end2end.chaos.actions.CompactRandomRegionOfTableAction;
+import org.apache.phoenix.end2end.chaos.actions.CompactTableAction;
+import org.apache.phoenix.end2end.chaos.actions.FlushRandomRegionOfTableAction;
+import org.apache.phoenix.end2end.chaos.actions.FlushTableAction;
+import org.apache.phoenix.end2end.chaos.actions.MergeRandomAdjacentRegionsOfTableAction;
+import org.apache.phoenix.end2end.chaos.actions.MoveRandomRegionOfTableAction;
+import org.apache.phoenix.end2end.chaos.actions.MoveRegionsOfTableAction;
+import org.apache.phoenix.end2end.chaos.actions.SnapshotTableAction;
+import org.apache.phoenix.end2end.chaos.actions.SplitAllRegionOfTableAction;
+import org.apache.phoenix.end2end.chaos.actions.SplitRandomRegionOfTableAction;
+
+public class NoKillMonkeyFactory extends MonkeyFactory {
+
+ private long action1Period;
+ private long action2Period;
+ private long action3Period;
+ private long action4Period;
+ private long moveRegionsMaxTime;
+ private long moveRegionsSleepTime;
+ private long moveRandomRegionSleepTime;
+ private float compactTableRatio;
+ private float compactRandomRegionRatio;
+
+ @Override
+ public ChaosMonkey build() {
+
+ loadProperties();
+
+ // Actions such as compact/flush a table/region,
+ // move one region around. They are not so destructive,
+ // can be executed more frequently.
+ Action[] actions1 = new Action[] {
+ new CompactTableAction(compactTableRatio),
+ new CompactRandomRegionOfTableAction(compactRandomRegionRatio),
+ new FlushTableAction(),
+ new FlushRandomRegionOfTableAction(),
+ new MoveRandomRegionOfTableAction()
+ };
+
+ // Actions such as split/merge/snapshot.
+ Action[] actions2 = new Action[] {
+ new SplitRandomRegionOfTableAction(),
+ new MergeRandomAdjacentRegionsOfTableAction(),
+ new SnapshotTableAction(),
+ };
+
+ // Destructive actions to mess things around.
+ Action[] actions3 = new Action[] {
+ new MoveRegionsOfTableAction(moveRegionsSleepTime, moveRegionsMaxTime),
+ new MoveRandomRegionOfTableAction(moveRandomRegionSleepTime),
+ new SplitAllRegionOfTableAction(),
+ };
+
+ // Action to log more info for debugging
+ Action[] actions4 = new Action[] {
+ new DumpClusterStatusAction()
+ };
+
+ return new PolicyBasedChaosMonkey(util,
+ new PeriodicRandomActionPolicy(action1Period, actions1),
+ new PeriodicRandomActionPolicy(action2Period, actions2),
+ new CompositeSequentialPolicy(
+ new DoActionsOncePolicy(action3Period, actions3),
+ new PeriodicRandomActionPolicy(action3Period, actions3)),
+ new PeriodicRandomActionPolicy(action4Period, actions4));
+ }
+
+ private void loadProperties() {
+ action1Period = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.PERIODIC_ACTION1_PERIOD,
+ MonkeyConstants.DEFAULT_PERIODIC_ACTION1_PERIOD + ""));
+ action2Period = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.PERIODIC_ACTION2_PERIOD,
+ MonkeyConstants.DEFAULT_PERIODIC_ACTION2_PERIOD + ""));
+ action3Period = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.COMPOSITE_ACTION3_PERIOD,
+ MonkeyConstants.DEFAULT_COMPOSITE_ACTION3_PERIOD + ""));
+ action4Period = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.PERIODIC_ACTION4_PERIOD,
+ MonkeyConstants.DEFAULT_PERIODIC_ACTION4_PERIOD + ""));
+ moveRegionsMaxTime = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.MOVE_REGIONS_MAX_TIME,
+ MonkeyConstants.DEFAULT_MOVE_REGIONS_MAX_TIME + ""));
+ moveRegionsSleepTime = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.MOVE_REGIONS_SLEEP_TIME,
+ MonkeyConstants.DEFAULT_MOVE_REGIONS_SLEEP_TIME + ""));
+ moveRandomRegionSleepTime = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.MOVE_RANDOM_REGION_SLEEP_TIME,
+ MonkeyConstants.DEFAULT_MOVE_RANDOM_REGION_SLEEP_TIME + ""));
+ compactTableRatio = Float.parseFloat(this.properties.getProperty(
+ MonkeyConstants.COMPACT_TABLE_ACTION_RATIO,
+ MonkeyConstants.DEFAULT_COMPACT_TABLE_ACTION_RATIO + ""));
+ compactRandomRegionRatio = Float.parseFloat(this.properties.getProperty(
+ MonkeyConstants.COMPACT_RANDOM_REGION_RATIO,
+ MonkeyConstants.DEFAULT_COMPACT_RANDOM_REGION_RATIO + ""));
+ }
+
+}
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/ServerKillingMonkeyFactory.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/ServerKillingMonkeyFactory.java
new file mode 100644
index 00000000000..520c2db473c
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/ServerKillingMonkeyFactory.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.end2end.chaos.factories;
+
+import org.apache.hadoop.hbase.chaos.actions.Action;
+import org.apache.hadoop.hbase.chaos.actions.DumpClusterStatusAction;
+import org.apache.hadoop.hbase.chaos.actions.ForceBalancerAction;
+import org.apache.hadoop.hbase.chaos.actions.RestartActiveMasterAction;
+import org.apache.hadoop.hbase.chaos.actions.RestartRandomRsAction;
+import org.apache.hadoop.hbase.chaos.actions.RestartRsHoldingMetaAction;
+import org.apache.hadoop.hbase.chaos.factories.MonkeyConstants;
+import org.apache.hadoop.hbase.chaos.monkies.ChaosMonkey;
+import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
+import org.apache.hadoop.hbase.chaos.policies.CompositeSequentialPolicy;
+import org.apache.hadoop.hbase.chaos.policies.DoActionsOncePolicy;
+import org.apache.hadoop.hbase.chaos.policies.PeriodicRandomActionPolicy;
+
+public class ServerKillingMonkeyFactory extends MonkeyFactory {
+
+ private long restartRandomRSSleepTime;
+ private long restartActiveMasterSleepTime;
+ private long restartRsHoldingMetaSleepTime;
+
+ @Override
+ public ChaosMonkey build() {
+
+ loadProperties();
+
+ // Destructive actions to mess things around. Cannot run batch restart
+ Action[] actions1 = new Action[] {
+ new RestartRandomRsAction(restartRandomRSSleepTime),
+ new RestartActiveMasterAction(restartActiveMasterSleepTime),
+ new RestartRsHoldingMetaAction(restartRsHoldingMetaSleepTime),
+ new ForceBalancerAction()
+ };
+
+ // Action to log more info for debugging
+ Action[] actions2 = new Action[] {
+ new DumpClusterStatusAction()
+ };
+
+ return new PolicyBasedChaosMonkey(util,
+ new CompositeSequentialPolicy(
+ new DoActionsOncePolicy(60 * 1000, actions1),
+ new PeriodicRandomActionPolicy(60 * 1000, actions1)),
+ new PeriodicRandomActionPolicy(60 * 1000, actions2));
+ }
+
+ private void loadProperties() {
+ restartRandomRSSleepTime = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.RESTART_RANDOM_RS_SLEEP_TIME,
+ MonkeyConstants.DEFAULT_RESTART_RANDOM_RS_SLEEP_TIME + ""));
+ restartActiveMasterSleepTime = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.RESTART_ACTIVE_MASTER_SLEEP_TIME,
+ MonkeyConstants.DEFAULT_RESTART_ACTIVE_MASTER_SLEEP_TIME + ""));
+ restartRsHoldingMetaSleepTime = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.RESTART_RS_HOLDING_META_SLEEP_TIME,
+ MonkeyConstants.DEFAULT_RESTART_RS_HOLDING_META_SLEEP_TIME + ""));
+ }
+
+}
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/SlowDeterministicMonkeyFactory.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/SlowDeterministicMonkeyFactory.java
new file mode 100644
index 00000000000..3806a33676c
--- /dev/null
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/chaos/factories/SlowDeterministicMonkeyFactory.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.phoenix.end2end.chaos.factories;
+
+import org.apache.hadoop.hbase.chaos.actions.Action;
+import org.apache.hadoop.hbase.chaos.actions.BatchRestartRsAction;
+import org.apache.hadoop.hbase.chaos.actions.DumpClusterStatusAction;
+import org.apache.hadoop.hbase.chaos.actions.RestartActiveMasterAction;
+import org.apache.hadoop.hbase.chaos.actions.RestartRandomRsAction;
+import org.apache.hadoop.hbase.chaos.actions.RestartRsHoldingMetaAction;
+import org.apache.hadoop.hbase.chaos.actions.RollingBatchRestartRsAction;
+import org.apache.hadoop.hbase.chaos.factories.MonkeyConstants;
+import org.apache.hadoop.hbase.chaos.monkies.ChaosMonkey;
+import org.apache.hadoop.hbase.chaos.monkies.PolicyBasedChaosMonkey;
+import org.apache.hadoop.hbase.chaos.policies.CompositeSequentialPolicy;
+import org.apache.hadoop.hbase.chaos.policies.DoActionsOncePolicy;
+import org.apache.hadoop.hbase.chaos.policies.PeriodicRandomActionPolicy;
+import org.apache.phoenix.end2end.chaos.actions.CompactRandomRegionOfTableAction;
+import org.apache.phoenix.end2end.chaos.actions.CompactTableAction;
+import org.apache.phoenix.end2end.chaos.actions.FlushRandomRegionOfTableAction;
+import org.apache.phoenix.end2end.chaos.actions.FlushTableAction;
+import org.apache.phoenix.end2end.chaos.actions.MergeRandomAdjacentRegionsOfTableAction;
+import org.apache.phoenix.end2end.chaos.actions.MoveRandomRegionOfTableAction;
+import org.apache.phoenix.end2end.chaos.actions.MoveRegionsOfTableAction;
+import org.apache.phoenix.end2end.chaos.actions.SnapshotTableAction;
+import org.apache.phoenix.end2end.chaos.actions.SplitAllRegionOfTableAction;
+import org.apache.phoenix.end2end.chaos.actions.SplitRandomRegionOfTableAction;
+
+public class SlowDeterministicMonkeyFactory extends MonkeyFactory {
+
+ private long action1Period;
+ private long action2Period;
+ private long action3Period;
+ private long action4Period;
+ private long moveRegionsMaxTime;
+ private long moveRegionsSleepTime;
+ private long moveRandomRegionSleepTime;
+ private long restartRandomRSSleepTime;
+ private long batchRestartRSSleepTime;
+ private float batchRestartRSRatio;
+ private long restartActiveMasterSleepTime;
+ private long rollingBatchRestartRSSleepTime;
+ private float rollingBatchRestartRSRatio;
+ private long restartRsHoldingMetaSleepTime;
+ private float compactTableRatio;
+ private float compactRandomRegionRatio;
+
+ @Override
+ public ChaosMonkey build() {
+
+ loadProperties();
+
+ // Actions such as compact/flush a table/region,
+ // move one region around. They are not so destructive,
+ // can be executed more frequently.
+ Action[] actions1 = new Action[] {
+ new CompactTableAction(compactTableRatio),
+ new CompactRandomRegionOfTableAction(compactRandomRegionRatio),
+ new FlushTableAction(),
+ new FlushRandomRegionOfTableAction(),
+ new MoveRandomRegionOfTableAction()
+ };
+
+ // Actions such as split/merge/snapshot.
+ // They should not cause data loss, or unreliability
+ // such as region stuck in transition.
+ Action[] actions2 = new Action[] {
+ new SplitRandomRegionOfTableAction(),
+ new MergeRandomAdjacentRegionsOfTableAction(),
+ new SnapshotTableAction(),
+ };
+
+ // Destructive actions to mess things around.
+ Action[] actions3 = new Action[] {
+ new MoveRegionsOfTableAction(moveRegionsSleepTime, moveRegionsMaxTime),
+ new MoveRandomRegionOfTableAction(moveRandomRegionSleepTime),
+ new RestartRandomRsAction(restartRandomRSSleepTime),
+ new BatchRestartRsAction(batchRestartRSSleepTime, batchRestartRSRatio),
+ new RestartActiveMasterAction(restartActiveMasterSleepTime),
+ new RollingBatchRestartRsAction(rollingBatchRestartRSSleepTime,
+ rollingBatchRestartRSRatio),
+ new RestartRsHoldingMetaAction(restartRsHoldingMetaSleepTime),
+ new SplitAllRegionOfTableAction(),
+ };
+
+ // Action to log more info for debugging
+ Action[] actions4 = new Action[] {
+ new DumpClusterStatusAction()
+ };
+
+ return new PolicyBasedChaosMonkey(util,
+ new PeriodicRandomActionPolicy(action1Period, actions1),
+ new PeriodicRandomActionPolicy(action2Period, actions2),
+ new CompositeSequentialPolicy(
+ new DoActionsOncePolicy(action3Period, actions3),
+ new PeriodicRandomActionPolicy(action3Period, actions3)),
+ new PeriodicRandomActionPolicy(action4Period, actions4));
+ }
+
+ private void loadProperties() {
+ action1Period = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.PERIODIC_ACTION1_PERIOD,
+ MonkeyConstants.DEFAULT_PERIODIC_ACTION1_PERIOD + ""));
+ action2Period = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.PERIODIC_ACTION2_PERIOD,
+ MonkeyConstants.DEFAULT_PERIODIC_ACTION2_PERIOD + ""));
+ action3Period = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.COMPOSITE_ACTION3_PERIOD,
+ MonkeyConstants.DEFAULT_COMPOSITE_ACTION3_PERIOD + ""));
+ action4Period = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.PERIODIC_ACTION4_PERIOD,
+ MonkeyConstants.DEFAULT_PERIODIC_ACTION4_PERIOD + ""));
+ moveRegionsMaxTime = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.MOVE_REGIONS_MAX_TIME,
+ MonkeyConstants.DEFAULT_MOVE_REGIONS_MAX_TIME + ""));
+ moveRegionsSleepTime = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.MOVE_REGIONS_SLEEP_TIME,
+ MonkeyConstants.DEFAULT_MOVE_REGIONS_SLEEP_TIME + ""));
+ moveRandomRegionSleepTime = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.MOVE_RANDOM_REGION_SLEEP_TIME,
+ MonkeyConstants.DEFAULT_MOVE_RANDOM_REGION_SLEEP_TIME + ""));
+ restartRandomRSSleepTime = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.RESTART_RANDOM_RS_SLEEP_TIME,
+ MonkeyConstants.DEFAULT_RESTART_RANDOM_RS_SLEEP_TIME + ""));
+ batchRestartRSSleepTime = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.BATCH_RESTART_RS_SLEEP_TIME,
+ MonkeyConstants.DEFAULT_BATCH_RESTART_RS_SLEEP_TIME + ""));
+ batchRestartRSRatio = Float.parseFloat(this.properties.getProperty(
+ MonkeyConstants.BATCH_RESTART_RS_RATIO,
+ MonkeyConstants.DEFAULT_BATCH_RESTART_RS_RATIO + ""));
+ restartActiveMasterSleepTime = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.RESTART_ACTIVE_MASTER_SLEEP_TIME,
+ MonkeyConstants.DEFAULT_RESTART_ACTIVE_MASTER_SLEEP_TIME + ""));
+ rollingBatchRestartRSSleepTime = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.ROLLING_BATCH_RESTART_RS_SLEEP_TIME,
+ MonkeyConstants.DEFAULT_ROLLING_BATCH_RESTART_RS_SLEEP_TIME + ""));
+ rollingBatchRestartRSRatio = Float.parseFloat(this.properties.getProperty(
+ MonkeyConstants.ROLLING_BATCH_RESTART_RS_RATIO,
+ MonkeyConstants.DEFAULT_ROLLING_BATCH_RESTART_RS_RATIO + ""));
+ restartRsHoldingMetaSleepTime = Long.parseLong(this.properties.getProperty(
+ MonkeyConstants.RESTART_RS_HOLDING_META_SLEEP_TIME,
+ MonkeyConstants.DEFAULT_RESTART_RS_HOLDING_META_SLEEP_TIME + ""));
+ compactTableRatio = Float.parseFloat(this.properties.getProperty(
+ MonkeyConstants.COMPACT_TABLE_ACTION_RATIO,
+ MonkeyConstants.DEFAULT_COMPACT_TABLE_ACTION_RATIO + ""));
+ compactRandomRegionRatio = Float.parseFloat(this.properties.getProperty(
+ MonkeyConstants.COMPACT_RANDOM_REGION_RATIO,
+ MonkeyConstants.DEFAULT_COMPACT_RANDOM_REGION_RATIO + ""));
+ }
+
+}
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/ReadOnlyProps.java b/phoenix-core/src/main/java/org/apache/phoenix/util/ReadOnlyProps.java
index d6950a20ca4..05b89ac8229 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/ReadOnlyProps.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/ReadOnlyProps.java
@@ -33,7 +33,6 @@
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.Maps;
/**
@@ -320,4 +319,18 @@ public ReadOnlyProps addAll(Properties overrides) {
}
return this;
}
+
+ /**
+ * Converts these read-only properties into a java.util.Properties object.
+ * @return Java properties
+ */
+ public Properties toProperties() {
+ Properties props = new Properties();
+ Iterator> i = iterator();
+ while (i.hasNext()) {
+ Entry e = i.next();
+ props.put(e.getKey(), e.getValue());
+ }
+ return props;
+ }
}