Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
ae21878
HDDS-13159. Refactor KeyManagerImpl for getting deleted subdirectorie…
swamirishi May 31, 2025
cd0157b
HDDS-13159. Static Import KeyValue
swamirishi May 31, 2025
4c73e3a
HDDS-13034. Refactor Directory Deleting Service to use ReclaimableDir…
swamirishi Jun 3, 2025
d14e83d
HDDS-13034. Fix pmd
swamirishi Jun 3, 2025
735903c
HDDS-13160. Remove SnapshotDirectoryCleaningService and refactor Abst…
swamirishi Jun 3, 2025
034585b
HDDS-13170. Reclaimable filter should always reclaim entries when buc…
swamirishi Jun 3, 2025
7eb2b98
HDDS-13160. Fix tests
swamirishi Jun 3, 2025
1fe3cfc
HDDS-13034. Fix find bugs
swamirishi Jun 3, 2025
99b61a2
HDDS-13034. Fix find bugs
swamirishi Jun 3, 2025
75c3891
Merge remote-tracking branch 'origin/HDDS-13034' into HEAD
swamirishi Jun 3, 2025
9df1494
HDDS-13160. Remove Snapshot directory cleaning service
swamirishi Jun 3, 2025
effdf71
HDDS-13160. Fix checkstyle
swamirishi Jun 3, 2025
29d2619
HDDS-13034. deprecate config instead of removing
swamirishi Jun 3, 2025
f18dcc2
Merge remote-tracking branch 'origin/HDDS-13034' into HEAD
swamirishi Jun 3, 2025
806111c
HDDS-13160. Fix function access
swamirishi Jun 3, 2025
4867d7d
HDDS-13035. Snapshot Deleting Service should hold write locks while p…
swamirishi Jun 3, 2025
6db570e
Merge remote-tracking branch 'apache/master' into HEAD
swamirishi Jun 5, 2025
a9cd247
Merge remote-tracking branch 'origin/HDDS-13034' into HEAD
swamirishi Jun 5, 2025
3e8db11
Merge remote-tracking branch 'origin/HDDS-13160' into HEAD
swamirishi Jun 5, 2025
2db371d
HDDS-13034. refactor test case
swamirishi Jun 5, 2025
4fc7d34
Merge remote-tracking branch 'origin/HDDS-13034' into HEAD
swamirishi Jun 5, 2025
464e321
HDDS-13034. Fix test case
swamirishi Jun 5, 2025
0ecec31
HDDS-13034. Fix test case
swamirishi Jun 5, 2025
1e9896b
HDDS-13160. Suspend should wait
swamirishi Jun 6, 2025
968d90a
HDDS-13035. Fix test
swamirishi Jun 6, 2025
c12a36e
HDDS-13034. Fix test
swamirishi Jun 6, 2025
e8bdecc
Merge remote-tracking branch 'origin/HDDS-13034' into HEAD
swamirishi Jun 6, 2025
b53430a
Merge remote-tracking branch 'origin/HDDS-13160' into HEAD
swamirishi Jun 6, 2025
72fc541
HDDS-13034. Fix test
swamirishi Jun 6, 2025
a03d498
Merge remote-tracking branch 'origin/HDDS-13034' into HEAD
swamirishi Jun 6, 2025
847dab7
HDDS-13160. Fix test
swamirishi Jun 6, 2025
b77c025
HDDS-13160. Fix test
swamirishi Jun 6, 2025
ea98dfe
Revert "HDDS-13160. Fix test"
swamirishi Jun 6, 2025
d1de734
Merge remote-tracking branch 'apache/master' into HEAD
swamirishi Jun 6, 2025
f4e9f4a
HDDS-13034. Address review comments
swamirishi Jun 6, 2025
4d1dda7
HDDS-13035. Add test case
swamirishi Jun 7, 2025
7c47106
HDDS-13034. Address review comments
swamirishi Jun 8, 2025
428e46d
HDDS-13036. Address review comments
swamirishi Jun 9, 2025
248305c
Merge remote-tracking branch 'origin/HDDS-13034' into HEAD
swamirishi Jun 9, 2025
90c8746
HDDS-13160. Fix checkstyle
swamirishi Jun 9, 2025
50d783c
HDDS-13160. Remove unused
swamirishi Jun 9, 2025
791848d
Merge remote-tracking branch 'origin/HDDS-13160' into HEAD
swamirishi Jun 9, 2025
c1808b7
HDDS-13035. Fix findbugs
swamirishi Jun 9, 2025
379884a
Merge remote-tracking branch 'apache/master' into HEAD
swamirishi Jun 9, 2025
029ca58
Merge remote-tracking branch 'apache/master' into HEAD
swamirishi Jun 9, 2025
6bfa322
HDDS-13035. Fix checkstyle
swamirishi Jun 9, 2025
d7ea8f6
Merge remote-tracking branch 'apache/master' into HEAD
swamirishi Jun 9, 2025
6a9721f
HDDS-13160. Fix checkstyle
swamirishi Jun 9, 2025
1884c0e
Merge remote-tracking branch 'origin/HDDS-13160' into HEAD
swamirishi Jun 10, 2025
1d71f4c
Merge remote-tracking branch 'apache/master' into HEAD
swamirishi Jun 10, 2025
763f401
Merge remote-tracking branch 'apache/master' into HEAD
swamirishi Jun 12, 2025
6ea7a27
Merge remote-tracking branch 'apache/master' into HEAD
swamirishi Jun 12, 2025
954763d
HDDS-13035. Address review comments
swamirishi Jun 13, 2025
c9d89bb
HDDS-13035. Address review comments
swamirishi Jun 13, 2025
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
6 changes: 3 additions & 3 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3786,7 +3786,7 @@
<property>
<name>ozone.snapshot.directory.service.timeout</name>
<value>300s</value>
<tag>OZONE, PERFORMANCE, OM</tag>
<tag>OZONE, PERFORMANCE, OM, DEPRECATED</tag>
<description>
Timeout value for SnapshotDirectoryCleaningService.
</description>
Expand All @@ -3795,9 +3795,9 @@
<property>
<name>ozone.snapshot.directory.service.interval</name>
<value>24h</value>
<tag>OZONE, PERFORMANCE, OM</tag>
<tag>OZONE, PERFORMANCE, OM, DEPRECATED</tag>
<description>
The time interval between successive SnapshotDirectoryCleaningService
DEPRECATED. The time interval between successive SnapshotDirectoryCleaningService
thread run.
</description>
</property>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,16 @@ public final class OMConfigKeys {
*/
public static final String OZONE_SNAPSHOT_DEEP_CLEANING_ENABLED = "ozone.snapshot.deep.cleaning.enabled";
public static final boolean OZONE_SNAPSHOT_DEEP_CLEANING_ENABLED_DEFAULT = false;
@Deprecated
public static final String OZONE_SNAPSHOT_DIRECTORY_SERVICE_INTERVAL =
"ozone.snapshot.directory.service.interval";
@Deprecated
public static final String OZONE_SNAPSHOT_DIRECTORY_SERVICE_INTERVAL_DEFAULT
= "24h";
@Deprecated
public static final String OZONE_SNAPSHOT_DIRECTORY_SERVICE_TIMEOUT =
"ozone.snapshot.directory.service.timeout";
@Deprecated
public static final String
OZONE_SNAPSHOT_DIRECTORY_SERVICE_TIMEOUT_DEFAULT = "300s";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.hadoop.fs.ozone;
package org.apache.hadoop.ozone.om.service;

import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ACL_ENABLED;
Expand Down Expand Up @@ -77,8 +77,8 @@
import org.apache.hadoop.ozone.om.ratis.OzoneManagerDoubleBuffer;
import org.apache.hadoop.ozone.om.ratis.OzoneManagerStateMachine;
import org.apache.hadoop.ozone.om.request.file.OMFileRequest;
import org.apache.hadoop.ozone.om.service.DirectoryDeletingService;
import org.apache.hadoop.ozone.om.service.KeyDeletingService;
import org.apache.hadoop.ozone.om.snapshot.filter.ReclaimableDirFilter;
import org.apache.hadoop.ozone.om.snapshot.filter.ReclaimableKeyFilter;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos;
import org.apache.ozone.test.GenericTestUtils;
import org.junit.jupiter.api.AfterAll;
Expand Down Expand Up @@ -275,11 +275,9 @@ public void testDeleteWithLargeSubPathsThanBatchSize() throws Exception {
assertEquals(18, metrics.getNumSubDirsMovedToDeletedDirTable());
assertEquals(18, metrics.getNumSubDirsSentForPurge());


long elapsedRunCount = dirDeletingService.getRunCount().get() - preRunCount;
assertThat(dirDeletingService.getRunCount().get()).isGreaterThan(1);
// Ensure dir deleting speed, here provide a backup value for safe CI
assertThat(elapsedRunCount).isGreaterThanOrEqualTo(7);
GenericTestUtils.waitFor(() -> dirDeletingService.getRunCount().get() - preRunCount >= 7, 1000, 100000);
}

@Test
Expand Down Expand Up @@ -576,7 +574,7 @@ public void testAOSKeyDeletingWithSnapshotCreateParallelExecution()
DirectoryDeletingService dirDeletingService = cluster.getOzoneManager().getKeyManager().getDirDeletingService();
// Suspend KeyDeletingService
dirDeletingService.suspend();
GenericTestUtils.waitFor(() -> !dirDeletingService.isRunningOnAOS(), 1000, 10000);
Thread.sleep(1000);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replacing conditional wait with a fixed sleep time can make the test brittle.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I fixed the suspend function to wait for the existing runs we wouldn't require the Thread.sleep() anymore

Comment thread
smengcl marked this conversation as resolved.
Outdated
Random random = new Random();
final String testVolumeName = "volume" + random.nextInt();
final String testBucketName = "bucket" + random.nextInt();
Expand All @@ -592,8 +590,7 @@ public void testAOSKeyDeletingWithSnapshotCreateParallelExecution()
OmSnapshotManager omSnapshotManager = Mockito.spy(ozoneManager.getOmSnapshotManager());
when(ozoneManager.getOmSnapshotManager()).thenAnswer(i -> omSnapshotManager);
DirectoryDeletingService service = Mockito.spy(new DirectoryDeletingService(1000, TimeUnit.MILLISECONDS, 1000,
ozoneManager,
cluster.getConf(), 1));
ozoneManager, cluster.getConf(), 1, false));
service.shutdown();
final int initialSnapshotCount =
(int) cluster.getOzoneManager().getMetadataManager().countRowsInTable(snapshotInfoTable);
Expand Down Expand Up @@ -627,7 +624,8 @@ public void testAOSKeyDeletingWithSnapshotCreateParallelExecution()
}
return null;
}).when(service).optimizeDirDeletesAndSubmitRequest(anyLong(), anyLong(),
anyLong(), anyList(), anyList(), eq(null), anyLong(), anyLong(), Mockito.any(), any(),
anyLong(), anyList(), anyList(), eq(null), anyLong(), anyLong(), any(),
any(ReclaimableDirFilter.class), any(ReclaimableKeyFilter.class), any(),
anyLong());

