Copilot commented on code in PR #18603:
URL: https://github.com/apache/iotdb/pull/18603#discussion_r3987074987


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/consensus/statemachine/dataregion/DataRegionStateMachine.java:
##########
@@ -55,6 +55,13 @@
 import java.util.List;
 import java.util.function.Supplier;
 
+/**
+ * Applies replicated write and query fragment operations to one DataRegion 
and exposes its snapshot
+ * and region-resource lifecycle to the consensus layer.
+ *
+ * <p>Write-process rejection is retried here to preserve the atomicity 
expected by the consensus
+ * apply path; other statuses are delegated to the consensus retry mechanism.

Review Comment:
   `needRetryForSpecificCases` also retries 
`METADATA_LEASE_FENCED_RETRY_REQUIRED` for non-pipe writes, while this 
class-level text describes only write-process rejection and places other 
statuses in the surrounding retry path. Please document both selected statuses 
and the pipe-generated exception so the retry contract is accurate.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/SchemaEngine.java:
##########
@@ -73,7 +73,14 @@
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
-// manage all the schemaRegion in this dataNode
+/**
+ * Owns the schema regions hosted by this DataNode and coordinates their 
loading, recovery, metrics,
+ * schema-resource management, and lifecycle operations.
+ *
+ * <p>The selected schema-engine mode determines whether schema state is 
memory-resident or cached.
+ * Schema metrics and shared schema resources must be initialized before 
schema regions, and cleared
+ * only after all schema regions have been cleared.

Review Comment:
   The lifecycle described here contradicts `clear()`: 
`SchemaResourceManager.clearSchemaResource()` is intentionally called before 
each schema region is cleared, while `schemaMetricManager.clear()` runs 
afterward. Please document that shared schema resources are cleared before 
regions and only schema metrics are cleared last.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/StorageEngine.java:
##########
@@ -912,10 +918,10 @@ public boolean runIfAbsent(DataRegionId regionId, 
Runnable runnable) {
   }
 
   /**
-   * run the consumer if the region is present. if the region is absent, do 
nothing.
+   * Run the consumer if the region is present. if the region is absent, do 
nothing.

Review Comment:
   The second sentence still starts with a lowercase `if`, so the grammar 
correction is incomplete.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNode.java:
##########
@@ -252,13 +260,20 @@ public static void main(final String[] args) {
     }
   }
 
+  /**
+   * Starts the DataNode by preparing local state, synchronizing cluster 
configuration, registering
+   * or restarting the node, recovering regions, and starting the remaining 
services in dependency
+   * order.
+   *
+   * <p>The first-start and restart paths intentionally perform different 
registration and security
+   * checks.
+   */
   @Override
   protected void start() {
     logger.info(DataNodeMiscMessages.STARTING_DATANODE);
     boolean isFirstStart;
     try {
-      
IoTDBDescriptor.getInstance().getMemoryConfig().activateAutoResizingBufferMemoryControl();
-      // Check if this DataNode is start for the first time and do other 
pre-checks
+      // Check whether this is the first DataNode startup and run the 
remaining startup checks.

Review Comment:
   This change removes the call to `activateAutoResizingBufferMemoryControl()`, 
so normal DataNode startup no longer installs the automatic RPC-buffer memory 
controller. That is a functional regression in a comments-only PR; restore the 
activation before `prepareDataNode()` (the method applies the configured 
`MemoryConfig` controller).



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