Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,9 @@ public void testRestoreSnapshot(BucketLayout bucketLayoutTest)
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);
Expand Down Expand Up @@ -258,9 +259,25 @@ public void testRestoreSnapshotDifferentBucket(BucketLayout bucketLayoutTest)
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);
Expand Down Expand Up @@ -302,8 +319,9 @@ public void testRestoreSnapshotDifferentBucketLayout(
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);
Expand Down