You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ad...@apache.org on 2026/04/03 17:45:36 UTC
(ozone) branch master updated: HDDS-13661. Fix flaky TestKeyDeletingService#testPurgeKeysRequestBatching (#10025)
This is an automated email from the ASF dual-hosted git repository.
adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 5bc0bf8788e HDDS-13661. Fix flaky TestKeyDeletingService#testPurgeKeysRequestBatching (#10025)
5bc0bf8788e is described below
commit 5bc0bf8788eb790050c796f031416c87279f2838
Author: Arun Sarin <ar...@gmail.com>
AuthorDate: Fri Apr 3 23:15:30 2026 +0530
HDDS-13661. Fix flaky TestKeyDeletingService#testPurgeKeysRequestBatching (#10025)
---
.../ozone/om/service/TestKeyDeletingService.java | 32 +++++++++++-----------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyDeletingService.java b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyDeletingService.java
index 5111710651b..0ee43d949ff 100644
--- a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyDeletingService.java
+++ b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyDeletingService.java
@@ -1166,18 +1166,19 @@ void cleanup() {
}
private void customizeConfig() {
- // Define a small Ratis limit to force multiple batches for testing
- // The actual byte size of protobuf messages depends on content.
- // A small value like 1KB or 2KB should ensure batching for ~10-20 keys.
- final int testRatisLimitBytes = 1024; // 2 KB to encourage multiple batches, 90% of the actualRatisLimitBytes.
- // Set the specific Ratis limit for this test
+ // Define a small Ratis limit to force multiple batches for testing.
+ // With 50 keys and 1024 bytes limit (90% = ~921 bytes effective), this
+ // produces ~7 batches, confirming the batching logic works correctly.
+ final int testRatisLimitBytes = 1024;
conf.setStorageSize(OMConfigKeys.OZONE_OM_RATIS_LOG_APPENDER_QUEUE_BYTE_LIMIT,
testRatisLimitBytes, StorageUnit.BYTES);
+ // Use a very large service interval so the background thread never fires
+ // during the test, preventing concurrent processing with runPeriodicalTaskNow().
+ conf.setTimeDuration(OZONE_BLOCK_DELETING_SERVICE_INTERVAL, 1, TimeUnit.DAYS);
}
@Test
@DisplayName("Verify PurgeKeysRequest is batched according to Ratis byte limit")
- @Flaky("HDDS-13661")
void testPurgeKeysRequestBatching() throws Exception {
keyDeletingService.suspend();
@@ -1191,20 +1192,19 @@ void testPurgeKeysRequestBatching() throws Exception {
// Mock submitRequest to capture requests and return success
mockedRatisUtils.when(() -> OzoneManagerRatisUtils.submitRequest(
any(OzoneManager.class),
- requestCaptor.capture(), // Capture the OMRequest here
+ requestCaptor.capture(),
any(),
anyLong()))
- .thenAnswer(invocation -> {
- // Return a successful OMResponse for each captured request
- return OzoneManagerProtocolProtos.OMResponse.newBuilder()
- .setCmdType(OzoneManagerProtocolProtos.Type.PurgeKeys)
- .setStatus(OzoneManagerProtocolProtos.Status.OK)
- .build();
- });
+ .thenAnswer(invocation -> OzoneManagerProtocolProtos.OMResponse.newBuilder()
+ .setCmdType(OzoneManagerProtocolProtos.Type.PurgeKeys)
+ .setStatus(OzoneManagerProtocolProtos.Status.OK)
+ .build());
- final int numKeysToCreate = 50; // Create enough keys to ensure multiple batches
- // Create and delete keys using the test-specific managers
+ final int numKeysToCreate = 50;
createAndDeleteKeys(numKeysToCreate, 1);
+ // Wait for all delete operations to be flushed from the DoubleBuffer to
+ // RocksDB, so that getPendingDeletionKeys() can see all 50 entries.
+ om.awaitDoubleBufferFlush();
keyDeletingService.resume();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org