sk0x50 commented on code in PR #7428:
URL: https://github.com/apache/ignite-3/pull/7428#discussion_r2764042759


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/replicator/PendingRows.java:
##########
@@ -88,4 +88,15 @@ public Set<RowId> removePendingRowIds(UUID txId) {
         return pendingRows == null ? EMPTY_SET : pendingRows;
     }
 
+    /**
+     * Returns the total number of unresolved write intents across all 
transactions.
+     *
+     * @return Total number of pending row IDs.
+     */
+    public int getPendingRowCount() {

Review Comment:
   Perhaps, it should be `long` WDYT?



##########
modules/transactions/src/test/java/org/apache/ignite/internal/tx/metrics/TransactionMetricSourceTest.java:
##########
@@ -61,7 +61,8 @@ void testMetricNames() {
                 "RoCommits",
                 "RoRollbacks",
                 "RwDuration",
-                "RoDuration");
+                "RoDuration",
+                TransactionMetricsSource.METRIC_PENDING_WRITE_INTENTS);

Review Comment:
   I would avoid using a constant in this particular test.  The main goal is to 
check that the list of metrics contains all required metrics and that metric 
names are correct. Lket;s assume that I changed the name `pendingWriteIntents` 
to `pendingWriteIntentы` by accident. In that case, the test will not fail, and 
so will not highlight the issue.



##########
modules/runner/src/main/java/org/apache/ignite/internal/app/IgniteImpl.java:
##########
@@ -1048,6 +1049,8 @@ public class IgniteImpl implements Ignite {
         LockManager lockMgr = new HeapLockManager(systemConfiguration, 
txStateVolatileStorage);
 
         // TODO: IGNITE-19344 - use nodeId that is validated on join (and 
probably generated differently).
+        TransactionMetricsSource txMetrics = new 
TransactionMetricsSource(clockService);

Review Comment:
   It looks weird to me. I still think that the transaction manager is the 
right place to create and hold this metric source instance. If you need this 
metric source instance within the table manager, then I would suggest the 
following two options that look better IMHO:
    - introduce a new method to the tx manager interface as follows: `public 
TxMetricSource metrics();`
    - you can always get an instance using metric manager 
`metricManager.metricSources()` and `TransactionMetricsSource.SOURCE_NAME`
   
   So, both approaches avoid expanding visibility of the metric source.



##########
modules/transactions/src/main/java/org/apache/ignite/internal/tx/metrics/TransactionMetricsSource.java:
##########
@@ -43,6 +49,8 @@ public class TransactionMetricsSource extends 
AbstractMetricSource<Holder> {
     /** Clock service to calculate a timestamp for rolled back transactions. */
     private final ClockService clockService;
 
+    private final AtomicReference<LongSupplier> pendingWriteIntentsSupplierRef 
= new AtomicReference<>(() -> 0L);

Review Comment:
   Perhaps `volatile` would be enough? WDYT?
   
   Also, does it make sense to introduce an interface with a descriptive name, 
`WriteIntentsProvider`, for example, instead of a faceless `LongSupplier`?



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