HenryCaiHaiying commented on code in PR #17025:
URL: https://github.com/apache/iceberg/pull/17025#discussion_r3612602740
##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/CommitState.java:
##########
@@ -102,6 +102,14 @@ void clearResponses() {
commitBuffer.clear();
}
+ int commitBufferSize() {
+ return commitBuffer.size();
Review Comment:
ArrayList.size() method will just return the internal size member variable,
although it is not defined with volatile but there is no danger of reading an
integer value half-way. The issue is on memory barrier visibility. So the JMX
poll thread can read older stale value, it does not seem to me a serious issue
for JMX reporting. For ArrayList.clear() and add(), they are updating 'size'
variable either in the middle or towards the end of the method call, it still
seems the danger is the other reader thread can read an old size variable
value, not on reading an inconsistent list.
I think I am fine with adding AtomicInteger variables make the metric
reading more accurate, it will add some code complexity on maintaining the
consistency between several member variables within CommitState, let me know if
you feel strongly about this one.
--
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]