49
49
import java .util .concurrent .atomic .AtomicLong ;
50
50
import java .util .stream .Collectors ;
51
51
import org .apache .commons .compress .utils .Lists ;
52
- import org .apache .hadoop .hdds .client .ReplicationConfig ;
53
- import org .apache .hadoop .hdds .client .ReplicationFactor ;
54
- import org .apache .hadoop .hdds .client .ReplicationType ;
55
52
import org .apache .hadoop .hdds .conf .OzoneConfiguration ;
56
53
import org .apache .hadoop .hdds .conf .StorageUnit ;
57
54
import org .apache .hadoop .hdds .utils .IOUtils ;
@@ -202,10 +199,8 @@ public void testMultipleSnapshotKeyReclaim() throws Exception {
202
199
OzoneBucket bucket2 = TestDataUtil .createBucket (
203
200
client , VOLUME_NAME , bucketArgs , BUCKET_NAME_TWO );
204
201
// Create key1 and key2
205
- TestDataUtil .createKey (bucket2 , "bucket2key1" , ReplicationConfig .
206
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ), CONTENT .array ());
207
- TestDataUtil .createKey (bucket2 , "bucket2key2" , ReplicationConfig .
208
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ), CONTENT .array ());
202
+ TestDataUtil .createKey (bucket2 , "bucket2key1" , CONTENT .array ());
203
+ TestDataUtil .createKey (bucket2 , "bucket2key2" , CONTENT .array ());
209
204
210
205
// Create Snapshot
211
206
client .getObjectStore ().createSnapshot (VOLUME_NAME , BUCKET_NAME_TWO ,
@@ -265,16 +260,12 @@ public void testSnapshotWithFSO() throws Exception {
265
260
266
261
// Create 10 keys
267
262
for (int i = 1 ; i <= 10 ; i ++) {
268
- TestDataUtil .createKey (bucket2 , "key" + i , ReplicationConfig .
269
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ),
270
- CONTENT .array ());
263
+ TestDataUtil .createKey (bucket2 , "key" + i , CONTENT .array ());
271
264
}
272
265
273
266
// Create 5 keys to overwrite
274
267
for (int i = 11 ; i <= 15 ; i ++) {
275
- TestDataUtil .createKey (bucket2 , "key" + i , ReplicationConfig .
276
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ),
277
- CONTENT .array ());
268
+ TestDataUtil .createKey (bucket2 , "key" + i , CONTENT .array ());
278
269
}
279
270
280
271
// Create Directory and Sub
@@ -287,8 +278,7 @@ public void testSnapshotWithFSO() throws Exception {
287
278
String childDir = "/childDir" + j ;
288
279
client .getProxy ().createDirectory (VOLUME_NAME ,
289
280
BUCKET_NAME_FSO , parent + childDir );
290
- TestDataUtil .createKey (bucket2 , parent + childFile , ReplicationConfig .
291
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ), CONTENT .array ());
281
+ TestDataUtil .createKey (bucket2 , parent + childFile , CONTENT .array ());
292
282
}
293
283
}
294
284
@@ -304,8 +294,7 @@ public void testSnapshotWithFSO() throws Exception {
304
294
305
295
// Overwrite 3 keys -> Moves previous version to deletedTable
306
296
for (int i = 11 ; i <= 13 ; i ++) {
307
- TestDataUtil .createKey (bucket2 , "key" + i , ReplicationConfig .
308
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ), CONTENT .array ());
297
+ TestDataUtil .createKey (bucket2 , "key" + i , CONTENT .array ());
309
298
}
310
299
assertTableRowCount (keyTable , 24 );
311
300
@@ -369,9 +358,7 @@ public void testSnapshotWithFSO() throws Exception {
369
358
370
359
// Overwrite 2 keys
371
360
for (int i = 14 ; i <= 15 ; i ++) {
372
- TestDataUtil .createKey (bucket2 , "key" + i , ReplicationConfig .
373
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ),
374
- CONTENT .array ());
361
+ TestDataUtil .createKey (bucket2 , "key" + i , CONTENT .array ());
375
362
}
376
363
377
364
// Delete 2 more keys
@@ -727,12 +714,8 @@ private synchronized void createSnapshotDataForBucket(OzoneBucket bucket) throws
727
714
OmMetadataManagerImpl metadataManager = (OmMetadataManagerImpl )
728
715
om .getMetadataManager ();
729
716
730
- TestDataUtil .createKey (bucket , bucket .getName () + "key0" , ReplicationConfig .
731
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ),
732
- CONTENT .array ());
733
- TestDataUtil .createKey (bucket , bucket .getName () + "key1" , ReplicationConfig .
734
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ),
735
- CONTENT .array ());
717
+ TestDataUtil .createKey (bucket , bucket .getName () + "key0" , CONTENT .array ());
718
+ TestDataUtil .createKey (bucket , bucket .getName () + "key1" , CONTENT .array ());
736
719
assertTableRowCount (keyTable , 2 );
737
720
738
721
// Create Snapshot 1.
@@ -742,10 +725,8 @@ private synchronized void createSnapshotDataForBucket(OzoneBucket bucket) throws
742
725
743
726
// Overwrite bucket1key0, This is a newer version of the key which should
744
727
// reclaimed as this is a different version of the key.
745
- TestDataUtil .createKey (bucket , bucket .getName () + "key0" , ReplicationConfig .
746
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ), CONTENT .array ());
747
- TestDataUtil .createKey (bucket , bucket .getName () + "key2" , ReplicationConfig .
748
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ), CONTENT .array ());
728
+ TestDataUtil .createKey (bucket , bucket .getName () + "key0" , CONTENT .array ());
729
+ TestDataUtil .createKey (bucket , bucket .getName () + "key2" , CONTENT .array ());
749
730
750
731
// Key 1 cannot be reclaimed as it is still referenced by Snapshot 1.
751
732
client .getProxy ().deleteKey (bucket .getVolumeName (), bucket .getName (),
@@ -769,10 +750,8 @@ private synchronized void createSnapshotDataForBucket(OzoneBucket bucket) throws
769
750
// deletedTable when Snapshot 2 is taken.
770
751
assertTableRowCount (deletedTable , 0 );
771
752
772
- TestDataUtil .createKey (bucket , bucket .getName () + "key3" , ReplicationConfig .
773
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ), CONTENT .array ());
774
- TestDataUtil .createKey (bucket , bucket .getName () + "key4" , ReplicationConfig .
775
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ), CONTENT .array ());
753
+ TestDataUtil .createKey (bucket , bucket .getName () + "key3" , CONTENT .array ());
754
+ TestDataUtil .createKey (bucket , bucket .getName () + "key4" , CONTENT .array ());
776
755
client .getProxy ().deleteKey (bucket .getVolumeName (), bucket .getName (),
777
756
bucket .getName () + "key4" , false );
778
757
assertTableRowCount (keyTable , 1 );
@@ -832,19 +811,15 @@ private synchronized void createSnapshotFSODataForBucket(OzoneBucket bucket) thr
832
811
throw new RuntimeException (ex );
833
812
}
834
813
}));
835
- TestDataUtil .createKey (bucket , "dir0/" + bucket .getName () + "key0" , ReplicationConfig .
836
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ), CONTENT .array ());
837
- TestDataUtil .createKey (bucket , "dir1/" + bucket .getName () + "key1" , ReplicationConfig .
838
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ), CONTENT .array ());
814
+ TestDataUtil .createKey (bucket , "dir0/" + bucket .getName () + "key0" , CONTENT .array ());
815
+ TestDataUtil .createKey (bucket , "dir1/" + bucket .getName () + "key1" , CONTENT .array ());
839
816
assertTableRowCount (keyTable , countMap .get (keyTable .getName ()) + 2 );
840
817
assertTableRowCount (dirTable , countMap .get (dirTable .getName ()) + 2 );
841
818
842
819
// Overwrite bucket1key0, This is a newer version of the key which should
843
820
// reclaimed as this is a different version of the key.
844
- TestDataUtil .createKey (bucket , "dir0/" + bucket .getName () + "key0" , ReplicationConfig .
845
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ), CONTENT .array ());
846
- TestDataUtil .createKey (bucket , "dir2/" + bucket .getName () + "key2" , ReplicationConfig .
847
- fromTypeAndFactor (ReplicationType .RATIS , ReplicationFactor .THREE ), CONTENT .array ());
821
+ TestDataUtil .createKey (bucket , "dir0/" + bucket .getName () + "key0" , CONTENT .array ());
822
+ TestDataUtil .createKey (bucket , "dir2/" + bucket .getName () + "key2" , CONTENT .array ());
848
823
assertTableRowCount (keyTable , countMap .get (keyTable .getName ()) + 3 );
849
824
assertTableRowCount (dirTable , countMap .get (dirTable .getName ()) + 3 );
850
825
assertTableRowCount (deletedTable , countMap .get (deletedTable .getName ()) + 1 );
0 commit comments