From 3de8a639b2350e956ef92160c7d223858d79166f Mon Sep 17 00:00:00 2001 From: Arpit Agarwal Date: Thu, 11 Apr 2019 14:42:01 -0700 Subject: [PATCH] HDDS-1426. Minor logging improvements for MiniOzoneChaosCluster. Contributed by Arpit Agarwal. Change-Id: Ied04ad29348d012366c7018ed9009890a37bb4d2 --- .../integration-test/src/test/bin/start-chaos.sh | 2 +- .../org/apache/hadoop/ozone/MiniOzoneChaosCluster.java | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hadoop-ozone/integration-test/src/test/bin/start-chaos.sh b/hadoop-ozone/integration-test/src/test/bin/start-chaos.sh index 63e4a95a6a6e9..d98e9ca9770b9 100755 --- a/hadoop-ozone/integration-test/src/test/bin/start-chaos.sh +++ b/hadoop-ozone/integration-test/src/test/bin/start-chaos.sh @@ -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/" diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneChaosCluster.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneChaosCluster.java index 52a2d40abc289..8bef479419c6f 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneChaosCluster.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/MiniOzoneChaosCluster.java @@ -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); }