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 cd08b0aa2f0 HDDS-17792. Recon swaps replicated / unreplicated size of
deleted keys at reprocess (#12026)
cd08b0aa2f0 is described below
commit cd08b0aa2f031c1417d11b593dc270e8a6f2cd15
Author: Navink <[email protected]>
AuthorDate: Fri Nov 13 11:25:28 2026 +0530
HDDS-17792. Recon swaps replicated / unreplicated size of deleted keys at
reprocess (#12026)
---
.../org/apache/hadoop/ozone/om/helpers/RepeatedOmKeyInfo.java | 4 ++--
.../hadoop/ozone/recon/tasks/DeletedKeysInsightHandler.java | 4 ++--
.../apache/hadoop/ozone/recon/tasks/TestOmTableInsightTask.java | 9 ++++++++-
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/RepeatedOmKeyInfo.java
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/RepeatedOmKeyInfo.java
index fe55033b36b..e8fa2f8f613 100644
---
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/RepeatedOmKeyInfo.java
+++
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/RepeatedOmKeyInfo.java
@@ -111,8 +111,8 @@ public List<OmKeyInfo> getOmKeyInfoList() {
}
/**
- * Returns a pair of long values representing the replicated size and
- * unreplicated size of all the keys in the list.
+ * Returns a pair of long values representing the unreplicated size and
+ * replicated size of all the keys in the list.
*/
public ImmutablePair<Long, Long> getTotalSize() {
long replicatedSize = 0;
diff --git
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/DeletedKeysInsightHandler.java
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/DeletedKeysInsightHandler.java
index 1567332b6f9..825eca8c19d 100644
---
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/DeletedKeysInsightHandler.java
+++
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/DeletedKeysInsightHandler.java
@@ -126,8 +126,8 @@ public Triple<Long, Long, Long> getTableSizeAndCount(String
tableName,
if (kv != null && kv.getValue() != null) {
RepeatedOmKeyInfo repeatedOmKeyInfo = kv.getValue();
Pair<Long, Long> result = repeatedOmKeyInfo.getTotalSize();
- unReplicatedSize += result.getRight();
- replicatedSize += result.getLeft();
+ unReplicatedSize += result.getLeft();
+ replicatedSize += result.getRight();
count += repeatedOmKeyInfo.getOmKeyInfoList().size();
}
}
diff --git
a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/tasks/TestOmTableInsightTask.java
b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/tasks/TestOmTableInsightTask.java
index 673439f65ea..ed9d8c9665e 100644
---
a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/tasks/TestOmTableInsightTask.java
+++
b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/tasks/TestOmTableInsightTask.java
@@ -385,7 +385,9 @@ public void testReprocessForCount() throws Exception {
when(deletedIter.hasNext()).thenReturn(true, true, true, true, true,
false);
RepeatedOmKeyInfo deletedKeyInfo = mock(RepeatedOmKeyInfo.class);
- when(deletedKeyInfo.getTotalSize()).thenReturn(ImmutablePair.of(100L,
100L));
+ // Use different unreplicated and replicated sizes to verify that
+ // reprocessing assigns each value to the correct size metric.
+ when(deletedKeyInfo.getTotalSize()).thenReturn(ImmutablePair.of(100L,
300L));
when(deletedKeyInfo.getOmKeyInfoList()).thenReturn(Arrays.asList(mock(OmKeyInfo.class)));
Table.KeyValue deletedKv = mock(Table.KeyValue.class);
@@ -441,6 +443,11 @@ public void testReprocessForCount() throws Exception {
assertEquals(5L, getCountForTable(OPEN_KEY_TABLE));
assertEquals(5L, getCountForTable(DELETED_TABLE));
assertEquals(5L, getCountForTable(MULTIPART_INFO_TABLE));
+ // Five deleted entries, each with 100 bytes unreplicated and 300 bytes
+ // replicated, should produce totals of 500 and 1500 bytes respectively.
+ // These assertions detect a typo ie: reversal of the two size metrics.
+ assertEquals(500L, getUnReplicatedSizeForTable(DELETED_TABLE));
+ assertEquals(1500L, getReplicatedSizeForTable(DELETED_TABLE));
}
@Test
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]