ivanzlenko commented on code in PR #7701:
URL: https://github.com/apache/ignite-3/pull/7701#discussion_r2905204777
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -465,6 +433,30 @@ public TableManager(
fullStateTransferIndexChooser = new
FullStateTransferIndexChooser(catalogService, lowWatermark, indexMetaStorage);
+ partitionResourcesFactory = new TablePartitionResourcesFactory(
Review Comment:
Can we create this factory in IgniteImpl and just insert it as a dependency
into TableManager?
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/PartitionResources.java:
##########
@@ -19,24 +19,34 @@
import org.apache.ignite.internal.table.distributed.gc.GcUpdateHandler;
import org.apache.ignite.internal.table.distributed.index.IndexUpdateHandler;
+import org.apache.ignite.internal.tostring.S;
/**
- * Partition update handler container.
+ * Partition resource container: handlers and modification counter created
during partition setup.
*/
-class PartitionUpdateHandlers {
+class PartitionResources {
final StorageUpdateHandler storageUpdateHandler;
final IndexUpdateHandler indexUpdateHandler;
final GcUpdateHandler gcUpdateHandler;
- PartitionUpdateHandlers(
+ final PartitionModificationCounter modificationCounter;
+
+ PartitionResources(
StorageUpdateHandler storageUpdateHandler,
IndexUpdateHandler indexUpdateHandler,
- GcUpdateHandler gcUpdateHandler
+ GcUpdateHandler gcUpdateHandler,
+ PartitionModificationCounter modificationCounter
) {
this.storageUpdateHandler = storageUpdateHandler;
this.indexUpdateHandler = indexUpdateHandler;
this.gcUpdateHandler = gcUpdateHandler;
+ this.modificationCounter = modificationCounter;
+ }
+
+ @Override
+ public String toString() {
+ return S.toString(this);
Review Comment:
Are you sure we need this?
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TablePartitionResourcesFactory.java:
##########
@@ -0,0 +1,310 @@
+/*
+ * 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 static java.util.Objects.requireNonNull;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import org.apache.ignite.internal.catalog.CatalogService;
+import org.apache.ignite.internal.failure.FailureProcessor;
+import org.apache.ignite.internal.hlc.ClockService;
+import org.apache.ignite.internal.hlc.HybridTimestamp;
+import org.apache.ignite.internal.lowwatermark.LowWatermark;
+import org.apache.ignite.internal.network.TopologyService;
+import
org.apache.ignite.internal.partition.replicator.raft.snapshot.PartitionDataStorage;
+import
org.apache.ignite.internal.partition.replicator.raft.snapshot.PartitionKey;
+import
org.apache.ignite.internal.partition.replicator.raft.snapshot.PartitionMvStorageAccess;
+import
org.apache.ignite.internal.partition.replicator.raft.snapshot.outgoing.OutgoingSnapshotsManager;
+import
org.apache.ignite.internal.partition.replicator.schema.ValidationSchemasSource;
+import org.apache.ignite.internal.placementdriver.LeasePlacementDriver;
+import org.apache.ignite.internal.raft.ExecutorInclinedRaftCommandRunner;
+import org.apache.ignite.internal.raft.service.RaftCommandRunner;
+import org.apache.ignite.internal.replicator.ZonePartitionId;
+import
org.apache.ignite.internal.replicator.configuration.ReplicationConfiguration;
+import org.apache.ignite.internal.schema.SchemaManager;
+import org.apache.ignite.internal.schema.SchemaSyncService;
+import org.apache.ignite.internal.storage.MvPartitionStorage;
+import org.apache.ignite.internal.table.TableViewInternal;
+import
org.apache.ignite.internal.table.distributed.PartitionModificationCounterFactory.SizeSupplier;
+import org.apache.ignite.internal.table.distributed.gc.GcUpdateHandler;
+import org.apache.ignite.internal.table.distributed.gc.MvGc;
+import org.apache.ignite.internal.table.distributed.index.IndexMetaStorage;
+import org.apache.ignite.internal.table.distributed.index.IndexUpdateHandler;
+import
org.apache.ignite.internal.table.distributed.raft.MinimumRequiredTimeCollectorService;
+import
org.apache.ignite.internal.table.distributed.raft.TablePartitionProcessor;
+import
org.apache.ignite.internal.table.distributed.raft.snapshot.FullStateTransferIndexChooser;
+import
org.apache.ignite.internal.table.distributed.raft.snapshot.PartitionMvStorageAccessImpl;
+import
org.apache.ignite.internal.table.distributed.raft.snapshot.SnapshotAwarePartitionDataStorage;
+import
org.apache.ignite.internal.table.distributed.replicator.PartitionReplicaListener;
+import org.apache.ignite.internal.tx.LockManager;
+import org.apache.ignite.internal.tx.TxManager;
+import org.apache.ignite.internal.tx.impl.RemotelyTriggeredResourceRegistry;
+import org.apache.ignite.internal.tx.impl.TransactionStateResolver;
+import org.apache.ignite.internal.util.Lazy;
+import org.apache.ignite.internal.util.PendingComparableValuesTracker;
+
+/**
+ * Stateless factory for creating partition-level resources: data storage
wrappers, update handlers, and replica listeners.
+ *
+ * <p>This factory performs pure construction only — it does not start
components, register metrics,
+ * or own any mutable state. Lifecycle management (start/stop, metric
registration/deregistration)
+ * remains in {@link TableManager}.
+ *
+ * <p><b>Lifecycle ordering:</b> the caller must invoke {@link
StorageUpdateHandler#start} on the
+ * {@link PartitionResources#storageUpdateHandler} returned by {@link
#createPartitionResources} before
+ * the constructed objects ({@link TablePartitionProcessor}, {@link
PartitionMvStorageAccess},
+ * {@link PartitionReplicaListener}) are used at runtime.
+ */
+class TablePartitionResourcesFactory {
+ private final TxManager txManager;
+ private final LockManager lockManager;
+ private final ExecutorService scanRequestExecutor;
+ private final ClockService clockService;
+ private final CatalogService catalogService;
+ private final PartitionModificationCounterFactory
partitionModificationCounterFactory;
+ private final OutgoingSnapshotsManager outgoingSnapshotsManager;
+ private final LowWatermark lowWatermark;
+ private final ValidationSchemasSource validationSchemasSource;
+ private final SchemaSyncService schemaSyncService;
+ private final LeasePlacementDriver placementDriver;
+ private final TopologyService topologyService;
+ private final RemotelyTriggeredResourceRegistry
remotelyTriggeredResourceRegistry;
+ private final FailureProcessor failureProcessor;
+ private final SchemaManager schemaManager;
+ private final ReplicationConfiguration replicationConfiguration;
+ private final Executor partitionOperationsExecutor;
+ private final IndexMetaStorage indexMetaStorage;
+ private final MinimumRequiredTimeCollectorService minTimeCollectorService;
+ private final MvGc mvGc;
+ private final FullStateTransferIndexChooser fullStateTransferIndexChooser;
+
+ TablePartitionResourcesFactory(
+ TxManager txManager,
+ LockManager lockManager,
+ ExecutorService scanRequestExecutor,
+ ClockService clockService,
+ CatalogService catalogService,
+ PartitionModificationCounterFactory
partitionModificationCounterFactory,
+ OutgoingSnapshotsManager outgoingSnapshotsManager,
+ LowWatermark lowWatermark,
+ ValidationSchemasSource validationSchemasSource,
+ SchemaSyncService schemaSyncService,
+ LeasePlacementDriver placementDriver,
+ TopologyService topologyService,
+ RemotelyTriggeredResourceRegistry
remotelyTriggeredResourceRegistry,
+ FailureProcessor failureProcessor,
+ SchemaManager schemaManager,
+ ReplicationConfiguration replicationConfiguration,
+ Executor partitionOperationsExecutor,
+ IndexMetaStorage indexMetaStorage,
+ MinimumRequiredTimeCollectorService minTimeCollectorService,
+ MvGc mvGc,
+ FullStateTransferIndexChooser fullStateTransferIndexChooser
+ ) {
+ this.txManager = requireNonNull(txManager, "txManager");
Review Comment:
I wouldn't be bothered with checks tbf. We have annotations for that purpose.
--
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]