sarvekshayr commented on code in PR #11173:
URL: https://github.com/apache/ozone/pull/11173#discussion_r3903497432


##########
hadoop-ozone/dist/src/main/compose/ozonesecure-ha/test-repair-tools.sh:
##########
@@ -103,7 +103,54 @@ execute_command_in_container ${OM} ozone fs -rm -R 
-skipTrash ofs://${OM_SERVICE
 
 get_om_db_size() {
   execute_command_in_container ${OM} find /data/metadata/om.db -name '*.sst' 
-exec du -b {} + \
-      | awk '{ sum += $1}  END { print sum }'
+      | awk '{ sum += $1 } END { print sum + 0 }'
+}
+
+get_cf_entry_count() {
+  local cf="$1"
+  execute_command_in_container ${OM} bash -c \
+      "ozone debug ldb --db=/data/metadata/om.db scan --cf=${cf} --count 
2>/dev/null" \
+      | tr -d '[:space:]'
+}
+
+wait_for_bucket_deletion_complete() {
+  local timeout=300 n cf
+  local cfs=(fileTable directoryTable deletedTable deletedDirectoryTable)
+  SECONDS=0
+  while [[ $SECONDS -lt $timeout ]]; do
+    for cf in "${cfs[@]}"; do
+      n=$(get_cf_entry_count "${cf}")
+      [[ "${n:-1}" -eq 0 ]] || continue 2
+    done
+    return 0
+    sleep 3

Review Comment:
   `sleep 3` is unreachable because it comes after `return 0`. The retry loop 
currently has no delay between polling attempts. Let's either move the `sleep` 
into the retry check or drop it if no delay is required as the test is passing.



-- 
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]

Reply via email to