HDDS-1426. Minor logging improvements for MiniOzoneChaosCluster

Closes #730
This commit is contained in:
Arpit Agarwal 2019-04-12 11:34:43 +02:00 committed by Márton Elek
parent 3b08ac4659
commit fd676e190a
No known key found for this signature in database
GPG Key ID: D51EA8F00EE79B28
2 changed files with 8 additions and 3 deletions

View File

@ -15,7 +15,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
date=`date +"%m-%d-%y-%T"`
date=`date +"%Y-%m-%d--%H-%M-%S-%Z"`
fileformat=".MiniOzoneChaosCluster.log"
heapformat=".dump"
current="/tmp/"

View File

@ -87,11 +87,15 @@ private int getNodeToFail() {
}
private void failNodes() {
for (int i = 0; i < getNumberOfNodesToFail(); i++) {
final int numNodesToFail = getNumberOfNodesToFail();
LOG.info("Will restart {} nodes to simulate failure", numNodesToFail);
for (int i = 0; i < numNodesToFail; i++) {
boolean failureMode = isFastRestart();
int failedNodeIndex = getNodeToFail();
try {
LOG.info("Restarting DataNodeIndex {}", failedNodeIndex);
restartHddsDatanode(failedNodeIndex, failureMode);
LOG.info("Completed restarting DataNodeIndex {}", failedNodeIndex);
} catch (Exception e) {
}
@ -118,7 +122,8 @@ private void fail() {
}
void startChaos(long initialDelay, long period, TimeUnit timeUnit) {
LOG.info("Starting Chaos with failure period:{} unit:{}", period, timeUnit);
LOG.info("Starting Chaos with failure period:{} unit:{} numDataNodes:{}",
period, timeUnit, numDatanodes);
scheduledFuture = executorService.scheduleAtFixedRate(this::fail,
initialDelay, period, timeUnit);
}