swamirishi commented on code in PR #5035:
URL: https://github.com/apache/ozone/pull/5035#discussion_r1262587881
##########
hadoop-hdds/managed-rocksdb/src/main/java/org/apache/hadoop/hdds/utils/db/managed/ManagedRocksObjectUtils.java:
##########
@@ -64,4 +73,46 @@ static String formatStackTrace(StackTraceElement[] elements)
{
return HddsUtils.formatStackTrace(elements, 3);
}
+ /**
+ * Wait for file to be deleted.
+ * @param file File to be deleted.
+ * @param maxDuration poll max duration.
+ * @param interval poll interval.
+ * @param pollDelayDuration poll delay val.
+ * @return true if deleted.
+ */
+ public static void waitForFileDelete(File file, Duration maxDuration,
+ Duration interval,
+ Duration pollDelayDuration)
+ throws IOException {
+ Instant start = Instant.now();
+ try {
+ Awaitility.with().atMost(maxDuration)
+ .pollDelay(pollDelayDuration)
+ .pollInterval(interval)
+ .await()
+ .until(() -> !file.exists());
+ LOG.info("Waited for {} milliseconds for file {} deletion.",
+ Duration.between(start, Instant.now()).toMillis(),
+ file.getAbsoluteFile());
+ } catch (ConditionTimeoutException exception) {
+ LOG.info("File: {} didn't get deleted in {} secs.",
+ file.getAbsolutePath(), maxDuration.getSeconds());
+ throw new IOException(exception);
+ }
+ }
+
+ /**
+ * Wait for file to be deleted.
+ * @param file File to be deleted.
+ * @param maxDuration poll max duration.
+ * @throws IOException in case of failure.
+ */
+ public static void waitForFileDelete(File file, Duration maxDuration)
+ throws IOException {
+ waitForFileDelete(file, maxDuration, POLL_INTERVAL_DURATION,
+ POLL_DELAY_DURATION);
+ }
+
+
Review Comment:
done
--
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]