poorbarcode commented on code in PR #16758: URL: https://github.com/apache/pulsar/pull/16758#discussion_r935781120
########## pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/TxnLogBufferedWriter.java: ########## @@ -272,23 +290,43 @@ private void doTrigFlush(boolean force, boolean byScheduleThreads){ return; } if (force) { + if (metricsStats != null) { Review Comment: > We can add a default TxnLogBufferedWriterMetricsStatsDisabled implementation to avoid many null checks. Good Idea. In the complete design, we should have two implementations like UML blow, one for enabling the batch feature, and another for disabled:  Sorry, I should have added some code comments in this PR. To reduce later maintenance costs, I'd like to ditch the 'DisabledMetricsStat' and we'll always use the implementation 'MetricsStatimpl' even if the Txn buffer writer disables batch feature. This constructor without 'param-metricsStats' and these' null checks' will be removed in the next PR. This is compatible only with split PR, making each PR have less code -- 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: commits-unsubscr...@pulsar.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org