You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "jojochuang (via GitHub)" <gi...@apache.org> on 2023/02/11 00:12:36 UTC

[GitHub] [ozone] jojochuang commented on a diff in pull request #4266: HDDS-7926. [hsync] Recon throws ClassCastException.

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


##########
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:
   does it guarantee repeatedKeyInfo has only one key? Also why is keyInfo and oldKeyInfo the same? typo?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org