C0urante commented on code in PR #12281:
URL: https://github.com/apache/kafka/pull/12281#discussion_r921322234


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/metrics/RocksDBMetricsRecordingTrigger.java:
##########
@@ -32,12 +32,12 @@ public RocksDBMetricsRecordingTrigger(final Time time) {
 
     public void addMetricsRecorder(final RocksDBMetricsRecorder 
metricsRecorder) {
         final String metricsRecorderName = 
metricsRecorderName(metricsRecorder);
-        if (metricsRecordersToTrigger.containsKey(metricsRecorderName)) {
+        final RocksDBMetricsRecorder existingRocksDBMetricsRecorder = 
metricsRecordersToTrigger.putIfAbsent(metricsRecorderName, metricsRecorder);

Review Comment:
   Does this change behavior? Potential concurrency bug aside (which I'm not 
sure is valid, since it's unclear if we expect this method to be called 
concurrently), it looks like we're going from failing _before_ overwriting 
values to now failing _after_ overwriting them. Is there any fallout from that 
or is it a benign change?



##########
streams/src/main/java/org/apache/kafka/streams/state/internals/metrics/RocksDBMetricsRecordingTrigger.java:
##########
@@ -32,12 +32,12 @@ public RocksDBMetricsRecordingTrigger(final Time time) {
 
     public void addMetricsRecorder(final RocksDBMetricsRecorder 
metricsRecorder) {
         final String metricsRecorderName = 
metricsRecorderName(metricsRecorder);
-        if (metricsRecordersToTrigger.containsKey(metricsRecorderName)) {
+        final RocksDBMetricsRecorder existingRocksDBMetricsRecorder = 
metricsRecordersToTrigger.putIfAbsent(metricsRecorderName, metricsRecorder);

Review Comment:
   Does this change behavior? Potential concurrency bug aside (which I'm not 
sure is actually a bug, since it's unclear if we expect this method to be 
called concurrently), it looks like we're going from failing _before_ 
overwriting values to now failing _after_ overwriting them. Is there any 
fallout from that or is it a benign change?



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

Reply via email to