korlov42 commented on code in PR #6563:
URL: https://github.com/apache/ignite-3/pull/6563#discussion_r2332293962
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/StorageUpdateHandler.java:
##########
@@ -443,6 +453,8 @@ private void performAddWriteCommittedWithCleanup(
assert result.status() == AddWriteCommittedResultStatus.SUCCESS :
"rowId=" + rowId + ", result=" + result;
}
+
+ modificationCounter.updateValue(1, commitTs);
Review Comment:
I think it's not really efficient to update counter for every row during
batch processing, those I would propose to move this on a few levels up on the
call stack: to the `else` brach of `if (trackWriteIntent)` in `handleUpdate`,
and to similar place in `processEntriesUntilBatchLimit`. WDYT?
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -3134,16 +3151,47 @@ private static PartitionUpdateHandlers
createPartitionUpdateHandlers(
GcUpdateHandler gcUpdateHandler = new
GcUpdateHandler(partitionDataStorage, safeTimeTracker, indexUpdateHandler);
+ LongSupplier partSizeSupplier = () ->
partitionDataStorage.getStorage().estimatedSize();
+ PartitionModificationCounter modificationCounter =
partitionModificationCounterFactory.create(partSizeSupplier);
+ registerPartitionModificationCounterMetrics(table.tableId(),
partitionId, modificationCounter);
+
StorageUpdateHandler storageUpdateHandler = new StorageUpdateHandler(
partitionId,
partitionDataStorage,
indexUpdateHandler,
- replicationConfiguration
+ replicationConfiguration,
+ modificationCounter
);
return new PartitionUpdateHandlers(storageUpdateHandler,
indexUpdateHandler, gcUpdateHandler);
}
+ private void registerPartitionModificationCounterMetrics(
+ int tableId, int partitionId, PartitionModificationCounter
counter) {
+
+ PartitionModificationCounterMetricSource metricSource =
+ new PartitionModificationCounterMetricSource(tableId,
partitionId);
+
+ metricSource.addMetric(new LongGauge(
+ PartitionModificationCounterMetricSource.METRIC_COUNTER,
+ "The value of the volatile counter of partition modifications.
"
+ + "This value is used to determine staleness of the
related SQL statistics.",
+ counter::value
+ ));
+
+ metricSource.addMetric(new LongGauge(
Review Comment:
we probably might want also the next milestone to be exposed
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/PartitionModificationCounter.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.table.distributed;
+
+import org.apache.ignite.internal.hlc.HybridTimestamp;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Partition modification counter.
+ */
+public interface PartitionModificationCounter {
+ /**
+ * Adds the given value to the current counter value.
+ *
+ * @param delta the value to add.
Review Comment:
parameter description must start with capital letter. Please check this
everywhere in the patch.
--
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]