You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/06/21 08:07:43 UTC
[shardingsphere] branch master updated: Delete TransactionConfigurationFileGenerator (#18484)
This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 77485ca8058 Delete TransactionConfigurationFileGenerator (#18484)
77485ca8058 is described below
commit 77485ca8058a88ba942a55196fd3c790c0fde44a
Author: JingShang Lu <ji...@gmail.com>
AuthorDate: Tue Jun 21 16:07:36 2022 +0800
Delete TransactionConfigurationFileGenerator (#18484)
* delete TransactionConfigurationFileGenerator
* fix
---
.../infra/instance/ComputeNodeInstance.java | 4 -
.../infra/instance/InstanceContext.java | 35 ---
.../transaction/rule/TransactionRule.java | 2 -
.../spi/TransactionConfigurationFileGenerator.java | 50 ---
...ansactionConfigurationFileGeneratorFactory.java | 43 ---
...xtureTransactionConfigurationFileGenerator.java | 41 ---
...ctionConfigurationFileGeneratorFactoryTest.java | 44 ---
...ction.spi.TransactionConfigurationFileGenerator | 18 --
.../xa/narayana/config/NarayanaConfigEntry.java | 43 ---
.../xa/narayana/config/NarayanaConfiguration.java | 41 ---
.../config/NarayanaConfigurationFileGenerator.java | 207 -------------
...ction.spi.TransactionConfigurationFileGenerator | 18 --
.../NarayanaConfigurationFileGeneratorTest.java | 335 ---------------------
.../mode/manager/ContextManager.java | 11 -
.../mode/metadata/persist/node/ComputeNode.java | 22 --
.../metadata/persist/node/ComputeNodeTest.java | 10 -
.../cluster/ClusterContextManagerBuilder.java | 47 +--
.../ClusterContextManagerCoordinator.java | 33 --
.../cluster/coordinator/RegistryCenter.java | 1 -
.../compute/event/XaRecoveryIdAddedEvent.java | 34 ---
.../compute/event/XaRecoveryIdChangedEvent.java | 35 ---
.../compute/event/XaRecoveryIdDeletedEvent.java | 34 ---
.../compute/service/ComputeNodeStatusService.java | 38 ---
.../subscriber/ComputeNodeStatusSubscriber.java | 11 -
.../watcher/ComputeNodeStateChangedWatcher.java | 16 -
.../ClusterContextManagerCoordinatorTest.java | 7 -
.../service/ComputeNodeStatusServiceTest.java | 18 --
.../ComputeNodeStateChangedWatcherTest.java | 16 -
.../memory/MemoryContextManagerBuilder.java | 13 -
.../StandaloneContextManagerBuilder.java | 14 -
.../text/distsql/ral/RALBackendHandlerFactory.java | 3 -
.../ral/common/queryable/ShowInstanceHandler.java | 8 +-
.../ral/common/updatable/AlterInstanceHandler.java | 53 ----
.../common/updatable/AlterInstanceHandlerTest.java | 77 -----
.../src/main/resources/conf/server.yaml | 15 -
35 files changed, 4 insertions(+), 1393 deletions(-)
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/ComputeNodeInstance.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/ComputeNodeInstance.java
index 79b6b2fd604..24faee66088 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/ComputeNodeInstance.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/ComputeNodeInstance.java
@@ -25,8 +25,6 @@ import org.apache.shardingsphere.infra.state.StateContext;
import org.apache.shardingsphere.infra.state.StateType;
import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
/**
* Instance of compute node.
@@ -44,8 +42,6 @@ public final class ComputeNodeInstance {
private Long workerId;
- private List<String> xaRecoveryIds = new LinkedList<>();
-
/**
* Set labels.
*
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
index 56eeb602ab7..b66be41676a 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
@@ -101,41 +101,6 @@ public final class InstanceContext {
computeNodeInstances.stream().filter(each -> each.getInstanceDefinition().getInstanceId().equals(instanceId)).forEach(each -> each.setLabels(labels));
}
- /**
- * Add instance XA recovery id.
- *
- * @param instanceId instance id
- * @param xaRecoveryId XA recovery id
- * @return true if current instance updated, else false
- */
- public boolean addXaRecoveryId(final String instanceId, final String xaRecoveryId) {
- if (instanceId.equals(instance.getCurrentInstanceId()) && !instance.getXaRecoveryIds().contains(xaRecoveryId)) {
- instance.getXaRecoveryIds().add(xaRecoveryId);
- computeNodeInstances.stream().filter(each -> each.getInstanceDefinition().getInstanceId().equals(instanceId)).forEach(each -> each.getXaRecoveryIds().add(xaRecoveryId));
- return true;
- }
- computeNodeInstances.stream().filter(each -> each.getInstanceDefinition().getInstanceId().equals(instanceId) && !each.getXaRecoveryIds().contains(xaRecoveryId))
- .forEach(each -> each.getXaRecoveryIds().add(xaRecoveryId));
- return false;
- }
-
- /**
- * Delete instance XA recovery id.
- *
- * @param instanceId instance id
- * @param xaRecoveryId XA recovery id
- * @return true if current instance updated, else false
- */
- public boolean deleteXaRecoveryId(final String instanceId, final String xaRecoveryId) {
- if (instanceId.equals(instance.getCurrentInstanceId()) && instance.getXaRecoveryIds().contains(xaRecoveryId)) {
- instance.getXaRecoveryIds().remove(xaRecoveryId);
- computeNodeInstances.stream().filter(each -> each.getInstanceDefinition().getInstanceId().equals(instanceId)).forEach(each -> each.getXaRecoveryIds().remove(xaRecoveryId));
- return true;
- }
- computeNodeInstances.stream().filter(each -> each.getInstanceDefinition().getInstanceId().equals(instanceId)).forEach(each -> each.getXaRecoveryIds().remove(xaRecoveryId));
- return false;
- }
-
/**
* Get worker id.
*
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java
index df9ee40d366..41894d15a43 100644
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java
+++ b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/rule/TransactionRule.java
@@ -28,7 +28,6 @@ import org.apache.shardingsphere.infra.rule.identifier.type.ResourceHeldRule;
import org.apache.shardingsphere.transaction.ShardingSphereTransactionManagerEngine;
import org.apache.shardingsphere.transaction.config.TransactionRuleConfiguration;
import org.apache.shardingsphere.transaction.core.TransactionType;
-import org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGeneratorFactory;
import java.util.HashMap;
import java.util.Map;
@@ -69,7 +68,6 @@ public final class TransactionRule implements GlobalRule, InstanceAwareRule, Res
private Map<String, ShardingSphereTransactionManagerEngine> createTransactionManagerEngines(final Map<String, ShardingSphereDatabase> databases, final InstanceContext instanceContext) {
Map<String, ShardingSphereTransactionManagerEngine> result = new HashMap<>(databases.keySet().size(), 1);
- TransactionConfigurationFileGeneratorFactory.findInstance(providerType).ifPresent(optional -> optional.generateFile(props, instanceContext));
for (Entry<String, ShardingSphereDatabase> entry : databases.entrySet()) {
result.put(entry.getKey(), createTransactionManagerEngine(entry.getValue()));
}
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/spi/TransactionConfigurationFileGenerator.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/spi/TransactionConfigurationFileGenerator.java
deleted file mode 100644
index 25a30eddf25..00000000000
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/spi/TransactionConfigurationFileGenerator.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.shardingsphere.transaction.spi;
-
-import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
-import org.apache.shardingsphere.infra.instance.InstanceContext;
-import org.apache.shardingsphere.spi.annotation.SingletonSPI;
-import org.apache.shardingsphere.spi.type.typed.TypedSPI;
-
-import java.util.Properties;
-
-/**
- * Transaction configuration file generator.
- */
-@SingletonSPI
-public interface TransactionConfigurationFileGenerator extends TypedSPI {
-
- /**
- * Generate transaction configuration file.
- *
- * @param transactionProps transaction properties
- * @param instanceContext instance context
- */
- void generateFile(Properties transactionProps, InstanceContext instanceContext);
-
- /**
- * Get transaction rule props.
- *
- * @param originTransactionProps origin transaction properties
- * @param databaseConfig database configuration
- * @param modeType mode type
- * @return transaction rule props
- */
- Properties getTransactionProps(Properties originTransactionProps, DatabaseConfiguration databaseConfig, String modeType);
-}
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/spi/TransactionConfigurationFileGeneratorFactory.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/spi/TransactionConfigurationFileGeneratorFactory.java
deleted file mode 100644
index 2ac0def469f..00000000000
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/main/java/org/apache/shardingsphere/transaction/spi/TransactionConfigurationFileGeneratorFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.shardingsphere.transaction.spi;
-
-import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
-import org.apache.shardingsphere.spi.type.typed.TypedSPIRegistry;
-
-import java.util.Optional;
-
-/**
- * Transaction configuration file generator factory.
- */
-public final class TransactionConfigurationFileGeneratorFactory {
-
- static {
- ShardingSphereServiceLoader.register(TransactionConfigurationFileGenerator.class);
- }
-
- /**
- * Find instance of transaction configuration file generator.
- *
- * @param transactionProviderType transaction provider type
- * @return found instance
- */
- public static Optional<TransactionConfigurationFileGenerator> findInstance(final String transactionProviderType) {
- return null == transactionProviderType ? Optional.empty() : TypedSPIRegistry.findRegisteredService(TransactionConfigurationFileGenerator.class, transactionProviderType);
- }
-}
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/fixture/FixtureTransactionConfigurationFileGenerator.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/fixture/FixtureTransactionConfigurationFileGenerator.java
deleted file mode 100644
index f731350ebc9..00000000000
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/fixture/FixtureTransactionConfigurationFileGenerator.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.shardingsphere.transaction.fixture;
-
-import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
-import org.apache.shardingsphere.infra.instance.InstanceContext;
-import org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGenerator;
-
-import java.util.Properties;
-
-public final class FixtureTransactionConfigurationFileGenerator implements TransactionConfigurationFileGenerator {
-
- @Override
- public void generateFile(final Properties transactionProps, final InstanceContext instanceContext) {
- }
-
- @Override
- public Properties getTransactionProps(final Properties originTransactionProps, final DatabaseConfiguration databaseConfig, final String modeType) {
- return new Properties();
- }
-
- @Override
- public String getType() {
- return "FIXTURE";
- }
-}
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/spi/TransactionConfigurationFileGeneratorFactoryTest.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/spi/TransactionConfigurationFileGeneratorFactoryTest.java
deleted file mode 100644
index 1fad85aca5a..00000000000
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/java/org/apache/shardingsphere/transaction/spi/TransactionConfigurationFileGeneratorFactoryTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.shardingsphere.transaction.spi;
-
-import org.apache.shardingsphere.transaction.fixture.FixtureTransactionConfigurationFileGenerator;
-import org.junit.Test;
-
-import java.util.Optional;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-public final class TransactionConfigurationFileGeneratorFactoryTest {
-
- @Test
- public void assertFindInstanceWithoutTransactionProviderType() {
- Optional<TransactionConfigurationFileGenerator> actual = TransactionConfigurationFileGeneratorFactory.findInstance(null);
- assertFalse(actual.isPresent());
- }
-
- @Test
- public void assertFindInstance() {
- Optional<TransactionConfigurationFileGenerator> actual = TransactionConfigurationFileGeneratorFactory.findInstance("FIXTURE");
- assertTrue(actual.isPresent());
- assertThat(actual.get(), instanceOf(FixtureTransactionConfigurationFileGenerator.class));
- }
-}
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/resources/META-INF/services/org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGenerator b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/resources/META-INF/services/org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGenerator
deleted file mode 100644
index 938a92bf3ef..00000000000
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-core/src/test/resources/META-INF/services/org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGenerator
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-org.apache.shardingsphere.transaction.fixture.FixtureTransactionConfigurationFileGenerator
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/config/NarayanaConfigEntry.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/ [...]
deleted file mode 100644
index 667e86725af..00000000000
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/config/NarayanaConfigEntry.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.shardingsphere.transaction.xa.narayana.config;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlValue;
-import java.util.Collection;
-import java.util.LinkedList;
-
-/**
- * Narayana config entry.
- */
-@Getter
-@Setter
-@XmlAccessorType(XmlAccessType.FIELD)
-public final class NarayanaConfigEntry {
-
- @XmlAttribute
- private String key;
-
- @XmlValue
- private Collection<String> value = new LinkedList<>();
-}
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/config/NarayanaConfiguration.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/sr [...]
deleted file mode 100644
index 5f1bc2c86d5..00000000000
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/config/NarayanaConfiguration.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.shardingsphere.transaction.xa.narayana.config;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import java.util.Collection;
-import java.util.LinkedList;
-
-/**
- * Narayana config.
- */
-@XmlRootElement(name = "properties")
-@XmlAccessorType(XmlAccessType.FIELD)
-@Getter
-@Setter
-public final class NarayanaConfiguration {
-
- @XmlElement(name = "entry")
- private Collection<NarayanaConfigEntry> entries = new LinkedList<>();
-}
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/config/NarayanaConfigurationFileGenerator.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-x [...]
deleted file mode 100644
index 4168f1e07f2..00000000000
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/config/NarayanaConfigurationFileGenerator.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * 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.shardingsphere.transaction.xa.narayana.config;
-
-import com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCStore;
-import com.arjuna.ats.internal.arjuna.objectstore.jdbc.accessors.DynamicDataSourceJDBCAccess;
-import com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule;
-import com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner;
-import com.arjuna.ats.internal.jta.recovery.arjunacore.JTAActionStatusServiceXAResourceOrphanFilter;
-import com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter;
-import com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResourceOrphanFilter;
-import com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule;
-import com.google.common.base.Joiner;
-import org.apache.shardingsphere.infra.config.database.DatabaseConfiguration;
-import org.apache.shardingsphere.infra.database.type.DatabaseType;
-import org.apache.shardingsphere.infra.database.type.DatabaseTypeEngine;
-import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
-import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
-import org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
-import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaData;
-import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaDataFactory;
-import org.apache.shardingsphere.infra.datasource.pool.metadata.DataSourcePoolMetaDataReflection;
-import org.apache.shardingsphere.infra.datasource.pool.metadata.type.DefaultDataSourcePoolFieldMetaData;
-import org.apache.shardingsphere.infra.instance.InstanceContext;
-import org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGenerator;
-
-import javax.sql.DataSource;
-import javax.xml.bind.JAXB;
-import java.io.File;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Properties;
-
-/**
- * Narayana transaction configuration file generator.
- */
-public final class NarayanaConfigurationFileGenerator implements TransactionConfigurationFileGenerator {
-
- @Override
- public void generateFile(final Properties transactionProps, final InstanceContext instanceContext) {
- String instanceId = instanceContext.getInstance().getInstanceDefinition().getInstanceId();
- String recoveryId = instanceContext.getInstance().getXaRecoveryIds().isEmpty() ? instanceId : Joiner.on(",").join(instanceContext.getInstance().getXaRecoveryIds());
- NarayanaConfiguration config = createDefaultConfiguration(instanceId, recoveryId, transactionProps);
- if (!transactionProps.isEmpty()) {
- appendUserDefinedJdbcStoreConfiguration(transactionProps, config);
- }
- JAXB.marshal(config, new File(ClassLoader.getSystemResource("").getPath(), "jbossts-properties.xml"));
- }
-
- private NarayanaConfiguration createDefaultConfiguration(final String instanceId, final String recoverId, final Properties transactionProps) {
- NarayanaConfiguration result = new NarayanaConfiguration();
- result.getEntries().add(createEntry("CoordinatorEnvironmentBean.commitOnePhase", transactionProps.getOrDefault("commitOnePhase", Boolean.TRUE).toString()));
- result.getEntries().add(createEntry("ObjectStoreEnvironmentBean.transactionSync", transactionProps.getOrDefault("transactionSync", Boolean.FALSE).toString()));
- result.getEntries().add(createEntry("CoreEnvironmentBean.nodeIdentifier", instanceId));
- result.getEntries().add(createEntry("JTAEnvironmentBean.xaRecoveryNodes", recoverId));
- result.getEntries().add(createEntry("JTAEnvironmentBean.xaResourceOrphanFilterClassNames", createXAResourceOrphanFilterClassNames()));
- result.getEntries().add(createEntry("CoreEnvironmentBean.socketProcessIdPort", "0"));
- result.getEntries().add(createEntry("RecoveryEnvironmentBean.recoveryModuleClassNames", getRecoveryModuleClassNames()));
- result.getEntries().add(createEntry("RecoveryEnvironmentBean.expiryScannerClassNames", ExpiredTransactionStatusManagerScanner.class.getName()));
- result.getEntries().add(createEntry("RecoveryEnvironmentBean.recoveryPort", "4712"));
- result.getEntries().add(createEntry("RecoveryEnvironmentBean.recoveryAddress", ""));
- result.getEntries().add(createEntry("RecoveryEnvironmentBean.transactionStatusManagerPort", "0"));
- result.getEntries().add(createEntry("RecoveryEnvironmentBean.transactionStatusManagerAddress", ""));
- result.getEntries().add(createEntry("RecoveryEnvironmentBean.recoveryListener", Boolean.FALSE.toString()));
- result.getEntries().add(createEntry("RecoveryEnvironmentBean.recoveryBackoffPeriod", transactionProps.getOrDefault("recoveryBackoffPeriod", "1").toString()));
- result.getEntries().add(createEntry("CoordinatorEnvironmentBean.defaultTimeout", transactionProps.getOrDefault("defaultTimeout", "180").toString()));
- result.getEntries().add(createEntry("RecoveryEnvironmentBean.expiryScanInterval", transactionProps.getOrDefault("expiryScanInterval", "12").toString()));
- result.getEntries().add(createEntry("RecoveryEnvironmentBean.periodicRecoveryPeriod", transactionProps.getOrDefault("periodicRecoveryPeriod", "120").toString()));
- return result;
- }
-
- private NarayanaConfigEntry createEntry(final String key, final String value) {
- NarayanaConfigEntry result = new NarayanaConfigEntry();
- result.setKey(key);
- result.getValue().add(value);
- return result;
- }
-
- private NarayanaConfigEntry createEntry(final String key, final Collection<String> values) {
- NarayanaConfigEntry result = new NarayanaConfigEntry();
- result.setKey(key);
- result.getValue().addAll(values);
- return result;
- }
-
- private Collection<String> createXAResourceOrphanFilterClassNames() {
- Collection<String> result = new LinkedList<>();
- result.add(JTATransactionLogXAResourceOrphanFilter.class.getName());
- result.add(JTANodeNameXAResourceOrphanFilter.class.getName());
- result.add(JTAActionStatusServiceXAResourceOrphanFilter.class.getName());
- return result;
- }
-
- private Collection<String> getRecoveryModuleClassNames() {
- Collection<String> result = new LinkedList<>();
- result.add(AtomicActionRecoveryModule.class.getName());
- result.add(XARecoveryModule.class.getName());
- return result;
- }
-
- private void appendUserDefinedJdbcStoreConfiguration(final Properties transactionProps, final NarayanaConfiguration config) {
- String url = transactionProps.getProperty("recoveryStoreUrl");
- String user = transactionProps.getProperty("recoveryStoreUser");
- String password = String.valueOf(transactionProps.get("recoveryStorePassword"));
- String dataSourceClass = transactionProps.getProperty("recoveryStoreDataSource");
- if (null != url && null != user && null != password && null != dataSourceClass) {
- appendJdbcStoreConfiguration(url, user, password, dataSourceClass, transactionProps, config);
- }
- }
-
- private void appendJdbcStoreConfiguration(final String jdbcUrl, final String user, final String password, final String dataSourceClassName,
- final Properties transactionProps, final NarayanaConfiguration config) {
- String jdbcAccessPatten = DynamicDataSourceJDBCAccess.class.getName() + ";ClassName=%s;URL=%s;User=%s;Password=%s";
- String jdbcAccess = String.format(jdbcAccessPatten, dataSourceClassName, jdbcUrl, user, password);
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.objectStoreType", JDBCStore.class.getName()));
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.jdbcAccess", jdbcAccess));
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.tablePrefix", "Action"));
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.createTable", transactionProps.getProperty("createTable", Boolean.TRUE.toString())));
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.dropTable", Boolean.FALSE.toString()));
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.stateStore.objectStoreType", JDBCStore.class.getName()));
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.stateStore.jdbcAccess", jdbcAccess));
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.stateStore.tablePrefix", "stateStore"));
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.stateStore.createTable", transactionProps.getProperty("stateStoreCreateTable", Boolean.TRUE.toString())));
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.stateStore.dropTable", Boolean.FALSE.toString()));
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.communicationStore.objectStoreType", JDBCStore.class.getName()));
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.communicationStore.jdbcAccess", jdbcAccess));
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.communicationStore.tablePrefix", "Communication"));
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.communicationStore.createTable", transactionProps.getProperty("communicationStoreCreateTable", Boolean.TRUE.toString())));
- config.getEntries().add(createEntry("ObjectStoreEnvironmentBean.communicationStore.dropTable", Boolean.FALSE.toString()));
- }
-
- @Override
- public Properties getTransactionProps(final Properties originTransactionProps, final DatabaseConfiguration databaseConfig, final String modeType) {
- Properties result = new Properties();
- if (!originTransactionProps.isEmpty()) {
- generateUserDefinedJdbcStoreConfiguration(originTransactionProps, result);
- } else if ("Cluster".equals(modeType)) {
- generateDefaultJdbcStoreConfiguration(databaseConfig, result);
- }
- return result;
- }
-
- private void generateUserDefinedJdbcStoreConfiguration(final Properties originTransactionProps, final Properties props) {
- String url = originTransactionProps.getProperty("recoveryStoreUrl");
- String user = originTransactionProps.getProperty("recoveryStoreUser");
- String password = String.valueOf(originTransactionProps.get("recoveryStorePassword"));
- String dataSourceClass = originTransactionProps.getProperty("recoveryStoreDataSource");
- generateTransactionProps(url, user, password, dataSourceClass, props);
- }
-
- private void generateDefaultJdbcStoreConfiguration(final DatabaseConfiguration databaseConfig, final Properties props) {
- Map<String, DataSource> datasourceMap = databaseConfig.getDataSources();
- Optional<DataSource> dataSource = datasourceMap.values().stream().findFirst();
- if (!dataSource.isPresent()) {
- return;
- }
- DataSourcePoolMetaDataReflection dataSourcePoolMetaDataReflection = new DataSourcePoolMetaDataReflection(dataSource.get(),
- DataSourcePoolMetaDataFactory.findInstance(dataSource.get().getClass().getName()).map(DataSourcePoolMetaData::getFieldMetaData).orElseGet(DefaultDataSourcePoolFieldMetaData::new));
- String jdbcUrl = dataSourcePoolMetaDataReflection.getJdbcUrl();
- int endIndex = jdbcUrl.indexOf("?");
- jdbcUrl = -1 == endIndex ? jdbcUrl : jdbcUrl.substring(0, endIndex);
- String username = dataSourcePoolMetaDataReflection.getUsername();
- String password = dataSourcePoolMetaDataReflection.getPassword();
- String dataSourceClassName = getDataSourceClassNameByJdbcUrl(jdbcUrl);
- generateTransactionProps(jdbcUrl, username, password, dataSourceClassName, props);
- }
-
- private String getDataSourceClassNameByJdbcUrl(final String jdbcUrl) {
- DatabaseType type = DatabaseTypeEngine.getDatabaseType(jdbcUrl);
- if (type instanceof MySQLDatabaseType || type instanceof OpenGaussDatabaseType || type instanceof PostgreSQLDatabaseType) {
- if (type.getDataSourceClassName().isPresent()) {
- return type.getDataSourceClassName().get();
- }
- }
- throw new UnsupportedOperationException(String.format("Cannot support database type: `%s` as narayana recovery store", type));
- }
-
- private void generateTransactionProps(final String recoveryStoreUrl, final String recoveryStoreUser, final String recoveryStorePassword,
- final String recoveryStoreDataSource, final Properties props) {
- props.setProperty("recoveryStoreUrl", recoveryStoreUrl);
- props.setProperty("recoveryStoreUser", recoveryStoreUser);
- props.setProperty("recoveryStorePassword", recoveryStorePassword);
- props.setProperty("recoveryStoreDataSource", recoveryStoreDataSource);
- }
-
- @Override
- public String getType() {
- return "Narayana";
- }
-}
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/main/resources/META-INF/services/org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGenerator b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transac [...]
deleted file mode 100644
index 9b4e5e61514..00000000000
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/main/resources/META-INF/services/org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGenerator
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-org.apache.shardingsphere.transaction.xa.narayana.config.NarayanaConfigurationFileGenerator
diff --git a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/test/java/org/apache/shardingsphere/transaction/xa/narayana/config/NarayanaConfigurationFileGeneratorTest.java b/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transacti [...]
deleted file mode 100644
index e506d313dc5..00000000000
--- a/shardingsphere-kernel/shardingsphere-transaction/shardingsphere-transaction-type/shardingsphere-transaction-xa/shardingsphere-transaction-xa-provider/shardingsphere-transaction-xa-narayana/src/test/java/org/apache/shardingsphere/transaction/xa/narayana/config/NarayanaConfigurationFileGeneratorTest.java
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * 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.shardingsphere.transaction.xa.narayana.config;
-
-import com.arjuna.ats.internal.arjuna.objectstore.jdbc.JDBCStore;
-import com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule;
-import com.arjuna.ats.internal.arjuna.recovery.ExpiredTransactionStatusManagerScanner;
-import com.arjuna.ats.internal.jta.recovery.arjunacore.JTAActionStatusServiceXAResourceOrphanFilter;
-import com.arjuna.ats.internal.jta.recovery.arjunacore.JTANodeNameXAResourceOrphanFilter;
-import com.arjuna.ats.internal.jta.recovery.arjunacore.JTATransactionLogXAResourceOrphanFilter;
-import com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule;
-import org.apache.shardingsphere.infra.instance.InstanceContext;
-import org.apache.shardingsphere.transaction.config.TransactionRuleConfiguration;
-import org.apache.shardingsphere.transaction.rule.TransactionRule;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.Optional;
-import java.util.Properties;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public final class NarayanaConfigurationFileGeneratorTest {
-
- private final NarayanaConfigurationFileGenerator narayanaConfigFileGenerator = new NarayanaConfigurationFileGenerator();
-
- private TransactionRule transactionRule;
-
- private String jdbcAccess;
-
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private InstanceContext instanceContext;
-
- @Before
- public void setUp() {
- transactionRule = new TransactionRule(new TransactionRuleConfiguration("XA", "Narayana", createProperties()), Collections.emptyMap());
- jdbcAccess = "com.arjuna.ats.internal.arjuna.objectstore.jdbc.accessors.DynamicDataSourceJDBCAccess;ClassName=com.mysql.jdbc.jdbc2.optional.MysqlDataSource;"
- + "URL=jdbc:mysql://127.0.0.1:3306/jbossts;User=root;Password=12345678";
- when(instanceContext.getInstance().getInstanceDefinition().getInstanceId()).thenReturn("127.0.0.1@3307");
- when(instanceContext.getInstance().getXaRecoveryIds()).thenReturn(Collections.singletonList("127.0.0.1@3307"));
- }
-
- private Properties createProperties() {
- Properties result = new Properties();
- result.setProperty("recoveryStoreUrl", "jdbc:mysql://127.0.0.1:3306/jbossts");
- result.setProperty("recoveryStoreDataSource", "com.mysql.jdbc.jdbc2.optional.MysqlDataSource");
- result.setProperty("recoveryStoreUser", "root");
- result.setProperty("recoveryStorePassword", "12345678");
- return result;
- }
-
- @Test
- public void assertNarayanaConfigurationFileGenerator() throws JAXBException, FileNotFoundException {
- narayanaConfigFileGenerator.generateFile(transactionRule.getProps(), instanceContext);
- JAXBContext jaxbContext = JAXBContext.newInstance(NarayanaConfiguration.class);
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- InputStream inputStream = new FileInputStream(new File(ClassLoader.getSystemResource("").getPath(), "jbossts-properties.xml"));
- NarayanaConfiguration narayanaConfig = (NarayanaConfiguration) unmarshaller.unmarshal(inputStream);
- assertThat(narayanaConfig.getEntries().size(), is(32));
- assertCommitOnePhase(narayanaConfig);
- assertTransactionSync(narayanaConfig);
- assertNodeIdentifier(narayanaConfig);
- assertXaRecoveryNodes(narayanaConfig);
- assertXaResourceOrphanFilterClassNames(narayanaConfig);
- assertSocketProcessIdPort(narayanaConfig);
- assertRecoveryModuleClassNames(narayanaConfig);
- assertExpiryScannerClassNames(narayanaConfig);
- assertRecoveryPort(narayanaConfig);
- assertTransactionStatusManagerPort(narayanaConfig);
- assertRecoveryListener(narayanaConfig);
- assertRecoveryBackoffPeriod(narayanaConfig);
- assertDefaultTimeout(narayanaConfig);
- assertExpiryScanInterval(narayanaConfig);
- assertPeriodicRecoveryPeriod(narayanaConfig);
- assertObjectStoreType(narayanaConfig);
- assertJdbcAccess(narayanaConfig);
- assertTablePrefix(narayanaConfig);
- assertDropTable(narayanaConfig);
- assertCreateTable(narayanaConfig);
- assertStateStoreJdbcAccess(narayanaConfig);
- assertStateStoreObjectStoreType(narayanaConfig);
- assertStateStoreTablePrefix(narayanaConfig);
- assertStateStoreDropTable(narayanaConfig);
- assertStateStoreCreateTable(narayanaConfig);
- assertCommunicationStoreObjectStoreType(narayanaConfig);
- assertCommunicationStoreJdbcAccess(narayanaConfig);
- assertCommunicationStoreTablePrefix(narayanaConfig);
- assertCommunicationStoreCreateTable(narayanaConfig);
- assertCommunicationStoreDropTable(narayanaConfig);
- }
-
- private void assertCommitOnePhase(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "CoordinatorEnvironmentBean.commitOnePhase".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(Boolean.TRUE.toString()));
- }
-
- private void assertTransactionSync(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.transactionSync".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(Boolean.FALSE.toString()));
- }
-
- private void assertNodeIdentifier(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "CoreEnvironmentBean.nodeIdentifier".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains("127.0.0.1@3307"));
- }
-
- private void assertXaRecoveryNodes(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "JTAEnvironmentBean.xaRecoveryNodes".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains("127.0.0.1@3307"));
- }
-
- private void assertXaResourceOrphanFilterClassNames(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "JTAEnvironmentBean.xaResourceOrphanFilterClassNames".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(3));
- assertTrue(entry.get().getValue().contains(JTATransactionLogXAResourceOrphanFilter.class.getName()));
- assertTrue(entry.get().getValue().contains(JTANodeNameXAResourceOrphanFilter.class.getName()));
- assertTrue(entry.get().getValue().contains(JTAActionStatusServiceXAResourceOrphanFilter.class.getName()));
- }
-
- private void assertSocketProcessIdPort(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "CoreEnvironmentBean.socketProcessIdPort".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains("0"));
- }
-
- private void assertRecoveryModuleClassNames(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "RecoveryEnvironmentBean.recoveryModuleClassNames".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(2));
- assertTrue(entry.get().getValue().contains(AtomicActionRecoveryModule.class.getName()));
- assertTrue(entry.get().getValue().contains(XARecoveryModule.class.getName()));
- }
-
- private void assertExpiryScannerClassNames(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "RecoveryEnvironmentBean.expiryScannerClassNames".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(ExpiredTransactionStatusManagerScanner.class.getName()));
- }
-
- private void assertRecoveryPort(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "RecoveryEnvironmentBean.recoveryPort".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains("4712"));
- }
-
- private void assertTransactionStatusManagerPort(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "RecoveryEnvironmentBean.transactionStatusManagerPort".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains("0"));
- }
-
- private void assertRecoveryListener(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "RecoveryEnvironmentBean.recoveryListener".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(Boolean.FALSE.toString()));
- }
-
- private void assertRecoveryBackoffPeriod(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "RecoveryEnvironmentBean.recoveryBackoffPeriod".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains("1"));
- }
-
- private void assertDefaultTimeout(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "CoordinatorEnvironmentBean.defaultTimeout".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains("180"));
- }
-
- private void assertExpiryScanInterval(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "RecoveryEnvironmentBean.expiryScanInterval".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains("12"));
- }
-
- private void assertPeriodicRecoveryPeriod(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "RecoveryEnvironmentBean.periodicRecoveryPeriod".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains("120"));
- }
-
- private void assertObjectStoreType(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.objectStoreType".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(JDBCStore.class.getName()));
- }
-
- private void assertJdbcAccess(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.jdbcAccess".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(jdbcAccess));
- }
-
- private void assertTablePrefix(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.tablePrefix".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains("Action"));
- }
-
- private void assertCreateTable(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.createTable".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(Boolean.TRUE.toString()));
- }
-
- private void assertDropTable(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.dropTable".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(Boolean.FALSE.toString()));
- }
-
- private void assertStateStoreJdbcAccess(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.stateStore.jdbcAccess".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(jdbcAccess));
- }
-
- private void assertStateStoreObjectStoreType(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.stateStore.objectStoreType".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(JDBCStore.class.getName()));
- }
-
- private void assertStateStoreTablePrefix(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.stateStore.tablePrefix".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains("stateStore"));
- }
-
- private void assertStateStoreCreateTable(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.stateStore.createTable".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(Boolean.TRUE.toString()));
- }
-
- private void assertStateStoreDropTable(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.stateStore.dropTable".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(Boolean.FALSE.toString()));
- }
-
- private void assertCommunicationStoreObjectStoreType(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.communicationStore.objectStoreType".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(JDBCStore.class.getName()));
- }
-
- private void assertCommunicationStoreJdbcAccess(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.communicationStore.jdbcAccess".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(jdbcAccess));
- }
-
- private void assertCommunicationStoreTablePrefix(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.communicationStore.tablePrefix".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains("Communication"));
- }
-
- private void assertCommunicationStoreCreateTable(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.communicationStore.createTable".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(Boolean.TRUE.toString()));
- }
-
- private void assertCommunicationStoreDropTable(final NarayanaConfiguration narayanaConfig) {
- Optional<NarayanaConfigEntry> entry = narayanaConfig.getEntries().stream().filter(each -> "ObjectStoreEnvironmentBean.communicationStore.dropTable".equals(each.getKey())).findFirst();
- assertTrue(entry.isPresent());
- assertThat(entry.get().getValue().size(), is(1));
- assertTrue(entry.get().getValue().contains(Boolean.FALSE.toString()));
- }
-}
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
index 41a6c88b8f4..d52d34a69d0 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/ContextManager.java
@@ -52,9 +52,6 @@ import org.apache.shardingsphere.infra.rule.identifier.type.ResourceHeldRule;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.mode.metadata.MetaDataContextsBuilder;
import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
-import org.apache.shardingsphere.transaction.rule.TransactionRule;
-import org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGenerator;
-import org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGeneratorFactory;
import javax.sql.DataSource;
import java.sql.SQLException;
@@ -562,7 +559,6 @@ public final class ContextManager implements AutoCloseable {
dataSourceMap.putAll(DataSourcePoolCreator.create(addedDataSourceProps));
DatabaseConfiguration databaseConfig = new DataSourceProvidedDatabaseConfiguration(dataSourceMap, originalDatabase.getRuleMetaData().getConfigurations());
Optional<MetaDataPersistService> metaDataPersistService = metaDataContexts.getPersistService();
- metaDataPersistService.ifPresent(optional -> persistTransactionConfiguration(databaseConfig, optional));
MetaDataContextsBuilder builder = new MetaDataContextsBuilder(Collections.singletonMap(originalDatabase.getName(), databaseConfig),
metaDataContexts.getMetaData().getGlobalRuleMetaData().getConfigurations(), metaDataContexts.getMetaData().getProps());
MetaDataContexts result = builder.build(metaDataContexts.getPersistService().orElse(null));
@@ -570,13 +566,6 @@ public final class ContextManager implements AutoCloseable {
return result;
}
- private void persistTransactionConfiguration(final DatabaseConfiguration databaseConfig, final MetaDataPersistService metaDataPersistService) {
- TransactionRule transactionRule = metaDataContexts.getMetaData().getGlobalRuleMetaData().getSingleRule(TransactionRule.class);
- Optional<TransactionConfigurationFileGenerator> fileGenerator = TransactionConfigurationFileGeneratorFactory.findInstance(transactionRule.getProviderType());
- fileGenerator.ifPresent(optional -> metaDataPersistService.persistTransactionRule(
- optional.getTransactionProps(transactionRule.getProps(), databaseConfig, instanceContext.getModeConfiguration().getType()), true));
- }
-
private MetaDataContexts buildChangedMetaDataContext(final ShardingSphereDatabase originalDatabase, final Collection<RuleConfiguration> ruleConfigs) throws SQLException {
MetaDataContextsBuilder builder = new MetaDataContextsBuilder(
Collections.singletonMap(originalDatabase.getName(), new DataSourceProvidedDatabaseConfiguration(originalDatabase.getResource().getDataSources(), ruleConfigs)),
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/node/ComputeNode.java b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/node/ComputeNode.java
index c8292d1c603..65a2c6ba34d 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/node/ComputeNode.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/node/ComputeNode.java
@@ -41,8 +41,6 @@ public final class ComputeNode {
private static final String WORKER_ID = "worker_id";
- private static final String XA_RECOVERY_ID_NODE = "xa_recovery_id";
-
/**
* Get online compute node path.
*
@@ -103,26 +101,6 @@ public final class ComputeNode {
return String.join("/", "", ROOT_NODE, COMPUTE_NODE, LABELS_NODE, instanceId);
}
- /**
- * Get xa recovery id node path.
- *
- * @return xa recovery id node path
- */
- public static String getXaRecoveryIdNodePath() {
- return String.join("/", "", ROOT_NODE, COMPUTE_NODE, XA_RECOVERY_ID_NODE);
- }
-
- /**
- * Get compute node xa recovery id path.
- *
- * @param xaRecoveryId recovery id
- * @param instanceId instance id
- * @return path of compute node xa recovery id
- */
- public static String getInstanceXaRecoveryIdNodePath(final String xaRecoveryId, final String instanceId) {
- return String.join("/", "", ROOT_NODE, COMPUTE_NODE, XA_RECOVERY_ID_NODE, xaRecoveryId, instanceId);
- }
-
/**
* Get compute node path.
*
diff --git a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/node/ComputeNodeTest.java b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/node/ComputeNodeTest.java
index e35111d612c..543833d4272 100644
--- a/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/node/ComputeNodeTest.java
+++ b/shardingsphere-mode/shardingsphere-mode-core/src/test/java/org/apache/shardingsphere/mode/metadata/persist/node/ComputeNodeTest.java
@@ -72,16 +72,6 @@ public final class ComputeNodeTest {
assertThat(ComputeNode.getInstanceStatusNodePath("foo_instance"), is("/nodes/compute_nodes/status/foo_instance"));
}
- @Test
- public void assertGetInstanceXaRecoveryIdNodePath() {
- assertThat(ComputeNode.getInstanceXaRecoveryIdNodePath("foo_xa_recovery_id", "foo_instance"), is("/nodes/compute_nodes/xa_recovery_id/foo_xa_recovery_id/foo_instance"));
- }
-
- @Test
- public void assertGetXaRecoveryIdNodePath() {
- assertThat(ComputeNode.getXaRecoveryIdNodePath(), is("/nodes/compute_nodes/xa_recovery_id"));
- }
-
@Test
public void assertGetComputeNodePath() {
assertThat(ComputeNode.getComputeNodePath(), is("/nodes/compute_nodes"));
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
index 50b100ce920..2a3d5da186e 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/ClusterContextManagerBuilder.java
@@ -26,7 +26,6 @@ import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
import org.apache.shardingsphere.infra.instance.InstanceContext;
import org.apache.shardingsphere.infra.instance.definition.InstanceDefinition;
import org.apache.shardingsphere.infra.instance.definition.InstanceType;
-import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.manager.ContextManagerBuilder;
import org.apache.shardingsphere.mode.manager.ContextManagerBuilderParameter;
@@ -41,17 +40,12 @@ import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositor
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryFactory;
import org.apache.shardingsphere.schedule.core.api.ModeScheduleContextFactory;
-import org.apache.shardingsphere.transaction.rule.TransactionRule;
-import org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGenerator;
-import org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGeneratorFactory;
import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import java.util.Optional;
-import java.util.Properties;
/**
* Cluster context manager builder.
@@ -67,9 +61,7 @@ public final class ClusterContextManagerBuilder implements ContextManagerBuilder
RegistryCenter registryCenter = new RegistryCenter(repository);
MetaDataContexts metaDataContexts = createMetaDataContextsBuilder(metaDataPersistService, parameter).build(metaDataPersistService);
persistMetaData(metaDataContexts);
- Properties transactionProps = getTransactionProperties(metaDataContexts);
- persistTransactionConfiguration(metaDataPersistService, transactionProps);
- ContextManager result = createContextManager(repository, registryCenter, parameter.getInstanceDefinition(), metaDataContexts, transactionProps, parameter.getModeConfig());
+ ContextManager result = createContextManager(repository, registryCenter, parameter.getInstanceDefinition(), metaDataContexts, parameter.getModeConfig());
registerOnline(metaDataPersistService, parameter, result, registryCenter);
return result;
}
@@ -91,29 +83,6 @@ public final class ClusterContextManagerBuilder implements ContextManagerBuilder
return new MetaDataContextsBuilder(databaseConfigMap, globalRuleConfigs, props);
}
- private Properties getTransactionProperties(final MetaDataContexts metaDataContexts) {
- Optional<String> databaseName = metaDataContexts.getMetaData().getDatabases().keySet().stream().findFirst();
- TransactionRule transactionRule = metaDataContexts.getMetaData().getGlobalRuleMetaData().getSingleRule(TransactionRule.class);
- Optional<TransactionConfigurationFileGenerator> fileGenerator = TransactionConfigurationFileGeneratorFactory.findInstance(transactionRule.getProviderType());
- if (!databaseName.isPresent() || !fileGenerator.isPresent()) {
- return transactionRule.getProps();
- }
- ShardingSphereDatabase database = metaDataContexts.getMetaData().getDatabases().get(databaseName.get());
- Properties result = fileGenerator.get().getTransactionProps(
- transactionRule.getProps(), new DataSourceProvidedDatabaseConfiguration(database.getResource().getDataSources(), database.getRuleMetaData().getConfigurations()), getType());
- transactionRule.getProps().clear();
- transactionRule.getProps().putAll(result);
- transactionRule.getProps().clear();
- transactionRule.getProps().putAll(result);
- return result;
- }
-
- private void persistTransactionConfiguration(final MetaDataPersistService metaDataPersistService, final Properties transactionProps) {
- if (!transactionProps.isEmpty()) {
- metaDataPersistService.persistTransactionRule(transactionProps, true);
- }
- }
-
private Map<String, DatabaseConfiguration> getDatabaseConfigMap(final Collection<String> databaseNames, final MetaDataPersistService metaDataPersistService,
final ContextManagerBuilderParameter parameter) {
Map<String, DatabaseConfiguration> result = new HashMap<>(databaseNames.size(), 1);
@@ -135,28 +104,16 @@ public final class ClusterContextManagerBuilder implements ContextManagerBuilder
private ContextManager createContextManager(final ClusterPersistRepository repository, final RegistryCenter registryCenter,
final InstanceDefinition instanceDefinition, final MetaDataContexts metaDataContexts,
- final Properties transactionProps, final ModeConfiguration modeConfig) {
+ final ModeConfiguration modeConfig) {
ClusterWorkerIdGenerator clusterWorkerIdGenerator = new ClusterWorkerIdGenerator(repository, registryCenter, instanceDefinition);
DistributedLockContext distributedLockContext = new DistributedLockContext(repository);
InstanceContext instanceContext = new InstanceContext(new ComputeNodeInstance(instanceDefinition), clusterWorkerIdGenerator, modeConfig, distributedLockContext);
repository.watchSessionConnection(instanceContext);
- generateTransactionConfigurationFile(instanceContext, metaDataContexts, transactionProps);
return new ContextManager(metaDataContexts, instanceContext);
}
- private void generateTransactionConfigurationFile(final InstanceContext instanceContext, final MetaDataContexts metaDataContexts, final Properties transactionProps) {
- Optional<TransactionRule> transactionRule = metaDataContexts.getMetaData().getGlobalRuleMetaData().getRules()
- .stream().filter(each -> each instanceof TransactionRule).map(each -> (TransactionRule) each).findFirst();
- if (transactionRule.isPresent()) {
- Optional<TransactionConfigurationFileGenerator> fileGenerator = TransactionConfigurationFileGeneratorFactory.findInstance(transactionRule.get().getProviderType());
- fileGenerator.ifPresent(optional -> optional.generateFile(transactionProps, instanceContext));
- }
- }
-
private void registerOnline(final MetaDataPersistService metaDataPersistService, final ContextManagerBuilderParameter parameter, final ContextManager contextManager,
final RegistryCenter registryCenter) {
- String instanceId = contextManager.getInstanceContext().getInstance().getCurrentInstanceId();
- contextManager.getInstanceContext().getInstance().getXaRecoveryIds().add(instanceId);
contextManager.getInstanceContext().getInstance().setLabels(parameter.getLabels());
contextManager.getInstanceContext().getComputeNodeInstances().addAll(registryCenter.getComputeNodeStatusService().loadAllComputeNodeInstances());
new ClusterContextManagerCoordinator(metaDataPersistService, contextManager, registryCenter);
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinator.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinator.java
index b7f3eb63698..dba5ad50b6b 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinator.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinator.java
@@ -48,8 +48,6 @@ import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.statu
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.ShowProcessListUnitCompleteEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.StateEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.WorkerIdEvent;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.XaRecoveryIdAddedEvent;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.XaRecoveryIdDeletedEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.event.PrimaryStateChangedEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.event.StorageNodeChangedEvent;
import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
@@ -58,7 +56,6 @@ import org.apache.shardingsphere.mode.metadata.storage.StorageNodeDataSource;
import org.apache.shardingsphere.mode.metadata.storage.StorageNodeStatus;
import org.apache.shardingsphere.mode.metadata.storage.event.PrimaryDataSourceChangedEvent;
import org.apache.shardingsphere.mode.metadata.storage.event.StorageNodeDataSourceChangedEvent;
-import org.apache.shardingsphere.transaction.rule.TransactionRule;
import java.sql.SQLException;
import java.util.Collection;
@@ -244,36 +241,6 @@ public final class ClusterContextManagerCoordinator {
contextManager.getInstanceContext().updateLabel(event.getInstanceId(), event.getLabels());
}
- /**
- * Renew instance xa recovery id event.
- *
- * @param event xa recovery id added event
- */
- @Subscribe
- public synchronized void renew(final XaRecoveryIdAddedEvent event) {
- if (contextManager.getInstanceContext().addXaRecoveryId(event.getInstanceId(), event.getXaRecoveryId())) {
- TransactionRule transactionRule = contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getSingleRule(TransactionRule.class);
- for (String each : transactionRule.getResources().keySet()) {
- transactionRule.addResource(contextManager.getMetaDataContexts().getMetaData().getDatabases().get(each));
- }
- }
- }
-
- /**
- * Renew instance xa recovery id event.
- *
- * @param event xa recovery id deleted event
- */
- @Subscribe
- public synchronized void renew(final XaRecoveryIdDeletedEvent event) {
- if (contextManager.getInstanceContext().deleteXaRecoveryId(event.getInstanceId(), event.getXaRecoveryId())) {
- TransactionRule transactionRule = contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getSingleRule(TransactionRule.class);
- for (String each : transactionRule.getResources().keySet()) {
- transactionRule.addResource(contextManager.getMetaDataContexts().getMetaData().getDatabases().get(each));
- }
- }
- }
-
/**
* Renew instance list.
*
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java
index 30b027b300a..e8b3d0b0363 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/RegistryCenter.java
@@ -75,7 +75,6 @@ public final class RegistryCenter {
public void onlineInstance(final ComputeNodeInstance computeNodeInstance) {
computeNodeStatusService.registerOnline(computeNodeInstance.getInstanceDefinition());
computeNodeStatusService.persistInstanceLabels(computeNodeInstance.getCurrentInstanceId(), computeNodeInstance.getLabels());
- computeNodeStatusService.persistInstanceXaRecoveryId(computeNodeInstance.getCurrentInstanceId(), computeNodeInstance.getXaRecoveryIds());
listenerFactory.watchListeners();
}
}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/event/XaRecoveryIdAddedEvent.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/event/XaRecoveryIdAddedEvent.java
deleted file mode 100644
index fe64ec5d9ff..00000000000
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/event/XaRecoveryIdAddedEvent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.GovernanceEvent;
-
-/**
- * Xa recovery id added event.
- */
-@RequiredArgsConstructor
-@Getter
-public final class XaRecoveryIdAddedEvent implements GovernanceEvent {
-
- private final String instanceId;
-
- private final String xaRecoveryId;
-}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/event/XaRecoveryIdChangedEvent.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/event/XaRecoveryIdChangedEvent.java
deleted file mode 100644
index f1f83b57a6c..00000000000
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/event/XaRecoveryIdChangedEvent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-
-import java.util.Collection;
-
-/**
- * Xa recovery id changed event.
- */
-@RequiredArgsConstructor
-@Getter
-public final class XaRecoveryIdChangedEvent {
-
- private final String instanceId;
-
- private final Collection<String> xaRecoveryIds;
-}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/event/XaRecoveryIdDeletedEvent.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/event/XaRecoveryIdDeletedEvent.java
deleted file mode 100644
index e52ecb4e4d4..00000000000
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/event/XaRecoveryIdDeletedEvent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.GovernanceEvent;
-
-/**
- * Xa recovery id deleted event.
- */
-@RequiredArgsConstructor
-@Getter
-public final class XaRecoveryIdDeletedEvent implements GovernanceEvent {
-
- private final String instanceId;
-
- private final String xaRecoveryId;
-}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusService.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusService.java
index 7b4caba570f..59893674fe4 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusService.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusService.java
@@ -30,8 +30,6 @@ import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositor
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
import java.util.Optional;
/**
@@ -75,24 +73,6 @@ public final class ComputeNodeStatusService {
repository.persistEphemeral(ComputeNode.getInstanceWorkerIdNodePath(instanceId), String.valueOf(workerId));
}
- /**
- * Persist instance xa recovery id.
- *
- * @param instanceId instance id
- * @param xaRecoveryIds collection of xa recovery id
- */
- public void persistInstanceXaRecoveryId(final String instanceId, final Collection<String> xaRecoveryIds) {
- Collection<String> originalXaRecoveryIds = loadXaRecoveryIds(instanceId);
- if (originalXaRecoveryIds.isEmpty()) {
- xaRecoveryIds.forEach(each -> repository.persistEphemeral(ComputeNode.getInstanceXaRecoveryIdNodePath(each, instanceId), ""));
- } else {
- originalXaRecoveryIds.stream().filter(each -> !xaRecoveryIds.contains(each)).forEach(each -> repository.delete(ComputeNode
- .getInstanceXaRecoveryIdNodePath(each, instanceId)));
- xaRecoveryIds.stream().filter(each -> !originalXaRecoveryIds.contains(each)).forEach(each -> repository.persistEphemeral(ComputeNode
- .getInstanceXaRecoveryIdNodePath(each, instanceId), ""));
- }
- }
-
/**
* Load instance labels.
*
@@ -133,23 +113,6 @@ public final class ComputeNodeStatusService {
return Optional.empty();
}
- /**
- * Load instance xa recovery id list.
- *
- * @param instanceId instance id
- * @return collection of xa recovery id
- */
- public Collection<String> loadXaRecoveryIds(final String instanceId) {
- Collection<String> result = new LinkedList<>();
- List<String> xaRecoveryIds = repository.getChildrenKeys(ComputeNode.getXaRecoveryIdNodePath());
- for (String xaRecoveryId : xaRecoveryIds) {
- if (repository.getChildrenKeys(String.join("/", ComputeNode.getXaRecoveryIdNodePath(), xaRecoveryId)).contains(instanceId)) {
- result.add(xaRecoveryId);
- }
- }
- return result;
- }
-
/**
* Load all compute node instances.
*
@@ -177,7 +140,6 @@ public final class ComputeNodeStatusService {
ComputeNodeInstance result = new ComputeNodeInstance(instanceDefinition);
result.setLabels(loadInstanceLabels(instanceDefinition.getInstanceId()));
result.switchState(loadInstanceStatus(instanceDefinition.getInstanceId()));
- result.getXaRecoveryIds().addAll(loadXaRecoveryIds(instanceDefinition.getInstanceId()));
loadInstanceWorkerId(instanceDefinition.getInstanceId()).ifPresent(result::setWorkerId);
return result;
}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatusSubscriber.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatus [...]
index ffac67c8ac6..73705109f70 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatusSubscriber.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/subscriber/ComputeNodeStatusSubscriber.java
@@ -25,7 +25,6 @@ import org.apache.shardingsphere.mode.manager.cluster.coordinator.RegistryCenter
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.ComputeNodeStatus;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.ComputeNodeStatusChangedEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.LabelsChangedEvent;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.XaRecoveryIdChangedEvent;
import org.apache.shardingsphere.mode.metadata.persist.node.ComputeNode;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
@@ -66,16 +65,6 @@ public final class ComputeNodeStatusSubscriber {
repository.persistEphemeral(computeStatusNodePath, YamlEngine.marshal(status));
}
- /**
- * Update compute node xa recovery id.
- *
- * @param event xa recovery id changed event
- */
- @Subscribe
- public void update(final XaRecoveryIdChangedEvent event) {
- registryCenter.getComputeNodeStatusService().persistInstanceXaRecoveryId(event.getInstanceId(), event.getXaRecoveryIds());
- }
-
/**
* Update compute node labels.
*
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcher.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChan [...]
index 42a9ba614e5..9a473a2bb2e 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcher.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcher.java
@@ -30,8 +30,6 @@ import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.statu
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.ShowProcessListUnitCompleteEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.StateEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.WorkerIdEvent;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.XaRecoveryIdAddedEvent;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.XaRecoveryIdDeletedEvent;
import org.apache.shardingsphere.mode.metadata.persist.node.ComputeNode;
import org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEvent;
import org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEvent.Type;
@@ -75,8 +73,6 @@ public final class ComputeNodeStateChangedWatcher implements GovernanceWatcher<G
return createInstanceEvent(event);
} else if (event.getKey().startsWith(ComputeNode.getProcessTriggerNodePatch())) {
return createShowProcessListTriggerEvent(event);
- } else if (event.getKey().startsWith(ComputeNode.getXaRecoveryIdNodePath())) {
- return createXaRecoveryIdEvent(event);
}
return Optional.empty();
}
@@ -120,16 +116,4 @@ public final class ComputeNodeStateChangedWatcher implements GovernanceWatcher<G
private InstanceType getInstanceType(final String instanceType) {
return InstanceType.PROXY.name().equalsIgnoreCase(instanceType) ? InstanceType.PROXY : InstanceType.JDBC;
}
-
- private Optional<GovernanceEvent> createXaRecoveryIdEvent(final DataChangedEvent event) {
- Matcher matcher = Pattern.compile(ComputeNode.getXaRecoveryIdNodePath() + "/([\\S]+)/([\\S]+)$", Pattern.CASE_INSENSITIVE).matcher(event.getKey());
- if (matcher.find()) {
- if (Type.ADDED == event.getType()) {
- return Optional.of(new XaRecoveryIdAddedEvent(matcher.group(2), matcher.group(1)));
- } else if (Type.DELETED == event.getType()) {
- return Optional.of(new XaRecoveryIdDeletedEvent(matcher.group(2), matcher.group(1)));
- }
- }
- return Optional.empty();
- }
}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinatorTest.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinatorTest.java
index 16873518571..f8839740810 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinatorTest.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/ClusterContextManagerCoordinatorTest.java
@@ -67,7 +67,6 @@ import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.statu
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.ShowProcessListUnitCompleteEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.StateEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.WorkerIdEvent;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.XaRecoveryIdAddedEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.event.StorageNodeChangedEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.storage.event.PrimaryStateChangedEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.util.ReflectionUtil;
@@ -311,12 +310,6 @@ public final class ClusterContextManagerCoordinatorTest {
assertThat(contextManager.getInstanceContext().getInstance().getLabels(), is(labels));
}
- @Test
- public void assertRenewXaRecoveryIdEvent() {
- coordinator.renew(new XaRecoveryIdAddedEvent(contextManager.getInstanceContext().getInstance().getInstanceDefinition().getInstanceId(), "foo_xa_recovery_id"));
- assertTrue(contextManager.getInstanceContext().getInstance().getXaRecoveryIds().contains("foo_xa_recovery_id"));
- }
-
@Test
public void assertRenewInstanceOfflineEvent() {
coordinator.renew(new InstanceOfflineEvent(contextManager.getInstanceContext().getInstance().getInstanceDefinition()));
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusServiceTest.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusServi [...]
index 88909d4e59b..a0ca06c1641 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusServiceTest.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/service/ComputeNodeStatusServiceTest.java
@@ -71,15 +71,6 @@ public final class ComputeNodeStatusServiceTest {
verify(repository).persistEphemeral(ComputeNode.getInstanceWorkerIdNodePath(instanceId), String.valueOf(100L));
}
- @Test
- public void assertPersistInstanceXaRecoveryId() {
- InstanceDefinition instanceDefinition = new InstanceDefinition(InstanceType.PROXY, 3307, "foo_instance_id");
- final String instanceId = instanceDefinition.getInstanceId();
- new ComputeNodeStatusService(repository).persistInstanceXaRecoveryId(instanceId, Collections.singleton(instanceId));
- verify(repository).getChildrenKeys(ComputeNode.getXaRecoveryIdNodePath());
- verify(repository).persistEphemeral(ComputeNode.getInstanceXaRecoveryIdNodePath(instanceId, instanceId), "");
- }
-
@Test
public void assertLoadInstanceLabels() {
InstanceDefinition instanceDefinition = new InstanceDefinition(InstanceType.PROXY, 3307, "foo_instance_id");
@@ -104,15 +95,6 @@ public final class ComputeNodeStatusServiceTest {
verify(repository).get(ComputeNode.getInstanceWorkerIdNodePath(instanceId));
}
- @Test
- public void assertLoadInstanceXaRecoveryId() {
- InstanceDefinition instanceDefinition = new InstanceDefinition(InstanceType.PROXY, 3307, "foo_instance_id");
- final String instanceId = instanceDefinition.getInstanceId();
- new ComputeNodeStatusService(repository).loadXaRecoveryIds(instanceId);
- verify(repository).getChildrenKeys(ComputeNode.getXaRecoveryIdNodePath());
-
- }
-
@Test
public void assertLoadAllComputeNodeInstances() {
when(repository.getChildrenKeys("/nodes/compute_nodes/online/proxy")).thenReturn(Collections.singletonList("foo_instance_3307"));
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcherTest.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeState [...]
index 707ada18cbc..b63eefc2544 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcherTest.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-cluster-mode/shardingsphere-cluster-mode-core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/registry/status/compute/watcher/ComputeNodeStateChangedWatcherTest.java
@@ -23,8 +23,6 @@ import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.statu
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.LabelsEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.StateEvent;
import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.WorkerIdEvent;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.XaRecoveryIdAddedEvent;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.XaRecoveryIdDeletedEvent;
import org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEvent;
import org.apache.shardingsphere.mode.repository.cluster.listener.DataChangedEvent.Type;
import org.junit.Test;
@@ -94,18 +92,4 @@ public final class ComputeNodeStateChangedWatcherTest {
assertThat(((LabelsEvent) actual.get()).getLabels(), is(Arrays.asList("label_1", "label_2")));
assertThat(((LabelsEvent) actual.get()).getInstanceId(), is("127.0.0.1@3307"));
}
-
- @Test
- public void assertCreateXaRecoveryIdEvent() {
- Optional<GovernanceEvent> actual = new ComputeNodeStateChangedWatcher()
- .createGovernanceEvent(new DataChangedEvent("/nodes/compute_nodes/xa_recovery_id/127.0.0.1@3307/127.0.0.1@3307", "", Type.ADDED));
- assertTrue(actual.isPresent());
- assertThat(((XaRecoveryIdAddedEvent) actual.get()).getInstanceId(), is("127.0.0.1@3307"));
- assertThat(((XaRecoveryIdAddedEvent) actual.get()).getXaRecoveryId(), is("127.0.0.1@3307"));
- actual = new ComputeNodeStateChangedWatcher()
- .createGovernanceEvent(new DataChangedEvent("/nodes/compute_nodes/xa_recovery_id/127.0.0.1@3307/127.0.0.1@3307", "", Type.DELETED));
- assertTrue(actual.isPresent());
- assertThat(((XaRecoveryIdDeletedEvent) actual.get()).getInstanceId(), is("127.0.0.1@3307"));
- assertThat(((XaRecoveryIdDeletedEvent) actual.get()).getXaRecoveryId(), is("127.0.0.1@3307"));
- }
}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
index a77afd0abc7..8d25f07e9bd 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-memory-mode/shardingsphere-memory-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/memory/MemoryContextManagerBuilder.java
@@ -28,9 +28,6 @@ import org.apache.shardingsphere.mode.manager.memory.lock.MemoryLockContext;
import org.apache.shardingsphere.mode.manager.memory.workerid.generator.MemoryWorkerIdGenerator;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.mode.metadata.MetaDataContextsBuilder;
-import org.apache.shardingsphere.transaction.rule.TransactionRule;
-import org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGenerator;
-import org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGeneratorFactory;
import java.sql.SQLException;
import java.util.Optional;
@@ -45,7 +42,6 @@ public final class MemoryContextManagerBuilder implements ContextManagerBuilder
MetaDataContexts metaDataContexts = new MetaDataContextsBuilder(
parameter.getDatabaseConfigs(), parameter.getGlobalRuleConfigs(), new ConfigurationProperties(parameter.getProps())).build(null);
InstanceContext instanceContext = buildInstanceContext(parameter);
- generateTransactionConfigurationFile(instanceContext, metaDataContexts);
ContextManager result = new ContextManager(metaDataContexts, instanceContext);
return result;
}
@@ -56,15 +52,6 @@ public final class MemoryContextManagerBuilder implements ContextManagerBuilder
return new InstanceContext(instance, new MemoryWorkerIdGenerator(), buildMemoryModeConfiguration(parameter.getModeConfig()), new MemoryLockContext());
}
- private void generateTransactionConfigurationFile(final InstanceContext instanceContext, final MetaDataContexts metaDataContexts) {
- Optional<TransactionRule> transactionRule =
- metaDataContexts.getMetaData().getGlobalRuleMetaData().getRules().stream().filter(each -> each instanceof TransactionRule).map(each -> (TransactionRule) each).findFirst();
- if (transactionRule.isPresent()) {
- Optional<TransactionConfigurationFileGenerator> fileGenerator = TransactionConfigurationFileGeneratorFactory.findInstance(transactionRule.get().getProviderType());
- fileGenerator.ifPresent(optional -> optional.generateFile(transactionRule.get().getProps(), instanceContext));
- }
- }
-
private ModeConfiguration buildMemoryModeConfiguration(final ModeConfiguration modeConfiguration) {
return Optional.ofNullable(modeConfiguration).orElseGet(() -> new ModeConfiguration(getType(), null, false));
}
diff --git a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
index d1f3db7dc0f..b558ee1ce15 100644
--- a/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
+++ b/shardingsphere-mode/shardingsphere-mode-type/shardingsphere-standalone-mode/shardingsphere-standalone-mode-core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/StandaloneContextManagerBuilder.java
@@ -33,16 +33,12 @@ import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.mode.metadata.MetaDataContextsBuilder;
import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
import org.apache.shardingsphere.mode.repository.standalone.StandalonePersistRepositoryFactory;
-import org.apache.shardingsphere.transaction.rule.TransactionRule;
-import org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGenerator;
-import org.apache.shardingsphere.transaction.spi.TransactionConfigurationFileGeneratorFactory;
import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import java.util.Optional;
/**
* Standalone context manager builder.
@@ -90,20 +86,10 @@ public final class StandaloneContextManagerBuilder implements ContextManagerBuil
private ContextManager createContextManager(final ContextManagerBuilderParameter parameter, final MetaDataContexts metaDataContexts) {
InstanceContext instanceContext = new InstanceContext(new ComputeNodeInstance(parameter.getInstanceDefinition()), new StandaloneWorkerIdGenerator(), parameter.getModeConfig(),
new StandaloneLockContext());
- generateTransactionConfigurationFile(instanceContext, metaDataContexts);
ContextManager result = new ContextManager(metaDataContexts, instanceContext);
return result;
}
- private void generateTransactionConfigurationFile(final InstanceContext instanceContext, final MetaDataContexts metaDataContexts) {
- Optional<TransactionRule> transactionRule =
- metaDataContexts.getMetaData().getGlobalRuleMetaData().getRules().stream().filter(each -> each instanceof TransactionRule).map(each -> (TransactionRule) each).findFirst();
- if (transactionRule.isPresent()) {
- Optional<TransactionConfigurationFileGenerator> fileGenerator = TransactionConfigurationFileGeneratorFactory.findInstance(transactionRule.get().getProviderType());
- fileGenerator.ifPresent(optional -> optional.generateFile(transactionRule.get().getProps(), instanceContext));
- }
- }
-
@Override
public String getType() {
return "Standalone";
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/RALBackendHandlerFactory.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/RALBackendHandlerFactory.java
index d3c8df936a4..237d4c900d9 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/RALBackendHandlerFactory.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/RALBackendHandlerFactory.java
@@ -34,7 +34,6 @@ import org.apache.shardingsphere.distsql.parser.statement.ral.common.queryable.S
import org.apache.shardingsphere.distsql.parser.statement.ral.common.queryable.ShowTrafficRulesStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.queryable.ShowTransactionRuleStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.queryable.ShowVariableStatement;
-import org.apache.shardingsphere.distsql.parser.statement.ral.common.updatable.AlterInstanceStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.updatable.AlterSQLParserRuleStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.updatable.AlterTrafficRuleStatement;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.updatable.AlterTransactionRuleStatement;
@@ -68,7 +67,6 @@ import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.queryable
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.queryable.ShowTrafficRulesHandler;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.queryable.ShowTransactionRuleHandler;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.queryable.ShowVariableHandler;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.updatable.AlterInstanceHandler;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.updatable.AlterSQLParserRuleHandler;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.updatable.AlterTrafficRuleHandler;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.updatable.AlterTransactionRuleHandler;
@@ -107,7 +105,6 @@ public final class RALBackendHandlerFactory {
HANDLERS.put(UnlabelInstanceStatement.class, UnlabelInstanceHandler.class);
HANDLERS.put(SetInstanceStatusStatement.class, SetInstanceStatusHandler.class);
HANDLERS.put(SetVariableStatement.class, SetVariableHandler.class);
- HANDLERS.put(AlterInstanceStatement.class, AlterInstanceHandler.class);
HANDLERS.put(SetReadwriteSplittingStatusStatement.class, SetReadwriteSplittingStatusHandler.class);
HANDLERS.put(RefreshTableMetadataStatement.class, RefreshTableMetadataHandler.class);
HANDLERS.put(CreateTrafficRuleStatement.class, CreateTrafficRuleHandler.class);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowInstanceHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowInstanceHandler.java
index f63e1376677..35a2d271602 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowInstanceHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowInstanceHandler.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.queryable;
-import com.google.common.base.Joiner;
import org.apache.shardingsphere.distsql.parser.statement.ral.common.queryable.ShowInstanceStatement;
import org.apache.shardingsphere.infra.instance.ComputeNodeInstance;
import org.apache.shardingsphere.infra.instance.definition.InstanceType;
@@ -48,11 +47,9 @@ public final class ShowInstanceHandler extends QueryableRALBackendHandler<ShowIn
private static final String LABELS = "labels";
- private static final String XA_RECOVERY_NODES = "xa_recovery_nodes";
-
@Override
protected Collection<String> getColumnNames() {
- return Arrays.asList(ID, HOST, PORT, STATUS, MODE_TYPE, LABELS, XA_RECOVERY_NODES);
+ return Arrays.asList(ID, HOST, PORT, STATUS, MODE_TYPE, LABELS);
}
@Override
@@ -68,8 +65,7 @@ public final class ShowInstanceHandler extends QueryableRALBackendHandler<ShowIn
private LocalDataQueryResultRow buildRow(final ComputeNodeInstance instance, final String modeType) {
String labels = null == instance.getLabels() ? "" : String.join(",", instance.getLabels());
- String xaRecoveryIds = Joiner.on(",").join(instance.getXaRecoveryIds());
return new LocalDataQueryResultRow(instance.getInstanceDefinition().getInstanceId(),
- instance.getInstanceDefinition().getIp(), instance.getInstanceDefinition().getUniqueSign(), instance.getState().getCurrentState().name(), modeType, labels, xaRecoveryIds);
+ instance.getInstanceDefinition().getIp(), instance.getInstanceDefinition().getUniqueSign(), instance.getState().getCurrentState().name(), modeType, labels);
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterInstanceHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterInstanceHandler.java
deleted file mode 100644
index f03d58068a4..00000000000
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterInstanceHandler.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.shardingsphere.proxy.backend.text.distsql.ral.common.updatable;
-
-import com.google.common.base.Splitter;
-import org.apache.shardingsphere.distsql.parser.statement.ral.common.updatable.AlterInstanceStatement;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
-import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
-import org.apache.shardingsphere.mode.manager.ContextManager;
-import org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.status.compute.event.XaRecoveryIdChangedEvent;
-import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.UpdatableRALBackendHandler;
-
-import java.util.Optional;
-
-/**
- * Alter instance handler.
- */
-public final class AlterInstanceHandler extends UpdatableRALBackendHandler<AlterInstanceStatement> {
-
- private static final String XA_RECOVERY_NODES = "xa_recovery_nodes";
-
- @Override
- protected void update(final ContextManager contextManager) throws DistSQLException {
- if (!XA_RECOVERY_NODES.equalsIgnoreCase(getSqlStatement().getKey())) {
- throw new UnsupportedOperationException(String.format("%s is not supported", getSqlStatement().getKey()));
- }
- Optional<MetaDataPersistService> persistService = contextManager.getMetaDataContexts().getPersistService();
- if (!persistService.isPresent()) {
- throw new UnsupportedOperationException(String.format("No persistence configuration found, unable to set '%s'", getSqlStatement().getKey()));
- }
- if (!contextManager.getInstanceContext().getComputeNodeInstanceById(getSqlStatement().getInstanceId()).isPresent()) {
- throw new UnsupportedOperationException(String.format("'%s' does not exist", getSqlStatement().getInstanceId()));
- }
- // TODO need support standalone mode
- ShardingSphereEventBus.getInstance().post(new XaRecoveryIdChangedEvent(getSqlStatement().getInstanceId(), Splitter.on(",").splitToList(getSqlStatement().getValue())));
- }
-}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterInstanceHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterInstanceHandlerTest.java
deleted file mode 100644
index eeebb4f134c..00000000000
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterInstanceHandlerTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.shardingsphere.proxy.backend.text.distsql.ral.common.updatable;
-
-import org.apache.shardingsphere.distsql.parser.statement.ral.common.updatable.AlterInstanceStatement;
-import org.apache.shardingsphere.mode.manager.ContextManager;
-import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
-import org.apache.shardingsphere.mode.persist.PersistRepository;
-import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
-import org.junit.Test;
-
-import java.sql.SQLException;
-import java.util.Optional;
-
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public final class AlterInstanceHandlerTest extends ProxyContextRestorer {
-
- @Test(expected = UnsupportedOperationException.class)
- public void assertUpdateWithNotSupportedKey() throws SQLException {
- String instanceId = "instance_id";
- String key = "key_1";
- String value = "value_1";
- AlterInstanceHandler handler = new AlterInstanceHandler();
- handler.init(getSQLStatement(instanceId, key, value), null);
- handler.execute();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void assertCheckWithNoPersistenceConfigurationFound() throws SQLException {
- ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- when(contextManager.getMetaDataContexts().getPersistService()).thenReturn(Optional.empty());
- ProxyContext.init(contextManager);
- String instanceId = "instance_id";
- String key = "xa_recovery_nodes";
- String value = "value_1";
- AlterInstanceHandler handler = new AlterInstanceHandler();
- handler.init(getSQLStatement(instanceId, key, value), null);
- handler.execute();
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void assertCheckWithNotExistInstanceId() throws SQLException {
- ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
- MetaDataPersistService metaDataPersistService = new MetaDataPersistService(mock(PersistRepository.class));
- when(contextManager.getMetaDataContexts().getPersistService()).thenReturn(Optional.of(metaDataPersistService));
- ProxyContext.init(contextManager);
- String instanceId = "instance_id";
- String key = "xa_recovery_nodes";
- String value = "value_1";
- AlterInstanceHandler handler = new AlterInstanceHandler();
- handler.init(getSQLStatement(instanceId, key, value), null);
- handler.execute();
- }
-
- private AlterInstanceStatement getSQLStatement(final String instanceId, final String key, final String value) {
- return new AlterInstanceStatement(instanceId, key, value);
- }
-}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
index e111932916d..b121e467cb3 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
+++ b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/conf/server.yaml
@@ -44,21 +44,6 @@
# - !TRANSACTION
# defaultType: XA
# providerType: Atomikos
-# # When the provider type is Narayana, the following properties can be configured or not
-# props:
-# recoveryStoreUrl: jdbc:mysql://127.0.0.1:3306/jbossts
-# recoveryStoreDataSource: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
-# recoveryStoreUser: root
-# recoveryStorePassword: 12345678
-# commitOnePhase: true
-# transactionSync: false
-# recoveryBackoffPeriod: 1
-# defaultTimeout: 180
-# expiryScanInterval: 12
-# periodicRecoveryPeriod: 120
-# createTable: true
-# stateStoreCreateTable: true
-# communicationStoreCreateTable: true
# - !SQL_PARSER
# sqlCommentParseEnabled: true
# sqlStatementCache: