From d8d25911778cc30c60c3fb2c0372ebe1a222c529 Mon Sep 17 00:00:00 2001 From: Yaobin Chen Date: Thu, 2 Jul 2026 11:52:55 +0800 Subject: [PATCH 1/5] introduce the lease and self-fence mechanism to support high availability of table metadata operation procedure --- .../env/cluster/config/MppCommonConfig.java | 6 + .../cluster/config/MppSharedCommonConfig.java | 7 + .../env/remote/config/RemoteCommonConfig.java | 5 + .../apache/iotdb/itbase/env/CommonConfig.java | 2 + .../it/schema/IoTDBTableDDLHAIT.java | 236 ++++++++++++ .../org/apache/iotdb/rpc/TSStatusCode.java | 1 + .../confignode/i18n/ProcedureMessages.java | 11 +- .../confignode/i18n/ProcedureMessages.java | 1 + .../client/async/CnToDnAsyncRequestType.java | 3 +- ...oDnInternalServiceAsyncRequestManager.java | 7 +- .../heartbeat/DataNodeHeartbeatHandler.java | 6 + .../rpc/DataNodeAsyncRequestRPCHandler.java | 3 +- .../rpc/DataNodeTSStatusRPCHandler.java | 13 +- .../consensus/request/ConfigPhysicalPlan.java | 4 + .../request/ConfigPhysicalPlanType.java | 1 + .../request/read/table/FetchTablePlan.java | 10 +- .../table/RollbackPreDeleteTablePlan.java | 33 ++ .../ConfigRegionStateMachine.java | 10 + .../confignode/manager/ConfigManager.java | 43 ++- .../iotdb/confignode/manager/IManager.java | 4 +- .../confignode/manager/ProcedureManager.java | 5 + .../manager/lease/ClusterCachePropagator.java | 156 ++++++++ .../manager/lease/DataNodeContactTracker.java | 100 +++++ .../lease/MetadataBroadcastVerdict.java | 63 ++++ .../manager/schema/ClusterSchemaManager.java | 61 +++- .../executor/ConfigPlanExecutor.java | 3 + .../persistence/schema/ClusterSchemaInfo.java | 25 +- .../persistence/schema/ConfigMTree.java | 48 ++- .../procedure/env/ConfigNodeProcedureEnv.java | 90 ++--- .../procedure/env/RemoveDataNodeHandler.java | 4 + .../schema/AlterLogicalViewProcedure.java | 31 +- .../AlterTimeSeriesDataTypeProcedure.java | 32 +- .../schema/DeleteLogicalViewProcedure.java | 30 +- .../schema/DeleteTimeSeriesProcedure.java | 33 +- .../procedure/impl/schema/SchemaUtils.java | 116 ++++-- .../impl/schema/SetTTLProcedure.java | 58 ++- .../impl/schema/SetTemplateProcedure.java | 43 +-- .../impl/schema/UnsetTemplateProcedure.java | 39 +- .../AbstractAlterOrDropTableProcedure.java | 36 +- .../schema/table/CreateTableProcedure.java | 36 +- .../schema/table/DeleteDevicesProcedure.java | 46 +-- .../table/DropTableColumnProcedure.java | 62 ++-- .../impl/schema/table/DropTableProcedure.java | 86 +++-- .../state/schema/DropTableState.java | 3 +- .../thrift/ConfigNodeRPCServiceProcessor.java | 14 +- .../lease/ClusterCachePropagatorTest.java | 189 ++++++++++ .../lease/DataNodeContactTrackerTest.java | 73 ++++ .../lease/MetadataBroadcastVerdictTest.java | 77 ++++ .../impl/schema/SetTTLProcedureTest.java | 29 +- .../iotdb/db/i18n/DataNodeSchemaMessages.java | 87 ++--- .../iotdb/db/i18n/DataNodeSchemaMessages.java | 45 ++- .../db/auth/ClusterAuthorityFetcher.java | 16 +- .../db/protocol/client/ConfigNodeClient.java | 12 +- .../impl/DataNodeInternalRPCServiceImpl.java | 11 +- .../cache/partition/PartitionCache.java | 12 + .../executor/ClusterConfigTaskExecutor.java | 7 +- .../config/executor/IConfigTaskExecutor.java | 4 +- .../metadata/TableMetadataImpl.java | 3 +- .../fetcher/cache/TableDeviceSchemaCache.java | 6 +- .../cache/TreeDeviceSchemaCacheManager.java | 13 +- .../lease/MetadataLeaseManager.java | 287 +++++++++++++++ .../table/DataNodeTableCache.java | 343 ++++++++++++++---- .../db/schemaengine/table/ITableCache.java | 20 +- .../metrics/DataNodeMetricsHelper.java | 3 + .../service/metrics/MetadataLeaseMetrics.java | 50 +++ .../utils/MultiTsFileDeviceIterator.java | 11 +- .../ClusterAuthorityFetcherLeaseTest.java | 103 ++++++ .../cache/PartitionCacheLeaseTest.java | 129 +++++++ ...TreeDeviceSchemaCacheManagerLeaseTest.java | 119 ++++++ .../lease/MetadataLeaseManagerTest.java | 111 ++++++ .../lease/MetadataLeaseTestUtils.java | 69 ++++ .../table/DataNodeTableCacheLeaseTest.java | 89 +++++ .../table/DataNodeTableCacheTest.java | 8 +- .../conf/iotdb-system.properties.template | 10 + .../iotdb/commons/concurrent/ThreadName.java | 4 +- .../iotdb/commons/conf/CommonConfig.java | 15 + .../iotdb/commons/conf/CommonDescriptor.java | 5 + .../MetadataLeaseFencedException.java | 33 ++ .../schema/table/NonCommittableTsTable.java | 4 +- .../schema/table/PreDeleteTsTable.java | 39 ++ .../commons/schema/table/TableNodeStatus.java | 10 +- .../iotdb/commons/schema/table/TsTable.java | 10 +- .../src/main/thrift/confignode.thrift | 12 +- 83 files changed, 3069 insertions(+), 625 deletions(-) create mode 100644 integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableDDLHAIT.java create mode 100644 iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/table/RollbackPreDeleteTablePlan.java create mode 100644 iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/ClusterCachePropagator.java create mode 100644 iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/DataNodeContactTracker.java create mode 100644 iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/MetadataBroadcastVerdict.java create mode 100644 iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/lease/ClusterCachePropagatorTest.java create mode 100644 iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/lease/DataNodeContactTrackerTest.java create mode 100644 iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/lease/MetadataBroadcastVerdictTest.java create mode 100644 iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManager.java create mode 100644 iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/MetadataLeaseMetrics.java create mode 100644 iotdb-core/datanode/src/test/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcherLeaseTest.java create mode 100644 iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/PartitionCacheLeaseTest.java create mode 100644 iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceSchemaCacheManagerLeaseTest.java create mode 100644 iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManagerTest.java create mode 100644 iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseTestUtils.java create mode 100644 iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCacheLeaseTest.java create mode 100644 iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/exception/MetadataLeaseFencedException.java create mode 100644 iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/PreDeleteTsTable.java diff --git a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppCommonConfig.java b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppCommonConfig.java index bd2fb84e0b600..ec67e5f451bd6 100644 --- a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppCommonConfig.java +++ b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppCommonConfig.java @@ -85,6 +85,12 @@ public CommonConfig setMemtableSizeThreshold(long memtableSizeThreshold) { return this; } + @Override + public CommonConfig setMetadataLeaseFenceMs(long metadataLeaseFenceMs) { + setProperty("metadata_lease_fence_ms", String.valueOf(metadataLeaseFenceMs)); + return this; + } + @Override public CommonConfig setPartitionInterval(long partitionInterval) { setProperty("time_partition_interval", String.valueOf(partitionInterval)); diff --git a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppSharedCommonConfig.java b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppSharedCommonConfig.java index b1c2a4f8d6be5..48544b901d4a5 100644 --- a/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppSharedCommonConfig.java +++ b/integration-test/src/main/java/org/apache/iotdb/it/env/cluster/config/MppSharedCommonConfig.java @@ -61,6 +61,13 @@ public CommonConfig setMemtableSizeThreshold(long memtableSizeThreshold) { return this; } + @Override + public CommonConfig setMetadataLeaseFenceMs(long metadataLeaseFenceMs) { + cnConfig.setMetadataLeaseFenceMs(metadataLeaseFenceMs); + dnConfig.setMetadataLeaseFenceMs(metadataLeaseFenceMs); + return this; + } + @Override public CommonConfig setPartitionInterval(long partitionInterval) { cnConfig.setPartitionInterval(partitionInterval); diff --git a/integration-test/src/main/java/org/apache/iotdb/it/env/remote/config/RemoteCommonConfig.java b/integration-test/src/main/java/org/apache/iotdb/it/env/remote/config/RemoteCommonConfig.java index ba1f7106dd647..752dcd009db0a 100644 --- a/integration-test/src/main/java/org/apache/iotdb/it/env/remote/config/RemoteCommonConfig.java +++ b/integration-test/src/main/java/org/apache/iotdb/it/env/remote/config/RemoteCommonConfig.java @@ -44,6 +44,11 @@ public CommonConfig setMemtableSizeThreshold(long memtableSizeThreshold) { return this; } + @Override + public CommonConfig setMetadataLeaseFenceMs(long metadataLeaseFenceMs) { + return this; + } + @Override public CommonConfig setPartitionInterval(long partitionInterval) { return this; diff --git a/integration-test/src/main/java/org/apache/iotdb/itbase/env/CommonConfig.java b/integration-test/src/main/java/org/apache/iotdb/itbase/env/CommonConfig.java index 5a7a004fa88a2..0ad3c23af16fe 100644 --- a/integration-test/src/main/java/org/apache/iotdb/itbase/env/CommonConfig.java +++ b/integration-test/src/main/java/org/apache/iotdb/itbase/env/CommonConfig.java @@ -32,6 +32,8 @@ public interface CommonConfig { CommonConfig setMemtableSizeThreshold(long memtableSizeThreshold); + CommonConfig setMetadataLeaseFenceMs(long metadataLeaseFenceMs); + CommonConfig setPartitionInterval(long partitionInterval); CommonConfig setCompressor(String compressor); diff --git a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableDDLHAIT.java b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableDDLHAIT.java new file mode 100644 index 0000000000000..de0092352274f --- /dev/null +++ b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableDDLHAIT.java @@ -0,0 +1,236 @@ +/* + * 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.iotdb.relational.it.schema; + +import org.apache.iotdb.consensus.ConsensusFactory; +import org.apache.iotdb.it.env.EnvFactory; +import org.apache.iotdb.it.env.cluster.node.DataNodeWrapper; +import org.apache.iotdb.it.framework.IoTDBTestRunner; +import org.apache.iotdb.itbase.category.TableClusterIT; +import org.apache.iotdb.itbase.env.BaseEnv; + +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.concurrent.Callable; + +import static org.junit.Assert.assertTrue; + +@RunWith(IoTDBTestRunner.class) +@Category({TableClusterIT.class}) +public class IoTDBTableDDLHAIT { + + private final Logger LOGGER = LoggerFactory.getLogger(IoTDBTableDDLHAIT.class); + + @BeforeClass + public static void setUp() throws Exception { + // Small fence threshold so the ConfigNode can prove the stopped DataNode is self-fenced quickly + // (T_proceed = fence + ~5s internal margin), keeping the test fast. Live DataNodes keep + // heartbeating (~1s), so they do not spuriously fence. + // Use 3 replicas so metadata/data-region operations such as DELETE DEVICES can still succeed + // after one DataNode is stopped. + EnvFactory.getEnv() + .getConfig() + .getCommonConfig() + .setMetadataLeaseFenceMs(20000) // default value + .setConfigNodeConsensusProtocolClass(ConsensusFactory.RATIS_CONSENSUS) + .setSchemaRegionConsensusProtocolClass(ConsensusFactory.RATIS_CONSENSUS) + .setDataRegionConsensusProtocolClass(ConsensusFactory.IOT_CONSENSUS) + .setSchemaReplicationFactor(3) + .setDataReplicationFactor(3); + EnvFactory.getEnv().initClusterEnvironment(1, 3); + } + + @AfterClass + public static void tearDown() throws Exception { + EnvFactory.getEnv().cleanClusterEnvironment(); + } + + @Test + public void tableDdlSucceedsWhileOneDataNodeIsDown() throws Exception { + final String databaseName = "test_table_ddl_ha"; + final String tableName = "table_ddl_ha"; + final String createdAfterDownTableName = "table_ddl_ha_created_after_down"; + final DataNodeWrapper liveDataNode = EnvFactory.getEnv().getDataNodeWrapper(0); + final DataNodeWrapper victimDataNode = EnvFactory.getEnv().getDataNodeWrapper(2); + + // Pin the connection to a DataNode we will keep alive, so stopping the victim cannot break it. + try (final Connection connection = + EnvFactory.getEnv() + .getConnection(liveDataNode, "root", "root", BaseEnv.TABLE_SQL_DIALECT); + final Statement statement = connection.createStatement()) { + statement.execute("CREATE DATABASE " + databaseName); + statement.execute("USE " + databaseName); + statement.execute("CREATE TABLE " + tableName + " (dev STRING TAG, s1 INT32 FIELD)"); + statement.execute( + "INSERT INTO " + + tableName + + "(time, dev, s1) VALUES(1, 'dev01', 1), (2, 'dev02', 2), (3, 'dev03', 3)"); + + // ready for the drop database + statement.execute("CREATE TABLE TABLE1 (dev STRING TAG, s1 INT32 FIELD)"); + statement.execute( + "INSERT INTO TABLE1 (time, dev, s1) VALUES(1, 'dev01', 1), (2, 'dev02', 2), (3, 'dev03', 3)"); + // Take one DataNode down. Its last successful ConfigNode contact is now frozen; after + // T_proceed the ConfigNode can treat it as self-fenced and stop waiting for its ack. + victimDataNode.stop(); + Assert.assertFalse("victim DataNode should be stopped", victimDataNode.isAlive()); + + // The DDL broadcast can no longer reach the stopped DataNode. Previously this hard-failed; + // now it must still succeed (after blocking ~T_proceed while the fence is proven). + LOGGER.info("0. start to test high availability of creating table procedure"); + assertStatementEffect( + statement, + "CREATE TABLE " + + createdAfterDownTableName + + " (region STRING TAG, temperature FLOAT FIELD)", + () -> tableExists(statement, createdAfterDownTableName), + "CREATE TABLE must succeed with one DataNode down"); + + LOGGER.info("1. start to test high availability of adding column procedure"); + assertStatementEffect( + statement, + "ALTER TABLE " + tableName + " ADD COLUMN s2 INT32 FIELD", + () -> columnHasType(statement, tableName, "s2", "INT32"), + "ADD COLUMN must succeed with one DataNode down"); + + LOGGER.info("2. start to test high availability of altering column type procedure"); + assertStatementEffect( + statement, + "ALTER TABLE " + tableName + " ALTER COLUMN s2 SET DATA TYPE INT64", + () -> columnHasType(statement, tableName, "s2", "INT64"), + "ALTER COLUMN TYPE must succeed with one DataNode down"); + + LOGGER.info("3. start to test high availability of altering table ttl procedure"); + assertStatementEffect( + statement, + "ALTER TABLE " + tableName + " SET PROPERTIES ttl = 864000", + () -> tableHasTtl(statement, tableName, "864000"), + "ALTER TABLE TTL must succeed with one DataNode down"); + + LOGGER.info("4. start to test high availability of resetting table ttl procedure"); + assertStatementEffect( + statement, + "ALTER TABLE " + tableName + " SET PROPERTIES ttl = 'INF'", + () -> tableHasTtl(statement, tableName, "INF"), + "ALTER TABLE TTL reset must succeed with one DataNode down"); + + LOGGER.info("5. start to test high availability of deleting devices procedure"); + assertStatementEffect( + statement, + "DELETE DEVICES FROM " + tableName + " WHERE dev = 'dev02'", + () -> !deviceExists(statement, tableName, "dev02"), + "DELETE DEVICES must succeed with one DataNode down"); + + LOGGER.info("6. start to test high availability of dropping table procedure"); + assertStatementEffect( + statement, + "DROP TABLE " + tableName, + () -> !tableExists(statement, tableName), + "DROP TABLE must succeed with one DataNode down"); + + LOGGER.info("7. start to test high availability of dropping database procedure"); + assertStatementEffect( + statement, + "DROP DATABASE " + databaseName, + () -> !databaseExists(statement, databaseName), + "DROP DATABASE must succeed with one DataNode down"); + } + } + + private void assertStatementEffect( + final Statement statement, + final String sql, + final Callable effect, + final String message) + throws Exception { + statement.execute(sql); + assertTrue(message, effect.call()); + } + + private boolean tableExists(final Statement statement, final String tableName) throws Exception { + try (final ResultSet resultSet = statement.executeQuery("SHOW TABLES")) { + while (resultSet.next()) { + if (tableName.equalsIgnoreCase(resultSet.getString(1))) { + return true; + } + } + } + return false; + } + + private boolean columnHasType( + final Statement statement, + final String tableName, + final String columnName, + final String dataType) + throws Exception { + try (final ResultSet resultSet = statement.executeQuery("DESCRIBE " + tableName)) { + while (resultSet.next()) { + if (columnName.equalsIgnoreCase(resultSet.getString(1))) { + return dataType.equalsIgnoreCase(resultSet.getString(2)); + } + } + } + return false; + } + + private boolean tableHasTtl(final Statement statement, final String tableName, final String ttl) + throws Exception { + try (final ResultSet resultSet = statement.executeQuery("SHOW TABLES")) { + while (resultSet.next()) { + if (tableName.equalsIgnoreCase(resultSet.getString(1))) { + return ttl.equalsIgnoreCase(resultSet.getString(2)); + } + } + } + return false; + } + + private boolean deviceExists( + final Statement statement, final String tableName, final String device) throws Exception { + try (final ResultSet resultSet = + statement.executeQuery( + "SHOW DEVICES FROM " + tableName + " WHERE dev = '" + device + "'")) { + return resultSet.next(); + } + } + + private boolean databaseExists(final Statement statement, final String databaseName) + throws Exception { + try (final ResultSet resultSet = statement.executeQuery("SHOW DATABASES")) { + while (resultSet.next()) { + if (databaseName.equalsIgnoreCase(resultSet.getString(1))) { + return true; + } + } + } + return false; + } +} diff --git a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TSStatusCode.java b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TSStatusCode.java index 95327bc59db97..384f38028e84a 100644 --- a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TSStatusCode.java +++ b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TSStatusCode.java @@ -90,6 +90,7 @@ public enum TSStatusCode { TYPE_NOT_FOUND(528), DATABASE_CONFLICT(529), DATABASE_MODEL(530), + METADATA_LEASE_FENCED(531), TABLE_NOT_EXISTS(550), TABLE_ALREADY_EXISTS(551), diff --git a/iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ProcedureMessages.java b/iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ProcedureMessages.java index 87e18f5ba906d..f0263b376215a 100644 --- a/iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ProcedureMessages.java +++ b/iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ProcedureMessages.java @@ -435,6 +435,7 @@ public final class ProcedureMessages { "Failed to pre-release {} for table {}.{} to DataNode, failure results: {}"; public static final String FAILED_TO_PRE_SET_TEMPLATE_ON_PATH_DUE_TO = "Failed to pre set template {} on path {} due to {}"; + public static final String FAILED_TO_PROVE_DN_IS_FENCED = "Failed to prove DN is fenced"; public static final String FAILED_TO_PUSH_CONSUMER_GROUP_META_TO_DATANODES_DETAILS = "Failed to push consumer group meta to dataNodes, details: %s"; public static final String FAILED_TO_PUSH_PIPE_META_LIST_TO_DATA_NODES_WILL = @@ -510,7 +511,7 @@ public final class ProcedureMessages { public static final String FAILED_TO_SYNC_TABLE_PRE_CREATE_INFO_TO_DATANODE_FAILURE = "Failed to sync table {}.{} pre-create info to DataNode, failure results: {}"; public static final String FAILED_TO_SYNC_TABLE_ROLLBACK_CREATE_INFO_TO_DATANODE_FAILURE = - "Failed to sync table {}.{} rollback-create info to DataNode {}, failure results: "; + "Failed to sync table {}.{} rollback-create info to DataNode, failure results: {}"; public static final String FAILED_TO_SYNC_TEMPLATE_COMMIT_SET_INFO_ON_PATH_TO = "Failed to sync template {} commit-set info on path {} to DataNode {}"; public static final String FAILED_TO_SYNC_TEMPLATE_PRE_SET_INFO_ON_PATH_TO = @@ -575,8 +576,10 @@ public final class ProcedureMessages { "Invalidate view schemaengine cache failed"; public static final String INVALIDATING_CACHE_FOR_COLUMN_IN_WHEN_DROPPING_COLUMN = "Invalidating cache for column {} in {}.{} when dropping column"; - public static final String INVALIDATING_CACHE_FOR_TABLE_WHEN_DROPPING_TABLE = - "Invalidating cache for table {}.{} when dropping table"; + public static final String PRE_RELEASE_DELETE_TABLE_WHEN_DROPPING_TABLE = + "pre release delete table {}.{} when dropping table"; + public static final String COMMIT_RELEASE_DELETE_TABLE_WHEN_DROPPING_TABLE = + "commit release delete table {}.{} when dropping table"; public static final String INVALID_DATA_TYPE_CANNOT_BE_USED_AS_A_NEW_TYPE = "Invalid data type cannot be used as a new type"; public static final String IO_ERROR_WHEN_DESERIALIZE_AUTHPLAN = @@ -845,6 +848,8 @@ public final class ProcedureMessages { public static final String ROLLBACK_CREATETABLE_COSTS_MS = "Rollback CreateTable-{} costs {}ms."; public static final String ROLLBACK_CREATE_TABLE_FAILED = "Rollback create table failed"; public static final String ROLLBACK_DROPTABLE_COSTS_MS = "Rollback DropTable-{} costs {}ms."; + public static final String ROLLBACK_PRE_DELETE_TABLE_FAILED = + "Rollback pre-delete table %s.%s failed, please manually drop the table"; public static final String ROLLBACK_PRE_RELEASE = "Rollback pre-release "; public static final String ROLLBACK_PRE_RELEASE_TEMPLATE_FAILED = "Rollback pre release template failed"; diff --git a/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java b/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java index 1cb059d6c72f8..5b8c1a85c7fc4 100644 --- a/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java +++ b/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java @@ -435,6 +435,7 @@ public final class ProcedureMessages { "Failed to pre-release {} for table {}.{} to DataNode, failure results: {}"; public static final String FAILED_TO_PRE_SET_TEMPLATE_ON_PATH_DUE_TO = "Failed to pre set template {} on path {} due to {}"; + public static final String FAILED_TO_PROVE_DN_IS_FENCED = "不能证明一个不可达的DN已经处于隔离状态"; public static final String FAILED_TO_PUSH_CONSUMER_GROUP_META_TO_DATANODES_DETAILS = "Failed to push consumer group meta to dataNodes, details: %s"; public static final String FAILED_TO_PUSH_PIPE_META_LIST_TO_DATA_NODES_WILL = diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/CnToDnAsyncRequestType.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/CnToDnAsyncRequestType.java index 2d44c214967f6..cc28fed0ff56e 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/CnToDnAsyncRequestType.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/CnToDnAsyncRequestType.java @@ -45,6 +45,7 @@ public enum CnToDnAsyncRequestType { CHANGE_REGION_LEADER, // Cache + INVALIDATE_PARTITION_CACHE, INVALIDATE_SCHEMA_CACHE, INVALIDATE_LAST_CACHE, CLEAR_CACHE, @@ -121,7 +122,7 @@ public enum CnToDnAsyncRequestType { // Table UPDATE_TABLE, - INVALIDATE_TABLE_CACHE, + PRE_DELETE_TABLE, DELETE_DATA_FOR_DROP_TABLE, DELETE_DEVICES_FOR_DROP_TABLE, INVALIDATE_COLUMN_CACHE, diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/CnToDnInternalServiceAsyncRequestManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/CnToDnInternalServiceAsyncRequestManager.java index 4048016548a16..4c7930240e867 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/CnToDnInternalServiceAsyncRequestManager.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/CnToDnInternalServiceAsyncRequestManager.java @@ -310,6 +310,11 @@ protected void initActionMapBuilder() { (req, client, handler) -> client.fetchSchemaBlackList( (TFetchSchemaBlackListReq) req, (FetchSchemaBlackListRPCHandler) handler)); + actionMapBuilder.put( + CnToDnAsyncRequestType.INVALIDATE_PARTITION_CACHE, + (req, client, handler) -> + client.invalidatePartitionCache( + (TInvalidateCacheReq) req, (DataNodeTSStatusRPCHandler) handler)); actionMapBuilder.put( CnToDnAsyncRequestType.INVALIDATE_SCHEMA_CACHE, (req, client, handler) -> @@ -442,7 +447,7 @@ protected void initActionMapBuilder() { (req, client, handler) -> client.updateTable((TUpdateTableReq) req, (DataNodeTSStatusRPCHandler) handler)); actionMapBuilder.put( - CnToDnAsyncRequestType.INVALIDATE_TABLE_CACHE, + CnToDnAsyncRequestType.PRE_DELETE_TABLE, (req, client, handler) -> client.invalidateTableCache( (TInvalidateTableCacheReq) req, (DataNodeTSStatusRPCHandler) handler)); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/handlers/heartbeat/DataNodeHeartbeatHandler.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/handlers/heartbeat/DataNodeHeartbeatHandler.java index 3114d60ca3a59..4d9df1235209b 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/handlers/heartbeat/DataNodeHeartbeatHandler.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/handlers/heartbeat/DataNodeHeartbeatHandler.java @@ -27,6 +27,7 @@ import org.apache.iotdb.commons.cluster.RegionStatus; import org.apache.iotdb.confignode.conf.ConfigNodeConfig; import org.apache.iotdb.confignode.conf.ConfigNodeDescriptor; +import org.apache.iotdb.confignode.manager.lease.DataNodeContactTracker; import org.apache.iotdb.confignode.manager.load.LoadManager; import org.apache.iotdb.confignode.manager.load.cache.consensus.ConsensusGroupHeartbeatSample; import org.apache.iotdb.confignode.manager.load.cache.node.NodeHeartbeatSample; @@ -93,6 +94,11 @@ public void onComplete(TDataNodeHeartbeatResp heartbeatResp) { } private void cacheNodeHeartbeatSample(TDataNodeHeartbeatResp heartbeatResp) { + // A successful response confirms ConfigNode->DataNode contact; stamp it on the ConfigNode clock + // for the metadata-lease verdict. Kept separate from the load-cache samples (which record the + // echoed send-time) and deliberately not touched in onError, so failures never advance it. + final DataNodeContactTracker contactTracker = DataNodeContactTracker.getInstance(); + contactTracker.recordSuccessfulResponse(nodeId); loadManager .getLoadCache() .cacheDataNodeHeartbeatSample(nodeId, new NodeHeartbeatSample(heartbeatResp)); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/handlers/rpc/DataNodeAsyncRequestRPCHandler.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/handlers/rpc/DataNodeAsyncRequestRPCHandler.java index 38a7462002408..7733d1f145ae6 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/handlers/rpc/DataNodeAsyncRequestRPCHandler.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/handlers/rpc/DataNodeAsyncRequestRPCHandler.java @@ -236,6 +236,7 @@ public static DataNodeAsyncRequestRPCHandler buildHandler( case SET_SYSTEM_STATUS: case NOTIFY_REGION_MIGRATION: case UPDATE_REGION_ROUTE_MAP: + case INVALIDATE_PARTITION_CACHE: case INVALIDATE_SCHEMA_CACHE: case INVALIDATE_MATCHED_SCHEMA_CACHE: case UPDATE_TEMPLATE: @@ -243,7 +244,7 @@ public static DataNodeAsyncRequestRPCHandler buildHandler( case KILL_QUERY_INSTANCE: case RESET_PEER_LIST: case TEST_CONNECTION: - case INVALIDATE_TABLE_CACHE: + case PRE_DELETE_TABLE: case DELETE_DATA_FOR_DROP_TABLE: case DELETE_DEVICES_FOR_DROP_TABLE: case INVALIDATE_COLUMN_CACHE: diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/handlers/rpc/DataNodeTSStatusRPCHandler.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/handlers/rpc/DataNodeTSStatusRPCHandler.java index 04130e42664fc..629e7fc393f90 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/handlers/rpc/DataNodeTSStatusRPCHandler.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/async/handlers/rpc/DataNodeTSStatusRPCHandler.java @@ -26,9 +26,11 @@ import org.apache.iotdb.rpc.RpcUtils; import org.apache.iotdb.rpc.TSStatusCode; +import org.apache.thrift.transport.TTransportException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.net.ConnectException; import java.util.Map; import java.util.concurrent.CountDownLatch; @@ -76,11 +78,14 @@ public void onError(Exception e) { + ", exception: " + e.getMessage(); logFailure(errorMsg); + // the DN throw Exception -> TApplicationException + // the DN crash -> TTransportException or ConnectException + int code = + e instanceof TTransportException || e instanceof ConnectException + ? TSStatusCode.CAN_NOT_CONNECT_DATANODE.getStatusCode() + : TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode(); - responseMap.put( - requestId, - new TSStatus( - RpcUtils.getStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode(), errorMsg))); + responseMap.put(requestId, new TSStatus(RpcUtils.getStatus(code, errorMsg))); countDownLatch.countDown(); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlan.java index b7453fb987665..0d9ca912571a4 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlan.java @@ -116,6 +116,7 @@ import org.apache.iotdb.confignode.consensus.request.write.table.RenameTableColumnPlan; import org.apache.iotdb.confignode.consensus.request.write.table.RenameTablePlan; import org.apache.iotdb.confignode.consensus.request.write.table.RollbackCreateTablePlan; +import org.apache.iotdb.confignode.consensus.request.write.table.RollbackPreDeleteTablePlan; import org.apache.iotdb.confignode.consensus.request.write.table.SetTableColumnCommentPlan; import org.apache.iotdb.confignode.consensus.request.write.table.SetTableCommentPlan; import org.apache.iotdb.confignode.consensus.request.write.table.SetTablePropertiesPlan; @@ -444,6 +445,9 @@ public static ConfigPhysicalPlan create(final ByteBuffer buffer) throws IOExcept case PreDeleteView: plan = new PreDeleteViewPlan(); break; + case RollbackPreDeleteTable: + plan = new RollbackPreDeleteTablePlan(); + break; case CommitDeleteTable: plan = new CommitDeleteTablePlan(configPhysicalPlanType); break; diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanType.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanType.java index dce1db12cd032..1be9518141483 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanType.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/ConfigPhysicalPlanType.java @@ -232,6 +232,7 @@ public enum ConfigPhysicalPlanType { RenameViewColumn((short) 877), AlterColumnDataType((short) 878), PreAlterColumnDataType((short) 879), + RollbackPreDeleteTable((short) 880), /** Deprecated types for sync, restored them for upgrade. */ @Deprecated diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/table/FetchTablePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/table/FetchTablePlan.java index a69eda99d79af..7d7dabdf89579 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/table/FetchTablePlan.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/read/table/FetchTablePlan.java @@ -19,6 +19,7 @@ package org.apache.iotdb.confignode.consensus.request.read.table; +import org.apache.iotdb.commons.schema.table.TableNodeStatus; import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType; import org.apache.iotdb.confignode.consensus.request.read.ConfigPhysicalReadPlan; @@ -28,13 +29,20 @@ public class FetchTablePlan extends ConfigPhysicalReadPlan { private final Map> fetchTableMap; + private final Set tableNodeStatusSet; - public FetchTablePlan(final Map> fetchTableMap) { + public FetchTablePlan( + final Map> fetchTableMap, Set tableNodeStatus) { super(ConfigPhysicalPlanType.FetchTable); this.fetchTableMap = fetchTableMap; + this.tableNodeStatusSet = tableNodeStatus; } public Map> getFetchTableMap() { return fetchTableMap; } + + public Set getTableNodeStatusSet() { + return tableNodeStatusSet; + } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/table/RollbackPreDeleteTablePlan.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/table/RollbackPreDeleteTablePlan.java new file mode 100644 index 0000000000000..3d30cf1262e9b --- /dev/null +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/request/write/table/RollbackPreDeleteTablePlan.java @@ -0,0 +1,33 @@ +/* + * 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.iotdb.confignode.consensus.request.write.table; + +import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlanType; + +public class RollbackPreDeleteTablePlan extends AbstractTablePlan { + + public RollbackPreDeleteTablePlan() { + super(ConfigPhysicalPlanType.RollbackPreDeleteTable); + } + + public RollbackPreDeleteTablePlan(final String database, final String tableName) { + super(ConfigPhysicalPlanType.RollbackPreDeleteTable, database, tableName); + } +} diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java index ad0a82bcf56b3..3674b531fbd12 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/consensus/statemachine/ConfigRegionStateMachine.java @@ -37,6 +37,7 @@ import org.apache.iotdb.confignode.i18n.ConfigNodeMessages; import org.apache.iotdb.confignode.manager.ConfigManager; import org.apache.iotdb.confignode.manager.consensus.ConsensusManager; +import org.apache.iotdb.confignode.manager.lease.DataNodeContactTracker; import org.apache.iotdb.confignode.manager.pipe.agent.PipeConfigNodeAgent; import org.apache.iotdb.confignode.persistence.executor.ConfigPlanExecutor; import org.apache.iotdb.confignode.persistence.schema.ConfigNodeSnapshotParser; @@ -304,6 +305,15 @@ public void notifyLeaderReady() { ConfigNodeMessages.CURRENT_NODE_NODEID_IP_PORT_BECOMES_CONFIG_REGION_LEADER, ConfigNodeDescriptor.getInstance().getConf().getConfigNodeId(), currentNodeTEndPoint); + + // Reset every DataNode's last-contact time to now on (re)acquiring leadership: a stale + // timestamp + // left from a previous leadership term (while another ConfigNode was contacting the DataNodes) + // would otherwise let the metadata-broadcast verdict wrongly judge a live DataNode as fenced. + DataNodeContactTracker.getInstance() + .onLeadershipAcquired( + configManager.getNodeManager().getRegisteredDataNodeLocations().keySet()); + // Bump the epoch eagerly so that any in-flight services of an older epoch are invalidated // immediately, even before the (serialized) become-leader orchestration gets to run. final long epoch = nextLeaderServicesEpoch(); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java index b11c83d5784e9..178ba7ddd025e 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java @@ -58,6 +58,7 @@ import org.apache.iotdb.commons.pipe.sink.payload.airgap.AirGapPseudoTPipeTransferRequest; import org.apache.iotdb.commons.schema.SchemaConstant; import org.apache.iotdb.commons.schema.table.AlterOrDropTableOperationType; +import org.apache.iotdb.commons.schema.table.TableNodeStatus; import org.apache.iotdb.commons.schema.table.TreeViewSchema; import org.apache.iotdb.commons.schema.table.TsTable; import org.apache.iotdb.commons.schema.table.TsTableInternalRPCUtil; @@ -168,6 +169,7 @@ import org.apache.iotdb.confignode.rpc.thrift.TCreateTableViewReq; import org.apache.iotdb.confignode.rpc.thrift.TCreateTopicReq; import org.apache.iotdb.confignode.rpc.thrift.TCreateTriggerReq; +import org.apache.iotdb.confignode.rpc.thrift.TDataNodeLeaseRecoveryResp; import org.apache.iotdb.confignode.rpc.thrift.TDataNodeRegisterReq; import org.apache.iotdb.confignode.rpc.thrift.TDataNodeRestartReq; import org.apache.iotdb.confignode.rpc.thrift.TDataNodeRestartResp; @@ -286,6 +288,7 @@ import java.util.Collection; import java.util.Collections; import java.util.Comparator; +import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -3164,19 +3167,41 @@ public TDescTable4InformationSchemaResp describeTable4InformationSchema() { } @Override - public TFetchTableResp fetchTables(final Map> fetchTableMap) { + public TFetchTableResp fetchTables( + final Map> fetchTableMap, TableNodeStatus tableNodeStatus) { final TSStatus status = confirmLeader(); if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { return new TFetchTableResp(status); } - fetchTableMap.forEach( - (key, value) -> - value.removeIf( - table -> - procedureManager - .checkDuplicateTableTask(key, null, table, null, null, null) - .getRight())); - return clusterSchemaManager.fetchTables(fetchTableMap); + switch (tableNodeStatus) { + case USING: + fetchTableMap.forEach( + (key, value) -> + value.removeIf( + table -> + procedureManager + .checkDuplicateTableTask(key, null, table, null, null, null) + .getRight())); + return clusterSchemaManager.fetchTables(fetchTableMap, EnumSet.of(TableNodeStatus.USING)); + case PRE_DELETE: + // for get the pre_delete status table, do not need checkDuplicateTableTask, + // just get the current table, and should find both of using and pre_delete status + return clusterSchemaManager.fetchTables( + fetchTableMap, EnumSet.of(TableNodeStatus.USING, TableNodeStatus.PRE_DELETE)); + case PRE_CREATE: + default: + throw new UnsupportedOperationException(); + } + } + + public TDataNodeLeaseRecoveryResp reloadCacheAfterLeaseRecovery() { + final TSStatus status = confirmLeader(); + if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { + return new TDataNodeLeaseRecoveryResp().setStatus(status); + } + return new TDataNodeLeaseRecoveryResp() + .setStatus(RpcUtils.SUCCESS_STATUS) + .setTableInfo(clusterSchemaManager.getAllTableInfoForDataNodeActivation()); } @Override diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java index 1dc097b34440b..bae45596812e1 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/IManager.java @@ -35,6 +35,7 @@ import org.apache.iotdb.commons.cluster.NodeStatus; import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.commons.path.PathPatternTree; +import org.apache.iotdb.commons.schema.table.TableNodeStatus; import org.apache.iotdb.confignode.audit.CNAuditLogger; import org.apache.iotdb.confignode.consensus.request.read.ainode.GetAINodeConfigurationPlan; import org.apache.iotdb.confignode.consensus.request.read.database.CountDatabasePlan; @@ -920,7 +921,8 @@ TDescTableResp describeTable( TDescTable4InformationSchemaResp describeTable4InformationSchema(); - TFetchTableResp fetchTables(final Map> fetchTableMap); + TFetchTableResp fetchTables( + final Map> fetchTableMap, TableNodeStatus tableNodeStatus); TSStatus pushHeartbeat(final int dataNodeId, final TPipeHeartbeatResp resp); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ProcedureManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ProcedureManager.java index 28514043188f2..d9e5bec8161c4 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ProcedureManager.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ProcedureManager.java @@ -2394,12 +2394,17 @@ public TDeleteTableDeviceResp deleteDevices( } } + // only care about the AbstractAlterOrDropTableProcedure(except the drop table/view) + // and the DeleteDatabaseProcedure public Map> getAllExecutingTables() { final Map> result = new HashMap<>(); for (final Procedure procedure : executor.getProcedures().values()) { if (procedure.isFinished()) { continue; } + if (procedure instanceof DropTableProcedure) { + continue; + } // CreateTableOrViewProcedure is covered by the default process, thus we can ignore it here // Note that if a table is creating there will not be a working table, and the DN will either // be updated by commit or fetch the CN tables diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/ClusterCachePropagator.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/ClusterCachePropagator.java new file mode 100644 index 0000000000000..e69095a1e8143 --- /dev/null +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/ClusterCachePropagator.java @@ -0,0 +1,156 @@ +/* + * 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.iotdb.confignode.manager.lease; + +import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation; +import org.apache.iotdb.common.rpc.thrift.TSStatus; +import org.apache.iotdb.commons.conf.CommonDescriptor; +import org.apache.iotdb.confignode.manager.IManager; +import org.apache.iotdb.confignode.manager.lease.MetadataBroadcastVerdict.DataNodeState; +import org.apache.iotdb.confignode.manager.lease.MetadataBroadcastVerdict.Verdict; +import org.apache.iotdb.rpc.TSStatusCode; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.function.IntToLongFunction; +import java.util.function.LongSupplier; +import java.util.function.Supplier; + +/** + * Broadcasts one Tier-A cache invalidation and turns the per-DataNode responses into a {@link + * Verdict}. An unreachable DataNode can be skipped only after it is provably self-fenced. + */ +public class ClusterCachePropagator { + + /** + * {@code T_proceed = T_fence + margin}. The margin covers heartbeat-recording granularity and + * scheduling jitter. + */ + private static final long DEFAULT_PROCEED_MARGIN_MS = 5_000L; + + /** How often to retry while waiting for unacked DataNodes to ack or cross T_proceed. */ + private static final long RETRY_INTERVAL_MS = 1_000L; + + /** Broadcasts the cache invalidation to {@code targets} and returns the per-nodeId responses. */ + @FunctionalInterface + public interface CacheBroadcast { + Map sendTo(Map targets); + } + + /** Injectable sleep so the retry loop can be driven deterministically in tests. */ + @FunctionalInterface + interface Sleeper { + void sleepMs(long ms) throws InterruptedException; + } + + private final Supplier> registeredDataNodes; + private final IntToLongFunction elapsedMsSinceLastSuccessfulHeartbeatResponse; + private final LongSupplier fenceTimeoutMs; + private final LongSupplier nanoClock; + private final Sleeper sleeper; + + public ClusterCachePropagator(final IManager configManager) { + this( + () -> configManager.getNodeManager().getRegisteredDataNodeLocations(), + nodeId -> DataNodeContactTracker.getInstance().getMillisSinceLastSuccessfulResponse(nodeId), + () -> + CommonDescriptor.getInstance().getConfig().getMetadataLeaseFenceMs() + + DEFAULT_PROCEED_MARGIN_MS, + System::nanoTime, + Thread::sleep); + } + + ClusterCachePropagator( + final Supplier> registeredDataNodes, + final IntToLongFunction elapsedMsSinceLastSuccessfulHeartbeatResponse, + final LongSupplier fenceTimeoutMs, + final LongSupplier nanoClock, + final Sleeper sleeper) { + this.registeredDataNodes = registeredDataNodes; + this.elapsedMsSinceLastSuccessfulHeartbeatResponse = + elapsedMsSinceLastSuccessfulHeartbeatResponse; + this.fenceTimeoutMs = fenceTimeoutMs; + this.nanoClock = nanoClock; + this.sleeper = sleeper; + } + + /** + * Broadcast once and classify the result. {@code waitBudgetExhausted} turns a would-be {@link + * Verdict#WAIT} into {@link Verdict#FAIL}. + */ + public Verdict propagateOnce(final CacheBroadcast broadcast, final boolean waitBudgetExhausted) { + final Map targets = registeredDataNodes.get(); + final Map responses = broadcast.sendTo(targets); + final long fenceTimeOutsMs = this.fenceTimeoutMs.getAsLong(); + final List states = new ArrayList<>(targets.size()); + for (final Integer nodeId : targets.keySet()) { + final TSStatus status = responses.get(nodeId); + // if the status code is not TSStatusCode.CAN_NOT_CONNECT_DATANODE, + // treat it as a DataNode internal execution exception + boolean executeSuccess; + if (status == null) { + executeSuccess = false; + } else { + switch (TSStatusCode.representOf(status.getCode())) { + case SUCCESS_STATUS: + executeSuccess = true; + break; + case CAN_NOT_CONNECT_DATANODE: + executeSuccess = false; + break; + default: + // There is a DN executes procedure with internal failure + return Verdict.FAIL; + } + } + states.add( + new DataNodeState( + executeSuccess, elapsedMsSinceLastSuccessfulHeartbeatResponse.applyAsLong(nodeId))); + } + return MetadataBroadcastVerdict.decide(states, fenceTimeOutsMs, waitBudgetExhausted); + } + + /** + * Broadcast and retry until the verdict is {@link Verdict#PROCEED} or {@link Verdict#FAIL}. + * Blocks the calling thread for up to {@code T_proceed}. + */ + public boolean propagate(final CacheBroadcast broadcast) { + final long deadlineNanos = + nanoClock.getAsLong() + TimeUnit.MILLISECONDS.toNanos(fenceTimeoutMs.getAsLong()); + while (true) { + final boolean waitBudgetExhausted = nanoClock.getAsLong() >= deadlineNanos; + final Verdict verdict = propagateOnce(broadcast, waitBudgetExhausted); + if (verdict == Verdict.PROCEED) { + return true; + } + if (verdict == Verdict.FAIL) { + return false; + } + try { + sleeper.sleepMs(RETRY_INTERVAL_MS); + } catch (final InterruptedException e) { + Thread.currentThread().interrupt(); + return false; + } + } + } +} diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/DataNodeContactTracker.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/DataNodeContactTracker.java new file mode 100644 index 0000000000000..939287baa5873 --- /dev/null +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/DataNodeContactTracker.java @@ -0,0 +1,100 @@ +/* + * 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.iotdb.confignode.manager.lease; + +import java.util.Collection; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.LongSupplier; + +/** + * Tracks, per DataNode, the time the ConfigNode last received a successful heartbeat + * response from it, stamped with the ConfigNode's own monotonic clock at receipt. + * + *

This is the sound signal for deciding whether an unreachable DataNode has self-fenced (used by + * the metadata-lease verdict). It must be kept separate from the load-cache {@code + * NodeHeartbeatSample}s, which (a) record the heartbeat send time echoed back by the + * DataNode — not response receipt — and (b) are advanced to the current time by failure ({@code + * onError}) samples. Either property would break the verdict: send-time can make the ConfigNode + * believe a DataNode is fenced while it just renewed from a delayed heartbeat, and failure-advanced + * time would keep the age from ever growing. + * + *

By construction there is no method that advances the time on failure: only {@link + * #recordSuccessfulResponse(int)} updates it. A never-contacted DataNode reads as age 0 (treated as + * just-contacted) so the verdict never wrongly declares an unknown DataNode fenced. + */ +public class DataNodeContactTracker { + + private final LongSupplier nanoClock; + + private final Map lastSuccessfulResponseNanos = new ConcurrentHashMap<>(); + + private DataNodeContactTracker() { + this(System::nanoTime); + } + + DataNodeContactTracker(final LongSupplier nanoClock) { + this.nanoClock = nanoClock; + } + + /** Record that a successful heartbeat response from the DataNode was just received. */ + public void recordSuccessfulResponse(final int dataNodeId) { + lastSuccessfulResponseNanos.put(dataNodeId, nanoClock.getAsLong()); + } + + /** + * Milliseconds since the ConfigNode last received a successful heartbeat response from the + * DataNode. Returns 0 (treated as just-contacted) if never recorded — conservative, so an unknown + * DataNode is never declared fenced. + */ + public long getMillisSinceLastSuccessfulResponse(final int dataNodeId) { + final Long lastNanos = lastSuccessfulResponseNanos.get(dataNodeId); + if (lastNanos == null) { + return 0L; + } + final long elapsedNanos = nanoClock.getAsLong() - lastNanos; + return elapsedNanos > 0 ? elapsedNanos / 1_000_000L : 0L; + } + + /** + * On leadership acquisition, conservatively reset contact ages so this leader does not infer any + * dataNode as fencing state from its previous record history. + */ + public void onLeadershipAcquired(final Collection registeredDataNodeIds) { + final long now = nanoClock.getAsLong(); + for (final Integer dataNodeId : registeredDataNodeIds) { + lastSuccessfulResponseNanos.put(dataNodeId, now); + } + } + + public void removeDataNode(final int dataNodeId) { + lastSuccessfulResponseNanos.remove(dataNodeId); + } + + public static DataNodeContactTracker getInstance() { + return DataNodeContactTrackerHolder.INSTANCE; + } + + private static final class DataNodeContactTrackerHolder { + private static final DataNodeContactTracker INSTANCE = new DataNodeContactTracker(); + + private DataNodeContactTrackerHolder() {} + } +} diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/MetadataBroadcastVerdict.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/MetadataBroadcastVerdict.java new file mode 100644 index 0000000000000..622d432c2315b --- /dev/null +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/MetadataBroadcastVerdict.java @@ -0,0 +1,63 @@ +/* + * 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.iotdb.confignode.manager.lease; + +import java.util.Collection; + +/** + * Pure decision logic for metadata-broadcast verdicts. + * + *

A DataNode that failed to ack is assumed to support self-fencing (enforced by the caller). The + * overall verdict is {@code PROCEED} when every unacked DataNode has been silent for at least + * {@code T_proceed}; otherwise {@code WAIT} until the retry budget is exhausted, then {@code FAIL}. + */ +public final class MetadataBroadcastVerdict { + + public enum Verdict { + PROCEED, + WAIT, + FAIL + } + + private MetadataBroadcastVerdict() {} + + /** Per-DataNode inputs for one broadcast round. */ + public static final class DataNodeState { + private final boolean executeSuccess; + private final long hbAgeMs; + + public DataNodeState(final boolean executeSuccess, final long hbAgeMs) { + this.executeSuccess = executeSuccess; + this.hbAgeMs = hbAgeMs; + } + } + + public static Verdict decide( + final Collection states, + final long fenceTimeOutsMs, + final boolean waitBudgetExhausted) { + for (final DataNodeState state : states) { + if (!state.executeSuccess && state.hbAgeMs < fenceTimeOutsMs) { + return waitBudgetExhausted ? Verdict.FAIL : Verdict.WAIT; + } + } + return Verdict.PROCEED; + } +} diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/schema/ClusterSchemaManager.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/schema/ClusterSchemaManager.java index 6b0c82ff1f056..a9c9c978527d2 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/schema/ClusterSchemaManager.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/schema/ClusterSchemaManager.java @@ -29,6 +29,7 @@ import org.apache.iotdb.commons.schema.SchemaConstant; import org.apache.iotdb.commons.schema.table.Audit; import org.apache.iotdb.commons.schema.table.NonCommittableTsTable; +import org.apache.iotdb.commons.schema.table.PreDeleteTsTable; import org.apache.iotdb.commons.schema.table.TableNodeStatus; import org.apache.iotdb.commons.schema.table.TreeViewSchema; import org.apache.iotdb.commons.schema.table.TsTable; @@ -1369,10 +1370,13 @@ public TDescTable4InformationSchemaResp describeTables4InformationSchema() { } } - public TFetchTableResp fetchTables(final Map> fetchTableMap) { + public TFetchTableResp fetchTables( + final Map> fetchTableMap, Set tableNodeStatus) { try { return ((FetchTableResp) - configManager.getConsensusManager().read(new FetchTablePlan(fetchTableMap))) + configManager + .getConsensusManager() + .read(new FetchTablePlan(fetchTableMap, tableNodeStatus))) .convertToTFetchTableResp(); } catch (final ConsensusException e) { LOGGER.warn(ConfigNodeMessages.FAILED_IN_THE_READ_API_EXECUTING_THE_CONSENSUS_LAYER_DUE, e); @@ -1391,23 +1395,42 @@ public byte[] getAllTableInfoForDataNodeActivation() { final Map> alteringTables = configManager.getProcedureManager().getAllExecutingTables(); final Map> usingTableMap = clusterSchemaInfo.getAllUsingTables(); - final Map> preCreateTableMap = clusterSchemaInfo.getAllPreCreateTables(); - alteringTables.forEach( - (k, v) -> { - final List preCreateList = - preCreateTableMap.computeIfAbsent(k, database -> new ArrayList<>()); - if (Objects.isNull(v)) { - usingTableMap - .remove(k) - .forEach( - table -> preCreateList.add(new NonCommittableTsTable(table.getTableName()))); - } else { - preCreateList.addAll( - v.stream().map(NonCommittableTsTable::new).collect(Collectors.toList())); - } - }); - return TsTableInternalRPCUtil.serializeTableInitializationInfo( - usingTableMap, preCreateTableMap); + final Map> allPreDeleteTables = clusterSchemaInfo.getAllPreDeleteTables(); + // the specialStatusMap will hold the PreCreate/PreDelete/altering table(NonCommittableTsTable) + final Map> specialStatusMap = clusterSchemaInfo.getAllPreCreateTables(); + + for (Map.Entry> databaseEntry : alteringTables.entrySet()) { + String databaseName = databaseEntry.getKey(); + List alteringTableList = databaseEntry.getValue(); + List speicalMapList = + specialStatusMap.computeIfAbsent(databaseName, name -> new ArrayList<>()); + + // 1. if the alteringTableList is null, means that executing the drop database is going on + if (Objects.isNull(alteringTableList)) { + List relatedTables = usingTableMap.remove(databaseName); + relatedTables.forEach( + table -> speicalMapList.add(new NonCommittableTsTable(table.getTableName()))); + } else { + // 2. if the table has existed, the procedure is modifying it. + // so the usingTableMap and specialStatusMap both hold it + speicalMapList.addAll( + alteringTableList.stream() + .map(NonCommittableTsTable::new) + .collect(Collectors.toList())); + } + } + // 3. deal with the pre_delete status table, add the PreDeleteTsTable table + for (Map.Entry> entry : allPreDeleteTables.entrySet()) { + String databaseName = entry.getKey(); + List preDeleteTables = entry.getValue(); + specialStatusMap + .computeIfAbsent(databaseName, name -> new ArrayList<>()) + .addAll( + preDeleteTables.stream() + .map(tsTable -> new PreDeleteTsTable(tsTable.getTableName())) + .collect(Collectors.toList())); + } + return TsTableInternalRPCUtil.serializeTableInitializationInfo(usingTableMap, specialStatusMap); } // endregion diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java index 4a70ace8ca19e..2dd49c1db36ed 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/executor/ConfigPlanExecutor.java @@ -133,6 +133,7 @@ import org.apache.iotdb.confignode.consensus.request.write.table.RenameTableColumnPlan; import org.apache.iotdb.confignode.consensus.request.write.table.RenameTablePlan; import org.apache.iotdb.confignode.consensus.request.write.table.RollbackCreateTablePlan; +import org.apache.iotdb.confignode.consensus.request.write.table.RollbackPreDeleteTablePlan; import org.apache.iotdb.confignode.consensus.request.write.table.SetTableColumnCommentPlan; import org.apache.iotdb.confignode.consensus.request.write.table.SetTableCommentPlan; import org.apache.iotdb.confignode.consensus.request.write.table.SetTablePropertiesPlan; @@ -606,6 +607,8 @@ public TSStatus executeNonQueryPlan(ConfigPhysicalPlan physicalPlan) case PreDeleteTable: case PreDeleteView: return clusterSchemaInfo.preDeleteTable((PreDeleteTablePlan) physicalPlan); + case RollbackPreDeleteTable: + return clusterSchemaInfo.rollbackPreDeleteTable((RollbackPreDeleteTablePlan) physicalPlan); case CommitDeleteTable: case CommitDeleteView: return clusterSchemaInfo.dropTable((CommitDeleteTablePlan) physicalPlan); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java index b4e2f349f015a..4abea616a2e85 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java @@ -66,6 +66,7 @@ import org.apache.iotdb.confignode.consensus.request.write.table.RenameTableColumnPlan; import org.apache.iotdb.confignode.consensus.request.write.table.RenameTablePlan; import org.apache.iotdb.confignode.consensus.request.write.table.RollbackCreateTablePlan; +import org.apache.iotdb.confignode.consensus.request.write.table.RollbackPreDeleteTablePlan; import org.apache.iotdb.confignode.consensus.request.write.table.SetTableColumnCommentPlan; import org.apache.iotdb.confignode.consensus.request.write.table.SetTableCommentPlan; import org.apache.iotdb.confignode.consensus.request.write.table.SetTablePropertiesPlan; @@ -1187,6 +1188,13 @@ public TSStatus commitCreateTable(final CommitCreateTablePlan plan) { getQualifiedDatabasePartialPath(plan.getDatabase()), plan.getTableName())); } + public TSStatus rollbackPreDeleteTable(final RollbackPreDeleteTablePlan plan) { + return executeWithLock( + () -> + tableModelMTree.rollbackPreDeleteTable( + getQualifiedDatabasePartialPath(plan.getDatabase()), plan.getTableName())); + } + public TSStatus preDeleteTable(final PreDeleteTablePlan plan) { return executeWithLock( () -> @@ -1343,7 +1351,8 @@ public FetchTableResp fetchTables(final FetchTablePlan plan) { database2Tables.getKey(), tableModelMTree.getSpecificTablesUnderSpecificDatabase( getQualifiedDatabasePartialPath(database2Tables.getKey()), - database2Tables.getValue())); + database2Tables.getValue(), + plan.getTableNodeStatusSet())); } catch (final DatabaseNotSetException ignore) { // continue } @@ -1447,7 +1456,19 @@ public Map> getAllUsingTables() { public Map> getAllPreCreateTables() { databaseReadWriteLock.readLock().lock(); try { - return tableModelMTree.getAllPreCreateTables(); + return tableModelMTree.getAllSpecialStatusTables(TableNodeStatus.PRE_CREATE); + } catch (final MetadataException e) { + LOGGER.warn(e.getMessage(), e); + throw new RuntimeException(e); + } finally { + databaseReadWriteLock.readLock().unlock(); + } + } + + public Map> getAllPreDeleteTables() { + databaseReadWriteLock.readLock().lock(); + try { + return tableModelMTree.getAllSpecialStatusTables(TableNodeStatus.PRE_DELETE); } catch (final MetadataException e) { LOGGER.warn(e.getMessage(), e); throw new RuntimeException(e); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java index cf8d9d5e2ed3a..43e72240a0459 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ConfigMTree.java @@ -33,6 +33,7 @@ import org.apache.iotdb.commons.schema.node.role.IDatabaseMNode; import org.apache.iotdb.commons.schema.node.utils.IMNodeFactory; import org.apache.iotdb.commons.schema.node.utils.IMNodeIterator; +import org.apache.iotdb.commons.schema.table.PreDeleteTsTable; import org.apache.iotdb.commons.schema.table.TableNodeStatus; import org.apache.iotdb.commons.schema.table.TreeViewSchema; import org.apache.iotdb.commons.schema.table.TsTable; @@ -754,6 +755,16 @@ public void preDeleteTable( tableNode.setStatus(TableNodeStatus.PRE_DELETE); } + public void rollbackPreDeleteTable(final PartialPath database, final String tableName) + throws MetadataException { + final IConfigMNode databaseNode = getDatabaseNodeByDatabasePath(database).getAsMNode(); + if (!databaseNode.hasChild(tableName)) { + return; + } + final ConfigTableNode tableNode = (ConfigTableNode) databaseNode.getChild(tableName); + tableNode.setStatus(TableNodeStatus.USING); + } + public void dropTable(final PartialPath database, final String tableName) throws MetadataException { final IConfigMNode databaseNode = getDatabaseNodeByDatabasePath(database).getAsMNode(); @@ -845,19 +856,25 @@ public List> getAllTablesUnderSpecificDatabase( } public Map getSpecificTablesUnderSpecificDatabase( - final PartialPath databasePath, final Set tables) throws MetadataException { + final PartialPath databasePath, + final Set tables, + final Set statusSet) + throws MetadataException { final IConfigMNode databaseNode = getDatabaseNodeByDatabasePath(databasePath).getAsMNode(); final Map result = new HashMap<>(); - tables.forEach( - table -> { - final IConfigMNode child = databaseNode.getChildren().get(table); - if (child instanceof ConfigTableNode - && ((ConfigTableNode) child).getStatus().equals(TableNodeStatus.USING)) { - result.put(table, ((ConfigTableNode) child).getTable()); - } else { - result.put(table, null); - } - }); + for (final String tableName : tables) { + final IConfigMNode child = databaseNode.getChildren().get(tableName); + if (child instanceof ConfigTableNode + && statusSet.contains(((ConfigTableNode) child).getStatus())) { + TsTable table = + ((ConfigTableNode) child).getStatus() == TableNodeStatus.PRE_DELETE + ? new PreDeleteTsTable(tableName) + : ((ConfigTableNode) child).getTable(); + result.put(tableName, table); + } else { + result.put(tableName, null); + } + } return result; } @@ -893,7 +910,12 @@ public Map> getAllUsingTables() { })); } - public Map> getAllPreCreateTables() throws MetadataException { + public Map> getAllSpecialStatusTables(TableNodeStatus tableNodeStatus) + throws MetadataException { + if (TableNodeStatus.PRE_CREATE != tableNodeStatus + && TableNodeStatus.PRE_DELETE != tableNodeStatus) { + throw new SemanticException("Invalid table status " + tableNodeStatus); + } final Map> result = new HashMap<>(); final List databaseList = getAllDatabasePaths(true); for (final PartialPath databasePath : databaseList) { @@ -902,7 +924,7 @@ public Map> getAllPreCreateTables() throws MetadataExcepti for (final IConfigMNode child : databaseNode.getChildren().values()) { if (child instanceof ConfigTableNode) { final ConfigTableNode tableNode = (ConfigTableNode) child; - if (!tableNode.getStatus().equals(TableNodeStatus.PRE_CREATE)) { + if (!tableNode.getStatus().equals(tableNodeStatus)) { continue; } result.computeIfAbsent(database, k -> new ArrayList<>()).add(tableNode.getTable()); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java index ab4f367df9242..55263db0cd4eb 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java @@ -22,7 +22,6 @@ import org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation; import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId; import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType; -import org.apache.iotdb.common.rpc.thrift.TDataNodeConfiguration; import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation; import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet; import org.apache.iotdb.common.rpc.thrift.TSStatus; @@ -36,9 +35,7 @@ import org.apache.iotdb.confignode.client.async.CnToDnAsyncRequestType; import org.apache.iotdb.confignode.client.async.CnToDnInternalServiceAsyncRequestManager; import org.apache.iotdb.confignode.client.async.handlers.DataNodeAsyncRequestContext; -import org.apache.iotdb.confignode.client.sync.CnToDnSyncRequestType; import org.apache.iotdb.confignode.client.sync.SyncConfigNodeClientPool; -import org.apache.iotdb.confignode.client.sync.SyncDataNodeClientPool; import org.apache.iotdb.confignode.consensus.request.write.confignode.RemoveConfigNodePlan; import org.apache.iotdb.confignode.consensus.request.write.database.DeleteDatabasePlan; import org.apache.iotdb.confignode.consensus.request.write.database.PreDeleteDatabasePlan; @@ -47,6 +44,7 @@ import org.apache.iotdb.confignode.exception.AddPeerException; import org.apache.iotdb.confignode.manager.ConfigManager; import org.apache.iotdb.confignode.manager.consensus.ConsensusManager; +import org.apache.iotdb.confignode.manager.lease.ClusterCachePropagator; import org.apache.iotdb.confignode.manager.load.LoadManager; import org.apache.iotdb.confignode.manager.load.cache.region.RegionHeartbeatSample; import org.apache.iotdb.confignode.manager.node.NodeManager; @@ -97,7 +95,6 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; @@ -165,74 +162,33 @@ public void preDeleteDatabase( getPartitionManager().preDeleteDatabase(deleteSgName, preDeleteType); } - /** - * @param databaseName database name - * @return ALL SUCCESS OR NOT - * @throws IOException IOE - * @throws TException Thrift IOE - */ public boolean invalidateCache(final String databaseName) throws IOException, TException { - final List allDataNodes = getNodeManager().getRegisteredDataNodes(); final TInvalidateCacheReq invalidateCacheReq = new TInvalidateCacheReq(); invalidateCacheReq.setStorageGroup(true); invalidateCacheReq.setFullPath(databaseName); - for (final TDataNodeConfiguration dataNodeConfiguration : allDataNodes) { - final int dataNodeId = dataNodeConfiguration.getLocation().getDataNodeId(); - - // If the node is not alive, retry for up to 10 times - NodeStatus nodeStatus = getLoadManager().getNodeStatus(dataNodeId); - int retryNum = 10; - if (nodeStatus == NodeStatus.Unknown) { - for (int i = 0; i < retryNum && nodeStatus == NodeStatus.Unknown; i++) { - try { - TimeUnit.MILLISECONDS.sleep(500); - } catch (final InterruptedException e) { - LOG.error("Sleep failed in ConfigNodeProcedureEnv: ", e); - Thread.currentThread().interrupt(); - break; - } - nodeStatus = getLoadManager().getNodeStatus(dataNodeId); - } - } - - if (nodeStatus == NodeStatus.Unknown) { - LOG.warn( - "Invalidate cache failed, because DataNode {} is Unknown", - dataNodeConfiguration.getLocation().getInternalEndPoint()); - return false; - } - - // Always invalidate PartitionCache first - final TSStatus invalidatePartitionStatus = - (TSStatus) - SyncDataNodeClientPool.getInstance() - .sendSyncRequestToDataNodeWithRetry( - dataNodeConfiguration.getLocation().getInternalEndPoint(), - invalidateCacheReq, - CnToDnSyncRequestType.INVALIDATE_PARTITION_CACHE); - - final TSStatus invalidateSchemaStatus = - (TSStatus) - SyncDataNodeClientPool.getInstance() - .sendSyncRequestToDataNodeWithRetry( - dataNodeConfiguration.getLocation().getInternalEndPoint(), - invalidateCacheReq, - CnToDnSyncRequestType.INVALIDATE_SCHEMA_CACHE); - - if (!verifySucceed(invalidatePartitionStatus, invalidateSchemaStatus)) { - LOG.error( - "Invalidate cache failed, invalidate partition cache status is {}, invalidate schemaengine cache status is {}", - invalidatePartitionStatus, - invalidateSchemaStatus); - return false; - } + // The per-round cache invalidation is sent asynchronously so the lease framework can collect a + // cluster-wide ack map and decide whether unAcked DataNodes are safely fenced. + final ClusterCachePropagator propagator = new ClusterCachePropagator(configManager); + if (!propagator.propagate( + targets -> + invalidateDatabaseCacheOnce( + targets, invalidateCacheReq, CnToDnAsyncRequestType.INVALIDATE_PARTITION_CACHE))) { + return false; } - return true; - } - - public boolean verifySucceed(TSStatus... status) { - return Arrays.stream(status) - .allMatch(tsStatus -> tsStatus.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()); + return propagator.propagate( + targets -> + invalidateDatabaseCacheOnce( + targets, invalidateCacheReq, CnToDnAsyncRequestType.INVALIDATE_SCHEMA_CACHE)); + } + + private Map invalidateDatabaseCacheOnce( + final Map targets, + final TInvalidateCacheReq invalidateCacheReq, + final CnToDnAsyncRequestType requestType) { + final DataNodeAsyncRequestContext clientHandler = + new DataNodeAsyncRequestContext<>(requestType, invalidateCacheReq, targets); + CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); + return clientHandler.getResponseMap(); } /** diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/RemoveDataNodeHandler.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/RemoveDataNodeHandler.java index 6782c1b652a3b..03ad7f3312c6c 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/RemoveDataNodeHandler.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/RemoveDataNodeHandler.java @@ -40,6 +40,7 @@ import org.apache.iotdb.confignode.i18n.ConfigNodeMessages; import org.apache.iotdb.confignode.i18n.ProcedureMessages; import org.apache.iotdb.confignode.manager.ConfigManager; +import org.apache.iotdb.confignode.manager.lease.DataNodeContactTracker; import org.apache.iotdb.confignode.manager.load.balancer.region.GreedyCopySetRegionGroupAllocator; import org.apache.iotdb.confignode.manager.load.balancer.region.IRegionGroupAllocator; import org.apache.iotdb.confignode.manager.load.cache.node.NodeHeartbeatSample; @@ -455,6 +456,9 @@ public void removeDataNodePersistence(List removedDataNodes) PartitionMetrics.unbindDataNodePartitionMetricsWhenUpdate( MetricService.getInstance(), NodeUrlUtils.convertTEndPointUrl(dataNodeLocation.getClientRpcEndPoint())); + // Drop the removed DataNode's metadata-lease contact/capability state so it is not retained, + // and a future DataNode reusing the id cannot inherit stale fencing history. + DataNodeContactTracker.getInstance().removeDataNode(dataNodeLocation.getDataNodeId()); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedure.java index 8c8d2019f4de8..b5783e908a944 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterLogicalViewProcedure.java @@ -31,8 +31,6 @@ import org.apache.iotdb.commons.path.PathPatternTree; import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression; import org.apache.iotdb.confignode.client.async.CnToDnAsyncRequestType; -import org.apache.iotdb.confignode.client.async.CnToDnInternalServiceAsyncRequestManager; -import org.apache.iotdb.confignode.client.async.handlers.DataNodeAsyncRequestContext; import org.apache.iotdb.confignode.i18n.ProcedureMessages; import org.apache.iotdb.confignode.procedure.env.ConfigNodeProcedureEnv; import org.apache.iotdb.confignode.procedure.exception.ProcedureException; @@ -42,7 +40,6 @@ import org.apache.iotdb.db.exception.BatchProcessException; import org.apache.iotdb.db.exception.metadata.view.ViewNotExistException; import org.apache.iotdb.mpp.rpc.thrift.TAlterViewReq; -import org.apache.iotdb.mpp.rpc.thrift.TInvalidateMatchedSchemaCacheReq; import org.apache.iotdb.rpc.TSStatusCode; import org.apache.tsfile.utils.ReadWriteIOUtils; @@ -123,27 +120,15 @@ protected Flow executeFromState( } private void invalidateCache(final ConfigNodeProcedureEnv env) { - final Map dataNodeLocationMap = - env.getConfigManager().getNodeManager().getRegisteredDataNodeLocations(); - final DataNodeAsyncRequestContext clientHandler = - new DataNodeAsyncRequestContext<>( - CnToDnAsyncRequestType.INVALIDATE_MATCHED_SCHEMA_CACHE, - new TInvalidateMatchedSchemaCacheReq(patternTreeBytes), - dataNodeLocationMap); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); - final Map statusMap = clientHandler.getResponseMap(); - for (final TSStatus status : statusMap.values()) { + if (!SchemaUtils.invalidateMatchedSchemaCache( + env.getConfigManager(), patternTreeBytes, false)) { // all dataNodes must clear the related schemaengine cache - if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - LOGGER.error( - ProcedureMessages.FAILED_TO_INVALIDATE_SCHEMAENGINE_CACHE_OF_VIEW, - viewPathToSourceMap.keySet()); - setFailure( - new ProcedureException( - new MetadataException( - ProcedureMessages.INVALIDATE_VIEW_SCHEMAENGINE_CACHE_FAILED))); - return; - } + LOGGER.error( + ProcedureMessages.FAILED_TO_INVALIDATE_SCHEMAENGINE_CACHE_OF_VIEW, + viewPathToSourceMap.keySet()); + setFailure( + new ProcedureException( + new MetadataException(ProcedureMessages.INVALIDATE_VIEW_SCHEMAENGINE_CACHE_FAILED))); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterTimeSeriesDataTypeProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterTimeSeriesDataTypeProcedure.java index 3a4431047c218..7d6cc571767fe 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterTimeSeriesDataTypeProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterTimeSeriesDataTypeProcedure.java @@ -28,8 +28,6 @@ import org.apache.iotdb.commons.path.PathDeserializeUtil; import org.apache.iotdb.commons.path.PathPatternTree; import org.apache.iotdb.confignode.client.async.CnToDnAsyncRequestType; -import org.apache.iotdb.confignode.client.async.CnToDnInternalServiceAsyncRequestManager; -import org.apache.iotdb.confignode.client.async.handlers.DataNodeAsyncRequestContext; import org.apache.iotdb.confignode.consensus.request.write.pipe.payload.PipeAlterTimeSeriesPlan; import org.apache.iotdb.confignode.consensus.request.write.pipe.payload.PipeEnrichedPlan; import org.apache.iotdb.confignode.i18n.ProcedureMessages; @@ -42,7 +40,6 @@ import org.apache.iotdb.consensus.exception.ConsensusException; import org.apache.iotdb.db.exception.metadata.PathNotExistException; import org.apache.iotdb.mpp.rpc.thrift.TAlterTimeSeriesReq; -import org.apache.iotdb.mpp.rpc.thrift.TInvalidateMatchedSchemaCacheReq; import org.apache.iotdb.pipe.api.exception.PipeException; import org.apache.iotdb.rpc.RpcUtils; import org.apache.iotdb.rpc.TSStatusCode; @@ -249,26 +246,17 @@ public static void invalidateCache( final String requestMessage, final Consumer setFailure, final boolean needLock) { - final Map dataNodeLocationMap = - env.getConfigManager().getNodeManager().getRegisteredDataNodeLocations(); - final DataNodeAsyncRequestContext clientHandler = - new DataNodeAsyncRequestContext<>( - CnToDnAsyncRequestType.INVALIDATE_MATCHED_SCHEMA_CACHE, - new TInvalidateMatchedSchemaCacheReq(measurementPathBytes).setNeedLock(needLock), - dataNodeLocationMap); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); - final Map statusMap = clientHandler.getResponseMap(); - for (final TSStatus status : statusMap.values()) { + // Proceed past provably-fenced DataNodes instead of hard-failing on the first unreachable one + // (see SchemaUtils.invalidateMatchedSchemaCache). Runs before the physical datatype change, so + // the "alter only after PROCEED" ordering holds. + if (!SchemaUtils.invalidateMatchedSchemaCache( + env.getConfigManager(), measurementPathBytes, needLock)) { // All dataNodes must clear the related schemaEngine cache - if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - LOGGER.error( - ProcedureMessages.FAILED_TO_INVALIDATE_SCHEMAENGINE_CACHE_OF_TIMESERIES, - requestMessage); - setFailure.accept( - new ProcedureException( - new MetadataException(ProcedureMessages.INVALIDATE_SCHEMAENGINE_CACHE_FAILED))); - return; - } + LOGGER.error( + ProcedureMessages.FAILED_TO_INVALIDATE_SCHEMAENGINE_CACHE_OF_TIMESERIES, requestMessage); + setFailure.accept( + new ProcedureException( + new MetadataException(ProcedureMessages.INVALIDATE_SCHEMAENGINE_CACHE_FAILED))); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteLogicalViewProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteLogicalViewProcedure.java index 5846c79b5219f..c634c21d92423 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteLogicalViewProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteLogicalViewProcedure.java @@ -27,8 +27,6 @@ import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.commons.path.PathPatternTree; import org.apache.iotdb.confignode.client.async.CnToDnAsyncRequestType; -import org.apache.iotdb.confignode.client.async.CnToDnInternalServiceAsyncRequestManager; -import org.apache.iotdb.confignode.client.async.handlers.DataNodeAsyncRequestContext; import org.apache.iotdb.confignode.consensus.request.write.pipe.payload.PipeDeleteLogicalViewPlan; import org.apache.iotdb.confignode.consensus.request.write.pipe.payload.PipeEnrichedPlan; import org.apache.iotdb.confignode.i18n.ProcedureMessages; @@ -41,7 +39,6 @@ import org.apache.iotdb.db.exception.metadata.view.ViewNotExistException; import org.apache.iotdb.mpp.rpc.thrift.TConstructViewSchemaBlackListReq; import org.apache.iotdb.mpp.rpc.thrift.TDeleteViewSchemaReq; -import org.apache.iotdb.mpp.rpc.thrift.TInvalidateMatchedSchemaCacheReq; import org.apache.iotdb.mpp.rpc.thrift.TRollbackViewSchemaBlackListReq; import org.apache.iotdb.pipe.api.exception.PipeException; import org.apache.iotdb.rpc.TSStatusCode; @@ -167,26 +164,15 @@ protected List processResponseOfOneDataNode( } private void invalidateCache(final ConfigNodeProcedureEnv env) { - final Map dataNodeLocationMap = - env.getConfigManager().getNodeManager().getRegisteredDataNodeLocations(); - final DataNodeAsyncRequestContext clientHandler = - new DataNodeAsyncRequestContext<>( - CnToDnAsyncRequestType.INVALIDATE_MATCHED_SCHEMA_CACHE, - new TInvalidateMatchedSchemaCacheReq(patternTreeBytes), - dataNodeLocationMap); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); - final Map statusMap = clientHandler.getResponseMap(); - for (final TSStatus status : statusMap.values()) { + if (!SchemaUtils.invalidateMatchedSchemaCache( + env.getConfigManager(), patternTreeBytes, false)) { // all dataNodes must clear the related schemaengine cache - if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - LOGGER.error( - ProcedureMessages.FAILED_TO_INVALIDATE_SCHEMAENGINE_CACHE_OF_VIEW, requestMessage); - setFailure( - new ProcedureException( - new MetadataException( - ProcedureMessages.INVALIDATE_VIEW_SCHEMAENGINE_CACHE_FAILED))); - return; - } + LOGGER.error( + ProcedureMessages.FAILED_TO_INVALIDATE_SCHEMAENGINE_CACHE_OF_VIEW, requestMessage); + setFailure( + new ProcedureException( + new MetadataException(ProcedureMessages.INVALIDATE_VIEW_SCHEMAENGINE_CACHE_FAILED))); + return; } setNextState(DeleteLogicalViewState.DELETE_VIEW_SCHEMA); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteTimeSeriesProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteTimeSeriesProcedure.java index 1cd5efe639cd8..107984dc603d1 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteTimeSeriesProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/DeleteTimeSeriesProcedure.java @@ -27,8 +27,6 @@ import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.commons.path.PathPatternTree; import org.apache.iotdb.confignode.client.async.CnToDnAsyncRequestType; -import org.apache.iotdb.confignode.client.async.CnToDnInternalServiceAsyncRequestManager; -import org.apache.iotdb.confignode.client.async.handlers.DataNodeAsyncRequestContext; import org.apache.iotdb.confignode.consensus.request.write.pipe.payload.PipeDeleteTimeSeriesPlan; import org.apache.iotdb.confignode.consensus.request.write.pipe.payload.PipeEnrichedPlan; import org.apache.iotdb.confignode.i18n.ProcedureMessages; @@ -42,7 +40,6 @@ import org.apache.iotdb.mpp.rpc.thrift.TConstructSchemaBlackListReq; import org.apache.iotdb.mpp.rpc.thrift.TDeleteDataForDeleteSchemaReq; import org.apache.iotdb.mpp.rpc.thrift.TDeleteTimeSeriesReq; -import org.apache.iotdb.mpp.rpc.thrift.TInvalidateMatchedSchemaCacheReq; import org.apache.iotdb.mpp.rpc.thrift.TRollbackSchemaBlackListReq; import org.apache.iotdb.pipe.api.exception.PipeException; import org.apache.iotdb.rpc.TSStatusCode; @@ -197,26 +194,18 @@ public static void invalidateCache( final String requestMessage, final Consumer setFailure, final boolean needLock) { - final Map dataNodeLocationMap = - env.getConfigManager().getNodeManager().getRegisteredDataNodeLocations(); - final DataNodeAsyncRequestContext clientHandler = - new DataNodeAsyncRequestContext<>( - CnToDnAsyncRequestType.INVALIDATE_MATCHED_SCHEMA_CACHE, - new TInvalidateMatchedSchemaCacheReq(patternTreeBytes).setNeedLock(needLock), - dataNodeLocationMap); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); - final Map statusMap = clientHandler.getResponseMap(); - for (final TSStatus status : statusMap.values()) { + // Proceed once every unreachable DataNode is provably self-fenced (it fails closed on its + // schema cache and resyncs on recovery, so it cannot serve the to-be-deleted/altered series), + // instead of hard-failing on the first unreachable DataNode. This runs before the physical + // delete in the state machine, so the "delete only after PROCEED" ordering holds. + if (!SchemaUtils.invalidateMatchedSchemaCache( + env.getConfigManager(), patternTreeBytes, needLock)) { // All dataNodes must clear the related schemaEngine cache - if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - LOGGER.error( - ProcedureMessages.FAILED_TO_INVALIDATE_SCHEMAENGINE_CACHE_OF_TIMESERIES, - requestMessage); - setFailure.accept( - new ProcedureException( - new MetadataException(ProcedureMessages.INVALIDATE_SCHEMAENGINE_CACHE_FAILED))); - return; - } + LOGGER.error( + ProcedureMessages.FAILED_TO_INVALIDATE_SCHEMAENGINE_CACHE_OF_TIMESERIES, requestMessage); + setFailure.accept( + new ProcedureException( + new MetadataException(ProcedureMessages.INVALIDATE_SCHEMAENGINE_CACHE_FAILED))); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SchemaUtils.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SchemaUtils.java index 4b8d0a533afe3..a8b5437e585ad 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SchemaUtils.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SchemaUtils.java @@ -36,6 +36,7 @@ import org.apache.iotdb.confignode.consensus.request.ConfigPhysicalPlan; import org.apache.iotdb.confignode.i18n.ProcedureMessages; import org.apache.iotdb.confignode.manager.ConfigManager; +import org.apache.iotdb.confignode.manager.lease.ClusterCachePropagator; import org.apache.iotdb.confignode.procedure.env.ConfigNodeProcedureEnv; import org.apache.iotdb.consensus.exception.ConsensusException; import org.apache.iotdb.db.exception.metadata.PathNotExistException; @@ -43,7 +44,9 @@ import org.apache.iotdb.mpp.rpc.thrift.TCheckSchemaRegionUsingTemplateResp; import org.apache.iotdb.mpp.rpc.thrift.TCountPathsUsingTemplateReq; import org.apache.iotdb.mpp.rpc.thrift.TCountPathsUsingTemplateResp; +import org.apache.iotdb.mpp.rpc.thrift.TInvalidateMatchedSchemaCacheReq; import org.apache.iotdb.mpp.rpc.thrift.TUpdateTableReq; +import org.apache.iotdb.mpp.rpc.thrift.TUpdateTemplateReq; import org.apache.iotdb.rpc.RpcUtils; import org.apache.iotdb.rpc.TSStatusCode; @@ -60,6 +63,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.function.Supplier; import java.util.stream.Collectors; public class SchemaUtils { @@ -240,23 +244,32 @@ protected void onAllReplicasetFailure( } } - public static Map preReleaseTable( - final String database, - final TsTable table, - final ConfigManager configManager, - final String oldName) { + /** Build the PRE_UPDATE_TABLE request used to pre-release a table change to DataNodes. */ + public static TUpdateTableReq BuildPreUpdateTableReq( + final String database, final TsTable table, final String oldName) { final TUpdateTableReq req = new TUpdateTableReq(); req.setType(TsTableInternalRPCType.PRE_UPDATE_TABLE.getOperationType()); req.setTableInfo(TsTableInternalRPCUtil.serializeSingleTsTableWithDatabase(database, table)); req.setOldName(oldName); + return req; + } - final Map dataNodeLocationMap = - configManager.getNodeManager().getRegisteredDataNodeLocations(); + /** + * Broadcast a table update to exactly {@code targets} and return the full per-nodeId response map + * (both successes and failures). Used by {@link + * org.apache.iotdb.confignode.manager.lease.ClusterCachePropagator}, which needs to know which + * DataNodes acknowledged in order to decide whether it is safe to proceed past the rest. + */ + public static Map broadcastTableUpdate( + final TUpdateTableReq req, final Map targets) { final DataNodeAsyncRequestContext clientHandler = - new DataNodeAsyncRequestContext<>( - CnToDnAsyncRequestType.UPDATE_TABLE, req, dataNodeLocationMap); + new DataNodeAsyncRequestContext<>(CnToDnAsyncRequestType.UPDATE_TABLE, req, targets); CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); - return clientHandler.getResponseMap().entrySet().stream() + return clientHandler.getResponseMap(); + } + + private static Map failedOnly(final Map responses) { + return responses.entrySet().stream() .filter(entry -> entry.getValue().getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); } @@ -289,11 +302,9 @@ public static Map commitReleaseTable( .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); } - public static Map rollbackPreRelease( - final String database, - final String tableName, - final ConfigManager configManager, - final @Nullable String oldName) { + /** Build the ROLLBACK_UPDATE_TABLE request used to roll back a pre-released table change. */ + public static TUpdateTableReq rollbackUpdateTableReq( + final String database, final String tableName, final String oldName) { final TUpdateTableReq req = new TUpdateTableReq(); req.setType(TsTableInternalRPCType.ROLLBACK_UPDATE_TABLE.getOperationType()); final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); @@ -305,16 +316,73 @@ public static Map rollbackPreRelease( } req.setTableInfo(outputStream.toByteArray()); req.setOldName(oldName); + return req; + } - final Map dataNodeLocationMap = - configManager.getNodeManager().getRegisteredDataNodeLocations(); - final DataNodeAsyncRequestContext clientHandler = - new DataNodeAsyncRequestContext<>( - CnToDnAsyncRequestType.UPDATE_TABLE, req, dataNodeLocationMap); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); - return clientHandler.getResponseMap().entrySet().stream() - .filter(entry -> entry.getValue().getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + public static Map rollbackPreRelease( + final String database, + final String tableName, + final ConfigManager configManager, + final @Nullable String oldName) { + return failedOnly( + broadcastTableUpdate( + rollbackUpdateTableReq(database, tableName, oldName), + configManager.getNodeManager().getRegisteredDataNodeLocations())); + } + + /** + * Broadcast an INVALIDATE_MATCHED_SCHEMA_CACHE to all DataNodes through {@link + * ClusterCachePropagator}: proceed once every unreachable DataNode is provably self-fenced (it + * fails closed on its schema cache and resyncs on recovery, so it cannot serve the + * deleted/altered series), instead of hard-failing on the first unreachable DataNode. Returns + * whether it is safe to proceed; the caller maps {@code false} to its own failure. + * + *

The propagator may re-broadcast while waiting for unacked DataNodes, so a fresh request with + * a duplicated buffer is built on each attempt — a consumed buffer can never be re-sent as an + * empty (and silently-successful) invalidation. + */ + public static boolean invalidateMatchedSchemaCache( + final ConfigManager configManager, + final ByteBuffer patternTreeBytes, + final boolean needLock) { + return new ClusterCachePropagator(configManager) + .propagate( + targets -> { + final DataNodeAsyncRequestContext + clientHandler = + new DataNodeAsyncRequestContext<>( + CnToDnAsyncRequestType.INVALIDATE_MATCHED_SCHEMA_CACHE, + new TInvalidateMatchedSchemaCacheReq(patternTreeBytes.duplicate()) + .setNeedLock(needLock), + targets); + CnToDnInternalServiceAsyncRequestManager.getInstance() + .sendAsyncRequestWithRetry(clientHandler); + return clientHandler.getResponseMap(); + }); + } + + /** + * Broadcast an UPDATE_TEMPLATE to all DataNodes through {@link ClusterCachePropagator}: proceed + * once every unreachable DataNode is provably self-fenced (it fails closed on its template cache + * and resyncs on recovery), instead of hard-failing on the first unreachable DataNode. Returns + * whether it is safe to proceed. + * + *

The request is rebuilt from {@code requestSupplier} on every attempt: the propagator may + * re-broadcast while waiting, and {@code TUpdateTemplateReq}'s binary field is backed by a {@link + * ByteBuffer}, so reusing one request could re-send a consumed (empty) payload. + */ + public static boolean broadcastTemplateUpdate( + final ConfigManager configManager, final Supplier requestSupplier) { + return new ClusterCachePropagator(configManager) + .propagate( + targets -> { + final DataNodeAsyncRequestContext clientHandler = + new DataNodeAsyncRequestContext<>( + CnToDnAsyncRequestType.UPDATE_TEMPLATE, requestSupplier.get(), targets); + CnToDnInternalServiceAsyncRequestManager.getInstance() + .sendAsyncRequestWithRetry(clientHandler); + return clientHandler.getResponseMap(); + }); } public static TSStatus executeInConsensusLayer( diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedure.java index dca79a02366f6..31641528269af 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedure.java @@ -34,6 +34,7 @@ import org.apache.iotdb.confignode.consensus.request.write.pipe.payload.PipeEnrichedPlan; import org.apache.iotdb.confignode.i18n.ConfigNodeMessages; import org.apache.iotdb.confignode.i18n.ProcedureMessages; +import org.apache.iotdb.confignode.manager.lease.ClusterCachePropagator; import org.apache.iotdb.confignode.procedure.env.ConfigNodeProcedureEnv; import org.apache.iotdb.confignode.procedure.exception.ProcedureException; import org.apache.iotdb.confignode.procedure.impl.StateMachineProcedure; @@ -115,13 +116,8 @@ void setConfigNodeTTL(final ConfigNodeProcedureEnv env) { } void updateDataNodeTTL(final ConfigNodeProcedureEnv env) { - final Map dataNodeLocationMap = - env.getConfigManager().getNodeManager().getRegisteredDataNodeLocations(); - final DataNodeAsyncRequestContext clientHandler = - sendTTLRequest( - dataNodeLocationMap, - buildSetTTLReq(plan.getPathPattern(), plan.getTTL(), plan.isDataBase())); - if (hasFailedDataNode(clientHandler)) { + if (!broadcastTTLAndDecide( + env, buildSetTTLReq(plan.getPathPattern(), plan.getTTL(), plan.isDataBase()))) { LOGGER.error(ProcedureMessages.FAILED_TO_UPDATE_TTL_CACHE_OF_DATANODE); setFailure( new ProcedureException( @@ -129,6 +125,17 @@ void updateDataNodeTTL(final ConfigNodeProcedureEnv env) { } } + /** + * Broadcast the TTL update to all DataNodes and decide whether it is safe to proceed: proceed + * once every unreachable DataNode is provably self-fenced (it fails closed on TTL in compaction + * and resyncs on recovery) instead of hard-failing on the first unreachable DataNode. + * Package-private and overridable for tests. + */ + boolean broadcastTTLAndDecide(final ConfigNodeProcedureEnv env, final TSetTTLReq req) { + return new ClusterCachePropagator(env.getConfigManager()) + .propagate(targets -> sendTTLRequest(targets, req).getResponseMap()); + } + private void capturePreviousTTLState(final ConfigNodeProcedureEnv env) { if (previousTTLStateCaptured) { return; @@ -168,19 +175,6 @@ private TSetTTLReq buildSetTTLReq( Collections.singletonList(String.join(".", pathPattern)), ttl, isDataBase); } - private boolean hasFailedDataNode( - final DataNodeAsyncRequestContext clientHandler) { - if (!clientHandler.getRequestIndices().isEmpty()) { - return true; - } - for (TSStatus status : clientHandler.getResponseMap().values()) { - if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - return true; - } - } - return false; - } - private long getTTLOrDefault(final ConfigNodeProcedureEnv env, final String[] pathPattern) { final long ttl = env.getConfigManager().getTTLManager().getTTL(pathPattern); return ttl == TTLCache.NULL_TTL ? TTL_NOT_EXIST : ttl; @@ -220,30 +214,20 @@ private void restoreTTLOnConfigNode( } private void rollbackDataNodeTTL(final ConfigNodeProcedureEnv env) throws ProcedureException { - final Map dataNodeLocationMap = - env.getConfigManager().getNodeManager().getRegisteredDataNodeLocations(); - restoreTTLOnDataNodes(dataNodeLocationMap, plan.getPathPattern(), previousTTL); + restoreTTLOnDataNodes(env, plan.getPathPattern(), previousTTL); if (plan.isDataBase()) { restoreTTLOnDataNodes( - dataNodeLocationMap, - getDatabaseWildcardPathPattern(plan.getPathPattern()), - previousDatabaseWildcardTTL); + env, getDatabaseWildcardPathPattern(plan.getPathPattern()), previousDatabaseWildcardTTL); } } private void restoreTTLOnDataNodes( - final Map dataNodeLocationMap, - final String[] pathPattern, - final long ttl) + final ConfigNodeProcedureEnv env, final String[] pathPattern, final long ttl) throws ProcedureException { - if (dataNodeLocationMap.isEmpty()) { - return; - } - final DataNodeAsyncRequestContext clientHandler = - sendTTLRequest( - dataNodeLocationMap, - buildSetTTLReq(pathPattern, ttl == TTL_NOT_EXIST ? TTLCache.NULL_TTL : ttl, false)); - if (hasFailedDataNode(clientHandler)) { + // Same proceed-past-fenced semantics as the forward update: a down DataNode must not block + // rollback (it resyncs TTL on recovery); only a live unacked DataNode fails it. + if (!broadcastTTLAndDecide( + env, buildSetTTLReq(pathPattern, ttl == TTL_NOT_EXIST ? TTLCache.NULL_TTL : ttl, false))) { throw new ProcedureException( new MetadataException( "Rollback dataNode ttl cache failed for " + String.join(".", pathPattern))); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedure.java index 55fffedad6145..8f24fe92eefe7 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTemplateProcedure.java @@ -215,30 +215,25 @@ private void preReleaseTemplate(final ConfigNodeProcedureEnv env) { return; } - final TUpdateTemplateReq req = new TUpdateTemplateReq(); - req.setType(TemplateInternalRPCUpdateType.ADD_TEMPLATE_PRE_SET_INFO.toByte()); - req.setTemplateInfo( - TemplateInternalRPCUtil.generateAddTemplateSetInfoBytes(template, templateSetPath)); - - final Map dataNodeLocationMap = - env.getConfigManager().getNodeManager().getRegisteredDataNodeLocations(); - final DataNodeAsyncRequestContext clientHandler = - new DataNodeAsyncRequestContext<>( - CnToDnAsyncRequestType.UPDATE_TEMPLATE, req, dataNodeLocationMap); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); - final Map statusMap = clientHandler.getResponseMap(); - for (final Map.Entry entry : statusMap.entrySet()) { - if (entry.getValue().getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - LOGGER.warn( - ProcedureMessages.FAILED_TO_SYNC_TEMPLATE_PRE_SET_INFO_ON_PATH_TO, - templateName, - templateSetPath, - dataNodeLocationMap.get(entry.getKey())); - setFailure( - new ProcedureException( - new MetadataException(ProcedureMessages.PRE_SET_TEMPLATE_FAILED))); - return; - } + // Proceed once every unreachable DataNode is provably self-fenced (it fails closed on its + // template cache and resyncs on recovery) instead of hard-failing on the first unreachable one. + if (!SchemaUtils.broadcastTemplateUpdate( + env.getConfigManager(), + () -> { + final TUpdateTemplateReq req = new TUpdateTemplateReq(); + req.setType(TemplateInternalRPCUpdateType.ADD_TEMPLATE_PRE_SET_INFO.toByte()); + req.setTemplateInfo( + TemplateInternalRPCUtil.generateAddTemplateSetInfoBytes(template, templateSetPath)); + return req; + })) { + LOGGER.warn( + ProcedureMessages.FAILED_TO_SYNC_TEMPLATE_PRE_SET_INFO_ON_PATH_TO, + templateName, + templateSetPath, + "an unreachable DataNode is not provably fenced"); + setFailure( + new ProcedureException(new MetadataException(ProcedureMessages.PRE_SET_TEMPLATE_FAILED))); + return; } setNextState(SetTemplateState.VALIDATE_TIMESERIES_EXISTENCE); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/UnsetTemplateProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/UnsetTemplateProcedure.java index 1fd7aefb33065..d7bb9d0894660 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/UnsetTemplateProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/UnsetTemplateProcedure.java @@ -155,29 +155,24 @@ private void invalidateCache(final ConfigNodeProcedureEnv env) { } private void executeInvalidateCache(final ConfigNodeProcedureEnv env) throws ProcedureException { - final Map dataNodeLocationMap = - env.getConfigManager().getNodeManager().getRegisteredDataNodeLocations(); - final TUpdateTemplateReq invalidateTemplateSetInfoReq = new TUpdateTemplateReq(); - invalidateTemplateSetInfoReq.setType( - TemplateInternalRPCUpdateType.INVALIDATE_TEMPLATE_SET_INFO.toByte()); - invalidateTemplateSetInfoReq.setTemplateInfo(getInvalidateTemplateSetInfo()); - final DataNodeAsyncRequestContext clientHandler = - new DataNodeAsyncRequestContext<>( - CnToDnAsyncRequestType.UPDATE_TEMPLATE, - invalidateTemplateSetInfoReq, - dataNodeLocationMap); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); - final Map statusMap = clientHandler.getResponseMap(); - for (final TSStatus status : statusMap.values()) { + // Proceed once every unreachable DataNode is provably self-fenced (it fails closed on its + // template cache and resyncs on recovery) instead of hard-failing on the first unreachable one. + if (!SchemaUtils.broadcastTemplateUpdate( + env.getConfigManager(), + () -> { + final TUpdateTemplateReq invalidateTemplateSetInfoReq = new TUpdateTemplateReq(); + invalidateTemplateSetInfoReq.setType( + TemplateInternalRPCUpdateType.INVALIDATE_TEMPLATE_SET_INFO.toByte()); + invalidateTemplateSetInfoReq.setTemplateInfo(getInvalidateTemplateSetInfo()); + return invalidateTemplateSetInfoReq; + })) { // all dataNodes must clear the related template cache - if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - LOGGER.error( - ProcedureMessages.FAILED_TO_INVALIDATE_TEMPLATE_CACHE_OF_TEMPLATE_SET_ON, - template.getName(), - path); - throw new ProcedureException( - new MetadataException(ProcedureMessages.INVALIDATE_TEMPLATE_CACHE_FAILED)); - } + LOGGER.error( + ProcedureMessages.FAILED_TO_INVALIDATE_TEMPLATE_CACHE_OF_TEMPLATE_SET_ON, + template.getName(), + path); + throw new ProcedureException( + new MetadataException(ProcedureMessages.INVALIDATE_TEMPLATE_CACHE_FAILED)); } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AbstractAlterOrDropTableProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AbstractAlterOrDropTableProcedure.java index 7cf1ff1c24f83..406bdfd5909c3 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AbstractAlterOrDropTableProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/AbstractAlterOrDropTableProcedure.java @@ -27,11 +27,13 @@ import org.apache.iotdb.commons.schema.table.TsTable; import org.apache.iotdb.confignode.client.async.CnToDnAsyncRequestType; import org.apache.iotdb.confignode.i18n.ProcedureMessages; +import org.apache.iotdb.confignode.manager.lease.ClusterCachePropagator; import org.apache.iotdb.confignode.procedure.env.ConfigNodeProcedureEnv; import org.apache.iotdb.confignode.procedure.exception.ProcedureException; import org.apache.iotdb.confignode.procedure.impl.StateMachineProcedure; import org.apache.iotdb.confignode.procedure.impl.schema.DataNodeTSStatusTaskExecutor; import org.apache.iotdb.confignode.procedure.impl.schema.SchemaUtils; +import org.apache.iotdb.mpp.rpc.thrift.TUpdateTableReq; import org.apache.tsfile.utils.ReadWriteIOUtils; import org.slf4j.Logger; @@ -91,17 +93,22 @@ protected void preRelease(final ConfigNodeProcedureEnv env) { } protected void preRelease(final ConfigNodeProcedureEnv env, final @Nullable String oldName) { - final Map failedResults = - SchemaUtils.preReleaseTable(database, table, env.getConfigManager(), oldName); - - if (!failedResults.isEmpty()) { - // All dataNodes must clear the related schema cache + // Proceed once every unreachable DataNode is provably self-fenced instead of hard-failing the + // DDL: a fenced DataNode fails closed on its now-stale table cache and resyncs on lease + // recovery, so it cannot serve dirty schema. Only fail if an unacked DataNode is not provably + // fenced (it may still be serving clients). + final TUpdateTableReq req = SchemaUtils.BuildPreUpdateTableReq(database, table, oldName); + final boolean proceeded = + new ClusterCachePropagator(env.getConfigManager()) + .propagate(targets -> SchemaUtils.broadcastTableUpdate(req, targets)); + + if (!proceeded) { LOGGER.warn( ProcedureMessages.FAILED_TO_PRE_RELEASE_FOR_TABLE_TO_DATANODE_FAILURE_RESULTS, getActionMessage(), database, table.getTableName(), - failedResults); + ProcedureMessages.FAILED_TO_PROVE_DN_IS_FENCED); setFailure( new ProcedureException( new MetadataException( @@ -138,18 +145,21 @@ protected void rollbackPreRelease(final ConfigNodeProcedureEnv env) { protected void rollbackPreRelease( final ConfigNodeProcedureEnv env, final @Nullable String tableName) { - final Map failedResults = - SchemaUtils.rollbackPreRelease( - database, table.getTableName(), env.getConfigManager(), tableName); - - if (!failedResults.isEmpty()) { - // All dataNodes must clear the related schema cache + // A down DataNode must not block rollback either: proceed past provably-fenced DataNodes (which + // resync on recovery) and only fail on an unacked DataNode that is not provably fenced. + final TUpdateTableReq req = + SchemaUtils.rollbackUpdateTableReq(database, table.getTableName(), tableName); + final boolean proceeded = + new ClusterCachePropagator(env.getConfigManager()) + .propagate(targets -> SchemaUtils.broadcastTableUpdate(req, targets)); + + if (!proceeded) { LOGGER.warn( ProcedureMessages.FAILED_TO_ROLLBACK_PRE_RELEASE_FOR_TABLE_INFO_TO_DATANODE, getActionMessage(), database, table.getTableName(), - failedResults); + "an unreachable DataNode is not provably fenced"); setFailure( new ProcedureException( new MetadataException( diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java index 05e0facb3018e..0d6db3a9c4fd2 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/CreateTableProcedure.java @@ -29,6 +29,7 @@ import org.apache.iotdb.confignode.consensus.request.write.table.RollbackCreateTablePlan; import org.apache.iotdb.confignode.exception.DatabaseNotExistsException; import org.apache.iotdb.confignode.i18n.ProcedureMessages; +import org.apache.iotdb.confignode.manager.lease.ClusterCachePropagator; import org.apache.iotdb.confignode.procedure.env.ConfigNodeProcedureEnv; import org.apache.iotdb.confignode.procedure.exception.ProcedureException; import org.apache.iotdb.confignode.procedure.impl.StateMachineProcedure; @@ -36,6 +37,7 @@ import org.apache.iotdb.confignode.procedure.state.schema.CreateTableState; import org.apache.iotdb.confignode.procedure.store.ProcedureType; import org.apache.iotdb.confignode.rpc.thrift.TDatabaseSchema; +import org.apache.iotdb.mpp.rpc.thrift.TUpdateTableReq; import org.apache.iotdb.rpc.TSStatusCode; import org.apache.tsfile.utils.ReadWriteIOUtils; @@ -151,16 +153,22 @@ protected void preCreateTable(final ConfigNodeProcedureEnv env) { } private void preReleaseTable(final ConfigNodeProcedureEnv env) { - final Map failedResults = - SchemaUtils.preReleaseTable(database, table, env.getConfigManager(), null); - - if (!failedResults.isEmpty()) { - // All dataNodes must clear the related schema cache + // Broadcast the pre-update to all DataNodes. Instead of failing whenever any DataNode is + // unreachable, proceed once every unacked DataNode is provably self-fenced: such a DataNode + // fails closed on its (now-stale) table cache and resyncs on lease recovery, so it cannot serve + // dirty schema. Only fail if an unacked DataNode is not provably fenced (it may still be + // serving clients). + final TUpdateTableReq req = SchemaUtils.BuildPreUpdateTableReq(database, table, null); + final boolean proceeded = + new ClusterCachePropagator(env.getConfigManager()) + .propagate(targets -> SchemaUtils.broadcastTableUpdate(req, targets)); + + if (!proceeded) { LOGGER.warn( ProcedureMessages.FAILED_TO_SYNC_TABLE_PRE_CREATE_INFO_TO_DATANODE_FAILURE, database, table.getTableName(), - failedResults); + "an unreachable DataNode is not provably fenced"); setFailure( new ProcedureException(new MetadataException(ProcedureMessages.PRE_CREATE_TABLE_FAILED))); return; @@ -240,17 +248,19 @@ protected void rollbackCreate(final ConfigNodeProcedureEnv env) { } private void rollbackPreRelease(final ConfigNodeProcedureEnv env) { - final Map failedResults = - SchemaUtils.rollbackPreRelease( - database, table.getTableName(), env.getConfigManager(), null); - - if (!failedResults.isEmpty()) { - // All dataNodes must clear the related schema cache + // A down DataNode must not block rollback if it is already provably self-fenced. + final TUpdateTableReq req = + SchemaUtils.rollbackUpdateTableReq(database, table.getTableName(), null); + final boolean proceeded = + new ClusterCachePropagator(env.getConfigManager()) + .propagate(targets -> SchemaUtils.broadcastTableUpdate(req, targets)); + + if (!proceeded) { LOGGER.warn( ProcedureMessages.FAILED_TO_SYNC_TABLE_ROLLBACK_CREATE_INFO_TO_DATANODE_FAILURE, database, table.getTableName(), - failedResults); + ProcedureMessages.FAILED_TO_PROVE_DN_IS_FENCED); setFailure( new ProcedureException( new MetadataException(ProcedureMessages.ROLLBACK_CREATE_TABLE_FAILED))); diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DeleteDevicesProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DeleteDevicesProcedure.java index 66c1687d5d086..9f2bb0bbfc177 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DeleteDevicesProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DeleteDevicesProcedure.java @@ -32,6 +32,7 @@ import org.apache.iotdb.confignode.consensus.request.write.pipe.payload.PipeEnrichedPlan; import org.apache.iotdb.confignode.i18n.ProcedureMessages; import org.apache.iotdb.confignode.manager.ClusterManager; +import org.apache.iotdb.confignode.manager.lease.ClusterCachePropagator; import org.apache.iotdb.confignode.procedure.env.ConfigNodeProcedureEnv; import org.apache.iotdb.confignode.procedure.exception.ProcedureException; import org.apache.iotdb.confignode.procedure.impl.schema.DataNodeTSStatusTaskExecutor; @@ -222,32 +223,35 @@ protected void onAllReplicasetFailure( } private void invalidateCache(final ConfigNodeProcedureEnv env) { - final Map dataNodeLocationMap = - env.getConfigManager().getNodeManager().getRegisteredDataNodeLocations(); - final DataNodeAsyncRequestContext clientHandler = - new DataNodeAsyncRequestContext<>( - CnToDnAsyncRequestType.INVALIDATE_MATCHED_TABLE_DEVICE_CACHE, - new TTableDeviceInvalidateCacheReq(database, tableName, ByteBuffer.wrap(patternBytes)), - dataNodeLocationMap); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); - final Map statusMap = clientHandler.getResponseMap(); - for (final TSStatus status : statusMap.values()) { - // All dataNodes must clear the related schemaEngine cache - if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - LOGGER.error( - ProcedureMessages.FAILED_TO_INVALIDATE_SCHEMAENGINE_CACHE_OF_DEVICES_IN_TABLE, - database, - tableName); - setFailure( - new ProcedureException( - new MetadataException(ProcedureMessages.INVALIDATE_SCHEMAENGINE_CACHE_FAILED))); - return; - } + TTableDeviceInvalidateCacheReq req = + new TTableDeviceInvalidateCacheReq(database, tableName, ByteBuffer.wrap(patternBytes)); + boolean proceeded = + new ClusterCachePropagator(env.getConfigManager()) + .propagate(targets -> broadCastInvalidateCache(req, targets)); + + if (!proceeded) { + LOGGER.error( + ProcedureMessages.FAILED_TO_INVALIDATE_SCHEMAENGINE_CACHE_OF_DEVICES_IN_TABLE, + database, + tableName); + setFailure( + new ProcedureException( + new MetadataException(ProcedureMessages.INVALIDATE_SCHEMAENGINE_CACHE_FAILED))); + return; } setNextState(DELETE_DATA); } + private Map broadCastInvalidateCache( + final TTableDeviceInvalidateCacheReq req, final Map targets) { + final DataNodeAsyncRequestContext clientHandler = + new DataNodeAsyncRequestContext<>( + CnToDnAsyncRequestType.INVALIDATE_MATCHED_TABLE_DEVICE_CACHE, req, targets); + CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); + return clientHandler.getResponseMap(); + } + private void deleteData(final ConfigNodeProcedureEnv env) { new TableRegionTaskExecutor<>( "delete data for table device", diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableColumnProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableColumnProcedure.java index 4e4d0e758bf7f..d06a275513d73 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableColumnProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableColumnProcedure.java @@ -33,6 +33,7 @@ import org.apache.iotdb.confignode.consensus.request.write.table.view.CommitDeleteViewColumnPlan; import org.apache.iotdb.confignode.consensus.request.write.table.view.PreDeleteViewColumnPlan; import org.apache.iotdb.confignode.i18n.ProcedureMessages; +import org.apache.iotdb.confignode.manager.lease.ClusterCachePropagator; import org.apache.iotdb.confignode.procedure.env.ConfigNodeProcedureEnv; import org.apache.iotdb.confignode.procedure.exception.ProcedureException; import org.apache.iotdb.confignode.procedure.impl.schema.SchemaUtils; @@ -150,36 +151,29 @@ private void checkAndPreDeleteColumn(final ConfigNodeProcedureEnv env) { } private void invalidateCache(final ConfigNodeProcedureEnv env) { - final Map dataNodeLocationMap = - env.getConfigManager().getNodeManager().getRegisteredDataNodeLocations(); - final DataNodeAsyncRequestContext clientHandler = - new DataNodeAsyncRequestContext<>( - CnToDnAsyncRequestType.INVALIDATE_COLUMN_CACHE, - new TInvalidateColumnCacheReq(database, tableName, columnName, isAttributeColumn), - dataNodeLocationMap); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); - final Map statusMap = clientHandler.getResponseMap(); - for (final TSStatus status : statusMap.values()) { - // All dataNodes must clear the related schemaEngine cache - if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - LOGGER.error( - ProcedureMessages.FAILED_TO_INVALIDATE_COLUMN_S_CACHE_OF_TABLE, - isAttributeColumn ? "attribute" : "measurement", - columnName, - database, - tableName); - setFailure( - new ProcedureException( - new MetadataException( - String.format( - ProcedureMessages.INVALIDATE_COLUMN_CACHE_FAILED_FOR_TABLE, - columnName, - database, - tableName)))); - return; - } - } + TInvalidateColumnCacheReq req = + new TInvalidateColumnCacheReq(database, tableName, columnName, isAttributeColumn); + final boolean proceeded = + new ClusterCachePropagator(env.getConfigManager()) + .propagate(targets -> broadCastInvalidateCache(req, targets)); + if (!proceeded) { + LOGGER.error( + ProcedureMessages.FAILED_TO_INVALIDATE_COLUMN_S_CACHE_OF_TABLE, + isAttributeColumn ? "attribute" : "measurement", + columnName, + database, + tableName); + setFailure( + new ProcedureException( + new MetadataException( + String.format( + ProcedureMessages.INVALIDATE_COLUMN_CACHE_FAILED_FOR_TABLE, + columnName, + database, + tableName)))); + return; + } // View does not need to be executed on regions setNextState( this instanceof DropViewColumnProcedure @@ -187,6 +181,16 @@ private void invalidateCache(final ConfigNodeProcedureEnv env) { : DropTableColumnState.EXECUTE_ON_REGIONS); } + private Map broadCastInvalidateCache( + TInvalidateColumnCacheReq req, Map targets) { + + final DataNodeAsyncRequestContext clientHandler = + new DataNodeAsyncRequestContext<>( + CnToDnAsyncRequestType.INVALIDATE_COLUMN_CACHE, req, targets); + CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); + return clientHandler.getResponseMap(); + } + private void executeOnRegions(final ConfigNodeProcedureEnv env) { final Map relatedRegionGroup = isAttributeColumn diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableProcedure.java index ac3ca2ef54fe7..94c36a3b7920d 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableProcedure.java @@ -25,14 +25,17 @@ import org.apache.iotdb.common.rpc.thrift.TSStatus; import org.apache.iotdb.commons.exception.IoTDBException; import org.apache.iotdb.commons.exception.MetadataException; +import org.apache.iotdb.commons.schema.table.PreDeleteTsTable; import org.apache.iotdb.confignode.client.async.CnToDnAsyncRequestType; import org.apache.iotdb.confignode.client.async.CnToDnInternalServiceAsyncRequestManager; import org.apache.iotdb.confignode.client.async.handlers.DataNodeAsyncRequestContext; import org.apache.iotdb.confignode.consensus.request.write.table.CommitDeleteTablePlan; import org.apache.iotdb.confignode.consensus.request.write.table.PreDeleteTablePlan; +import org.apache.iotdb.confignode.consensus.request.write.table.RollbackPreDeleteTablePlan; import org.apache.iotdb.confignode.consensus.request.write.table.view.CommitDeleteViewPlan; import org.apache.iotdb.confignode.consensus.request.write.table.view.PreDeleteViewPlan; import org.apache.iotdb.confignode.i18n.ProcedureMessages; +import org.apache.iotdb.confignode.manager.lease.ClusterCachePropagator; import org.apache.iotdb.confignode.procedure.env.ConfigNodeProcedureEnv; import org.apache.iotdb.confignode.procedure.exception.ProcedureException; import org.apache.iotdb.confignode.procedure.impl.schema.SchemaUtils; @@ -67,10 +70,9 @@ public DropTableProcedure( super(database, tableName, queryId, isGeneratedByPipe); } - // Not used @Override protected String getActionMessage() { - return null; + return "drop table"; } @Override @@ -86,12 +88,10 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final DropTabl tableName); checkAndPreDeleteTable(env); break; - case INVALIDATE_CACHE: + case PRE_DELETE: LOGGER.info( - ProcedureMessages.INVALIDATING_CACHE_FOR_TABLE_WHEN_DROPPING_TABLE, - database, - tableName); - invalidateCache(env); + ProcedureMessages.PRE_RELEASE_DELETE_TABLE_WHEN_DROPPING_TABLE, database, tableName); + preDelete(env); break; case DELETE_DATA: LOGGER.info(ProcedureMessages.DELETING_DATA_FOR_TABLE, database, tableName); @@ -107,6 +107,13 @@ protected Flow executeFromState(final ConfigNodeProcedureEnv env, final DropTabl case DROP_TABLE: LOGGER.info(ProcedureMessages.DROPPING_TABLE_ON_CONFIGNODE, database, tableName); dropTable(env); + break; + case COMMIT_DELETE: + LOGGER.info( + ProcedureMessages.COMMIT_RELEASE_DELETE_TABLE_WHEN_DROPPING_TABLE, + database, + tableName); + commitRelease(env); return Flow.NO_MORE_STATE; default: setFailure(new ProcedureException(ProcedureMessages.UNRECOGNIZED_DROPTABLESTATE + state)); @@ -132,40 +139,39 @@ private void checkAndPreDeleteTable(final ConfigNodeProcedureEnv env) { env, LOGGER); if (status.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - setNextState(DropTableState.INVALIDATE_CACHE); + setNextState(DropTableState.PRE_DELETE); + table = new PreDeleteTsTable(tableName); } else { setFailure(new ProcedureException(new IoTDBException(status))); } } - private void invalidateCache(final ConfigNodeProcedureEnv env) { - final Map dataNodeLocationMap = - env.getConfigManager().getNodeManager().getRegisteredDataNodeLocations(); - final DataNodeAsyncRequestContext clientHandler = - new DataNodeAsyncRequestContext<>( - CnToDnAsyncRequestType.INVALIDATE_TABLE_CACHE, - new TInvalidateTableCacheReq(database, tableName), - dataNodeLocationMap); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); - final Map statusMap = clientHandler.getResponseMap(); - for (final TSStatus status : statusMap.values()) { - // All dataNodes must clear the related schemaEngine cache - if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { - LOGGER.error( - ProcedureMessages.FAILED_TO_INVALIDATE_SCHEMAENGINE_CACHE_OF_TABLE, - database, - tableName); - setFailure( - new ProcedureException( - new MetadataException(ProcedureMessages.INVALIDATE_SCHEMAENGINE_CACHE_FAILED))); - return; - } - } + private void preDelete(final ConfigNodeProcedureEnv env) { + TInvalidateTableCacheReq req = new TInvalidateTableCacheReq(database, tableName); + final boolean proceeded = + new ClusterCachePropagator(env.getConfigManager()) + .propagate(targets -> broadCastInvalidateCache(req, targets)); + if (!proceeded) { + LOGGER.error( + ProcedureMessages.FAILED_TO_INVALIDATE_SCHEMAENGINE_CACHE_OF_TABLE, database, tableName); + setFailure( + new ProcedureException( + new MetadataException(ProcedureMessages.INVALIDATE_SCHEMAENGINE_CACHE_FAILED))); + return; + } setNextState( this instanceof DropViewProcedure ? DropTableState.DROP_TABLE : DropTableState.DELETE_DATA); } + private Map broadCastInvalidateCache( + final TInvalidateTableCacheReq req, final Map targets) { + final DataNodeAsyncRequestContext clientHandler = + new DataNodeAsyncRequestContext<>(CnToDnAsyncRequestType.PRE_DELETE_TABLE, req, targets); + CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); + return clientHandler.getResponseMap(); + } + private void deleteData(final ConfigNodeProcedureEnv env) { final Map relatedDataRegionGroup = env.getConfigManager().getRelatedDataRegionGroup4TableModel(database); @@ -215,19 +221,29 @@ private void dropTable(final ConfigNodeProcedureEnv env) { isGeneratedByPipe); if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { setFailure(new ProcedureException(new IoTDBException(status))); + } else { + setNextState(DropTableState.COMMIT_DELETE); } } @Override protected boolean isRollbackSupported(final DropTableState state) { - return false; + return state == DropTableState.CHECK_AND_INVALIDATE_TABLE || state == DropTableState.PRE_DELETE; } @Override - protected void rollbackState( - final ConfigNodeProcedureEnv configNodeProcedureEnv, final DropTableState dropTableState) + protected void rollbackState(final ConfigNodeProcedureEnv env, final DropTableState state) throws IOException, InterruptedException, ProcedureException { - // Do nothing + if (state == DropTableState.PRE_DELETE) { + final TSStatus status = + SchemaUtils.executeInConsensusLayer( + new RollbackPreDeleteTablePlan(database, tableName), env, LOGGER); + if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { + throw new ProcedureException( + String.format(ProcedureMessages.ROLLBACK_PRE_DELETE_TABLE_FAILED, database, tableName)); + } + } + // CHECK_AND_INVALIDATE_TABLE: consensus plan failed so no state changed, nothing to revert } @Override diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/DropTableState.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/DropTableState.java index 1a4a7b222dc33..804e02344acf4 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/DropTableState.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/state/schema/DropTableState.java @@ -21,8 +21,9 @@ public enum DropTableState { CHECK_AND_INVALIDATE_TABLE, - INVALIDATE_CACHE, + PRE_DELETE, DELETE_DATA, DELETE_DEVICES, DROP_TABLE, + COMMIT_DELETE } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java index 1d0b7612dbd6e..d23c4db9d4891 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java @@ -46,6 +46,7 @@ import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.commons.path.PathPatternTree; import org.apache.iotdb.commons.schema.SchemaConstant; +import org.apache.iotdb.commons.schema.table.TableNodeStatus; import org.apache.iotdb.commons.utils.AuthUtils; import org.apache.iotdb.commons.utils.StatusUtils; import org.apache.iotdb.commons.utils.TestOnly; @@ -127,6 +128,7 @@ import org.apache.iotdb.confignode.rpc.thrift.TCreateTopicReq; import org.apache.iotdb.confignode.rpc.thrift.TCreateTriggerReq; import org.apache.iotdb.confignode.rpc.thrift.TDataNodeConfigurationResp; +import org.apache.iotdb.confignode.rpc.thrift.TDataNodeLeaseRecoveryResp; import org.apache.iotdb.confignode.rpc.thrift.TDataNodeRegisterReq; import org.apache.iotdb.confignode.rpc.thrift.TDataNodeRegisterResp; import org.apache.iotdb.confignode.rpc.thrift.TDataNodeRemoveReq; @@ -336,6 +338,13 @@ public TDataNodeRestartResp restartDataNode(TDataNodeRestartReq req) { return resp; } + @Override + public TDataNodeLeaseRecoveryResp reloadCacheAfterLeaseRecovery() throws TException { + final TDataNodeLeaseRecoveryResp resp = configManager.reloadCacheAfterLeaseRecovery(); + LOGGER.info("Execute getMetaDataCache with result {}", resp.getStatus()); + return resp; + } + @Override public TAINodeRegisterResp registerAINode(TAINodeRegisterReq req) { TAINodeRegisterResp resp = @@ -1495,8 +1504,9 @@ public TDescTable4InformationSchemaResp descTables4InformationSchema() { } @Override - public TFetchTableResp fetchTables(final Map> fetchTableMap) { - return configManager.fetchTables(fetchTableMap); + public TFetchTableResp fetchTables( + final Map> fetchTableMap, final byte tableNodeStatus) { + return configManager.fetchTables(fetchTableMap, TableNodeStatus.deserialize(tableNodeStatus)); } @Override diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/lease/ClusterCachePropagatorTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/lease/ClusterCachePropagatorTest.java new file mode 100644 index 0000000000000..c8fea39c72971 --- /dev/null +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/lease/ClusterCachePropagatorTest.java @@ -0,0 +1,189 @@ +/* + * 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.iotdb.confignode.manager.lease; + +import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation; +import org.apache.iotdb.common.rpc.thrift.TSStatus; +import org.apache.iotdb.confignode.manager.lease.MetadataBroadcastVerdict.Verdict; +import org.apache.iotdb.rpc.TSStatusCode; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.IntToLongFunction; + +public class ClusterCachePropagatorTest { + + private final long FENCE_TIMEOUT_MS = 25_000L; + + private TSStatus success() { + return new TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()); + } + + private TSStatus error() { + return new TSStatus(TSStatusCode.INTERNAL_SERVER_ERROR.getStatusCode()); + } + + private TSStatus canNotConnect() { + return new TSStatus(TSStatusCode.CAN_NOT_CONNECT_DATANODE.getStatusCode()); + } + + private Map twoDataNodes() { + final Map map = new HashMap<>(); + map.put(1, new TDataNodeLocation().setDataNodeId(1)); + map.put(2, new TDataNodeLocation().setDataNodeId(2)); + return map; + } + + /** Build a propagator whose loop seams are inert (only propagateOnce is exercised). */ + private ClusterCachePropagator propagator(final IntToLongFunction hbAgeMs) { + return new ClusterCachePropagator( + this::twoDataNodes, hbAgeMs, () -> FENCE_TIMEOUT_MS, () -> 0L, ms -> {}); + } + + @Test + public void allAckedProceeds() { + final ClusterCachePropagator p = propagator(id -> 0L); + final Verdict v = + p.propagateOnce( + targets -> { + final Map r = new HashMap<>(); + r.put(1, success()); + r.put(2, success()); + return r; + }, + false); + Assert.assertEquals(Verdict.PROCEED, v); + } + + @Test + public void unreachableButProvablyFencedProceeds() { + final ClusterCachePropagator p = propagator(id -> id == 2 ? FENCE_TIMEOUT_MS + 1 : 0L); + final Verdict v = p.propagateOnce(targets -> ackOnly(1), false); + Assert.assertEquals(Verdict.PROCEED, v); + } + + @Test + public void unreachableNotYetFencedWaits() { + final ClusterCachePropagator p = propagator(id -> id == 2 ? 10_000L : 0L); + Assert.assertEquals(Verdict.WAIT, p.propagateOnce(targets -> ackOnly(1), false)); + } + + @Test + public void unreachableNotYetFencedFailsWhenBudgetExhausted() { + final ClusterCachePropagator p = propagator(id -> id == 2 ? 10_000L : 0L); + Assert.assertEquals(Verdict.FAIL, p.propagateOnce(targets -> ackOnly(1), true)); + } + + @Test + public void canNotConnectResponseIsUnackedAndCanProceedAfterFenceTimeout() { + final ClusterCachePropagator p = propagator(id -> id == 2 ? 999_999L : 0L); + final Verdict v = + p.propagateOnce( + targets -> { + final Map r = new HashMap<>(); + r.put(1, success()); + r.put(2, canNotConnect()); + return r; + }, + false); + Assert.assertEquals(Verdict.PROCEED, v); + } + + @Test + public void canNotConnectResponseWaitsBeforeFenceTimeout() { + final ClusterCachePropagator p = propagator(id -> id == 2 ? 1_000L : 0L); + final Verdict v = + p.propagateOnce( + targets -> { + final Map r = new HashMap<>(); + r.put(1, success()); + r.put(2, canNotConnect()); + return r; + }, + false); + Assert.assertEquals(Verdict.WAIT, v); + } + + @Test + public void internalFailureFailsImmediately() { + final ClusterCachePropagator p = propagator(id -> id == 2 ? FENCE_TIMEOUT_MS + 1 : 0L); + final Verdict v = + p.propagateOnce( + targets -> { + final Map r = new HashMap<>(); + r.put(1, success()); + r.put(2, error()); + return r; + }, + false); + Assert.assertEquals(Verdict.FAIL, v); + } + + @Test + public void loopReturnsTrueWhenItEventuallyProceeds() { + final AtomicInteger calls = new AtomicInteger(); + final AtomicLong nanos = new AtomicLong(); + final ClusterCachePropagator p = + new ClusterCachePropagator( + this::twoDataNodes, + id -> id == 2 ? 10_000L : 0L, // DN2 not fenced, so round 1 must WAIT + () -> FENCE_TIMEOUT_MS, + nanos::get, + ms -> nanos.addAndGet(ms * 1_000_000L)); + // Round 1: DN2 unreachable -> WAIT. Round 2: DN2 acks -> PROCEED. + final boolean proceeded = + p.propagate(targets -> calls.incrementAndGet() == 1 ? ackOnly(1) : ackBoth()); + Assert.assertTrue(proceeded); + Assert.assertEquals(2, calls.get()); + } + + @Test + public void loopReturnsFalseWhenBudgetExhausted() { + final AtomicLong nanos = new AtomicLong(); + final ClusterCachePropagator p = + new ClusterCachePropagator( + this::twoDataNodes, + id -> id == 2 ? 10_000L : 0L, // DN2 never fenced (alive but not acking) -> WAIT forever + () -> FENCE_TIMEOUT_MS, + nanos::get, + ms -> nanos.addAndGet(ms * 1_000_000L)); + // DN2 keeps failing to ack; the fake clock advances on each sleep until the wait budget runs + // out, at which point the loop must give up with FAIL. + Assert.assertFalse(p.propagate(targets -> ackOnly(1))); + } + + private Map ackOnly(final int nodeId) { + final Map r = new HashMap<>(); + r.put(nodeId, success()); + return r; + } + + private Map ackBoth() { + final Map r = new HashMap<>(); + r.put(1, success()); + r.put(2, success()); + return r; + } +} diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/lease/DataNodeContactTrackerTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/lease/DataNodeContactTrackerTest.java new file mode 100644 index 0000000000000..80b4498d13bf2 --- /dev/null +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/lease/DataNodeContactTrackerTest.java @@ -0,0 +1,73 @@ +/* + * 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.iotdb.confignode.manager.lease; + +import org.junit.Test; + +import java.util.Arrays; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; + +import static org.junit.Assert.assertEquals; + +public class DataNodeContactTrackerTest { + + private static final int DN = 3; + + @Test + public void reportsMillisSinceLastSuccessfulResponse() { + final AtomicLong nowNanos = new AtomicLong(TimeUnit.SECONDS.toNanos(100)); + final DataNodeContactTracker tracker = new DataNodeContactTracker(nowNanos::get); + tracker.recordSuccessfulResponse(DN); + nowNanos.addAndGet(TimeUnit.MILLISECONDS.toNanos(1234)); + assertEquals(1234L, tracker.getMillisSinceLastSuccessfulResponse(DN)); + } + + @Test + public void ageKeepsGrowingWithoutSuccessfulResponse() { + // Failures must NOT refresh the contact time. This is enforced structurally: only + // recordSuccessfulResponse updates it, so with no further success the age keeps growing. + final AtomicLong nowNanos = new AtomicLong(TimeUnit.SECONDS.toNanos(100)); + final DataNodeContactTracker tracker = new DataNodeContactTracker(nowNanos::get); + tracker.recordSuccessfulResponse(DN); + nowNanos.addAndGet(TimeUnit.SECONDS.toNanos(30)); + assertEquals(30_000L, tracker.getMillisSinceLastSuccessfulResponse(DN)); + } + + @Test + public void leadershipAcquisitionResetsContactToNow() { + final AtomicLong nowNanos = new AtomicLong(TimeUnit.SECONDS.toNanos(100)); + final DataNodeContactTracker tracker = new DataNodeContactTracker(nowNanos::get); + tracker.recordSuccessfulResponse(DN); + nowNanos.addAndGet(TimeUnit.SECONDS.toNanos(30)); // would otherwise look stale + tracker.onLeadershipAcquired(Arrays.asList(DN, 4)); + assertEquals(0L, tracker.getMillisSinceLastSuccessfulResponse(DN)); + assertEquals(0L, tracker.getMillisSinceLastSuccessfulResponse(4)); + } + + @Test + public void neverContactedReadsAsZeroSoVerdictTreatsAsRecent() { + // Conservative: an unknown DataNode must NOT look fenced (else the verdict would wrongly + // proceed past it), so its age reads as 0 until a real success/expiry is observed. + final AtomicLong nowNanos = new AtomicLong(TimeUnit.SECONDS.toNanos(100)); + final DataNodeContactTracker tracker = new DataNodeContactTracker(nowNanos::get); + assertEquals(0L, tracker.getMillisSinceLastSuccessfulResponse(999)); + } +} diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/lease/MetadataBroadcastVerdictTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/lease/MetadataBroadcastVerdictTest.java new file mode 100644 index 0000000000000..c28fd1040c882 --- /dev/null +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/manager/lease/MetadataBroadcastVerdictTest.java @@ -0,0 +1,77 @@ +/* + * 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.iotdb.confignode.manager.lease; + +import org.apache.iotdb.confignode.manager.lease.MetadataBroadcastVerdict.DataNodeState; +import org.apache.iotdb.confignode.manager.lease.MetadataBroadcastVerdict.Verdict; + +import org.junit.Test; + +import java.util.Arrays; +import java.util.Collections; + +import static org.junit.Assert.assertEquals; + +public class MetadataBroadcastVerdictTest { + + private static final long T_PROCEED_MS = 25_000L; + + private static DataNodeState acked() { + return new DataNodeState(true, 0L); + } + + private static DataNodeState fencedSafe() { + return new DataNodeState(false, T_PROCEED_MS + 1); + } + + private static DataNodeState freshUnacked() { + return new DataNodeState(false, 1_000L); + } + + @Test + public void allAckedProceeds() { + assertEquals( + Verdict.PROCEED, + MetadataBroadcastVerdict.decide(Arrays.asList(acked(), acked()), T_PROCEED_MS, false)); + } + + @Test + public void unackedButAllFencedSafeProceeds() { + assertEquals( + Verdict.PROCEED, + MetadataBroadcastVerdict.decide(Arrays.asList(acked(), fencedSafe()), T_PROCEED_MS, false)); + } + + @Test + public void freshUnackedWaitsWhileBudgetRemains() { + assertEquals( + Verdict.WAIT, + MetadataBroadcastVerdict.decide( + Collections.singletonList(freshUnacked()), T_PROCEED_MS, false)); + } + + @Test + public void freshUnackedFailsWhenWaitBudgetExhausted() { + assertEquals( + Verdict.FAIL, + MetadataBroadcastVerdict.decide( + Collections.singletonList(freshUnacked()), T_PROCEED_MS, true)); + } +} diff --git a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedureTest.java b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedureTest.java index cb09c23659c39..a1813c1642cca 100644 --- a/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedureTest.java +++ b/iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedureTest.java @@ -25,8 +25,6 @@ import org.apache.iotdb.commons.exception.IllegalPathException; import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.commons.schema.ttl.TTLCache; -import org.apache.iotdb.confignode.client.async.CnToDnAsyncRequestType; -import org.apache.iotdb.confignode.client.async.handlers.DataNodeAsyncRequestContext; import org.apache.iotdb.confignode.consensus.request.write.database.SetTTLPlan; import org.apache.iotdb.confignode.manager.ConfigManager; import org.apache.iotdb.confignode.manager.TTLManager; @@ -355,30 +353,11 @@ TSStatus writeConfigNodePlan(final ConfigNodeProcedureEnv env, final SetTTLPlan } @Override - DataNodeAsyncRequestContext sendTTLRequest( - final Map dataNodeLocationMap, final TSetTTLReq req) { + boolean broadcastTTLAndDecide(final ConfigNodeProcedureEnv env, final TSetTTLReq req) { requests.add(copyRequest(req)); - - final DataNodeAsyncRequestContext clientHandler = - new DataNodeAsyncRequestContext<>( - CnToDnAsyncRequestType.SET_TTL, copyRequest(req), dataNodeLocationMap); - final List requestIds = new ArrayList<>(clientHandler.getNodeLocationMap().keySet()); - final boolean shouldFail = failFirstDataNodeUpdate && requestCount++ == 0; - - for (Integer requestId : requestIds) { - clientHandler - .getResponseMap() - .put( - requestId, - new TSStatus( - shouldFail - ? TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode() - : TSStatusCode.SUCCESS_STATUS.getStatusCode())); - if (!shouldFail) { - clientHandler.getNodeLocationMap().remove(requestId); - } - } - return clientHandler; + // Simulate a live, un-acked DataNode on the first broadcast: the propagator verdict is FAIL + // (which triggers rollback). Later broadcasts (the rollback restore) proceed. + return !(failFirstDataNodeUpdate && requestCount++ == 0); } private SetTTLPlan copyPlan(final SetTTLPlan plan) { diff --git a/iotdb-core/datanode/src/main/i18n/en/org/apache/iotdb/db/i18n/DataNodeSchemaMessages.java b/iotdb-core/datanode/src/main/i18n/en/org/apache/iotdb/db/i18n/DataNodeSchemaMessages.java index 2b5fe9d72f6eb..b705d3efda654 100644 --- a/iotdb-core/datanode/src/main/i18n/en/org/apache/iotdb/db/i18n/DataNodeSchemaMessages.java +++ b/iotdb-core/datanode/src/main/i18n/en/org/apache/iotdb/db/i18n/DataNodeSchemaMessages.java @@ -121,7 +121,8 @@ public final class DataNodeSchemaMessages { public static final String UPDATE_MLOG_DESCRIPTION_FAILED = "Update {} failed because {}"; public static final String DIRECT_BUFFER_MEMORY_EXCEEDED = "Total allocated memory for direct buffer will be "; - public static final String DIRECT_BUFFER_MEMORY_LIMIT = ", which is greater than limit mem cost: "; + public static final String DIRECT_BUFFER_MEMORY_LIMIT = + ", which is greater than limit mem cost: "; // ======================== SchemaRegion Snapshot ======================== @@ -144,8 +145,7 @@ public final class DataNodeSchemaMessages { "Snapshot creation of schemaRegion {} costs {}ms."; public static final String SUCCESSFULLY_CREATE_SNAPSHOT = "Successfully create snapshot of schemaRegion {}"; - public static final String START_LOADING_SNAPSHOT = - "Start loading snapshot of schemaRegion {}"; + public static final String START_LOADING_SNAPSHOT = "Start loading snapshot of schemaRegion {}"; public static final String DEVICE_ATTR_SNAPSHOT_LOADING_COST = "Device attribute snapshot loading of schemaRegion {} costs {}ms."; public static final String DEVICE_ATTR_UPDATER_SNAPSHOT_LOADING_COST = @@ -265,8 +265,7 @@ public final class DataNodeSchemaMessages { "Failed to rename {} to {} while creating mTree snapshot."; public static final String FAILED_TO_CREATE_MTREE_SNAPSHOT = "Failed to create mTree snapshot due to {}"; - public static final String SERIALIZE_ERROR_INFO = - "Error occurred during serializing MemMTree."; + public static final String SERIALIZE_ERROR_INFO = "Error occurred during serializing MemMTree."; public static final String UNRECOGNIZED_MNODE_TYPE = "Unrecognized MNode type "; // ======================== View ======================== @@ -274,8 +273,7 @@ public final class DataNodeSchemaMessages { public static final String IS_NO_VIEW = "[%s] is no view."; public static final String VIEW_NOT_SUPPORTED = "View is not supported."; public static final String VIEW_DOES_NOT_SUPPORT_ALIAS = "View doesn't support alias"; - public static final String CANNOT_CONSTRUCT_ABSTRACT_CLASS = - "Can not construct abstract class."; + public static final String CANNOT_CONSTRUCT_ABSTRACT_CLASS = "Can not construct abstract class."; // ======================== PBTree ======================== @@ -288,8 +286,7 @@ public final class DataNodeSchemaMessages { "PBTree File [{}] will be overwritten since already exists."; public static final String SCHEMA_FILE_WRONG_VERSION = "SchemaFile with wrong version, please check or upgrade."; - public static final String NODE_NO_CHILD_IN_PBTREE = - "Node [%s] has no child in pbtree file."; + public static final String NODE_NO_CHILD_IN_PBTREE = "Node [%s] has no child in pbtree file."; public static final String SCHEMA_FILE_INSPECTED = "SchemaFile[%s] had been inspected."; public static final String FAILED_TO_CREATE_SCHEMA_FILE_SNAPSHOT = "Failed to create SchemaFile snapshot due to {}"; @@ -306,8 +303,7 @@ public final class DataNodeSchemaMessages { "AliasIndexPage can only extend to buffer with same capacity."; public static final String SEGMENTS_SPLIT_SAME_CAPACITY = "Segments only splits with same capacity."; - public static final String SEGMENT_SPLIT_NO_RECORDS = - "Segment can not be split with no records."; + public static final String SEGMENT_SPLIT_NO_RECORDS = "Segment can not be split with no records."; public static final String SEGMENT_SPLIT_ONLY_ONE_RECORD = "Segment can not be split with only one record."; public static final String INTERNAL_PAGE_EXTEND_CAPACITY = @@ -332,8 +328,7 @@ public final class DataNodeSchemaMessages { public static final String CHILD_SHALL_NOT_HAVE_SEGMENT_ADDRESS = "A child in newChildBuffer shall not have segmentAddress."; public static final String PAGE_INDEX_OUT_OF_RANGE = "Page index %d out of range."; - public static final String ROOT_PAGE_SHALL_NOT_BE_MIGRATED = - "Root page shall not be migrated."; + public static final String ROOT_PAGE_SHALL_NOT_BE_MIGRATED = "Root page shall not be migrated."; public static final String SUBORDINATE_INDEX_NOT_ON_SINGLE_PAGE = "Subordinate index shall not build upon single page segment."; public static final String SUBORDINATE_INDEX_BROKEN = @@ -457,8 +452,7 @@ public final class DataNodeSchemaMessages { public static final String COMMIT_MARK_WITHOUT_PREPARE = "COMMIT_MARK without PREPARE_MARK"; public static final String EXTRANEOUS_BYTE_AFTER_PREPARE = "an extraneous byte rather than COMMIT_MARK after PREPARE_MARK"; - public static final String NOT_ENDED_BY_MARK = - "not ended by COMMIT_MARK nor PREPARE_MARK."; + public static final String NOT_ENDED_BY_MARK = "not ended by COMMIT_MARK nor PREPARE_MARK."; // ======================== Additional MNodeContainer ======================== @@ -512,8 +506,7 @@ public final class DataNodeSchemaMessages { // ======================== Additional CachedMTreeStore ======================== - public static final String ERROR_DURING_PBTREE_CLEAR = - "Error occurred during PBTree clear, {}"; + public static final String ERROR_DURING_PBTREE_CLEAR = "Error occurred during PBTree clear, {}"; public static final String ERROR_DURING_MTREE_FLUSH_SCHEMA_REGION = "Error occurred during MTree flush, current SchemaRegionId is {}"; public static final String ERROR_DURING_MTREE_FLUSH_SCHEMA_REGION_BECAUSE = @@ -532,17 +525,14 @@ public final class DataNodeSchemaMessages { // ======================== FakeCRC32Deserializer ======================== - public static final String READ_LOG_LENGTH_NEGATIVE_LOG = - "Read log length {} is negative."; + public static final String READ_LOG_LENGTH_NEGATIVE_LOG = "Read log length {} is negative."; // ======================== SchemaLogReader ======================== - public static final String FILE_CORRUPTED = - "File {} is corrupted. The uncorrupted size is {}."; + public static final String FILE_CORRUPTED = "File {} is corrupted. The uncorrupted size is {}."; public static final String LOG_FILE_END_CORRUPTED_TRUNCATE = "The end of log file {} is corrupted. Start truncate it. The unbroken size is {}. The file size is {}."; - public static final String FAIL_TO_TRUNCATE_LOG_FILE = - "Fail to truncate log file to size {}"; + public static final String FAIL_TO_TRUNCATE_LOG_FILE = "Fail to truncate log file to size {}"; // ======================== SchemaRegionPlanDeserializer ======================== @@ -553,28 +543,20 @@ public final class DataNodeSchemaMessages { public static final String TIMESERIES_NUM_UPPER_LIMIT = "The number of timeseries has reached the upper limit"; - public static final String ALIAS_DUPLICATED_DETAIL = - ", fullPath: "; - public static final String ALIAS_DUPLICATED_OTHER_MEASUREMENT = - ", otherMeasurement: "; - public static final String START_CREATE_TABLE_DEVICE = - "Start to create table device {}.{}"; - public static final String TABLE_DEVICE_ALREADY_EXISTS = - "Table device {}.{} already exists"; - public static final String TABLE_DEVICE_CREATED = - "Table device {}.{} created"; + public static final String ALIAS_DUPLICATED_DETAIL = ", fullPath: "; + public static final String ALIAS_DUPLICATED_OTHER_MEASUREMENT = ", otherMeasurement: "; + public static final String START_CREATE_TABLE_DEVICE = "Start to create table device {}.{}"; + public static final String TABLE_DEVICE_ALREADY_EXISTS = "Table device {}.{} already exists"; + public static final String TABLE_DEVICE_CREATED = "Table device {}.{} created"; // ======================== CachedMTreeStore / Scheduler ======================== - public static final String MTREE_FLUSH_COST = - "It takes {}ms to flush MTree in SchemaRegion {}"; + public static final String MTREE_FLUSH_COST = "It takes {}ms to flush MTree in SchemaRegion {}"; // ======================== DataNodeTableCache ======================== - public static final String INIT_TABLE_CACHE_SUCCESS = - "Init DataNodeTableCache successfully"; - public static final String PRE_UPDATE_TABLE_SUCCESS = - "Pre-update table {}.{} successfully"; + public static final String INIT_TABLE_CACHE_SUCCESS = "Init DataNodeTableCache successfully"; + public static final String PRE_UPDATE_TABLE_SUCCESS = "Pre-update table {}.{} successfully"; public static final String PRE_RENAME_OLD_TABLE_SUCCESS = "Pre-rename old table {}.{} successfully"; public static final String ROLLBACK_UPDATE_TABLE_SUCCESS = @@ -585,14 +567,18 @@ public final class DataNodeSchemaMessages { "Commit-update table {}.{} successfully, {}"; public static final String COMMIT_UPDATE_TABLE_SUCCESS = "Commit-update table {}.{} successfully."; - public static final String RENAME_OLD_TABLE_SUCCESS = - "Rename old table {}.{} successfully."; + public static final String RENAME_OLD_TABLE_SUCCESS = "Rename old table {}.{} successfully."; + public static final String COMMIT_DELETE_TABLE_SUCCESS = + "commit delete table {}.{} successfully."; + public static final String FAILED_TO_REFRESH_CACHE_FROM_CN = + "Failed to refresh DataNodeTableCache from ConfigNode"; public static final String INTERRUPTED_ACQUIRE_SEMAPHORE_GET_TABLES = "Interrupted when trying to acquire semaphore when trying to get tables from configNode, ignore."; public static final String UPDATE_TABLE_BY_FETCH_WITH_DETAIL = "Update table {}.{} by table fetch, {}"; - public static final String UPDATE_TABLE_BY_FETCH = - "Update table {}.{} by table fetch."; + public static final String UPDATE_TABLE_BY_FETCH = "Update table {}.{} by table fetch."; + public static final String THE_TABLE_IS_IN_PRE_DELETE_STATE = + "The table %s.%s is in the pre-delete state. Please wait a few seconds. If the table is still in this state, please drop it again."; public static final String COMPARE_TABLE_ADDED = "Added table: "; public static final String COMPARE_TABLE_REMOVED = "Removed table: "; public static final String COMPARE_TABLE_NAME = "Table name: "; @@ -602,6 +588,21 @@ public final class DataNodeSchemaMessages { public static final String COMPARE_TABLE_ADDED_COLUMNS = " Added column(s): "; public static final String COMPARE_TABLE_NOT_MODIFIED = " Not modified"; + // ======================== MetadataLeaseManager ======================== + + public static final String FAILED_TO_SUBMIT_METADATA_PULL_TASK = + "Failed to submit metadata pull task."; + public static final String UNEXPECTED_METADATA_STATE = + "Unexpected metadata state {}, because no other clear-and-pull thread should exist."; + public static final String METADATA_LEASE_CACHE_CLEARING_IN_PROGRESS = + "Metadata state is {}, another thread may be set the metadata status. Retry later."; + public static final String FAILED_TO_CLEAR_METADATA_CACHE = "Failed to clear metadata cache."; + public static final String FAILED_TO_MARK_METADATA_STATE_AS_PULLING = + "Failed to mark metadata state {} as PULLING because another metadata pull thread is active."; + public static final String FAILED_TO_PULL_OR_INIT_METADATA = "Failed to pull or init metadata."; + public static final String METADATA_LEASE_IS_FENCED = + "Metadata lease is fenced. The local metadata cache is unavailable."; + // ======================== ClusterTemplateManager ======================== public static final String ILLEGAL_PATH_LOG = "illegal path {}"; diff --git a/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodeSchemaMessages.java b/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodeSchemaMessages.java index de8b762c10b78..415e2580a1380 100644 --- a/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodeSchemaMessages.java +++ b/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodeSchemaMessages.java @@ -562,28 +562,21 @@ public final class DataNodeSchemaMessages { // ======================== DataNodeTableCache 相关消息 ======================== - public static final String INIT_TABLE_CACHE_SUCCESS = - "DataNodeTableCache 初始化成功"; - public static final String PRE_UPDATE_TABLE_SUCCESS = - "预更新表 {}.{} 成功"; - public static final String PRE_RENAME_OLD_TABLE_SUCCESS = - "预重命名旧表 {}.{} 成功"; - public static final String ROLLBACK_UPDATE_TABLE_SUCCESS = - "回滚更新表 {}.{} 成功"; - public static final String ROLLBACK_RENAME_OLD_TABLE_SUCCESS = - "回滚重命名旧表 {}.{} 成功。"; - public static final String COMMIT_UPDATE_TABLE_SUCCESS_WITH_DETAIL = - "提交更新表 {}.{} 成功,{}"; - public static final String COMMIT_UPDATE_TABLE_SUCCESS = - "提交更新表 {}.{} 成功。"; - public static final String RENAME_OLD_TABLE_SUCCESS = - "重命名旧表 {}.{} 成功。"; + public static final String INIT_TABLE_CACHE_SUCCESS = "DataNodeTableCache 初始化成功"; + public static final String PRE_UPDATE_TABLE_SUCCESS = "预更新表 {}.{} 成功"; + public static final String PRE_RENAME_OLD_TABLE_SUCCESS = "预重命名旧表 {}.{} 成功"; + public static final String ROLLBACK_UPDATE_TABLE_SUCCESS = "回滚更新表 {}.{} 成功"; + public static final String ROLLBACK_RENAME_OLD_TABLE_SUCCESS = "回滚重命名旧表 {}.{} 成功。"; + public static final String COMMIT_UPDATE_TABLE_SUCCESS_WITH_DETAIL = "提交更新表 {}.{} 成功,{}"; + public static final String COMMIT_UPDATE_TABLE_SUCCESS = "提交更新表 {}.{} 成功。"; + public static final String RENAME_OLD_TABLE_SUCCESS = "重命名旧表 {}.{} 成功。"; + public static final String FAILED_TO_REFRESH_CACHE_FROM_CN = + "从configNode拉取元数据更新DataNodeTableCache失败"; public static final String INTERRUPTED_ACQUIRE_SEMAPHORE_GET_TABLES = "尝试获取信号量以从 ConfigNode 获取表时被中断,已忽略。"; - public static final String UPDATE_TABLE_BY_FETCH_WITH_DETAIL = - "通过表拉取更新表 {}.{},{}"; - public static final String UPDATE_TABLE_BY_FETCH = - "通过表拉取更新表 {}.{}。"; + public static final String UPDATE_TABLE_BY_FETCH = "通过表拉取更新表 {}.{}"; + public static final String THE_TABLE_IS_IN_PRE_DELETE_STATE = + "表 %s.%s 处于预删除的状态,请稍等,如之后重试还是此状态,请输入sql再次删除"; public static final String COMPARE_TABLE_ADDED = "新增表:"; public static final String COMPARE_TABLE_REMOVED = "已移除表:"; public static final String COMPARE_TABLE_NAME = "表名:"; @@ -597,5 +590,17 @@ public final class DataNodeSchemaMessages { public static final String ILLEGAL_PATH_LOG = "非法路径 {}"; + // ======================== MetadataLeaseManager 相关消息 ======================== + + public static final String FAILED_TO_SUBMIT_METADATA_PULL_TASK = "提交元数据拉取任务失败。"; + public static final String UNEXPECTED_METADATA_STATE = "元数据状态异常,当前为 {},不应存在其他元数据拉取线程。"; + public static final String METADATA_LEASE_CACHE_CLEARING_IN_PROGRESS = + "当前元数据状态为 {},可能有其他线程正在清理元数据缓存,请稍后重试。"; + public static final String FAILED_TO_CLEAR_METADATA_CACHE = "清理元数据缓存失败。"; + public static final String FAILED_TO_MARK_METADATA_STATE_AS_PULLING = + "无法将元数据状态 {} 标记为 PULLING,因为已有其他元数据拉取线程正在运行。"; + public static final String FAILED_TO_PULL_OR_INIT_METADATA = "拉取元数据失败。"; + public static final String METADATA_LEASE_IS_FENCED = "元数据租约已过期, 本地缓存不可用"; + private DataNodeSchemaMessages() {} } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcher.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcher.java index 641ead173d2be..af3c149f2bf44 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcher.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcher.java @@ -57,6 +57,7 @@ import org.apache.iotdb.db.queryengine.plan.relational.type.AuthorRType; import org.apache.iotdb.db.queryengine.plan.statement.StatementType; import org.apache.iotdb.db.queryengine.plan.statement.sys.AuthorStatement; +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseManager; import org.apache.iotdb.rpc.RpcUtils; import org.apache.iotdb.rpc.TSStatusCode; @@ -518,13 +519,24 @@ public void refreshToken() { heartBeatTimeStamp = currentTime; } - private void checkCacheAvailable() { - if (cacheOutDate) { + // Package-private for testing (ClusterAuthorityFetcherLeaseTest). + void checkCacheAvailable() { + // cacheOutDate is set by refreshToken() only when a heartbeat finally arrives after a long gap, + // so it cannot catch an *ongoing* ConfigNode partition (no heartbeat arrives, refreshToken() is + // never called). isFenced() is evaluated on this DataNode's own clock and fires without any + // heartbeat: while fenced we drop the permission cache and force a re-fetch from the + // ConfigNode, + // which fails closed while partitioned, so a missed REVOKE cannot keep authorizing a privilege. + if (cacheOutDate || isMetadataLeaseFenced()) { iAuthorCache.invalidAllCache(); } cacheOutDate = false; } + boolean isMetadataLeaseFenced() { + return MetadataLeaseManager.getInstance().isFenced(); + } + @TestOnly public void setAcceptCache(boolean acceptCache) { this.acceptCache = acceptCache; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java index f6a079bd2d609..33c643ed85990 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/client/ConfigNodeClient.java @@ -84,6 +84,7 @@ import org.apache.iotdb.confignode.rpc.thrift.TCreateTopicReq; import org.apache.iotdb.confignode.rpc.thrift.TCreateTriggerReq; import org.apache.iotdb.confignode.rpc.thrift.TDataNodeConfigurationResp; +import org.apache.iotdb.confignode.rpc.thrift.TDataNodeLeaseRecoveryResp; import org.apache.iotdb.confignode.rpc.thrift.TDataNodeRegisterReq; import org.apache.iotdb.confignode.rpc.thrift.TDataNodeRegisterResp; import org.apache.iotdb.confignode.rpc.thrift.TDataNodeRemoveReq; @@ -552,6 +553,12 @@ public TDataNodeRestartResp restartDataNode(TDataNodeRestartReq req) throws TExc () -> client.restartDataNode(req), resp -> !updateConfigNodeLeader(resp.status)); } + @Override + public TDataNodeLeaseRecoveryResp reloadCacheAfterLeaseRecovery() throws TException { + return executeRemoteCallWithRetry( + () -> client.reloadCacheAfterLeaseRecovery(), resp -> !updateConfigNodeLeader(resp.status)); + } + @Override public TAINodeRegisterResp registerAINode(TAINodeRegisterReq req) throws TException { throw new UnsupportedOperationException(UNSUPPORTED_INVOCATION); @@ -1527,10 +1534,11 @@ public TDescTable4InformationSchemaResp descTables4InformationSchema() throws TE } @Override - public TFetchTableResp fetchTables(final Map> fetchTableMap) + public TFetchTableResp fetchTables(Map> fetchTableMap, byte tableNodeStatus) throws TException { return executeRemoteCallWithRetry( - () -> client.fetchTables(fetchTableMap), resp -> !updateConfigNodeLeader(resp.status)); + () -> client.fetchTables(fetchTableMap, tableNodeStatus), + resp -> !updateConfigNodeLeader(resp.status)); } @Override diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java index ec3bbff0bb78d..a1b9d911802b0 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java @@ -192,6 +192,7 @@ import org.apache.iotdb.db.queryengine.plan.statement.crud.InsertRowStatement; import org.apache.iotdb.db.queryengine.plan.statement.crud.QueryStatement; import org.apache.iotdb.db.schemaengine.SchemaEngine; +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseManager; import org.apache.iotdb.db.schemaengine.schemaregion.ISchemaRegion; import org.apache.iotdb.db.schemaengine.schemaregion.read.resp.info.ITimeSeriesSchemaInfo; import org.apache.iotdb.db.schemaengine.schemaregion.read.resp.reader.ISchemaReader; @@ -1895,7 +1896,8 @@ public TSStatus invalidateTableCache(final TInvalidateTableCacheReq req) { .takeWriteLock(SchemaLockType.VALIDATE_VS_DELETION_TABLE); try { TableDeviceSchemaCache.getInstance() - .invalidate(PathUtils.unQualifyDatabaseName(req.getDatabase()), req.getTableName()); + .invalidateAndPreDelete( + PathUtils.unQualifyDatabaseName(req.getDatabase()), req.getTableName()); return StatusUtils.OK; } finally { DataNodeSchemaLockManager.getInstance() @@ -2283,6 +2285,10 @@ private PathPatternTree filterPathPatternTree(PathPatternTree patternTree, Strin public TDataNodeHeartbeatResp getDataNodeHeartBeat(TDataNodeHeartbeatReq req) throws TException { TDataNodeHeartbeatResp resp = new TDataNodeHeartbeatResp(); + // Renew the metadata lease: receiving a ConfigNode heartbeat means this DataNode is still in + // contact with the cluster and may keep trusting its ConfigNode-pushed metadata caches. + MetadataLeaseManager.getInstance().triggerCheckWithHeartBeat(); + // Judging leader if necessary if (req.isNeedJudgeLeader()) { // Always get logical clock before judging leader @@ -2330,6 +2336,9 @@ public TDataNodeHeartbeatResp getDataNodeHeartBeat(TDataNodeHeartbeatReq req) th AuthorityChecker.getAuthorityFetcher().refreshToken(); resp.setHeartbeatTimestamp(req.getHeartbeatTimestamp()); resp.setStatus(commonConfig.getNodeStatus().getStatus()); + // Advertise that this DataNode supports metadata-lease self-fencing, so the ConfigNode may + // treat + // it as safely fenced when unreachable (older DataNodes that omit this are handled strictly). if (commonConfig.getStatusReason() != null) { resp.setStatusReason(commonConfig.getStatusReason()); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java index 97121eb82e86e..11c7c50e12840 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/partition/PartitionCache.java @@ -60,6 +60,7 @@ import org.apache.iotdb.db.protocol.client.ConfigNodeInfo; import org.apache.iotdb.db.protocol.session.IClientSession; import org.apache.iotdb.db.protocol.session.SessionManager; +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseManager; import org.apache.iotdb.db.schemaengine.schemaregion.utils.MetaUtils; import org.apache.iotdb.db.service.metrics.CacheMetrics; import org.apache.iotdb.rpc.TSStatusCode; @@ -143,6 +144,10 @@ public PartitionCache() { this.cacheMetrics = new CacheMetrics(); } + protected void failIfMetadataLeaseFenced() { + MetadataLeaseManager.getInstance().failIfMetadataLeaseFenced(); + } + // region database cache /** @@ -158,6 +163,7 @@ public Map> getDatabaseToDevice( final boolean tryToFetch, final boolean isAutoCreate, final String userName) { + failIfMetadataLeaseFenced(); final DatabaseCacheResult> result = new DatabaseCacheResult>() { @Override @@ -182,6 +188,7 @@ public Map getDeviceToDatabase( final boolean tryToFetch, final boolean isAutoCreate, final String userName) { + failIfMetadataLeaseFenced(); final DatabaseCacheResult result = new DatabaseCacheResult() { @Override @@ -516,6 +523,7 @@ private void getDatabaseCacheResult( public void checkAndAutoCreateDatabase( final String database, final boolean isAutoCreate, final String userName) { + failIfMetadataLeaseFenced(); boolean isExisted = containsDatabase(database); if (!isExisted) { try { @@ -577,6 +585,7 @@ public List getRegionReplicaSet(List conse // try to get regionReplicaSet from cache regionReplicaSetLock.readLock().lock(); try { + failIfMetadataLeaseFenced(); result = getRegionReplicaSetInternal(consensusGroupIds); } finally { regionReplicaSetLock.readLock().unlock(); @@ -680,6 +689,7 @@ public SchemaPartition getSchemaPartition( final Map> databaseToDeviceMap) { schemaPartitionCacheLock.readLock().lock(); try { + failIfMetadataLeaseFenced(); if (databaseToDeviceMap.isEmpty()) { cacheMetrics.record(false, CacheMetrics.SCHEMA_PARTITION_CACHE_NAME); return null; @@ -752,6 +762,7 @@ public SchemaPartition getSchemaPartition( public SchemaPartition getSchemaPartition(String database) { schemaPartitionCacheLock.readLock().lock(); try { + failIfMetadataLeaseFenced(); SchemaPartitionTable schemaPartitionTable = schemaPartitionCache.getIfPresent(database); if (null == schemaPartitionTable) { // if database not find, then return cache miss. @@ -841,6 +852,7 @@ public DataPartition getDataPartition( Map> databaseToQueryParamsMap) { dataPartitionCacheLock.readLock().lock(); try { + failIfMetadataLeaseFenced(); if (databaseToQueryParamsMap.isEmpty()) { cacheMetrics.record(false, CacheMetrics.DATA_PARTITION_CACHE_NAME); return null; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java index 9a31dae2baefb..2b70b9b5ae831 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java @@ -84,6 +84,7 @@ import org.apache.iotdb.commons.schema.table.AlterOrDropTableOperationType; import org.apache.iotdb.commons.schema.table.Audit; import org.apache.iotdb.commons.schema.table.InformationSchema; +import org.apache.iotdb.commons.schema.table.TableNodeStatus; import org.apache.iotdb.commons.schema.table.TsTable; import org.apache.iotdb.commons.schema.table.TsTableInternalRPCUtil; import org.apache.iotdb.commons.schema.table.column.TsTableColumnSchema; @@ -4796,10 +4797,12 @@ public SettableFuture showTables( } @Override - public TFetchTableResp fetchTables(final Map> fetchTableMap) { + public TFetchTableResp fetchTables( + final Map> fetchTableMap, final TableNodeStatus tableNodeStatus) { try (final ConfigNodeClient configNodeClient = CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) { - final TFetchTableResp fetchTableResp = configNodeClient.fetchTables(fetchTableMap); + final TFetchTableResp fetchTableResp = + configNodeClient.fetchTables(fetchTableMap, tableNodeStatus.getStatus()); if (TSStatusCode.SUCCESS_STATUS.getStatusCode() != fetchTableResp.getStatus().getCode()) { LOGGER.warn(DataNodeQueryMessages.FAILED_TO_FETCHTABLES_STATUS_IS, fetchTableResp); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/IConfigTaskExecutor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/IConfigTaskExecutor.java index 46f82cefe28cf..964b1c527792b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/IConfigTaskExecutor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/IConfigTaskExecutor.java @@ -27,6 +27,7 @@ import org.apache.iotdb.commons.queryengine.common.SessionInfo; import org.apache.iotdb.commons.queryengine.common.SqlDialect; import org.apache.iotdb.commons.schema.cache.CacheClearOptions; +import org.apache.iotdb.commons.schema.table.TableNodeStatus; import org.apache.iotdb.commons.schema.table.TsTable; import org.apache.iotdb.commons.schema.table.column.TsTableColumnSchema; import org.apache.iotdb.confignode.rpc.thrift.TDatabaseSchema; @@ -372,7 +373,8 @@ SettableFuture describeTable( SettableFuture showTables( final String database, final Predicate checkCanShowTable, final boolean isDetails); - TFetchTableResp fetchTables(final Map> fetchTableMap); + TFetchTableResp fetchTables( + final Map> fetchTableMap, final TableNodeStatus tableNodeStatus); SettableFuture alterTableRenameTable( final String database, diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java index 60b6b6ebc6181..3eb05e7c5ebd6 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/TableMetadataImpl.java @@ -59,6 +59,7 @@ import org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.TableHeaderSchemaValidator; import org.apache.iotdb.db.queryengine.plan.relational.security.AccessControl; import org.apache.iotdb.db.schemaengine.table.DataNodeTableCache; +import org.apache.iotdb.db.schemaengine.table.ITableCache; import org.apache.iotdb.udf.api.customizer.analysis.AggregateFunctionAnalysis; import org.apache.iotdb.udf.api.customizer.analysis.ScalarFunctionAnalysis; import org.apache.iotdb.udf.api.customizer.parameter.FunctionArguments; @@ -98,7 +99,7 @@ public class TableMetadataImpl implements Metadata { private final IPartitionFetcher partitionFetcher = ClusterPartitionFetcher.getInstance(); - private final DataNodeTableCache tableCache = DataNodeTableCache.getInstance(); + private final ITableCache tableCache = DataNodeTableCache.getInstance(); @Override public TableFunction getTableFunction(String functionName) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceSchemaCache.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceSchemaCache.java index a328ffa221deb..eb436bfaf7d7b 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceSchemaCache.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TableDeviceSchemaCache.java @@ -26,6 +26,7 @@ import org.apache.iotdb.commons.path.PartialPath; import org.apache.iotdb.commons.path.PathPatternUtil; import org.apache.iotdb.commons.queryengine.plan.relational.metadata.QualifiedObjectName; +import org.apache.iotdb.commons.schema.table.PreDeleteTsTable; import org.apache.iotdb.commons.service.metric.MetricService; import org.apache.iotdb.commons.utils.PathUtils; import org.apache.iotdb.db.conf.DataNodeMemoryConfig; @@ -633,11 +634,12 @@ public void invalidate(final @Nonnull String database) { } // Only used by table model - public void invalidate(final String database, final String tableName) { + public void invalidateAndPreDelete(final String database, final String tableName) { readWriteLock.writeLock().lock(); try { // Table cache's invalidate must be guarded by this lock - DataNodeTableCache.getInstance().invalid(database, tableName); + DataNodeTableCache.getInstance() + .preUpdateTable(database, new PreDeleteTsTable(tableName), null); dualKeyCache.invalidate(new TableId(database, tableName)); } finally { readWriteLock.writeLock().unlock(); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceSchemaCacheManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceSchemaCacheManager.java index c2588606cea69..28fcbf01b23e8 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceSchemaCacheManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceSchemaCacheManager.java @@ -29,6 +29,7 @@ import org.apache.iotdb.db.queryengine.common.schematree.ClusterSchemaTree; import org.apache.iotdb.db.queryengine.common.schematree.IMeasurementSchemaInfo; import org.apache.iotdb.db.queryengine.plan.analyze.schema.ISchemaComputation; +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseManager; import org.apache.iotdb.db.schemaengine.template.ClusterTemplateManager; import org.apache.iotdb.db.schemaengine.template.ITemplateManager; @@ -63,7 +64,7 @@ public class TreeDeviceSchemaCacheManager { // cache update or clean have higher priority than cache read private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock(false); - private TreeDeviceSchemaCacheManager() { + TreeDeviceSchemaCacheManager() { tableDeviceSchemaCache = TableDeviceSchemaCache.getInstance(); } @@ -71,6 +72,10 @@ public static TreeDeviceSchemaCacheManager getInstance() { return TreeDeviceSchemaCacheManagerHolder.INSTANCE; } + void failIfMetadataLeaseFenced() { + MetadataLeaseManager.getInstance().failIfMetadataLeaseFenced(); + } + /** singleton pattern. */ private static class TreeDeviceSchemaCacheManagerHolder { private static final TreeDeviceSchemaCacheManager INSTANCE = new TreeDeviceSchemaCacheManager(); @@ -100,6 +105,7 @@ public void releaseWriteLock() { * @return timeseries partialPath and its SchemaEntity */ public ClusterSchemaTree get(final PartialPath devicePath, final String[] measurements) { + failIfMetadataLeaseFenced(); final ClusterSchemaTree tree = new ClusterSchemaTree(); final IDeviceSchema schema = tableDeviceSchemaCache.getDeviceSchema(devicePath.getNodes()); if (!(schema instanceof TreeDeviceNormalSchema)) { @@ -129,6 +135,7 @@ public ClusterSchemaTree get(final PartialPath devicePath, final String[] measur * @return empty if cache miss or the device path is not a template activated path */ public ClusterSchemaTree getMatchedTemplateSchema(final PartialPath devicePath) { + failIfMetadataLeaseFenced(); final ClusterSchemaTree tree = new ClusterSchemaTree(); final IDeviceSchema schema = tableDeviceSchemaCache.getDeviceSchema(devicePath.getNodes()); if (!(schema instanceof TreeDeviceTemplateSchema)) { @@ -148,6 +155,7 @@ public ClusterSchemaTree getMatchedTemplateSchema(final PartialPath devicePath) * @return empty if cache miss */ public ClusterSchemaTree getMatchedNormalSchema(final PartialPath fullPath) { + failIfMetadataLeaseFenced(); final ClusterSchemaTree tree = new ClusterSchemaTree(); final IDeviceSchema schema = tableDeviceSchemaCache.getDeviceSchema( @@ -167,6 +175,7 @@ public ClusterSchemaTree getMatchedNormalSchema(final PartialPath fullPath) { } public List computeWithoutTemplate(final ISchemaComputation schemaComputation) { + failIfMetadataLeaseFenced(); final List indexOfMissingMeasurements = new ArrayList<>(); final String[] measurements = schemaComputation.getMeasurements(); if (measurements == null) { @@ -207,6 +216,7 @@ public Pair, List> computeSourceOfLogicalView( if (!schemaComputation.hasLogicalViewNeedProcess()) { return new Pair<>(new ArrayList<>(), new ArrayList<>()); } + failIfMetadataLeaseFenced(); final List indexOfMissingMeasurements = new ArrayList<>(); final Pair beginToEnd = @@ -263,6 +273,7 @@ public Pair, List> computeSourceOfLogicalView( } public List computeWithTemplate(final ISchemaComputation computation) { + failIfMetadataLeaseFenced(); final List indexOfMissingMeasurements = new ArrayList<>(); final String[] measurements = computation.getMeasurements(); final IDeviceSchema deviceSchema = diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManager.java new file mode 100644 index 0000000000000..a673f8aa37a26 --- /dev/null +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManager.java @@ -0,0 +1,287 @@ +/* + * 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.iotdb.db.schemaengine.lease; + +import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory; +import org.apache.iotdb.commons.conf.CommonDescriptor; +import org.apache.iotdb.commons.exception.MetadataLeaseFencedException; +import org.apache.iotdb.commons.utils.TestOnly; +import org.apache.iotdb.db.i18n.DataNodeSchemaMessages; +import org.apache.iotdb.db.queryengine.plan.analyze.ClusterPartitionFetcher; +import org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.cache.TreeDeviceSchemaCacheManager; +import org.apache.iotdb.db.schemaengine.table.DataNodeTableCache; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicStampedReference; +import java.util.function.LongSupplier; + +import static org.apache.iotdb.commons.concurrent.ThreadName.RELOAD_TABLE_METADATA_CACHE; + +/** + * Tracks the DataNode's "metadata lease" with the ConfigNode. The ConfigNode periodically sends + * heartbeats to the DataNode; while these arrive the DataNode may trust its ConfigNode-pushed + * metadata caches (table/tree schema, device attributes, templates, TTL, permissions, ...). If no + * heartbeat is received within {@code metadata_lease_fence_ms} ({@code T_fence}), the lease has + * expired and the DataNode must self-fence: stop trusting those caches so a partitioned DataNode + * cannot serve stale schema and generate dirty data. + * + *

This class only tracks the lease state; wiring fail-closed behavior into the read/write/auth + * paths and resync-on-recovery is done by the respective subsystems. + * + *

A monotonic clock ({@link System#nanoTime()}) is used so the lease is immune to wall-clock + * adjustments. The clock and fence threshold are injectable for testing. + */ +public class MetadataLeaseManager { + + @FunctionalInterface + interface MetadataAction { + void execute(); + } + + private final Logger LOGGER = LoggerFactory.getLogger(MetadataLeaseManager.class); + + private final List clearCacheList; + private final List pullMetaList; + + private final LongSupplier nanoClock; + private final LongSupplier fenceThresholdMs; + + private volatile long lastConfigNodeHeartbeatNanos; + + AtomicBoolean hasPullTaskNowRef; + AtomicStampedReference metadataStateRef; + ExecutorService pullExecutorService; + + private enum MetadataState { + NORMAL, + CACHE_CLEARING, + CACHE_CLEARED, + NEED_CLEAR, + PULLING, + PULL_OR_INIT_FAILED; + } + + private MetadataLeaseManager() { + this( + System::nanoTime, + () -> CommonDescriptor.getInstance().getConfig().getMetadataLeaseFenceMs(), + defaultClearCacheList(), + defaultPullMetaList(), + IoTDBThreadPoolFactory.newCachedThreadPool(RELOAD_TABLE_METADATA_CACHE.getName())); + } + + private static List defaultClearCacheList() { + return Arrays.asList( + () -> ClusterPartitionFetcher.getInstance().invalidAllCache(), + () -> DataNodeTableCache.getInstance().invalidateAll(), + () -> TreeDeviceSchemaCacheManager.getInstance().cleanUp()); + } + + private static List defaultPullMetaList() { + return Collections.singletonList( + () -> DataNodeTableCache.getInstance().reloadTableCacheAfterLeaseRecovery()); + } + + MetadataLeaseManager( + final LongSupplier nanoClock, + final LongSupplier fenceThresholdMs, + final List clearCacheList, + final List pullMetaList, + final ExecutorService pullExecutorService) { + this.nanoClock = nanoClock; + this.fenceThresholdMs = fenceThresholdMs; + this.clearCacheList = new ArrayList<>(clearCacheList); + this.pullMetaList = new ArrayList<>(pullMetaList); + // Startup registration performs a full re-sync, so treat construction time as a fresh contact. + this.lastConfigNodeHeartbeatNanos = nanoClock.getAsLong(); + + metadataStateRef = new AtomicStampedReference<>(MetadataState.NORMAL, 0); + hasPullTaskNowRef = new AtomicBoolean(false); + this.pullExecutorService = pullExecutorService; + } + + /** Renew the lease: record that a ConfigNode heartbeat has just been received */ + public void triggerCheckWithHeartBeat() { + if (metadataStateRef.getReference() == MetadataState.NORMAL && !hasOutOfLease()) { + // If the lease is about to expire, a cache-clear thread may race with a new CN heartbeat. + // In that case the heartbeat only refreshes the timestamp; + // And the state is no longer NORMAL, so the next heartbeat will schedule + // metadata pulling and make the cache available again + this.lastConfigNodeHeartbeatNanos = nanoClock.getAsLong(); + return; + } + boolean hasPullTaskNow = hasPullTaskNowRef.get(); + if (hasPullTaskNow) { + return; + } + if (hasPullTaskNowRef.compareAndSet(false, true)) { + try { + pullExecutorService.submit(this::clearCacheAndPullMetaData); + } catch (Exception e) { + LOGGER.error(DataNodeSchemaMessages.FAILED_TO_SUBMIT_METADATA_PULL_TASK, e); + hasPullTaskNowRef.set(false); + } + } + } + + private void clearCacheAndPullMetaData() { + try { + int[] stamp = new int[1]; + MetadataState metadataState = metadataStateRef.get(stamp); + if (metadataState == MetadataState.PULLING || metadataState == MetadataState.CACHE_CLEARING) { + LOGGER.error(DataNodeSchemaMessages.UNEXPECTED_METADATA_STATE, metadataState); + return; + } + + // clear the cache + if (metadataState == MetadataState.NORMAL || metadataState == MetadataState.NEED_CLEAR) { + if (!tryClearCache(metadataState, stamp[0])) { + LOGGER.warn( + DataNodeSchemaMessages.METADATA_LEASE_CACHE_CLEARING_IN_PROGRESS, metadataState); + return; + } + } + + pullMetaDataAndInit(); + } finally { + hasPullTaskNowRef.set(false); + } + } + + /** + * Attempts to CAS {@code currentState} → {@code CACHE_CLEARING}, then executes all cache-clear + * actions. Sets state to {@code CACHE_CLEARED} on success, or {@code NEED_CLEAR} on failure. + */ + private boolean tryClearCache(final MetadataState currentState, final int currentStamp) { + if (!metadataStateRef.compareAndSet( + currentState, MetadataState.CACHE_CLEARING, currentStamp, currentStamp + 1)) { + return false; + } + try { + clearCacheList.forEach(MetadataAction::execute); + } catch (Exception e) { + metadataStateRef.set(MetadataState.NEED_CLEAR, metadataStateRef.getStamp() + 1); + LOGGER.error(DataNodeSchemaMessages.FAILED_TO_CLEAR_METADATA_CACHE, e); + throw e; + } + metadataStateRef.set(MetadataState.CACHE_CLEARED, metadataStateRef.getStamp() + 1); + return true; + } + + private void pullMetaDataAndInit() { + int[] stamp = new int[1]; + MetadataState metadataState = metadataStateRef.get(stamp); + if (metadataState != MetadataState.CACHE_CLEARED + && metadataState != MetadataState.PULL_OR_INIT_FAILED) { + LOGGER.error(DataNodeSchemaMessages.UNEXPECTED_METADATA_STATE, metadataState); + return; + } + + if (!metadataStateRef.compareAndSet( + metadataState, MetadataState.PULLING, stamp[0], stamp[0] + 1)) { + LOGGER.error(DataNodeSchemaMessages.FAILED_TO_MARK_METADATA_STATE_AS_PULLING, metadataState); + return; + } + + for (final MetadataAction action : pullMetaList) { + try { + action.execute(); + } catch (final Exception e) { + metadataStateRef.set(MetadataState.PULL_OR_INIT_FAILED, metadataStateRef.getStamp() + 1); + LOGGER.error(DataNodeSchemaMessages.FAILED_TO_PULL_OR_INIT_METADATA, e); + throw e; + } + } + this.lastConfigNodeHeartbeatNanos = nanoClock.getAsLong(); + metadataStateRef.set(MetadataState.NORMAL, metadataStateRef.getStamp() + 1); + } + + private boolean hasOutOfLease() { + return getMillisSinceLastConfigNodeHeartbeat() > fenceThresholdMs.getAsLong(); + } + + /** Milliseconds elapsed since the last ConfigNode heartbeat was received (never negative). */ + public long getMillisSinceLastConfigNodeHeartbeat() { + final long elapsedNanos = nanoClock.getAsLong() - lastConfigNodeHeartbeatNanos; + return elapsedNanos > 0 ? elapsedNanos / 1_000_000L : 0L; + } + + public boolean isFenced() { + int[] stampHolder = new int[1]; + MetadataState metadataState = metadataStateRef.get(stampHolder); + if (metadataState != MetadataState.NORMAL) { + return true; + } + + // NORMAL and within lease means the metadata cache is available + if (!hasOutOfLease()) { + return false; + } + + // Do not clear cache in caller threads. Mark the lease as fenced only; the heartbeat worker + // serializes cache clearing and metadata pulling. The stamp prevents an old isFenced() caller + // from changing a newly recovered NORMAL state back to NEED_CLEAR. + metadataStateRef.compareAndSet( + MetadataState.NORMAL, MetadataState.NEED_CLEAR, stampHolder[0], stampHolder[0] + 1); + return true; + } + + /** + * Fail closed when the metadata lease has expired: a fenced DataNode may hold a stale + * table-schema cache (it could have missed a ConfigNode invalidation while partitioned), so + * refuse to serve it rather than risk validating writes/queries against stale schema and + * producing dirty data. + */ + public void failIfMetadataLeaseFenced() { + if (isFenced()) { + throw new MetadataLeaseFencedException(DataNodeSchemaMessages.METADATA_LEASE_IS_FENCED); + } + } + + /** Force the lease to appear expired, for tests that exercise fail-closed behavior. */ + @TestOnly + public void recoveryLeaseForTest(boolean recovery) { + if (recovery) { + this.lastConfigNodeHeartbeatNanos = nanoClock.getAsLong(); + metadataStateRef.set(MetadataState.NORMAL, 0); + } else { + this.lastConfigNodeHeartbeatNanos = + nanoClock.getAsLong() - (fenceThresholdMs.getAsLong() + 1_000L) * 1_000_000L; + } + } + + public static MetadataLeaseManager getInstance() { + return MetadataLeaseManagerHolder.INSTANCE; + } + + private static final class MetadataLeaseManagerHolder { + private static final MetadataLeaseManager INSTANCE = new MetadataLeaseManager(); + + private MetadataLeaseManagerHolder() {} + } +} diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCache.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCache.java index 11e80f5a63e8c..444ddac5b1da2 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCache.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCache.java @@ -20,17 +20,30 @@ package org.apache.iotdb.db.schemaengine.table; import org.apache.iotdb.calc.plan.relational.metadata.CommonMetadataUtils; +import org.apache.iotdb.commons.client.IClientManager; +import org.apache.iotdb.commons.client.exception.ClientManagerException; +import org.apache.iotdb.commons.consensus.ConfigRegionId; +import org.apache.iotdb.commons.exception.IoTDBRuntimeException; +import org.apache.iotdb.commons.exception.SemanticException; import org.apache.iotdb.commons.schema.table.NonCommittableTsTable; +import org.apache.iotdb.commons.schema.table.PreDeleteTsTable; +import org.apache.iotdb.commons.schema.table.TableNodeStatus; import org.apache.iotdb.commons.schema.table.TsTable; import org.apache.iotdb.commons.schema.table.TsTableInternalRPCUtil; import org.apache.iotdb.commons.schema.table.column.TsTableColumnSchema; import org.apache.iotdb.commons.utils.PathUtils; +import org.apache.iotdb.confignode.rpc.thrift.TDataNodeLeaseRecoveryResp; import org.apache.iotdb.confignode.rpc.thrift.TFetchTableResp; import org.apache.iotdb.db.conf.IoTDBDescriptor; import org.apache.iotdb.db.i18n.DataNodeSchemaMessages; +import org.apache.iotdb.db.protocol.client.ConfigNodeClient; +import org.apache.iotdb.db.protocol.client.ConfigNodeClientManager; +import org.apache.iotdb.db.protocol.client.ConfigNodeInfo; import org.apache.iotdb.db.queryengine.plan.execution.config.executor.ClusterConfigTaskExecutor; +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseManager; import org.apache.iotdb.rpc.TSStatusCode; +import org.apache.thrift.TException; import org.apache.tsfile.utils.Pair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,14 +61,19 @@ import java.util.concurrent.Semaphore; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.Function; import java.util.stream.Collectors; +import static org.apache.iotdb.db.i18n.DataNodeSchemaMessages.FAILED_TO_REFRESH_CACHE_FROM_CN; + /** It contains all tables' latest column schema */ public class DataNodeTableCache implements ITableCache { private static final Logger LOGGER = LoggerFactory.getLogger(DataNodeTableCache.class); + private static final IClientManager CONFIG_NODE_CLIENT_MANAGER = + ConfigNodeClientManager.getInstance(); /** Instance-specific version counter for optimistic locking mechanisms. */ private final AtomicLong instanceVersion = new AtomicLong(0); @@ -64,7 +82,7 @@ public class DataNodeTableCache implements ITableCache { private final Map> databaseTableMap = new ConcurrentHashMap<>(); // The database is without "root" - private final Map>> preUpdateTableMap = + private final Map>> specialStatusMap = new ConcurrentHashMap<>(); private final ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock(); @@ -72,9 +90,7 @@ public class DataNodeTableCache implements ITableCache { new Semaphore( IoTDBDescriptor.getInstance().getConfig().getDataNodeTableCacheSemaphorePermitNum()); - private DataNodeTableCache() { - // Do nothing - } + private DataNodeTableCache() {} private static final class DataNodeTableCacheHolder { private static final DataNodeTableCache INSTANCE = new DataNodeTableCache(); @@ -82,10 +98,14 @@ private static final class DataNodeTableCacheHolder { private DataNodeTableCacheHolder() {} } - public static DataNodeTableCache getInstance() { + public static ITableCache getInstance() { return DataNodeTableCacheHolder.INSTANCE; } + void failIfMetadataLeaseFenced() { + MetadataLeaseManager.getInstance().failIfMetadataLeaseFenced(); + } + @Override public void init(final byte[] tableInitializationBytes) { readWriteLock.writeLock().lock(); @@ -96,7 +116,7 @@ public void init(final byte[] tableInitializationBytes) { final Pair>, Map>> tableInfo = TsTableInternalRPCUtil.deserializeTableInitializationInfo(tableInitializationBytes); final Map> usingMap = tableInfo.left; - final Map> preCreateMap = tableInfo.right; + final Map> specialStatusMap = tableInfo.right; usingMap.forEach( (key, value) -> databaseTableMap.put( @@ -108,9 +128,9 @@ public void init(final byte[] tableInitializationBytes) { Function.identity(), (v1, v2) -> v2, ConcurrentHashMap::new)))); - preCreateMap.forEach( + specialStatusMap.forEach( (key, value) -> - preUpdateTableMap.put( + this.specialStatusMap.put( PathUtils.unQualifyDatabaseName(key), value.stream() .collect( @@ -125,12 +145,43 @@ public void init(final byte[] tableInitializationBytes) { } } + // No need to acquire a lock here; reloadTableCacheAfterLeaseRecovery is within a critical section + // protected by metadataLeaseManager + @Override + public void reloadTableCacheAfterLeaseRecovery() { + try (ConfigNodeClient configNodeClient = + CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) { + final TDataNodeLeaseRecoveryResp resp = configNodeClient.reloadCacheAfterLeaseRecovery(); + if (resp.getStatus().getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { + throw new IoTDBRuntimeException(resp.getStatus().getMessage(), resp.getStatus().getCode()); + } + if (resp.isSetTableInfo()) { + init(resp.getTableInfo()); + } + } catch (final ClientManagerException | TException e) { + throw new RuntimeException(FAILED_TO_REFRESH_CACHE_FROM_CN, e); + } + } + + /** + * The case that pre update Table and pre delete Table procedures targeting the same table are + * executed serially by CN. + * + *

Consider the scenario: + * + *

    + *
  1. Drop the table first: DN executed pre update but missed the commit phase + *
  2. Create table second: DN executed pre update, which overwrites the result of the drop + * table procedure in {@link #specialStatusMap} + *
+ */ @Override public void preUpdateTable(String database, final TsTable table, final String oldName) { database = PathUtils.unQualifyDatabaseName(database); readWriteLock.writeLock().lock(); try { - preUpdateTableMap + failIfMetadataLeaseFenced(); + specialStatusMap .computeIfAbsent(database, k -> new ConcurrentHashMap<>()) .compute( table.getTableName(), @@ -144,11 +195,15 @@ public void preUpdateTable(String database, final TsTable table, final String ol } }); LOGGER.info(DataNodeSchemaMessages.PRE_UPDATE_TABLE_SUCCESS, database, table.getTableName()); - + if (table instanceof PreDeleteTsTable) { + if (databaseTableMap.containsKey(database)) { + databaseTableMap.get(database).remove(table.getTableName()); + } + } // If rename table if (Objects.nonNull(oldName)) { final TsTable oldTable = databaseTableMap.get(database).remove(oldName); - preUpdateTableMap + specialStatusMap .computeIfAbsent(database, k -> new ConcurrentHashMap<>()) .compute( oldName, @@ -173,13 +228,20 @@ public void rollbackUpdateTable(String database, final String tableName, final S database = PathUtils.unQualifyDatabaseName(database); readWriteLock.writeLock().lock(); try { - removeTableFromPreUpdateMap(database, tableName); + failIfMetadataLeaseFenced(); + // if rollback the drop table procedure, do nothing, + // wait for triggering the action of pull table from CN + final TsTable table = getTableFromSpecialStatusMap(database, tableName); + if (table instanceof PreDeleteTsTable) { + return; + } + removeTableFromSpecialStatusMap(database, tableName); LOGGER.info(DataNodeSchemaMessages.ROLLBACK_UPDATE_TABLE_SUCCESS, database, tableName); // If rename table if (Objects.nonNull(oldName)) { // Equals to commit update - final TsTable oldTable = getTableFromPreUpdateMap(database, oldName); + final TsTable oldTable = getTableFromSpecialStatusMap(database, oldName); if (Objects.isNull(oldTable)) { LOGGER.info( "Skip rollback renaming old table {}.{} because it has been handled.", @@ -199,28 +261,16 @@ public void rollbackUpdateTable(String database, final String tableName, final S .computeIfAbsent(database, k -> new ConcurrentHashMap<>()) .put(tableName, oldTable); LOGGER.info(DataNodeSchemaMessages.ROLLBACK_RENAME_OLD_TABLE_SUCCESS, database, oldName); - removeTableFromPreUpdateMap(database, oldName); + removeTableFromSpecialStatusMap(database, oldName); } } finally { readWriteLock.writeLock().unlock(); } } - private void removeTableFromPreUpdateMap(final String database, final String tableName) { - preUpdateTableMap.computeIfPresent( - database, - (k, v) -> { - final Pair tableVersionPair = v.get(tableName); - if (Objects.nonNull(tableVersionPair)) { - tableVersionPair.setLeft(null); - } - return v; - }); - } - - private @Nullable TsTable getTableFromPreUpdateMap( + private @Nullable TsTable getTableFromSpecialStatusMap( final String database, final String tableName) { - final Map> tableMap = preUpdateTableMap.get(database); + final Map> tableMap = specialStatusMap.get(database); if (Objects.isNull(tableMap)) { return null; } @@ -228,18 +278,33 @@ private void removeTableFromPreUpdateMap(final String database, final String tab return Objects.nonNull(tableVersionPair) ? tableVersionPair.getLeft() : null; } + private void removeTableFromSpecialStatusMap(final String database, final String tableName) { + specialStatusMap.computeIfPresent( + database, + (k, v) -> { + v.computeIfPresent( + tableName, + (innerKey, tableVersionPair) -> { + tableVersionPair.setLeft(null); + return tableVersionPair; + }); + return v; + }); + } + @Override public void commitUpdateTable( String database, final String tableName, final @Nullable String oldName) { database = PathUtils.unQualifyDatabaseName(database); readWriteLock.writeLock().lock(); try { - final TsTable newTable = getTableFromPreUpdateMap(database, tableName); + failIfMetadataLeaseFenced(); + final TsTable newTable = getTableFromSpecialStatusMap(database, tableName); if (Objects.isNull(newTable)) { LOGGER.info( "Skip commit-update table {}.{} because it has been handled.", database, tableName); if (Objects.nonNull(oldName)) { - removeTableFromPreUpdateMap(database, oldName); + removeTableFromSpecialStatusMap(database, oldName); } return; } @@ -251,6 +316,10 @@ public void commitUpdateTable( if (newTable instanceof NonCommittableTsTable) { return; } + if (newTable instanceof PreDeleteTsTable) { + commitDeleteTable(database, tableName); + return; + } final TsTable oldTable = databaseTableMap .computeIfAbsent(database, k -> new ConcurrentHashMap<>()) @@ -264,9 +333,9 @@ public void commitUpdateTable( } else if (LOGGER.isInfoEnabled()) { LOGGER.info(DataNodeSchemaMessages.COMMIT_UPDATE_TABLE_SUCCESS, database, tableName); } - removeTableFromPreUpdateMap(database, tableName); + removeTableFromSpecialStatusMap(database, tableName); if (Objects.nonNull(oldName)) { - removeTableFromPreUpdateMap(database, oldName); + removeTableFromSpecialStatusMap(database, oldName); LOGGER.info(DataNodeSchemaMessages.RENAME_OLD_TABLE_SUCCESS, database, oldName); } instanceVersion.incrementAndGet(); @@ -275,31 +344,38 @@ public void commitUpdateTable( } } + private void commitDeleteTable(String database, final String tableName) { + if (databaseTableMap.containsKey(database)) { + databaseTableMap.get(database).remove(tableName); + } + removeTableFromSpecialStatusMap(database, tableName); + LOGGER.info(DataNodeSchemaMessages.COMMIT_DELETE_TABLE_SUCCESS, database, tableName); + } + @Override public void invalid(String database) { database = PathUtils.unQualifyDatabaseName(database); readWriteLock.writeLock().lock(); try { databaseTableMap.remove(database); - preUpdateTableMap.remove(database); + specialStatusMap.remove(database); instanceVersion.incrementAndGet(); } finally { readWriteLock.writeLock().unlock(); } } - @GuardedBy("TableDeviceSchemaCache#writeLock") + /** + * Drop the entire cache. Used on metadata-lease recovery: after the DataNode was fenced it may + * have missed ConfigNode pushes, so the cached schema is no longer trustworthy and must be + * re-fetched lazily on the next lookup. + */ @Override - public void invalid(String database, final String tableName) { - database = PathUtils.unQualifyDatabaseName(database); + public void invalidateAll() { readWriteLock.writeLock().lock(); try { - if (databaseTableMap.containsKey(database)) { - databaseTableMap.get(database).remove(tableName); - } - if (preUpdateTableMap.containsKey(database)) { - preUpdateTableMap.get(database).remove(tableName); - } + databaseTableMap.clear(); + specialStatusMap.clear(); instanceVersion.incrementAndGet(); } finally { readWriteLock.writeLock().unlock(); @@ -318,9 +394,9 @@ public void invalid(String database, final String tableName, final String column copyTable.removeColumnSchema(columnName); databaseTableMap.get(database).put(tableName, copyTable); } - if (preUpdateTableMap.containsKey(database) - && preUpdateTableMap.get(database).containsKey(tableName)) { - final Pair tableVersionPair = preUpdateTableMap.get(database).get(tableName); + if (specialStatusMap.containsKey(database) + && specialStatusMap.get(database).containsKey(tableName)) { + final Pair tableVersionPair = specialStatusMap.get(database).get(tableName); if (Objects.nonNull(tableVersionPair.getLeft())) { final TsTable copyTable = new TsTable(tableVersionPair.getLeft()); copyTable.removeColumnSchema(columnName); @@ -338,25 +414,36 @@ public long getInstanceVersion() { return instanceVersion.get(); } + @Override public TsTable getTableInWrite(final String database, final String tableName) { final TsTable result = getTableInCache(database, tableName); return Objects.nonNull(result) ? result : getTable(database, tableName, false); } + @Override public TsTable getTable(final String database, final String tableName) { return getTable(database, tableName, true); } /** * The following logic can handle the cases when configNode failed to clear some table in {@link - * #preUpdateTableMap}, due to the failure of "commit" or rollback of "pre-update". + * #specialStatusMap}, due to the failure of "commit" or rollback of "pre-update". */ + @Override public TsTable getTable(String database, final String tableName, final boolean force) { database = PathUtils.unQualifyDatabaseName(database); - final Map> preUpdateTables = - mayGetTableInPreUpdateMap(database, tableName); - if (Objects.nonNull(preUpdateTables) && !preUpdateTables.isEmpty()) { - updateTable(getTablesInConfigNode(preUpdateTables), preUpdateTables); + final AtomicReference tableStatusRef = new AtomicReference<>(); + final Map> specialStatusMap = + mayGetTableInSpecialStatusMap(database, tableName, tableStatusRef); + + if (Objects.nonNull(specialStatusMap) && !specialStatusMap.isEmpty()) { + Map> fetchedTables = + getTablesInConfigNode(specialStatusMap, tableStatusRef.get()); + if (tableStatusRef.get() == TableNodeStatus.USING) { + updateUsingTable(fetchedTables, specialStatusMap); + } else { + updateDeleteTable(fetchedTables, database, tableName); + } } final TsTable table = getTableInCache(database, tableName); if (Objects.isNull(table) && force) { @@ -365,39 +452,58 @@ public TsTable getTable(String database, final String tableName, final boolean f return table; } - private Map> mayGetTableInPreUpdateMap( - final String database, final String tableName) { + private Map> mayGetTableInSpecialStatusMap( + final String database, + final String tableName, + final AtomicReference tableNodeStatus) { readWriteLock.readLock().lock(); try { - return preUpdateTableMap.containsKey(database) - && preUpdateTableMap.get(database).containsKey(tableName) - && Objects.nonNull(preUpdateTableMap.get(database).get(tableName).getLeft()) - ? preUpdateTableMap.entrySet().stream() - .filter( - entry -> { - entry - .getValue() - .entrySet() - .removeIf(tableEntry -> Objects.isNull(tableEntry.getValue().getLeft())); - return !entry.getValue().isEmpty(); - }) - .collect( - Collectors.toMap( - Map.Entry::getKey, - entry -> - entry.getValue().entrySet().stream() - .collect( - Collectors.toMap( - Map.Entry::getKey, - innerEntry -> innerEntry.getValue().getRight())))) - : null; + failIfMetadataLeaseFenced(); + final Map> targetDatabaseMap = specialStatusMap.get(database); + if (Objects.isNull(targetDatabaseMap)) { + return null; + } + + final Pair targetTablePair = targetDatabaseMap.get(tableName); + if (Objects.isNull(targetTablePair) || Objects.isNull(targetTablePair.getLeft())) { + return null; + } + final boolean targetIsPreDelete = targetTablePair.getLeft() instanceof PreDeleteTsTable; + final Map> result = new HashMap<>(); + for (final Map.Entry>> databaseEntry : + specialStatusMap.entrySet()) { + final Map tableVersionMap = + getSpecificStatusTable(databaseEntry, targetIsPreDelete); + if (!tableVersionMap.isEmpty()) { + result.put(databaseEntry.getKey(), tableVersionMap); + } + } + tableNodeStatus.set(targetIsPreDelete ? TableNodeStatus.PRE_DELETE : TableNodeStatus.USING); + return result; } finally { readWriteLock.readLock().unlock(); } } + private Map getSpecificStatusTable( + Map.Entry>> databaseEntry, + boolean targetIsPreDelete) { + final Map tableVersionMap = new HashMap<>(); + for (final Map.Entry> tableEntry : + databaseEntry.getValue().entrySet()) { + final TsTable candidate = tableEntry.getValue().getLeft(); + if (Objects.isNull(candidate)) { + continue; + } + if ((candidate instanceof PreDeleteTsTable) == targetIsPreDelete) { + tableVersionMap.put(tableEntry.getKey(), tableEntry.getValue().getRight()); + } + } + return tableVersionMap; + } + private Map> getTablesInConfigNode( - final Map> tableInput) { + final Map> tableInput, final TableNodeStatus tableNodeStatus) { Map> result = Collections.emptyMap(); boolean acquired = false; try { @@ -408,7 +514,8 @@ private Map> getTablesInConfigNode( .fetchTables( tableInput.entrySet().stream() .collect( - Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().keySet()))); + Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().keySet())), + tableNodeStatus); if (TSStatusCode.SUCCESS_STATUS.getStatusCode() == resp.getStatus().getCode()) { result = TsTableInternalRPCUtil.deserializeTsTableFetchResult(resp.getTableInfoMap()); } @@ -423,20 +530,21 @@ private Map> getTablesInConfigNode( return result; } - private void updateTable( + private void updateUsingTable( final Map> fetchedTables, final Map> previousVersions) { readWriteLock.writeLock().lock(); try { + failIfMetadataLeaseFenced(); final AtomicBoolean isUpdated = new AtomicBoolean(false); fetchedTables.forEach( (qualifiedDatabase, tableInfoMap) -> { final String database = PathUtils.unQualifyDatabaseName(qualifiedDatabase); - if (preUpdateTableMap.containsKey(database)) { + if (specialStatusMap.containsKey(database)) { tableInfoMap.forEach( (tableName, tsTable) -> { final Pair existingPair = - preUpdateTableMap.get(database).get(tableName); + specialStatusMap.get(database).get(tableName); if (Objects.isNull(existingPair) || Objects.isNull(existingPair.getLeft()) || !Objects.equals( @@ -478,6 +586,76 @@ private void updateTable( } } + /** fetch the pre delete table to update */ + private void updateDeleteTable( + Map> fetchedTables, + String targetDatabase, + final String targetTable) { + readWriteLock.writeLock().lock(); + try { + failIfMetadataLeaseFenced(); + boolean isUpdated = false; + boolean targetTableIsStillDeleting = false; + + for (final Map.Entry> databaseEntry : fetchedTables.entrySet()) { + final String currentDatabase = PathUtils.unQualifyDatabaseName(databaseEntry.getKey()); + + final Map> existingDatabaseMap = + this.specialStatusMap.get(currentDatabase); + if (Objects.isNull(existingDatabaseMap)) { + continue; + } + for (final Map.Entry tableEntry : databaseEntry.getValue().entrySet()) { + final String currentTableName = tableEntry.getKey(); + + final Pair existingPair = existingDatabaseMap.get(currentTableName); + if (Objects.isNull(existingPair) + || Objects.isNull(existingPair.getLeft()) + || !(existingPair.getLeft() instanceof PreDeleteTsTable)) { + continue; + } + + final TsTable fetchedTable = tableEntry.getValue(); + // case 1. the table is still in the pre delete status, do not update + // and only remind user of it + // the CN may be still in drop table procedure or has finished the procedure with error + if (fetchedTable instanceof PreDeleteTsTable) { + if (targetDatabase.equals(currentDatabase) && targetTable.equals(currentTableName)) { + targetTableIsStillDeleting = true; + } + continue; + } + + isUpdated = true; + // case 2. the TsTable is normal TsTable, means that the drop table procedure rollback + // recovery it in databaseTableMap + if (Objects.nonNull(fetchedTable)) { + databaseTableMap + .computeIfAbsent(currentDatabase, k -> new ConcurrentHashMap<>()) + .put(currentTableName, fetchedTable); + } else if (databaseTableMap.containsKey(currentDatabase)) { + // case 3. the CN do not hold the table, means that the table has been deleted + databaseTableMap.get(currentDatabase).remove(currentTableName); + } + // case 2 and case 3, remove table from specialStatusMap + existingPair.setLeft(null); + } + } + if (isUpdated) { + instanceVersion.incrementAndGet(); + } + if (targetTableIsStillDeleting) { + throw new SemanticException( + String.format( + DataNodeSchemaMessages.THE_TABLE_IS_IN_PRE_DELETE_STATE, + targetDatabase, + targetTable)); + } + } finally { + readWriteLock.writeLock().unlock(); + } + } + private String compareTable(final TsTable oldTable, final TsTable newTable) { if (Objects.isNull(oldTable)) { return DataNodeSchemaMessages.COMPARE_TABLE_ADDED + newTable; @@ -559,6 +737,7 @@ private String compareTable(final TsTable oldTable, final TsTable newTable) { private TsTable getTableInCache(final String database, final String tableName) { readWriteLock.readLock().lock(); try { + failIfMetadataLeaseFenced(); final TsTable result = databaseTableMap.containsKey(database) ? databaseTableMap.get(database).get(tableName) @@ -572,13 +751,16 @@ private TsTable getTableInCache(final String database, final String tableName) { } public boolean isDatabaseExist(final String database) { + failIfMetadataLeaseFenced(); if (databaseTableMap.containsKey(database)) { return true; } - if (getTablesInConfigNode(Collections.singletonMap(database, Collections.emptyMap())) + if (getTablesInConfigNode( + Collections.singletonMap(database, Collections.emptyMap()), TableNodeStatus.USING) .containsKey(database)) { readWriteLock.readLock().lock(); try { + failIfMetadataLeaseFenced(); databaseTableMap.computeIfAbsent(database, k -> new ConcurrentHashMap<>()); return true; } finally { @@ -589,6 +771,7 @@ public boolean isDatabaseExist(final String database) { } // Database shall not start with "root" + @Override public String tryGetInternColumnName( final @Nonnull String database, final @Nonnull String tableName, diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/table/ITableCache.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/table/ITableCache.java index 694be6f3b2adb..63763553981e3 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/table/ITableCache.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/table/ITableCache.java @@ -21,6 +21,7 @@ import org.apache.iotdb.commons.schema.table.TsTable; +import javax.annotation.Nonnull; import javax.annotation.Nullable; public interface ITableCache { @@ -40,7 +41,22 @@ void commitUpdateTable( */ void invalid(final String database); - void invalid(final String database, final String tableName); - void invalid(final String database, final String tableName, final String columnName); + + void invalidateAll(); + + TsTable getTableInWrite(final String database, final String tableName); + + TsTable getTable(final String database, final String tableName); + + TsTable getTable(String database, final String tableName, final boolean force); + + String tryGetInternColumnName( + final @Nonnull String database, + final @Nonnull String tableName, + final @Nonnull String columnName); + + boolean isDatabaseExist(final String database); + + void reloadTableCacheAfterLeaseRecovery(); } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/DataNodeMetricsHelper.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/DataNodeMetricsHelper.java index 2183d6ac8812b..e2204e8cf0b57 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/DataNodeMetricsHelper.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/DataNodeMetricsHelper.java @@ -108,6 +108,9 @@ public static void bind() { // bind memory related metrics metricService.addMetricSet(GlobalMemoryMetrics.getInstance()); + + // bind metadata lease (ConfigNode heartbeat freshness) metrics + metricService.addMetricSet(new MetadataLeaseMetrics()); } private static void initSystemMetrics(MetricService metricService) { diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/MetadataLeaseMetrics.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/MetadataLeaseMetrics.java new file mode 100644 index 0000000000000..99b33befc9acf --- /dev/null +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/metrics/MetadataLeaseMetrics.java @@ -0,0 +1,50 @@ +/* + * 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.iotdb.db.service.metrics; + +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseManager; +import org.apache.iotdb.metrics.AbstractMetricService; +import org.apache.iotdb.metrics.metricsets.IMetricSet; +import org.apache.iotdb.metrics.utils.MetricLevel; +import org.apache.iotdb.metrics.utils.MetricType; + +/** + * Exposes the DataNode's metadata-lease state for observability: how long it has been since the + * last ConfigNode heartbeat was received. A value approaching {@code metadata_lease_fence_ms} + * indicates the DataNode is about to (or has) self-fenced its ConfigNode-pushed metadata caches. + */ +public class MetadataLeaseMetrics implements IMetricSet { + + private static final String METADATA_LEASE_HEARTBEAT_AGE_MS = "metadata_lease_heartbeat_age_ms"; + + @Override + public void bindTo(final AbstractMetricService metricService) { + metricService.createAutoGauge( + METADATA_LEASE_HEARTBEAT_AGE_MS, + MetricLevel.IMPORTANT, + MetadataLeaseManager.getInstance(), + MetadataLeaseManager::getMillisSinceLastConfigNodeHeartbeat); + } + + @Override + public void unbindFrom(final AbstractMetricService metricService) { + metricService.remove(MetricType.AUTO_GAUGE, METADATA_LEASE_HEARTBEAT_AGE_MS); + } +} diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/MultiTsFileDeviceIterator.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/MultiTsFileDeviceIterator.java index a639fba299cb9..3ce86271968f5 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/MultiTsFileDeviceIterator.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/execute/utils/MultiTsFileDeviceIterator.java @@ -28,6 +28,7 @@ import org.apache.iotdb.commons.schema.table.column.TsTableColumnSchema; import org.apache.iotdb.commons.utils.CommonDateTimeUtils; import org.apache.iotdb.db.queryengine.plan.analyze.cache.schema.DataNodeTTLCache; +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseManager; import org.apache.iotdb.db.schemaengine.table.DataNodeTableCache; import org.apache.iotdb.db.storageengine.dataregion.compaction.io.CompactionTsFileReader; import org.apache.iotdb.db.storageengine.dataregion.compaction.schedule.constant.CompactionType; @@ -236,7 +237,15 @@ public Pair nextDevice() throws IllegalPathException, IOExce IDeviceID deviceID = currentDevice.left; boolean isAligned = currentDevice.right; ignoreAllNullRows = !isAligned || deviceID.getTableName().startsWith("root."); - if (!ignoreAllNullRows) { + if (MetadataLeaseManager.getInstance().isFenced()) { + // Metadata lease fenced: this DataNode may hold a stale TTL (it could have missed a + // ConfigNode + // TTL update while partitioned). A too-short stale TTL would make compaction permanently + // delete data that a missed TTL-increase says to keep, so use an infinite TTL: compaction + // deletes nothing by TTL while fenced, and real TTL deletion resumes once the lease recovers + // and the cache resyncs. (Checked first so the table path also avoids the fenced cache.) + ttlForCurrentDevice = Long.MAX_VALUE; + } else if (!ignoreAllNullRows) { ttlForCurrentDevice = DataNodeTTLCache.getInstance().getTTLForTable(databaseName, deviceID.getTableName()); } else { diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcherLeaseTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcherLeaseTest.java new file mode 100644 index 0000000000000..a166ccdcacbe1 --- /dev/null +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcherLeaseTest.java @@ -0,0 +1,103 @@ +/* + * 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.iotdb.db.auth; + +import org.apache.iotdb.commons.auth.entity.User; +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseManager; +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseTestUtils; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import static org.apache.iotdb.db.schemaengine.lease.MetadataLeaseTestUtils.T_FENCE_MS; + +public class ClusterAuthorityFetcherLeaseTest { + + private TestClock clock; + private MetadataLeaseManager leaseManager; + + @Before + public void setUp() { + clock = new TestClock(); + leaseManager = MetadataLeaseTestUtils.newManager(clock::nowNanos); + } + + @Test + public void fencedLeaseDropsPermissionCache() { + final ClusterAuthorityFetcher fetcher = + new TestingClusterAuthorityFetcher(new BasicAuthorityCache(), leaseManager); + final User user = new User("user_fenced", "password"); + fetcher.getAuthorCache().putUserCache(user.getName(), user); + Assert.assertNotNull(fetcher.getAuthorCache().getUserCache(user.getName())); + + clock.addMillis(T_FENCE_MS + 1); + fetcher.checkCacheAvailable(); + + Assert.assertNull( + "a fenced DataNode must drop its permission cache so a missed REVOKE cannot keep authorizing", + fetcher.getAuthorCache().getUserCache(user.getName())); + } + + @Test + public void activeLeaseKeepsPermissionCache() { + final ClusterAuthorityFetcher fetcher = + new TestingClusterAuthorityFetcher(new BasicAuthorityCache(), leaseManager); + final User user = new User("user_active", "password"); + fetcher.getAuthorCache().putUserCache(user.getName(), user); + + // An active lease (a ConfigNode heartbeat was just received) must not needlessly drop the + // cache. + clock.addMillis(1_000L); + fetcher.checkCacheAvailable(); + + Assert.assertNotNull( + "an active lease must not needlessly drop the permission cache", + fetcher.getAuthorCache().getUserCache(user.getName())); + } + + private static class TestClock { + private long nowNanos = 100_000_000_000L; + + private long nowNanos() { + return nowNanos; + } + + private void addMillis(final long millis) { + nowNanos += millis * 1_000_000L; + } + } + + private static class TestingClusterAuthorityFetcher extends ClusterAuthorityFetcher { + + private final MetadataLeaseManager leaseManager; + + private TestingClusterAuthorityFetcher( + final IAuthorCache authorCache, final MetadataLeaseManager leaseManager) { + super(authorCache); + this.leaseManager = leaseManager; + } + + @Override + boolean isMetadataLeaseFenced() { + return leaseManager.isFenced(); + } + } +} diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/PartitionCacheLeaseTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/PartitionCacheLeaseTest.java new file mode 100644 index 0000000000000..fbfcaa58a2492 --- /dev/null +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/analyze/cache/PartitionCacheLeaseTest.java @@ -0,0 +1,129 @@ +/* + * 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.iotdb.db.queryengine.plan.analyze.cache; + +import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId; +import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType; +import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot; +import org.apache.iotdb.commons.exception.MetadataLeaseFencedException; +import org.apache.iotdb.commons.partition.DataPartitionQueryParam; +import org.apache.iotdb.db.auth.AuthorityChecker; +import org.apache.iotdb.db.queryengine.plan.analyze.cache.partition.PartitionCache; +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseManager; +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseTestUtils; +import org.apache.iotdb.rpc.TSStatusCode; + +import org.apache.tsfile.file.metadata.IDeviceID; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; + +import static org.apache.iotdb.db.schemaengine.lease.MetadataLeaseTestUtils.T_FENCE_MS; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; + +public class PartitionCacheLeaseTest { + + private final AtomicLong nowNanos = new AtomicLong(100_000_000_000L); + + private MetadataLeaseManager leaseManager; + private PartitionCache partitionCache; + private IDeviceID deviceID; + private TConsensusGroupId consensusGroupId; + + @Before + public void setUp() { + nowNanos.set(100_000_000_000L); + leaseManager = MetadataLeaseTestUtils.newManager(nowNanos); + partitionCache = new TestingPartitionCache(leaseManager); + deviceID = IDeviceID.Factory.DEFAULT_FACTORY.create("root.sg.d1"); + consensusGroupId = new TConsensusGroupId(TConsensusGroupType.DataRegion, 1); + } + + @After + public void tearDown() { + partitionCache.invalidAllCache(); + } + + @Test + public void fencedLeaseFailsClosedForPartitionCache() { + nowNanos.addAndGet((T_FENCE_MS + 1) * 1_000_000L); + + assertLeaseFenced( + () -> + partitionCache.getDatabaseToDevice( + Collections.singletonList(deviceID), false, false, AuthorityChecker.SUPER_USER)); + assertLeaseFenced( + () -> + partitionCache.getDeviceToDatabase( + Collections.singletonList(deviceID), false, false, AuthorityChecker.SUPER_USER)); + assertLeaseFenced( + () -> + partitionCache.checkAndAutoCreateDatabase( + "root.sg", false, AuthorityChecker.SUPER_USER)); + assertLeaseFenced( + () -> partitionCache.getRegionReplicaSet(Collections.singletonList(consensusGroupId))); + assertLeaseFenced(() -> partitionCache.getSchemaPartition(databaseToDeviceMap())); + assertLeaseFenced(() -> partitionCache.getSchemaPartition("root.sg")); + assertLeaseFenced(() -> partitionCache.getDataPartition(dataQueryMap())); + } + + private static void assertLeaseFenced(final Runnable runnable) { + final MetadataLeaseFencedException e = + assertThrows(MetadataLeaseFencedException.class, runnable::run); + assertEquals(TSStatusCode.METADATA_LEASE_FENCED.getStatusCode(), e.getErrorCode()); + } + + private Map> databaseToDeviceMap() { + final Map> map = new HashMap<>(); + map.put("root.sg", Collections.singletonList(deviceID)); + return map; + } + + private Map> dataQueryMap() { + final DataPartitionQueryParam param = new DataPartitionQueryParam(); + param.setDeviceID(deviceID); + param.setTimePartitionSlotList(Collections.singletonList(new TTimePartitionSlot(0))); + + final Map> map = new HashMap<>(); + map.put("root.sg", Collections.singletonList(param)); + return map; + } + + private static class TestingPartitionCache extends PartitionCache { + + private final MetadataLeaseManager leaseManager; + + private TestingPartitionCache(final MetadataLeaseManager leaseManager) { + this.leaseManager = leaseManager; + } + + @Override + protected void failIfMetadataLeaseFenced() { + MetadataLeaseTestUtils.failIfMetadataLeaseFenced(leaseManager); + } + } +} diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceSchemaCacheManagerLeaseTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceSchemaCacheManagerLeaseTest.java new file mode 100644 index 0000000000000..df689c257d414 --- /dev/null +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceSchemaCacheManagerLeaseTest.java @@ -0,0 +1,119 @@ +/* + * 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.iotdb.db.queryengine.plan.relational.metadata.fetcher.cache; + +import org.apache.iotdb.commons.exception.IllegalPathException; +import org.apache.iotdb.commons.exception.MetadataLeaseFencedException; +import org.apache.iotdb.commons.path.MeasurementPath; +import org.apache.iotdb.commons.path.PartialPath; +import org.apache.iotdb.db.queryengine.common.schematree.ClusterSchemaTree; +import org.apache.iotdb.db.queryengine.plan.analyze.schema.ISchemaComputation; +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseManager; +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseTestUtils; +import org.apache.iotdb.rpc.TSStatusCode; + +import org.apache.tsfile.enums.TSDataType; +import org.apache.tsfile.write.schema.MeasurementSchema; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; + +import java.util.Collections; +import java.util.concurrent.atomic.AtomicLong; + +import static org.apache.iotdb.db.schemaengine.lease.MetadataLeaseTestUtils.T_FENCE_MS; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; + +public class TreeDeviceSchemaCacheManagerLeaseTest { + + private final AtomicLong nowNanos = new AtomicLong(100_000_000_000L); + + private MetadataLeaseManager leaseManager; + private TreeDeviceSchemaCacheManager manager; + + @Before + public void setUp() throws IllegalPathException { + nowNanos.set(100_000_000_000L); + leaseManager = MetadataLeaseTestUtils.newManager(nowNanos); + manager = new TestingTreeDeviceSchemaCacheManager(leaseManager); + manager.cleanUp(); + + final ClusterSchemaTree tree = new ClusterSchemaTree(); + tree.appendSingleMeasurement( + new PartialPath("root.sg1.d1.s1"), + new MeasurementSchema("s1", TSDataType.INT32), + null, + null, + null, + false); + tree.setDatabases(Collections.singleton("root.sg1")); + manager.put(tree); + } + + @After + public void tearDown() { + manager.cleanUp(); + } + + @Test + public void fencedLeaseFailsClosedForTreeSchemaCache() throws IllegalPathException { + final PartialPath device1 = new PartialPath("root.sg1.d1"); + final String[] measurements = new String[] {"s1"}; + + nowNanos.addAndGet((T_FENCE_MS + 1) * 1_000_000L); + assertLeaseFenced(() -> manager.get(device1, measurements)); + assertLeaseFenced( + () -> { + try { + manager.getMatchedNormalSchema(new MeasurementPath("root.sg1.d1.s1")); + } catch (IllegalPathException e) { + throw new RuntimeException(e); + } + }); + assertLeaseFenced(() -> manager.getMatchedTemplateSchema(device1)); + assertLeaseFenced(() -> manager.computeWithoutTemplate(Mockito.mock(ISchemaComputation.class))); + assertLeaseFenced(() -> manager.computeWithTemplate(Mockito.mock(ISchemaComputation.class))); + final ISchemaComputation logicalViewComputation = Mockito.mock(ISchemaComputation.class); + Mockito.when(logicalViewComputation.hasLogicalViewNeedProcess()).thenReturn(true); + assertLeaseFenced(() -> manager.computeSourceOfLogicalView(logicalViewComputation)); + } + + private static void assertLeaseFenced(final Runnable runnable) { + final MetadataLeaseFencedException e = + assertThrows(MetadataLeaseFencedException.class, runnable::run); + assertEquals(TSStatusCode.METADATA_LEASE_FENCED.getStatusCode(), e.getErrorCode()); + } + + private static class TestingTreeDeviceSchemaCacheManager extends TreeDeviceSchemaCacheManager { + + private final MetadataLeaseManager leaseManager; + + private TestingTreeDeviceSchemaCacheManager(final MetadataLeaseManager leaseManager) { + this.leaseManager = leaseManager; + } + + @Override + void failIfMetadataLeaseFenced() { + MetadataLeaseTestUtils.failIfMetadataLeaseFenced(leaseManager); + } + } +} diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManagerTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManagerTest.java new file mode 100644 index 0000000000000..9ea9c580bd6b5 --- /dev/null +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManagerTest.java @@ -0,0 +1,111 @@ +/* + * 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.iotdb.db.schemaengine.lease; + +import org.junit.Test; + +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicLong; + +import static org.apache.iotdb.db.schemaengine.lease.MetadataLeaseTestUtils.T_FENCE_MS; +import static org.apache.iotdb.db.schemaengine.lease.MetadataLeaseTestUtils.newManager; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class MetadataLeaseManagerTest { + + @Test + public void isNotFencedWithinLease() { + final AtomicLong nowNanos = new AtomicLong(TimeUnit.SECONDS.toNanos(100)); + final MetadataLeaseManager manager = newManager(nowNanos, () -> {}, () -> {}); + + nowNanos.addAndGet(TimeUnit.MILLISECONDS.toNanos(1234)); + + assertFalse(manager.isFenced()); + assertEquals(1234L, manager.getMillisSinceLastConfigNodeHeartbeat()); + } + + @Test + public void recoversAfterHeartbeatWhenLeaseExpired() { + final AtomicLong nowNanos = new AtomicLong(TimeUnit.SECONDS.toNanos(100)); + final MetadataLeaseManager manager = newManager(nowNanos, () -> {}, () -> {}); + + nowNanos.addAndGet(TimeUnit.MILLISECONDS.toNanos(T_FENCE_MS + 1)); + assertTrue(manager.isFenced()); + + manager.recoveryLeaseForTest(true); + + assertFalse(manager.isFenced()); + } + + @Test + public void retriesCacheClearInHeartbeatWorkerAfterFailure() { + final AtomicLong nowNanos = new AtomicLong(TimeUnit.SECONDS.toNanos(100)); + final AtomicInteger clearAttempts = new AtomicInteger(); + final MetadataLeaseManager manager = + newManager( + nowNanos, + () -> { + if (clearAttempts.getAndIncrement() == 0) { + throw new RuntimeException("mock clear cache failure"); + } + }, + () -> {}); + + nowNanos.addAndGet(TimeUnit.MILLISECONDS.toNanos(T_FENCE_MS + 1)); + assertTrue(manager.isFenced()); + assertEquals(0, clearAttempts.get()); + + manager.triggerCheckWithHeartBeat(); + assertTrue(manager.isFenced()); + assertEquals(1, clearAttempts.get()); + + manager.triggerCheckWithHeartBeat(); + assertFalse(manager.isFenced()); + assertEquals(2, clearAttempts.get()); + } + + @Test + public void retriesMetadataPullAfterFailure() { + final AtomicLong nowNanos = new AtomicLong(TimeUnit.SECONDS.toNanos(100)); + final AtomicInteger pullAttempts = new AtomicInteger(); + final MetadataLeaseManager manager = + newManager( + nowNanos, + () -> {}, + () -> { + if (pullAttempts.getAndIncrement() == 0) { + throw new RuntimeException("mock pull failure"); + } + }); + + nowNanos.addAndGet(TimeUnit.MILLISECONDS.toNanos(T_FENCE_MS + 1)); + assertTrue(manager.isFenced()); + + manager.triggerCheckWithHeartBeat(); + assertTrue(manager.isFenced()); + + manager.triggerCheckWithHeartBeat(); + assertFalse(manager.isFenced()); + assertEquals(2, pullAttempts.get()); + } +} diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseTestUtils.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseTestUtils.java new file mode 100644 index 0000000000000..1ae72821a77c3 --- /dev/null +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseTestUtils.java @@ -0,0 +1,69 @@ +/* + * 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.iotdb.db.schemaengine.lease; + +import org.apache.iotdb.commons.exception.MetadataLeaseFencedException; + +import com.google.common.util.concurrent.MoreExecutors; + +import java.util.Collections; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.LongSupplier; + +public final class MetadataLeaseTestUtils { + + public static final long T_FENCE_MS = 20_000L; + + private MetadataLeaseTestUtils() {} + + public static MetadataLeaseManager newManager(final AtomicLong nowNanos) { + return newManager(nowNanos::get); + } + + public static MetadataLeaseManager newManager(final LongSupplier nowNanos) { + return newManager(nowNanos, () -> {}, () -> {}); + } + + public static void failIfMetadataLeaseFenced(final MetadataLeaseManager manager) { + if (manager.isFenced()) { + throw new MetadataLeaseFencedException( + "Metadata lease is fenced. The local metadata cache is unavailable."); + } + } + + static MetadataLeaseManager newManager( + final AtomicLong nowNanos, + final MetadataLeaseManager.MetadataAction clearAction, + final MetadataLeaseManager.MetadataAction pullAction) { + return newManager(nowNanos::get, clearAction, pullAction); + } + + static MetadataLeaseManager newManager( + final LongSupplier nowNanos, + final MetadataLeaseManager.MetadataAction clearAction, + final MetadataLeaseManager.MetadataAction pullAction) { + return new MetadataLeaseManager( + nowNanos, + () -> T_FENCE_MS, + Collections.singletonList(clearAction), + Collections.singletonList(pullAction), + MoreExecutors.newDirectExecutorService()); + } +} diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCacheLeaseTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCacheLeaseTest.java new file mode 100644 index 0000000000000..8007581f9289c --- /dev/null +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCacheLeaseTest.java @@ -0,0 +1,89 @@ +/* + * 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.iotdb.db.schemaengine.table; + +import org.apache.iotdb.commons.exception.MetadataLeaseFencedException; +import org.apache.iotdb.commons.schema.table.TsTable; +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseManager; +import org.apache.iotdb.db.schemaengine.lease.MetadataLeaseTestUtils; +import org.apache.iotdb.rpc.TSStatusCode; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; + +import java.util.concurrent.atomic.AtomicLong; + +import static org.apache.iotdb.db.schemaengine.lease.MetadataLeaseTestUtils.T_FENCE_MS; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; + +public class DataNodeTableCacheLeaseTest { + + private final AtomicLong nowNanos = new AtomicLong(100_000_000_000L); + + private MetadataLeaseManager leaseManager; + private DataNodeTableCache tableCache; + + @Before + public void setUp() { + nowNanos.set(100_000_000_000L); + leaseManager = MetadataLeaseTestUtils.newManager(nowNanos); + tableCache = Mockito.spy((DataNodeTableCache) DataNodeTableCache.getInstance()); + tableCache.invalidateAll(); + Mockito.doAnswer( + invocation -> { + MetadataLeaseTestUtils.failIfMetadataLeaseFenced(leaseManager); + return null; + }) + .when(tableCache) + .failIfMetadataLeaseFenced(); + } + + @After + public void tearDown() { + tableCache.invalidateAll(); + } + + @Test + public void fencedLeaseFailsClosedForReadApis() { + nowNanos.addAndGet((T_FENCE_MS + 1) * 1_000_000L); + assertLeaseFenced(() -> tableCache.getTableInWrite("root.db", "t")); + assertLeaseFenced(() -> tableCache.getTable("root.db", "t", false)); + assertLeaseFenced(() -> tableCache.isDatabaseExist("root.db")); + } + + @Test + public void fencedLeaseFailsClosedForUpdateApis() { + final TsTable table = new TsTable("t"); + + nowNanos.addAndGet((T_FENCE_MS + 1) * 1_000_000L); + assertLeaseFenced(() -> tableCache.preUpdateTable("root.db", table, null)); + assertLeaseFenced(() -> tableCache.rollbackUpdateTable("root.db", "t", null)); + assertLeaseFenced(() -> tableCache.commitUpdateTable("root.db", "t", null)); + } + + private static void assertLeaseFenced(final Runnable runnable) { + final MetadataLeaseFencedException e = + assertThrows(MetadataLeaseFencedException.class, runnable::run); + assertEquals(TSStatusCode.METADATA_LEASE_FENCED.getStatusCode(), e.getErrorCode()); + } +} diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCacheTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCacheTest.java index 4b33991e3d7ed..a3baad292c78f 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCacheTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/table/DataNodeTableCacheTest.java @@ -39,7 +39,7 @@ public class DataNodeTableCacheTest { @Test public void interruptedFetchDoesNotLeakSemaphorePermit() throws Exception { - final DataNodeTableCache cache = DataNodeTableCache.getInstance(); + final ITableCache cache = DataNodeTableCache.getInstance(); cache.invalid(DATABASE); try { final Semaphore fetchTableSemaphore = getFetchTableSemaphore(cache); @@ -60,7 +60,7 @@ public void interruptedFetchDoesNotLeakSemaphorePermit() throws Exception { @Test public void commitUpdateTableIsIdempotent() { - final DataNodeTableCache cache = DataNodeTableCache.getInstance(); + final ITableCache cache = DataNodeTableCache.getInstance(); cache.invalid(TABLE_CACHE_TEST_DATABASE); try { cache.preUpdateTable(TABLE_CACHE_TEST_DATABASE, createTable(TABLE_NAME), null); @@ -77,7 +77,7 @@ public void commitUpdateTableIsIdempotent() { @Test public void commitAfterRollbackUpdateTableIsIgnored() { - final DataNodeTableCache cache = DataNodeTableCache.getInstance(); + final ITableCache cache = DataNodeTableCache.getInstance(); cache.invalid(TABLE_CACHE_TEST_DATABASE); try { cache.preUpdateTable(TABLE_CACHE_TEST_DATABASE, createTable(TABLE_NAME), null); @@ -91,7 +91,7 @@ public void commitAfterRollbackUpdateTableIsIgnored() { } } - private Semaphore getFetchTableSemaphore(final DataNodeTableCache cache) throws Exception { + private Semaphore getFetchTableSemaphore(final ITableCache cache) throws Exception { final Field field = DataNodeTableCache.class.getDeclaredField("fetchTableSemaphore"); field.setAccessible(true); return (Semaphore) field.get(cache); diff --git a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template index 64e35fddd75c2..2ec0b2e010fcf 100644 --- a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template +++ b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template @@ -752,6 +752,16 @@ failure_detector_phi_threshold=30 # Datatype: long failure_detector_phi_acceptable_pause_in_ms=10000 +# A DataNode self-fences its ConfigNode-pushed metadata caches (table/tree schema, templates, TTL, +# permissions, ...) if it has not received a ConfigNode heartbeat within this duration, so a +# partitioned DataNode stops trusting stale caches. Kept aligned with +# failure_detector_fixed_threshold_in_ms so a DataNode fences itself around the same time the +# cluster would consider it down. The ConfigNode also uses this to decide how long it must wait +# before treating an unreachable DataNode as safely fenced. +# effectiveMode: restart +# Datatype: long +metadata_lease_fence_ms=20000 + # Whether to enable topology probing between DataNodes # effectiveMode: hot_reload # Datatype: Boolean diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java index e9e01efd2d48b..0435fc1f5e85a 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java @@ -105,6 +105,7 @@ public enum ThreadName { CONFIG_NODE_TIMEOUT_EXECUTOR("ProcedureTimeoutExecutor"), CONFIG_NODE_WORKER_THREAD_MONITOR("ProcedureWorkerThreadMonitor"), CONFIG_NODE_RETRY_FAILED_TASK("Cluster-RetryFailedTasks-Service"), + RELOAD_TABLE_METADATA_CACHE("Reload-table-metadata-cache"), // -------------------------- IoTConsensusV2 -------------------------- IOT_CONSENSUS_V2_RPC_SERVICE("IoTConsensusV2RPC-Service"), IOT_CONSENSUS_V2_RPC_PROCESSOR("IoTConsensusV2RPC-Processor"), @@ -383,7 +384,8 @@ public enum ThreadName { CONFIG_NODE_PROCEDURE_WORKER, CONFIG_NODE_WORKER_THREAD_MONITOR, CONFIG_NODE_TIMEOUT_EXECUTOR, - CONFIG_NODE_RETRY_FAILED_TASK)); + CONFIG_NODE_RETRY_FAILED_TASK, + RELOAD_TABLE_METADATA_CACHE)); private static final Set metricsThreadNames = new HashSet<>( diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java index 257b2a8ad5176..8442937bbb75d 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java @@ -477,6 +477,13 @@ public class CommonConfig { private volatile long remoteWriteMaxRetryDurationInMs = 60000; + // The DataNode self-fences its ConfigNode-pushed metadata caches (table/tree schema, template, + // TTL, permission, ...) if it has not received a ConfigNode heartbeat within this duration. Kept + // aligned with the failure detector threshold so a partitioned DataNode stops trusting stale + // caches around the same time the cluster would consider it dead. Also used by the ConfigNode to + // derive how long it must wait before treating an unreachable DataNode as safely fenced. + private volatile long metadataLeaseFenceMs = 20_000; + private final RateLimiter querySamplingRateLimiter = RateLimiter.create(160); // if querySamplingRateLimiter < 0, means that there is no rate limit, we need to full sample all // the queries @@ -2907,6 +2914,14 @@ public void setRemoteWriteMaxRetryDurationInMs(long remoteWriteMaxRetryDurationI this.remoteWriteMaxRetryDurationInMs = remoteWriteMaxRetryDurationInMs; } + public long getMetadataLeaseFenceMs() { + return metadataLeaseFenceMs; + } + + public void setMetadataLeaseFenceMs(long metadataLeaseFenceMs) { + this.metadataLeaseFenceMs = metadataLeaseFenceMs; + } + public int getArenaNum() { return arenaNum; } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java index 9d7c6bdffc26b..dba01c67bd25b 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java @@ -340,6 +340,11 @@ public void loadCommonProps(TrimProperties properties) throws IOException { properties.getProperty( "path_log_max_size", String.valueOf(config.getPathLogMaxSize())))); + config.setMetadataLeaseFenceMs( + Long.parseLong( + properties.getProperty( + "metadata_lease_fence_ms", String.valueOf(config.getMetadataLeaseFenceMs())))); + loadRetryProperties(properties); loadBinaryAllocatorProps(properties); } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/exception/MetadataLeaseFencedException.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/exception/MetadataLeaseFencedException.java new file mode 100644 index 0000000000000..b87f76bb18f12 --- /dev/null +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/exception/MetadataLeaseFencedException.java @@ -0,0 +1,33 @@ +/* + * 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.iotdb.commons.exception; + +import org.apache.iotdb.rpc.TSStatusCode; + +public class MetadataLeaseFencedException extends IoTDBRuntimeException { + + public MetadataLeaseFencedException(String message) { + super(message, TSStatusCode.METADATA_LEASE_FENCED.getStatusCode()); + } + + public MetadataLeaseFencedException(Throwable cause) { + super(cause, TSStatusCode.METADATA_LEASE_FENCED.getStatusCode()); + } +} diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/NonCommittableTsTable.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/NonCommittableTsTable.java index 5f22c86474f3c..71989fa54ac57 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/NonCommittableTsTable.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/NonCommittableTsTable.java @@ -31,6 +31,8 @@ * version. */ public class NonCommittableTsTable extends TsTable { + public static final int NON_COMMITTABLE_MARKER = -1; + public NonCommittableTsTable(final String tableName) { super(tableName); } @@ -38,6 +40,6 @@ public NonCommittableTsTable(final String tableName) { @Override public void serialize(final OutputStream stream) throws IOException { ReadWriteIOUtils.write(tableName, stream); - ReadWriteIOUtils.write(-1, stream); + ReadWriteIOUtils.write(NON_COMMITTABLE_MARKER, stream); } } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/PreDeleteTsTable.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/PreDeleteTsTable.java new file mode 100644 index 0000000000000..2ed1aeff3506b --- /dev/null +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/PreDeleteTsTable.java @@ -0,0 +1,39 @@ +/* + * 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.iotdb.commons.schema.table; + +import org.apache.tsfile.utils.ReadWriteIOUtils; + +import java.io.IOException; +import java.io.OutputStream; + +public class PreDeleteTsTable extends TsTable { + public static final int PRE_DELETE_MARKER = -2; + + public PreDeleteTsTable(final String tableName) { + super(tableName); + } + + @Override + public void serialize(final OutputStream stream) throws IOException { + ReadWriteIOUtils.write(tableName, stream); + ReadWriteIOUtils.write(PRE_DELETE_MARKER, stream); + } +} diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TableNodeStatus.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TableNodeStatus.java index 33aad560c0f45..48c85a4081b91 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TableNodeStatus.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TableNodeStatus.java @@ -39,6 +39,10 @@ public enum TableNodeStatus { this.status = status; } + public byte getStatus() { + return status; + } + public void serialize(final OutputStream outputStream) throws IOException { ReadWriteIOUtils.write(status, outputStream); } @@ -57,7 +61,11 @@ public static TableNodeStatus deserialize(final InputStream inputStream) throws } public static TableNodeStatus deserialize(final ByteBuffer buffer) { - switch (ReadWriteIOUtils.readByte(buffer)) { + return deserialize(ReadWriteIOUtils.readByte(buffer)); + } + + public static TableNodeStatus deserialize(final byte status) { + switch (status) { case 0: return PRE_CREATE; case 1: diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TsTable.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TsTable.java index 833c37a59407f..3546413b10324 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TsTable.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/schema/table/TsTable.java @@ -391,9 +391,12 @@ public void serialize(final OutputStream stream) throws IOException { public static TsTable deserialize(final InputStream inputStream) throws IOException { final String name = ReadWriteIOUtils.readString(inputStream); final int columnNum = ReadWriteIOUtils.readInt(inputStream); - if (columnNum < 0) { + if (columnNum == NonCommittableTsTable.NON_COMMITTABLE_MARKER) { return new NonCommittableTsTable(name); } + if (columnNum == PreDeleteTsTable.PRE_DELETE_MARKER) { + return new PreDeleteTsTable(name); + } final TsTable table = new TsTable(name); for (int i = 0; i < columnNum; i++) { table.addColumnSchema(TsTableColumnSchemaUtil.deserialize(inputStream)); @@ -405,9 +408,12 @@ public static TsTable deserialize(final InputStream inputStream) throws IOExcept public static TsTable deserialize(final ByteBuffer buffer) { final String name = ReadWriteIOUtils.readString(buffer); final int columnNum = ReadWriteIOUtils.readInt(buffer); - if (columnNum < 0) { + if (columnNum == NonCommittableTsTable.NON_COMMITTABLE_MARKER) { return new NonCommittableTsTable(name); } + if (columnNum == PreDeleteTsTable.PRE_DELETE_MARKER) { + return new PreDeleteTsTable(name); + } final TsTable table = new TsTable(name); for (int i = 0; i < columnNum; i++) { table.addColumnSchema(TsTableColumnSchemaUtil.deserialize(buffer)); diff --git a/iotdb-protocol/thrift-confignode/src/main/thrift/confignode.thrift b/iotdb-protocol/thrift-confignode/src/main/thrift/confignode.thrift index a414584f80ec9..4b0b995c16778 100644 --- a/iotdb-protocol/thrift-confignode/src/main/thrift/confignode.thrift +++ b/iotdb-protocol/thrift-confignode/src/main/thrift/confignode.thrift @@ -159,6 +159,11 @@ struct TDataNodeRestartResp { 4: optional list correctConsensusGroups } +struct TDataNodeLeaseRecoveryResp{ + 1: required common.TSStatus status + 2: optional binary tableInfo +} + struct TDataNodeRemoveReq { 1: required list dataNodeLocations } @@ -1343,6 +1348,11 @@ service IConfigNodeRPCService { TDataNodeRestartResp restartDataNode(TDataNodeRestartReq req) + /** + * get all metadate cache when the heartbeart renew the lease + */ + TDataNodeLeaseRecoveryResp reloadCacheAfterLeaseRecovery(); + // ====================================================== // AINode // ====================================================== @@ -2095,7 +2105,7 @@ service IConfigNodeRPCService { TDescTable4InformationSchemaResp descTables4InformationSchema() - TFetchTableResp fetchTables(map> fetchTableMap) + TFetchTableResp fetchTables(map> fetchTableMap, byte tableNodeStatus) TDeleteTableDeviceResp deleteDevice(TDeleteTableDeviceReq req) From 1ad52816de19e37863f19499a6eb94832331f330 Mon Sep 17 00:00:00 2001 From: Yaobin Chen Date: Fri, 3 Jul 2026 10:51:02 +0800 Subject: [PATCH 2/5] set the MetadataLeaseFenceMs in UT envSetUp, remove the effect of the lease frame --- .../test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java index 4c2e1c9c95b98..83e0106e2aeb6 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java @@ -353,7 +353,7 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOEx public static void envSetUp() { logger.debug("EnvironmentUtil setup..."); config.setThriftServerAwaitTimeForStopService(60); - + CommonDescriptor.getInstance().getConfig().setMetadataLeaseFenceMs(Long.MAX_VALUE); createAllDir(); try { From 5b26f9bf14c35b631b6bf6b67e815b72e7c01f06 Mon Sep 17 00:00:00 2001 From: Yaobin Chen Date: Mon, 6 Jul 2026 11:45:21 +0800 Subject: [PATCH 3/5] fix the problems, main modification is the change of MetadataLeaseManager, add the scheduled task to check the status of metadata --- .../confignode/i18n/ProcedureMessages.java | 329 +++++++++------ .../confignode/i18n/ProcedureMessages.java | 278 +++++++----- .../manager/lease/ClusterCachePropagator.java | 3 + .../lease/MetadataBroadcastVerdict.java | 11 +- .../procedure/env/ConfigNodeProcedureEnv.java | 4 +- .../procedure/impl/schema/SchemaUtils.java | 10 +- .../impl/schema/SetTTLProcedure.java | 4 +- .../schema/table/DeleteDevicesProcedure.java | 6 +- .../table/DropTableColumnProcedure.java | 4 +- .../impl/schema/table/DropTableProcedure.java | 4 +- .../iotdb/db/i18n/DataNodePipeMessages.java | 213 +++++----- .../iotdb/db/i18n/DataNodeSchemaMessages.java | 395 ++++++------------ .../lease/MetadataLeaseManager.java | 70 +++- .../ClusterAuthorityFetcherLeaseTest.java | 2 +- .../lease/MetadataLeaseManagerTest.java | 3 + .../lease/MetadataLeaseTestUtils.java | 10 +- .../conf/iotdb-system.properties.template | 7 + .../iotdb/commons/concurrent/ThreadName.java | 6 +- .../iotdb/commons/conf/CommonConfig.java | 10 + .../iotdb/commons/conf/CommonDescriptor.java | 6 + 20 files changed, 750 insertions(+), 625 deletions(-) diff --git a/iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ProcedureMessages.java b/iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ProcedureMessages.java index f0263b376215a..71de83ff4b5e7 100644 --- a/iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ProcedureMessages.java +++ b/iotdb-core/confignode/src/main/i18n/en/org/apache/iotdb/confignode/i18n/ProcedureMessages.java @@ -66,8 +66,9 @@ public final class ProcedureMessages { "AlterTableColumnDataType-{}.{}-{} costs {}ms"; public static final String ALTERTIMESERIESDATATYPE_COSTS_MS = "AlterTimeSeriesDataType-{}-[{}] costs {}ms"; - public static final String ALTERTOPICPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES_TRY_TO_ALTER_TOPIC = - "AlterTopicProcedure: executeFromOperateOnConfigNodes, try to alter topic"; + public static final String + ALTERTOPICPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES_TRY_TO_ALTER_TOPIC = + "AlterTopicProcedure: executeFromOperateOnConfigNodes, try to alter topic"; public static final String ALTERTOPICPROCEDURE_EXECUTEFROMOPERATEONDATANODES = "AlterTopicProcedure: executeFromOperateOnDataNodes({})"; public static final String ALTERTOPICPROCEDURE_EXECUTEFROMVALIDATE = @@ -98,8 +99,9 @@ public final class ProcedureMessages { "{}, Begin to stop DataNodes and kill the DataNode process: {}"; public static final String BROADCASTDATANODESTATUSCHANGE_FINISHED_DATANODE = "{}, BroadcastDataNodeStatusChange finished, dataNode: {}"; - public static final String BROADCASTDATANODESTATUSCHANGE_MEETS_ERROR_STATUS_CHANGE_DATANODES_ERROR_DATANODE = - "{}, BroadcastDataNodeStatusChange meets error, status change dataNodes: {}, error datanode: {}"; + public static final String + BROADCASTDATANODESTATUSCHANGE_MEETS_ERROR_STATUS_CHANGE_DATANODES_ERROR_DATANODE = + "{}, BroadcastDataNodeStatusChange meets error, status change dataNodes: {}, error datanode: {}"; public static final String BROADCASTDATANODESTATUSCHANGE_START_DATANODE = "{}, BroadcastDataNodeStatusChange start, dataNode: {}"; public static final String CALL_CHANGEREGIONLEADER_FAIL_FOR_THE_TIME_WILL_SLEEP_MS = @@ -110,8 +112,9 @@ public final class ProcedureMessages { "{}, Cannot find region replica nodes in createPeer, regionId: {}"; public static final String CANNOT_FIND_REGION_REPLICA_NODES_REGION = "Cannot find region replica nodes, region: {}"; - public static final String CATCH_EXCEPTION_WHILE_DESERIALIZING_PROCEDURE_THIS_PROCEDURE_WILL_BE_IGNORED = - "Catch exception while deserializing procedure, this procedure will be ignored."; + public static final String + CATCH_EXCEPTION_WHILE_DESERIALIZING_PROCEDURE_THIS_PROCEDURE_WILL_BE_IGNORED = + "Catch exception while deserializing procedure, this procedure will be ignored."; public static final String CHANGE_REGION_LEADER_FINISHED_REGIONID_NEWLEADERNODE = "{}, Change region leader finished, regionId: {}, newLeaderNode: {}"; public static final String CHECK_AND_INVALIDATE_COLUMN_IN_WHEN_ALTERING_COLUMN_DATA_TYPE = @@ -153,12 +156,14 @@ public final class ProcedureMessages { public static final String COMMIT_RELEASE_TABLE = "Commit release table {}.{}"; public static final String COMMIT_SET_SCHEMAENGINE_TEMPLATE_ON_PATH = "Commit set schemaengine template {} on path {}"; - public static final String CONSENSUSPIPEGUARDIAN_CONSENSUS_PIPE_IS_STOPPED_RESTARTING_ASYNCHRONOUSLY = - "[ConsensusPipeGuardian] consensus pipe [{}] is stopped, restarting asynchronously"; + public static final String + CONSENSUSPIPEGUARDIAN_CONSENSUS_PIPE_IS_STOPPED_RESTARTING_ASYNCHRONOUSLY = + "[ConsensusPipeGuardian] consensus pipe [{}] is stopped, restarting asynchronously"; public static final String CONSENSUSPIPEGUARDIAN_CONSENSUS_PIPE_MISSING_CREATING_ASYNCHRONOUSLY = "[ConsensusPipeGuardian] consensus pipe [{}] missing, creating asynchronously"; - public static final String CONSENSUSPIPEGUARDIAN_UNEXPECTED_CONSENSUS_PIPE_EXISTS_DROPPING_ASYNCHRONOUSLY = - "[ConsensusPipeGuardian] unexpected consensus pipe [{}] exists, dropping asynchronously"; + public static final String + CONSENSUSPIPEGUARDIAN_UNEXPECTED_CONSENSUS_PIPE_EXISTS_DROPPING_ASYNCHRONOUSLY = + "[ConsensusPipeGuardian] unexpected consensus pipe [{}] exists, dropping asynchronously"; public static final String CONSTRUCT_SCHEMAENGINE_BLACK_LIST_OF_DEVICES_IN = "Construct schemaEngine black list of devices in {}.{}"; public static final String CONSTRUCT_SCHEMAENGINE_BLACK_LIST_OF_TEMPLATE_SET_ON = @@ -217,12 +222,15 @@ public final class ProcedureMessages { "CreatePipeProcedureV2: rollbackFromValidateTask({})"; public static final String CREATEPIPEPROCEDUREV2_ROLLBACKFROMWRITECONFIGNODECONSENSUS = "CreatePipeProcedureV2: rollbackFromWriteConfigNodeConsensus({})"; - public static final String CREATEREGIONGROUPS_ALL_REPLICAS_OF_REGIONGROUP_ARE_CREATED_SUCCESSFULLY = - "[CreateRegionGroups] All replicas of RegionGroup: {} are created successfully!"; - public static final String CREATEREGIONGROUPS_FAILED_TO_CREATE_MOST_OF_REPLICAS_IN_REGIONGROUP_THE = - "[CreateRegionGroups] Failed to create most of replicas in RegionGroup: {}, The redundant replicas in this RegionGroup will be deleted."; - public static final String CREATEREGIONGROUPS_FAILED_TO_CREATE_SOME_REPLICAS_OF_REGIONGROUP_BUT_THIS = - "[CreateRegionGroups] Failed to create some replicas of RegionGroup: {}, but this RegionGroup can still be used."; + public static final String + CREATEREGIONGROUPS_ALL_REPLICAS_OF_REGIONGROUP_ARE_CREATED_SUCCESSFULLY = + "[CreateRegionGroups] All replicas of RegionGroup: {} are created successfully!"; + public static final String + CREATEREGIONGROUPS_FAILED_TO_CREATE_MOST_OF_REPLICAS_IN_REGIONGROUP_THE = + "[CreateRegionGroups] Failed to create most of replicas in RegionGroup: {}, The redundant replicas in this RegionGroup will be deleted."; + public static final String + CREATEREGIONGROUPS_FAILED_TO_CREATE_SOME_REPLICAS_OF_REGIONGROUP_BUT_THIS = + "[CreateRegionGroups] Failed to create some replicas of RegionGroup: {}, but this RegionGroup can still be used."; public static final String CREATESUBSCRIPTIONPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES = "CreateSubscriptionProcedure: executeFromOperateOnConfigNodes"; public static final String CREATESUBSCRIPTIONPROCEDURE_EXECUTEFROMOPERATEONDATANODES = @@ -373,8 +381,9 @@ public final class ProcedureMessages { "Failed to commit set template {} on path {} due to {}"; public static final String FAILED_TO_CREATE_CONSENSUS_PIPE = "{}, Failed to create consensus pipe {}: {}"; - public static final String FAILED_TO_CREATE_PIPES_WHEN_CREATING_SUBSCRIPTION_WITH_REQUEST_DETAILS = - "Failed to create pipes %s when creating subscription with request %s, details: %s, metadata will be synchronized later."; + public static final String + FAILED_TO_CREATE_PIPES_WHEN_CREATING_SUBSCRIPTION_WITH_REQUEST_DETAILS = + "Failed to create pipes %s when creating subscription with request %s, details: %s, metadata will be synchronized later."; public static final String FAILED_TO_CREATE_PIPE_DETAILS_METADATA_WILL_BE_SYNCHRONIZED_LATER = "Failed to create pipe {}, details: {}, metadata will be synchronized later."; public static final String FAILED_TO_CREATE_PIPE_PLUGIN_INSTANCE_ON_DATA_NODES = @@ -455,8 +464,9 @@ public final class ProcedureMessages { "Failed to rollback alter pipe {}, details: {}, metadata will be synchronized later."; public static final String FAILED_TO_ROLLBACK_COMMIT_SET_TEMPLATE_ON_PATH_DUE_TO = "Failed to rollback commit set template {} on path {} due to {}"; - public static final String FAILED_TO_ROLLBACK_CREATE_PIPES_WHEN_CREATING_SUBSCRIPTION_WITH_REQUEST = - "Failed to rollback create pipes when creating subscription with request %s, because %s"; + public static final String + FAILED_TO_ROLLBACK_CREATE_PIPES_WHEN_CREATING_SUBSCRIPTION_WITH_REQUEST = + "Failed to rollback create pipes when creating subscription with request %s, because %s"; public static final String FAILED_TO_ROLLBACK_CREATE_PIPE_DETAILS_METADATA_WILL_BE_SYNCHRONIZED = "Failed to rollback create pipe {}, details: {}, metadata will be synchronized later."; public static final String FAILED_TO_ROLLBACK_CREATING_SUBSCRIPTION_WITH_REQUEST_ON_CONFIG_NODES = @@ -579,7 +589,7 @@ public final class ProcedureMessages { public static final String PRE_RELEASE_DELETE_TABLE_WHEN_DROPPING_TABLE = "pre release delete table {}.{} when dropping table"; public static final String COMMIT_RELEASE_DELETE_TABLE_WHEN_DROPPING_TABLE = - "commit release delete table {}.{} when dropping table"; + "commit release delete table {}.{} when dropping table"; public static final String INVALID_DATA_TYPE_CANNOT_BE_USED_AS_A_NEW_TYPE = "Invalid data type cannot be used as a new type"; public static final String IO_ERROR_WHEN_DESERIALIZE_AUTHPLAN = @@ -597,10 +607,12 @@ public final class ProcedureMessages { public static final String OPERATION_TIMED_OUT_AFTER = "Operation timed out after "; public static final String PARTITION_TABLE_CLEANER_ACTIVATE_TTL_LOG = "[PartitionTableCleaner] Periodically activate PartitionTableAutoCleaner, databaseTTL: {}"; - public static final String PARTITIONTABLECLEANER_PERIODICALLY_ACTIVATE_PARTITIONTABLEAUTOCLEANER_FOR = - "[PartitionTableCleaner] Periodically activate PartitionTableAutoCleaner for: {}"; - public static final String PARTITIONTABLECLEANER_THE_PARTITIONTABLEAUTOCLEANER_IS_STARTED_WITH_CYCLE_MS = - "[PartitionTableCleaner] The PartitionTableAutoCleaner is started with cycle={}ms"; + public static final String + PARTITIONTABLECLEANER_PERIODICALLY_ACTIVATE_PARTITIONTABLEAUTOCLEANER_FOR = + "[PartitionTableCleaner] Periodically activate PartitionTableAutoCleaner for: {}"; + public static final String + PARTITIONTABLECLEANER_THE_PARTITIONTABLEAUTOCLEANER_IS_STARTED_WITH_CYCLE_MS = + "[PartitionTableCleaner] The PartitionTableAutoCleaner is started with cycle={}ms"; public static final String PID_ADDREGION_CANNOT_ROLL_BACK_BECAUSE_CANNOT_FIND_THE_CORRECT = "[pid{}][AddRegion] Cannot roll back, because cannot find the correct locations"; public static final String PID_ADDREGION_IT_APPEARS_THAT_CONSENSUS_WRITE_HAS_NOT_MODIFIED = @@ -636,8 +648,9 @@ public final class ProcedureMessages { public static final String PID_MIGRATEREGION_STATE_FAIL = "[pid{}][MigrateRegion] state {} fail"; public static final String PID_MIGRATEREGION_SUB_PROCEDURE_ADDREGIONPEERPROCEDURE = "[pid{}][MigrateRegion] sub-procedure AddRegionPeerProcedure failed, RegionMigrateProcedure will not continue"; - public static final String PID_MIGRATEREGION_SUCCESS_HAS_BEEN_MIGRATED_FROM_DATANODE_TO_PROCEDURE = - "[pid{}][MigrateRegion] success,{} {} has been migrated from DataNode {} to {}. Procedure took {} (started at {})."; + public static final String + PID_MIGRATEREGION_SUCCESS_HAS_BEEN_MIGRATED_FROM_DATANODE_TO_PROCEDURE = + "[pid{}][MigrateRegion] success,{} {} has been migrated from DataNode {} to {}. Procedure took {} (started at {})."; public static final String PID_NOTIFYREGIONMIGRATION_STARTED_REGION_ID_IS = "[pid{}][NotifyRegionMigration] started, region id is {}."; public static final String PID_NOTIFYREGIONMIGRATION_STATE_COMPLETE = @@ -646,8 +659,9 @@ public final class ProcedureMessages { "[pid{}][NotifyRegionMigration] state {} failed"; public static final String PID_RECONSTRUCTREGION_FAILED_BUT_THE_REGION_HAS_BEEN_REMOVED_FROM = "[pid{}][ReconstructRegion] failed, but the region {} has been removed from DataNode {}. Use 'extend region' to fix this."; - public static final String PID_RECONSTRUCTREGION_STARTED_REGION_ON_DATANODE_WILL_BE_RECONSTRUCTED = - "[pid{}][ReconstructRegion] started, region {} on DataNode {}({}) will be reconstructed."; + public static final String + PID_RECONSTRUCTREGION_STARTED_REGION_ON_DATANODE_WILL_BE_RECONSTRUCTED = + "[pid{}][ReconstructRegion] started, region {} on DataNode {}({}) will be reconstructed."; public static final String PID_RECONSTRUCTREGION_STATE_COMPLETE = "[pid{}][ReconstructRegion] state {} complete"; public static final String PID_RECONSTRUCTREGION_STATE_FAIL = @@ -656,24 +670,28 @@ public final class ProcedureMessages { "[pid{}][ReconstructRegion] sub-procedure RemoveRegionPeerProcedure failed, ReconstructRegionProcedure will not continue"; public static final String PID_RECONSTRUCTREGION_SUCCESS_REGION_HAS_BEEN_RECONSTRUCTED = "[pid{}][ReconstructRegion] success, region {} has been reconstructed on DataNode {}. Procedure took {} (started at {})"; - public static final String PID_REMOVEREGION_DELETE_OLD_REGION_PEER_EXECUTED_FAILED_AFTER_ATTEMPTS = - "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER executed failed after {} attempts, procedure will continue. You should manually delete region file. {}"; + public static final String + PID_REMOVEREGION_DELETE_OLD_REGION_PEER_EXECUTED_FAILED_AFTER_ATTEMPTS = + "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER executed failed after {} attempts, procedure will continue. You should manually delete region file. {}"; public static final String PID_REMOVEREGION_DELETE_OLD_REGION_PEER_EXECUTED_FAILED_ATTEMPT_WILL = "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER executed failed (attempt {}/{}), will retry after {}ms. {}"; public static final String PID_REMOVEREGION_DELETE_OLD_REGION_PEER_TASK_SUBMITTED_FAILED_AFTER = "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER task submitted failed after {} attempts, procedure will continue. You should manually delete region file. {}"; public static final String PID_REMOVEREGION_DELETE_OLD_REGION_PEER_TASK_SUBMITTED_FAILED_ATTEMPT = "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER task submitted failed (attempt {}/{}), will retry after {}ms. {}"; - public static final String PID_REMOVEREGION_EXECUTED_FAILED_CONFIGNODE_BELIEVE_CURRENT_PEER_LIST_OF = - "[pid{}][RemoveRegion] {} executed failed, ConfigNode believe current peer list of {} is {}. Procedure will continue. You should manually clear peer list."; + public static final String + PID_REMOVEREGION_EXECUTED_FAILED_CONFIGNODE_BELIEVE_CURRENT_PEER_LIST_OF = + "[pid{}][RemoveRegion] {} executed failed, ConfigNode believe current peer list of {} is {}. Procedure will continue. You should manually clear peer list."; public static final String PID_REMOVEREGION_STARTED_REGION_WILL_BE_REMOVED_FROM_DATANODE = "[pid{}][RemoveRegion] started, region {} will be removed from DataNode {}."; public static final String PID_REMOVEREGION_STATE_SUCCESS = "[pid{}][RemoveRegion] state {} success"; - public static final String PID_REMOVEREGION_SUCCESS_REGION_HAS_BEEN_REMOVED_FROM_DATANODE_PROCEDURE = - "[pid{}][RemoveRegion] success, region {} has been removed from DataNode {}. Procedure took {} (started at {})"; - public static final String PID_REMOVEREGION_TASK_SUBMITTED_FAILED_CONFIGNODE_BELIEVE_CURRENT_PEER_LIST = - "[pid{}][RemoveRegion] {} task submitted failed, ConfigNode believe current peer list of {} is {}. Procedure will continue. You should manually clear peer list."; + public static final String + PID_REMOVEREGION_SUCCESS_REGION_HAS_BEEN_REMOVED_FROM_DATANODE_PROCEDURE = + "[pid{}][RemoveRegion] success, region {} has been removed from DataNode {}. Procedure took {} (started at {})"; + public static final String + PID_REMOVEREGION_TASK_SUBMITTED_FAILED_CONFIGNODE_BELIEVE_CURRENT_PEER_LIST = + "[pid{}][RemoveRegion] {} task submitted failed, ConfigNode believe current peer list of {} is {}. Procedure will continue. You should manually clear peer list."; public static final String PIPEHANDLELEADERCHANGEPROCEDURE_EXECUTEFROMCALCULATEINFOFORTASK = "PipeHandleLeaderChangeProcedure: executeFromCalculateInfoForTask"; public static final String PIPEHANDLELEADERCHANGEPROCEDURE_EXECUTEFROMHANDLEONCONFIGNODES = @@ -706,8 +724,9 @@ public final class ProcedureMessages { "PipeHandleMetaChangeProcedure: rollbackFromValidateTask"; public static final String PIPEHANDLEMETACHANGEPROCEDURE_ROLLBACKFROMWRITECONFIGNODECONSENSUS = "PipeHandleMetaChangeProcedure: rollbackFromWriteConfigNodeConsensus"; - public static final String PIPEMETASYNCPROCEDURE_ACQUIRELOCK_SKIP_THE_PROCEDURE_DUE_TO_THE_LAST_EXECUTION = - "PipeMetaSyncProcedure: acquireLock, skip the procedure due to the last execution time {}"; + public static final String + PIPEMETASYNCPROCEDURE_ACQUIRELOCK_SKIP_THE_PROCEDURE_DUE_TO_THE_LAST_EXECUTION = + "PipeMetaSyncProcedure: acquireLock, skip the procedure due to the last execution time {}"; public static final String PIPEMETASYNCPROCEDURE_EXECUTEFROMCALCULATEINFOFORTASK = "PipeMetaSyncProcedure: executeFromCalculateInfoForTask"; public static final String PIPEMETASYNCPROCEDURE_EXECUTEFROMOPERATEONDATANODES = @@ -726,8 +745,9 @@ public final class ProcedureMessages { "PipeMetaSyncProcedure: rollbackFromWriteConfigNodeConsensus"; public static final String PIPE_NOT_FOUND_IN_PIPETASKINFO_CAN_NOT_PUSH_ITS_META = "Pipe {} not found in PipeTaskInfo, can not push its meta."; - public static final String PIPE_PLUGIN_IS_ALREADY_CREATED_AND_ISSETIFNOTEXISTSCONDITION_IS_TRUE_END = - "Pipe plugin {} is already created and isSetIfNotExistsCondition is true, end the CreatePipePluginProcedure({})"; + public static final String + PIPE_PLUGIN_IS_ALREADY_CREATED_AND_ISSETIFNOTEXISTSCONDITION_IS_TRUE_END = + "Pipe plugin {} is already created and isSetIfNotExistsCondition is true, end the CreatePipePluginProcedure({})"; public static final String PIPE_PLUGIN_IS_ALREADY_CREATED_END_THE_CREATEPIPEPLUGINPROCEDURE = "Pipe plugin {} is already created, end the CreatePipePluginProcedure({})"; public static final String PIPE_PLUGIN_IS_NOT_EXIST_END_THE_DROPPIPEPLUGINPROCEDURE = @@ -782,16 +802,21 @@ public final class ProcedureMessages { "ProcedureId {}: {}. Invalid lock state. Without acquiring pipe lock."; public static final String PROCEDUREID_INVALID_LOCK_STATE_WITHOUT_ACQUIRING_SUBSCRIPTION_LOCK = "ProcedureId {}: {}. Invalid lock state. Without acquiring subscription lock."; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH = - "ProcedureId {}: LOCK_ACQUIRED. The following procedure should be executed with pipe lock."; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH_2 = - "ProcedureId {}: LOCK_ACQUIRED. The following procedure should be executed with subscription and pipe lock."; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH_3 = - "ProcedureId {}: LOCK_ACQUIRED. The following procedure should be executed with subscription lock."; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_NOT_BE_EXECUTED = - "ProcedureId {}: LOCK_ACQUIRED. The following procedure should not be executed without pipe lock."; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_NOT_BE_EXECUTED_2 = - "ProcedureId {}: LOCK_ACQUIRED. The following procedure should not be executed without subscription lock."; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH = + "ProcedureId {}: LOCK_ACQUIRED. The following procedure should be executed with pipe lock."; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH_2 = + "ProcedureId {}: LOCK_ACQUIRED. The following procedure should be executed with subscription and pipe lock."; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH_3 = + "ProcedureId {}: LOCK_ACQUIRED. The following procedure should be executed with subscription lock."; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_NOT_BE_EXECUTED = + "ProcedureId {}: LOCK_ACQUIRED. The following procedure should not be executed without pipe lock."; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_NOT_BE_EXECUTED_2 = + "ProcedureId {}: LOCK_ACQUIRED. The following procedure should not be executed without subscription lock."; public static final String PROCEDUREID_LOCK_EVENT_WAIT_PIPE_LOCK_WILL_BE_RELEASED = "ProcedureId {}: LOCK_EVENT_WAIT. Pipe lock will be released."; public static final String PROCEDUREID_LOCK_EVENT_WAIT_SUBSCRIPTION_LOCK_WILL_BE_RELEASED = @@ -800,8 +825,9 @@ public final class ProcedureMessages { "ProcedureId {}: LOCK_EVENT_WAIT. Without acquiring pipe lock."; public static final String PROCEDUREID_LOCK_EVENT_WAIT_WITHOUT_ACQUIRING_SUBSCRIPTION_LOCK = "ProcedureId {}: LOCK_EVENT_WAIT. Without acquiring subscription lock."; - public static final String PROCEDUREID_PIPE_LOCK_IS_NOT_ACQUIRED_EXECUTEFROMSTATE_S_EXECUTION_WILL = - "ProcedureId {}: Pipe lock is not acquired, executeFromState's execution will be skipped."; + public static final String + PROCEDUREID_PIPE_LOCK_IS_NOT_ACQUIRED_EXECUTEFROMSTATE_S_EXECUTION_WILL = + "ProcedureId {}: Pipe lock is not acquired, executeFromState's execution will be skipped."; public static final String PROCEDUREID_PIPE_LOCK_IS_NOT_ACQUIRED_ROLLBACKSTATE_S_EXECUTION_WILL = "ProcedureId {}: Pipe lock is not acquired, rollbackState({})'s execution will be skipped."; public static final String PROCEDUREID_RELEASE_LOCK_NO_NEED_TO_RELEASE_PIPE_LOCK = @@ -812,10 +838,12 @@ public final class ProcedureMessages { "ProcedureId {} release lock. Pipe lock will be released."; public static final String PROCEDUREID_RELEASE_LOCK_SUBSCRIPTION_LOCK_WILL_BE_RELEASED = "ProcedureId {} release lock. Subscription lock will be released."; - public static final String PROCEDUREID_SUBSCRIPTION_LOCK_IS_NOT_ACQUIRED_EXECUTEFROMSTATE_S_EXECUTION_WILL = - "ProcedureId {}: Subscription lock is not acquired, executeFromState({})'s execution will be skipped."; - public static final String PROCEDUREID_SUBSCRIPTION_LOCK_IS_NOT_ACQUIRED_ROLLBACKSTATE_S_EXECUTION_WILL = - "ProcedureId {}: Subscription lock is not acquired, rollbackState({})'s execution will be skipped."; + public static final String + PROCEDUREID_SUBSCRIPTION_LOCK_IS_NOT_ACQUIRED_EXECUTEFROMSTATE_S_EXECUTION_WILL = + "ProcedureId {}: Subscription lock is not acquired, executeFromState({})'s execution will be skipped."; + public static final String + PROCEDUREID_SUBSCRIPTION_LOCK_IS_NOT_ACQUIRED_ROLLBACKSTATE_S_EXECUTION_WILL = + "ProcedureId {}: Subscription lock is not acquired, rollbackState({})'s execution will be skipped."; public static final String PROCEDUREID_TRY_TO_ACQUIRE_PIPE_LOCK = "ProcedureId {} try to acquire pipe lock."; public static final String PROCEDUREID_TRY_TO_ACQUIRE_SUBSCRIPTION_AND_PIPE_LOCK = @@ -849,7 +877,7 @@ public final class ProcedureMessages { public static final String ROLLBACK_CREATE_TABLE_FAILED = "Rollback create table failed"; public static final String ROLLBACK_DROPTABLE_COSTS_MS = "Rollback DropTable-{} costs {}ms."; public static final String ROLLBACK_PRE_DELETE_TABLE_FAILED = - "Rollback pre-delete table %s.%s failed, please manually drop the table"; + "Rollback pre-delete table %s.%s failed, please manually drop the table by entering sql"; public static final String ROLLBACK_PRE_RELEASE = "Rollback pre-release "; public static final String ROLLBACK_PRE_RELEASE_TEMPLATE_FAILED = "Rollback pre release template failed"; @@ -862,13 +890,16 @@ public final class ProcedureMessages { public static final String ROLLBACK_TEMPLATE_CACHE_FAILED = "Rollback template cache failed"; public static final String ROLLBACK_TEMPLATE_PRE_UNSET_FAILED_BECAUSE_OF = "Rollback template pre unset failed because of"; - public static final String ROLLBACK_UNSET_TEMPLATE_FAILED_AND_THE_CLUSTER_TEMPLATE_INFO_MANAGEMENT = - "Rollback unset template failed and the cluster template info management is strictly broken. Please try unset again."; + public static final String + ROLLBACK_UNSET_TEMPLATE_FAILED_AND_THE_CLUSTER_TEMPLATE_INFO_MANAGEMENT = + "Rollback unset template failed and the cluster template info management is strictly broken. Please try unset again."; public static final String SELECTED_DATANODE_FOR_REGION = "Selected DataNode {} for Region {}"; - public static final String SEND_ACTION_ADDREGIONPEER_FINISHED_REGIONID_RPCDATANODE_DESTDATANODE_STATUS = - "{}, Send action addRegionPeer finished, regionId: {}, rpcDataNode: {}, destDataNode: {}, status: {}"; - public static final String SEND_ACTION_CREATENEWREGIONPEER_ERROR_REGIONID_NEWPEERDATANODEID_RESULT = - "{}, Send action createNewRegionPeer error, regionId: {}, newPeerDataNodeId: {}, result: {}"; + public static final String + SEND_ACTION_ADDREGIONPEER_FINISHED_REGIONID_RPCDATANODE_DESTDATANODE_STATUS = + "{}, Send action addRegionPeer finished, regionId: {}, rpcDataNode: {}, destDataNode: {}, status: {}"; + public static final String + SEND_ACTION_CREATENEWREGIONPEER_ERROR_REGIONID_NEWPEERDATANODEID_RESULT = + "{}, Send action createNewRegionPeer error, regionId: {}, newPeerDataNodeId: {}, result: {}"; public static final String SEND_ACTION_CREATENEWREGIONPEER_FINISHED_REGIONID_NEWPEERDATANODEID = "{}, Send action createNewRegionPeer finished, regionId: {}, newPeerDataNodeId: {}"; public static final String SEND_ACTION_DELETEOLDREGIONPEER_FINISHED_REGIONID_DATANODEID = @@ -957,8 +988,9 @@ public final class ProcedureMessages { "{} task {} cannot get task report from DataNode {}, last report time is {} ago"; public static final String THE_UPDATED_TABLE_HAS_THE_SAME_PROPERTIES_WITH_THE_ORIGINAL = "The updated table has the same properties with the original one. Skip the procedure."; - public static final String TOPICMETASYNCPROCEDURE_ACQUIRELOCK_SKIP_THE_PROCEDURE_DUE_TO_THE_LAST_EXECUTION = - "TopicMetaSyncProcedure: acquireLock, skip the procedure due to the last execution time {}"; + public static final String + TOPICMETASYNCPROCEDURE_ACQUIRELOCK_SKIP_THE_PROCEDURE_DUE_TO_THE_LAST_EXECUTION = + "TopicMetaSyncProcedure: acquireLock, skip the procedure due to the last execution time {}"; public static final String TOPICMETASYNCPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES = "TopicMetaSyncProcedure: executeFromOperateOnConfigNodes"; public static final String TOPICMETASYNCPROCEDURE_EXECUTEFROMOPERATEONDATANODES = @@ -1007,104 +1039,161 @@ public final class ProcedureMessages { public static final String UNRECOGNIZED_SETTEMPLATESTATE = "Unrecognized SetTemplateState "; public static final String UNRECOGNIZED_STATE = "Unrecognized state "; public static final String UNSETTEMPLATE_COSTS_MS = "UnsetTemplate-[{}] costs {}ms"; - public static final String UNSET_TEMPLATE_FROM_FAILED_WHEN_CHECK_DATANODE_TEMPLATE_ACTIVATION_BECAUSE = - "Unset template %s from %s failed when [check DataNode template activation] because %s"; + public static final String + UNSET_TEMPLATE_FROM_FAILED_WHEN_CHECK_DATANODE_TEMPLATE_ACTIVATION_BECAUSE = + "Unset template %s from %s failed when [check DataNode template activation] because %s"; public static final String UNSET_TEMPLATE_ON = "Unset template {} on {}"; public static final String UNSUPPORTED_ROLL_BACK_STATE = "Unsupported roll back STATE [{}]"; public static final String UNSUPPORTED_STATE = "Unsupported state: "; public static final String UPDATE_DATANODE_TTL_CACHE_FAILED = "Update dataNode ttl cache failed"; public static final String VALIDATE_TABLE_FOR_TABLE_WHEN_SETTING_PROPERTIES = "Validate table for table {}.{} when setting properties"; - public static final String WAITTASKFINISH_RETURNS_PROCESSING_WHICH_MEANS_THE_WAITING_HAS_BEEN_INTERRUPTED = - "waitTaskFinish() returns PROCESSING, which means the waiting has been interrupted (ConfigNode shutdown or leader change); the AddRegionPeer task is still running on the coordinator, this procedure will stay at DO_ADD_REGION_PEER and resume polling after recovery"; + public static final String + WAITTASKFINISH_RETURNS_PROCESSING_WHICH_MEANS_THE_WAITING_HAS_BEEN_INTERRUPTED = + "waitTaskFinish() returns PROCESSING, which means the waiting has been interrupted (ConfigNode shutdown or leader change); the AddRegionPeer task is still running on the coordinator, this procedure will stay at DO_ADD_REGION_PEER and resume polling after recovery"; - public static final String FAILED_TO_CREATE_DATABASE_THE_TTL_SHOULD_BE_NON_NEGATIVE = "Failed to create database. The TTL should be non-negative."; - public static final String FAILED_TO_CREATE_DATABASE_THE_DATAREGIONGROUPNUM_SHOULD_BE_POSITIVE = "Failed to create database. The dataRegionGroupNum should be positive."; - public static final String PID_FAILED_TO_PERSIST_LOCK_STATE_TO_STORE = "pid={} Failed to persist lock state to store."; - public static final String FORCE_WRITE_UNLOCK_STATE_TO_RAFT_FOR_PID = "Force write unlock state to raft for pid={}"; - public static final String PID_FAILED_TO_PERSIST_UNLOCK_STATE_TO_STORE = "pid={} Failed to persist unlock state to store."; - public static final String DIDN_T_HOLD_THE_LOCK_BEFORE_RESTARTING_SKIP_ACQUIRING_LOCK = "{} didn't hold the lock before restarting, skip acquiring lock"; - public static final String IS_ALREADY_BYPASSED_SKIP_ACQUIRING_LOCK = "{} is already bypassed, skip acquiring lock."; - public static final String IS_IN_WAITING_STATE_AND_HOLDLOCK_FALSE_SKIP_ACQUIRING_LOCK = "{} is in WAITING STATE, and holdLock= false , skip acquiring lock."; - public static final String HELD_THE_LOCK_BEFORE_RESTARTING_CALL_ACQUIRELOCK_TO_RESTORE_IT = "{} held the lock before restarting, call acquireLock to restore it."; + public static final String FAILED_TO_CREATE_DATABASE_THE_TTL_SHOULD_BE_NON_NEGATIVE = + "Failed to create database. The TTL should be non-negative."; + public static final String FAILED_TO_CREATE_DATABASE_THE_DATAREGIONGROUPNUM_SHOULD_BE_POSITIVE = + "Failed to create database. The dataRegionGroupNum should be positive."; + public static final String PID_FAILED_TO_PERSIST_LOCK_STATE_TO_STORE = + "pid={} Failed to persist lock state to store."; + public static final String FORCE_WRITE_UNLOCK_STATE_TO_RAFT_FOR_PID = + "Force write unlock state to raft for pid={}"; + public static final String PID_FAILED_TO_PERSIST_UNLOCK_STATE_TO_STORE = + "pid={} Failed to persist unlock state to store."; + public static final String DIDN_T_HOLD_THE_LOCK_BEFORE_RESTARTING_SKIP_ACQUIRING_LOCK = + "{} didn't hold the lock before restarting, skip acquiring lock"; + public static final String IS_ALREADY_BYPASSED_SKIP_ACQUIRING_LOCK = + "{} is already bypassed, skip acquiring lock."; + public static final String IS_IN_WAITING_STATE_AND_HOLDLOCK_FALSE_SKIP_ACQUIRING_LOCK = + "{} is in WAITING STATE, and holdLock= false , skip acquiring lock."; + public static final String HELD_THE_LOCK_BEFORE_RESTARTING_CALL_ACQUIRELOCK_TO_RESTORE_IT = + "{} held the lock before restarting, call acquireLock to restore it."; public static final String CHILD_LATCH_INCREMENT_SET = "CHILD LATCH INCREMENT SET "; public static final String CHILD_LATCH_INCREMENT = "CHILD LATCH INCREMENT "; public static final String CHILD_LATCH_DECREMENT = "CHILD LATCH DECREMENT "; public static final String UNEXPECTED_STATE_FOR = "Unexpected state:{} for {}"; - public static final String OLD_PROCEDURE_DIRECTORY_DETECTED_UPGRADE_BEGINNING = "Old procedure directory detected, upgrade beginning..."; + public static final String OLD_PROCEDURE_DIRECTORY_DETECTED_UPGRADE_BEGINNING = + "Old procedure directory detected, upgrade beginning..."; public static final String ALREADY_RUNNING = "Already running"; public static final String PROCEDURE_WORKERS_ARE_STARTED = "{} procedure workers are started."; public static final String IS_ALREADY_FINISHED = "{} is already finished."; - public static final String ROLLBACK_BECAUSE_PARENT_IS_DONE_ROLLEDBACK_PROC_IS = "Rollback because parent is done/rolledback, proc is {}"; + public static final String ROLLBACK_BECAUSE_PARENT_IS_DONE_ROLLEDBACK_PROC_IS = + "Rollback because parent is done/rolledback, proc is {}"; public static final String ROLLBACK_STACK_IS_NULL_FOR = "Rollback stack is null for {}"; public static final String LOCK_EVENT_WAIT_ROLLBACK = "LOCK_EVENT_WAIT rollback {}"; - public static final String LOCK_EVENT_WAIT_CAN_T_ROLLBACK_CHILD_RUNNING_FOR = "LOCK_EVENT_WAIT can't rollback child running for {}"; + public static final String LOCK_EVENT_WAIT_CAN_T_ROLLBACK_CHILD_RUNNING_FOR = + "LOCK_EVENT_WAIT can't rollback child running for {}"; public static final String LOCKSTATE_IS = "{} lockstate is {}"; public static final String FINISHED_IN_MS_SUCCESSFULLY = "{} finished in {}ms successfully."; public static final String PROCEDUREID_WAIT_FOR_LOCK = "procedureId {} wait for lock."; - public static final String INTERRUPT_DURING_EXECUTION_SUSPEND_OR_RETRY_IT_LATER = "Interrupt during execution, suspend or retry it later."; + public static final String INTERRUPT_DURING_EXECUTION_SUSPEND_OR_RETRY_IT_LATER = + "Interrupt during execution, suspend or retry it later."; public static final String CODE_BUG = "CODE-BUG:{}"; public static final String INITIALIZED_SUB_PROCS = "Initialized sub procs:{}"; public static final String ADDED_INTO_TIMEOUTEXECUTOR = "Added into timeoutExecutor {}"; - public static final String SUB_PROCEDURE_PID_HAS_BEEN_SUBMITTED = "Sub-Procedure pid={} has been submitted"; + public static final String SUB_PROCEDURE_PID_HAS_BEEN_SUBMITTED = + "Sub-Procedure pid={} has been submitted"; public static final String STORED_CHILDREN = "Stored {}, children {}"; - public static final String FAILED_TO_UPDATE_SUBPROCS_ON_EXECUTION = "Failed to update subprocs on execution"; + public static final String FAILED_TO_UPDATE_SUBPROCS_ON_EXECUTION = + "Failed to update subprocs on execution"; public static final String STORE_UPDATE = "Store update {}"; - public static final String FAILED_TO_DELETE_SUBPROCEDURES_ON_EXECUTION = "Failed to delete subprocedures on execution"; - public static final String FAILED_TO_UPDATE_PROCEDURE_ON_EXECUTION = "Failed to update procedure on execution"; + public static final String FAILED_TO_DELETE_SUBPROCEDURES_ON_EXECUTION = + "Failed to delete subprocedures on execution"; + public static final String FAILED_TO_UPDATE_PROCEDURE_ON_EXECUTION = + "Failed to update procedure on execution"; public static final String ROLLED_BACK_TIME_DURATION_IS = "Rolled back {}, time duration is {}"; public static final String ROLL_BACK_FAILED_FOR = "Roll back failed for {}"; - public static final String INTERRUPTED_EXCEPTION_OCCURRED_FOR = "Interrupted exception occurred for {}"; + public static final String INTERRUPTED_EXCEPTION_OCCURRED_FOR = + "Interrupted exception occurred for {}"; public static final String CODE_BUG_RUNTIME_EXCEPTION_FOR = "CODE-BUG: runtime exception for {}"; - public static final String FAILED_TO_DELETE_PROCEDURE_ON_ROLLBACK = "Failed to delete procedure on rollback"; - public static final String FAILED_TO_UPDATE_PROCEDURE_ON_ROLLBACK = "Failed to update procedure on rollback"; + public static final String FAILED_TO_DELETE_PROCEDURE_ON_ROLLBACK = + "Failed to delete procedure on rollback"; + public static final String FAILED_TO_UPDATE_PROCEDURE_ON_ROLLBACK = + "Failed to update procedure on rollback"; public static final String PROCEDURE_WORKER_TERMINATED = "Procedure worker {} terminated."; public static final String ADDED_NEW_WORKER_THREAD = "Added new worker thread {}"; public static final String STOPPING = "Stopping"; - public static final String FAILED_TO_UPDATE_STORE_PROCEDURE = "Failed to update store procedure {}"; + public static final String FAILED_TO_UPDATE_STORE_PROCEDURE = + "Failed to update store procedure {}"; public static final String IS_STORED = "{} is stored."; public static final String START_TO_CREATE_TRIGGER = "Start to create trigger [{}]"; public static final String CREATE_TRIGGER_FAILED = "Create trigger {} failed."; - public static final String START_INIT_ROLLBACK_OF_TRIGGER = "Start [INIT] rollback of trigger [{}]"; - public static final String START_VALIDATED_ROLLBACK_OF_TRIGGER = "Start [VALIDATED] rollback of trigger [{}]"; + public static final String START_INIT_ROLLBACK_OF_TRIGGER = + "Start [INIT] rollback of trigger [{}]"; + public static final String START_VALIDATED_ROLLBACK_OF_TRIGGER = + "Start [VALIDATED] rollback of trigger [{}]"; public static final String START_TO_DROP_TRIGGER = "Start to drop trigger [{}]"; - public static final String START_TO_DROP_TRIGGER_ON_DATA_NODES = "Start to drop trigger [{}] on Data Nodes"; - public static final String START_TO_DROP_TRIGGER_ON_CONFIG_NODES = "Start to drop trigger [{}] on Config Nodes"; + public static final String START_TO_DROP_TRIGGER_ON_DATA_NODES = + "Start to drop trigger [{}] on Data Nodes"; + public static final String START_TO_DROP_TRIGGER_ON_CONFIG_NODES = + "Start to drop trigger [{}] on Config Nodes"; public static final String DROP_TRIGGER_FAILED = "Drop trigger {} failed."; - public static final String ERROR_IN_DESERIALIZE_DELETEDATABASEPROCEDURE = "Error in deserialize DeleteDatabaseProcedure"; + public static final String ERROR_IN_DESERIALIZE_DELETEDATABASEPROCEDURE = + "Error in deserialize DeleteDatabaseProcedure"; public static final String EXECUTING_CREATE_PEER_ON = "Executing CREATE_PEER on {}..."; public static final String SUCCESSFULLY_CREATE_PEER_ON = "Successfully CREATE_PEER on {}"; public static final String EXECUTING_ADD_PEER = "Executing ADD_PEER {}..."; public static final String SUCCESSFULLY_ADD_PEER = "Successfully ADD_PEER {}"; - public static final String THE_CONFIGNODE_IS_SUCCESSFULLY_ADDED_TO_THE_CLUSTER = "The ConfigNode: {} is successfully added to the cluster"; + public static final String THE_CONFIGNODE_IS_SUCCESSFULLY_ADDED_TO_THE_CLUSTER = + "The ConfigNode: {} is successfully added to the cluster"; public static final String ROLLBACK_CREATE_PEER_FOR = "Rollback CREATE_PEER for: {}"; public static final String ROLLBACK_ADD_PEER_FOR = "Rollback ADD_PEER for: {}"; - public static final String ERROR_IN_DESERIALIZE_ADDCONFIGNODEPROCEDURE = "Error in deserialize AddConfigNodeProcedure"; + public static final String ERROR_IN_DESERIALIZE_ADDCONFIGNODEPROCEDURE = + "Error in deserialize AddConfigNodeProcedure"; public static final String REMOVE_PEER_FOR_CONFIGNODE = "Remove peer for ConfigNode: {}"; public static final String DELETE_PEER_FOR_CONFIGNODE = "Delete peer for ConfigNode: {}"; public static final String STOP_AND_CLEAR_CONFIGNODE = "Stop and clear ConfigNode: {}"; - public static final String ERROR_IN_DESERIALIZE_REMOVECONFIGNODEPROCEDURE = "Error in deserialize RemoveConfigNodeProcedure"; - public static final String DATAPARTITIONINTEGRITY_ERROR_EXECUTING_STATE = "[DataPartitionIntegrity] Error executing state {}: {}"; - public static final String COLLECTING_EARLIEST_TIMESLOTS_FROM_ALL_DATANODES = "Collecting earliest timeslots from all DataNodes..."; - public static final String ANALYZING_MISSING_DATA_PARTITIONS = "Analyzing missing data partitions..."; - public static final String CHECKING_DATAPARTITIONTABLE_GENERATION_COMPLETION_STATUS = "Checking DataPartitionTable generation completion status..."; - public static final String MERGING_DATAPARTITIONTABLES_FROM_DATANODES = "Merging DataPartitionTables from {} DataNodes..."; - public static final String DATAPARTITIONINTEGRITY_DATAPARTITIONTABLES_MERGE_COMPLETED_SUCCESSFULLY = "[DataPartitionIntegrity] DataPartitionTables merge completed successfully"; - public static final String WRITING_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = "Writing DataPartitionTable to consensus log..."; - public static final String DATAPARTITIONINTEGRITY_NO_DATABASE_LOST_DATA_PARTITION_TABLE = "[DataPartitionIntegrity] No database lost data partition table"; - public static final String DATAPARTITIONINTEGRITY_DATAPARTITIONTABLE_TO_WRITE_TO_CONSENSUS = "[DataPartitionIntegrity] DataPartitionTable to write to consensus"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_WRITE_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = "[DataPartitionIntegrity] Failed to write DataPartitionTable to consensus log"; - public static final String DATAPARTITIONINTEGRITY_ERROR_WRITING_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = "[DataPartitionIntegrity] Error writing DataPartitionTable to consensus log"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_SERIALIZE_SKIPDATANODE = "[DataPartitionIntegrity] Failed to serialize skipDataNode"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_SERIALIZE_FAILEDDATANODE = "[DataPartitionIntegrity] Failed to serialize failedDataNode"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_DESERIALIZE_SKIPDATANODE = "[DataPartitionIntegrity] Failed to deserialize skipDataNode"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_DESERIALIZE_FAILEDDATANODE = "[DataPartitionIntegrity] Failed to deserialize failedDataNode"; - public static final String DATAPARTITIONINTEGRITY_SKIPPING_EMPTY_BYTEBUFFER_DURING_DESERIALIZATION = "[DataPartitionIntegrity] Skipping empty ByteBuffer during deserialization"; - public static final String NOT_FIND_REGION_REPLICA_NODES_IN_CREATEPEER_REGIONID = "Not find region replica nodes in createPeer, regionId: "; - public static final String SIMPLECONSENSUS_PROTOCOL_IS_NOT_SUPPORTED_TO_REMOVE_DATA_NODE = "SimpleConsensus protocol is not supported to remove data node"; - public static final String FAILED_TO_REMOVE_ALL_REQUESTED_DATA_NODES = "Failed to remove all requested data nodes"; - public static final String THERE_EXIST_DATA_NODE_IN_REQUEST_BUT_NOT_IN_CLUSTER = "there exist Data Node in request but not in cluster"; + public static final String ERROR_IN_DESERIALIZE_REMOVECONFIGNODEPROCEDURE = + "Error in deserialize RemoveConfigNodeProcedure"; + public static final String DATAPARTITIONINTEGRITY_ERROR_EXECUTING_STATE = + "[DataPartitionIntegrity] Error executing state {}: {}"; + public static final String COLLECTING_EARLIEST_TIMESLOTS_FROM_ALL_DATANODES = + "Collecting earliest timeslots from all DataNodes..."; + public static final String ANALYZING_MISSING_DATA_PARTITIONS = + "Analyzing missing data partitions..."; + public static final String CHECKING_DATAPARTITIONTABLE_GENERATION_COMPLETION_STATUS = + "Checking DataPartitionTable generation completion status..."; + public static final String MERGING_DATAPARTITIONTABLES_FROM_DATANODES = + "Merging DataPartitionTables from {} DataNodes..."; + public static final String + DATAPARTITIONINTEGRITY_DATAPARTITIONTABLES_MERGE_COMPLETED_SUCCESSFULLY = + "[DataPartitionIntegrity] DataPartitionTables merge completed successfully"; + public static final String WRITING_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = + "Writing DataPartitionTable to consensus log..."; + public static final String DATAPARTITIONINTEGRITY_NO_DATABASE_LOST_DATA_PARTITION_TABLE = + "[DataPartitionIntegrity] No database lost data partition table"; + public static final String DATAPARTITIONINTEGRITY_DATAPARTITIONTABLE_TO_WRITE_TO_CONSENSUS = + "[DataPartitionIntegrity] DataPartitionTable to write to consensus"; + public static final String + DATAPARTITIONINTEGRITY_FAILED_TO_WRITE_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = + "[DataPartitionIntegrity] Failed to write DataPartitionTable to consensus log"; + public static final String + DATAPARTITIONINTEGRITY_ERROR_WRITING_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = + "[DataPartitionIntegrity] Error writing DataPartitionTable to consensus log"; + public static final String DATAPARTITIONINTEGRITY_FAILED_TO_SERIALIZE_SKIPDATANODE = + "[DataPartitionIntegrity] Failed to serialize skipDataNode"; + public static final String DATAPARTITIONINTEGRITY_FAILED_TO_SERIALIZE_FAILEDDATANODE = + "[DataPartitionIntegrity] Failed to serialize failedDataNode"; + public static final String DATAPARTITIONINTEGRITY_FAILED_TO_DESERIALIZE_SKIPDATANODE = + "[DataPartitionIntegrity] Failed to deserialize skipDataNode"; + public static final String DATAPARTITIONINTEGRITY_FAILED_TO_DESERIALIZE_FAILEDDATANODE = + "[DataPartitionIntegrity] Failed to deserialize failedDataNode"; + public static final String + DATAPARTITIONINTEGRITY_SKIPPING_EMPTY_BYTEBUFFER_DURING_DESERIALIZATION = + "[DataPartitionIntegrity] Skipping empty ByteBuffer during deserialization"; + public static final String NOT_FIND_REGION_REPLICA_NODES_IN_CREATEPEER_REGIONID = + "Not find region replica nodes in createPeer, regionId: "; + public static final String SIMPLECONSENSUS_PROTOCOL_IS_NOT_SUPPORTED_TO_REMOVE_DATA_NODE = + "SimpleConsensus protocol is not supported to remove data node"; + public static final String FAILED_TO_REMOVE_ALL_REQUESTED_DATA_NODES = + "Failed to remove all requested data nodes"; + public static final String THERE_EXIST_DATA_NODE_IN_REQUEST_BUT_NOT_IN_CLUSTER = + "there exist Data Node in request but not in cluster"; + + public static final String FAILED_IN_THE_WRITE_API_EXECUTING_THE_CONSENSUS_LAYER_DUE = + "Failed in the write API executing the consensus layer due to: "; - public static final String FAILED_IN_THE_WRITE_API_EXECUTING_THE_CONSENSUS_LAYER_DUE = "Failed in the write API executing the consensus layer due to: "; private ProcedureMessages() {} } diff --git a/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java b/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java index 5b8c1a85c7fc4..2cef2c24235fc 100644 --- a/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java +++ b/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java @@ -66,8 +66,9 @@ public final class ProcedureMessages { "AlterTableColumnDataType-{}.{}-{} costs {}ms"; public static final String ALTERTIMESERIESDATATYPE_COSTS_MS = "AlterTimeSeriesDataType-{}-[{}] costs {}ms"; - public static final String ALTERTOPICPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES_TRY_TO_ALTER_TOPIC = - "AlterTopicProcedure: executeFromOperateOnConfigNodes, try to alter topic"; + public static final String + ALTERTOPICPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES_TRY_TO_ALTER_TOPIC = + "AlterTopicProcedure: executeFromOperateOnConfigNodes, try to alter topic"; public static final String ALTERTOPICPROCEDURE_EXECUTEFROMOPERATEONDATANODES = "AlterTopicProcedure: executeFromOperateOnDataNodes({})"; public static final String ALTERTOPICPROCEDURE_EXECUTEFROMVALIDATE = @@ -98,8 +99,9 @@ public final class ProcedureMessages { "{}, Begin to stop DataNodes and kill the DataNode process: {}"; public static final String BROADCASTDATANODESTATUSCHANGE_FINISHED_DATANODE = "{}, BroadcastDataNodeStatusChange finished, dataNode: {}"; - public static final String BROADCASTDATANODESTATUSCHANGE_MEETS_ERROR_STATUS_CHANGE_DATANODES_ERROR_DATANODE = - "{}, BroadcastDataNodeStatusChange meets error, status change dataNodes: {}, error datanode: {}"; + public static final String + BROADCASTDATANODESTATUSCHANGE_MEETS_ERROR_STATUS_CHANGE_DATANODES_ERROR_DATANODE = + "{}, BroadcastDataNodeStatusChange meets error, status change dataNodes: {}, error datanode: {}"; public static final String BROADCASTDATANODESTATUSCHANGE_START_DATANODE = "{}, BroadcastDataNodeStatusChange start, dataNode: {}"; public static final String CALL_CHANGEREGIONLEADER_FAIL_FOR_THE_TIME_WILL_SLEEP_MS = @@ -110,8 +112,9 @@ public final class ProcedureMessages { "{}, Cannot find region replica nodes in createPeer, regionId: {}"; public static final String CANNOT_FIND_REGION_REPLICA_NODES_REGION = "Cannot find region replica nodes, region: {}"; - public static final String CATCH_EXCEPTION_WHILE_DESERIALIZING_PROCEDURE_THIS_PROCEDURE_WILL_BE_IGNORED = - "Catch exception while deserializing procedure, this procedure will be ignored."; + public static final String + CATCH_EXCEPTION_WHILE_DESERIALIZING_PROCEDURE_THIS_PROCEDURE_WILL_BE_IGNORED = + "Catch exception while deserializing procedure, this procedure will be ignored."; public static final String CHANGE_REGION_LEADER_FINISHED_REGIONID_NEWLEADERNODE = "{}, Change region leader finished, regionId: {}, newLeaderNode: {}"; public static final String CHECK_AND_INVALIDATE_COLUMN_IN_WHEN_ALTERING_COLUMN_DATA_TYPE = @@ -153,12 +156,14 @@ public final class ProcedureMessages { public static final String COMMIT_RELEASE_TABLE = "Commit release table {}.{}"; public static final String COMMIT_SET_SCHEMAENGINE_TEMPLATE_ON_PATH = "Commit set schemaengine template {} on path {}"; - public static final String CONSENSUSPIPEGUARDIAN_CONSENSUS_PIPE_IS_STOPPED_RESTARTING_ASYNCHRONOUSLY = - "[ConsensusPipeGuardian] consensus pipe [{}] is stopped, restarting asynchronously"; + public static final String + CONSENSUSPIPEGUARDIAN_CONSENSUS_PIPE_IS_STOPPED_RESTARTING_ASYNCHRONOUSLY = + "[ConsensusPipeGuardian] consensus pipe [{}] is stopped, restarting asynchronously"; public static final String CONSENSUSPIPEGUARDIAN_CONSENSUS_PIPE_MISSING_CREATING_ASYNCHRONOUSLY = "[ConsensusPipeGuardian] consensus pipe [{}] missing, creating asynchronously"; - public static final String CONSENSUSPIPEGUARDIAN_UNEXPECTED_CONSENSUS_PIPE_EXISTS_DROPPING_ASYNCHRONOUSLY = - "[ConsensusPipeGuardian] unexpected consensus pipe [{}] exists, dropping asynchronously"; + public static final String + CONSENSUSPIPEGUARDIAN_UNEXPECTED_CONSENSUS_PIPE_EXISTS_DROPPING_ASYNCHRONOUSLY = + "[ConsensusPipeGuardian] unexpected consensus pipe [{}] exists, dropping asynchronously"; public static final String CONSTRUCT_SCHEMAENGINE_BLACK_LIST_OF_DEVICES_IN = "Construct schemaEngine black list of devices in {}.{}"; public static final String CONSTRUCT_SCHEMAENGINE_BLACK_LIST_OF_TEMPLATE_SET_ON = @@ -217,12 +222,15 @@ public final class ProcedureMessages { "CreatePipeProcedureV2: rollbackFromValidateTask({})"; public static final String CREATEPIPEPROCEDUREV2_ROLLBACKFROMWRITECONFIGNODECONSENSUS = "CreatePipeProcedureV2: rollbackFromWriteConfigNodeConsensus({})"; - public static final String CREATEREGIONGROUPS_ALL_REPLICAS_OF_REGIONGROUP_ARE_CREATED_SUCCESSFULLY = - "[CreateRegionGroups] All replicas of RegionGroup: {} are created successfully!"; - public static final String CREATEREGIONGROUPS_FAILED_TO_CREATE_MOST_OF_REPLICAS_IN_REGIONGROUP_THE = - "[CreateRegionGroups] Failed to create most of replicas in RegionGroup: {}, The redundant replicas in this RegionGroup will be deleted."; - public static final String CREATEREGIONGROUPS_FAILED_TO_CREATE_SOME_REPLICAS_OF_REGIONGROUP_BUT_THIS = - "[CreateRegionGroups] Failed to create some replicas of RegionGroup: {}, but this RegionGroup can still be used."; + public static final String + CREATEREGIONGROUPS_ALL_REPLICAS_OF_REGIONGROUP_ARE_CREATED_SUCCESSFULLY = + "[CreateRegionGroups] All replicas of RegionGroup: {} are created successfully!"; + public static final String + CREATEREGIONGROUPS_FAILED_TO_CREATE_MOST_OF_REPLICAS_IN_REGIONGROUP_THE = + "[CreateRegionGroups] Failed to create most of replicas in RegionGroup: {}, The redundant replicas in this RegionGroup will be deleted."; + public static final String + CREATEREGIONGROUPS_FAILED_TO_CREATE_SOME_REPLICAS_OF_REGIONGROUP_BUT_THIS = + "[CreateRegionGroups] Failed to create some replicas of RegionGroup: {}, but this RegionGroup can still be used."; public static final String CREATESUBSCRIPTIONPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES = "CreateSubscriptionProcedure: executeFromOperateOnConfigNodes"; public static final String CREATESUBSCRIPTIONPROCEDURE_EXECUTEFROMOPERATEONDATANODES = @@ -373,8 +381,9 @@ public final class ProcedureMessages { "Failed to commit set template {} on path {} due to {}"; public static final String FAILED_TO_CREATE_CONSENSUS_PIPE = "{}, Failed to create consensus pipe {}: {}"; - public static final String FAILED_TO_CREATE_PIPES_WHEN_CREATING_SUBSCRIPTION_WITH_REQUEST_DETAILS = - "Failed to create pipes %s when creating subscription with request %s, details: %s, metadata will be synchronized later."; + public static final String + FAILED_TO_CREATE_PIPES_WHEN_CREATING_SUBSCRIPTION_WITH_REQUEST_DETAILS = + "Failed to create pipes %s when creating subscription with request %s, details: %s, metadata will be synchronized later."; public static final String FAILED_TO_CREATE_PIPE_DETAILS_METADATA_WILL_BE_SYNCHRONIZED_LATER = "Failed to create pipe {}, details: {}, metadata will be synchronized later."; public static final String FAILED_TO_CREATE_PIPE_PLUGIN_INSTANCE_ON_DATA_NODES = @@ -455,8 +464,9 @@ public final class ProcedureMessages { "Failed to rollback alter pipe {}, details: {}, metadata will be synchronized later."; public static final String FAILED_TO_ROLLBACK_COMMIT_SET_TEMPLATE_ON_PATH_DUE_TO = "Failed to rollback commit set template {} on path {} due to {}"; - public static final String FAILED_TO_ROLLBACK_CREATE_PIPES_WHEN_CREATING_SUBSCRIPTION_WITH_REQUEST = - "Failed to rollback create pipes when creating subscription with request %s, because %s"; + public static final String + FAILED_TO_ROLLBACK_CREATE_PIPES_WHEN_CREATING_SUBSCRIPTION_WITH_REQUEST = + "Failed to rollback create pipes when creating subscription with request %s, because %s"; public static final String FAILED_TO_ROLLBACK_CREATE_PIPE_DETAILS_METADATA_WILL_BE_SYNCHRONIZED = "Failed to rollback create pipe {}, details: {}, metadata will be synchronized later."; public static final String FAILED_TO_ROLLBACK_CREATING_SUBSCRIPTION_WITH_REQUEST_ON_CONFIG_NODES = @@ -575,6 +585,9 @@ public final class ProcedureMessages { "Invalidate view schemaengine cache failed"; public static final String INVALIDATING_CACHE_FOR_COLUMN_IN_WHEN_DROPPING_COLUMN = "Invalidating cache for column {} in {}.{} when dropping column"; + public static final String PRE_RELEASE_DELETE_TABLE_WHEN_DROPPING_TABLE = "执行表删除操作流程时,预删除表 {}.{}"; + public static final String COMMIT_RELEASE_DELETE_TABLE_WHEN_DROPPING_TABLE = + "执行删除表操作流程时,正式删除表 {}.{}"; public static final String INVALIDATING_CACHE_FOR_TABLE_WHEN_DROPPING_TABLE = "Invalidating cache for table {}.{} when dropping table"; public static final String INVALID_DATA_TYPE_CANNOT_BE_USED_AS_A_NEW_TYPE = @@ -593,10 +606,12 @@ public final class ProcedureMessages { public static final String OPERATION_TIMED_OUT_AFTER = "Operation timed out after "; public static final String PARTITION_TABLE_CLEANER_ACTIVATE_TTL_LOG = "[PartitionTableCleaner] Periodically activate PartitionTableAutoCleaner, databaseTTL: {}"; - public static final String PARTITIONTABLECLEANER_PERIODICALLY_ACTIVATE_PARTITIONTABLEAUTOCLEANER_FOR = - "[PartitionTableCleaner] Periodically activate PartitionTableAutoCleaner for: {}"; - public static final String PARTITIONTABLECLEANER_THE_PARTITIONTABLEAUTOCLEANER_IS_STARTED_WITH_CYCLE_MS = - "[PartitionTableCleaner] The PartitionTableAutoCleaner is started with cycle={}ms"; + public static final String + PARTITIONTABLECLEANER_PERIODICALLY_ACTIVATE_PARTITIONTABLEAUTOCLEANER_FOR = + "[PartitionTableCleaner] Periodically activate PartitionTableAutoCleaner for: {}"; + public static final String + PARTITIONTABLECLEANER_THE_PARTITIONTABLEAUTOCLEANER_IS_STARTED_WITH_CYCLE_MS = + "[PartitionTableCleaner] The PartitionTableAutoCleaner is started with cycle={}ms"; public static final String PID_ADDREGION_CANNOT_ROLL_BACK_BECAUSE_CANNOT_FIND_THE_CORRECT = "[pid{}][AddRegion] Cannot roll back, because cannot find the correct locations"; public static final String PID_ADDREGION_IT_APPEARS_THAT_CONSENSUS_WRITE_HAS_NOT_MODIFIED = @@ -632,8 +647,9 @@ public final class ProcedureMessages { public static final String PID_MIGRATEREGION_STATE_FAIL = "[pid{}][MigrateRegion] state {} fail"; public static final String PID_MIGRATEREGION_SUB_PROCEDURE_ADDREGIONPEERPROCEDURE = "[pid{}][MigrateRegion] sub-procedure AddRegionPeerProcedure failed, RegionMigrateProcedure will not continue"; - public static final String PID_MIGRATEREGION_SUCCESS_HAS_BEEN_MIGRATED_FROM_DATANODE_TO_PROCEDURE = - "[pid{}][MigrateRegion] success,{} {} has been migrated from DataNode {} to {}. Procedure took {} (started at {})."; + public static final String + PID_MIGRATEREGION_SUCCESS_HAS_BEEN_MIGRATED_FROM_DATANODE_TO_PROCEDURE = + "[pid{}][MigrateRegion] success,{} {} has been migrated from DataNode {} to {}. Procedure took {} (started at {})."; public static final String PID_NOTIFYREGIONMIGRATION_STARTED_REGION_ID_IS = "[pid{}][NotifyRegionMigration] started, region id is {}."; public static final String PID_NOTIFYREGIONMIGRATION_STATE_COMPLETE = @@ -642,8 +658,9 @@ public final class ProcedureMessages { "[pid{}][NotifyRegionMigration] state {} failed"; public static final String PID_RECONSTRUCTREGION_FAILED_BUT_THE_REGION_HAS_BEEN_REMOVED_FROM = "[pid{}][ReconstructRegion] failed, but the region {} has been removed from DataNode {}. Use 'extend region' to fix this."; - public static final String PID_RECONSTRUCTREGION_STARTED_REGION_ON_DATANODE_WILL_BE_RECONSTRUCTED = - "[pid{}][ReconstructRegion] started, region {} on DataNode {}({}) will be reconstructed."; + public static final String + PID_RECONSTRUCTREGION_STARTED_REGION_ON_DATANODE_WILL_BE_RECONSTRUCTED = + "[pid{}][ReconstructRegion] started, region {} on DataNode {}({}) will be reconstructed."; public static final String PID_RECONSTRUCTREGION_STATE_COMPLETE = "[pid{}][ReconstructRegion] state {} complete"; public static final String PID_RECONSTRUCTREGION_STATE_FAIL = @@ -652,24 +669,28 @@ public final class ProcedureMessages { "[pid{}][ReconstructRegion] sub-procedure RemoveRegionPeerProcedure failed, ReconstructRegionProcedure will not continue"; public static final String PID_RECONSTRUCTREGION_SUCCESS_REGION_HAS_BEEN_RECONSTRUCTED = "[pid{}][ReconstructRegion] success, region {} has been reconstructed on DataNode {}. Procedure took {} (started at {})"; - public static final String PID_REMOVEREGION_DELETE_OLD_REGION_PEER_EXECUTED_FAILED_AFTER_ATTEMPTS = - "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER executed failed after {} attempts, procedure will continue. You should manually delete region file. {}"; + public static final String + PID_REMOVEREGION_DELETE_OLD_REGION_PEER_EXECUTED_FAILED_AFTER_ATTEMPTS = + "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER executed failed after {} attempts, procedure will continue. You should manually delete region file. {}"; public static final String PID_REMOVEREGION_DELETE_OLD_REGION_PEER_EXECUTED_FAILED_ATTEMPT_WILL = "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER executed failed (attempt {}/{}), will retry after {}ms. {}"; public static final String PID_REMOVEREGION_DELETE_OLD_REGION_PEER_TASK_SUBMITTED_FAILED_AFTER = "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER task submitted failed after {} attempts, procedure will continue. You should manually delete region file. {}"; public static final String PID_REMOVEREGION_DELETE_OLD_REGION_PEER_TASK_SUBMITTED_FAILED_ATTEMPT = "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER task submitted failed (attempt {}/{}), will retry after {}ms. {}"; - public static final String PID_REMOVEREGION_EXECUTED_FAILED_CONFIGNODE_BELIEVE_CURRENT_PEER_LIST_OF = - "[pid{}][RemoveRegion] {} executed failed, ConfigNode believe current peer list of {} is {}. Procedure will continue. You should manually clear peer list."; + public static final String + PID_REMOVEREGION_EXECUTED_FAILED_CONFIGNODE_BELIEVE_CURRENT_PEER_LIST_OF = + "[pid{}][RemoveRegion] {} executed failed, ConfigNode believe current peer list of {} is {}. Procedure will continue. You should manually clear peer list."; public static final String PID_REMOVEREGION_STARTED_REGION_WILL_BE_REMOVED_FROM_DATANODE = "[pid{}][RemoveRegion] started, region {} will be removed from DataNode {}."; public static final String PID_REMOVEREGION_STATE_SUCCESS = "[pid{}][RemoveRegion] state {} success"; - public static final String PID_REMOVEREGION_SUCCESS_REGION_HAS_BEEN_REMOVED_FROM_DATANODE_PROCEDURE = - "[pid{}][RemoveRegion] success, region {} has been removed from DataNode {}. Procedure took {} (started at {})"; - public static final String PID_REMOVEREGION_TASK_SUBMITTED_FAILED_CONFIGNODE_BELIEVE_CURRENT_PEER_LIST = - "[pid{}][RemoveRegion] {} task submitted failed, ConfigNode believe current peer list of {} is {}. Procedure will continue. You should manually clear peer list."; + public static final String + PID_REMOVEREGION_SUCCESS_REGION_HAS_BEEN_REMOVED_FROM_DATANODE_PROCEDURE = + "[pid{}][RemoveRegion] success, region {} has been removed from DataNode {}. Procedure took {} (started at {})"; + public static final String + PID_REMOVEREGION_TASK_SUBMITTED_FAILED_CONFIGNODE_BELIEVE_CURRENT_PEER_LIST = + "[pid{}][RemoveRegion] {} task submitted failed, ConfigNode believe current peer list of {} is {}. Procedure will continue. You should manually clear peer list."; public static final String PIPEHANDLELEADERCHANGEPROCEDURE_EXECUTEFROMCALCULATEINFOFORTASK = "PipeHandleLeaderChangeProcedure: executeFromCalculateInfoForTask"; public static final String PIPEHANDLELEADERCHANGEPROCEDURE_EXECUTEFROMHANDLEONCONFIGNODES = @@ -702,8 +723,9 @@ public final class ProcedureMessages { "PipeHandleMetaChangeProcedure: rollbackFromValidateTask"; public static final String PIPEHANDLEMETACHANGEPROCEDURE_ROLLBACKFROMWRITECONFIGNODECONSENSUS = "PipeHandleMetaChangeProcedure: rollbackFromWriteConfigNodeConsensus"; - public static final String PIPEMETASYNCPROCEDURE_ACQUIRELOCK_SKIP_THE_PROCEDURE_DUE_TO_THE_LAST_EXECUTION = - "PipeMetaSyncProcedure: acquireLock, skip the procedure due to the last execution time {}"; + public static final String + PIPEMETASYNCPROCEDURE_ACQUIRELOCK_SKIP_THE_PROCEDURE_DUE_TO_THE_LAST_EXECUTION = + "PipeMetaSyncProcedure: acquireLock, skip the procedure due to the last execution time {}"; public static final String PIPEMETASYNCPROCEDURE_EXECUTEFROMCALCULATEINFOFORTASK = "PipeMetaSyncProcedure: executeFromCalculateInfoForTask"; public static final String PIPEMETASYNCPROCEDURE_EXECUTEFROMOPERATEONDATANODES = @@ -722,8 +744,9 @@ public final class ProcedureMessages { "PipeMetaSyncProcedure: rollbackFromWriteConfigNodeConsensus"; public static final String PIPE_NOT_FOUND_IN_PIPETASKINFO_CAN_NOT_PUSH_ITS_META = "Pipe {} not found in PipeTaskInfo, can not push its meta."; - public static final String PIPE_PLUGIN_IS_ALREADY_CREATED_AND_ISSETIFNOTEXISTSCONDITION_IS_TRUE_END = - "Pipe plugin {} is already created and isSetIfNotExistsCondition is true, end the CreatePipePluginProcedure({})"; + public static final String + PIPE_PLUGIN_IS_ALREADY_CREATED_AND_ISSETIFNOTEXISTSCONDITION_IS_TRUE_END = + "Pipe plugin {} is already created and isSetIfNotExistsCondition is true, end the CreatePipePluginProcedure({})"; public static final String PIPE_PLUGIN_IS_ALREADY_CREATED_END_THE_CREATEPIPEPLUGINPROCEDURE = "Pipe plugin {} is already created, end the CreatePipePluginProcedure({})"; public static final String PIPE_PLUGIN_IS_NOT_EXIST_END_THE_DROPPIPEPLUGINPROCEDURE = @@ -778,16 +801,21 @@ public final class ProcedureMessages { "ProcedureId {}: {}. Invalid lock state. Without acquiring pipe lock."; public static final String PROCEDUREID_INVALID_LOCK_STATE_WITHOUT_ACQUIRING_SUBSCRIPTION_LOCK = "ProcedureId {}: {}. Invalid lock state. Without acquiring subscription lock."; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH = - "ProcedureId {}: LOCK_ACQUIRED. The following procedure should be executed with pipe lock."; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH_2 = - "ProcedureId {}: LOCK_ACQUIRED. The following procedure should be executed with subscription and pipe lock."; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH_3 = - "ProcedureId {}: LOCK_ACQUIRED. The following procedure should be executed with subscription lock."; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_NOT_BE_EXECUTED = - "ProcedureId {}: LOCK_ACQUIRED. The following procedure should not be executed without pipe lock."; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_NOT_BE_EXECUTED_2 = - "ProcedureId {}: LOCK_ACQUIRED. The following procedure should not be executed without subscription lock."; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH = + "ProcedureId {}: LOCK_ACQUIRED. The following procedure should be executed with pipe lock."; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH_2 = + "ProcedureId {}: LOCK_ACQUIRED. The following procedure should be executed with subscription and pipe lock."; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH_3 = + "ProcedureId {}: LOCK_ACQUIRED. The following procedure should be executed with subscription lock."; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_NOT_BE_EXECUTED = + "ProcedureId {}: LOCK_ACQUIRED. The following procedure should not be executed without pipe lock."; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_NOT_BE_EXECUTED_2 = + "ProcedureId {}: LOCK_ACQUIRED. The following procedure should not be executed without subscription lock."; public static final String PROCEDUREID_LOCK_EVENT_WAIT_PIPE_LOCK_WILL_BE_RELEASED = "ProcedureId {}: LOCK_EVENT_WAIT. Pipe lock will be released."; public static final String PROCEDUREID_LOCK_EVENT_WAIT_SUBSCRIPTION_LOCK_WILL_BE_RELEASED = @@ -796,8 +824,9 @@ public final class ProcedureMessages { "ProcedureId {}: LOCK_EVENT_WAIT. Without acquiring pipe lock."; public static final String PROCEDUREID_LOCK_EVENT_WAIT_WITHOUT_ACQUIRING_SUBSCRIPTION_LOCK = "ProcedureId {}: LOCK_EVENT_WAIT. Without acquiring subscription lock."; - public static final String PROCEDUREID_PIPE_LOCK_IS_NOT_ACQUIRED_EXECUTEFROMSTATE_S_EXECUTION_WILL = - "ProcedureId {}: Pipe lock is not acquired, executeFromState's execution will be skipped."; + public static final String + PROCEDUREID_PIPE_LOCK_IS_NOT_ACQUIRED_EXECUTEFROMSTATE_S_EXECUTION_WILL = + "ProcedureId {}: Pipe lock is not acquired, executeFromState's execution will be skipped."; public static final String PROCEDUREID_PIPE_LOCK_IS_NOT_ACQUIRED_ROLLBACKSTATE_S_EXECUTION_WILL = "ProcedureId {}: Pipe lock is not acquired, rollbackState({})'s execution will be skipped."; public static final String PROCEDUREID_RELEASE_LOCK_NO_NEED_TO_RELEASE_PIPE_LOCK = @@ -808,10 +837,12 @@ public final class ProcedureMessages { "ProcedureId {} release lock. Pipe lock will be released."; public static final String PROCEDUREID_RELEASE_LOCK_SUBSCRIPTION_LOCK_WILL_BE_RELEASED = "ProcedureId {} release lock. Subscription lock will be released."; - public static final String PROCEDUREID_SUBSCRIPTION_LOCK_IS_NOT_ACQUIRED_EXECUTEFROMSTATE_S_EXECUTION_WILL = - "ProcedureId {}: Subscription lock is not acquired, executeFromState({})'s execution will be skipped."; - public static final String PROCEDUREID_SUBSCRIPTION_LOCK_IS_NOT_ACQUIRED_ROLLBACKSTATE_S_EXECUTION_WILL = - "ProcedureId {}: Subscription lock is not acquired, rollbackState({})'s execution will be skipped."; + public static final String + PROCEDUREID_SUBSCRIPTION_LOCK_IS_NOT_ACQUIRED_EXECUTEFROMSTATE_S_EXECUTION_WILL = + "ProcedureId {}: Subscription lock is not acquired, executeFromState({})'s execution will be skipped."; + public static final String + PROCEDUREID_SUBSCRIPTION_LOCK_IS_NOT_ACQUIRED_ROLLBACKSTATE_S_EXECUTION_WILL = + "ProcedureId {}: Subscription lock is not acquired, rollbackState({})'s execution will be skipped."; public static final String PROCEDUREID_TRY_TO_ACQUIRE_PIPE_LOCK = "ProcedureId {} try to acquire pipe lock."; public static final String PROCEDUREID_TRY_TO_ACQUIRE_SUBSCRIPTION_AND_PIPE_LOCK = @@ -844,6 +875,7 @@ public final class ProcedureMessages { public static final String ROLLBACK_CREATETABLE_COSTS_MS = "Rollback CreateTable-{} costs {}ms."; public static final String ROLLBACK_CREATE_TABLE_FAILED = "Rollback create table failed"; public static final String ROLLBACK_DROPTABLE_COSTS_MS = "Rollback DropTable-{} costs {}ms."; + public static final String ROLLBACK_PRE_DELETE_TABLE_FAILED = "回滚预删除表 %s.%s 操作失败, 请手动输入sql删除"; public static final String ROLLBACK_PRE_RELEASE = "Rollback pre-release "; public static final String ROLLBACK_PRE_RELEASE_TEMPLATE_FAILED = "Rollback pre release template failed"; @@ -856,13 +888,16 @@ public final class ProcedureMessages { public static final String ROLLBACK_TEMPLATE_CACHE_FAILED = "Rollback template cache failed"; public static final String ROLLBACK_TEMPLATE_PRE_UNSET_FAILED_BECAUSE_OF = "Rollback template pre unset failed because of"; - public static final String ROLLBACK_UNSET_TEMPLATE_FAILED_AND_THE_CLUSTER_TEMPLATE_INFO_MANAGEMENT = - "Rollback unset template failed and the cluster template info management is strictly broken. Please try unset again."; + public static final String + ROLLBACK_UNSET_TEMPLATE_FAILED_AND_THE_CLUSTER_TEMPLATE_INFO_MANAGEMENT = + "Rollback unset template failed and the cluster template info management is strictly broken. Please try unset again."; public static final String SELECTED_DATANODE_FOR_REGION = "Selected DataNode {} for Region {}"; - public static final String SEND_ACTION_ADDREGIONPEER_FINISHED_REGIONID_RPCDATANODE_DESTDATANODE_STATUS = - "{}, Send action addRegionPeer finished, regionId: {}, rpcDataNode: {}, destDataNode: {}, status: {}"; - public static final String SEND_ACTION_CREATENEWREGIONPEER_ERROR_REGIONID_NEWPEERDATANODEID_RESULT = - "{}, Send action createNewRegionPeer error, regionId: {}, newPeerDataNodeId: {}, result: {}"; + public static final String + SEND_ACTION_ADDREGIONPEER_FINISHED_REGIONID_RPCDATANODE_DESTDATANODE_STATUS = + "{}, Send action addRegionPeer finished, regionId: {}, rpcDataNode: {}, destDataNode: {}, status: {}"; + public static final String + SEND_ACTION_CREATENEWREGIONPEER_ERROR_REGIONID_NEWPEERDATANODEID_RESULT = + "{}, Send action createNewRegionPeer error, regionId: {}, newPeerDataNodeId: {}, result: {}"; public static final String SEND_ACTION_CREATENEWREGIONPEER_FINISHED_REGIONID_NEWPEERDATANODEID = "{}, Send action createNewRegionPeer finished, regionId: {}, newPeerDataNodeId: {}"; public static final String SEND_ACTION_DELETEOLDREGIONPEER_FINISHED_REGIONID_DATANODEID = @@ -951,8 +986,9 @@ public final class ProcedureMessages { "{} task {} cannot get task report from DataNode {}, last report time is {} ago"; public static final String THE_UPDATED_TABLE_HAS_THE_SAME_PROPERTIES_WITH_THE_ORIGINAL = "The updated table has the same properties with the original one. Skip the procedure."; - public static final String TOPICMETASYNCPROCEDURE_ACQUIRELOCK_SKIP_THE_PROCEDURE_DUE_TO_THE_LAST_EXECUTION = - "TopicMetaSyncProcedure: acquireLock, skip the procedure due to the last execution time {}"; + public static final String + TOPICMETASYNCPROCEDURE_ACQUIRELOCK_SKIP_THE_PROCEDURE_DUE_TO_THE_LAST_EXECUTION = + "TopicMetaSyncProcedure: acquireLock, skip the procedure due to the last execution time {}"; public static final String TOPICMETASYNCPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES = "TopicMetaSyncProcedure: executeFromOperateOnConfigNodes"; public static final String TOPICMETASYNCPROCEDURE_EXECUTEFROMOPERATEONDATANODES = @@ -1001,42 +1037,53 @@ public final class ProcedureMessages { public static final String UNRECOGNIZED_SETTEMPLATESTATE = "Unrecognized SetTemplateState "; public static final String UNRECOGNIZED_STATE = "Unrecognized state "; public static final String UNSETTEMPLATE_COSTS_MS = "UnsetTemplate-[{}] costs {}ms"; - public static final String UNSET_TEMPLATE_FROM_FAILED_WHEN_CHECK_DATANODE_TEMPLATE_ACTIVATION_BECAUSE = - "Unset template %s from %s failed when [check DataNode template activation] because %s"; + public static final String + UNSET_TEMPLATE_FROM_FAILED_WHEN_CHECK_DATANODE_TEMPLATE_ACTIVATION_BECAUSE = + "Unset template %s from %s failed when [check DataNode template activation] because %s"; public static final String UNSET_TEMPLATE_ON = "Unset template {} on {}"; public static final String UNSUPPORTED_ROLL_BACK_STATE = "Unsupported roll back STATE [{}]"; public static final String UNSUPPORTED_STATE = "Unsupported state: "; public static final String UPDATE_DATANODE_TTL_CACHE_FAILED = "Update dataNode ttl cache failed"; public static final String VALIDATE_TABLE_FOR_TABLE_WHEN_SETTING_PROPERTIES = "Validate table for table {}.{} when setting properties"; - public static final String WAITTASKFINISH_RETURNS_PROCESSING_WHICH_MEANS_THE_WAITING_HAS_BEEN_INTERRUPTED = - "waitTaskFinish() 返回 PROCESSING,表示等待被中断(ConfigNode 关闭或主节点切换);AddRegionPeer 任务仍在协调者上运行,该流程将停留在 DO_ADD_REGION_PEER 状态,恢复后继续轮询"; + public static final String + WAITTASKFINISH_RETURNS_PROCESSING_WHICH_MEANS_THE_WAITING_HAS_BEEN_INTERRUPTED = + "waitTaskFinish() 返回 PROCESSING,表示等待被中断(ConfigNode 关闭或主节点切换);AddRegionPeer 任务仍在协调者上运行,该流程将停留在 DO_ADD_REGION_PEER 状态,恢复后继续轮询"; - public static final String FAILED_TO_CREATE_DATABASE_THE_TTL_SHOULD_BE_NON_NEGATIVE = "创建数据库失败。TTL 不能为负数。"; - public static final String FAILED_TO_CREATE_DATABASE_THE_DATAREGIONGROUPNUM_SHOULD_BE_POSITIVE = "创建数据库失败。dataRegionGroupNum 应为正数。"; + public static final String FAILED_TO_CREATE_DATABASE_THE_TTL_SHOULD_BE_NON_NEGATIVE = + "创建数据库失败。TTL 不能为负数。"; + public static final String FAILED_TO_CREATE_DATABASE_THE_DATAREGIONGROUPNUM_SHOULD_BE_POSITIVE = + "创建数据库失败。dataRegionGroupNum 应为正数。"; public static final String PID_FAILED_TO_PERSIST_LOCK_STATE_TO_STORE = "pid={} 持久化锁状态到存储失败。"; public static final String FORCE_WRITE_UNLOCK_STATE_TO_RAFT_FOR_PID = "强制写入解锁状态到 raft,pid={}"; public static final String PID_FAILED_TO_PERSIST_UNLOCK_STATE_TO_STORE = "pid={} 持久化解锁状态到存储失败。"; - public static final String DIDN_T_HOLD_THE_LOCK_BEFORE_RESTARTING_SKIP_ACQUIRING_LOCK = "{} 重启前未持有锁,跳过获取锁"; + public static final String DIDN_T_HOLD_THE_LOCK_BEFORE_RESTARTING_SKIP_ACQUIRING_LOCK = + "{} 重启前未持有锁,跳过获取锁"; public static final String IS_ALREADY_BYPASSED_SKIP_ACQUIRING_LOCK = "{} 已被绕过,跳过获取锁。"; - public static final String IS_IN_WAITING_STATE_AND_HOLDLOCK_FALSE_SKIP_ACQUIRING_LOCK = "{} 处于 WAITING 状态且 holdLock=false,跳过获取锁。"; - public static final String HELD_THE_LOCK_BEFORE_RESTARTING_CALL_ACQUIRELOCK_TO_RESTORE_IT = "{} 重启前持有锁,调用 acquireLock 恢复。"; + public static final String IS_IN_WAITING_STATE_AND_HOLDLOCK_FALSE_SKIP_ACQUIRING_LOCK = + "{} 处于 WAITING 状态且 holdLock=false,跳过获取锁。"; + public static final String HELD_THE_LOCK_BEFORE_RESTARTING_CALL_ACQUIRELOCK_TO_RESTORE_IT = + "{} 重启前持有锁,调用 acquireLock 恢复。"; public static final String CHILD_LATCH_INCREMENT_SET = "子锁计数器设置递增 "; public static final String CHILD_LATCH_INCREMENT = "子锁计数器递增 "; public static final String CHILD_LATCH_DECREMENT = "子锁计数器递减 "; public static final String UNEXPECTED_STATE_FOR = "意外状态:{} 对应 {}"; - public static final String OLD_PROCEDURE_DIRECTORY_DETECTED_UPGRADE_BEGINNING = "检测到旧的 procedure 目录,开始升级..."; + public static final String OLD_PROCEDURE_DIRECTORY_DETECTED_UPGRADE_BEGINNING = + "检测到旧的 procedure 目录,开始升级..."; public static final String ALREADY_RUNNING = "已在运行中"; public static final String PROCEDURE_WORKERS_ARE_STARTED = "{} 个 procedure 工作线程已启动。"; public static final String IS_ALREADY_FINISHED = "{} 已完成。"; - public static final String ROLLBACK_BECAUSE_PARENT_IS_DONE_ROLLEDBACK_PROC_IS = "因父流程已完成/已回滚而回滚,proc 为 {}"; + public static final String ROLLBACK_BECAUSE_PARENT_IS_DONE_ROLLEDBACK_PROC_IS = + "因父流程已完成/已回滚而回滚,proc 为 {}"; public static final String ROLLBACK_STACK_IS_NULL_FOR = "{} 的回滚栈为 null"; public static final String LOCK_EVENT_WAIT_ROLLBACK = "LOCK_EVENT_WAIT 回滚 {}"; - public static final String LOCK_EVENT_WAIT_CAN_T_ROLLBACK_CHILD_RUNNING_FOR = "LOCK_EVENT_WAIT 无法回滚正在运行的子流程 {}"; + public static final String LOCK_EVENT_WAIT_CAN_T_ROLLBACK_CHILD_RUNNING_FOR = + "LOCK_EVENT_WAIT 无法回滚正在运行的子流程 {}"; public static final String LOCKSTATE_IS = "{} 锁状态为 {}"; public static final String FINISHED_IN_MS_SUCCESSFULLY = "{} 在 {} 毫秒内成功完成。"; public static final String PROCEDUREID_WAIT_FOR_LOCK = "procedureId {} 等待锁。"; - public static final String INTERRUPT_DURING_EXECUTION_SUSPEND_OR_RETRY_IT_LATER = "执行期间被中断,稍后挂起或重试。"; + public static final String INTERRUPT_DURING_EXECUTION_SUSPEND_OR_RETRY_IT_LATER = + "执行期间被中断,稍后挂起或重试。"; public static final String CODE_BUG = "代码错误:{}"; public static final String INITIALIZED_SUB_PROCS = "初始化子流程:{}"; public static final String ADDED_INTO_TIMEOUTEXECUTOR = "已添加到超时执行器 {}"; @@ -1051,7 +1098,8 @@ public final class ProcedureMessages { public static final String INTERRUPTED_EXCEPTION_OCCURRED_FOR = "{} 发生中断异常"; public static final String CODE_BUG_RUNTIME_EXCEPTION_FOR = "代码错误:{} 发生运行时异常"; public static final String FAILED_TO_DELETE_PROCEDURE_ON_ROLLBACK = "回滚时删除流程失败"; - public static final String FAILED_TO_UPDATE_PROCEDURE_ON_ROLLBACK = "Failed to update procedure on rollback"; + public static final String FAILED_TO_UPDATE_PROCEDURE_ON_ROLLBACK = + "Failed to update procedure on rollback"; public static final String PROCEDURE_WORKER_TERMINATED = "Procedure 工作线程 {} 已终止。"; public static final String ADDED_NEW_WORKER_THREAD = "添加新工作线程 {}"; public static final String STOPPING = "正在停止"; @@ -1065,40 +1113,68 @@ public final class ProcedureMessages { public static final String START_TO_DROP_TRIGGER_ON_DATA_NODES = "开始在 DataNode 上删除触发器 [{}]"; public static final String START_TO_DROP_TRIGGER_ON_CONFIG_NODES = "开始在 ConfigNode 上删除触发器 [{}]"; public static final String DROP_TRIGGER_FAILED = "删除触发器 {} 失败。"; - public static final String ERROR_IN_DESERIALIZE_DELETEDATABASEPROCEDURE = "反序列化 DeleteDatabaseProcedure 出错"; + public static final String ERROR_IN_DESERIALIZE_DELETEDATABASEPROCEDURE = + "反序列化 DeleteDatabaseProcedure 出错"; public static final String EXECUTING_CREATE_PEER_ON = "正在执行 CREATE_PEER 于 {}..."; public static final String SUCCESSFULLY_CREATE_PEER_ON = "成功执行 CREATE_PEER 于 {}"; public static final String EXECUTING_ADD_PEER = "正在执行 ADD_PEER {}..."; public static final String SUCCESSFULLY_ADD_PEER = "成功执行 ADD_PEER {}"; - public static final String THE_CONFIGNODE_IS_SUCCESSFULLY_ADDED_TO_THE_CLUSTER = "ConfigNode {} 已成功加入集群"; + public static final String THE_CONFIGNODE_IS_SUCCESSFULLY_ADDED_TO_THE_CLUSTER = + "ConfigNode {} 已成功加入集群"; public static final String ROLLBACK_CREATE_PEER_FOR = "回滚 CREATE_PEER:{}"; public static final String ROLLBACK_ADD_PEER_FOR = "回滚 ADD_PEER:{}"; - public static final String ERROR_IN_DESERIALIZE_ADDCONFIGNODEPROCEDURE = "反序列化 AddConfigNodeProcedure 出错"; + public static final String ERROR_IN_DESERIALIZE_ADDCONFIGNODEPROCEDURE = + "反序列化 AddConfigNodeProcedure 出错"; public static final String REMOVE_PEER_FOR_CONFIGNODE = "移除 ConfigNode 的 peer:{}"; public static final String DELETE_PEER_FOR_CONFIGNODE = "删除 ConfigNode 的 peer:{}"; public static final String STOP_AND_CLEAR_CONFIGNODE = "停止并清理 ConfigNode:{}"; - public static final String ERROR_IN_DESERIALIZE_REMOVECONFIGNODEPROCEDURE = "反序列化 RemoveConfigNodeProcedure 出错"; - public static final String DATAPARTITIONINTEGRITY_ERROR_EXECUTING_STATE = "[DataPartitionIntegrity] 执行状态 {} 出错:{}"; - public static final String COLLECTING_EARLIEST_TIMESLOTS_FROM_ALL_DATANODES = "正在从所有 DataNode 收集最早时间槽..."; + public static final String ERROR_IN_DESERIALIZE_REMOVECONFIGNODEPROCEDURE = + "反序列化 RemoveConfigNodeProcedure 出错"; + public static final String DATAPARTITIONINTEGRITY_ERROR_EXECUTING_STATE = + "[DataPartitionIntegrity] 执行状态 {} 出错:{}"; + public static final String COLLECTING_EARLIEST_TIMESLOTS_FROM_ALL_DATANODES = + "正在从所有 DataNode 收集最早时间槽..."; public static final String ANALYZING_MISSING_DATA_PARTITIONS = "正在分析缺失的数据分区..."; - public static final String CHECKING_DATAPARTITIONTABLE_GENERATION_COMPLETION_STATUS = "正在检查 DataPartitionTable 生成完成状态..."; - public static final String MERGING_DATAPARTITIONTABLES_FROM_DATANODES = "正在合并来自 {} 个 DataNode 的 DataPartitionTable..."; - public static final String DATAPARTITIONINTEGRITY_DATAPARTITIONTABLES_MERGE_COMPLETED_SUCCESSFULLY = "[DataPartitionIntegrity] DataPartitionTable 合并成功"; - public static final String WRITING_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = "正在将 DataPartitionTable 写入共识日志..."; - public static final String DATAPARTITIONINTEGRITY_NO_DATABASE_LOST_DATA_PARTITION_TABLE = "[DataPartitionIntegrity] 没有数据库丢失数据分区表"; - public static final String DATAPARTITIONINTEGRITY_DATAPARTITIONTABLE_TO_WRITE_TO_CONSENSUS = "[DataPartitionIntegrity] 待写入共识的 DataPartitionTable"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_WRITE_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = "[DataPartitionIntegrity] 写入 DataPartitionTable 到共识日志失败"; - public static final String DATAPARTITIONINTEGRITY_ERROR_WRITING_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = "[DataPartitionIntegrity] 写入 DataPartitionTable 到共识日志出错"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_SERIALIZE_SKIPDATANODE = "[DataPartitionIntegrity] 序列化 skipDataNode 失败"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_SERIALIZE_FAILEDDATANODE = "[DataPartitionIntegrity] 序列化 failedDataNode 失败"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_DESERIALIZE_SKIPDATANODE = "[DataPartitionIntegrity] 反序列化 skipDataNode 失败"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_DESERIALIZE_FAILEDDATANODE = "[DataPartitionIntegrity] 反序列化 failedDataNode 失败"; - public static final String DATAPARTITIONINTEGRITY_SKIPPING_EMPTY_BYTEBUFFER_DURING_DESERIALIZATION = "[DataPartitionIntegrity] 反序列化时跳过空 ByteBuffer"; - public static final String NOT_FIND_REGION_REPLICA_NODES_IN_CREATEPEER_REGIONID = "在 createPeer 中未找到 region 副本节点,regionId:"; - public static final String SIMPLECONSENSUS_PROTOCOL_IS_NOT_SUPPORTED_TO_REMOVE_DATA_NODE = "SimpleConsensus 协议不支持移除数据节点"; + public static final String CHECKING_DATAPARTITIONTABLE_GENERATION_COMPLETION_STATUS = + "正在检查 DataPartitionTable 生成完成状态..."; + public static final String MERGING_DATAPARTITIONTABLES_FROM_DATANODES = + "正在合并来自 {} 个 DataNode 的 DataPartitionTable..."; + public static final String + DATAPARTITIONINTEGRITY_DATAPARTITIONTABLES_MERGE_COMPLETED_SUCCESSFULLY = + "[DataPartitionIntegrity] DataPartitionTable 合并成功"; + public static final String WRITING_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = + "正在将 DataPartitionTable 写入共识日志..."; + public static final String DATAPARTITIONINTEGRITY_NO_DATABASE_LOST_DATA_PARTITION_TABLE = + "[DataPartitionIntegrity] 没有数据库丢失数据分区表"; + public static final String DATAPARTITIONINTEGRITY_DATAPARTITIONTABLE_TO_WRITE_TO_CONSENSUS = + "[DataPartitionIntegrity] 待写入共识的 DataPartitionTable"; + public static final String + DATAPARTITIONINTEGRITY_FAILED_TO_WRITE_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = + "[DataPartitionIntegrity] 写入 DataPartitionTable 到共识日志失败"; + public static final String + DATAPARTITIONINTEGRITY_ERROR_WRITING_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = + "[DataPartitionIntegrity] 写入 DataPartitionTable 到共识日志出错"; + public static final String DATAPARTITIONINTEGRITY_FAILED_TO_SERIALIZE_SKIPDATANODE = + "[DataPartitionIntegrity] 序列化 skipDataNode 失败"; + public static final String DATAPARTITIONINTEGRITY_FAILED_TO_SERIALIZE_FAILEDDATANODE = + "[DataPartitionIntegrity] 序列化 failedDataNode 失败"; + public static final String DATAPARTITIONINTEGRITY_FAILED_TO_DESERIALIZE_SKIPDATANODE = + "[DataPartitionIntegrity] 反序列化 skipDataNode 失败"; + public static final String DATAPARTITIONINTEGRITY_FAILED_TO_DESERIALIZE_FAILEDDATANODE = + "[DataPartitionIntegrity] 反序列化 failedDataNode 失败"; + public static final String + DATAPARTITIONINTEGRITY_SKIPPING_EMPTY_BYTEBUFFER_DURING_DESERIALIZATION = + "[DataPartitionIntegrity] 反序列化时跳过空 ByteBuffer"; + public static final String NOT_FIND_REGION_REPLICA_NODES_IN_CREATEPEER_REGIONID = + "在 createPeer 中未找到 region 副本节点,regionId:"; + public static final String SIMPLECONSENSUS_PROTOCOL_IS_NOT_SUPPORTED_TO_REMOVE_DATA_NODE = + "SimpleConsensus 协议不支持移除数据节点"; public static final String FAILED_TO_REMOVE_ALL_REQUESTED_DATA_NODES = "移除所有请求的数据节点失败"; - public static final String THERE_EXIST_DATA_NODE_IN_REQUEST_BUT_NOT_IN_CLUSTER = "请求中存在不在集群中的 DataNode"; + public static final String THERE_EXIST_DATA_NODE_IN_REQUEST_BUT_NOT_IN_CLUSTER = + "请求中存在不在集群中的 DataNode"; + + public static final String FAILED_IN_THE_WRITE_API_EXECUTING_THE_CONSENSUS_LAYER_DUE = + "在共识层执行写入 API 失败,原因:"; - public static final String FAILED_IN_THE_WRITE_API_EXECUTING_THE_CONSENSUS_LAYER_DUE = "在共识层执行写入 API 失败,原因:"; private ProcedureMessages() {} } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/ClusterCachePropagator.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/ClusterCachePropagator.java index e69095a1e8143..2fd0f2726d342 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/ClusterCachePropagator.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/ClusterCachePropagator.java @@ -50,6 +50,9 @@ public class ClusterCachePropagator { /** How often to retry while waiting for unacked DataNodes to ack or cross T_proceed. */ private static final long RETRY_INTERVAL_MS = 1_000L; + /** Per-attempt timeout for cache-invalidation RPCs broadcast to DataNodes. */ + public static final long BROADCAST_RPC_TIMEOUT_MS = 1_000L; + /** Broadcasts the cache invalidation to {@code targets} and returns the per-nodeId responses. */ @FunctionalInterface public interface CacheBroadcast { diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/MetadataBroadcastVerdict.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/MetadataBroadcastVerdict.java index 622d432c2315b..f059de45e97b4 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/MetadataBroadcastVerdict.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/lease/MetadataBroadcastVerdict.java @@ -41,11 +41,13 @@ private MetadataBroadcastVerdict() {} /** Per-DataNode inputs for one broadcast round. */ public static final class DataNodeState { private final boolean executeSuccess; - private final long hbAgeMs; + private final long elapsedMsSinceLastSuccessfulHeartbeatResponse; - public DataNodeState(final boolean executeSuccess, final long hbAgeMs) { + public DataNodeState( + final boolean executeSuccess, final long elapsedMsSinceLastSuccessfulHeartbeatResponse) { this.executeSuccess = executeSuccess; - this.hbAgeMs = hbAgeMs; + this.elapsedMsSinceLastSuccessfulHeartbeatResponse = + elapsedMsSinceLastSuccessfulHeartbeatResponse; } } @@ -54,7 +56,8 @@ public static Verdict decide( final long fenceTimeOutsMs, final boolean waitBudgetExhausted) { for (final DataNodeState state : states) { - if (!state.executeSuccess && state.hbAgeMs < fenceTimeOutsMs) { + if (!state.executeSuccess + && state.elapsedMsSinceLastSuccessfulHeartbeatResponse < fenceTimeOutsMs) { return waitBudgetExhausted ? Verdict.FAIL : Verdict.WAIT; } } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java index 55263db0cd4eb..a569fae5a3a25 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/env/ConfigNodeProcedureEnv.java @@ -187,7 +187,9 @@ private Map invalidateDatabaseCacheOnce( final CnToDnAsyncRequestType requestType) { final DataNodeAsyncRequestContext clientHandler = new DataNodeAsyncRequestContext<>(requestType, invalidateCacheReq, targets); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); + CnToDnInternalServiceAsyncRequestManager.getInstance() + .sendAsyncRequestWithTimeoutInMs( + clientHandler, ClusterCachePropagator.BROADCAST_RPC_TIMEOUT_MS); return clientHandler.getResponseMap(); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SchemaUtils.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SchemaUtils.java index a8b5437e585ad..cff9342e13001 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SchemaUtils.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SchemaUtils.java @@ -264,7 +264,9 @@ public static Map broadcastTableUpdate( final TUpdateTableReq req, final Map targets) { final DataNodeAsyncRequestContext clientHandler = new DataNodeAsyncRequestContext<>(CnToDnAsyncRequestType.UPDATE_TABLE, req, targets); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); + CnToDnInternalServiceAsyncRequestManager.getInstance() + .sendAsyncRequestWithTimeoutInMs( + clientHandler, ClusterCachePropagator.BROADCAST_RPC_TIMEOUT_MS); return clientHandler.getResponseMap(); } @@ -356,7 +358,8 @@ public static boolean invalidateMatchedSchemaCache( .setNeedLock(needLock), targets); CnToDnInternalServiceAsyncRequestManager.getInstance() - .sendAsyncRequestWithRetry(clientHandler); + .sendAsyncRequestWithTimeoutInMs( + clientHandler, ClusterCachePropagator.BROADCAST_RPC_TIMEOUT_MS); return clientHandler.getResponseMap(); }); } @@ -380,7 +383,8 @@ public static boolean broadcastTemplateUpdate( new DataNodeAsyncRequestContext<>( CnToDnAsyncRequestType.UPDATE_TEMPLATE, requestSupplier.get(), targets); CnToDnInternalServiceAsyncRequestManager.getInstance() - .sendAsyncRequestWithRetry(clientHandler); + .sendAsyncRequestWithTimeoutInMs( + clientHandler, ClusterCachePropagator.BROADCAST_RPC_TIMEOUT_MS); return clientHandler.getResponseMap(); }); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedure.java index 31641528269af..fdf1de533256d 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/SetTTLProcedure.java @@ -165,7 +165,9 @@ DataNodeAsyncRequestContext sendTTLRequest( final Map dataNodeLocationMap, final TSetTTLReq req) { final DataNodeAsyncRequestContext clientHandler = new DataNodeAsyncRequestContext<>(CnToDnAsyncRequestType.SET_TTL, req, dataNodeLocationMap); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); + CnToDnInternalServiceAsyncRequestManager.getInstance() + .sendAsyncRequestWithTimeoutInMs( + clientHandler, ClusterCachePropagator.BROADCAST_RPC_TIMEOUT_MS); return clientHandler; } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DeleteDevicesProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DeleteDevicesProcedure.java index 9f2bb0bbfc177..775a847114448 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DeleteDevicesProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DeleteDevicesProcedure.java @@ -230,7 +230,7 @@ private void invalidateCache(final ConfigNodeProcedureEnv env) { .propagate(targets -> broadCastInvalidateCache(req, targets)); if (!proceeded) { - LOGGER.error( + LOGGER.warn( ProcedureMessages.FAILED_TO_INVALIDATE_SCHEMAENGINE_CACHE_OF_DEVICES_IN_TABLE, database, tableName); @@ -248,7 +248,9 @@ private Map broadCastInvalidateCache( final DataNodeAsyncRequestContext clientHandler = new DataNodeAsyncRequestContext<>( CnToDnAsyncRequestType.INVALIDATE_MATCHED_TABLE_DEVICE_CACHE, req, targets); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); + CnToDnInternalServiceAsyncRequestManager.getInstance() + .sendAsyncRequestWithTimeoutInMs( + clientHandler, ClusterCachePropagator.BROADCAST_RPC_TIMEOUT_MS); return clientHandler.getResponseMap(); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableColumnProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableColumnProcedure.java index d06a275513d73..0c7514d2fe5b6 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableColumnProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableColumnProcedure.java @@ -187,7 +187,9 @@ private Map broadCastInvalidateCache( final DataNodeAsyncRequestContext clientHandler = new DataNodeAsyncRequestContext<>( CnToDnAsyncRequestType.INVALIDATE_COLUMN_CACHE, req, targets); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); + CnToDnInternalServiceAsyncRequestManager.getInstance() + .sendAsyncRequestWithTimeoutInMs( + clientHandler, ClusterCachePropagator.BROADCAST_RPC_TIMEOUT_MS); return clientHandler.getResponseMap(); } diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableProcedure.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableProcedure.java index 94c36a3b7920d..2b42c8b65520e 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableProcedure.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/procedure/impl/schema/table/DropTableProcedure.java @@ -168,7 +168,9 @@ private Map broadCastInvalidateCache( final TInvalidateTableCacheReq req, final Map targets) { final DataNodeAsyncRequestContext clientHandler = new DataNodeAsyncRequestContext<>(CnToDnAsyncRequestType.PRE_DELETE_TABLE, req, targets); - CnToDnInternalServiceAsyncRequestManager.getInstance().sendAsyncRequestWithRetry(clientHandler); + CnToDnInternalServiceAsyncRequestManager.getInstance() + .sendAsyncRequestWithTimeoutInMs( + clientHandler, ClusterCachePropagator.BROADCAST_RPC_TIMEOUT_MS); return clientHandler.getResponseMap(); } diff --git a/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodePipeMessages.java b/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodePipeMessages.java index 6fbc50ac13b5e..03c4b446678cb 100644 --- a/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodePipeMessages.java +++ b/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodePipeMessages.java @@ -124,6 +124,7 @@ public final class DataNodePipeMessages { "减少 reference count for event {} in PipeRealtimePriorityBlockingQueue 失败"; public static final String FAILED_TO_GET_PENDINGQUEUE_NO_SUCH_SUBTASK = "获取 PendingQueue. No such subtask: 失败"; + public static final String FAILED_TO_GET_PIPE_INFO_FROM_CONFIG_NODE_STATUS = "获取pipe失败, 当前状态是%s."; public static final String FAILED_TO_GET_PIPE_METAS_WILL_BE = "获取 pipe metas, will be synced by configNode later 失败。"; public static final String FAILED_TO_GET_PIPE_PLUGIN_JAR_FROM = @@ -133,57 +134,43 @@ public final class DataNodePipeMessages { + "ready yet, and meta will be pushed by config node later."; public static final String FAILED_TO_PERSIST_PROGRESS_INDEX_TO_CONFIGNODE = "持久化进度索引到 ConfigNode 失败,状态:{}"; - public static final String SHUTDOWN_PROGRESS_NOT_CONFIRMED = - "本次关闭流程中的进度未确认已持久化到 ConfigNode。"; + public static final String SHUTDOWN_PROGRESS_NOT_CONFIRMED = "本次关闭流程中的进度未确认已持久化到 ConfigNode。"; public static final String START_TO_PERSIST_ALL_PIPE_PROGRESS_INDEXES_DURING_SHUTDOWN = "开始在关闭期间持久化所有 Pipe 进度索引,Pipe 数量 {},超时时间 {} ms"; public static final String INTERRUPTED_WHILE_PERSISTING_ALL_PIPE_PROGRESS_INDEXES_DURING_SHUTDOWN = - "在关闭期间持久化所有 Pipe 进度索引时被中断。" - + SHUTDOWN_PROGRESS_NOT_CONFIRMED; - public static final String - TIMED_OUT_WHILE_PERSISTING_ALL_PIPE_PROGRESS_INDEXES_DURING_SHUTDOWN = - "在关闭期间持久化所有 Pipe 进度索引超时,耗时 {} ms。" - + SHUTDOWN_PROGRESS_NOT_CONFIRMED; + "在关闭期间持久化所有 Pipe 进度索引时被中断。" + SHUTDOWN_PROGRESS_NOT_CONFIRMED; + public static final String TIMED_OUT_WHILE_PERSISTING_ALL_PIPE_PROGRESS_INDEXES_DURING_SHUTDOWN = + "在关闭期间持久化所有 Pipe 进度索引超时,耗时 {} ms。" + SHUTDOWN_PROGRESS_NOT_CONFIRMED; public static final String FAILED_TO_PERSIST_ALL_PIPE_PROGRESS_INDEXES_DURING_SHUTDOWN = - "在关闭期间持久化所有 Pipe 进度索引失败,耗时 {} ms。" - + SHUTDOWN_PROGRESS_NOT_CONFIRMED; + "在关闭期间持久化所有 Pipe 进度索引失败,耗时 {} ms。" + SHUTDOWN_PROGRESS_NOT_CONFIRMED; public static final String COLLECTED_PIPE_METAS_FOR_SHUTDOWN_PROGRESS_PERSIST = - "已收集关闭期间进度持久化所需的 Pipe 元数据,Pipe 数量 {},Pipe 元数据数量 {}," - + "Pipe 元数据大小 {} 字节,耗时 {} ms"; + "已收集关闭期间进度持久化所需的 Pipe 元数据,Pipe 数量 {},Pipe 元数据数量 {}," + "Pipe 元数据大小 {} 字节,耗时 {} ms"; public static final String COLLECTED_EMPTY_PIPE_METAS_DURING_SHUTDOWN = "关闭期间为 {} 个 Pipe 收集到空 Pipe 元数据。"; public static final String START_TO_PUSH_HEARTBEAT_SHUTDOWN_PIPE_META_TO_CONFIGNODE = "开始向 ConfigNode 推送关闭期间的 Pipe 元数据心跳,DataNode ID {},Pipe 数量 {}," + "Pipe 元数据数量 {},Pipe 元数据大小 {} 字节"; public static final String FAILED_TO_PUSH_HEARTBEAT_SHUTDOWN_PIPE_META_TO_CONFIGNODE = - "向 ConfigNode 推送关闭期间的 Pipe 元数据心跳失败,状态 {},耗时 {} ms。" - + SHUTDOWN_PROGRESS_NOT_CONFIRMED; - public static final String - SUCCESSFULLY_FINISHED_PUSH_HEARTBEAT_SHUTDOWN_PIPE_META_TO_CONFIGNODE = - "成功向 ConfigNode 推送关闭期间的 Pipe 元数据心跳,Pipe 数量 {},Pipe 元数据数量 {}," - + "Pipe 元数据大小 {} 字节,耗时 {} ms"; + "向 ConfigNode 推送关闭期间的 Pipe 元数据心跳失败,状态 {},耗时 {} ms。" + SHUTDOWN_PROGRESS_NOT_CONFIRMED; + public static final String SUCCESSFULLY_FINISHED_PUSH_HEARTBEAT_SHUTDOWN_PIPE_META_TO_CONFIGNODE = + "成功向 ConfigNode 推送关闭期间的 Pipe 元数据心跳,Pipe 数量 {},Pipe 元数据数量 {}," + "Pipe 元数据大小 {} 字节,耗时 {} ms"; public static final String EXCEPTION_OCCURRED_WHILE_PERSISTING_ALL_PIPE_PROGRESS_INDEXES_DURING_SHUTDOWN = - "在关闭期间持久化所有 Pipe 进度索引时发生异常。" - + SHUTDOWN_PROGRESS_NOT_CONFIRMED; + "在关闭期间持久化所有 Pipe 进度索引时发生异常。" + SHUTDOWN_PROGRESS_NOT_CONFIRMED; public static final String PERSISTING_PIPE_PROGRESS_INDEXES_BEFORE_SHUTDOWN = "关闭前正在持久化 Pipe 进度索引,超时时间 {} ms。"; public static final String PIPE_PROGRESS_INDEXES_WERE_NOT_CONFIRMED_DURING_SHUTDOWN = - "关闭期间 Pipe 进度索引未被 ConfigNode 确认。" - + SHUTDOWN_PROGRESS_NOT_CONFIRMED; + "关闭期间 Pipe 进度索引未被 ConfigNode 确认。" + SHUTDOWN_PROGRESS_NOT_CONFIRMED; public static final String FAILURE_WHEN_REGISTER_PIPE_PLUGIN_SKIP_THIS = "注册 pipe plugin {} 失败。将跳过该插件并继续启动。"; - public static final String - FAILED_TO_REGISTER_PIPE_PLUGIN_BECAUSE_NAME_CONFLICTS_WITH_BUILTIN = - "注册 PipePlugin %s 失败,因为给定的 PipePlugin 名称与内置 PipePlugin 名称重复。"; - public static final String - FAILED_TO_REGISTER_PIPE_PLUGIN_BECAUSE_INSTANCE_CONSTRUCTION_FAILED = - "注册 PipePlugin %s(%s) 失败,因为其实例无法成功构造。异常:%s"; + public static final String FAILED_TO_REGISTER_PIPE_PLUGIN_BECAUSE_NAME_CONFLICTS_WITH_BUILTIN = + "注册 PipePlugin %s 失败,因为给定的 PipePlugin 名称与内置 PipePlugin 名称重复。"; + public static final String FAILED_TO_REGISTER_PIPE_PLUGIN_BECAUSE_INSTANCE_CONSTRUCTION_FAILED = + "注册 PipePlugin %s(%s) 失败,因为其实例无法成功构造。异常:%s"; public static final String FAILED_TO_REGISTER_PIPE_PLUGIN_BECAUSE_JAR_MD5_MISMATCH = "注册 PipePlugin %s 失败,因为 pipe plugin %s 已存在的 jar 文件 MD5 与新的 jar 文件不同。"; - public static final String FAILED_TO_DEREGISTER_BUILTIN_PIPE_PLUGIN = - "注销内置 PipePlugin %s 失败。"; + public static final String FAILED_TO_DEREGISTER_BUILTIN_PIPE_PLUGIN = "注销内置 PipePlugin %s 失败。"; public static final String PIPECONNECTOR = "PipeConnector: "; public static final String PIPEDATANODETASKBUILDER_FAILED_TO_PARSE_INCLUSION_AND_EXCLUSION = "PipeDataNodeTaskBuilder failed to parse 'inclusion' and 'exclusion' parameters: {}"; @@ -237,9 +224,9 @@ public final class DataNodePipeMessages { "向本地 PipeTaskMeta({}) 上报 PipeRuntimeException,异常信息:{}"; public static final String RUNNINGTASKCOUNT_0 = "runningTaskCount 小于 0"; public static final String RUNNINGTASKCOUNT_0_1 = "runningTaskCount 小于等于 0"; - public static final String SIMPLEPROGRESSINDEXASSIGNER_STARTED_SUCCESSFULLY_ISSIMPLECONSENSUSENABLE_R = - "SimpleProgressIndexAssigner 启动成功。isSimpleConsensusEnable: {}, " - + "rebootTimes: {}"; + public static final String + SIMPLEPROGRESSINDEXASSIGNER_STARTED_SUCCESSFULLY_ISSIMPLECONSENSUSENABLE_R = + "SimpleProgressIndexAssigner 启动成功。isSimpleConsensusEnable: {}, " + "rebootTimes: {}"; public static final String STARTING_SIMPLEPROGRESSINDEXASSIGNER = "正在启动 SimpleProgressIndexAssigner ..."; public static final String START_PIPE_DN_TASK_SUCCESSFULLY_WITHIN_MS = @@ -255,8 +242,7 @@ public final class DataNodePipeMessages { public static final String SUBTASK_WORKER_IS_INTERRUPTED = "子任务工作线程被中断"; public static final String SUCCESSFULLY_PERSISTED_ALL_PIPE_S_INFO_TO = "成功将所有 Pipe 信息持久化到 ConfigNode。"; - public static final String THE_EXECUTOR_AND_HAS_BEEN_SUCCESSFULLY_SHUTDOWN = - "执行器 {} 和 {} 已成功关闭。"; + public static final String THE_EXECUTOR_AND_HAS_BEEN_SUCCESSFULLY_SHUTDOWN = "执行器 {} 和 {} 已成功关闭。"; // ===================== EVENT ===================== @@ -312,8 +298,9 @@ public final class DataNodePipeMessages { "mayEventTimeOverlappedWithTimeRange() is not supported!"; public static final String NO_COMMIT_IDS_FOUND_IN_PIPECOMPACTEDTSFILEINSERTIONEVENT = "No commit IDs found in PipeCompactedTsFileInsertionEvent."; - public static final String PIPECOMPACTEDTSFILEINSERTIONEVENT_DOES_NOT_SUPPORT_EQUALSINIOTCONSENSUSV2 = - "PipeCompactedTsFileInsertionEvent 不支持 equalsInIoTConsensusV2."; + public static final String + PIPECOMPACTEDTSFILEINSERTIONEVENT_DOES_NOT_SUPPORT_EQUALSINIOTCONSENSUSV2 = + "PipeCompactedTsFileInsertionEvent 不支持 equalsInIoTConsensusV2."; public static final String PIPECOMPACTEDTSFILEINSERTIONEVENT_DOES_NOT_SUPPORT_GETREBOOTTIMES = "PipeCompactedTsFileInsertionEvent 不支持 getRebootTimes."; public static final String PIPE_FAILED_TO_GET_DEVICES_FROM_TSFILE = @@ -480,8 +467,7 @@ public final class DataNodePipeMessages { "Heartbeat Event {} 无法被提供,因为其引用计数无法增加"; public static final String EVENT_CAN_NOT_BE_SUPPLIED_BECAUSE_DATA_IS_LOST = "Event %s 无法被提供,因为其引用计数无法增加,事件代表的数据已经丢失"; - public static final String INTERRUPTED_WAITING_FOR_PROCESSOR_TO_STOP = - "等待 processor 停止时被中断"; + public static final String INTERRUPTED_WAITING_FOR_PROCESSOR_TO_STOP = "等待 processor 停止时被中断"; public static final String INTERRUPTED_WHEN_WAITING_FOR_PARSING_PRIVILEGE_FOR_TSFILE = "等待解析 TsFile %s 的权限信息时被中断。"; public static final String PARSE_TSFILE_WHEN_CHECKING_PRIVILEGE_ERROR = @@ -493,9 +479,10 @@ public final class DataNodePipeMessages { public static final String NOT_HAS_PRIVILEGE_TO_TRANSFER_PLAN = "没有权限传输计划:"; public static final String NO_EVENT_HANDLER_CONFIGURED = "No event handler configured"; public static final String N_MUST_BE_0 = "n must be > 0"; - public static final String PIPEREALTIMEDATAREGIONEXTRACTOR_OBSERVED_DATA_REGION_TIME_PARTITION_GROWT = - "PipeRealtimeDataRegionExtractor({}) observed data region {} time partition growth, " - + "recording time partition id bound: {}."; + public static final String + PIPEREALTIMEDATAREGIONEXTRACTOR_OBSERVED_DATA_REGION_TIME_PARTITION_GROWT = + "PipeRealtimeDataRegionExtractor({}) observed data region {} time partition growth, " + + "recording time partition id bound: {}."; public static final String PIPE_AND_IS_NOT_SET_USE_HYBRID = "Pipe:'{}' ('{}') and '{}' ('{}') is not set, use hybrid mode by default."; public static final String PIPE_ASSIGNER_ON_DATA_REGION_SHUTDOWN_INTERNAL = @@ -637,8 +624,9 @@ public final class DataNodePipeMessages { + "trusted directory to allow encrypted access"; public static final String CLIENT_HAS_BEEN_RETURNED_TO_THE_POOL = "Client has been returned to the pool. Current handler status is {}. Will not transfer {}."; - public static final String CLOSED_ASYNCPIPEDATATRANSFERSERVICECLIENTMANAGER_FOR_RECEIVER_ATTRIBUTES = - "已关闭 AsyncPipeDataTransferServiceClientManager for receiver attributes: {}"; + public static final String + CLOSED_ASYNCPIPEDATATRANSFERSERVICECLIENTMANAGER_FOR_RECEIVER_ATTRIBUTES = + "已关闭 AsyncPipeDataTransferServiceClientManager for receiver attributes: {}"; public static final String CREATE_GROUP_SUCCESSFULLY_SERVER_HANDLE_UPDATE_RATE = "创建 group successfully! Server handle: {}, update rate: {} ms"; public static final String DELETENODETRANSFER_NO_EVENT_SUCCESSFULLY_PROCESSED = @@ -651,12 +639,14 @@ public final class DataNodePipeMessages { public static final String ERROR_PROGID_IS_INVALID_OR_UNREGISTERED_HRESULT = "Error: ProgID is invalid or unregistered, (HRESULT=0x"; public static final String ERROR_RUNNING_OPC_CLIENT = "Error running opc client: "; - public static final String EXCEPTION_OCCURRED_WHEN_PIPETABLEMODELTSFILEBUILDERV2_WRITING_TABLETS_TO = - "PipeTableModelTsFileBuilderV2 writing tablets to tsfile, use fallback tsfile builder: " - + "{} 时发生异常"; - public static final String EXCEPTION_OCCURRED_WHEN_PIPETREEMODELTSFILEBUILDERV2_WRITING_TABLETS_TO = - "PipeTreeModelTsFileBuilderV2 writing tablets to tsfile, use fallback tsfile builder: {} " - + "时发生异常"; + public static final String + EXCEPTION_OCCURRED_WHEN_PIPETABLEMODELTSFILEBUILDERV2_WRITING_TABLETS_TO = + "PipeTableModelTsFileBuilderV2 writing tablets to tsfile, use fallback tsfile builder: " + + "{} 时发生异常"; + public static final String + EXCEPTION_OCCURRED_WHEN_PIPETREEMODELTSFILEBUILDERV2_WRITING_TABLETS_TO = + "PipeTreeModelTsFileBuilderV2 writing tablets to tsfile, use fallback tsfile builder: {} " + + "时发生异常"; public static final String EXECUTE_STATEMENT_TO_DATABASE_SKIP_BECAUSE_NO = "Execute statement {} to database {}, skip because no permission."; public static final String FAILED_TO_ACQUIRE_IOPCITEMMGT_ERROR_CODE_0X = @@ -671,8 +661,9 @@ public final class DataNodePipeMessages { "borrow client {}:{} for cached leader 失败。"; public static final String FAILED_TO_BUILD_AND_STARTUP_OPCUASERVER = "构建 and startup OpcUaServer 失败"; - public static final String FAILED_TO_CLOSE_ASYNCPIPEDATATRANSFERSERVICECLIENTMANAGER_FOR_RECEIVER_ATTRIBUTE = - "关闭 AsyncPipeDataTransferServiceClientManager for receiver attributes: {} 失败"; + public static final String + FAILED_TO_CLOSE_ASYNCPIPEDATATRANSFERSERVICECLIENTMANAGER_FOR_RECEIVER_ATTRIBUTE = + "关闭 AsyncPipeDataTransferServiceClientManager for receiver attributes: {} 失败"; public static final String FAILED_TO_CLOSE_CLIENT_AFTER_HANDSHAKE_FAILURE = "关闭 client {}:{} after handshake failure when the manager is closed 失败。"; public static final String FAILED_TO_CLOSE_CLIENT_MANAGER = "关闭 client manager 失败。"; @@ -735,12 +726,14 @@ public final class DataNodePipeMessages { "InsertNodeTransfer: no.{} event successfully processed!"; public static final String INTERRUPTED_WHILE_WAITING_FOR_HANDSHAKE_RESPONSE = "waiting for handshake response 时被中断。"; - public static final String IOTCONSENSUSV2ASYNCCONNECTOR_DOES_NOT_SUPPORT_TRANSFERRING_GENERIC_EVENT = - "IoTConsensusV2AsyncConnector 不支持 transferring generic event: {}."; + public static final String + IOTCONSENSUSV2ASYNCCONNECTOR_DOES_NOT_SUPPORT_TRANSFERRING_GENERIC_EVENT = + "IoTConsensusV2AsyncConnector 不支持 transferring generic event: {}."; public static final String IOTCONSENSUSV2ASYNCCONNECTOR_DOES_NOT_SUPPORT_TRANSFER_GENERIC_EVENT = "IoTConsensusV2AsyncConnector 不支持 transfer generic event: {}."; - public static final String IOTCONSENSUSV2ASYNCCONNECTOR_ONLY_SUPPORT_PIPETSFILEINSERTIONEVENT_CURRENT_EVEN = - "IoTConsensusV2AsyncConnector only support PipeTsFileInsertionEvent. Current event: {}."; + public static final String + IOTCONSENSUSV2ASYNCCONNECTOR_ONLY_SUPPORT_PIPETSFILEINSERTIONEVENT_CURRENT_EVEN = + "IoTConsensusV2AsyncConnector only support PipeTsFileInsertionEvent. Current event: {}."; public static final String IOTCONSENSUSV2CONNECTOR_TRANSFERBUFFER_QUEUE_OFFER_IS_INTERRUPTED = "IoTConsensusV2Connector transferBuffer queue offer is interrupted."; public static final String IOTCONSENSUSV2TRANSFERBATCHREQBUILDER_THE_MAX_BATCH_SIZE_IS_ADJUSTED = @@ -783,49 +776,59 @@ public final class DataNodePipeMessages { "IoTConsensusV2-{}:Redirect file position to {}."; public static final String IOTCONSENSUSV2_SUCCESSFULLY_TRANSFERRED_FILE_COMMITTER_KEY_REPLICATE = "IoTConsensusV2-{}:成功 transferred file {} (committer key={}, replicate index={})。"; - public static final String IOTDBCDCCONNECTOR_ONLY_SUPPORT_PIPEINSERTNODETABLETINSERTIONEVENT_AND_PIPERAWTAB = - "IoTDBCDCConnector only support PipeInsertNodeTabletInsertionEvent and " - + "PipeRawTabletInsertionEvent."; - public static final String IOTDBDATAREGIONAIRGAPCONNECTOR_DOES_NOT_SUPPORT_TRANSFERRING_GENERIC_EVENT = - "IoTDBDataRegionAirGapConnector 不支持 transferring generic event: {}."; - public static final String IOTDBDATAREGIONAIRGAPCONNECTOR_ONLY_SUPPORT_PIPEINSERTNODETABLETINSERTIONEVENT_A = - "IoTDBDataRegionAirGapConnector only support PipeInsertNodeTabletInsertionEvent and " - + "PipeRawTabletInsertionEvent. Ignore {}."; - public static final String IOTDBDATAREGIONAIRGAPCONNECTOR_ONLY_SUPPORT_PIPETSFILEINSERTIONEVENT_IGNORE = - "IoTDBDataRegionAirGapConnector only support PipeTsFileInsertionEvent. Ignore {}."; + public static final String + IOTDBCDCCONNECTOR_ONLY_SUPPORT_PIPEINSERTNODETABLETINSERTIONEVENT_AND_PIPERAWTAB = + "IoTDBCDCConnector only support PipeInsertNodeTabletInsertionEvent and " + + "PipeRawTabletInsertionEvent."; + public static final String + IOTDBDATAREGIONAIRGAPCONNECTOR_DOES_NOT_SUPPORT_TRANSFERRING_GENERIC_EVENT = + "IoTDBDataRegionAirGapConnector 不支持 transferring generic event: {}."; + public static final String + IOTDBDATAREGIONAIRGAPCONNECTOR_ONLY_SUPPORT_PIPEINSERTNODETABLETINSERTIONEVENT_A = + "IoTDBDataRegionAirGapConnector only support PipeInsertNodeTabletInsertionEvent and " + + "PipeRawTabletInsertionEvent. Ignore {}."; + public static final String + IOTDBDATAREGIONAIRGAPCONNECTOR_ONLY_SUPPORT_PIPETSFILEINSERTIONEVENT_IGNORE = + "IoTDBDataRegionAirGapConnector only support PipeTsFileInsertionEvent. Ignore {}."; public static final String IOTDBLEGACYPIPECONNECTOR_DOES_NOT_SUPPORT_TRANSFERRING_GENERIC_EVENT = "IoTDBLegacyPipeConnector 不支持 transferring generic event: {}."; - public static final String IOTDBLEGACYPIPECONNECTOR_ONLY_SUPPORT_PIPEINSERTNODEINSERTIONEVENT_AND_PIPETABLE = - "IoTDBLegacyPipeConnector only support PipeInsertNodeInsertionEvent and " - + "PipeTabletInsertionEvent."; + public static final String + IOTDBLEGACYPIPECONNECTOR_ONLY_SUPPORT_PIPEINSERTNODEINSERTIONEVENT_AND_PIPETABLE = + "IoTDBLegacyPipeConnector only support PipeInsertNodeInsertionEvent and " + + "PipeTabletInsertionEvent."; public static final String IOTDBLEGACYPIPECONNECTOR_ONLY_SUPPORT_PIPETSFILEINSERTIONEVENT = "IoTDBLegacyPipeConnector only support PipeTsFileInsertionEvent."; public static final String IOTDBSCHEMAREGIONAIRGAPSINK_CAN_T_TRANSFER_TABLETINSERTIONEVENT = "IoTDBSchemaRegionAirGapSink can't transfer TabletInsertionEvent."; public static final String IOTDBSCHEMAREGIONAIRGAPSINK_CAN_T_TRANSFER_TSFILEINSERTIONEVENT = "IoTDBSchemaRegionAirGapSink can't transfer TsFileInsertionEvent."; - public static final String IOTDBSCHEMAREGIONAIRGAPSINK_DOES_NOT_SUPPORT_TRANSFERRING_GENERIC_EVENT = - "IoTDBSchemaRegionAirGapSink 不支持 transferring generic event: {}."; + public static final String + IOTDBSCHEMAREGIONAIRGAPSINK_DOES_NOT_SUPPORT_TRANSFERRING_GENERIC_EVENT = + "IoTDBSchemaRegionAirGapSink 不支持 transferring generic event: {}."; public static final String IOTDBSCHEMAREGIONCONNECTOR_CAN_T_TRANSFER_TABLETINSERTIONEVENT = "IoTDBSchemaRegionConnector can't transfer TabletInsertionEvent."; public static final String IOTDBSCHEMAREGIONCONNECTOR_CAN_T_TRANSFER_TSFILEINSERTIONEVENT = "IoTDBSchemaRegionConnector can't transfer TsFileInsertionEvent."; - public static final String IOTDBSCHEMAREGIONCONNECTOR_DOES_NOT_SUPPORT_TRANSFERRING_GENERIC_EVENT = - "IoTDBSchemaRegionConnector 不支持 transferring generic event: {}."; + public static final String + IOTDBSCHEMAREGIONCONNECTOR_DOES_NOT_SUPPORT_TRANSFERRING_GENERIC_EVENT = + "IoTDBSchemaRegionConnector 不支持 transferring generic event: {}."; public static final String IOTDBTHRIFTASYNCCONNECTOR_DOES_NOT_SUPPORT_TRANSFERRING_GENERIC_EVENT = "IoTDBThriftAsyncConnector 不支持 transferring generic event: {}."; public static final String IOTDBTHRIFTASYNCCONNECTOR_DOES_NOT_SUPPORT_TRANSFER_GENERIC_EVENT = "IoTDBThriftAsyncConnector 不支持 transfer generic event: {}."; - public static final String IOTDBTHRIFTASYNCCONNECTOR_ONLY_SUPPORT_PIPEINSERTNODETABLETINSERTIONEVENT_AND_PI = - "IoTDBThriftAsyncConnector only support PipeInsertNodeTabletInsertionEvent and " - + "PipeRawTabletInsertionEvent. Current event: {}."; - public static final String IOTDBTHRIFTASYNCCONNECTOR_ONLY_SUPPORT_PIPETSFILEINSERTIONEVENT_CURRENT_EVENT = - "IoTDBThriftAsyncConnector only support PipeTsFileInsertionEvent. Current event: {}."; + public static final String + IOTDBTHRIFTASYNCCONNECTOR_ONLY_SUPPORT_PIPEINSERTNODETABLETINSERTIONEVENT_AND_PI = + "IoTDBThriftAsyncConnector only support PipeInsertNodeTabletInsertionEvent and " + + "PipeRawTabletInsertionEvent. Current event: {}."; + public static final String + IOTDBTHRIFTASYNCCONNECTOR_ONLY_SUPPORT_PIPETSFILEINSERTIONEVENT_CURRENT_EVENT = + "IoTDBThriftAsyncConnector only support PipeTsFileInsertionEvent. Current event: {}."; public static final String IOTDBTHRIFTSYNCCONNECTOR_DOES_NOT_SUPPORT_TRANSFERRING_GENERIC_EVENT = "IoTDBThriftSyncConnector 不支持 transferring generic event: {}."; - public static final String IOTDBTHRIFTSYNCCONNECTOR_ONLY_SUPPORT_PIPEINSERTNODETABLETINSERTIONEVENT_AND_PIP = - "IoTDBThriftSyncConnector only support PipeInsertNodeTabletInsertionEvent and " - + "PipeRawTabletInsertionEvent. Ignore {}."; + public static final String + IOTDBTHRIFTSYNCCONNECTOR_ONLY_SUPPORT_PIPEINSERTNODETABLETINSERTIONEVENT_AND_PIP = + "IoTDBThriftSyncConnector only support PipeInsertNodeTabletInsertionEvent and " + + "PipeRawTabletInsertionEvent. Ignore {}."; public static final String IOTDBTHRIFTSYNCCONNECTOR_ONLY_SUPPORT_PIPETSFILEINSERTIONEVENT_IGNORE = "IoTDBThriftSyncConnector only support PipeTsFileInsertionEvent. Ignore {}."; public static final String LEADERCACHEMANAGER_ALLOCATEDMEMORYBLOCK_HAS_EXPANDED_FROM_TO = @@ -868,8 +871,9 @@ public final class DataNodePipeMessages { public static final String SUCCESSFULLY_TRANSFERRED_FILE = "成功 transferred file {}。"; public static final String SUCCESSFULLY_TRANSFERRED_FILE_AND = "成功 transferred file {}, {} and {}。"; - public static final String SUCCESSFULLY_TRANSFERRED_FILE_BATCHED_TABLEINSERTIONEVENTS_REFERENCE_COUNT = - "成功 transferred file {} (batched TableInsertionEvents, reference count={})。"; + public static final String + SUCCESSFULLY_TRANSFERRED_FILE_BATCHED_TABLEINSERTIONEVENTS_REFERENCE_COUNT = + "成功 transferred file {} (batched TableInsertionEvents, reference count={})。"; public static final String SUCCESSFULLY_TRANSFERRED_FILE_COMMITTER_KEY_COMMIT_ID = "成功 transferred file {} (committer key={}, commit id={}, reference count={})。"; public static final String SUCCESSFULLY_TRANSFERRED_SCHEMA_EVENT = @@ -892,8 +896,7 @@ public final class DataNodePipeMessages { + "Peeked event: {}, polled event: {}."; public static final String THE_FILE_IS_NOT_FOUND_MAY_ALREADY = "The file {} is not found, may already be deleted."; - public static final String NETWORK_FAILED_TO_RECEIVE_TSFILE_STATUS = - "网络接收 TsFile %s 失败,状态:%s"; + public static final String NETWORK_FAILED_TO_RECEIVE_TSFILE_STATUS = "网络接收 TsFile %s 失败,状态:%s"; public static final String THE_PIPE_WAS_DROPPED_SO_THE_EVENT = "The pipe {} was dropped so the event ack {} will be ignored."; public static final String THE_PIPE_WAS_DROPPED_SO_THE_EVENT_1 = @@ -932,9 +935,10 @@ public final class DataNodePipeMessages { "The websocket server {}:{} 已启动!"; public static final String THE_WRITTEN_TABLET_TIME_MAY_OVERLAP_OR = "The written Tablet time may overlap or the Schema may be incorrect"; - public static final String THIS_CONNECTOR_ONLY_SUPPORT_PIPEINSERTNODETABLETINSERTIONEVENT_AND_PIPERAWTABLET = - "This Connector only support PipeInsertNodeTabletInsertionEvent and " - + "PipeRawTabletInsertionEvent. Ignore {}."; + public static final String + THIS_CONNECTOR_ONLY_SUPPORT_PIPEINSERTNODETABLETINSERTIONEVENT_AND_PIPERAWTABLET = + "This Connector only support PipeInsertNodeTabletInsertionEvent and " + + "PipeRawTabletInsertionEvent. Ignore {}."; public static final String TIMED_OUT_WHEN_WAITING_FOR_CLIENT_HANDSHAKE = "Timed out when waiting for client handshake finish."; public static final String TIOTCONSENSUSV2BATCHTRANSFERRESP_IS_NULL = @@ -957,18 +961,21 @@ public final class DataNodePipeMessages { public static final String WEBSOCKETCONNECTOR_FAILED_TO_INCREASE_THE_REFERENCE_COUNT = "WebsocketConnector failed to increase the reference count of the event. Ignore it. " + "Current event: {}."; - public static final String WEBSOCKETCONNECTOR_ONLY_SUPPORT_PIPEINSERTNODETABLETINSERTIONEVENT_AND_PIPERAWTA = - "WebsocketConnector only support PipeInsertNodeTabletInsertionEvent and " - + "PipeRawTabletInsertionEvent. Current event: {}."; - public static final String WEBSOCKETCONNECTOR_ONLY_SUPPORT_PIPETSFILEINSERTIONEVENT_CURRENT_EVENT = - "WebsocketConnector only support PipeTsFileInsertionEvent. Current event: {}."; + public static final String + WEBSOCKETCONNECTOR_ONLY_SUPPORT_PIPEINSERTNODETABLETINSERTIONEVENT_AND_PIPERAWTA = + "WebsocketConnector only support PipeInsertNodeTabletInsertionEvent and " + + "PipeRawTabletInsertionEvent. Current event: {}."; + public static final String + WEBSOCKETCONNECTOR_ONLY_SUPPORT_PIPETSFILEINSERTIONEVENT_CURRENT_EVENT = + "WebsocketConnector only support PipeTsFileInsertionEvent. Current event: {}."; public static final String WHEN_THE_OPC_UA_SINK_POINTS_TO = "When the OPC UA sink points to an outer server, the table model data is not supported."; public static final String WHEN_THE_OPC_UA_SINK_SETS_WITH = "When the OPC UA sink sets 'with-quality' to true, the table model data is not supported."; - public static final String WRITEBACKSINK_ONLY_SUPPORT_PIPEINSERTNODETABLETINSERTIONEVENT_AND_PIPERAWTABLETI = - "WriteBackSink only support PipeInsertNodeTabletInsertionEvent and " - + "PipeRawTabletInsertionEvent. Ignore {}."; + public static final String + WRITEBACKSINK_ONLY_SUPPORT_PIPEINSERTNODETABLETINSERTIONEVENT_AND_PIPERAWTABLETI = + "WriteBackSink only support PipeInsertNodeTabletInsertionEvent and " + + "PipeRawTabletInsertionEvent. Ignore {}."; // ===================== RECEIVER ===================== @@ -1015,9 +1022,10 @@ public final class DataNodePipeMessages { "IoTConsensusV2Receiver thread is interrupted when waiting for receiver get initiated, " + "may because system exit."; public static final String IOTCONSENSUSV2_PIPENAME = "IoTConsensusV2-PipeName-{}:{}"; - public static final String IOTCONSENSUSV2_PIPENAME_CURRENT_WAITING_IS_INTERRUPTED_ONSYNCEDCOMMITINDEX = - "IoTConsensusV2-PipeName-{}:current waiting is interrupted. onSyncedCommitIndex: {}. " - + "Exception: "; + public static final String + IOTCONSENSUSV2_PIPENAME_CURRENT_WAITING_IS_INTERRUPTED_ONSYNCEDCOMMITINDEX = + "IoTConsensusV2-PipeName-{}:current waiting is interrupted. onSyncedCommitIndex: {}. " + + "Exception: "; public static final String IOTCONSENSUSV2_PIPENAME_CURRENT_WRITING_FILE_WRITER_IS = "IoTConsensusV2-PipeName-{}:Current writing file writer 为空,无需关闭。"; public static final String IOTCONSENSUSV2_PIPENAME_CURRENT_WRITING_FILE_WRITER_WAS = @@ -1080,9 +1088,10 @@ public final class DataNodePipeMessages { "IoTConsensusV2-PipeName-{}:process no.{} event successfully!"; public static final String IOTCONSENSUSV2_PIPENAME_RECEIVED_A_DEPRECATED_REQUEST_WHICH = "IoTConsensusV2-PipeName-{}:received a deprecated request-{}, which may because {}. "; - public static final String IOTCONSENSUSV2_PIPENAME_RECEIVER_DETECTED_AN_NEWER_PIPETASKRESTARTTIMES = - "IoTConsensusV2-PipeName-{}:receiver detected an newer pipeTaskRestartTimes, which " - + "indicates the pipe task has restarted. receiver will reset all its data."; + public static final String + IOTCONSENSUSV2_PIPENAME_RECEIVER_DETECTED_AN_NEWER_PIPETASKRESTARTTIMES = + "IoTConsensusV2-PipeName-{}:receiver detected an newer pipeTaskRestartTimes, which " + + "indicates the pipe task has restarted. receiver will reset all its data."; public static final String IOTCONSENSUSV2_PIPENAME_RECEIVER_DETECTED_AN_NEWER_REBOOTTIMES = "IoTConsensusV2-PipeName-{}:receiver detected an newer rebootTimes, which indicates the " + "leader has rebooted. receiver will reset all its data."; diff --git a/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodeSchemaMessages.java b/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodeSchemaMessages.java index 415e2580a1380..6e3552b7063f0 100644 --- a/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodeSchemaMessages.java +++ b/iotdb-core/datanode/src/main/i18n/zh/org/apache/iotdb/db/i18n/DataNodeSchemaMessages.java @@ -31,8 +31,7 @@ public final class DataNodeSchemaMessages { public static final String RECOVER_SPEND = "恢复 [{}] 耗时:{} ms"; public static final String SCHEMA_REGION_FAILED_TO_RECOVER = "SchemaRegion [%d] 在 StorageGroup [%s] 中恢复失败。"; - public static final String SCHEMA_REGION_ALREADY_DELETED = - "SchemaRegion(id = {}) 已被删除,已跳过"; + public static final String SCHEMA_REGION_ALREADY_DELETED = "SchemaRegion(id = {}) 已被删除,已跳过"; public static final String FAILED_TO_GET_TABLE_FOR_TIMESERIES_COUNT = "计算时间序列数量时获取表 {}.{} 失败,可能是集群正在重启或表正在被删除。"; public static final String PEER_IS_SHUTTING_DOWN = "节点正在关闭中。"; @@ -41,40 +40,31 @@ public final class DataNodeSchemaMessages { // ======================== MemSchemaEngineStatistics 相关消息 ======================== - public static final String CURRENT_SERIES_MEMORY_TOO_LARGE = - "当前时间序列内存 {} 过大..."; + public static final String CURRENT_SERIES_MEMORY_TOO_LARGE = "当前时间序列内存 {} 过大..."; public static final String CURRENT_SERIES_MEMORY_BACK_TO_NORMAL = "当前时间序列内存 {} 已恢复正常水平,总时间序列数量为 {}。"; - public static final String WRONG_SCHEMA_ENGINE_STATISTICS_TYPE = - "SchemaEngineStatistics 类型错误"; + public static final String WRONG_SCHEMA_ENGINE_STATISTICS_TYPE = "SchemaEngineStatistics 类型错误"; // ======================== MemSchemaRegionStatistics 相关消息 ======================== - public static final String WRONG_SCHEMA_REGION_STATISTICS_TYPE = - "SchemaRegionStatistics 类型错误"; + public static final String WRONG_SCHEMA_REGION_STATISTICS_TYPE = "SchemaRegionStatistics 类型错误"; // ======================== SchemaRegionUtils 相关消息 ======================== public static final String CANNOT_GET_FILES_IN_SCHEMA_REGION_DIR = "无法获取 schema region 目录 %s 中的文件"; public static final String DELETE_SCHEMA_REGION_FILE = "删除 schema region 文件 {}"; - public static final String DELETE_SCHEMA_REGION_FILE_FAILED = - "删除 schema region 文件 {} 失败。"; - public static final String FAILED_TO_DELETE_SCHEMA_REGION_FILE = - "删除 schema region 文件 %s 失败"; + public static final String DELETE_SCHEMA_REGION_FILE_FAILED = "删除 schema region 文件 {} 失败。"; + public static final String FAILED_TO_DELETE_SCHEMA_REGION_FILE = "删除 schema region 文件 %s 失败"; public static final String DELETE_SCHEMA_REGION_FOLDER = "删除 schema region 目录 {}"; - public static final String DELETE_SCHEMA_REGION_FOLDER_FAILED = - "删除 schema region 目录 {} 失败。"; - public static final String FAILED_TO_DELETE_SCHEMA_REGION_FOLDER = - "删除 schema region 目录 %s 失败"; + public static final String DELETE_SCHEMA_REGION_FOLDER_FAILED = "删除 schema region 目录 {} 失败。"; + public static final String FAILED_TO_DELETE_SCHEMA_REGION_FOLDER = "删除 schema region 目录 %s 失败"; public static final String DELETE_DATABASE_SCHEMA_FOLDER = "删除数据库 schema 目录 {}"; - public static final String DELETE_DATABASE_SCHEMA_FOLDER_FAILED = - "删除数据库 schema 目录 {} 失败"; + public static final String DELETE_DATABASE_SCHEMA_FOLDER_FAILED = "删除数据库 schema 目录 {} 失败"; // ======================== SchemaRegionLoader 相关消息 ======================== - public static final String CLASS_NOT_SUBCLASS_OF_ISCHEMAREGION = - "类 %s 不是 ISchemaRegion 的子类。"; + public static final String CLASS_NOT_SUBCLASS_OF_ISCHEMAREGION = "类 %s 不是 ISchemaRegion 的子类。"; public static final String DUPLICATED_SCHEMA_REGION_IMPL = "存在重复的 SchemaRegion 实现,{} 和 {} 使用了相同的模式名称 [{}]"; public static final String NO_SCHEMA_REGION_IMPL_WITH_TARGET_MODE = @@ -84,21 +74,16 @@ public final class DataNodeSchemaMessages { // ======================== SchemaRegionPlanType 相关消息 ======================== - public static final String UNRECOGNIZED_SCHEMA_REGION_PLAN_TYPE = - "无法识别的 SchemaRegionPlanType:"; + public static final String UNRECOGNIZED_SCHEMA_REGION_PLAN_TYPE = "无法识别的 SchemaRegionPlanType:"; // ======================== SchemaRegion 初始化/目录 相关消息 ======================== public static final String CREATE_DATABASE_SCHEMA_FOLDER = "创建数据库 schema 目录 {}"; - public static final String CREATE_DATABASE_SCHEMA_FOLDER_FAILED = - "创建数据库 schema 目录 {} 失败。"; + public static final String CREATE_DATABASE_SCHEMA_FOLDER_FAILED = "创建数据库 schema 目录 {} 失败。"; public static final String CREATE_SCHEMA_REGION_FOLDER = "创建 schema region 目录 {}"; - public static final String CREATE_SCHEMA_REGION_FOLDER_FAILED = - "创建 schema region 目录 {} 失败。"; - public static final String CANNOT_RECOVER_ALL_SCHEMA_INFO = - "无法从 {} 恢复所有 schema 信息,将尽可能恢复"; - public static final String CANNOT_RECOVER_ALL_MTREE = - "无法从 {} 文件恢复所有 MTree,将尽可能恢复"; + public static final String CREATE_SCHEMA_REGION_FOLDER_FAILED = "创建 schema region 目录 {} 失败。"; + public static final String CANNOT_RECOVER_ALL_SCHEMA_INFO = "无法从 {} 恢复所有 schema 信息,将尽可能恢复"; + public static final String CANNOT_RECOVER_ALL_MTREE = "无法从 {} 文件恢复所有 MTree,将尽可能恢复"; // ======================== SchemaRegion MLog 相关消息 ======================== @@ -109,17 +94,14 @@ public final class DataNodeSchemaMessages { public static final String MLOG_BIN_SUFFIX = " mlog.bin 失败"; public static final String PARSE_MLOG_ERROR = "在行号 {} 处解析 mlog 出错:"; public static final String CANNOT_OPERATE_CMD = "无法执行命令 {},错误:"; - public static final String MLOG_BIN_CORRUPTED = - "mlog.bin 文件已损坏,请删除或修复该文件,然后重启 IoTDB"; - public static final String CANNOT_CLOSE_METADATA_LOG_WRITER = - "无法关闭元数据日志写入器:"; + public static final String MLOG_BIN_CORRUPTED = "mlog.bin 文件已损坏,请删除或修复该文件,然后重启 IoTDB"; + public static final String CANNOT_CLOSE_METADATA_LOG_WRITER = "无法关闭元数据日志写入器:"; public static final String MLOG_RECOVERY_CHECK_POINT = "MLog 恢复检查点:{}"; public static final String CANNOT_GET_MLOG_CHECKPOINT = "无法从 MLogDescription 文件获取检查点,原因:{},使用默认值 0。"; public static final String FAILED_TO_SKIP_MLOG = "跳过 {} 失败,schemaRegion 目录为 {}"; public static final String UPDATE_MLOG_DESCRIPTION_FAILED = "更新 {} 失败,原因:{}"; - public static final String DIRECT_BUFFER_MEMORY_EXCEEDED = - "直接缓冲区的总分配内存将达到 "; + public static final String DIRECT_BUFFER_MEMORY_EXCEEDED = "直接缓冲区的总分配内存将达到 "; public static final String DIRECT_BUFFER_MEMORY_LIMIT = ",超过内存限制:"; // ======================== SchemaRegion 快照相关消息 ======================== @@ -127,129 +109,86 @@ public final class DataNodeSchemaMessages { public static final String FAILED_TO_CREATE_SNAPSHOT_NOT_INITIALIZED = "创建 schemaRegion {} 的快照失败,因为该 schemaRegion 尚未初始化。"; public static final String START_CREATE_SNAPSHOT = "开始创建 schemaRegion {} 的快照"; - public static final String MTREE_SNAPSHOT_CREATION_COST = - "schemaRegion {} 的 MTree 快照创建耗时 {}ms。"; + public static final String MTREE_SNAPSHOT_CREATION_COST = "schemaRegion {} 的 MTree 快照创建耗时 {}ms。"; public static final String MTREE_SNAPSHOT_CREATION_COST_WITH_STATUS = "schemaRegion {} 的 MTree 快照创建耗时 {}ms,状态:{}"; - public static final String TAG_SNAPSHOT_CREATION_COST = - "schemaRegion {} 的 Tag 快照创建耗时 {}ms。"; + public static final String TAG_SNAPSHOT_CREATION_COST = "schemaRegion {} 的 Tag 快照创建耗时 {}ms。"; public static final String TAG_SNAPSHOT_CREATION_COST_WITH_STATUS = "schemaRegion {} 的 Tag 快照创建耗时 {}ms,状态:{}"; public static final String DEVICE_ATTR_SNAPSHOT_CREATION_COST = "schemaRegion {} 的设备属性快照创建耗时 {}ms,状态:{}"; public static final String DEVICE_ATTR_UPDATER_SNAPSHOT_CREATION_COST = "schemaRegion {} 的设备属性远程更新器快照创建耗时 {}ms,状态:{}"; - public static final String SNAPSHOT_CREATION_COST = - "schemaRegion {} 的快照创建耗时 {}ms。"; - public static final String SUCCESSFULLY_CREATE_SNAPSHOT = - "成功创建 schemaRegion {} 的快照"; - public static final String START_LOADING_SNAPSHOT = - "开始加载 schemaRegion {} 的快照"; + public static final String SNAPSHOT_CREATION_COST = "schemaRegion {} 的快照创建耗时 {}ms。"; + public static final String SUCCESSFULLY_CREATE_SNAPSHOT = "成功创建 schemaRegion {} 的快照"; + public static final String START_LOADING_SNAPSHOT = "开始加载 schemaRegion {} 的快照"; public static final String DEVICE_ATTR_SNAPSHOT_LOADING_COST = "schemaRegion {} 的设备属性快照加载耗时 {}ms。"; public static final String DEVICE_ATTR_UPDATER_SNAPSHOT_LOADING_COST = "schemaRegion {} 的设备属性远程更新器快照加载耗时 {}ms。"; - public static final String TAG_SNAPSHOT_LOADING_COST = - "schemaRegion {} 的 Tag 快照加载耗时 {}ms。"; - public static final String MTREE_SNAPSHOT_LOADING_COST = - "schemaRegion {} 的 MTree 快照加载耗时 {}ms。"; - public static final String SNAPSHOT_LOADING_COST = - "schemaRegion {} 的快照加载耗时 {}ms。"; - public static final String SUCCESSFULLY_LOAD_SNAPSHOT = - "成功加载 schemaRegion {} 的快照"; + public static final String TAG_SNAPSHOT_LOADING_COST = "schemaRegion {} 的 Tag 快照加载耗时 {}ms。"; + public static final String MTREE_SNAPSHOT_LOADING_COST = "schemaRegion {} 的 MTree 快照加载耗时 {}ms。"; + public static final String SNAPSHOT_LOADING_COST = "schemaRegion {} 的快照加载耗时 {}ms。"; + public static final String SUCCESSFULLY_LOAD_SNAPSHOT = "成功加载 schemaRegion {} 的快照"; public static final String FAILED_TO_LOAD_SNAPSHOT = "加载 schemaRegion {} 的快照失败,原因:{},将使用空的 schemaRegion"; - public static final String ERROR_DURING_INIT_SCHEMA_REGION = - "初始化 schemaRegion {} 过程中发生错误"; - public static final String FAILED_TO_RECOVER_TAG_INDEX = - "恢复 {} 的 tagIndex 失败,schemaRegion 为 {}。"; - public static final String FAILED_TO_READ_TAG_ATTRIBUTE = - "读取 tag 和 attribute 信息失败:{}"; + public static final String ERROR_DURING_INIT_SCHEMA_REGION = "初始化 schemaRegion {} 过程中发生错误"; + public static final String FAILED_TO_RECOVER_TAG_INDEX = "恢复 {} 的 tagIndex 失败,schemaRegion 为 {}。"; + public static final String FAILED_TO_READ_TAG_ATTRIBUTE = "读取 tag 和 attribute 信息失败:{}"; // ======================== DeviceAttributeStore 相关消息 ======================== - public static final String FAILED_TO_DELETE_OLD_SNAPSHOT_DEVICE_ATTR = - "创建设备属性快照时删除旧快照 {} 失败。"; - public static final String FAILED_TO_RENAME_SNAPSHOT_DEVICE_ATTR = - "创建设备属性快照时将 {} 重命名为 {} 失败。"; - public static final String FAILED_TO_CREATE_DEVICE_ATTR_SNAPSHOT = - "创建设备属性快照失败:{}"; - public static final String DEVICE_ATTR_SNAPSHOT_NOT_FOUND = - "未找到设备属性快照 {},视为从旧版本升级,使用空属性"; - public static final String LOAD_DEVICE_ATTR_SNAPSHOT_FAILED = - "从 {} 加载设备属性快照失败"; + public static final String FAILED_TO_DELETE_OLD_SNAPSHOT_DEVICE_ATTR = "创建设备属性快照时删除旧快照 {} 失败。"; + public static final String FAILED_TO_RENAME_SNAPSHOT_DEVICE_ATTR = "创建设备属性快照时将 {} 重命名为 {} 失败。"; + public static final String FAILED_TO_CREATE_DEVICE_ATTR_SNAPSHOT = "创建设备属性快照失败:{}"; + public static final String DEVICE_ATTR_SNAPSHOT_NOT_FOUND = "未找到设备属性快照 {},视为从旧版本升级,使用空属性"; + public static final String LOAD_DEVICE_ATTR_SNAPSHOT_FAILED = "从 {} 加载设备属性快照失败"; // ======================== DeviceAttributeCacheUpdater 相关消息 ======================== - public static final String FAILED_TO_DELETE_OLD_SNAPSHOT_UPDATER = - "创建设备属性远程更新器快照时删除旧快照 {} 失败。"; - public static final String FAILED_TO_RENAME_SNAPSHOT_UPDATER = - "创建设备属性远程更新器快照时将 {} 重命名为 {} 失败。"; - public static final String FAILED_TO_CREATE_UPDATER_SNAPSHOT = - "创建设备属性远程更新器快照失败:{}"; - public static final String UPDATER_SNAPSHOT_NOT_FOUND = - "未找到设备属性远程更新器快照 {},视为从旧版本升级,将不更新远程节点"; - public static final String LOAD_UPDATER_SNAPSHOT_FAILED = - "从 {} 加载设备属性远程更新器快照失败,继续..."; - public static final String REQUEST_MEMORY_SIZE_NEGATIVE = - "requestMemory 大小不能为负数"; - public static final String RELEASE_MEMORY_SIZE_NEGATIVE = - "releaseMemory 大小不能为负数"; + public static final String FAILED_TO_DELETE_OLD_SNAPSHOT_UPDATER = "创建设备属性远程更新器快照时删除旧快照 {} 失败。"; + public static final String FAILED_TO_RENAME_SNAPSHOT_UPDATER = "创建设备属性远程更新器快照时将 {} 重命名为 {} 失败。"; + public static final String FAILED_TO_CREATE_UPDATER_SNAPSHOT = "创建设备属性远程更新器快照失败:{}"; + public static final String UPDATER_SNAPSHOT_NOT_FOUND = "未找到设备属性远程更新器快照 {},视为从旧版本升级,将不更新远程节点"; + public static final String LOAD_UPDATER_SNAPSHOT_FAILED = "从 {} 加载设备属性远程更新器快照失败,继续..."; + public static final String REQUEST_MEMORY_SIZE_NEGATIVE = "requestMemory 大小不能为负数"; + public static final String RELEASE_MEMORY_SIZE_NEGATIVE = "releaseMemory 大小不能为负数"; // ======================== MetaFormatUtils 相关消息 ======================== public static final String ILLEGAL_NAME = "%s 是不合法的名称。"; - public static final String NAME_CONTAINS_UNSUPPORTED_CHAR = - "名称 %s 包含不支持的字符。"; - public static final String DATABASE_NAME_ILLEGAL_CHARS = - "数据库名称只能包含中英文字符、数字、反引号和下划线。%s"; - public static final String SDT_COMPRESSION_DEVIATION_REQUIRED = - "SDT 压缩偏差为必填项"; - public static final String SDT_COMPRESSION_DEVIATION_NEGATIVE = - "SDT 压缩偏差不能为负数"; - public static final String SDT_COMPRESSION_DEVIATION_FORMAT_ERROR = - "SDT 压缩偏差格式错误"; - public static final String SDT_COMPRESSION_MAX_GREATER_THAN_MIN = - "SDT 压缩最大时间必须大于最小时间"; - public static final String SDT_COMPRESSION_TIME_NEGATIVE = - "SDT 压缩 %s 时间不能为负数"; - public static final String SDT_COMPRESSION_TIME_FORMAT_ERROR = - "SDT 压缩 %s 时间格式错误"; - public static final String SDT_ENABLED_NO_COMPRESSION_TIME = - "{} 已启用 SDT 但未设置压缩 {} 时间"; + public static final String NAME_CONTAINS_UNSUPPORTED_CHAR = "名称 %s 包含不支持的字符。"; + public static final String DATABASE_NAME_ILLEGAL_CHARS = "数据库名称只能包含中英文字符、数字、反引号和下划线。%s"; + public static final String SDT_COMPRESSION_DEVIATION_REQUIRED = "SDT 压缩偏差为必填项"; + public static final String SDT_COMPRESSION_DEVIATION_NEGATIVE = "SDT 压缩偏差不能为负数"; + public static final String SDT_COMPRESSION_DEVIATION_FORMAT_ERROR = "SDT 压缩偏差格式错误"; + public static final String SDT_COMPRESSION_MAX_GREATER_THAN_MIN = "SDT 压缩最大时间必须大于最小时间"; + public static final String SDT_COMPRESSION_TIME_NEGATIVE = "SDT 压缩 %s 时间不能为负数"; + public static final String SDT_COMPRESSION_TIME_FORMAT_ERROR = "SDT 压缩 %s 时间格式错误"; + public static final String SDT_ENABLED_NO_COMPRESSION_TIME = "{} 已启用 SDT 但未设置压缩 {} 时间"; // ======================== Tag/Attribute 相关消息 ======================== - public static final String TIMESERIES_NO_TAG_ATTRIBUTE = - "时间序列 [%s] 没有任何 tag/attribute。"; + public static final String TIMESERIES_NO_TAG_ATTRIBUTE = "时间序列 [%s] 没有任何 tag/attribute。"; public static final String TIMESERIES_NO_SPECIFIC_TAG_ATTRIBUTE = "时间序列 [%s] 没有 [%s] tag/attribute。"; - public static final String TIMESERIES_ALREADY_HAS_ATTRIBUTE = - "时间序列 [%s] 已有 attribute [%s]。"; - public static final String TIMESERIES_ALREADY_HAS_TAG = - "时间序列 [%s] 已有 tag [%s]。"; - public static final String TIMESERIES_NO_TAG_ATTRIBUTE_LOG = - "时间序列 [{}] 没有 tag/attribute [{}]"; + public static final String TIMESERIES_ALREADY_HAS_ATTRIBUTE = "时间序列 [%s] 已有 attribute [%s]。"; + public static final String TIMESERIES_ALREADY_HAS_TAG = "时间序列 [%s] 已有 tag [%s]。"; + public static final String TIMESERIES_NO_TAG_ATTRIBUTE_LOG = "时间序列 [{}] 没有 tag/attribute [{}]"; public static final String TIMESERIES_NO_SPECIFIC_TAG_ATTRIBUTE_FMT = "时间序列 [%s] 没有 tag/attribute [%s]。"; // ======================== TagManager 快照相关消息 ======================== - public static final String FAILED_TO_DELETE_OLD_TAG_SNAPSHOT = - "创建 tagManager 快照时删除旧快照 {} 失败。"; - public static final String FAILED_TO_RENAME_TAG_SNAPSHOT = - "创建 tagManager 快照时将 {} 重命名为 {} 失败。"; - public static final String FAILED_TO_DELETE_AFTER_RENAME_FAILURE = - "重命名失败后删除 {} 失败。"; - public static final String FAILED_TO_CREATE_TAG_SNAPSHOT = - "创建 tagManager 快照失败:{}"; + public static final String FAILED_TO_DELETE_OLD_TAG_SNAPSHOT = "创建 tagManager 快照时删除旧快照 {} 失败。"; + public static final String FAILED_TO_RENAME_TAG_SNAPSHOT = "创建 tagManager 快照时将 {} 重命名为 {} 失败。"; + public static final String FAILED_TO_DELETE_AFTER_RENAME_FAILURE = "重命名失败后删除 {} 失败。"; + public static final String FAILED_TO_CREATE_TAG_SNAPSHOT = "创建 tagManager 快照失败:{}"; public static final String FAILED_TO_DELETE_AFTER_TAG_SNAPSHOT_FAILURE = "创建 tagManager 快照失败后删除 {} 失败。"; public static final String FAILED_TO_DELETE_FILE = "删除 {} 失败。"; - public static final String FAILED_TO_DELETE_EXISTING_WHEN_LOADING = - "加载快照时删除已有的 {} 失败。"; - public static final String FAILED_TO_DELETE_EXISTING_WHEN_COPY_FAILURE = - "复制快照失败时删除已有的 {} 失败。"; + public static final String FAILED_TO_DELETE_EXISTING_WHEN_LOADING = "加载快照时删除已有的 {} 失败。"; + public static final String FAILED_TO_DELETE_EXISTING_WHEN_COPY_FAILURE = "复制快照失败时删除已有的 {} 失败。"; // ======================== TagLogFile 相关消息 ======================== @@ -258,14 +197,10 @@ public final class DataNodeSchemaMessages { // ======================== MemMTreeSnapshotUtil 相关消息 ======================== - public static final String FAILED_TO_DELETE_OLD_MTREE_SNAPSHOT = - "创建 mTree 快照时删除旧快照 {} 失败。"; - public static final String FAILED_TO_RENAME_MTREE_SNAPSHOT = - "创建 mTree 快照时将 {} 重命名为 {} 失败。"; - public static final String FAILED_TO_CREATE_MTREE_SNAPSHOT = - "创建 mTree 快照失败:{}"; - public static final String SERIALIZE_ERROR_INFO = - "序列化 MemMTree 过程中发生错误。"; + public static final String FAILED_TO_DELETE_OLD_MTREE_SNAPSHOT = "创建 mTree 快照时删除旧快照 {} 失败。"; + public static final String FAILED_TO_RENAME_MTREE_SNAPSHOT = "创建 mTree 快照时将 {} 重命名为 {} 失败。"; + public static final String FAILED_TO_CREATE_MTREE_SNAPSHOT = "创建 mTree 快照失败:{}"; + public static final String SERIALIZE_ERROR_INFO = "序列化 MemMTree 过程中发生错误。"; public static final String UNRECOGNIZED_MNODE_TYPE = "无法识别的 MNode 类型 "; // ======================== View 相关消息 ======================== @@ -273,54 +208,34 @@ public final class DataNodeSchemaMessages { public static final String IS_NO_VIEW = "[%s] 不是视图。"; public static final String VIEW_NOT_SUPPORTED = "不支持视图。"; public static final String VIEW_DOES_NOT_SUPPORT_ALIAS = "视图不支持别名"; - public static final String CANNOT_CONSTRUCT_ABSTRACT_CLASS = - "无法构造抽象类。"; + public static final String CANNOT_CONSTRUCT_ABSTRACT_CLASS = "无法构造抽象类。"; // ======================== PBTree 相关消息 ======================== - public static final String TABLE_MODEL_NOT_SUPPORT_PBTREE = - "表模型尚不支持 PBTree。"; - public static final String PBTREE_NOT_SUPPORT_ALTER_ENCODING = - "PBTree 尚不支持修改编码和压缩方式。"; + public static final String TABLE_MODEL_NOT_SUPPORT_PBTREE = "表模型尚不支持 PBTree。"; + public static final String PBTREE_NOT_SUPPORT_ALTER_ENCODING = "PBTree 尚不支持修改编码和压缩方式。"; public static final String NOT_IMPLEMENTED = "尚未实现"; - public static final String PBTREE_FILE_OVERWRITTEN = - "PBTree 文件 [{}] 已存在,将被覆盖。"; - public static final String SCHEMA_FILE_WRONG_VERSION = - "SchemaFile 版本错误,请检查或升级。"; - public static final String NODE_NO_CHILD_IN_PBTREE = - "节点 [%s] 在 pbtree 文件中没有子节点。"; + public static final String PBTREE_FILE_OVERWRITTEN = "PBTree 文件 [{}] 已存在,将被覆盖。"; + public static final String SCHEMA_FILE_WRONG_VERSION = "SchemaFile 版本错误,请检查或升级。"; + public static final String NODE_NO_CHILD_IN_PBTREE = "节点 [%s] 在 pbtree 文件中没有子节点。"; public static final String SCHEMA_FILE_INSPECTED = "SchemaFile[%s] 已被检查。"; - public static final String FAILED_TO_CREATE_SCHEMA_FILE_SNAPSHOT = - "创建 SchemaFile 快照失败:{}"; - public static final String FAILED_TO_DELETE_OLD_PBTREE_SNAPSHOT = - "创建 pbtree 文件快照时删除旧快照 {} 失败。"; + public static final String FAILED_TO_CREATE_SCHEMA_FILE_SNAPSHOT = "创建 SchemaFile 快照失败:{}"; + public static final String FAILED_TO_DELETE_OLD_PBTREE_SNAPSHOT = "创建 pbtree 文件快照时删除旧快照 {} 失败。"; // ======================== PBTree Segment/Page 相关消息 ======================== - public static final String FAILED_TO_INSERT_RELOCATED_SEGMENT = - "向重定位的 segment 插入缓冲区失败"; - public static final String FAILED_TO_UPDATE_RELOCATED_SEGMENT = - "在重定位的 segment 上更新缓冲区失败"; - public static final String ALIAS_INDEX_PAGE_EXTEND_CAPACITY = - "AliasIndexPage 只能扩展到相同容量的缓冲区。"; - public static final String SEGMENTS_SPLIT_SAME_CAPACITY = - "Segment 只能以相同容量进行拆分。"; - public static final String SEGMENT_SPLIT_NO_RECORDS = - "没有记录的 Segment 无法拆分。"; - public static final String SEGMENT_SPLIT_ONLY_ONE_RECORD = - "只有一条记录的 Segment 无法拆分。"; - public static final String INTERNAL_PAGE_EXTEND_CAPACITY = - "InternalPage 只能扩展到相同容量的缓冲区。"; - public static final String INTERNAL_SEGMENT_SPLIT_NO_KEY = - "内部 Segment 没有插入键时无法拆分"; - public static final String INTERNAL_SEGMENT_LESS_THAN_2_POINTERS = - "指针数少于 2 的 Segment 无法拆分。"; - public static final String LEAF_SEGMENT_EXTEND_SMALLER = - "叶子 Segment 无法扩展到更小的缓冲区。"; - public static final String RECORD_CONFLICT_NAME_WITH_ALIAS = - "记录 [%s] 的名称与其兄弟节点的别名冲突。"; - public static final String RECORD_CONFLICT_ALIAS = - "记录 [%s] 的别名 [%s] 与其兄弟节点冲突。"; + public static final String FAILED_TO_INSERT_RELOCATED_SEGMENT = "向重定位的 segment 插入缓冲区失败"; + public static final String FAILED_TO_UPDATE_RELOCATED_SEGMENT = "在重定位的 segment 上更新缓冲区失败"; + public static final String ALIAS_INDEX_PAGE_EXTEND_CAPACITY = "AliasIndexPage 只能扩展到相同容量的缓冲区。"; + public static final String SEGMENTS_SPLIT_SAME_CAPACITY = "Segment 只能以相同容量进行拆分。"; + public static final String SEGMENT_SPLIT_NO_RECORDS = "没有记录的 Segment 无法拆分。"; + public static final String SEGMENT_SPLIT_ONLY_ONE_RECORD = "只有一条记录的 Segment 无法拆分。"; + public static final String INTERNAL_PAGE_EXTEND_CAPACITY = "InternalPage 只能扩展到相同容量的缓冲区。"; + public static final String INTERNAL_SEGMENT_SPLIT_NO_KEY = "内部 Segment 没有插入键时无法拆分"; + public static final String INTERNAL_SEGMENT_LESS_THAN_2_POINTERS = "指针数少于 2 的 Segment 无法拆分。"; + public static final String LEAF_SEGMENT_EXTEND_SMALLER = "叶子 Segment 无法扩展到更小的缓冲区。"; + public static final String RECORD_CONFLICT_NAME_WITH_ALIAS = "记录 [%s] 的名称与其兄弟节点的别名冲突。"; + public static final String RECORD_CONFLICT_ALIAS = "记录 [%s] 的别名 [%s] 与其兄弟节点冲突。"; public static final String RECORD_NOT_EXISTED = "记录[key:%s] 不存在。"; public static final String SEGMENT_CACHE_MAP_INCONSISTENT = "页面 %d 中的 Segment 缓存映射与 Segment 列表不一致。"; @@ -331,37 +246,27 @@ public final class DataNodeSchemaMessages { public static final String CHILD_SHALL_NOT_HAVE_SEGMENT_ADDRESS = "newChildBuffer 中的子节点不应有 segmentAddress。"; public static final String PAGE_INDEX_OUT_OF_RANGE = "页面索引 %d 超出范围。"; - public static final String ROOT_PAGE_SHALL_NOT_BE_MIGRATED = - "根页面不应被迁移。"; - public static final String SUBORDINATE_INDEX_NOT_ON_SINGLE_PAGE = - "不应在单页面 segment 上构建从属索引。"; - public static final String SUBORDINATE_INDEX_BROKEN = - "文件可能已损坏,从属索引已断裂。"; - public static final String DUPLICATE_PAGE_INSTANCES = - "存在索引相同的重复页面实例:{}"; + public static final String ROOT_PAGE_SHALL_NOT_BE_MIGRATED = "根页面不应被迁移。"; + public static final String SUBORDINATE_INDEX_NOT_ON_SINGLE_PAGE = "不应在单页面 segment 上构建从属索引。"; + public static final String SUBORDINATE_INDEX_BROKEN = "文件可能已损坏,从属索引已断裂。"; + public static final String DUPLICATE_PAGE_INSTANCES = "存在索引相同的重复页面实例:{}"; public static final String PAGE_LOCKED_TIMES = "页面 [{}] 已被锁定 {} 次。"; - public static final String REENTRANT_WRITE_LOCKS_DETAIL = - "页面 {} 上存在可重入写锁,内容详情:{}"; + public static final String REENTRANT_WRITE_LOCKS_DETAIL = "页面 {} 上存在可重入写锁,内容详情:{}"; public static final String REENTRANT_WRITE_LOCKS = "页面 {} 上存在可重入写锁"; // ======================== PBTree Flush 相关消息 ======================== - public static final String IO_EXCEPTION_UPDATING_SG_MNODE = - "更新 StorageGroupMNode {} 时发生 IO 异常"; - public static final String ERROR_DURING_MTREE_FLUSH = - "MTree 刷写过程中发生错误,当前节点为 {}"; + public static final String IO_EXCEPTION_UPDATING_SG_MNODE = "更新 StorageGroupMNode {} 时发生 IO 异常"; + public static final String ERROR_DURING_MTREE_FLUSH = "MTree 刷写过程中发生错误,当前节点为 {}"; // ======================== PBTree ReleaseFlushMonitor 相关消息 ======================== - public static final String RELEASE_TASK_MONITOR_INTERRUPTED = - "ReleaseTaskMonitor 线程被中断。"; - public static final String RELEASE_FLUSH_TASK_TIMEOUT = - "释放任务和刷写任务未在 {} 毫秒内完成,已中断。"; + public static final String RELEASE_TASK_MONITOR_INTERRUPTED = "ReleaseTaskMonitor 线程被中断。"; + public static final String RELEASE_FLUSH_TASK_TIMEOUT = "释放任务和刷写任务未在 {} 毫秒内完成,已中断。"; // ======================== PBTree PagePool 相关消息 ======================== - public static final String PAGE_CACHE_EVICTION_INTERRUPTED = - "页面缓存淘汰过程中被中断,请考虑增加缓存大小、降低并发或延长超时时间"; + public static final String PAGE_CACHE_EVICTION_INTERRUPTED = "页面缓存淘汰过程中被中断,请考虑增加缓存大小、降低并发或延长超时时间"; // ======================== ReadOnly MTreeStore 相关消息 ======================== @@ -373,30 +278,24 @@ public final class DataNodeSchemaMessages { public static final String WRONG_NODE_TYPE = "错误的节点类型"; public static final String SHOULD_CALL_EXACT_SUB_CLASS = "应调用具体的子类!"; public static final String VIEW_TABLE_NOT_ALLOWED = "不允许使用视图表。"; - public static final String TABLE_DEVICE_NOT_UNDER_TREE_MODEL = - "不应在树模型下创建表设备"; + public static final String TABLE_DEVICE_NOT_UNDER_TREE_MODEL = "不应在树模型下创建表设备"; public static final String NO_SATISFIED_MNODE_FACTORY = "未找到满足条件的 MNodeFactory"; // ======================== Logfile 相关消息 ======================== public static final String READ_LOG_LENGTH_NEGATIVE = "读取的日志长度 %s 为负数。"; - public static final String PLAN_NOT_SUPPORT_DESERIALIZATION = - "%s 计划不支持反序列化。"; - public static final String PLAN_NOT_SUPPORT_SERIALIZATION = - "%s 计划不支持序列化。"; + public static final String PLAN_NOT_SUPPORT_DESERIALIZATION = "%s 计划不支持反序列化。"; + public static final String PLAN_NOT_SUPPORT_SERIALIZATION = "%s 计划不支持序列化。"; public static final String SCHEMA_FILE_LOG_INCOMPLETE_ENTRY = "不完整的日志条目。"; // ======================== Template 相关消息 ======================== - public static final String UNKNOWN_TEMPLATE_UPDATE_OPERATION_TYPE = - "未知的模板更新操作类型"; + public static final String UNKNOWN_TEMPLATE_UPDATE_OPERATION_TYPE = "未知的模板更新操作类型"; // ======================== InformationSchema 相关消息 ======================== - public static final String SYSTEM_VIEW_NOT_SUPPORT_SHOW_CREATE = - "系统视图不支持 show create。"; - public static final String SYSTEM_DATABASE_NOT_SUPPORT_SHOW_CREATE = - "系统数据库不支持 show create。"; + public static final String SYSTEM_VIEW_NOT_SUPPORT_SHOW_CREATE = "系统视图不支持 show create。"; + public static final String SYSTEM_DATABASE_NOT_SUPPORT_SHOW_CREATE = "系统数据库不支持 show create。"; // ======================== 附加 SchemaRegion 相关消息 ======================== @@ -406,23 +305,17 @@ public final class DataNodeSchemaMessages { "类型为 %s 的 SchemaRegionPlan 不支持在 SchemaRegionMemoryImpl 中执行恢复操作。"; public static final String SCHEMA_REGION_PLAN_NOT_SUPPORT_RECOVER_PBTREE = "类型为 %s 的 SchemaRegionPlan 不支持在 SchemaRegionPBTreeImpl 中执行恢复操作。"; - public static final String PBTREE_NOT_SUPPORT_ALTER_DATA_TYPE = - "PBTree 尚不支持修改时间序列数据类型。"; + public static final String PBTREE_NOT_SUPPORT_ALTER_DATA_TYPE = "PBTree 尚不支持修改时间序列数据类型。"; // ======================== 附加 MTree 相关消息 ======================== - public static final String DEVICE_NUM_UPPER_LIMIT = - "设备数量已达到上限"; - public static final String TIMESERIES_TYPE_NOT_COMPATIBLE = - "时间序列 %s 使用的新类型 %s 与已有类型 %s 不兼容"; - public static final String ALIAS_DUPLICATED = - "别名与其他测量的名称或别名重复,别名:"; + public static final String DEVICE_NUM_UPPER_LIMIT = "设备数量已达到上限"; + public static final String TIMESERIES_TYPE_NOT_COMPATIBLE = "时间序列 %s 使用的新类型 %s 与已有类型 %s 不兼容"; + public static final String ALIAS_DUPLICATED = "别名与其他测量的名称或别名重复,别名:"; public static final String LOGICAL_VIEW_NODE_TYPE_ERROR = "newMNode 的类型不是 LogicalViewMNode!实际类型为 "; - public static final String TEMPLATE_SHOULD_MOUNTED_ON_ANCESTOR = - "使用模板的节点 [%s] 的祖先节点上应挂载模板。"; - public static final String DESCENDANT_SHOULD_NOT_EXIST = - "节点 %s 下不应存在后代节点"; + public static final String TEMPLATE_SHOULD_MOUNTED_ON_ANCESTOR = "使用模板的节点 [%s] 的祖先节点上应挂载模板。"; + public static final String DESCENDANT_SHOULD_NOT_EXIST = "节点 %s 下不应存在后代节点"; // ======================== 附加 SchemaFile/Page 相关消息 ======================== @@ -434,12 +327,9 @@ public final class DataNodeSchemaMessages { "SegmentedPage 仅在包含一个最大尺寸 segment 时才能共享整个缓冲区切片。"; public static final String BYTEBUFFER_CORRUPTED_FOR_SCHEMA_PAGE = "ByteBuffer 已损坏或位置设置错误,无法加载为 SchemaPage。"; - public static final String NODE_NO_CHILD_IN_PBTREE_WITH_NAME = - "节点 [%s] 在 pbtree 文件中没有子节点 [%s]。"; - public static final String SINGLE_RECORD_TOO_LARGE = - "SchemaFile 目前不支持超过半页大小的单条记录。"; - public static final String PAGE_REPLACEMENT_ERROR = - "页面 [%d] 替换错误:引用计数或锁对象不一致。"; + public static final String NODE_NO_CHILD_IN_PBTREE_WITH_NAME = "节点 [%s] 在 pbtree 文件中没有子节点 [%s]。"; + public static final String SINGLE_RECORD_TOO_LARGE = "SchemaFile 目前不支持超过半页大小的单条记录。"; + public static final String PAGE_REPLACEMENT_ERROR = "页面 [%d] 替换错误:引用计数或锁对象不一致。"; public static final String NODE_NO_VALID_SEGMENT_ADDRESS = "节点 [%s] 在 pbtree 文件中没有有效的 segment 地址。"; @@ -448,8 +338,7 @@ public final class DataNodeSchemaMessages { public static final String COMMIT_MARK_WITHOUT_PREPARE = "存在 COMMIT_MARK 但缺少 PREPARE_MARK"; public static final String EXTRANEOUS_BYTE_AFTER_PREPARE = "PREPARE_MARK 之后出现了非 COMMIT_MARK 的多余字节"; - public static final String NOT_ENDED_BY_MARK = - "未以 COMMIT_MARK 或 PREPARE_MARK 结尾。"; + public static final String NOT_ENDED_BY_MARK = "未以 COMMIT_MARK 或 PREPARE_MARK 结尾。"; // ======================== 附加 MNodeContainer 相关消息 ======================== @@ -458,8 +347,7 @@ public final class DataNodeSchemaMessages { // ======================== 附加 Logfile 相关消息 ======================== - public static final String FAILED_TO_CREATE_FILE_ALREADY_EXISTS = - "创建文件 %s 失败,因为同名文件已存在"; + public static final String FAILED_TO_CREATE_FILE_ALREADY_EXISTS = "创建文件 %s 失败,因为同名文件已存在"; // ======================== 附加 View 相关消息 ======================== @@ -475,26 +363,21 @@ public final class DataNodeSchemaMessages { // ======================== 附加 Template 相关消息 ======================== - public static final String FAILED_TO_CREATE_TEMPLATE = - "在 ConfigNode 中执行创建设备模板 {} 失败,状态为 {}。"; + public static final String FAILED_TO_CREATE_TEMPLATE = "在 ConfigNode 中执行创建设备模板 {} 失败,状态为 {}。"; public static final String CREATE_TEMPLATE_ERROR_PREFIX = "创建模板出错 - "; public static final String CREATE_TEMPLATE_ERROR = "创建模板出错。"; public static final String GET_ALL_TEMPLATE_ERROR = "获取所有模板出错。"; public static final String GET_TEMPLATE_INFO_ERROR = "获取模板信息出错。"; - public static final String FAILED_TO_SET_TEMPLATE = - "在 ConfigNode 中执行设置设备模板 {} 到路径 {} 失败,状态为 {}。"; + public static final String FAILED_TO_SET_TEMPLATE = "在 ConfigNode 中执行设置设备模板 {} 到路径 {} 失败,状态为 {}。"; // ======================== 附加 InformationSchema 相关消息 ======================== - public static final String INFORMATION_SCHEMA_READ_ONLY = - "数据库 'information_schema' 仅支持查询操作"; + public static final String INFORMATION_SCHEMA_READ_ONLY = "数据库 'information_schema' 仅支持查询操作"; // ======================== 附加 GRASS/Updater 相关消息 ======================== - public static final String FAILED_TO_WRITE_ATTR_COMMIT = - "向 region {} 写入属性提交消息失败。"; - public static final String FAILED_TO_FETCH_DATANODE_LOCATIONS = - "获取 DataNode 位置信息失败,将重试。"; + public static final String FAILED_TO_WRITE_ATTR_COMMIT = "向 region {} 写入属性提交消息失败。"; + public static final String FAILED_TO_FETCH_DATANODE_LOCATIONS = "获取 DataNode 位置信息失败,将重试。"; // ======================== 附加 ResourceByPathUtils 相关消息 ======================== @@ -503,8 +386,7 @@ public final class DataNodeSchemaMessages { // ======================== 附加 CachedMTreeStore 相关消息 ======================== - public static final String ERROR_DURING_PBTREE_CLEAR = - "PBTree 清理过程中发生错误:{}"; + public static final String ERROR_DURING_PBTREE_CLEAR = "PBTree 清理过程中发生错误:{}"; public static final String ERROR_DURING_MTREE_FLUSH_SCHEMA_REGION = "MTree 刷写过程中发生错误,当前 SchemaRegionId 为 {}"; public static final String ERROR_DURING_MTREE_FLUSH_SCHEMA_REGION_BECAUSE = @@ -512,53 +394,40 @@ public final class DataNodeSchemaMessages { // ======================== 附加 MemMTreeSnapshotUtil 相关消息 ======================== - public static final String DESERIALIZE_ERROR_INFO = - "反序列化 MemMTree 过程中发生错误。"; + public static final String DESERIALIZE_ERROR_INFO = "反序列化 MemMTree 过程中发生错误。"; // ======================== 附加 MetaUtils 相关消息 ======================== - public static final String PATH_NO_LONGER_THAN_SG_LEVEL = - "路径长度不超过默认 sg 层级:"; + public static final String PATH_NO_LONGER_THAN_SG_LEVEL = "路径长度不超过默认 sg 层级:"; public static final String PATH_DOES_NOT_START_WITH_ROOT = "路径不以 "; // ======================== FakeCRC32Deserializer 相关消息 ======================== - public static final String READ_LOG_LENGTH_NEGATIVE_LOG = - "读取的日志长度 {} 为负数。"; + public static final String READ_LOG_LENGTH_NEGATIVE_LOG = "读取的日志长度 {} 为负数。"; // ======================== SchemaLogReader 相关消息 ======================== - public static final String FILE_CORRUPTED = - "文件 {} 已损坏,未损坏的大小为 {}。"; + public static final String FILE_CORRUPTED = "文件 {} 已损坏,未损坏的大小为 {}。"; public static final String LOG_FILE_END_CORRUPTED_TRUNCATE = "日志文件 {} 的末尾已损坏,开始截断。未损坏的大小为 {},文件大小为 {}。"; - public static final String FAIL_TO_TRUNCATE_LOG_FILE = - "截断日志文件到大小 {} 失败"; + public static final String FAIL_TO_TRUNCATE_LOG_FILE = "截断日志文件到大小 {} 失败"; // ======================== SchemaRegionPlanDeserializer 相关消息 ======================== - public static final String CANNOT_DESERIALIZE_SCHEMA_REGION_PLAN = - "无法从缓冲区反序列化 SchemaRegionPlan"; + public static final String CANNOT_DESERIALIZE_SCHEMA_REGION_PLAN = "无法从缓冲区反序列化 SchemaRegionPlan"; // ======================== MTreeBelowSGMemoryImpl 相关消息 ======================== - public static final String TIMESERIES_NUM_UPPER_LIMIT = - "时间序列数量已达到上限"; - public static final String ALIAS_DUPLICATED_DETAIL = - ",完整路径:"; - public static final String ALIAS_DUPLICATED_OTHER_MEASUREMENT = - ",其他测量:"; - public static final String START_CREATE_TABLE_DEVICE = - "开始创建表设备 {}.{}"; - public static final String TABLE_DEVICE_ALREADY_EXISTS = - "表设备 {}.{} 已存在"; - public static final String TABLE_DEVICE_CREATED = - "表设备 {}.{} 已创建"; + public static final String TIMESERIES_NUM_UPPER_LIMIT = "时间序列数量已达到上限"; + public static final String ALIAS_DUPLICATED_DETAIL = ",完整路径:"; + public static final String ALIAS_DUPLICATED_OTHER_MEASUREMENT = ",其他测量:"; + public static final String START_CREATE_TABLE_DEVICE = "开始创建表设备 {}.{}"; + public static final String TABLE_DEVICE_ALREADY_EXISTS = "表设备 {}.{} 已存在"; + public static final String TABLE_DEVICE_CREATED = "表设备 {}.{} 已创建"; // ======================== CachedMTreeStore / Scheduler 相关消息 ======================== - public static final String MTREE_FLUSH_COST = - "MTree 刷写耗时 {}ms,SchemaRegion 为 {}"; + public static final String MTREE_FLUSH_COST = "MTree 刷写耗时 {}ms,SchemaRegion 为 {}"; // ======================== DataNodeTableCache 相关消息 ======================== @@ -570,10 +439,12 @@ public final class DataNodeSchemaMessages { public static final String COMMIT_UPDATE_TABLE_SUCCESS_WITH_DETAIL = "提交更新表 {}.{} 成功,{}"; public static final String COMMIT_UPDATE_TABLE_SUCCESS = "提交更新表 {}.{} 成功。"; public static final String RENAME_OLD_TABLE_SUCCESS = "重命名旧表 {}.{} 成功。"; + public static final String COMMIT_DELETE_TABLE_SUCCESS = "提交删除表 {}.{} 操作成功。"; public static final String FAILED_TO_REFRESH_CACHE_FROM_CN = "从configNode拉取元数据更新DataNodeTableCache失败"; public static final String INTERRUPTED_ACQUIRE_SEMAPHORE_GET_TABLES = "尝试获取信号量以从 ConfigNode 获取表时被中断,已忽略。"; + public static final String UPDATE_TABLE_BY_FETCH_WITH_DETAIL = "获取表 {}.{} 信息, {}"; public static final String UPDATE_TABLE_BY_FETCH = "通过表拉取更新表 {}.{}"; public static final String THE_TABLE_IS_IN_PRE_DELETE_STATE = "表 %s.%s 处于预删除的状态,请稍等,如之后重试还是此状态,请输入sql再次删除"; diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManager.java index a673f8aa37a26..e52fef88c6d1c 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManager.java @@ -20,6 +20,7 @@ package org.apache.iotdb.db.schemaengine.lease; import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory; +import org.apache.iotdb.commons.concurrent.threadpool.ScheduledExecutorUtil; import org.apache.iotdb.commons.conf.CommonDescriptor; import org.apache.iotdb.commons.exception.MetadataLeaseFencedException; import org.apache.iotdb.commons.utils.TestOnly; @@ -36,10 +37,13 @@ import java.util.Collections; import java.util.List; import java.util.concurrent.ExecutorService; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicStampedReference; import java.util.function.LongSupplier; +import static org.apache.iotdb.commons.concurrent.ThreadName.CHECK_DN_LEASE_STATUS; import static org.apache.iotdb.commons.concurrent.ThreadName.RELOAD_TABLE_METADATA_CACHE; /** @@ -73,9 +77,10 @@ interface MetadataAction { private volatile long lastConfigNodeHeartbeatNanos; - AtomicBoolean hasPullTaskNowRef; - AtomicStampedReference metadataStateRef; - ExecutorService pullExecutorService; + private final AtomicBoolean hasPullTaskNowRef; + private final AtomicStampedReference metadataStateRef; + private final ExecutorService pullExecutorService; + private final ScheduledExecutorService checkLeaseStatusExecutor; private enum MetadataState { NORMAL, @@ -92,7 +97,9 @@ private MetadataLeaseManager() { () -> CommonDescriptor.getInstance().getConfig().getMetadataLeaseFenceMs(), defaultClearCacheList(), defaultPullMetaList(), - IoTDBThreadPoolFactory.newCachedThreadPool(RELOAD_TABLE_METADATA_CACHE.getName())); + IoTDBThreadPoolFactory.newCachedThreadPool(RELOAD_TABLE_METADATA_CACHE.getName()), + CommonDescriptor.getInstance().getConfig().getCheckDnLeaseStatusIntervalMs(), + IoTDBThreadPoolFactory.newScheduledThreadPool(1, CHECK_DN_LEASE_STATUS.getName())); } private static List defaultClearCacheList() { @@ -112,7 +119,9 @@ private static List defaultPullMetaList() { final LongSupplier fenceThresholdMs, final List clearCacheList, final List pullMetaList, - final ExecutorService pullExecutorService) { + final ExecutorService pullExecutorService, + final long checkDnLeaseStatusIntervalMs, + final ScheduledExecutorService checkLeaseStatusExecutor) { this.nanoClock = nanoClock; this.fenceThresholdMs = fenceThresholdMs; this.clearCacheList = new ArrayList<>(clearCacheList); @@ -123,6 +132,15 @@ private static List defaultPullMetaList() { metadataStateRef = new AtomicStampedReference<>(MetadataState.NORMAL, 0); hasPullTaskNowRef = new AtomicBoolean(false); this.pullExecutorService = pullExecutorService; + this.checkLeaseStatusExecutor = checkLeaseStatusExecutor; + if (this.checkLeaseStatusExecutor != null) { + ScheduledExecutorUtil.safelyScheduleWithFixedDelay( + this.checkLeaseStatusExecutor, + this::checkLeaseStatus, + 0, + checkDnLeaseStatusIntervalMs, + TimeUnit.MILLISECONDS); + } } /** Renew the lease: record that a ConfigNode heartbeat has just been received */ @@ -184,10 +202,10 @@ private boolean tryClearCache(final MetadataState currentState, final int curren } try { clearCacheList.forEach(MetadataAction::execute); - } catch (Exception e) { + } catch (Throwable t) { metadataStateRef.set(MetadataState.NEED_CLEAR, metadataStateRef.getStamp() + 1); - LOGGER.error(DataNodeSchemaMessages.FAILED_TO_CLEAR_METADATA_CACHE, e); - throw e; + LOGGER.error(DataNodeSchemaMessages.FAILED_TO_CLEAR_METADATA_CACHE, t); + rethrowUnchecked(t); } metadataStateRef.set(MetadataState.CACHE_CLEARED, metadataStateRef.getStamp() + 1); return true; @@ -211,16 +229,26 @@ private void pullMetaDataAndInit() { for (final MetadataAction action : pullMetaList) { try { action.execute(); - } catch (final Exception e) { + } catch (final Throwable t) { metadataStateRef.set(MetadataState.PULL_OR_INIT_FAILED, metadataStateRef.getStamp() + 1); - LOGGER.error(DataNodeSchemaMessages.FAILED_TO_PULL_OR_INIT_METADATA, e); - throw e; + LOGGER.error(DataNodeSchemaMessages.FAILED_TO_PULL_OR_INIT_METADATA, t); + rethrowUnchecked(t); } } this.lastConfigNodeHeartbeatNanos = nanoClock.getAsLong(); metadataStateRef.set(MetadataState.NORMAL, metadataStateRef.getStamp() + 1); } + private static void rethrowUnchecked(final Throwable t) { + if (t instanceof Error) { + throw (Error) t; + } + if (t instanceof RuntimeException) { + throw (RuntimeException) t; + } + throw new RuntimeException(t); + } + private boolean hasOutOfLease() { return getMillisSinceLastConfigNodeHeartbeat() > fenceThresholdMs.getAsLong(); } @@ -232,23 +260,19 @@ public long getMillisSinceLastConfigNodeHeartbeat() { } public boolean isFenced() { + return metadataStateRef.getReference() != MetadataState.NORMAL; + } + + void checkLeaseStatus() { int[] stampHolder = new int[1]; MetadataState metadataState = metadataStateRef.get(stampHolder); if (metadataState != MetadataState.NORMAL) { - return true; + return; } - - // NORMAL and within lease means the metadata cache is available - if (!hasOutOfLease()) { - return false; + if (hasOutOfLease()) { + metadataStateRef.compareAndSet( + MetadataState.NORMAL, MetadataState.NEED_CLEAR, stampHolder[0], stampHolder[0] + 1); } - - // Do not clear cache in caller threads. Mark the lease as fenced only; the heartbeat worker - // serializes cache clearing and metadata pulling. The stamp prevents an old isFenced() caller - // from changing a newly recovered NORMAL state back to NEED_CLEAR. - metadataStateRef.compareAndSet( - MetadataState.NORMAL, MetadataState.NEED_CLEAR, stampHolder[0], stampHolder[0] + 1); - return true; } /** diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcherLeaseTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcherLeaseTest.java index a166ccdcacbe1..6933b11a05501 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcherLeaseTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/auth/ClusterAuthorityFetcherLeaseTest.java @@ -97,7 +97,7 @@ private TestingClusterAuthorityFetcher( @Override boolean isMetadataLeaseFenced() { - return leaseManager.isFenced(); + return MetadataLeaseTestUtils.isFenced(leaseManager); } } } diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManagerTest.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManagerTest.java index 9ea9c580bd6b5..bc68209de2664 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManagerTest.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManagerTest.java @@ -50,6 +50,7 @@ public void recoversAfterHeartbeatWhenLeaseExpired() { final MetadataLeaseManager manager = newManager(nowNanos, () -> {}, () -> {}); nowNanos.addAndGet(TimeUnit.MILLISECONDS.toNanos(T_FENCE_MS + 1)); + manager.checkLeaseStatus(); assertTrue(manager.isFenced()); manager.recoveryLeaseForTest(true); @@ -72,6 +73,7 @@ public void retriesCacheClearInHeartbeatWorkerAfterFailure() { () -> {}); nowNanos.addAndGet(TimeUnit.MILLISECONDS.toNanos(T_FENCE_MS + 1)); + manager.checkLeaseStatus(); assertTrue(manager.isFenced()); assertEquals(0, clearAttempts.get()); @@ -99,6 +101,7 @@ public void retriesMetadataPullAfterFailure() { }); nowNanos.addAndGet(TimeUnit.MILLISECONDS.toNanos(T_FENCE_MS + 1)); + manager.checkLeaseStatus(); assertTrue(manager.isFenced()); manager.triggerCheckWithHeartBeat(); diff --git a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseTestUtils.java b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseTestUtils.java index 1ae72821a77c3..6631c0500a7eb 100644 --- a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseTestUtils.java +++ b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseTestUtils.java @@ -41,7 +41,13 @@ public static MetadataLeaseManager newManager(final LongSupplier nowNanos) { return newManager(nowNanos, () -> {}, () -> {}); } + public static boolean isFenced(final MetadataLeaseManager manager) { + manager.checkLeaseStatus(); + return manager.isFenced(); + } + public static void failIfMetadataLeaseFenced(final MetadataLeaseManager manager) { + manager.checkLeaseStatus(); if (manager.isFenced()) { throw new MetadataLeaseFencedException( "Metadata lease is fenced. The local metadata cache is unavailable."); @@ -64,6 +70,8 @@ static MetadataLeaseManager newManager( () -> T_FENCE_MS, Collections.singletonList(clearAction), Collections.singletonList(pullAction), - MoreExecutors.newDirectExecutorService()); + MoreExecutors.newDirectExecutorService(), + 500L, + null); } } diff --git a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template index 2ec0b2e010fcf..1fbee884c967f 100644 --- a/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template +++ b/iotdb-core/node-commons/src/assembly/resources/conf/iotdb-system.properties.template @@ -762,6 +762,13 @@ failure_detector_phi_acceptable_pause_in_ms=10000 # Datatype: long metadata_lease_fence_ms=20000 +# Interval at which a DataNode checks whether its metadata lease has expired and self-fences local +# metadata caches. Keep this value smaller than the ConfigNode-side safe-fence wait so the DataNode +# can finish self-isolation before the ConfigNode treats it as fenced. +# effectiveMode: restart +# Datatype: long +check_dn_lease_status_interval_ms=500 + # Whether to enable topology probing between DataNodes # effectiveMode: hot_reload # Datatype: Boolean diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java index 0435fc1f5e85a..606a08bde3322 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/concurrent/ThreadName.java @@ -105,7 +105,8 @@ public enum ThreadName { CONFIG_NODE_TIMEOUT_EXECUTOR("ProcedureTimeoutExecutor"), CONFIG_NODE_WORKER_THREAD_MONITOR("ProcedureWorkerThreadMonitor"), CONFIG_NODE_RETRY_FAILED_TASK("Cluster-RetryFailedTasks-Service"), - RELOAD_TABLE_METADATA_CACHE("Reload-table-metadata-cache"), + RELOAD_TABLE_METADATA_CACHE("Reload-Table-Metadata-Cache"), + CHECK_DN_LEASE_STATUS("Check-DN-Lease-Status"), // -------------------------- IoTConsensusV2 -------------------------- IOT_CONSENSUS_V2_RPC_SERVICE("IoTConsensusV2RPC-Service"), IOT_CONSENSUS_V2_RPC_PROCESSOR("IoTConsensusV2RPC-Processor"), @@ -385,7 +386,8 @@ public enum ThreadName { CONFIG_NODE_WORKER_THREAD_MONITOR, CONFIG_NODE_TIMEOUT_EXECUTOR, CONFIG_NODE_RETRY_FAILED_TASK, - RELOAD_TABLE_METADATA_CACHE)); + RELOAD_TABLE_METADATA_CACHE, + CHECK_DN_LEASE_STATUS)); private static final Set metricsThreadNames = new HashSet<>( diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java index 8442937bbb75d..c3516faaa5acf 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java @@ -484,6 +484,8 @@ public class CommonConfig { // derive how long it must wait before treating an unreachable DataNode as safely fenced. private volatile long metadataLeaseFenceMs = 20_000; + private volatile long checkDnLeaseStatusIntervalMs = 500; + private final RateLimiter querySamplingRateLimiter = RateLimiter.create(160); // if querySamplingRateLimiter < 0, means that there is no rate limit, we need to full sample all // the queries @@ -2922,6 +2924,14 @@ public void setMetadataLeaseFenceMs(long metadataLeaseFenceMs) { this.metadataLeaseFenceMs = metadataLeaseFenceMs; } + public long getCheckDnLeaseStatusIntervalMs() { + return checkDnLeaseStatusIntervalMs; + } + + public void setCheckDnLeaseStatusIntervalMs(long checkDnLeaseStatusIntervalMs) { + this.checkDnLeaseStatusIntervalMs = checkDnLeaseStatusIntervalMs; + } + public int getArenaNum() { return arenaNum; } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java index dba01c67bd25b..20533698e33d5 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java @@ -345,6 +345,12 @@ public void loadCommonProps(TrimProperties properties) throws IOException { properties.getProperty( "metadata_lease_fence_ms", String.valueOf(config.getMetadataLeaseFenceMs())))); + config.setCheckDnLeaseStatusIntervalMs( + Long.parseLong( + properties.getProperty( + "check_dn_lease_status_interval_ms", + String.valueOf(config.getCheckDnLeaseStatusIntervalMs())))); + loadRetryProperties(properties); loadBinaryAllocatorProps(properties); } From 8b604cf1d121c4f01933c56f1ab98687081e62a2 Mon Sep 17 00:00:00 2001 From: Yaobin Chen Date: Mon, 6 Jul 2026 18:59:01 +0800 Subject: [PATCH 4/5] fix i18n --- .../confignode/i18n/ProcedureMessages.java | 912 +++++++++++------- 1 file changed, 559 insertions(+), 353 deletions(-) diff --git a/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java b/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java index 7a9e4b4576c80..d00421bf894fe 100644 --- a/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java +++ b/iotdb-core/confignode/src/main/i18n/zh/org/apache/iotdb/confignode/i18n/ProcedureMessages.java @@ -42,8 +42,7 @@ public final class ProcedureMessages { "AlterConsumerGroupProcedure: rollbackFromValidate"; public static final String ALTERENCODINGCOMPRESSOR_COSTS_MS = "AlterEncodingCompressor-[{}] costs {}ms"; - public static final String ALTERING_COLUMN_IN_ON_CONFIGNODE = - "在 ConfigNode 上修改表 {}.{} 中的列 {}"; + public static final String ALTERING_COLUMN_IN_ON_CONFIGNODE = "在 ConfigNode 上修改表 {}.{} 中的列 {}"; public static final String ALTERING_TIME_SERIES_DATA_TYPE = "正在修改时间序列 {} 的数据类型"; public static final String ALTERLOGICALVIEW_COSTS_MS = "AlterLogicalView-[{}] costs {}ms"; public static final String ALTERPIPEPROCEDUREV2_EXECUTEFROMCALCULATEINFOFORTASK = @@ -66,8 +65,9 @@ public final class ProcedureMessages { "AlterTableColumnDataType-{}.{}-{} costs {}ms"; public static final String ALTERTIMESERIESDATATYPE_COSTS_MS = "AlterTimeSeriesDataType-{}-[{}] costs {}ms"; - public static final String ALTERTOPICPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES_TRY_TO_ALTER_TOPIC = - "AlterTopicProcedure: executeFromOperateOnConfigNodes, try to alter topic"; + public static final String + ALTERTOPICPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES_TRY_TO_ALTER_TOPIC = + "AlterTopicProcedure: executeFromOperateOnConfigNodes, try to alter topic"; public static final String ALTERTOPICPROCEDURE_EXECUTEFROMOPERATEONDATANODES = "AlterTopicProcedure: executeFromOperateOnDataNodes({})"; public static final String ALTERTOPICPROCEDURE_EXECUTEFROMVALIDATE = @@ -84,8 +84,7 @@ public final class ProcedureMessages { "在 schema region 中修改时间序列 {} 的编码 {} 和压缩器 {}"; public static final String ALTER_TIMESERIES_DATA_TYPE_TO_IN_SCHEMA_REGIONS_FAILED_FAILURES = "在 schema region 中将时间序列 %s 的数据类型修改为 %s 失败。失败信息:%s"; - public static final String ALTER_TIME_SERIES_DATA_TYPE_FAILED = - "修改时间序列 {} 数据类型失败"; + public static final String ALTER_TIME_SERIES_DATA_TYPE_FAILED = "修改时间序列 {} 数据类型失败"; public static final String ALTER_VIEW = "修改视图 {}"; public static final String ALTER_VIEW_FAILED_WHEN_BECAUSE_FAILED_TO_EXECUTE_IN_ALL = "修改视图 %s 失败,当 [%s] 时,原因:在 schemaRegion %s 的所有 replicaset 中执行失败。失败节点:%s,状态:%s"; @@ -98,8 +97,9 @@ public final class ProcedureMessages { "{}, 开始停止 DataNode 并杀死 DataNode 进程:{}"; public static final String BROADCASTDATANODESTATUSCHANGE_FINISHED_DATANODE = "{}, BroadcastDataNodeStatusChange 完成,dataNode:{}"; - public static final String BROADCASTDATANODESTATUSCHANGE_MEETS_ERROR_STATUS_CHANGE_DATANODES_ERROR_DATANODE = - "{}, BroadcastDataNodeStatusChange 出错,状态变更的 DataNode:{},出错的 DataNode:{}"; + public static final String + BROADCASTDATANODESTATUSCHANGE_MEETS_ERROR_STATUS_CHANGE_DATANODES_ERROR_DATANODE = + "{}, BroadcastDataNodeStatusChange 出错,状态变更的 DataNode:{},出错的 DataNode:{}"; public static final String BROADCASTDATANODESTATUSCHANGE_START_DATANODE = "{}, BroadcastDataNodeStatusChange 开始,dataNode:{}"; public static final String CALL_CHANGEREGIONLEADER_FAIL_FOR_THE_TIME_WILL_SLEEP_MS = @@ -108,10 +108,10 @@ public final class ProcedureMessages { "找不到包含给定 region 的 DataNode:{}"; public static final String CANNOT_FIND_REGION_REPLICA_NODES_IN_CREATEPEER_REGIONID = "{}, 在 createPeer 中找不到 region 副本节点,regionId:{}"; - public static final String CANNOT_FIND_REGION_REPLICA_NODES_REGION = - "找不到 region 副本节点,region:{}"; - public static final String CATCH_EXCEPTION_WHILE_DESERIALIZING_PROCEDURE_THIS_PROCEDURE_WILL_BE_IGNORED = - "反序列化 procedure 时捕获异常,该 procedure 将被忽略。"; + public static final String CANNOT_FIND_REGION_REPLICA_NODES_REGION = "找不到 region 副本节点,region:{}"; + public static final String + CATCH_EXCEPTION_WHILE_DESERIALIZING_PROCEDURE_THIS_PROCEDURE_WILL_BE_IGNORED = + "反序列化 procedure 时捕获异常,该 procedure 将被忽略。"; public static final String CHANGE_REGION_LEADER_FINISHED_REGIONID_NEWLEADERNODE = "{}, 切换 region leader 完成,regionId:{},newLeaderNode:{}"; public static final String CHECK_AND_INVALIDATE_COLUMN_IN_WHEN_ALTERING_COLUMN_DATA_TYPE = @@ -131,12 +131,9 @@ public final class ProcedureMessages { "尝试设置模板 {} 时检查路径 {} 下是否存在时间序列"; public static final String CLEARING_CACHE_AFTER_ALTER_TIME_SERIES_DATA_TYPE = "修改时间序列 {} 数据类型后清理缓存"; - public static final String COLUMN_CHECK_FOR_TABLE_WHEN_ADDING_COLUMN = - "添加列时对表 {}.{} 进行列检查"; - public static final String COLUMN_CHECK_FOR_TABLE_WHEN_RENAMING_COLUMN = - "重命名列时对表 {}.{} 进行列检查"; - public static final String COLUMN_CHECK_FOR_TABLE_WHEN_RENAMING_TABLE = - "重命名表时对表 {}.{} 进行列检查"; + public static final String COLUMN_CHECK_FOR_TABLE_WHEN_ADDING_COLUMN = "添加列时对表 {}.{} 进行列检查"; + public static final String COLUMN_CHECK_FOR_TABLE_WHEN_RENAMING_COLUMN = "重命名列时对表 {}.{} 进行列检查"; + public static final String COLUMN_CHECK_FOR_TABLE_WHEN_RENAMING_TABLE = "重命名表时对表 {}.{} 进行列检查"; public static final String COMMIT_CREATE_TABLE = "提交创建表 {}.{}"; public static final String COMMIT_RELEASE_INFO_OF_TABLE_WHEN_ADDING_COLUMN = "添加列时提交表 {}.{} 的释放信息"; @@ -153,20 +150,21 @@ public final class ProcedureMessages { public static final String COMMIT_RELEASE_TABLE = "提交释放表 {}.{}"; public static final String COMMIT_SET_SCHEMAENGINE_TEMPLATE_ON_PATH = "提交在路径 {} 上设置 schemaengine 模板 {}"; - public static final String CONSENSUSPIPEGUARDIAN_CONSENSUS_PIPE_IS_STOPPED_RESTARTING_ASYNCHRONOUSLY = - "[ConsensusPipeGuardian] 共识 pipe [{}] 已停止,正在异步重启"; + public static final String + CONSENSUSPIPEGUARDIAN_CONSENSUS_PIPE_IS_STOPPED_RESTARTING_ASYNCHRONOUSLY = + "[ConsensusPipeGuardian] 共识 pipe [{}] 已停止,正在异步重启"; public static final String CONSENSUSPIPEGUARDIAN_CONSENSUS_PIPE_MISSING_CREATING_ASYNCHRONOUSLY = "[ConsensusPipeGuardian] 共识 pipe [{}] 缺失,正在异步创建"; - public static final String CONSENSUSPIPEGUARDIAN_UNEXPECTED_CONSENSUS_PIPE_EXISTS_DROPPING_ASYNCHRONOUSLY = - "[ConsensusPipeGuardian] 存在非预期的共识 pipe [{}],正在异步删除"; + public static final String + CONSENSUSPIPEGUARDIAN_UNEXPECTED_CONSENSUS_PIPE_EXISTS_DROPPING_ASYNCHRONOUSLY = + "[ConsensusPipeGuardian] 存在非预期的共识 pipe [{}],正在异步删除"; public static final String CONSTRUCT_SCHEMAENGINE_BLACK_LIST_OF_DEVICES_IN = "构建 {}.{} 中设备的 schemaEngine 黑名单"; public static final String CONSTRUCT_SCHEMAENGINE_BLACK_LIST_OF_TEMPLATE_SET_ON = "构建模板 {}(设置在 {} 上)的 schemaengine 黑名单"; public static final String CONSTRUCT_SCHEMAENGINE_BLACK_LIST_OF_TIMESERIES = "构建时间序列 {} 的 schemaEngine 黑名单"; - public static final String CONSTRUCT_SCHEMA_BLACK_LIST_WITH_TEMPLATE = - "使用模板 {} 构建 schema 黑名单"; + public static final String CONSTRUCT_SCHEMA_BLACK_LIST_WITH_TEMPLATE = "使用模板 {} 构建 schema 黑名单"; public static final String CONSTRUCT_VIEW_SCHEMAENGINE_BLACK_LIST_OF_VIEW = "构建视图 {} 的 schemaengine 黑名单"; public static final String CONSUMERGROUPMETASYNCPROCEDURE_ACQUIRELOCK_SKIP_THE_PROCEDURE_DUE_TO = @@ -217,12 +215,15 @@ public final class ProcedureMessages { "CreatePipeProcedureV2: rollbackFromValidateTask({})"; public static final String CREATEPIPEPROCEDUREV2_ROLLBACKFROMWRITECONFIGNODECONSENSUS = "CreatePipeProcedureV2: rollbackFromWriteConfigNodeConsensus({})"; - public static final String CREATEREGIONGROUPS_ALL_REPLICAS_OF_REGIONGROUP_ARE_CREATED_SUCCESSFULLY = - "[CreateRegionGroups] RegionGroup:{} 的所有副本均已成功创建!"; - public static final String CREATEREGIONGROUPS_FAILED_TO_CREATE_MOST_OF_REPLICAS_IN_REGIONGROUP_THE = - "[CreateRegionGroups] RegionGroup:{} 中大多数副本创建失败,该 RegionGroup 中的冗余副本将被删除。"; - public static final String CREATEREGIONGROUPS_FAILED_TO_CREATE_SOME_REPLICAS_OF_REGIONGROUP_BUT_THIS = - "[CreateRegionGroups] RegionGroup:{} 中部分副本创建失败,但该 RegionGroup 仍可使用。"; + public static final String + CREATEREGIONGROUPS_ALL_REPLICAS_OF_REGIONGROUP_ARE_CREATED_SUCCESSFULLY = + "[CreateRegionGroups] RegionGroup:{} 的所有副本均已成功创建!"; + public static final String + CREATEREGIONGROUPS_FAILED_TO_CREATE_MOST_OF_REPLICAS_IN_REGIONGROUP_THE = + "[CreateRegionGroups] RegionGroup:{} 中大多数副本创建失败,该 RegionGroup 中的冗余副本将被删除。"; + public static final String + CREATEREGIONGROUPS_FAILED_TO_CREATE_SOME_REPLICAS_OF_REGIONGROUP_BUT_THIS = + "[CreateRegionGroups] RegionGroup:{} 中部分副本创建失败,但该 RegionGroup 仍可使用。"; public static final String CREATESUBSCRIPTIONPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES = "CreateSubscriptionProcedure: executeFromOperateOnConfigNodes"; public static final String CREATESUBSCRIPTIONPROCEDURE_EXECUTEFROMOPERATEONDATANODES = @@ -266,25 +267,20 @@ public final class ProcedureMessages { public static final String DELETELOGICALVIEW_COSTS_MS = "DeleteLogicalView-[{}] costs {}ms"; public static final String DELETETIMESERIES_COSTS_MS = "DeleteTimeSeries-[{}] costs {}ms"; public static final String DELETE_DATA_OF_DEVICES_IN = "删除 {}.{} 中设备的数据"; - public static final String DELETE_DATA_OF_TEMPLATE_TIMESERIES = - "删除模板时间序列 {} 的数据"; + public static final String DELETE_DATA_OF_TEMPLATE_TIMESERIES = "删除模板时间序列 {} 的数据"; public static final String DELETE_DATA_OF_TIMESERIES = "删除时间序列 {} 的数据"; - public static final String DELETE_DEVICES_IN_IN_SCHEMAENGINE = - "在 schemaEngine 中删除 {}.{} 中的设备"; - public static final String DELETE_TIMESERIES_SCHEMAENGINE_OF = - "删除时间序列 {} 的 schemaEngine"; + public static final String DELETE_DEVICES_IN_IN_SCHEMAENGINE = "在 schemaEngine 中删除 {}.{} 中的设备"; + public static final String DELETE_TIMESERIES_SCHEMAENGINE_OF = "删除时间序列 {} 的 schemaEngine"; public static final String DELETE_TIME_SERIES_FAILED_WHEN_BECAUSE_FAILED_TO_EXECUTE_IN = "删除时间序列 %s 失败,当 [%s] 时,原因:在所有 replicaset(%s %s)中执行失败。失败信息:%s"; public static final String DELETE_VIEW_FAILED_WHEN_BECAUSE_FAILED_TO_EXECUTE_IN_ALL = "删除视图 %s 失败,当 [%s] 时,原因:在 schemaRegion %s 的所有 replicaset 中执行失败。失败信息:%s"; public static final String DELETE_VIEW_SCHEMAENGINE_OF = "删除视图 {} 的 schemaengine"; public static final String DELETING_DATA_FOR_TABLE = "正在删除表 {}.{} 的数据"; - public static final String DELETING_DEVICES_FOR_TABLE_WHEN_DROPPING_TABLE = - "删除表时正在删除表 {}.{} 的设备"; + public static final String DELETING_DEVICES_FOR_TABLE_WHEN_DROPPING_TABLE = "删除表时正在删除表 {}.{} 的设备"; public static final String DESERIALIZE_MEETS_ERROR_IN_CREATEREGIONGROUPSPROCEDURE = "在 CreateRegionGroupsProcedure 中反序列化出错"; - public static final String DROPPING_COLUMN_IN_ON_CONFIGNODE = - "在 ConfigNode 上删除表 {}.{} 中的列 {}"; + public static final String DROPPING_COLUMN_IN_ON_CONFIGNODE = "在 ConfigNode 上删除表 {}.{} 中的列 {}"; public static final String DROPPING_TABLE_ON_CONFIGNODE = "在 ConfigNode 上删除表 {}.{}"; public static final String DROPPIPEPLUGINPROCEDURE_EXECUTEFROMDROPONCONFIGNODES = "DropPipePluginProcedure: executeFromDropOnConfigNodes({})"; @@ -371,10 +367,10 @@ public final class ProcedureMessages { "{}, 修改 DataNode 状态失败,dataNodeId={},nodeStatus={}"; public static final String FAILED_TO_COMMIT_SET_TEMPLATE_ON_PATH_DUE_TO = "在路径 {} 上提交设置模板 {} 失败,原因:{}"; - public static final String FAILED_TO_CREATE_CONSENSUS_PIPE = - "{}, 创建共识 pipe {} 失败:{}"; - public static final String FAILED_TO_CREATE_PIPES_WHEN_CREATING_SUBSCRIPTION_WITH_REQUEST_DETAILS = - "使用请求 %s 创建订阅时创建 pipes %s 失败,详情:%s,元数据将稍后同步。"; + public static final String FAILED_TO_CREATE_CONSENSUS_PIPE = "{}, 创建共识 pipe {} 失败:{}"; + public static final String + FAILED_TO_CREATE_PIPES_WHEN_CREATING_SUBSCRIPTION_WITH_REQUEST_DETAILS = + "使用请求 %s 创建订阅时创建 pipes %s 失败,详情:%s,元数据将稍后同步。"; public static final String FAILED_TO_CREATE_PIPE_DETAILS_METADATA_WILL_BE_SYNCHRONIZED_LATER = "创建 pipe {} 失败,详情:{},元数据将稍后同步。"; public static final String FAILED_TO_CREATE_PIPE_PLUGIN_INSTANCE_ON_DATA_NODES = @@ -409,8 +405,7 @@ public final class ProcedureMessages { "在路径 %s 上检查模板时,在 schemaRegion %s 的所有 replicaset 中执行失败。失败信息:%s"; public static final String FAILED_TO_EXECUTE_IN_ALL_REPLICASET_OF_SCHEMAREGION_WHEN_CHECKING_2 = "在 %s 上检查模板 %s 时,在 schemaRegion %s 的所有 replicaset 中执行失败。失败节点:%s"; - public static final String FAILED_TO_EXECUTE_PLAN_BECAUSE = - "执行 plan {} 失败,原因:{}"; + public static final String FAILED_TO_EXECUTE_PLAN_BECAUSE = "执行 plan {} 失败,原因:{}"; public static final String FAILED_TO_FOR_TABLE_TO_DATANODE_FAILURE_RESULTS = "对表 {}.{} 在 DataNode 上执行 {} 失败,失败结果:{}"; public static final String FAILED_TO_INIT_CQ_BECAUSE_OF_UNKNOWN_REASONS = @@ -434,9 +429,8 @@ public final class ProcedureMessages { public static final String FAILED_TO_PRE_RELEASE_FOR_TABLE_TO_DATANODE_FAILURE_RESULTS = "对表 {}.{} 在 DataNode 上预释放 {} 失败,失败结果:{}"; public static final String FAILED_TO_PRE_SET_TEMPLATE_ON_PATH_DUE_TO = - "Failed to pre set template {} on path {} due to {}"; - public static final String FAILED_TO_PROVE_DN_IS_FENCED = "不能证明一个不可达的DN已经处于隔离状态"; "在路径 {} 上预设置模板 {} 失败,原因:{}"; + public static final String FAILED_TO_PROVE_DN_IS_FENCED = "不能证明一个不可达的DN已经处于隔离状态"; public static final String FAILED_TO_PUSH_CONSUMER_GROUP_META_TO_DATANODES_DETAILS = "向 DataNode 推送 consumer group 元数据失败,详情:%s"; public static final String FAILED_TO_PUSH_PIPE_META_LIST_TO_DATA_NODES_WILL = @@ -456,8 +450,9 @@ public final class ProcedureMessages { "回滚修改 pipe {} 失败,详情:{},元数据将稍后同步。"; public static final String FAILED_TO_ROLLBACK_COMMIT_SET_TEMPLATE_ON_PATH_DUE_TO = "回滚在路径 {} 上提交的模板 {} 设置失败,原因:{}"; - public static final String FAILED_TO_ROLLBACK_CREATE_PIPES_WHEN_CREATING_SUBSCRIPTION_WITH_REQUEST = - "使用请求 %s 创建订阅时回滚创建 pipes 失败,原因:%s"; + public static final String + FAILED_TO_ROLLBACK_CREATE_PIPES_WHEN_CREATING_SUBSCRIPTION_WITH_REQUEST = + "使用请求 %s 创建订阅时回滚创建 pipes 失败,原因:%s"; public static final String FAILED_TO_ROLLBACK_CREATE_PIPE_DETAILS_METADATA_WILL_BE_SYNCHRONIZED = "回滚创建 pipe {} 失败,详情:{},元数据将稍后同步。"; public static final String FAILED_TO_ROLLBACK_CREATING_SUBSCRIPTION_WITH_REQUEST_ON_CONFIG_NODES = @@ -488,14 +483,11 @@ public final class ProcedureMessages { "回滚启动 pipe {} 失败,详情:{},元数据将稍后同步。"; public static final String FAILED_TO_ROLLBACK_STOP_PIPE_DETAILS_METADATA_WILL_BE_SYNCHRONIZED = "回滚停止 pipe {} 失败,详情:{},元数据将稍后同步。"; - public static final String FAILED_TO_ROLLBACK_TABLE_CREATION = - "回滚表 {} 的创建失败。{}"; + public static final String FAILED_TO_ROLLBACK_TABLE_CREATION = "回滚表 {} 的创建失败。{}"; public static final String FAILED_TO_ROLLBACK_TEMPLATE_CACHE_OF_TEMPLATE_SET_ON = "回滚模板 {}(设置在 {} 上)的模板缓存失败"; - public static final String FAILED_TO_SERIALIZE_DATAPARTITIONTABLES = - "序列化 dataPartitionTables 失败"; - public static final String FAILED_TO_SERIALIZE_FAILEDDATANODE = - "序列化 failedDataNode 失败"; + public static final String FAILED_TO_SERIALIZE_DATAPARTITIONTABLES = "序列化 dataPartitionTables 失败"; + public static final String FAILED_TO_SERIALIZE_FAILEDDATANODE = "序列化 failedDataNode 失败"; public static final String FAILED_TO_SERIALIZE_FINALDATAPARTITIONTABLES = "序列化 finalDataPartitionTables 失败"; public static final String FAILED_TO_SERIALIZE_SKIPDATANODE = "序列化 skipDataNode 失败"; @@ -518,8 +510,7 @@ public final class ProcedureMessages { public static final String FAILED_TO_SYNC_TEMPLATE_PRE_SET_INFO_ON_PATH_TO = "向 DataNode {} 同步路径 {} 上模板 {} 的 pre-set 信息失败"; public static final String FAILED_TO_UPDATE_PROCEDURE = "更新 procedure {} 失败"; - public static final String FAILED_TO_UPDATE_TTL_CACHE_OF_DATANODE = - "更新 DataNode 的 ttl 缓存失败。"; + public static final String FAILED_TO_UPDATE_TTL_CACHE_OF_DATANODE = "更新 DataNode 的 ttl 缓存失败。"; public static final String FAILED_TO_WRITE_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = "将 DataPartitionTable 写入共识日志失败"; public static final String FAIL_IN_CREATECQPROCEDURE = "在 CreateCQProcedure 中失败"; @@ -531,63 +522,48 @@ public final class ProcedureMessages { "重试 {} 次后创建 pipe plugin [{}] 仍失败"; public static final String FAIL_TO_CREATE_TRIGGERINSTANCE_ON_DATA_NODES = "在 DataNode 上创建 triggerInstance [%s] 失败"; - public static final String FAIL_TO_CREATE_TRIGGER_AT_STATE = - "在 STATE [%s] 处创建 trigger [%s] 失败"; + public static final String FAIL_TO_CREATE_TRIGGER_AT_STATE = "在 STATE [%s] 处创建 trigger [%s] 失败"; public static final String FAIL_TO_DATA_NODE_INACTIVE_ROLLBACK_OF_TRIGGER = "对 trigger [%s] 执行 [DATA_NODE_INACTIVE] 回滚失败"; public static final String FAIL_TO_DROP_PIPE_PLUGIN_AFTER_RETRIES = "重试 {} 次后删除 pipe plugin [{}] 仍失败"; - public static final String FAIL_TO_DROP_TRIGGER_AT_STATE = - "在 STATE [%s] 处删除 trigger [%s] 失败"; - public static final String FAIL_TO_DROP_TRIGGER_ON_DATA_NODES = - "在 DataNode 上删除 trigger [%s] 失败"; - public static final String FAIL_TO_EXECUTE_PLAN_AT_STATE = - "在 state[%s] 处执行 plan [%s] 失败"; - public static final String FAIL_TO_REMOVE_AINODE_AT_STATE = - "在 STATE [%s] 处移除 AINode [%s] 失败,%s"; + public static final String FAIL_TO_DROP_TRIGGER_AT_STATE = "在 STATE [%s] 处删除 trigger [%s] 失败"; + public static final String FAIL_TO_DROP_TRIGGER_ON_DATA_NODES = "在 DataNode 上删除 trigger [%s] 失败"; + public static final String FAIL_TO_EXECUTE_PLAN_AT_STATE = "在 state[%s] 处执行 plan [%s] 失败"; + public static final String FAIL_TO_REMOVE_AINODE_AT_STATE = "在 STATE [%s] 处移除 AINode [%s] 失败,%s"; public static final String FAIL_TO_REMOVE_AINODE_ON_CONFIG_NODES = "在 ConfigNode [%s] 上移除 [%s] 个 AINode 失败"; public static final String FAIL_WHEN_EXECUTE = "执行 {} 时失败 "; public static final String FINISH_INACTIVE_ROLLBACK_OF_CQ_SUCCESSFULLY = "成功完成 CQ {} 的 [INACTIVE] 回滚"; public static final String FINISH_INIT_CQ_SUCCESSFULLY = "成功完成 CQ {} 的初始化"; - public static final String FINISH_SCHEDULING_CQ_SUCCESSFULLY = - "成功完成 CQ {} 的调度"; + public static final String FINISH_SCHEDULING_CQ_SUCCESSFULLY = "成功完成 CQ {} 的调度"; public static final String FORCE_UPDATE_NODECACHE_DATANODEID_NODESTATUS_CURRENTTIME = "{}, 强制更新 NodeCache:dataNodeId={},nodeStatus={},currentTime={}"; public static final String FOR_FAILED_WHEN_BECAUSE_FAILED_TO_EXECUTE_IN_ALL_REPLICASET = "[%s] 对 %s.%s 失败,当 [%s] 时,原因:在所有 replicaset(%s %s)中执行失败。失败节点:%s"; public static final String FOR_FAILED_WHEN_CONSTRUCT_BLACK_LIST_FOR_TABLE_BECAUSE_FAILED = "[%s] 对 %s.%s 失败,当为表构建黑名单时,原因:在所有 replicaset(%s %s)中执行失败。失败信息:%s"; - public static final String INVALIDATE_CACHE_OF_DEVICES_IN = - "使 {}.{} 中设备的缓存失效"; - public static final String INVALIDATE_CACHE_OF_TEMPLATE_SET_ON = - "使模板 {}(设置在 {} 上)的缓存失效"; - public static final String INVALIDATE_CACHE_OF_TEMPLATE_TIMESERIES = - "使模板时间序列 {} 的缓存失效"; + public static final String INVALIDATE_CACHE_OF_DEVICES_IN = "使 {}.{} 中设备的缓存失效"; + public static final String INVALIDATE_CACHE_OF_TEMPLATE_SET_ON = "使模板 {}(设置在 {} 上)的缓存失效"; + public static final String INVALIDATE_CACHE_OF_TEMPLATE_TIMESERIES = "使模板时间序列 {} 的缓存失效"; public static final String INVALIDATE_CACHE_OF_TIMESERIES = "使时间序列 {} 的缓存失效"; public static final String INVALIDATE_CACHE_OF_VIEW = "使视图 {} 的缓存失效"; - public static final String INVALIDATE_COLUMN_CACHE_FAILED_FOR_TABLE = - "使表 %s.%s 的列 %s 缓存失效失败"; + public static final String INVALIDATE_COLUMN_CACHE_FAILED_FOR_TABLE = "使表 %s.%s 的列 %s 缓存失效失败"; public static final String INVALIDATE_SCHEMAENGINE_CACHE_FAILED = "使 SchemaEngine 缓存失效失败"; public static final String INVALIDATE_SCHEMA_CACHE_FAILED = "使 schema 缓存失效失败"; public static final String INVALIDATE_TEMPLATE_CACHE_FAILED = "使模板缓存失效失败"; - public static final String INVALIDATE_VIEW_SCHEMAENGINE_CACHE_FAILED = - "使视图 schemaengine 缓存失效失败"; + public static final String INVALIDATE_VIEW_SCHEMAENGINE_CACHE_FAILED = "使视图 schemaengine 缓存失效失败"; public static final String INVALIDATING_CACHE_FOR_COLUMN_IN_WHEN_DROPPING_COLUMN = - "Invalidating cache for column {} in {}.{} when dropping column"; + "删除列时正在使表 {}.{} 中的列 {} 缓存失效"; public static final String PRE_RELEASE_DELETE_TABLE_WHEN_DROPPING_TABLE = "执行表删除操作流程时,预删除表 {}.{}"; public static final String COMMIT_RELEASE_DELETE_TABLE_WHEN_DROPPING_TABLE = "执行删除表操作流程时,正式删除表 {}.{}"; - "删除列时正在使表 {}.{} 中的列 {} 缓存失效"; public static final String INVALIDATING_CACHE_FOR_TABLE_WHEN_DROPPING_TABLE = "删除表时正在使表 {}.{} 缓存失效"; - public static final String INVALID_DATA_TYPE_CANNOT_BE_USED_AS_A_NEW_TYPE = - "无效的数据类型不能作为新类型使用"; - public static final String IO_ERROR_WHEN_DESERIALIZE_AUTHPLAN = - "反序列化 authplan 时发生 IO 错误。"; - public static final String IO_ERROR_WHEN_DESERIALIZE_SETTTL_PLAN = - "反序列化 setTTL plan 时发生 IO 错误。"; + public static final String INVALID_DATA_TYPE_CANNOT_BE_USED_AS_A_NEW_TYPE = "无效的数据类型不能作为新类型使用"; + public static final String IO_ERROR_WHEN_DESERIALIZE_AUTHPLAN = "反序列化 authplan 时发生 IO 错误。"; + public static final String IO_ERROR_WHEN_DESERIALIZE_SETTTL_PLAN = "反序列化 setTTL plan 时发生 IO 错误。"; public static final String NO_AVAILABLE_DATANODE_TO_ASSIGN_TASKS = "没有可用的 DataNode 分配任务"; public static final String NO_DATABASE_LOST_DATA_PARTITION_TABLE_FOR_CONSENSUS_WRITE = "没有数据库丢失用于共识写入的数据分区表"; @@ -598,10 +574,12 @@ public final class ProcedureMessages { public static final String OPERATION_TIMED_OUT_AFTER = "操作超时,已耗时 "; public static final String PARTITION_TABLE_CLEANER_ACTIVATE_TTL_LOG = "[PartitionTableCleaner] 定期激活 PartitionTableAutoCleaner,databaseTTL:{}"; - public static final String PARTITIONTABLECLEANER_PERIODICALLY_ACTIVATE_PARTITIONTABLEAUTOCLEANER_FOR = - "[PartitionTableCleaner] 为 {} 定期激活 PartitionTableAutoCleaner"; - public static final String PARTITIONTABLECLEANER_THE_PARTITIONTABLEAUTOCLEANER_IS_STARTED_WITH_CYCLE_MS = - "[PartitionTableCleaner] PartitionTableAutoCleaner 已启动,cycle={}ms"; + public static final String + PARTITIONTABLECLEANER_PERIODICALLY_ACTIVATE_PARTITIONTABLEAUTOCLEANER_FOR = + "[PartitionTableCleaner] 为 {} 定期激活 PartitionTableAutoCleaner"; + public static final String + PARTITIONTABLECLEANER_THE_PARTITIONTABLEAUTOCLEANER_IS_STARTED_WITH_CYCLE_MS = + "[PartitionTableCleaner] PartitionTableAutoCleaner 已启动,cycle={}ms"; public static final String PID_ADDREGION_CANNOT_ROLL_BACK_BECAUSE_CANNOT_FIND_THE_CORRECT = "[pid{}][AddRegion] 无法回滚,原因:找不到正确的 locations"; public static final String PID_ADDREGION_IT_APPEARS_THAT_CONSENSUS_WRITE_HAS_NOT_MODIFIED = @@ -632,13 +610,13 @@ public final class ProcedureMessages { "[pid{}][RemoveRegionGroup] 成功,region group {} 已删除。过程耗时 {}(开始于 {})。"; public static final String PID_MIGRATEREGION_STARTED_WILL_BE_MIGRATED_FROM_DATANODE_TO = "[pid{}][MigrateRegion] 开始,{} 将从 DataNode {} 迁移到 {}。"; - public static final String PID_MIGRATEREGION_STATE_COMPLETE = - "[pid{}][MigrateRegion] 状态 {} 完成"; + public static final String PID_MIGRATEREGION_STATE_COMPLETE = "[pid{}][MigrateRegion] 状态 {} 完成"; public static final String PID_MIGRATEREGION_STATE_FAIL = "[pid{}][MigrateRegion] 状态 {} 失败"; public static final String PID_MIGRATEREGION_SUB_PROCEDURE_ADDREGIONPEERPROCEDURE = "[pid{}][MigrateRegion] 子 procedure AddRegionPeerProcedure 失败,RegionMigrateProcedure 将不再继续"; - public static final String PID_MIGRATEREGION_SUCCESS_HAS_BEEN_MIGRATED_FROM_DATANODE_TO_PROCEDURE = - "[pid{}][MigrateRegion] 成功,{} {} 已从 DataNode {} 迁移到 {}。Procedure 耗时 {}(开始于 {})。"; + public static final String + PID_MIGRATEREGION_SUCCESS_HAS_BEEN_MIGRATED_FROM_DATANODE_TO_PROCEDURE = + "[pid{}][MigrateRegion] 成功,{} {} 已从 DataNode {} 迁移到 {}。Procedure 耗时 {}(开始于 {})。"; public static final String PID_NOTIFYREGIONMIGRATION_STARTED_REGION_ID_IS = "[pid{}][NotifyRegionMigration] 开始,region id 为 {}。"; public static final String PID_NOTIFYREGIONMIGRATION_STATE_COMPLETE = @@ -647,8 +625,9 @@ public final class ProcedureMessages { "[pid{}][NotifyRegionMigration] 状态 {} 失败"; public static final String PID_RECONSTRUCTREGION_FAILED_BUT_THE_REGION_HAS_BEEN_REMOVED_FROM = "[pid{}][ReconstructRegion] 失败,但 region {} 已从 DataNode {} 移除。请使用 'extend region' 修复。"; - public static final String PID_RECONSTRUCTREGION_STARTED_REGION_ON_DATANODE_WILL_BE_RECONSTRUCTED = - "[pid{}][ReconstructRegion] 开始,DataNode {}({}) 上的 region {} 将被重建。"; + public static final String + PID_RECONSTRUCTREGION_STARTED_REGION_ON_DATANODE_WILL_BE_RECONSTRUCTED = + "[pid{}][ReconstructRegion] 开始,DataNode {}({}) 上的 region {} 将被重建。"; public static final String PID_RECONSTRUCTREGION_STATE_COMPLETE = "[pid{}][ReconstructRegion] 状态 {} 完成"; public static final String PID_RECONSTRUCTREGION_STATE_FAIL = @@ -657,24 +636,27 @@ public final class ProcedureMessages { "[pid{}][ReconstructRegion] 子 procedure RemoveRegionPeerProcedure 失败,ReconstructRegionProcedure 将不再继续"; public static final String PID_RECONSTRUCTREGION_SUCCESS_REGION_HAS_BEEN_RECONSTRUCTED = "[pid{}][ReconstructRegion] 成功,region {} 已在 DataNode {} 上重建。Procedure 耗时 {}(开始于 {})"; - public static final String PID_REMOVEREGION_DELETE_OLD_REGION_PEER_EXECUTED_FAILED_AFTER_ATTEMPTS = - "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER 在 {} 次尝试后仍执行失败,procedure 将继续。请手动删除 region 文件。{}"; + public static final String + PID_REMOVEREGION_DELETE_OLD_REGION_PEER_EXECUTED_FAILED_AFTER_ATTEMPTS = + "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER 在 {} 次尝试后仍执行失败,procedure 将继续。请手动删除 region 文件。{}"; public static final String PID_REMOVEREGION_DELETE_OLD_REGION_PEER_EXECUTED_FAILED_ATTEMPT_WILL = "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER 执行失败(第 {}/{} 次尝试),将在 {} 毫秒后重试。{}"; public static final String PID_REMOVEREGION_DELETE_OLD_REGION_PEER_TASK_SUBMITTED_FAILED_AFTER = "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER 任务在 {} 次尝试后仍提交失败,procedure 将继续。请手动删除 region 文件。{}"; public static final String PID_REMOVEREGION_DELETE_OLD_REGION_PEER_TASK_SUBMITTED_FAILED_ATTEMPT = "[pid{}][RemoveRegion] DELETE_OLD_REGION_PEER 任务提交失败(第 {}/{} 次尝试),将在 {} 毫秒后重试。{}"; - public static final String PID_REMOVEREGION_EXECUTED_FAILED_CONFIGNODE_BELIEVE_CURRENT_PEER_LIST_OF = - "[pid{}][RemoveRegion] {} 执行失败,ConfigNode 认为 {} 当前的 peer list 为 {}。Procedure 将继续。请手动清理 peer list。"; + public static final String + PID_REMOVEREGION_EXECUTED_FAILED_CONFIGNODE_BELIEVE_CURRENT_PEER_LIST_OF = + "[pid{}][RemoveRegion] {} 执行失败,ConfigNode 认为 {} 当前的 peer list 为 {}。Procedure 将继续。请手动清理 peer list。"; public static final String PID_REMOVEREGION_STARTED_REGION_WILL_BE_REMOVED_FROM_DATANODE = "[pid{}][RemoveRegion] 开始,region {} 将从 DataNode {} 移除。"; - public static final String PID_REMOVEREGION_STATE_SUCCESS = - "[pid{}][RemoveRegion] 状态 {} 成功"; - public static final String PID_REMOVEREGION_SUCCESS_REGION_HAS_BEEN_REMOVED_FROM_DATANODE_PROCEDURE = - "[pid{}][RemoveRegion] 成功,region {} 已从 DataNode {} 移除。Procedure 耗时 {}(开始于 {})"; - public static final String PID_REMOVEREGION_TASK_SUBMITTED_FAILED_CONFIGNODE_BELIEVE_CURRENT_PEER_LIST = - "[pid{}][RemoveRegion] {} 任务提交失败,ConfigNode 认为 {} 当前的 peer list 为 {}。Procedure 将继续。请手动清理 peer list。"; + public static final String PID_REMOVEREGION_STATE_SUCCESS = "[pid{}][RemoveRegion] 状态 {} 成功"; + public static final String + PID_REMOVEREGION_SUCCESS_REGION_HAS_BEEN_REMOVED_FROM_DATANODE_PROCEDURE = + "[pid{}][RemoveRegion] 成功,region {} 已从 DataNode {} 移除。Procedure 耗时 {}(开始于 {})"; + public static final String + PID_REMOVEREGION_TASK_SUBMITTED_FAILED_CONFIGNODE_BELIEVE_CURRENT_PEER_LIST = + "[pid{}][RemoveRegion] {} 任务提交失败,ConfigNode 认为 {} 当前的 peer list 为 {}。Procedure 将继续。请手动清理 peer list。"; public static final String PIPEHANDLELEADERCHANGEPROCEDURE_EXECUTEFROMCALCULATEINFOFORTASK = "PipeHandleLeaderChangeProcedure: executeFromCalculateInfoForTask"; public static final String PIPEHANDLELEADERCHANGEPROCEDURE_EXECUTEFROMHANDLEONCONFIGNODES = @@ -707,8 +689,9 @@ public final class ProcedureMessages { "PipeHandleMetaChangeProcedure: rollbackFromValidateTask"; public static final String PIPEHANDLEMETACHANGEPROCEDURE_ROLLBACKFROMWRITECONFIGNODECONSENSUS = "PipeHandleMetaChangeProcedure: rollbackFromWriteConfigNodeConsensus"; - public static final String PIPEMETASYNCPROCEDURE_ACQUIRELOCK_SKIP_THE_PROCEDURE_DUE_TO_THE_LAST_EXECUTION = - "PipeMetaSyncProcedure: acquireLock, skip the procedure due to the last execution time {}"; + public static final String + PIPEMETASYNCPROCEDURE_ACQUIRELOCK_SKIP_THE_PROCEDURE_DUE_TO_THE_LAST_EXECUTION = + "PipeMetaSyncProcedure: acquireLock, skip the procedure due to the last execution time {}"; public static final String PIPEMETASYNCPROCEDURE_EXECUTEFROMCALCULATEINFOFORTASK = "PipeMetaSyncProcedure: executeFromCalculateInfoForTask"; public static final String PIPEMETASYNCPROCEDURE_EXECUTEFROMOPERATEONDATANODES = @@ -727,8 +710,9 @@ public final class ProcedureMessages { "PipeMetaSyncProcedure: rollbackFromWriteConfigNodeConsensus"; public static final String PIPE_NOT_FOUND_IN_PIPETASKINFO_CAN_NOT_PUSH_ITS_META = "在 PipeTaskInfo 中找不到 Pipe {},无法推送其元数据。"; - public static final String PIPE_PLUGIN_IS_ALREADY_CREATED_AND_ISSETIFNOTEXISTSCONDITION_IS_TRUE_END = - "Pipe plugin {} 已创建,且 isSetIfNotExistsCondition 为 true,结束 CreatePipePluginProcedure({})"; + public static final String + PIPE_PLUGIN_IS_ALREADY_CREATED_AND_ISSETIFNOTEXISTSCONDITION_IS_TRUE_END = + "Pipe plugin {} 已创建,且 isSetIfNotExistsCondition 为 true,结束 CreatePipePluginProcedure({})"; public static final String PIPE_PLUGIN_IS_ALREADY_CREATED_END_THE_CREATEPIPEPLUGINPROCEDURE = "Pipe plugin {} 已创建,结束 CreatePipePluginProcedure({})"; public static final String PIPE_PLUGIN_IS_NOT_EXIST_END_THE_DROPPIPEPLUGINPROCEDURE = @@ -738,14 +722,10 @@ public final class ProcedureMessages { public static final String PRE_RELEASE = "预释放 "; public static final String PRE_RELEASE_INFO_FOR_TABLE_WHEN_SETTING_PROPERTIES = "设置属性时预释放表 {}.{} 的信息"; - public static final String PRE_RELEASE_INFO_OF_TABLE_WHEN_ADDING_COLUMN = - "添加列时预释放表 {}.{} 的信息"; - public static final String PRE_RELEASE_INFO_OF_TABLE_WHEN_ALTERING_COLUMN = - "修改列时预释放表 {}.{} 的信息"; - public static final String PRE_RELEASE_INFO_OF_TABLE_WHEN_RENAMING_COLUMN = - "重命名列时预释放表 {}.{} 的信息"; - public static final String PRE_RELEASE_INFO_OF_TABLE_WHEN_RENAMING_TABLE = - "重命名表时预释放表 {}.{} 的信息"; + public static final String PRE_RELEASE_INFO_OF_TABLE_WHEN_ADDING_COLUMN = "添加列时预释放表 {}.{} 的信息"; + public static final String PRE_RELEASE_INFO_OF_TABLE_WHEN_ALTERING_COLUMN = "修改列时预释放表 {}.{} 的信息"; + public static final String PRE_RELEASE_INFO_OF_TABLE_WHEN_RENAMING_COLUMN = "重命名列时预释放表 {}.{} 的信息"; + public static final String PRE_RELEASE_INFO_OF_TABLE_WHEN_RENAMING_TABLE = "重命名表时预释放表 {}.{} 的信息"; public static final String PRE_RELEASE_SCHEMAENGINE_TEMPLATE_SET_ON_PATH = "预释放在路径 {} 上设置的 schemaengine 模板 {}"; public static final String PRE_RELEASE_TABLE = "预释放表 {}.{}"; @@ -783,16 +763,21 @@ public final class ProcedureMessages { "ProcedureId {}:{}。锁状态无效。未获取 pipe 锁。"; public static final String PROCEDUREID_INVALID_LOCK_STATE_WITHOUT_ACQUIRING_SUBSCRIPTION_LOCK = "ProcedureId {}:{}。锁状态无效。未获取 subscription 锁。"; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH = - "ProcedureId {}:LOCK_ACQUIRED。后续 procedure 应在持有 pipe 锁的情况下执行。"; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH_2 = - "ProcedureId {}:LOCK_ACQUIRED。后续 procedure 应在同时持有 subscription 锁和 pipe 锁的情况下执行。"; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH_3 = - "ProcedureId {}:LOCK_ACQUIRED。后续 procedure 应在持有 subscription 锁的情况下执行。"; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_NOT_BE_EXECUTED = - "ProcedureId {}:LOCK_ACQUIRED。后续 procedure 不应在未持有 pipe 锁的情况下执行。"; - public static final String PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_NOT_BE_EXECUTED_2 = - "ProcedureId {}:LOCK_ACQUIRED。后续 procedure 不应在未持有 subscription 锁的情况下执行。"; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH = + "ProcedureId {}:LOCK_ACQUIRED。后续 procedure 应在持有 pipe 锁的情况下执行。"; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH_2 = + "ProcedureId {}:LOCK_ACQUIRED。后续 procedure 应在同时持有 subscription 锁和 pipe 锁的情况下执行。"; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_BE_EXECUTED_WITH_3 = + "ProcedureId {}:LOCK_ACQUIRED。后续 procedure 应在持有 subscription 锁的情况下执行。"; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_NOT_BE_EXECUTED = + "ProcedureId {}:LOCK_ACQUIRED。后续 procedure 不应在未持有 pipe 锁的情况下执行。"; + public static final String + PROCEDUREID_LOCK_ACQUIRED_THE_FOLLOWING_PROCEDURE_SHOULD_NOT_BE_EXECUTED_2 = + "ProcedureId {}:LOCK_ACQUIRED。后续 procedure 不应在未持有 subscription 锁的情况下执行。"; public static final String PROCEDUREID_LOCK_EVENT_WAIT_PIPE_LOCK_WILL_BE_RELEASED = "ProcedureId {}:LOCK_EVENT_WAIT。Pipe 锁将被释放。"; public static final String PROCEDUREID_LOCK_EVENT_WAIT_SUBSCRIPTION_LOCK_WILL_BE_RELEASED = @@ -801,8 +786,9 @@ public final class ProcedureMessages { "ProcedureId {}:LOCK_EVENT_WAIT。未获取 pipe 锁。"; public static final String PROCEDUREID_LOCK_EVENT_WAIT_WITHOUT_ACQUIRING_SUBSCRIPTION_LOCK = "ProcedureId {}:LOCK_EVENT_WAIT。未获取 subscription 锁。"; - public static final String PROCEDUREID_PIPE_LOCK_IS_NOT_ACQUIRED_EXECUTEFROMSTATE_S_EXECUTION_WILL = - "ProcedureId {}:未获取 pipe 锁,executeFromState 的执行将被跳过。"; + public static final String + PROCEDUREID_PIPE_LOCK_IS_NOT_ACQUIRED_EXECUTEFROMSTATE_S_EXECUTION_WILL = + "ProcedureId {}:未获取 pipe 锁,executeFromState 的执行将被跳过。"; public static final String PROCEDUREID_PIPE_LOCK_IS_NOT_ACQUIRED_ROLLBACKSTATE_S_EXECUTION_WILL = "ProcedureId {}:未获取 pipe 锁,rollbackState({}) 的执行将被跳过。"; public static final String PROCEDUREID_RELEASE_LOCK_NO_NEED_TO_RELEASE_PIPE_LOCK = @@ -813,12 +799,13 @@ public final class ProcedureMessages { "ProcedureId {} 释放锁。Pipe 锁将被释放。"; public static final String PROCEDUREID_RELEASE_LOCK_SUBSCRIPTION_LOCK_WILL_BE_RELEASED = "ProcedureId {} 释放锁。Subscription 锁将被释放。"; - public static final String PROCEDUREID_SUBSCRIPTION_LOCK_IS_NOT_ACQUIRED_EXECUTEFROMSTATE_S_EXECUTION_WILL = - "ProcedureId {}:未获取 subscription 锁,executeFromState({}) 的执行将被跳过。"; - public static final String PROCEDUREID_SUBSCRIPTION_LOCK_IS_NOT_ACQUIRED_ROLLBACKSTATE_S_EXECUTION_WILL = - "ProcedureId {}:未获取 subscription 锁,rollbackState({}) 的执行将被跳过。"; - public static final String PROCEDUREID_TRY_TO_ACQUIRE_PIPE_LOCK = - "ProcedureId {} 尝试获取 pipe 锁。"; + public static final String + PROCEDUREID_SUBSCRIPTION_LOCK_IS_NOT_ACQUIRED_EXECUTEFROMSTATE_S_EXECUTION_WILL = + "ProcedureId {}:未获取 subscription 锁,executeFromState({}) 的执行将被跳过。"; + public static final String + PROCEDUREID_SUBSCRIPTION_LOCK_IS_NOT_ACQUIRED_ROLLBACKSTATE_S_EXECUTION_WILL = + "ProcedureId {}:未获取 subscription 锁,rollbackState({}) 的执行将被跳过。"; + public static final String PROCEDUREID_TRY_TO_ACQUIRE_PIPE_LOCK = "ProcedureId {} 尝试获取 pipe 锁。"; public static final String PROCEDUREID_TRY_TO_ACQUIRE_SUBSCRIPTION_AND_PIPE_LOCK = "ProcedureId {} 尝试获取 subscription 锁和 pipe 锁。"; public static final String PROCEDUREID_TRY_TO_ACQUIRE_SUBSCRIPTION_LOCK = @@ -834,8 +821,7 @@ public final class ProcedureMessages { public static final String REMOVE_DATA_NODE_FAILED = "移除 DataNode 失败 "; public static final String RENAMETABLECOLUMN_COSTS_MS = "RenameTableColumn-{}.{}-{} costs {}ms"; public static final String RENAMETABLE_COSTS_MS = "RenameTable-{}.{}-{} costs {}ms"; - public static final String RENAME_COLUMN_TO_TABLE_ON_CONFIG_NODE = - "在 ConfigNode 上重命名表 {}.{} 的列"; + public static final String RENAME_COLUMN_TO_TABLE_ON_CONFIG_NODE = "在 ConfigNode 上重命名表 {}.{} 的列"; public static final String RETRIEVABLE_ERROR_TRYING_TO_CREATE_CQ_STATE = "尝试创建 cq [{}] 时发生可重试错误,状态 [{}]"; public static final String RETRIEVABLE_ERROR_TRYING_TO_CREATE_PIPE_PLUGIN_STATE = @@ -851,8 +837,7 @@ public final class ProcedureMessages { public static final String ROLLBACK_DROPTABLE_COSTS_MS = "Rollback DropTable-{} costs {}ms."; public static final String ROLLBACK_PRE_RELEASE = "回滚预释放 "; public static final String ROLLBACK_PRE_DELETE_TABLE_FAILED = "回滚预删除表 %s.%s 操作失败, 请手动输入sql删除"; - public static final String ROLLBACK_PRE_RELEASE_TEMPLATE_FAILED = - "回滚预释放模板失败"; + public static final String ROLLBACK_PRE_RELEASE_TEMPLATE_FAILED = "回滚预释放模板失败"; public static final String ROLLBACK_RENAMETABLECOLUMN_COSTS_MS = "Rollback RenameTableColumn-{} costs {}ms."; public static final String ROLLBACK_RENAMETABLE_COSTS_MS = "Rollback RenameTable-{} costs {}ms."; @@ -860,15 +845,17 @@ public final class ProcedureMessages { "Rollback SetTableProperties-{} costs {}ms."; public static final String ROLLBACK_SETTEMPLATE_COSTS_MS = "Rollback SetTemplate-{} costs {}ms."; public static final String ROLLBACK_TEMPLATE_CACHE_FAILED = "回滚模板缓存失败"; - public static final String ROLLBACK_TEMPLATE_PRE_UNSET_FAILED_BECAUSE_OF = - "回滚预取消设置模板失败,原因"; - public static final String ROLLBACK_UNSET_TEMPLATE_FAILED_AND_THE_CLUSTER_TEMPLATE_INFO_MANAGEMENT = - "回滚取消设置模板失败,集群模板信息管理已严重损坏。请重新尝试取消设置。"; + public static final String ROLLBACK_TEMPLATE_PRE_UNSET_FAILED_BECAUSE_OF = "回滚预取消设置模板失败,原因"; + public static final String + ROLLBACK_UNSET_TEMPLATE_FAILED_AND_THE_CLUSTER_TEMPLATE_INFO_MANAGEMENT = + "回滚取消设置模板失败,集群模板信息管理已严重损坏。请重新尝试取消设置。"; public static final String SELECTED_DATANODE_FOR_REGION = "已为 Region {} 选择 DataNode {}"; - public static final String SEND_ACTION_ADDREGIONPEER_FINISHED_REGIONID_RPCDATANODE_DESTDATANODE_STATUS = - "{}, Send action addRegionPeer 完成,regionId:{},rpcDataNode:{},destDataNode:{},status:{}"; - public static final String SEND_ACTION_CREATENEWREGIONPEER_ERROR_REGIONID_NEWPEERDATANODEID_RESULT = - "{}, Send action createNewRegionPeer 出错,regionId:{},newPeerDataNodeId:{},result:{}"; + public static final String + SEND_ACTION_ADDREGIONPEER_FINISHED_REGIONID_RPCDATANODE_DESTDATANODE_STATUS = + "{}, Send action addRegionPeer 完成,regionId:{},rpcDataNode:{},destDataNode:{},status:{}"; + public static final String + SEND_ACTION_CREATENEWREGIONPEER_ERROR_REGIONID_NEWPEERDATANODEID_RESULT = + "{}, Send action createNewRegionPeer 出错,regionId:{},newPeerDataNodeId:{},result:{}"; public static final String SEND_ACTION_CREATENEWREGIONPEER_FINISHED_REGIONID_NEWPEERDATANODEID = "{}, Send action createNewRegionPeer 完成,regionId:{},newPeerDataNodeId:{}"; public static final String SEND_ACTION_DELETEOLDREGIONPEER_FINISHED_REGIONID_DATANODEID = @@ -902,24 +889,20 @@ public final class ProcedureMessages { "添加列时开始回滚向表 {}.{} 添加列的操作"; public static final String START_ROLLBACK_COMMIT_SET_SCHEMAENGINE_TEMPLATE_ON_PATH = "开始回滚在路径 {} 上提交设置 schemaengine 模板 {} 的操作"; - public static final String START_ROLLBACK_PRE_CREATE_TABLE = - "开始回滚预创建表 {}.{}"; + public static final String START_ROLLBACK_PRE_CREATE_TABLE = "开始回滚预创建表 {}.{}"; public static final String START_ROLLBACK_PRE_RELEASE_INFO_FOR_TABLE_WHEN_SETTING_PROPERTIES = "设置属性时开始回滚预释放表 {}.{} 的信息"; - public static final String START_ROLLBACK_PRE_RELEASE_INFO_OF_TABLE = - "开始回滚预释放表 {}.{} 的信息"; + public static final String START_ROLLBACK_PRE_RELEASE_INFO_OF_TABLE = "开始回滚预释放表 {}.{} 的信息"; public static final String START_ROLLBACK_PRE_RELEASE_SCHEMAENGINE_TEMPLATE_ON_PATH = "开始回滚预释放在路径 {} 上设置的 schemaengine 模板 {}"; - public static final String START_ROLLBACK_PRE_RELEASE_TABLE = - "开始回滚预释放表 {}.{}"; + public static final String START_ROLLBACK_PRE_RELEASE_TABLE = "开始回滚预释放表 {}.{}"; public static final String START_ROLLBACK_PRE_SET_SCHEMAENGINE_TEMPLATE_ON_PATH = "开始回滚在路径 {} 上预设置 schemaengine 模板 {}"; public static final String START_ROLLBACK_RENAMING_COLUMN_TO_TABLE_ON_CONFIGNODE = "在 ConfigNode 上开始回滚重命名表 {}.{} 列的操作"; public static final String START_ROLLBACK_RENAMING_TABLE_ON_CONFIGNODE = "在 ConfigNode 上开始回滚重命名表 {}.{}"; - public static final String START_ROLLBACK_SET_PROPERTIES_TO_TABLE = - "开始回滚设置表 {}.{} 的属性"; + public static final String START_ROLLBACK_SET_PROPERTIES_TO_TABLE = "开始回滚设置表 {}.{} 的属性"; public static final String STATE_MACHINE_PROCEDURE_EOF_STATE_SKIP_EXECUTION = "StateMachineProcedure pid={} 被 EOF 状态调度,跳过执行:{}"; public static final String STATE_STUCK_AT = "状态卡在 "; @@ -942,8 +925,7 @@ public final class ProcedureMessages { public static final String STOP_DATA_NODE_MEETS_ERROR_ERROR_DATANODE = "{}, 停止 DataNode 出错,出错的 DataNode:{}"; public static final String STOP_DATA_NODE_SUCCESS = "{}, 停止 DataNode {} 成功。"; - public static final String SUBMITTED_ASYNC_CONSENSUS_PIPE_CREATION = - "{}, 已提交异步共识 pipe 创建:{}"; + public static final String SUBMITTED_ASYNC_CONSENSUS_PIPE_CREATION = "{}, 已提交异步共识 pipe 创建:{}"; public static final String SUBSCRIPTION_META_SYNC_PROCEDURE_FINISHED_UPDATING_LAST_SYNC_VERSION = "Subscription 元数据同步 procedure 完成,正在更新上次同步版本。"; public static final String SUCCESSFULLY_OPERATE_WILL_CLEAR_CACHE_TO_THE_DATA_REGIONS_ANYWAY = @@ -959,8 +941,9 @@ public final class ProcedureMessages { "{} 任务 {} 无法从 DataNode {} 获取任务报告,上次报告时间为 {} 之前"; public static final String THE_UPDATED_TABLE_HAS_THE_SAME_PROPERTIES_WITH_THE_ORIGINAL = "更新后的表与原表属性相同。跳过该 procedure。"; - public static final String TOPICMETASYNCPROCEDURE_ACQUIRELOCK_SKIP_THE_PROCEDURE_DUE_TO_THE_LAST_EXECUTION = - "TopicMetaSyncProcedure: acquireLock, skip the procedure due to the last execution time {}"; + public static final String + TOPICMETASYNCPROCEDURE_ACQUIRELOCK_SKIP_THE_PROCEDURE_DUE_TO_THE_LAST_EXECUTION = + "TopicMetaSyncProcedure: acquireLock, skip the procedure due to the last execution time {}"; public static final String TOPICMETASYNCPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES = "TopicMetaSyncProcedure: executeFromOperateOnConfigNodes"; public static final String TOPICMETASYNCPROCEDURE_EXECUTEFROMOPERATEONDATANODES = @@ -999,52 +982,60 @@ public final class ProcedureMessages { public static final String UNRECOGNIZED_ALTERTIMESERIESDATATYPEPROCEDURE_STATE = "无法识别的 AlterTimeSeriesDataTypeProcedure 状态 "; public static final String UNRECOGNIZED_CREATETABLESTATE = "无法识别的 CreateTableState "; - public static final String UNRECOGNIZED_DROPTABLECOLUMNSTATE = - "无法识别的 DropTableColumnState "; + public static final String UNRECOGNIZED_DROPTABLECOLUMNSTATE = "无法识别的 DropTableColumnState "; public static final String UNRECOGNIZED_DROPTABLESTATE = "无法识别的 DropTableState "; public static final String UNRECOGNIZED_LOG_TYPE = "无法识别的日志类型 "; - public static final String UNRECOGNIZED_RENAMETABLECOLUMNSTATE = - "无法识别的 RenameTableColumnState "; + public static final String UNRECOGNIZED_RENAMETABLECOLUMNSTATE = "无法识别的 RenameTableColumnState "; public static final String UNRECOGNIZED_RENAMETABLESTATE = "无法识别的 RenameTableState "; public static final String UNRECOGNIZED_SETTEMPLATESTATE = "无法识别的 SetTemplateState "; public static final String UNRECOGNIZED_STATE = "无法识别的状态 "; public static final String UNSETTEMPLATE_COSTS_MS = "UnsetTemplate-[{}] costs {}ms"; - public static final String UNSET_TEMPLATE_FROM_FAILED_WHEN_CHECK_DATANODE_TEMPLATE_ACTIVATION_BECAUSE = - "从 %s 取消设置模板 %s 失败,当 [检查 DataNode 模板激活情况] 时,原因:%s"; + public static final String + UNSET_TEMPLATE_FROM_FAILED_WHEN_CHECK_DATANODE_TEMPLATE_ACTIVATION_BECAUSE = + "从 %s 取消设置模板 %s 失败,当 [检查 DataNode 模板激活情况] 时,原因:%s"; public static final String UNSET_TEMPLATE_ON = "在 {} 上取消设置模板 {}"; public static final String UNSUPPORTED_ROLL_BACK_STATE = "不支持的回滚 STATE [{}]"; public static final String UNSUPPORTED_STATE = "不支持的状态:"; public static final String UPDATE_DATANODE_TTL_CACHE_FAILED = "更新 DataNode ttl 缓存失败"; - public static final String VALIDATE_TABLE_FOR_TABLE_WHEN_SETTING_PROPERTIES = - "设置属性时校验表 {}.{}"; - public static final String WAITTASKFINISH_RETURNS_PROCESSING_WHICH_MEANS_THE_WAITING_HAS_BEEN_INTERRUPTED = - "waitTaskFinish() 返回 PROCESSING,表示等待已被中断(ConfigNode 关闭或 leader 切换);AddRegionPeer 任务仍在协调节点上运行,本 procedure 将停留在 DO_ADD_REGION_PEER,并在恢复后继续轮询"; + public static final String VALIDATE_TABLE_FOR_TABLE_WHEN_SETTING_PROPERTIES = "设置属性时校验表 {}.{}"; + public static final String + WAITTASKFINISH_RETURNS_PROCESSING_WHICH_MEANS_THE_WAITING_HAS_BEEN_INTERRUPTED = + "waitTaskFinish() 返回 PROCESSING,表示等待已被中断(ConfigNode 关闭或 leader 切换);AddRegionPeer 任务仍在协调节点上运行,本 procedure 将停留在 DO_ADD_REGION_PEER,并在恢复后继续轮询"; - public static final String FAILED_TO_CREATE_DATABASE_THE_TTL_SHOULD_BE_NON_NEGATIVE = "创建数据库失败。TTL 不能为负数。"; - public static final String FAILED_TO_CREATE_DATABASE_THE_DATAREGIONGROUPNUM_SHOULD_BE_POSITIVE = "创建数据库失败。dataRegionGroupNum 应为正数。"; + public static final String FAILED_TO_CREATE_DATABASE_THE_TTL_SHOULD_BE_NON_NEGATIVE = + "创建数据库失败。TTL 不能为负数。"; + public static final String FAILED_TO_CREATE_DATABASE_THE_DATAREGIONGROUPNUM_SHOULD_BE_POSITIVE = + "创建数据库失败。dataRegionGroupNum 应为正数。"; public static final String PID_FAILED_TO_PERSIST_LOCK_STATE_TO_STORE = "pid={} 持久化锁状态到存储失败。"; public static final String FORCE_WRITE_UNLOCK_STATE_TO_RAFT_FOR_PID = "强制写入解锁状态到 raft,pid={}"; public static final String PID_FAILED_TO_PERSIST_UNLOCK_STATE_TO_STORE = "pid={} 持久化解锁状态到存储失败。"; - public static final String DIDN_T_HOLD_THE_LOCK_BEFORE_RESTARTING_SKIP_ACQUIRING_LOCK = "{} 重启前未持有锁,跳过获取锁"; + public static final String DIDN_T_HOLD_THE_LOCK_BEFORE_RESTARTING_SKIP_ACQUIRING_LOCK = + "{} 重启前未持有锁,跳过获取锁"; public static final String IS_ALREADY_BYPASSED_SKIP_ACQUIRING_LOCK = "{} 已被绕过,跳过获取锁。"; - public static final String IS_IN_WAITING_STATE_AND_HOLDLOCK_FALSE_SKIP_ACQUIRING_LOCK = "{} 处于 WAITING 状态且 holdLock=false,跳过获取锁。"; - public static final String HELD_THE_LOCK_BEFORE_RESTARTING_CALL_ACQUIRELOCK_TO_RESTORE_IT = "{} 重启前持有锁,调用 acquireLock 恢复。"; + public static final String IS_IN_WAITING_STATE_AND_HOLDLOCK_FALSE_SKIP_ACQUIRING_LOCK = + "{} 处于 WAITING 状态且 holdLock=false,跳过获取锁。"; + public static final String HELD_THE_LOCK_BEFORE_RESTARTING_CALL_ACQUIRELOCK_TO_RESTORE_IT = + "{} 重启前持有锁,调用 acquireLock 恢复。"; public static final String CHILD_LATCH_INCREMENT_SET = "子锁计数器设置递增 "; public static final String CHILD_LATCH_INCREMENT = "子锁计数器递增 "; public static final String CHILD_LATCH_DECREMENT = "子锁计数器递减 "; public static final String UNEXPECTED_STATE_FOR = "意外状态:{} 对应 {}"; - public static final String OLD_PROCEDURE_DIRECTORY_DETECTED_UPGRADE_BEGINNING = "检测到旧的 procedure 目录,开始升级..."; + public static final String OLD_PROCEDURE_DIRECTORY_DETECTED_UPGRADE_BEGINNING = + "检测到旧的 procedure 目录,开始升级..."; public static final String ALREADY_RUNNING = "已在运行中"; public static final String PROCEDURE_WORKERS_ARE_STARTED = "{} 个 procedure 工作线程已启动。"; public static final String IS_ALREADY_FINISHED = "{} 已完成。"; - public static final String ROLLBACK_BECAUSE_PARENT_IS_DONE_ROLLEDBACK_PROC_IS = "因父流程已完成/已回滚而回滚,proc 为 {}"; + public static final String ROLLBACK_BECAUSE_PARENT_IS_DONE_ROLLEDBACK_PROC_IS = + "因父流程已完成/已回滚而回滚,proc 为 {}"; public static final String ROLLBACK_STACK_IS_NULL_FOR = "{} 的回滚栈为 null"; public static final String LOCK_EVENT_WAIT_ROLLBACK = "LOCK_EVENT_WAIT 回滚 {}"; - public static final String LOCK_EVENT_WAIT_CAN_T_ROLLBACK_CHILD_RUNNING_FOR = "LOCK_EVENT_WAIT 无法回滚正在运行的子流程 {}"; + public static final String LOCK_EVENT_WAIT_CAN_T_ROLLBACK_CHILD_RUNNING_FOR = + "LOCK_EVENT_WAIT 无法回滚正在运行的子流程 {}"; public static final String LOCKSTATE_IS = "{} 锁状态为 {}"; public static final String FINISHED_IN_MS_SUCCESSFULLY = "{} 在 {} 毫秒内成功完成。"; public static final String PROCEDUREID_WAIT_FOR_LOCK = "procedureId {} 等待锁。"; - public static final String INTERRUPT_DURING_EXECUTION_SUSPEND_OR_RETRY_IT_LATER = "执行期间被中断,稍后挂起或重试。"; + public static final String INTERRUPT_DURING_EXECUTION_SUSPEND_OR_RETRY_IT_LATER = + "执行期间被中断,稍后挂起或重试。"; public static final String CODE_BUG = "代码错误:{}"; public static final String INITIALIZED_SUB_PROCS = "初始化子流程:{}"; public static final String ADDED_INTO_TIMEOUTEXECUTOR = "已添加到超时执行器 {}"; @@ -1073,206 +1064,421 @@ public final class ProcedureMessages { public static final String START_TO_DROP_TRIGGER_ON_DATA_NODES = "开始在 DataNode 上删除触发器 [{}]"; public static final String START_TO_DROP_TRIGGER_ON_CONFIG_NODES = "开始在 ConfigNode 上删除触发器 [{}]"; public static final String DROP_TRIGGER_FAILED = "删除触发器 {} 失败。"; - public static final String ERROR_IN_DESERIALIZE_DELETEDATABASEPROCEDURE = "反序列化 DeleteDatabaseProcedure 出错"; + public static final String ERROR_IN_DESERIALIZE_DELETEDATABASEPROCEDURE = + "反序列化 DeleteDatabaseProcedure 出错"; public static final String EXECUTING_CREATE_PEER_ON = "正在执行 CREATE_PEER 于 {}..."; public static final String SUCCESSFULLY_CREATE_PEER_ON = "成功执行 CREATE_PEER 于 {}"; public static final String EXECUTING_ADD_PEER = "正在执行 ADD_PEER {}..."; public static final String SUCCESSFULLY_ADD_PEER = "成功执行 ADD_PEER {}"; - public static final String THE_CONFIGNODE_IS_SUCCESSFULLY_ADDED_TO_THE_CLUSTER = "ConfigNode {} 已成功加入集群"; + public static final String THE_CONFIGNODE_IS_SUCCESSFULLY_ADDED_TO_THE_CLUSTER = + "ConfigNode {} 已成功加入集群"; public static final String ROLLBACK_CREATE_PEER_FOR = "回滚 CREATE_PEER:{}"; public static final String ROLLBACK_ADD_PEER_FOR = "回滚 ADD_PEER:{}"; - public static final String ERROR_IN_DESERIALIZE_ADDCONFIGNODEPROCEDURE = "反序列化 AddConfigNodeProcedure 出错"; + public static final String ERROR_IN_DESERIALIZE_ADDCONFIGNODEPROCEDURE = + "反序列化 AddConfigNodeProcedure 出错"; public static final String REMOVE_PEER_FOR_CONFIGNODE = "移除 ConfigNode 的 peer:{}"; public static final String DELETE_PEER_FOR_CONFIGNODE = "删除 ConfigNode 的 peer:{}"; public static final String STOP_AND_CLEAR_CONFIGNODE = "停止并清理 ConfigNode:{}"; - public static final String ERROR_IN_DESERIALIZE_REMOVECONFIGNODEPROCEDURE = "反序列化 RemoveConfigNodeProcedure 出错"; - public static final String DATAPARTITIONINTEGRITY_ERROR_EXECUTING_STATE = "[DataPartitionIntegrity] 执行状态 {} 出错:{}"; - public static final String COLLECTING_EARLIEST_TIMESLOTS_FROM_ALL_DATANODES = "正在从所有 DataNode 收集最早时间槽..."; + public static final String ERROR_IN_DESERIALIZE_REMOVECONFIGNODEPROCEDURE = + "反序列化 RemoveConfigNodeProcedure 出错"; + public static final String DATAPARTITIONINTEGRITY_ERROR_EXECUTING_STATE = + "[DataPartitionIntegrity] 执行状态 {} 出错:{}"; + public static final String COLLECTING_EARLIEST_TIMESLOTS_FROM_ALL_DATANODES = + "正在从所有 DataNode 收集最早时间槽..."; public static final String ANALYZING_MISSING_DATA_PARTITIONS = "正在分析缺失的数据分区..."; - public static final String CHECKING_DATAPARTITIONTABLE_GENERATION_COMPLETION_STATUS = "正在检查 DataPartitionTable 生成完成状态..."; - public static final String MERGING_DATAPARTITIONTABLES_FROM_DATANODES = "正在合并来自 {} 个 DataNode 的 DataPartitionTable..."; - public static final String DATAPARTITIONINTEGRITY_DATAPARTITIONTABLES_MERGE_COMPLETED_SUCCESSFULLY = "[DataPartitionIntegrity] DataPartitionTable 合并成功"; - public static final String WRITING_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = "正在将 DataPartitionTable 写入共识日志..."; - public static final String DATAPARTITIONINTEGRITY_NO_DATABASE_LOST_DATA_PARTITION_TABLE = "[DataPartitionIntegrity] 没有数据库丢失数据分区表"; - public static final String DATAPARTITIONINTEGRITY_DATAPARTITIONTABLE_TO_WRITE_TO_CONSENSUS = "[DataPartitionIntegrity] 待写入共识的 DataPartitionTable"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_WRITE_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = "[DataPartitionIntegrity] 写入 DataPartitionTable 到共识日志失败"; - public static final String DATAPARTITIONINTEGRITY_ERROR_WRITING_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = "[DataPartitionIntegrity] 写入 DataPartitionTable 到共识日志出错"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_SERIALIZE_SKIPDATANODE = "[DataPartitionIntegrity] 序列化 skipDataNode 失败"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_SERIALIZE_FAILEDDATANODE = "[DataPartitionIntegrity] 序列化 failedDataNode 失败"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_DESERIALIZE_SKIPDATANODE = "[DataPartitionIntegrity] 反序列化 skipDataNode 失败"; - public static final String DATAPARTITIONINTEGRITY_FAILED_TO_DESERIALIZE_FAILEDDATANODE = "[DataPartitionIntegrity] 反序列化 failedDataNode 失败"; - public static final String DATAPARTITIONINTEGRITY_SKIPPING_EMPTY_BYTEBUFFER_DURING_DESERIALIZATION = "[DataPartitionIntegrity] 反序列化时跳过空 ByteBuffer"; - public static final String NOT_FIND_REGION_REPLICA_NODES_IN_CREATEPEER_REGIONID = "在 createPeer 中未找到 region 副本节点,regionId:"; - public static final String SIMPLECONSENSUS_PROTOCOL_IS_NOT_SUPPORTED_TO_REMOVE_DATA_NODE = "SimpleConsensus 协议不支持移除数据节点"; + public static final String CHECKING_DATAPARTITIONTABLE_GENERATION_COMPLETION_STATUS = + "正在检查 DataPartitionTable 生成完成状态..."; + public static final String MERGING_DATAPARTITIONTABLES_FROM_DATANODES = + "正在合并来自 {} 个 DataNode 的 DataPartitionTable..."; + public static final String + DATAPARTITIONINTEGRITY_DATAPARTITIONTABLES_MERGE_COMPLETED_SUCCESSFULLY = + "[DataPartitionIntegrity] DataPartitionTable 合并成功"; + public static final String WRITING_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = + "正在将 DataPartitionTable 写入共识日志..."; + public static final String DATAPARTITIONINTEGRITY_NO_DATABASE_LOST_DATA_PARTITION_TABLE = + "[DataPartitionIntegrity] 没有数据库丢失数据分区表"; + public static final String DATAPARTITIONINTEGRITY_DATAPARTITIONTABLE_TO_WRITE_TO_CONSENSUS = + "[DataPartitionIntegrity] 待写入共识的 DataPartitionTable"; + public static final String + DATAPARTITIONINTEGRITY_FAILED_TO_WRITE_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = + "[DataPartitionIntegrity] 写入 DataPartitionTable 到共识日志失败"; + public static final String + DATAPARTITIONINTEGRITY_ERROR_WRITING_DATAPARTITIONTABLE_TO_CONSENSUS_LOG = + "[DataPartitionIntegrity] 写入 DataPartitionTable 到共识日志出错"; + public static final String DATAPARTITIONINTEGRITY_FAILED_TO_SERIALIZE_SKIPDATANODE = + "[DataPartitionIntegrity] 序列化 skipDataNode 失败"; + public static final String DATAPARTITIONINTEGRITY_FAILED_TO_SERIALIZE_FAILEDDATANODE = + "[DataPartitionIntegrity] 序列化 failedDataNode 失败"; + public static final String DATAPARTITIONINTEGRITY_FAILED_TO_DESERIALIZE_SKIPDATANODE = + "[DataPartitionIntegrity] 反序列化 skipDataNode 失败"; + public static final String DATAPARTITIONINTEGRITY_FAILED_TO_DESERIALIZE_FAILEDDATANODE = + "[DataPartitionIntegrity] 反序列化 failedDataNode 失败"; + public static final String + DATAPARTITIONINTEGRITY_SKIPPING_EMPTY_BYTEBUFFER_DURING_DESERIALIZATION = + "[DataPartitionIntegrity] 反序列化时跳过空 ByteBuffer"; + public static final String NOT_FIND_REGION_REPLICA_NODES_IN_CREATEPEER_REGIONID = + "在 createPeer 中未找到 region 副本节点,regionId:"; + public static final String SIMPLECONSENSUS_PROTOCOL_IS_NOT_SUPPORTED_TO_REMOVE_DATA_NODE = + "SimpleConsensus 协议不支持移除数据节点"; public static final String FAILED_TO_REMOVE_ALL_REQUESTED_DATA_NODES = "移除所有请求的数据节点失败"; - public static final String THERE_EXIST_DATA_NODE_IN_REQUEST_BUT_NOT_IN_CLUSTER = "请求中存在不在集群中的 DataNode"; + public static final String THERE_EXIST_DATA_NODE_IN_REQUEST_BUT_NOT_IN_CLUSTER = + "请求中存在不在集群中的 DataNode"; + + public static final String FAILED_IN_THE_WRITE_API_EXECUTING_THE_CONSENSUS_LAYER_DUE = + "在共识层执行写入 API 失败,原因:"; - public static final String FAILED_IN_THE_WRITE_API_EXECUTING_THE_CONSENSUS_LAYER_DUE = "在共识层执行写入 API 失败,原因:"; private ProcedureMessages() {} + // --------------------------------------------------------------------------- // Additional auto-collected messages // --------------------------------------------------------------------------- public static final String EXCEPTION_MS_95BA098D = " ms."; public static final String LOG_ARG_JOIN_WAIT_GOT_INTERRUPTED_316B5E9F = "{} 的 join 等待被中断"; - public static final String LOG_NO_COMPLETED_PROCEDURES_CLEANUP_50434D91 = "没有已完成的 procedures 需要清理。"; - public static final String LOG_ERROR_DELETING_COMPLETED_PROCEDURES_ARG_1A3A185E = "删除已完成的 procedures {} 时出错。"; + public static final String LOG_NO_COMPLETED_PROCEDURES_CLEANUP_50434D91 = + "没有已完成的 procedures 需要清理。"; + public static final String LOG_ERROR_DELETING_COMPLETED_PROCEDURES_ARG_1A3A185E = + "删除已完成的 procedures {} 时出错。"; public static final String LOG_EVICT_COMPLETED_ARG_A968A070 = "驱逐已完成的 {}"; - public static final String LOG_EXECUTING_PROCEDURE_SHOULD_RUNNABLE_STATE_BUT_IT_S_NOT_PROCEDURE_7CF42CE8 = "执行中的 procedure 应处于 RUNNABLE 状态,但实际不是。Procedure 为 {}"; - public static final String LOG_FINISHED_SUBPROCEDURE_PID_ARG_RESUME_PROCESSING_PPID_ARG_93ED990B = "subprocedure pid={} 已完成,恢复处理 ppid={}"; - public static final String LOG_HALT_PID_ARG_ACTIVECOUNT_ARG_411F3EBF = "暂停 pid={}, activeCount={}"; - public static final String LOG_EXCEPTION_HAPPENED_WORKER_ARG_EXECUTE_PROCEDURE_ARG_6E3AD27D = "worker {} 执行 procedure {} 时发生异常"; - public static final String LOG_WORKER_STUCK_ARG_ARG_RUN_TIME_ARG_MS_FB612354 = "Worker 卡住 {}({}),运行时间 {} ms"; - public static final String LOG_PROCEDURE_WORKERS_ARG_RUNNING_ARG_RUNNING_STUCK_1565936D = "Procedure workers:{} 正在运行,{} 正在运行且卡住"; - public static final String LOG_PROCEDUREEXECUTOR_THREADGROUP_ARG_CONTAINS_RUNNING_THREADS_WHICH_USED_NON_PROCEDURE_BD865211 = "ProcedureExecutor threadGroup {} 包含被非 procedure 模块使用的运行线程。"; - public static final String LOG_ADD_PROCEDURE_ARG_AS_ARG_TH_ROLLBACK_STEP_C71B2184 = "将 procedure {} 添加为第 {} 个回滚步骤"; - public static final String LOG_STATEMACHINEPROCEDURE_PID_ARG_NOT_SET_NEXT_STATE_BUT_RETURN_HAS_7F93E63F = - "StateMachineProcedure pid={} 未设置下一状态,却返回 HAS_MORE_STATE。代码可能存在问题,请检查代码。该 procedure 即将被终止:{}"; - public static final String LOG_STATEMACHINEPROCEDURE_PID_ARG_SET_NEXT_STATE_ARG_BUT_RETURN_NO_0CA2D56C = "StateMachineProcedure pid={} 设置下一状态为 {},但返回 NO_MORE_STATE"; - public static final String LOG_DON_T_ADD_SUCCESSFUL_PROCEDURE_BACK_SCHEDULER_IT_WILL_IGNORED_E015472C = "不要将已成功的 procedure 加回 scheduler,它将被忽略"; + public static final String + LOG_EXECUTING_PROCEDURE_SHOULD_RUNNABLE_STATE_BUT_IT_S_NOT_PROCEDURE_7CF42CE8 = + "执行中的 procedure 应处于 RUNNABLE 状态,但实际不是。Procedure 为 {}"; + public static final String LOG_FINISHED_SUBPROCEDURE_PID_ARG_RESUME_PROCESSING_PPID_ARG_93ED990B = + "subprocedure pid={} 已完成,恢复处理 ppid={}"; + public static final String LOG_HALT_PID_ARG_ACTIVECOUNT_ARG_411F3EBF = + "暂停 pid={}, activeCount={}"; + public static final String LOG_EXCEPTION_HAPPENED_WORKER_ARG_EXECUTE_PROCEDURE_ARG_6E3AD27D = + "worker {} 执行 procedure {} 时发生异常"; + public static final String LOG_WORKER_STUCK_ARG_ARG_RUN_TIME_ARG_MS_FB612354 = + "Worker 卡住 {}({}),运行时间 {} ms"; + public static final String LOG_PROCEDURE_WORKERS_ARG_RUNNING_ARG_RUNNING_STUCK_1565936D = + "Procedure workers:{} 正在运行,{} 正在运行且卡住"; + public static final String + LOG_PROCEDUREEXECUTOR_THREADGROUP_ARG_CONTAINS_RUNNING_THREADS_WHICH_USED_NON_PROCEDURE_BD865211 = + "ProcedureExecutor threadGroup {} 包含被非 procedure 模块使用的运行线程。"; + public static final String LOG_ADD_PROCEDURE_ARG_AS_ARG_TH_ROLLBACK_STEP_C71B2184 = + "将 procedure {} 添加为第 {} 个回滚步骤"; + public static final String + LOG_STATEMACHINEPROCEDURE_PID_ARG_NOT_SET_NEXT_STATE_BUT_RETURN_HAS_7F93E63F = + "StateMachineProcedure pid={} 未设置下一状态,却返回 HAS_MORE_STATE。代码可能存在问题,请检查代码。该 procedure 即将被终止:{}"; + public static final String + LOG_STATEMACHINEPROCEDURE_PID_ARG_SET_NEXT_STATE_ARG_BUT_RETURN_NO_0CA2D56C = + "StateMachineProcedure pid={} 设置下一状态为 {},但返回 NO_MORE_STATE"; + public static final String + LOG_DON_T_ADD_SUCCESSFUL_PROCEDURE_BACK_SCHEDULER_IT_WILL_IGNORED_E015472C = + "不要将已成功的 procedure 加回 scheduler,它将被忽略"; public static final String LOG_SCHEDULER_NOT_RUNNING_6969C9FF = "scheduler 未运行"; - public static final String LOG_SCHEDULER_WAITING_TIME_LEFT_ARG_NANOS_D7717019 = "scheduler 剩余等待时间 {} nanos"; - public static final String LOG_SLEEP_FAILED_CONFIGNODEPROCEDUREENV_BCD470AC = "ConfigNodeProcedureEnv 中 Sleep 失败:"; - public static final String LOG_INVALIDATE_CACHE_FAILED_BECAUSE_DATANODE_ARG_UNKNOWN_4F2D374C = "缓存失效失败,原因:DataNode {} 状态未知"; - public static final String LOG_INVALIDATE_CACHE_FAILED_INVALIDATE_PARTITION_CACHE_STATUS_ARG_INVALIDATE_SCHEMAENGINE_BEB7A065 = "缓存失效失败,分区缓存失效状态为 {},schemaengine 缓存失效状态为 {}"; - public static final String MESSAGE_REMOVE_CONFIGNODE_FAILED_BECAUSE_UPDATE_CONSENSUSGROUP_PEER_INFORMATION_FAILED_FCE5302B = "移除 ConfigNode 失败,原因:更新 ConsensusGroup peer 信息失败。"; - public static final String MESSAGE_CAN_T_REMOVE_DATANODE_LIMIT_REPLICATION_FACTOR_D960E3A6 = "无法移除 DataNode,原因:受副本因子限制,"; - public static final String MESSAGE_AVAILABLEDATANODESIZE_ARG_MAXREPLICAFACTOR_ARG_MAX_ALLOWED_REMOVED_DATA_NODE_SIZE_FB8C382C = "availableDataNodeSize:%s,maxReplicaFactor:%s,允许移除的最大 DataNode 数量为:%s"; + public static final String LOG_SCHEDULER_WAITING_TIME_LEFT_ARG_NANOS_D7717019 = + "scheduler 剩余等待时间 {} nanos"; + public static final String LOG_SLEEP_FAILED_CONFIGNODEPROCEDUREENV_BCD470AC = + "ConfigNodeProcedureEnv 中 Sleep 失败:"; + public static final String LOG_INVALIDATE_CACHE_FAILED_BECAUSE_DATANODE_ARG_UNKNOWN_4F2D374C = + "缓存失效失败,原因:DataNode {} 状态未知"; + public static final String + LOG_INVALIDATE_CACHE_FAILED_INVALIDATE_PARTITION_CACHE_STATUS_ARG_INVALIDATE_SCHEMAENGINE_BEB7A065 = + "缓存失效失败,分区缓存失效状态为 {},schemaengine 缓存失效状态为 {}"; + public static final String + MESSAGE_REMOVE_CONFIGNODE_FAILED_BECAUSE_UPDATE_CONSENSUSGROUP_PEER_INFORMATION_FAILED_FCE5302B = + "移除 ConfigNode 失败,原因:更新 ConsensusGroup peer 信息失败。"; + public static final String MESSAGE_CAN_T_REMOVE_DATANODE_LIMIT_REPLICATION_FACTOR_D960E3A6 = + "无法移除 DataNode,原因:受副本因子限制,"; + public static final String + MESSAGE_AVAILABLEDATANODESIZE_ARG_MAXREPLICAFACTOR_ARG_MAX_ALLOWED_REMOVED_DATA_NODE_SIZE_FB8C382C = + "availableDataNodeSize:%s,maxReplicaFactor:%s,允许移除的最大 DataNode 数量为:%s"; public static final String EXCEPTION_NOT_SUPPORTED_0A83F963 = " 不支持"; - public static final String LOG_START_ADD_TRIGGER_ARG_TRIGGERTABLE_CONFIG_NODES_NEEDTOSAVEJAR_ARG_0C23D81E = "开始在 Config Nodes 的 TriggerTable 中添加 trigger [{}],needToSaveJar[{}]"; - public static final String LOG_START_CREATE_TRIGGERINSTANCE_ARG_DATA_NODES_917C3313 = "开始在 Data Nodes 上创建 triggerInstance [{}]"; - public static final String LOG_START_ACTIVE_TRIGGER_ARG_DATA_NODES_A4AB8131 = "开始在 Data Nodes 上激活 trigger [{}]"; - public static final String LOG_START_ACTIVE_TRIGGER_ARG_CONFIG_NODES_153A5D40 = "开始在 Config Nodes 上激活 trigger [{}]"; - public static final String LOG_RETRIEVABLE_ERROR_TRYING_CREATE_TRIGGER_ARG_STATE_ARG_44976C4E = "尝试创建 trigger [{}] 时发生可重试错误,状态 [{}]"; - public static final String LOG_START_CONFIG_NODE_INACTIVE_ROLLBACK_TRIGGER_ARG_536929E5 = "开始 trigger [{}] 的 [CONFIG_NODE_INACTIVE] 回滚"; - public static final String LOG_START_DATA_NODE_INACTIVE_ROLLBACK_TRIGGER_ARG_38C93D64 = "开始 trigger [{}] 的 [DATA_NODE_INACTIVE] 回滚"; - public static final String LOG_RETRIEVABLE_ERROR_TRYING_DROP_TRIGGER_ARG_STATE_ARG_2282AC35 = "尝试删除 trigger [{}] 时发生可重试错误,状态 [{}]"; - public static final String LOG_DELETEDATABASEPROCEDURE_PRE_DELETE_DATABASE_ARG_6A1FEACC = "[DeleteDatabaseProcedure] 预删除数据库:{}"; - public static final String LOG_DELETEDATABASEPROCEDURE_INVALIDATE_CACHE_DATABASE_ARG_299FC9BC = "[DeleteDatabaseProcedure] 使数据库 {} 的缓存失效"; - public static final String LOG_DELETEDATABASEPROCEDURE_DELETE_DATABASESCHEMA_ARG_A49A47AC = "[DeleteDatabaseProcedure] 删除数据库 Schema:{}"; - public static final String LOG_DELETEDATABASEPROCEDURE_SUCCESSFULLY_DELETE_SCHEMAREGION_ARG_ARG_BA0535DA = "[DeleteDatabaseProcedure] 成功删除 SchemaRegion[{}],位置 {}"; - public static final String LOG_DELETEDATABASEPROCEDURE_FAILED_DELETE_SCHEMAREGION_ARG_ARG_SUBMIT_ASYNC_DELETION_8C3E6DE3 = "[DeleteDatabaseProcedure] 删除 SchemaRegion[{}] 失败,位置 {}。提交异步删除。"; - public static final String LOG_DELETEDATABASEPROCEDURE_DATA_PARTITION_POLICY_TABLE_DATABASE_ARG_CLEARED_7A32E28A = "[DeleteDatabaseProcedure] 数据库 {} 的数据分区策略表已清理。"; - public static final String LOG_DELETEDATABASEPROCEDURE_DATABASE_ARG_DELETED_SUCCESSFULLY_3A4E9202 = "[DeleteDatabaseProcedure] 数据库 {} 已成功删除"; - public static final String LOG_DELETEDATABASEPROCEDURE_RETRIABLE_ERROR_TRYING_DELETE_DATABASE_ARG_STATE_ARG_8167D246 = "[DeleteDatabaseProcedure] 尝试删除数据库 {} 时发生可重试错误,状态 {}"; - public static final String LOG_DELETEDATABASEPROCEDURE_ROLLBACK_PREDELETED_ARG_638F53DA = "[DeleteDatabaseProcedure] 回滚到预删除状态:{}"; + public static final String + LOG_START_ADD_TRIGGER_ARG_TRIGGERTABLE_CONFIG_NODES_NEEDTOSAVEJAR_ARG_0C23D81E = + "开始在 Config Nodes 的 TriggerTable 中添加 trigger [{}],needToSaveJar[{}]"; + public static final String LOG_START_CREATE_TRIGGERINSTANCE_ARG_DATA_NODES_917C3313 = + "开始在 Data Nodes 上创建 triggerInstance [{}]"; + public static final String LOG_START_ACTIVE_TRIGGER_ARG_DATA_NODES_A4AB8131 = + "开始在 Data Nodes 上激活 trigger [{}]"; + public static final String LOG_START_ACTIVE_TRIGGER_ARG_CONFIG_NODES_153A5D40 = + "开始在 Config Nodes 上激活 trigger [{}]"; + public static final String LOG_RETRIEVABLE_ERROR_TRYING_CREATE_TRIGGER_ARG_STATE_ARG_44976C4E = + "尝试创建 trigger [{}] 时发生可重试错误,状态 [{}]"; + public static final String LOG_START_CONFIG_NODE_INACTIVE_ROLLBACK_TRIGGER_ARG_536929E5 = + "开始 trigger [{}] 的 [CONFIG_NODE_INACTIVE] 回滚"; + public static final String LOG_START_DATA_NODE_INACTIVE_ROLLBACK_TRIGGER_ARG_38C93D64 = + "开始 trigger [{}] 的 [DATA_NODE_INACTIVE] 回滚"; + public static final String LOG_RETRIEVABLE_ERROR_TRYING_DROP_TRIGGER_ARG_STATE_ARG_2282AC35 = + "尝试删除 trigger [{}] 时发生可重试错误,状态 [{}]"; + public static final String LOG_DELETEDATABASEPROCEDURE_PRE_DELETE_DATABASE_ARG_6A1FEACC = + "[DeleteDatabaseProcedure] 预删除数据库:{}"; + public static final String LOG_DELETEDATABASEPROCEDURE_INVALIDATE_CACHE_DATABASE_ARG_299FC9BC = + "[DeleteDatabaseProcedure] 使数据库 {} 的缓存失效"; + public static final String LOG_DELETEDATABASEPROCEDURE_DELETE_DATABASESCHEMA_ARG_A49A47AC = + "[DeleteDatabaseProcedure] 删除数据库 Schema:{}"; + public static final String + LOG_DELETEDATABASEPROCEDURE_SUCCESSFULLY_DELETE_SCHEMAREGION_ARG_ARG_BA0535DA = + "[DeleteDatabaseProcedure] 成功删除 SchemaRegion[{}],位置 {}"; + public static final String + LOG_DELETEDATABASEPROCEDURE_FAILED_DELETE_SCHEMAREGION_ARG_ARG_SUBMIT_ASYNC_DELETION_8C3E6DE3 = + "[DeleteDatabaseProcedure] 删除 SchemaRegion[{}] 失败,位置 {}。提交异步删除。"; + public static final String + LOG_DELETEDATABASEPROCEDURE_DATA_PARTITION_POLICY_TABLE_DATABASE_ARG_CLEARED_7A32E28A = + "[DeleteDatabaseProcedure] 数据库 {} 的数据分区策略表已清理。"; + public static final String + LOG_DELETEDATABASEPROCEDURE_DATABASE_ARG_DELETED_SUCCESSFULLY_3A4E9202 = + "[DeleteDatabaseProcedure] 数据库 {} 已成功删除"; + public static final String + LOG_DELETEDATABASEPROCEDURE_RETRIABLE_ERROR_TRYING_DELETE_DATABASE_ARG_STATE_ARG_8167D246 = + "[DeleteDatabaseProcedure] 尝试删除数据库 {} 时发生可重试错误,状态 {}"; + public static final String LOG_DELETEDATABASEPROCEDURE_ROLLBACK_PREDELETED_ARG_638F53DA = + "[DeleteDatabaseProcedure] 回滚到预删除状态:{}"; public static final String EXCEPTION_FAILED_DAA6EA2F = " 失败 "; - public static final String EXCEPTION_FAILED_CHECK_TIME_SERIES_EXISTENCE_ALL_REPLICASET_SCHEMAREGION_ARG_FAILURES_5F668154 = "检查 SchemaRegion %s 的所有 replicaset 中的时间序列是否存在失败。失败信息:%s"; - public static final String LOG_FAILED_ROLLBACK_CONFIGNODE_TTL_STATE_9666EF54 = "无法回滚 ConfigNode ttl 状态。"; - public static final String LOG_FAILED_ROLLBACK_DATANODE_TTL_CACHE_436C008A = "无法回滚 DataNode ttl 缓存。"; - public static final String EXCEPTION_ROLLBACK_CONFIGNODE_TTL_FAILED_6D4FB59A = "回滚 ConfigNode ttl 失败,对象:"; - public static final String EXCEPTION_ROLLBACK_DATANODE_TTL_CACHE_FAILED_AF9C7102 = "回滚 DataNode ttl 缓存失败,对象:"; - public static final String LOG_PLEASE_VERIFY_WHETHER_LEADER_CHANGE_HAS_OCCURRED_DURING_STAGE_9FE68EE3 = "请确认该阶段是否发生 leader 变更。"; - public static final String LOG_IF_LOG_TRIGGERED_WITHOUT_LEADER_CHANGE_IT_INDICATES_POTENTIAL_BUG_32AE71FD = - "如果未发生 leader 变更却触发该日志,说明分区表可能存在潜在问题。"; - public static final String LOG_SKIP_RECOVERING_SCHEDULE_TASK_CQ_ARG_BECAUSE_ITS_METADATA_UNAVAILABLE_00286802 = "跳过恢复 CQ {} 的调度任务,原因:其元数据不可用。"; + public static final String + EXCEPTION_FAILED_CHECK_TIME_SERIES_EXISTENCE_ALL_REPLICASET_SCHEMAREGION_ARG_FAILURES_5F668154 = + "检查 SchemaRegion %s 的所有 replicaset 中的时间序列是否存在失败。失败信息:%s"; + public static final String LOG_FAILED_ROLLBACK_CONFIGNODE_TTL_STATE_9666EF54 = + "无法回滚 ConfigNode ttl 状态。"; + public static final String LOG_FAILED_ROLLBACK_DATANODE_TTL_CACHE_436C008A = + "无法回滚 DataNode ttl 缓存。"; + public static final String EXCEPTION_ROLLBACK_CONFIGNODE_TTL_FAILED_6D4FB59A = + "回滚 ConfigNode ttl 失败,对象:"; + public static final String EXCEPTION_ROLLBACK_DATANODE_TTL_CACHE_FAILED_AF9C7102 = + "回滚 DataNode ttl 缓存失败,对象:"; + public static final String + LOG_PLEASE_VERIFY_WHETHER_LEADER_CHANGE_HAS_OCCURRED_DURING_STAGE_9FE68EE3 = + "请确认该阶段是否发生 leader 变更。"; + public static final String + LOG_IF_LOG_TRIGGERED_WITHOUT_LEADER_CHANGE_IT_INDICATES_POTENTIAL_BUG_32AE71FD = + "如果未发生 leader 变更却触发该日志,说明分区表可能存在潜在问题。"; + public static final String + LOG_SKIP_RECOVERING_SCHEDULE_TASK_CQ_ARG_BECAUSE_ITS_METADATA_UNAVAILABLE_00286802 = + "跳过恢复 CQ {} 的调度任务,原因:其元数据不可用。"; public static final String LOG_PROCEDUREID_ARG_ACQUIRE_LOCK_3FBF9987 = "procedureId {} 获取锁。"; - public static final String LOG_PROCEDUREID_ARG_ACQUIRE_LOCK_FAILED_WILL_WAIT_LOCK_AFTER_FINISHING_3B27278E = "procedureId {} 获取锁失败,将在执行完成后等待锁。"; + public static final String + LOG_PROCEDUREID_ARG_ACQUIRE_LOCK_FAILED_WILL_WAIT_LOCK_AFTER_FINISHING_3B27278E = + "procedureId {} 获取锁失败,将在执行完成后等待锁。"; public static final String LOG_PROCEDUREID_ARG_RELEASE_LOCK_FF860D6B = "procedureId {} 释放锁。"; - public static final String LOG_RETRIEVABLE_ERROR_TRYING_ADD_CONFIG_NODE_ARG_STATE_ARG_D7285810 = "尝试添加 ConfigNode {} 时发生可重试错误,状态 {}"; - public static final String LOG_RETRIEVABLE_ERROR_TRYING_REMOVE_CONFIG_NODE_ARG_STATE_ARG_3754EBA1 = "尝试移除 ConfigNode {} 时发生可重试错误,状态 {}"; - public static final String LOG_PROCEDUREID_ARG_REMOVEDATANODES_SKIPS_ACQUIRING_LOCK_SINCE_UPPER_LAYER_ENSURES_C7546FF8 = "procedureId {}-RemoveDataNodes 跳过获取锁,因为上层保证串行执行。"; - public static final String LOG_PROCEDUREID_ARG_REMOVEDATANODES_SKIPS_RELEASING_LOCK_SINCE_IT_HASN_T_AED8A3DA = "procedureId {}-RemoveDataNodes 跳过释放锁,因为它没有获取任何锁。"; + public static final String LOG_RETRIEVABLE_ERROR_TRYING_ADD_CONFIG_NODE_ARG_STATE_ARG_D7285810 = + "尝试添加 ConfigNode {} 时发生可重试错误,状态 {}"; + public static final String + LOG_RETRIEVABLE_ERROR_TRYING_REMOVE_CONFIG_NODE_ARG_STATE_ARG_3754EBA1 = + "尝试移除 ConfigNode {} 时发生可重试错误,状态 {}"; + public static final String + LOG_PROCEDUREID_ARG_REMOVEDATANODES_SKIPS_ACQUIRING_LOCK_SINCE_UPPER_LAYER_ENSURES_C7546FF8 = + "procedureId {}-RemoveDataNodes 跳过获取锁,因为上层保证串行执行。"; + public static final String + LOG_PROCEDUREID_ARG_REMOVEDATANODES_SKIPS_RELEASING_LOCK_SINCE_IT_HASN_T_AED8A3DA = + "procedureId {}-RemoveDataNodes 跳过释放锁,因为它没有获取任何锁。"; public static final String LOG_ARG_CAN_NOT_REMOVE_DATANODE_ARG_495F9F85 = "{}, 不能移除 DataNode {} "; - public static final String LOG_BECAUSE_NUMBER_DATANODES_LESS_EQUAL_THAN_REGION_REPLICA_NUMBER_DEC0CB38 = "因为 DataNode 数量小于或等于 Region 副本数"; - public static final String LOG_ARG_DATANODE_REGIONS_REMOVED_ARG_216A7DC7 = "{},待移除的 DataNode Region 为 {}"; - public static final String LOG_RETRIEVABLE_ERROR_TRYING_REMOVE_DATA_NODE_ARG_STATE_ARG_4EFEB850 = "尝试移除 DataNode {} 时发生可重试错误,状态 {}"; - public static final String LOG_SUBMIT_REGIONMIGRATEPROCEDURE_REGIONID_ARG_REMOVEDDATANODE_ARG_DESTDATANODE_ARG_COORDINATORFORADDPEER_ARG_ = - "提交 RegionMigrateProcedure,regionId {}: removedDataNode={}, destDataNode={}," - + " coordinatorForAddPeer={}, coordinatorForRemovePeer={}"; - public static final String LOG_ARG_CANNOT_FIND_TARGET_DATANODE_MIGRATE_REGION_ARG_81A78E06 = "{},找不到用于迁移 Region {} 的目标 DataNode"; - public static final String LOG_ARG_SOME_REGIONS_MIGRATED_FAILED_DATANODE_ARG_MIGRATEDFAILEDREGIONS_ARG_11644841 = "{},DataNode {} 中部分 Regions 迁移失败,migratedFailedRegions:{}。"; - public static final String LOG_REGIONS_HAVE_BEEN_SUCCESSFULLY_MIGRATED_WILL_NOT_ROLL_BACK_YOU_AE904563 = "已成功迁移的 Regions 不会回滚,之后可以再次提交 RemoveDataNodes 任务。"; - public static final String LOG_ARG_DATANODES_ARG_ALL_REGIONS_MIGRATED_SUCCESSFULLY_START_STOP_THEM_32D56F28 = "{},DataNodes:{} 的所有 Regions 已成功迁移,开始停止它们。"; - public static final String LOG_ARG_START_ROLL_BACK_DATANODES_STATUS_ARG_05C67270 = "{},开始回滚 DataNodes 状态:{}"; - public static final String LOG_ARG_ROLL_BACK_DATANODES_STATUS_SUCCESSFULLY_ARG_6773A2DF = "{},成功回滚 DataNodes 状态:{}"; - public static final String LOG_DATAPARTITIONINTEGRITY_NO_DATANODES_REGISTERED_NO_WAY_COLLECT_EARLIEST_TIMESLOTS_WAITING_7025EB23 = - "[DataPartitionIntegrity] 没有已注册的 DataNode,无法收集最早的 timeslot,等待它们上线"; - public static final String LOG_DATAPARTITIONINTEGRITY_FAILED_COLLECTED_EARLIEST_TIMESLOTS_DATANODE_ID_ARG_ALREADY_OUT_834B62B9 = - "[DataPartitionIntegrity] 从 DataNode[id={}] 收集最早 timeslot 失败,已超过最大重试时间"; - public static final String LOG_DATAPARTITIONINTEGRITY_FAILED_COLLECTED_EARLIEST_TIMESLOTS_DATANODE_ID_ARG_RESPONSE_STATUS_B0A31EC4 = - "[DataPartitionIntegrity] 从 DataNode[id={}] 收集最早 timeslot 失败,响应状态为 {}"; - public static final String LOG_COLLECTED_EARLIEST_TIMESLOTS_DATANODE_ID_ARG_ARG_5CDF2BA6 = "已从 DataNode[id={}] 收集最早 timeslot:{}"; - public static final String LOG_DATAPARTITIONINTEGRITY_FAILED_COLLECT_EARLIEST_TIMESLOTS_DATANODE_ID_ARG_ARG_A211840A = "[DataPartitionIntegrity] 从 DataNode[id={}] 收集最早 timeslot 失败:{}"; - public static final String LOG_COLLECTED_EARLIEST_TIMESLOTS_ARG_DATANODES_ARG_NUMBER_SUCCESSFUL_DATANODES_ARG_1CC129EF = "从 {} 个 DataNode 收集最早 timeslot:{},成功的 DataNode 数量为 {}"; - public static final String LOG_DATAPARTITIONINTEGRITY_NO_MISSING_DATA_PARTITIONS_DETECTED_NOTHING_NEEDS_REPAIRED_TERMINATING_72F2635F = - "[DataPartitionIntegrity] 未检测到缺失的数据分区,无需修复,终止 procedure"; - public static final String LOG_DATAPARTITIONINTEGRITY_NO_DATA_PARTITION_TABLE_RELATED_DATABASE_ARG_WAS_FOUND_B5B90613 = - "[DataPartitionIntegrity] 未从 ConfigNode 找到与数据库 {} 相关的数据分区表,需要修复该问题"; - public static final String LOG_DATAPARTITIONINTEGRITY_DATABASE_ARG_HAS_LOST_TIMESLOT_ARG_ITS_DATA_TABLE_499AF395 = - "[DataPartitionIntegrity] 数据库 {} 在其数据表分区中丢失 timeslot {},需要修复该问题"; - public static final String LOG_DATAPARTITIONINTEGRITY_NO_DATABASES_HAVE_LOST_DATA_PARTITIONS_TERMINATING_PROCEDURE_3E718CC3 = "[DataPartitionIntegrity] 没有数据库丢失数据分区,终止 procedure"; - public static final String LOG_DATAPARTITIONINTEGRITY_IDENTIFIED_ARG_DATABASES_HAVE_LOST_DATA_PARTITIONS_WILL_REQUEST_6DEA7502 = - "[DataPartitionIntegrity] 已识别出 {} 个数据库丢失数据分区,将请求 {} 个 DataNode 生成 DataPartitionTable"; - public static final String LOG_REQUESTING_DATAPARTITIONTABLE_GENERATION_ARG_DATANODES_559F97E8 = "正在请求 {} 个 DataNode 生成 DataPartitionTable..."; - public static final String LOG_DATAPARTITIONINTEGRITY_NO_DATANODES_REGISTERED_NO_WAY_REQUESTED_DATAPARTITIONTABLE_GENERATION_TERMINATING_ = - "[DataPartitionIntegrity] 没有已注册的 DataNode,无法请求生成 DataPartitionTable,终止 procedure"; - public static final String LOG_DATAPARTITIONINTEGRITY_FAILED_REQUEST_DATAPARTITIONTABLE_GENERATION_DATANODE_ID_ARG_ALREADY_OUT_6B0C9351 = - "[DataPartitionIntegrity] 从 DataNode[id={}] 请求生成 DataPartitionTable 失败,已超过最大重试时间"; - public static final String LOG_DATAPARTITIONINTEGRITY_FAILED_REQUEST_DATAPARTITIONTABLE_GENERATION_DATANODE_ID_ARG_RESPONSE_STATUS_93012D = - "[DataPartitionIntegrity] 从 DataNode[id={}] 请求生成 DataPartitionTable 失败,响应状态为 {}"; - public static final String LOG_DATAPARTITIONINTEGRITY_FAILED_REQUEST_DATAPARTITIONTABLE_GENERATION_DATANODE_ID_ARG_ARG_818B47B8 = "[DataPartitionIntegrity] 从 DataNode[id={}] 请求生成 DataPartitionTable 失败:{}"; - public static final String LOG_DATAPARTITIONINTEGRITY_FAILED_REQUEST_DATAPARTITIONTABLE_GENERATION_HEART_BEAT_DATANODE_ID_ARG_2AB63F12 = - "[DataPartitionIntegrity] 从 DataNode[id={}] 请求 DataPartitionTable 生成心跳失败,已超过最大重试时间"; - public static final String LOG_DATAPARTITIONINTEGRITY_FAILED_REQUEST_DATAPARTITIONTABLE_GENERATION_HEART_BEAT_DATANODE_ID_ARG_DC1702EF = - "[DataPartitionIntegrity] 从 DataNode[id={}] 请求 DataPartitionTable 生成心跳失败,状态为 {},响应状态为 {}"; - public static final String LOG_DATAPARTITIONINTEGRITY_DATANODE_ARG_COMPLETED_DATAPARTITIONTABLE_GENERATION_TERMINATING_HEART_BEAT_59DAAD5 = - "[DataPartitionIntegrity] DataNode {} 已完成 DataPartitionTable 生成,终止心跳"; - public static final String LOG_DATAPARTITIONINTEGRITY_DATANODE_ARG_STILL_GENERATING_DATAPARTITIONTABLE_63F84C78 = "[DataPartitionIntegrity] DataNode {} 仍在生成 DataPartitionTable"; - public static final String LOG_DATAPARTITIONINTEGRITY_DATANODE_ARG_RETURNED_UNKNOWN_ERROR_CODE_ARG_2DA6A21E = "[DataPartitionIntegrity] DataNode {} 返回未知错误码:{}"; - public static final String LOG_DATAPARTITIONINTEGRITY_ERROR_CHECKING_DATAPARTITIONTABLE_STATUS_DATANODE_ARG_ARG_TERMINATING_HEART_D6EDA91 = - "[DataPartitionIntegrity] 从 DataNode {} 检查 DataPartitionTable 状态出错:{},终止心跳"; - public static final String LOG_DATAPARTITIONINTEGRITY_NO_DATAPARTITIONTABLES_MERGE_DATAPARTITIONTABLES_EMPTY_920E3DE6 = "[DataPartitionIntegrity] 没有可合并的 DataPartitionTable,dataPartitionTables 为空"; - public static final String LOG_DATAPARTITIONINTEGRITY_NO_DATA_PARTITION_TABLE_RELATED_DATABASE_ARG_WAS_FOUND_D1698512 = - "[DataPartitionIntegrity] 未从 ConfigNode 找到与数据库 {} 相关的数据分区表,直接使用 DataNode 的数据分区表"; - public static final String LOG_DATAPARTITIONINTEGRITY_DATAPARTITIONTABLE_SUCCESSFULLY_WRITTEN_CONSENSUS_LOG_2B1634A6 = "[DataPartitionIntegrity] DataPartitionTable 已成功写入共识日志"; - public static final String LOG_DATAPARTITIONINTEGRITY_ARG_SERIALIZE_FAILED_DATANODEID_ARG_967B51AA = "[DataPartitionIntegrity] {} 对 dataNodeId:{} 序列化失败"; - public static final String LOG_DATAPARTITIONINTEGRITY_ARG_SERIALIZE_FINALDATAPARTITIONTABLES_FAILED_7E44DCD8 = "[DataPartitionIntegrity] {} 序列化 finalDataPartitionTables 失败"; - public static final String LOG_DATAPARTITIONINTEGRITY_ARG_DESERIALIZE_FAILED_DATANODEID_ARG_22388A60 = "[DataPartitionIntegrity] {} 对 dataNodeId:{} 反序列化失败"; - public static final String LOG_DATAPARTITIONINTEGRITY_ARG_DESERIALIZE_FINALDATAPARTITIONTABLES_FAILED_7E23E4BD = "[DataPartitionIntegrity] {} 反序列化 finalDataPartitionTables 失败"; - public static final String LOG_DATAPARTITIONINTEGRITY_FAILED_DESERIALIZE_DATABASESCOPEDDATAPARTITIONTABLE_3B6933B5 = "[DataPartitionIntegrity] 反序列化失败 DatabaseScopedDataPartitionTable"; + public static final String + LOG_BECAUSE_NUMBER_DATANODES_LESS_EQUAL_THAN_REGION_REPLICA_NUMBER_DEC0CB38 = + "因为 DataNode 数量小于或等于 Region 副本数"; + public static final String LOG_ARG_DATANODE_REGIONS_REMOVED_ARG_216A7DC7 = + "{},待移除的 DataNode Region 为 {}"; + public static final String LOG_RETRIEVABLE_ERROR_TRYING_REMOVE_DATA_NODE_ARG_STATE_ARG_4EFEB850 = + "尝试移除 DataNode {} 时发生可重试错误,状态 {}"; + public static final String + LOG_SUBMIT_REGIONMIGRATEPROCEDURE_REGIONID_ARG_REMOVEDDATANODE_ARG_DESTDATANODE_ARG_COORDINATORFORADDPEER_ARG_ = + "提交 RegionMigrateProcedure,regionId {}: removedDataNode={}, destDataNode={}," + + " coordinatorForAddPeer={}, coordinatorForRemovePeer={}"; + public static final String LOG_ARG_CANNOT_FIND_TARGET_DATANODE_MIGRATE_REGION_ARG_81A78E06 = + "{},找不到用于迁移 Region {} 的目标 DataNode"; + public static final String + LOG_ARG_SOME_REGIONS_MIGRATED_FAILED_DATANODE_ARG_MIGRATEDFAILEDREGIONS_ARG_11644841 = + "{},DataNode {} 中部分 Regions 迁移失败,migratedFailedRegions:{}。"; + public static final String + LOG_REGIONS_HAVE_BEEN_SUCCESSFULLY_MIGRATED_WILL_NOT_ROLL_BACK_YOU_AE904563 = + "已成功迁移的 Regions 不会回滚,之后可以再次提交 RemoveDataNodes 任务。"; + public static final String + LOG_ARG_DATANODES_ARG_ALL_REGIONS_MIGRATED_SUCCESSFULLY_START_STOP_THEM_32D56F28 = + "{},DataNodes:{} 的所有 Regions 已成功迁移,开始停止它们。"; + public static final String LOG_ARG_START_ROLL_BACK_DATANODES_STATUS_ARG_05C67270 = + "{},开始回滚 DataNodes 状态:{}"; + public static final String LOG_ARG_ROLL_BACK_DATANODES_STATUS_SUCCESSFULLY_ARG_6773A2DF = + "{},成功回滚 DataNodes 状态:{}"; + public static final String + LOG_DATAPARTITIONINTEGRITY_NO_DATANODES_REGISTERED_NO_WAY_COLLECT_EARLIEST_TIMESLOTS_WAITING_7025EB23 = + "[DataPartitionIntegrity] 没有已注册的 DataNode,无法收集最早的 timeslot,等待它们上线"; + public static final String + LOG_DATAPARTITIONINTEGRITY_FAILED_COLLECTED_EARLIEST_TIMESLOTS_DATANODE_ID_ARG_ALREADY_OUT_834B62B9 = + "[DataPartitionIntegrity] 从 DataNode[id={}] 收集最早 timeslot 失败,已超过最大重试时间"; + public static final String + LOG_DATAPARTITIONINTEGRITY_FAILED_COLLECTED_EARLIEST_TIMESLOTS_DATANODE_ID_ARG_RESPONSE_STATUS_B0A31EC4 = + "[DataPartitionIntegrity] 从 DataNode[id={}] 收集最早 timeslot 失败,响应状态为 {}"; + public static final String LOG_COLLECTED_EARLIEST_TIMESLOTS_DATANODE_ID_ARG_ARG_5CDF2BA6 = + "已从 DataNode[id={}] 收集最早 timeslot:{}"; + public static final String + LOG_DATAPARTITIONINTEGRITY_FAILED_COLLECT_EARLIEST_TIMESLOTS_DATANODE_ID_ARG_ARG_A211840A = + "[DataPartitionIntegrity] 从 DataNode[id={}] 收集最早 timeslot 失败:{}"; + public static final String + LOG_COLLECTED_EARLIEST_TIMESLOTS_ARG_DATANODES_ARG_NUMBER_SUCCESSFUL_DATANODES_ARG_1CC129EF = + "从 {} 个 DataNode 收集最早 timeslot:{},成功的 DataNode 数量为 {}"; + public static final String + LOG_DATAPARTITIONINTEGRITY_NO_MISSING_DATA_PARTITIONS_DETECTED_NOTHING_NEEDS_REPAIRED_TERMINATING_72F2635F = + "[DataPartitionIntegrity] 未检测到缺失的数据分区,无需修复,终止 procedure"; + public static final String + LOG_DATAPARTITIONINTEGRITY_NO_DATA_PARTITION_TABLE_RELATED_DATABASE_ARG_WAS_FOUND_B5B90613 = + "[DataPartitionIntegrity] 未从 ConfigNode 找到与数据库 {} 相关的数据分区表,需要修复该问题"; + public static final String + LOG_DATAPARTITIONINTEGRITY_DATABASE_ARG_HAS_LOST_TIMESLOT_ARG_ITS_DATA_TABLE_499AF395 = + "[DataPartitionIntegrity] 数据库 {} 在其数据表分区中丢失 timeslot {},需要修复该问题"; + public static final String + LOG_DATAPARTITIONINTEGRITY_NO_DATABASES_HAVE_LOST_DATA_PARTITIONS_TERMINATING_PROCEDURE_3E718CC3 = + "[DataPartitionIntegrity] 没有数据库丢失数据分区,终止 procedure"; + public static final String + LOG_DATAPARTITIONINTEGRITY_IDENTIFIED_ARG_DATABASES_HAVE_LOST_DATA_PARTITIONS_WILL_REQUEST_6DEA7502 = + "[DataPartitionIntegrity] 已识别出 {} 个数据库丢失数据分区,将请求 {} 个 DataNode 生成 DataPartitionTable"; + public static final String LOG_REQUESTING_DATAPARTITIONTABLE_GENERATION_ARG_DATANODES_559F97E8 = + "正在请求 {} 个 DataNode 生成 DataPartitionTable..."; + public static final String + LOG_DATAPARTITIONINTEGRITY_NO_DATANODES_REGISTERED_NO_WAY_REQUESTED_DATAPARTITIONTABLE_GENERATION_TERMINATING_ = + "[DataPartitionIntegrity] 没有已注册的 DataNode,无法请求生成 DataPartitionTable,终止 procedure"; + public static final String + LOG_DATAPARTITIONINTEGRITY_FAILED_REQUEST_DATAPARTITIONTABLE_GENERATION_DATANODE_ID_ARG_ALREADY_OUT_6B0C9351 = + "[DataPartitionIntegrity] 从 DataNode[id={}] 请求生成 DataPartitionTable 失败,已超过最大重试时间"; + public static final String + LOG_DATAPARTITIONINTEGRITY_FAILED_REQUEST_DATAPARTITIONTABLE_GENERATION_DATANODE_ID_ARG_RESPONSE_STATUS_93012D = + "[DataPartitionIntegrity] 从 DataNode[id={}] 请求生成 DataPartitionTable 失败,响应状态为 {}"; + public static final String + LOG_DATAPARTITIONINTEGRITY_FAILED_REQUEST_DATAPARTITIONTABLE_GENERATION_DATANODE_ID_ARG_ARG_818B47B8 = + "[DataPartitionIntegrity] 从 DataNode[id={}] 请求生成 DataPartitionTable 失败:{}"; + public static final String + LOG_DATAPARTITIONINTEGRITY_FAILED_REQUEST_DATAPARTITIONTABLE_GENERATION_HEART_BEAT_DATANODE_ID_ARG_2AB63F12 = + "[DataPartitionIntegrity] 从 DataNode[id={}] 请求 DataPartitionTable 生成心跳失败,已超过最大重试时间"; + public static final String + LOG_DATAPARTITIONINTEGRITY_FAILED_REQUEST_DATAPARTITIONTABLE_GENERATION_HEART_BEAT_DATANODE_ID_ARG_DC1702EF = + "[DataPartitionIntegrity] 从 DataNode[id={}] 请求 DataPartitionTable 生成心跳失败,状态为 {},响应状态为 {}"; + public static final String + LOG_DATAPARTITIONINTEGRITY_DATANODE_ARG_COMPLETED_DATAPARTITIONTABLE_GENERATION_TERMINATING_HEART_BEAT_59DAAD5 = + "[DataPartitionIntegrity] DataNode {} 已完成 DataPartitionTable 生成,终止心跳"; + public static final String + LOG_DATAPARTITIONINTEGRITY_DATANODE_ARG_STILL_GENERATING_DATAPARTITIONTABLE_63F84C78 = + "[DataPartitionIntegrity] DataNode {} 仍在生成 DataPartitionTable"; + public static final String + LOG_DATAPARTITIONINTEGRITY_DATANODE_ARG_RETURNED_UNKNOWN_ERROR_CODE_ARG_2DA6A21E = + "[DataPartitionIntegrity] DataNode {} 返回未知错误码:{}"; + public static final String + LOG_DATAPARTITIONINTEGRITY_ERROR_CHECKING_DATAPARTITIONTABLE_STATUS_DATANODE_ARG_ARG_TERMINATING_HEART_D6EDA91 = + "[DataPartitionIntegrity] 从 DataNode {} 检查 DataPartitionTable 状态出错:{},终止心跳"; + public static final String + LOG_DATAPARTITIONINTEGRITY_NO_DATAPARTITIONTABLES_MERGE_DATAPARTITIONTABLES_EMPTY_920E3DE6 = + "[DataPartitionIntegrity] 没有可合并的 DataPartitionTable,dataPartitionTables 为空"; + public static final String + LOG_DATAPARTITIONINTEGRITY_NO_DATA_PARTITION_TABLE_RELATED_DATABASE_ARG_WAS_FOUND_D1698512 = + "[DataPartitionIntegrity] 未从 ConfigNode 找到与数据库 {} 相关的数据分区表,直接使用 DataNode 的数据分区表"; + public static final String + LOG_DATAPARTITIONINTEGRITY_DATAPARTITIONTABLE_SUCCESSFULLY_WRITTEN_CONSENSUS_LOG_2B1634A6 = + "[DataPartitionIntegrity] DataPartitionTable 已成功写入共识日志"; + public static final String + LOG_DATAPARTITIONINTEGRITY_ARG_SERIALIZE_FAILED_DATANODEID_ARG_967B51AA = + "[DataPartitionIntegrity] {} 对 dataNodeId:{} 序列化失败"; + public static final String + LOG_DATAPARTITIONINTEGRITY_ARG_SERIALIZE_FINALDATAPARTITIONTABLES_FAILED_7E44DCD8 = + "[DataPartitionIntegrity] {} 序列化 finalDataPartitionTables 失败"; + public static final String + LOG_DATAPARTITIONINTEGRITY_ARG_DESERIALIZE_FAILED_DATANODEID_ARG_22388A60 = + "[DataPartitionIntegrity] {} 对 dataNodeId:{} 反序列化失败"; + public static final String + LOG_DATAPARTITIONINTEGRITY_ARG_DESERIALIZE_FINALDATAPARTITIONTABLES_FAILED_7E23E4BD = + "[DataPartitionIntegrity] {} 反序列化 finalDataPartitionTables 失败"; + public static final String + LOG_DATAPARTITIONINTEGRITY_FAILED_DESERIALIZE_DATABASESCOPEDDATAPARTITIONTABLE_3B6933B5 = + "[DataPartitionIntegrity] 反序列化失败 DatabaseScopedDataPartitionTable"; public static final String EXCEPTION_FAILED_C6FF154E = " 失败"; - public static final String LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_EXECUTEFROMVALIDATE_97490577 = "SubscriptionHandleLeaderChangeProcedure: executeFromValidate"; - public static final String LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES_D4E8BD37 = "SubscriptionHandleLeaderChangeProcedure: executeFromOperateOnConfigNodes"; - public static final String LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_FAILED_PULL_COMMIT_PROGRESS_DATANODE_ARG_STATUS_ARG_8C6DEC4E = "SubscriptionHandleLeaderChangeProcedure:拉取 DataNode {} 的提交进度失败,状态:{}"; - public static final String LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_FAILED_WRITE_API_EXECUTING_CONSENSUS_LAYER_56B3832A = "SubscriptionHandleLeaderChangeProcedure:写入 API 执行共识层时失败,原因:"; - public static final String LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_EXECUTEFROMOPERATEONDATANODES_0D9F7C98 = "SubscriptionHandleLeaderChangeProcedure: executeFromOperateOnDataNodes"; - public static final String LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_IGNORED_FAILED_TOPIC_META_PUSH_DATANODE_ARG_STATUS_ARG_67FC003F = "SubscriptionHandleLeaderChangeProcedure:忽略向 DataNode {} 推送 topic 元数据失败,状态:{}"; - public static final String LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_IGNORED_FAILED_CONSUMER_GROUP_META_PUSH_DATANODE_ARG_STATUS_17C948 = "SubscriptionHandleLeaderChangeProcedure:忽略向 DataNode {} 推送 consumer group 元数据失败,状态:{}"; - public static final String LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_IGNORED_FAILED_SUBSCRIPTION_RUNTIME_PUSH_UNREADABLE_DATANODE_ARG_S = "SubscriptionHandleLeaderChangeProcedure:忽略向不可读 DataNode {} 推送订阅运行时信息失败,状态:{}"; - public static final String LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_ROLLBACKFROMVALIDATE_74B408B7 = "SubscriptionHandleLeaderChangeProcedure: rollbackFromValidate"; - public static final String LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_ROLLBACKFROMOPERATEONCONFIGNODES_D4C70763 = "SubscriptionHandleLeaderChangeProcedure: rollbackFromOperateOnConfigNodes"; - public static final String LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_ROLLBACKFROMOPERATEONDATANODES_0250F6E9 = "SubscriptionHandleLeaderChangeProcedure: rollbackFromOperateOnDataNodes"; - public static final String LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_FAILED_DESERIALIZE_REGION_PROGRESS_KEY_ARG_SUMMARY_ARG_F6935E59 = "SubscriptionHandleLeaderChangeProcedure: 反序列化 Region 进度失败,key={}, summary={}"; - public static final String EXCEPTION_FAILED_PUSH_SUBSCRIPTION_RUNTIME_STATE_READABLE_DATANODES_DURING_LEADER_CHANGE_F37E6F2C = "leader 变更期间向可读 DataNode 推送订阅运行时状态失败,详情:%s"; - public static final String EXCEPTION_FAILED_SERIALIZE_REGION_PROGRESS_1769D6F1 = "序列化 Region 进度失败 "; - public static final String EXCEPTION_NO_READABLE_DATANODE_AVAILABLE_ACCEPT_SUBSCRIPTION_METADATA_RUNTIME_UPDATES_DURING_22E61621 = "leader 变更期间没有可读 DataNode 可接受订阅元数据/运行时更新"; - public static final String LOG_CREATESUBSCRIPTIONPROCEDURE_TOPIC_ARG_USES_CONSENSUS_SUBSCRIPTION_MODE_031CF049 = "CreateSubscriptionProcedure: topic [{}] 使用共识订阅模式 "; + public static final String + LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_EXECUTEFROMVALIDATE_97490577 = + "SubscriptionHandleLeaderChangeProcedure: executeFromValidate"; + public static final String + LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES_D4E8BD37 = + "SubscriptionHandleLeaderChangeProcedure: executeFromOperateOnConfigNodes"; + public static final String + LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_FAILED_PULL_COMMIT_PROGRESS_DATANODE_ARG_STATUS_ARG_8C6DEC4E = + "SubscriptionHandleLeaderChangeProcedure:拉取 DataNode {} 的提交进度失败,状态:{}"; + public static final String + LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_FAILED_WRITE_API_EXECUTING_CONSENSUS_LAYER_56B3832A = + "SubscriptionHandleLeaderChangeProcedure:写入 API 执行共识层时失败,原因:"; + public static final String + LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_EXECUTEFROMOPERATEONDATANODES_0D9F7C98 = + "SubscriptionHandleLeaderChangeProcedure: executeFromOperateOnDataNodes"; + public static final String + LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_IGNORED_FAILED_TOPIC_META_PUSH_DATANODE_ARG_STATUS_ARG_67FC003F = + "SubscriptionHandleLeaderChangeProcedure:忽略向 DataNode {} 推送 topic 元数据失败,状态:{}"; + public static final String + LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_IGNORED_FAILED_CONSUMER_GROUP_META_PUSH_DATANODE_ARG_STATUS_17C948 = + "SubscriptionHandleLeaderChangeProcedure:忽略向 DataNode {} 推送 consumer group 元数据失败,状态:{}"; + public static final String + LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_IGNORED_FAILED_SUBSCRIPTION_RUNTIME_PUSH_UNREADABLE_DATANODE_ARG_S = + "SubscriptionHandleLeaderChangeProcedure:忽略向不可读 DataNode {} 推送订阅运行时信息失败,状态:{}"; + public static final String + LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_ROLLBACKFROMVALIDATE_74B408B7 = + "SubscriptionHandleLeaderChangeProcedure: rollbackFromValidate"; + public static final String + LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_ROLLBACKFROMOPERATEONCONFIGNODES_D4C70763 = + "SubscriptionHandleLeaderChangeProcedure: rollbackFromOperateOnConfigNodes"; + public static final String + LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_ROLLBACKFROMOPERATEONDATANODES_0250F6E9 = + "SubscriptionHandleLeaderChangeProcedure: rollbackFromOperateOnDataNodes"; + public static final String + LOG_SUBSCRIPTIONHANDLELEADERCHANGEPROCEDURE_FAILED_DESERIALIZE_REGION_PROGRESS_KEY_ARG_SUMMARY_ARG_F6935E59 = + "SubscriptionHandleLeaderChangeProcedure: 反序列化 Region 进度失败,key={}, summary={}"; + public static final String + EXCEPTION_FAILED_PUSH_SUBSCRIPTION_RUNTIME_STATE_READABLE_DATANODES_DURING_LEADER_CHANGE_F37E6F2C = + "leader 变更期间向可读 DataNode 推送订阅运行时状态失败,详情:%s"; + public static final String EXCEPTION_FAILED_SERIALIZE_REGION_PROGRESS_1769D6F1 = + "序列化 Region 进度失败 "; + public static final String + EXCEPTION_NO_READABLE_DATANODE_AVAILABLE_ACCEPT_SUBSCRIPTION_METADATA_RUNTIME_UPDATES_DURING_22E61621 = + "leader 变更期间没有可读 DataNode 可接受订阅元数据/运行时更新"; + public static final String + LOG_CREATESUBSCRIPTIONPROCEDURE_TOPIC_ARG_USES_CONSENSUS_SUBSCRIPTION_MODE_031CF049 = + "CreateSubscriptionProcedure: topic [{}] 使用共识订阅模式 "; public static final String LOG_MODE_ARG_SKIPPING_PIPE_CREATION_5F4D1026 = "(mode={}),跳过创建 pipe"; - public static final String LOG_CREATESUBSCRIPTIONPROCEDURE_CONSENSUS_BASED_TOPICS_ARG_WILL_HANDLED_DATANODE_90A9C2FD = "CreateSubscriptionProcedure:基于共识的 topics {} 将由 DataNode 处理"; - public static final String LOG_VIA_CONSUMER_GROUP_META_PUSH_NO_PIPE_CREATION_NEEDED_D56CFE31 = "通过 consumer group 元数据推送(无需创建 pipe)"; - public static final String LOG_DROPSUBSCRIPTIONPROCEDURE_TOPIC_ARG_USES_CONSENSUS_SUBSCRIPTION_MODE_6962D13C = "DropSubscriptionProcedure: topic [{}] 使用共识订阅模式 "; + public static final String + LOG_CREATESUBSCRIPTIONPROCEDURE_CONSENSUS_BASED_TOPICS_ARG_WILL_HANDLED_DATANODE_90A9C2FD = + "CreateSubscriptionProcedure:基于共识的 topics {} 将由 DataNode 处理"; + public static final String LOG_VIA_CONSUMER_GROUP_META_PUSH_NO_PIPE_CREATION_NEEDED_D56CFE31 = + "通过 consumer group 元数据推送(无需创建 pipe)"; + public static final String + LOG_DROPSUBSCRIPTIONPROCEDURE_TOPIC_ARG_USES_CONSENSUS_SUBSCRIPTION_MODE_6962D13C = + "DropSubscriptionProcedure: topic [{}] 使用共识订阅模式 "; public static final String LOG_MODE_ARG_SKIPPING_PIPE_REMOVAL_133B0CD6 = "(mode={}),跳过移除 pipe"; - public static final String LOG_COMMITPROGRESSSYNCPROCEDURE_ACQUIRELOCK_SKIP_PROCEDURE_LAST_EXECUTION_TIME_ARG_CE3DD247 = "CommitProgressSyncProcedure:acquireLock,因上次执行时间 {} 跳过该 procedure"; - public static final String LOG_COMMITPROGRESSSYNCPROCEDURE_EXECUTEFROMVALIDATE_CF220E1F = "CommitProgressSyncProcedure: executeFromValidate"; - public static final String LOG_COMMITPROGRESSSYNCPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES_0DC818CA = "CommitProgressSyncProcedure: executeFromOperateOnConfigNodes"; - public static final String LOG_FAILED_PULL_COMMIT_PROGRESS_DATANODE_ARG_STATUS_ARG_33037B29 = "拉取 DataNode {} 的提交进度失败,状态:{}"; - public static final String LOG_COMMITPROGRESSSYNCPROCEDURE_EXECUTEFROMOPERATEONDATANODES_NO_OP_34420360 = "CommitProgressSyncProcedure: executeFromOperateOnDataNodes(无操作)"; - public static final String LOG_COMMITPROGRESSSYNCPROCEDURE_ROLLBACKFROMVALIDATE_2309D4D2 = "CommitProgressSyncProcedure: rollbackFromValidate"; - public static final String LOG_COMMITPROGRESSSYNCPROCEDURE_ROLLBACKFROMOPERATEONCONFIGNODES_57CB907B = "CommitProgressSyncProcedure: rollbackFromOperateOnConfigNodes"; - public static final String LOG_COMMITPROGRESSSYNCPROCEDURE_ROLLBACKFROMOPERATEONDATANODES_0D2CEB50 = "CommitProgressSyncProcedure: rollbackFromOperateOnDataNodes"; - public static final String LOG_COMMITPROGRESSSYNCPROCEDURE_FAILED_DESERIALIZE_REGION_PROGRESS_KEY_ARG_SUMMARY_ARG_0202F658 = "CommitProgressSyncProcedure: 反序列化 Region 进度失败,key={}, summary={}"; + public static final String + LOG_COMMITPROGRESSSYNCPROCEDURE_ACQUIRELOCK_SKIP_PROCEDURE_LAST_EXECUTION_TIME_ARG_CE3DD247 = + "CommitProgressSyncProcedure:acquireLock,因上次执行时间 {} 跳过该 procedure"; + public static final String LOG_COMMITPROGRESSSYNCPROCEDURE_EXECUTEFROMVALIDATE_CF220E1F = + "CommitProgressSyncProcedure: executeFromValidate"; + public static final String + LOG_COMMITPROGRESSSYNCPROCEDURE_EXECUTEFROMOPERATEONCONFIGNODES_0DC818CA = + "CommitProgressSyncProcedure: executeFromOperateOnConfigNodes"; + public static final String LOG_FAILED_PULL_COMMIT_PROGRESS_DATANODE_ARG_STATUS_ARG_33037B29 = + "拉取 DataNode {} 的提交进度失败,状态:{}"; + public static final String + LOG_COMMITPROGRESSSYNCPROCEDURE_EXECUTEFROMOPERATEONDATANODES_NO_OP_34420360 = + "CommitProgressSyncProcedure: executeFromOperateOnDataNodes(无操作)"; + public static final String LOG_COMMITPROGRESSSYNCPROCEDURE_ROLLBACKFROMVALIDATE_2309D4D2 = + "CommitProgressSyncProcedure: rollbackFromValidate"; + public static final String + LOG_COMMITPROGRESSSYNCPROCEDURE_ROLLBACKFROMOPERATEONCONFIGNODES_57CB907B = + "CommitProgressSyncProcedure: rollbackFromOperateOnConfigNodes"; + public static final String + LOG_COMMITPROGRESSSYNCPROCEDURE_ROLLBACKFROMOPERATEONDATANODES_0D2CEB50 = + "CommitProgressSyncProcedure: rollbackFromOperateOnDataNodes"; + public static final String + LOG_COMMITPROGRESSSYNCPROCEDURE_FAILED_DESERIALIZE_REGION_PROGRESS_KEY_ARG_SUMMARY_ARG_0202F658 = + "CommitProgressSyncProcedure: 反序列化 Region 进度失败,key={}, summary={}"; public static final String EXCEPTION_UNEXPECTED_PARENT_444B4289 = "非预期父节点"; public static final String LOG_ARG_8393DD4A = "{}"; - public static final String MESSAGE_HALT_PID_ARG_ACTIVECOUNT_ARG_411F3EBF = "停止 pid={},activeCount={}"; - public static final String MESSAGE_EXCEPTION_HAPPENED_WHEN_WORKER_ARG_EXECUTE_PROCEDURE_ARG_6E3AD27D = "worker {} 执行 procedure {} 时发生异常"; - public static final String EXCEPTION_CANNOT_DERIVE_A_COLLISION_FREE_DELETE_TASKID_PROCID_ARG_DELETETASKSEQ_ARG_EXCEED_THE_71B7046A = - "无法推导出无冲突的 delete taskId:procId=%d,deleteTaskSeq=%d 超出了 "; - public static final String EXCEPTION_CANNOT_DERIVE_A_COLLISION_FREE_DELETE_TASKID_PROCID_ARG_DELETETASKSEQ_ARG_EXCEED_THE_ARG_ARG_BIT_BUDGET_015C598D = - "无法推导出无冲突的 delete taskId:procId=%d,deleteTaskSeq=%d 超出了 %d/%d 位的预算"; - public static final String MESSAGE_FAILED_TO_SHOW_DATAPARTITIONTABLE_INTEGRITY_CHECK_PROGRESS_5EE98694 = "显示 DataPartitionTable 完整性检查进度失败"; - public static final String MESSAGE_ENCOUNTERED_UNEXPECTED_DATAPARTITIONTABLEINTEGRITYCHECKPROCEDURESTATE_ARG_WHEN_SHOWING_PROGRESS_5FA2739F = - "显示进度时遇到非预期的 DataPartitionTableIntegrityCheckProcedureState {}"; - public static final String MESSAGE_UNEXPECTED_DATAPARTITIONTABLEINTEGRITYCHECKPROCEDURESTATE_ARG_WHEN_SHOWING_PROGRESS_D3C07BA1 = - "非预期的 DataPartitionTableIntegrityCheckProcedureState {}(显示进度时)"; - + public static final String MESSAGE_HALT_PID_ARG_ACTIVECOUNT_ARG_411F3EBF = + "停止 pid={},activeCount={}"; + public static final String + MESSAGE_EXCEPTION_HAPPENED_WHEN_WORKER_ARG_EXECUTE_PROCEDURE_ARG_6E3AD27D = + "worker {} 执行 procedure {} 时发生异常"; + public static final String + EXCEPTION_CANNOT_DERIVE_A_COLLISION_FREE_DELETE_TASKID_PROCID_ARG_DELETETASKSEQ_ARG_EXCEED_THE_71B7046A = + "无法推导出无冲突的 delete taskId:procId=%d,deleteTaskSeq=%d 超出了 "; + public static final String + EXCEPTION_CANNOT_DERIVE_A_COLLISION_FREE_DELETE_TASKID_PROCID_ARG_DELETETASKSEQ_ARG_EXCEED_THE_ARG_ARG_BIT_BUDGET_015C598D = + "无法推导出无冲突的 delete taskId:procId=%d,deleteTaskSeq=%d 超出了 %d/%d 位的预算"; + public static final String + MESSAGE_FAILED_TO_SHOW_DATAPARTITIONTABLE_INTEGRITY_CHECK_PROGRESS_5EE98694 = + "显示 DataPartitionTable 完整性检查进度失败"; + public static final String + MESSAGE_ENCOUNTERED_UNEXPECTED_DATAPARTITIONTABLEINTEGRITYCHECKPROCEDURESTATE_ARG_WHEN_SHOWING_PROGRESS_5FA2739F = + "显示进度时遇到非预期的 DataPartitionTableIntegrityCheckProcedureState {}"; + public static final String + MESSAGE_UNEXPECTED_DATAPARTITIONTABLEINTEGRITYCHECKPROCEDURESTATE_ARG_WHEN_SHOWING_PROGRESS_D3C07BA1 = + "非预期的 DataPartitionTableIntegrityCheckProcedureState {}(显示进度时)"; } From 2dd3759072228f9d840af141cd67e160edc54b00 Mon Sep 17 00:00:00 2001 From: Yaobin Chen Date: Mon, 6 Jul 2026 19:14:24 +0800 Subject: [PATCH 5/5] fix: remove the configuration 'check_dn_lease_status_interval_ms' from CommonConfig to the IoTDBConfig --- .../java/org/apache/iotdb/db/conf/IoTDBConfig.java | 10 ++++++++++ .../java/org/apache/iotdb/db/conf/IoTDBDescriptor.java | 6 ++++++ .../db/schemaengine/lease/MetadataLeaseManager.java | 3 ++- .../org/apache/iotdb/commons/conf/CommonConfig.java | 10 ---------- .../apache/iotdb/commons/conf/CommonDescriptor.java | 6 ------ 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java index b0c78e496e706..ff5434c4e29db 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java @@ -204,6 +204,8 @@ public class IoTDBConfig { private volatile long dataNodeTableSchemaCacheSize = 1 << 20; + private volatile long checkDnLeaseStatusIntervalMs = 500; + /** * MemTable size threshold for triggering MemTable snapshot in wal. When a memTable's size exceeds * this, wal can flush this memtable to disk, otherwise wal will snapshot this memtable in wal. @@ -2081,6 +2083,14 @@ public void setDataNodeTableSchemaCacheSize(long dataNodeTableSchemaCacheSize) { this.dataNodeTableSchemaCacheSize = dataNodeTableSchemaCacheSize; } + public long getCheckDnLeaseStatusIntervalMs() { + return checkDnLeaseStatusIntervalMs; + } + + public void setCheckDnLeaseStatusIntervalMs(long checkDnLeaseStatusIntervalMs) { + this.checkDnLeaseStatusIntervalMs = checkDnLeaseStatusIntervalMs; + } + public int getDeviceSchemaRequestCacheMaxSize() { return deviceSchemaRequestCacheMaxSize; } diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java index 3544f68662447..2768467a55947 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java @@ -1004,6 +1004,12 @@ public void loadProperties(TrimProperties properties) throws BadNodeUrlException "device_schema_request_cache_wait_time_ms", String.valueOf(conf.getDeviceSchemaRequestCacheWaitTimeMs())))); + conf.setCheckDnLeaseStatusIntervalMs( + Long.parseLong( + properties.getProperty( + "check_dn_lease_status_interval_ms", + String.valueOf(conf.getCheckDnLeaseStatusIntervalMs())))); + // Commons commonDescriptor.loadCommonProps(properties); commonDescriptor.initCommonConfigDir(conf.getSystemDir()); diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManager.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManager.java index e52fef88c6d1c..a1e7937758332 100644 --- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManager.java +++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/lease/MetadataLeaseManager.java @@ -24,6 +24,7 @@ import org.apache.iotdb.commons.conf.CommonDescriptor; import org.apache.iotdb.commons.exception.MetadataLeaseFencedException; import org.apache.iotdb.commons.utils.TestOnly; +import org.apache.iotdb.db.conf.IoTDBDescriptor; import org.apache.iotdb.db.i18n.DataNodeSchemaMessages; import org.apache.iotdb.db.queryengine.plan.analyze.ClusterPartitionFetcher; import org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.cache.TreeDeviceSchemaCacheManager; @@ -98,7 +99,7 @@ private MetadataLeaseManager() { defaultClearCacheList(), defaultPullMetaList(), IoTDBThreadPoolFactory.newCachedThreadPool(RELOAD_TABLE_METADATA_CACHE.getName()), - CommonDescriptor.getInstance().getConfig().getCheckDnLeaseStatusIntervalMs(), + IoTDBDescriptor.getInstance().getConfig().getCheckDnLeaseStatusIntervalMs(), IoTDBThreadPoolFactory.newScheduledThreadPool(1, CHECK_DN_LEASE_STATUS.getName())); } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java index 4834d216ffbb6..8b98da6bc3172 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonConfig.java @@ -484,8 +484,6 @@ public class CommonConfig { // derive how long it must wait before treating an unreachable DataNode as safely fenced. private volatile long metadataLeaseFenceMs = 20_000; - private volatile long checkDnLeaseStatusIntervalMs = 500; - private final RateLimiter querySamplingRateLimiter = RateLimiter.create(160); // if querySamplingRateLimiter < 0, means that there is no rate limit, we need to full sample all // the queries @@ -2959,14 +2957,6 @@ public void setMetadataLeaseFenceMs(long metadataLeaseFenceMs) { this.metadataLeaseFenceMs = metadataLeaseFenceMs; } - public long getCheckDnLeaseStatusIntervalMs() { - return checkDnLeaseStatusIntervalMs; - } - - public void setCheckDnLeaseStatusIntervalMs(long checkDnLeaseStatusIntervalMs) { - this.checkDnLeaseStatusIntervalMs = checkDnLeaseStatusIntervalMs; - } - public int getArenaNum() { return arenaNum; } diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java index a587ab47092ea..9933997622a4f 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/conf/CommonDescriptor.java @@ -346,12 +346,6 @@ public void loadCommonProps(TrimProperties properties) throws IOException { properties.getProperty( "metadata_lease_fence_ms", String.valueOf(config.getMetadataLeaseFenceMs())))); - config.setCheckDnLeaseStatusIntervalMs( - Long.parseLong( - properties.getProperty( - "check_dn_lease_status_interval_ms", - String.valueOf(config.getCheckDnLeaseStatusIntervalMs())))); - loadRetryProperties(properties); loadBinaryAllocatorProps(properties); }