sarvekshayr commented on code in PR #8810:
URL: https://github.com/apache/ozone/pull/8810#discussion_r2219014314
##########
hadoop-ozone/dist/src/main/compose/ozonesecure-ha/test-repair-tools.sh:
##########
@@ -40,6 +40,54 @@ create_data_dirs dn{1..5} kms om{1..3} recon s3g scm{1..3}
start_docker_env
+repair_and_restart_om() {
+ local om_container="$1"
+ local om_id="$2"
+ echo "Waiting for container '${om_container}' to stop..."
+ # Loop until the container is not running
+ timeout=60 # seconds
+ start_time=$(date +%s)
+ while [ "$(docker inspect -f '{{.State.Running}}' "${om_container}"
2>/dev/null)" == "true" ]; do
+ current_time=$(date +%s)
+ elapsed=$((current_time - start_time))
+
+ if [ "$elapsed" -ge "$timeout" ]; then
+ echo "Timeout: Container '${om_container}' did not stop within
${timeout} seconds."
+ exit 1
+ fi
+ sleep 1
+ done
+ echo "Container '${om_container}' has stopped."
+
+ logpath=$(execute_command_in_container ${SCM} bash -c "find / -type f -path
'/*/$om_id/*/log_inprogress_0' 2>/dev/null | head -n 1")
+ echo "Ratis log segment file path: ${logpath}"
+
+ execute_command_in_container ${SCM} bash -c "ozone repair om srt
-b=/opt/hadoop/compose/ozonesecure-ha/data/$om_id/backup1 --index=2
-s=${logpath}"
+ echo "Repair command executed for ${om_id}."
+ docker start "${om_container}"
+ echo "Container '${om_container}' started again."
+ bucketTable=$(execute_command_in_container ${SCM} bash -c "ozone debug ldb
--db=/opt/hadoop/compose/ozonesecure-ha/data/$om_id/metadata/om.db scan
--cf=bucketTable")
+ echo "Bucket table for ${om_id}:"
+ if echo "$bucketTable" | grep -q "bucket-crash-1"; then
+ echo "bucket 'bucket-crash-1' should not have been created, but it is
present in the bucketTable of $om_id"
+ exit 1
+ else
+ echo "bucket 'bucket-crash-1' is not present in the bucketTable of $om_id
as expected."
+ fi
+}
+
+# Test for repairing a ratis transaction
+execute_robot_test ${SCM} kinit.robot
+execute_robot_test ${SCM} repair/ratis-transaction-repair.robot
Review Comment:
Can we add this line (or something similar) before we execute
`repair_and_restart_om`?
```
echo "Testing ratis transcation repair on all OMs"
```
##########
hadoop-ozone/dist/src/main/smoketest/repair/ratis-transaction-repair.robot:
##########
@@ -0,0 +1,34 @@
+# 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.
+
+*** Settings ***
+Documentation Test recovering from OM crash due to transaction failure
+Library OperatingSystem
+Library BuiltIn
+Library Process
+Resource ../lib/os.robot
+Resource ../ozone-fi/BytemanKeywords.robot
+
+*** Variables ***
+${VOLUME} test-txn-vol
+${BAD_BUCKET} bucket-crash-1
+${CRASH_RULE} /opt/hadoop/share/ozone/byteman/fail-create-bucket.btm
+${TIMEOUT} 10 seconds
+
+*** Test Cases ***
+Verify OM crash at bucket create
+ Inject Fault Into OMs Only ${CRASH_RULE}
+ Execute ozone sh volume create o3://${OM_SERVICE_ID}/${VOLUME}
+ Run Process ozone sh bucket create
o3://${OM_SERVICE_ID}/${VOLUME}/${BAD_BUCKET} timeout=${TIMEOUT}
shell=True
Review Comment:
It's important to remove the fault injection from all OMs. While it may
appear to work due to the OM restart performed later in `test-repair-tools.sh`,
it's safer and more robust to explicitly remove the fault.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]