001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.chaos.factories; 019 020import java.util.Arrays; 021import java.util.HashSet; 022import java.util.Set; 023import java.util.concurrent.TimeUnit; 024 025public interface MonkeyConstants { 026 027 String PERIODIC_ACTION1_PERIOD = "sdm.action1.period"; 028 String PERIODIC_ACTION2_PERIOD = "sdm.action2.period"; 029 String PERIODIC_ACTION4_PERIOD = "sdm.action4.period"; 030 String COMPOSITE_ACTION3_PERIOD = "sdm.action3.period"; 031 String MOVE_REGIONS_MAX_TIME = "move.regions.max.time"; 032 String MOVE_REGIONS_SLEEP_TIME = "move.regions.sleep.time"; 033 String MOVE_RANDOM_REGION_SLEEP_TIME = "move.randomregion.sleep.time"; 034 String RESTART_RANDOM_RS_SLEEP_TIME = "restart.random.rs.sleep.time"; 035 String BATCH_RESTART_RS_SLEEP_TIME = "batch.restart.rs.sleep.time"; 036 String BATCH_RESTART_RS_RATIO = "batch.restart.rs.ratio"; 037 String RESTART_ACTIVE_MASTER_SLEEP_TIME = "restart.active.master.sleep.time"; 038 String ROLLING_BATCH_RESTART_RS_SLEEP_TIME = "rolling.batch.restart.rs.sleep.time"; 039 String ROLLING_BATCH_RESTART_RS_RATIO = "rolling.batch.restart.rs.ratio"; 040 String RESTART_RS_HOLDING_META_SLEEP_TIME = "restart.rs.holding.meta.sleep.time"; 041 String COMPACT_TABLE_ACTION_RATIO = "compact.table.ratio"; 042 String COMPACT_RANDOM_REGION_RATIO = "compact.random.region.ratio"; 043 String UNBALANCE_CHAOS_EVERY_MS = "unbalance.chaos.period"; 044 String UNBALANCE_WAIT_FOR_UNBALANCE_MS = "unbalance.action.wait.period"; 045 String UNBALANCE_WAIT_FOR_KILLS_MS = "unbalance.action.kill.period"; 046 String UNBALANCE_WAIT_AFTER_BALANCE_MS = "unbalance.action.wait.after.period"; 047 String UNBALANCE_KILL_META_RS = "unbalance.action.kill.meta.rs"; 048 String DECREASE_HFILE_SIZE_SLEEP_TIME = "decrease.hfile.size.sleep.time"; 049 String RESTART_RANDOM_RS_EXCEPTION_SLEEP_TIME = "restart.random.rs.exception.sleep.time"; 050 String RESTART_ACTIVE_NAMENODE_SLEEP_TIME = "restart.active.namenode.sleep.time"; 051 String RESTART_RANDOM_DATANODE_SLEEP_TIME = "restart.random.datanode.sleep.time"; 052 String RESTART_RANDOM_JOURNALNODE_SLEEP_TIME = "restart.random.journalnode.sleep.time"; 053 String RESTART_RANDOM_ZKNODE_SLEEP_TIME = "restart.random.zknode.sleep.time"; 054 String GRACEFUL_RESTART_RS_SLEEP_TIME = "graceful.restart.rs.sleep.time"; 055 String ROLLING_BATCH_SUSPEND_RS_SLEEP_TIME = "rolling.batch.suspend.rs.sleep.time"; 056 String ROLLING_BATCH_SUSPEND_RS_RATIO = "rolling.batch.suspend.rs.ratio"; 057 String SKIP_META_RS = "skip.meta.rs"; 058 String CPU_LOAD_DURATION = "cpu.load.duration"; 059 String CPU_LOAD_PROCESSES = "cpu.load.processes"; 060 String NETWORK_ISSUE_COMMAND_TIMEOUT = "network.issue.command.timeout"; 061 String NETWORK_ISSUE_DURATION = "network.issueduration"; 062 String NETWORK_ISSUE_RATIO = "network.issue.ratio"; 063 String NETWORK_ISSUE_DELAY = "network.issue.delay"; 064 String NETWORK_ISSUE_INTERFACE = "network.issue.interface"; 065 // should be higher than the usual timeout because the target machine might respond slowly 066 String FILL_DISK_COMMAND_TIMEOUT = "fill.disk.command.timeout"; 067 String FILL_DISK_PATH = "fill.disk.path"; 068 String FILL_DISK_FILE_SIZE = "fill.disk.file.size"; 069 String FILL_DISK_ISSUE_DURATION = "fill.disk.issue.duration"; 070 String DATA_ISSUE_CHANCE = "data.issue.chance"; 071 String SNAPSHOT_TABLE_TTL = "snapshot.table.ttl"; 072 073 /** 074 * A Set of prefixes which encompasses all of the configuration properties for the ChaosMonky. 075 */ 076 Set<String> MONKEY_CONFIGURATION_KEY_PREFIXES = new HashSet<>(Arrays.asList("sdm.", "move.", 077 "restart.", "batch.", "rolling.", "compact.", "unbalance.", "decrease.", "decrease.", 078 "graceful.", "cpu.", "network.", "fill.", "data.", "snapshot.", "skip")); 079 080 long DEFAULT_PERIODIC_ACTION1_PERIOD = 60 * 1000; 081 long DEFAULT_PERIODIC_ACTION2_PERIOD = 90 * 1000; 082 long DEFAULT_PERIODIC_ACTION4_PERIOD = 90 * 1000; 083 long DEFAULT_COMPOSITE_ACTION3_PERIOD = 150 * 1000; 084 long DEFAULT_MOVE_REGIONS_MAX_TIME = 10 * 60 * 1000; 085 long DEFAULT_MOVE_REGIONS_SLEEP_TIME = 800; 086 long DEFAULT_MOVE_RANDOM_REGION_SLEEP_TIME = 800; 087 long DEFAULT_RESTART_RANDOM_RS_SLEEP_TIME = 60000; 088 long DEFAULT_BATCH_RESTART_RS_SLEEP_TIME = 5000; 089 float DEFAULT_BATCH_RESTART_RS_RATIO = 0.5f; 090 long DEFAULT_RESTART_ACTIVE_MASTER_SLEEP_TIME = 5000; 091 long DEFAULT_ROLLING_BATCH_RESTART_RS_SLEEP_TIME = 5000; 092 float DEFAULT_ROLLING_BATCH_RESTART_RS_RATIO = 1.0f; 093 long DEFAULT_RESTART_RS_HOLDING_META_SLEEP_TIME = 35000; 094 float DEFAULT_COMPACT_TABLE_ACTION_RATIO = 0.5f; 095 float DEFAULT_COMPACT_RANDOM_REGION_RATIO = 0.6f; 096 long DEFAULT_UNBALANCE_CHAOS_EVERY_MS = 65 * 1000; 097 long DEFAULT_UNBALANCE_WAIT_FOR_UNBALANCE_MS = 2 * 1000; 098 long DEFAULT_UNBALANCE_WAIT_FOR_KILLS_MS = 2 * 1000; 099 long DEFAULT_UNBALANCE_WAIT_AFTER_BALANCE_MS = 5 * 1000; 100 boolean DEFAULT_UNBALANCE_KILL_META_RS = true; 101 long DEFAULT_DECREASE_HFILE_SIZE_SLEEP_TIME = 30 * 1000; 102 103 long DEFAULT_RESTART_RANDOM_RS_EXCEPTION_SLEEP_TIME = TimeUnit.MILLISECONDS.toMillis(60000); 104 long DEFAULT_RESTART_ACTIVE_NAMENODE_SLEEP_TIME = TimeUnit.MILLISECONDS.toMillis(60000); 105 long DEFAULT_RESTART_RANDOM_DATANODE_SLEEP_TIME = TimeUnit.MILLISECONDS.toMillis(60000); 106 long DEFAULT_RESTART_RANDOM_JOURNALNODE_SLEEP_TIME = TimeUnit.MILLISECONDS.toMillis(60000); 107 long DEFAULT_RESTART_RANDOM_ZKNODE_SLEEP_TIME = TimeUnit.MILLISECONDS.toMillis(60000); 108 109 long DEFAULT_GRACEFUL_RESTART_RS_SLEEP_TIME = 5000; 110 long DEFAULT_ROLLING_BATCH_SUSPEND_RS_SLEEP_TIME = 30 * 1000; 111 float DEFAULT_ROLLING_BATCH_SUSPEND_RS_RATIO = 1.0f; 112 boolean DEFAULT_SKIP_META_RS = false; 113 long DEFAULT_CPU_LOAD_DURATION = 5 * 60 * 1000; 114 long DEFAULT_CPU_LOAD_PROCESSES = 2; 115 long DEFAULT_NETWORK_ISSUE_COMMAND_TIMEOUT = 30 * 1000; 116 long DEFAULT_NETWORK_ISSUE_DURATION = 60 * 1000; 117 float DEFAULT_NETWORK_ISSUE_RATIO = 0.1f; 118 long DEFAULT_NETWORK_ISSUE_DELAY = 100; 119 String DEFAULT_NETWORK_ISSUE_INTERFACE = "eth0"; 120 long DEFAULT_FILL_DISK_COMMAND_TIMEOUT = 60 * 1000; 121 String DEFAULT_FILL_DISK_PATH = "/tmp"; 122 long DEFAULT_FILL_DISK_FILE_SIZE = 0; 123 long DEFAULT_FILL_DISK_ISSUE_DURATION = 5 * 60 * 1000; 124 float DEFAULT_DATA_ISSUE_CHANCE = 0.01f; 125 long DEFAULT_SNAPSHOT_TABLE_TTL = -1L; 126}