ArafatKhan2198 commented on code in PR #4266:
URL: https://github.com/apache/ozone/pull/4266#discussion_r1103678205


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/FileSizeCountTask.java:
##########
@@ -122,28 +123,46 @@ public Pair<String, Boolean> process(OMUpdateEventBatch 
events) {
     final Collection<String> taskTables = getTaskTables();
 
     while (eventIterator.hasNext()) {
-      OMDBUpdateEvent<String, OmKeyInfo> omdbUpdateEvent = 
eventIterator.next();
+      OMDBUpdateEvent<String, ?> omdbUpdateEvent = eventIterator.next();
       // Filter event inside process method to avoid duping
       if (!taskTables.contains(omdbUpdateEvent.getTable())) {
         continue;
       }
       String updatedKey = omdbUpdateEvent.getKey();
-      OmKeyInfo omKeyInfo = omdbUpdateEvent.getValue();
+
+      // Get the updated and old OM Key Info objects
+      Object omKeyInfo = omdbUpdateEvent.getValue();
+      Object oldOmKeyInfo = omdbUpdateEvent.getOldValue();
+
+      OmKeyInfo keyInfo, oldKeyInfo;
+      // Handle the case where the updated OM Key Info is a RepeatedOmKeyInfo 
object
+      if (omKeyInfo instanceof RepeatedOmKeyInfo) {
+        // Handle RepeatedOmKeyInfo object
+        RepeatedOmKeyInfo repeatedKeyInfo = (RepeatedOmKeyInfo) omKeyInfo;
+        keyInfo = repeatedKeyInfo.getOmKeyInfoList().get(0);
+        oldKeyInfo = repeatedKeyInfo.getOmKeyInfoList().get(0);

Review Comment:
   Thanks for the comment @jojochuang 
   I was mistaken in believing that all `OmKeyInfo` objects stored in the 
`RepeatedOmKeyInfo` class are similar in terms of size, but differ only in 
their paths. In fact, it is the complete opposite. Once a key is deleted, it is 
moved to the "om metadata deletedTable." Hence having a mapping of `{label: 
List<OMKeyInfo>}` ensures that if users repeatedly create and delete keys with 
the exact same URI, all instances of deletion are grouped together under the 
same key name.
   Hence I believe we must iterate through the list and call 
`handleDeleteKeyEvent()` on each OmKeyInfo object in the list. Do let me know 
if I am making a mistake in my understanding of RepeatedOmKeyInfo class and the 
rocksDB DeletedTable. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to