jtuglu1 commented on code in PR #18855:
URL: https://github.com/apache/druid/pull/18855#discussion_r2639943966


##########
processing/src/main/java/org/apache/druid/segment/incremental/RowIngestionMetersTotals.java:
##########
@@ -109,7 +156,19 @@ public String toString()
            ", processedBytes=" + processedBytes +
            ", processedWithError=" + processedWithError +
            ", thrownAway=" + thrownAway +
+           ", thrownAwayByReason=" + thrownAwayByReason +
            ", unparseable=" + unparseable +
            '}';
   }
+
+  /**
+   * For backwards compatibility, key by {@link InputRowFilterResult} in case 
of lack of thrownAwayByReason input during rolling Druid upgrades.
+   * This can occur when tasks running on older Druid versions return ingest 
statistic payloads to an overlord running on a newer Druid version.
+   */
+  private static Map<String, Long> 
getBackwardsCompatibleThrownAwayByReason(long thrownAway)
+  {
+    Map<String, Long> results = InputRowFilterResult.buildRejectedCounterMap();
+    results.put(InputRowFilterResult.UNKNOWN.getReason(), thrownAway);
+    return results;

Review Comment:
   This would not work as the code expects a frequency map containing the full 
set of rejected reasons. As I mentioned above, I want to *always* emit a 
frequency map that covers all possible keys. IMO, omission of a key isn't as 
clear as reporting the `key:0` (e.g. did the event not exist, did the filter 
reason not exist, did the task not check for that reason?) and is easier for 
clients to build logic around. Additionally, this is already the pattern with 
the rest of the counters (processed, etc.) where they are still returned (but 
maybe not emitted) if they are 0. Open to suggestions here, but I think this 
fits with the current accounting contracts.



-- 
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