You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by si...@apache.org on 2023/02/01 23:48:56 UTC

[ozone] branch HDDS-6517-Snapshot updated: HDDS-7861. [Snapshot] Delete keys from the source bucket to fix the flakiness of snapshot restore tests (#4230)

This is an automated email from the ASF dual-hosted git repository.

siyao pushed a commit to branch HDDS-6517-Snapshot
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/HDDS-6517-Snapshot by this push:
     new afa6030b90 HDDS-7861. [Snapshot] Delete keys from the source bucket to fix the flakiness of snapshot restore tests (#4230)
afa6030b90 is described below

commit afa6030b9056332ab108e9e8587fa6ab2a0d12a9
Author: Hemant Kumar <he...@gmail.com>
AuthorDate: Wed Feb 1 15:48:49 2023 -0800

    HDDS-7861. [Snapshot] Delete keys from the source bucket to fix the flakiness of snapshot restore tests (#4230)
---
 .../om/snapshot/TestOzoneSnapshotRestore.java      | 30 +++++++++++++++++-----
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestOzoneSnapshotRestore.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestOzoneSnapshotRestore.java
index d61efd7d8b..55db121ab2 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestOzoneSnapshotRestore.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestOzoneSnapshotRestore.java
@@ -220,8 +220,9 @@ public class TestOzoneSnapshotRestore {
     Assertions.assertEquals(0, delKeyCount);
 
     String sourcePath = OM_KEY_PREFIX + volume + OM_KEY_PREFIX + bucket
-            + OM_KEY_PREFIX + snapshotKeyPrefix;
-    String destPath = OM_KEY_PREFIX + volume + OM_KEY_PREFIX + bucket;
+        + OM_KEY_PREFIX + snapshotKeyPrefix;
+    String destPath = OM_KEY_PREFIX + volume + OM_KEY_PREFIX + bucket
+        + OM_KEY_PREFIX;
 
     for (int i = 0; i < 5; i++) {
       keyCopy(sourcePath + keyPrefix + i, destPath);
@@ -258,9 +259,25 @@ public class TestOzoneSnapshotRestore {
     int volBucketKeyCount = keyCount(buck, snapshotKeyPrefix + keyPrefix);
     Assertions.assertEquals(5, volBucketKeyCount);
 
+    // Delete keys from the source bucket.
+    // This is temporary fix to make sure that test passes all the time.
+    // If we don't delete keys from the source bucket, copy command
+    // will fail. In copy command, there is a check to make sure that key
+    // doesn't exist in the destination bucket.
+    // Problem is that RocksDB's seek operation doesn't 100% guarantee that
+    // item key is available. Tho we believe that it is in
+    // `createFakeDirIfShould` function. When we seek if there is a directory
+    // for the key name, sometime it returns non-null response but in reality
+    // item doesn't exist.
+    // In the case when seek returns non-null response, "key doesn't exist in
+    // the destination bucket" check fails because getFileStatus returns
+    // dir with key name exists.
+    deleteKeys(buck);
+
     String sourcePath = OM_KEY_PREFIX + volume + OM_KEY_PREFIX + bucket
-            + OM_KEY_PREFIX + snapshotKeyPrefix;
-    String destPath = OM_KEY_PREFIX + volume + OM_KEY_PREFIX + bucket2;
+        + OM_KEY_PREFIX + snapshotKeyPrefix;
+    String destPath = OM_KEY_PREFIX + volume + OM_KEY_PREFIX + bucket2
+        + OM_KEY_PREFIX;
 
     for (int i = 0; i < 5; i++) {
       keyCopy(sourcePath + keyPrefix + i, destPath);
@@ -302,8 +319,9 @@ public class TestOzoneSnapshotRestore {
     Assertions.assertEquals(5, volBucketKeyCount);
 
     String sourcePath = OM_KEY_PREFIX + volume + OM_KEY_PREFIX + bucket
-            + OM_KEY_PREFIX + snapshotKeyPrefix;
-    String destPath = OM_KEY_PREFIX + volume + OM_KEY_PREFIX + bucket2;
+        + OM_KEY_PREFIX + snapshotKeyPrefix;
+    String destPath = OM_KEY_PREFIX + volume + OM_KEY_PREFIX + bucket2
+        + OM_KEY_PREFIX;
 
     for (int i = 0; i < 5; i++) {
       keyCopy(sourcePath + keyPrefix + i, destPath);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org