voonhous commented on code in PR #19575:
URL: https://github.com/apache/hudi/pull/19575#discussion_r3863085631
##########
hudi-io/src/main/java/org/apache/hudi/common/metrics/Registry.java:
##########
@@ -190,6 +199,28 @@ static void setRegistries(Collection<Registry> registries)
{
*/
void set(String name, long value);
+ /**
+ * Subtract a set of counts previously read out of this registry, clamping
every counter at zero.
+ *
+ * Used to hand a batch of counters over to a consumer that owns them from
then on -- the commit-boundary
+ * drain for the record index lookup counters -- without discarding whatever
arrived after they were read.
+ *
+ * Clamping is what distinguishes this from {@code add(name, -value)}. The
registry can be emptied
+ * underneath a caller by an unrelated destructive scrape ({@link
#getAllMetrics(boolean, boolean)} with
+ * {@code flush=true} clears every registry in the process), and an
unbounded subtraction would then leave
+ * negative counters behind for good.
+ *
+ * The default is a best-effort read-modify-write. Implementations able to
do this atomically should
+ * override it, and should drop counters that reach zero rather than leaving
them at zero, so a registry
+ * nobody is writing to reads as empty.
+ *
+ * @param counts the counts to release, as returned by {@link
#getAllCounts(boolean)}.
+ */
+ default void release(Map<String, Long> counts) {
Review Comment:
Dead-but-harmless API surface in hudi-io, ~15 lines. It is part of the same
hudi-io bundle as thread 24 (`getRegistry` contract, `NoOpRegistry`,
`ExecutorMetricsContext`), which you chose to keep open without a reply.
Consistent handling would be the same here; this is a nit, so let's not block
on this.)
--
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]