Mockito.doAnswer(i -> {
Expand All @@ -651,8 +649,8 @@ public void testAOSKeyDeletingWithSnapshotCreateParallelExecution()
}
}, 1000, 10000);
return i.callRealMethod();
}).when(omSnapshotManager).getSnapshot(ArgumentMatchers.eq(testVolumeName), ArgumentMatchers.eq(testBucketName),
ArgumentMatchers.eq(snap1));
}).when(omSnapshotManager).getActiveSnapshot(ArgumentMatchers.eq(testVolumeName),
ArgumentMatchers.eq(testBucketName), ArgumentMatchers.eq(snap1));
assertTableRowCount(snapshotInfoTable, initialSnapshotCount + 1);
service.runPeriodicalTaskNow();
service.runPeriodicalTaskNow();
Expand Down Expand Up @@ -729,7 +727,6 @@ public void testDirDeletedTableCleanUpForSnapshot() throws Exception {
DirectoryDeletingService dirDeletingService =
(DirectoryDeletingService) cluster.getOzoneManager().getKeyManager()
.getDirDeletingService();

// After delete. 5 more files left out under the root dir
assertTableRowCount(keyTable, 5);
assertTableRowCount(dirTable, 5);
Expand All @@ -749,30 +746,29 @@ public void testDirDeletedTableCleanUpForSnapshot() throws Exception {
assertSubPathsCount(dirDeletingService::getMovedFilesCount, 0);
assertSubPathsCount(dirDeletingService::getMovedDirsCount, 0);
assertSubPathsCount(dirDeletingService::getDeletedDirsCount, 0);

// Case-2) Delete dir
fs.delete(root, true);

// After delete. 5 sub files are still in keyTable.
// 4 dirs in dirTable.
assertTableRowCount(keyTable, 5);
assertTableRowCount(dirTable, 4);
assertTableRowCount(dirTable, 0);

// KeyDeletingService and DirectoryDeletingService will not
// clean up because the paths are part of a snapshot.
// As a result on 1 deleted dir and 3 deleted files will
// remain in dirTable and keyTable respectively.
long prevDDSRunCount = dirDeletingService.getRunCount().get();
long prevKDSRunCount = keyDeletingService.getRunCount().get();
assertTableRowCount(deletedDirTable, 1);
assertTableRowCount(deletedDirTable, 5);
assertTableRowCount(deletedKeyTable, 3);
GenericTestUtils.waitFor(() -> dirDeletingService.getRunCount().get() >
prevDDSRunCount, 100, 10000);
GenericTestUtils.waitFor(() -> keyDeletingService.getRunCount().get() >
prevKDSRunCount, 100, 10000);

assertSubPathsCount(dirDeletingService::getMovedFilesCount, 0);
assertSubPathsCount(dirDeletingService::getMovedDirsCount, 0);
assertSubPathsCount(dirDeletingService::getMovedDirsCount, 4);
assertSubPathsCount(dirDeletingService::getDeletedDirsCount, 0);

// Manual cleanup deletedDirTable for next tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
* limitations under the License.
*/

package org.apache.hadoop.fs.ozone;
package org.apache.hadoop.ozone.om.service;

import static org.apache.hadoop.fs.ozone.TestDirectoryDeletingServiceWithFSO.assertSubPathsCount;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ACL_ENABLED;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_BLOCK_DELETING_SERVICE_INTERVAL;
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_FS_ITERATE_BATCH_SIZE;
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
import static org.apache.hadoop.ozone.om.service.TestDirectoryDeletingServiceWithFSO.assertSubPathsCount;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -51,7 +51,6 @@
import org.apache.hadoop.ozone.om.helpers.BucketLayout;
import org.apache.hadoop.ozone.om.helpers.OmDirectoryInfo;
import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
import org.apache.hadoop.ozone.om.service.DirectoryDeletingService;
import org.apache.ozone.test.GenericTestUtils;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
Expand Down
Loading