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 435e8d3e3fe shardingsphere-proxy trigger scaling IT (#17938)
435e8d3e3fe is described below
commit 435e8d3e3fe13f1b8d15ae1ac52583827ed69574
Author: Hongsheng Zhong <[email protected]>
AuthorDate: Thu May 26 13:41:53 2022 +0800
shardingsphere-proxy trigger scaling IT (#17938)
* shardingsphere-proxy trigger scaling IT
* Add log
---
.github/workflows/it-scaling.yml | 2 ++
.../core/metadata/generator/PipelineDDLGenerator.java | 4 ++++
.../cache/subscriber/ScalingRegistrySubscriber.java | 14 ++++++++++++++
3 files changed, 20 insertions(+)
diff --git a/.github/workflows/it-scaling.yml b/.github/workflows/it-scaling.yml
index d775bcc0be1..75d842d1916 100644
--- a/.github/workflows/it-scaling.yml
+++ b/.github/workflows/it-scaling.yml
@@ -24,6 +24,7 @@ on:
- '.github/workflows/it-scaling.yml'
- 'shardingsphere-infra/shardingsphere-infra-common/src/main/**'
- 'shardingsphere-mode/**/src/main/**'
+ - 'shardingsphere-proxy/**/src/main/**'
- 'shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/**'
- '**/*-distsql*/**/src/main/**'
- 'shardingsphere-kernel/shardingsphere-data-pipeline/**/src/main/**'
@@ -40,6 +41,7 @@ on:
- '.github/workflows/it-scaling.yml'
- 'shardingsphere-infra/shardingsphere-infra-common/src/main/**'
- 'shardingsphere-mode/**/src/main/**'
+ - 'shardingsphere-proxy/**/src/main/**'
- 'shardingsphere-jdbc/shardingsphere-jdbc-core/src/main/**'
- '**/*-distsql*/**/src/main/**'
- 'shardingsphere-kernel/shardingsphere-data-pipeline/**/src/main/**'
diff --git
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/metadata/generator/PipelineDDLGenerator.java
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/metadata/generator/PipelineDDLGenerator.java
index 487d68f93f2..4b653797208 100644
---
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/metadata/generator/PipelineDDLGenerator.java
+++
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/metadata/generator/PipelineDDLGenerator.java
@@ -20,6 +20,7 @@ package
org.apache.shardingsphere.data.pipeline.core.metadata.generator;
import com.google.common.base.Preconditions;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.binder.LogicSQL;
import org.apache.shardingsphere.infra.binder.SQLStatementContextFactory;
import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
@@ -60,6 +61,7 @@ import java.util.TreeMap;
* Pipeline ddl generator.
*/
@RequiredArgsConstructor
+@Slf4j
public final class PipelineDDLGenerator {
private static final String DELIMITER = ";";
@@ -80,6 +82,8 @@ public final class PipelineDDLGenerator {
@SneakyThrows
public String generateLogicDDLSQL(final DatabaseType databaseType, final
String databaseName, final String schemaName, final String tableName) {
ShardingSphereDatabase database =
contextManager.getMetaDataContexts().getDatabaseMetaData(databaseName);
+ log.info("generateLogicDDLSQL, databaseType={}, databaseName={},
schemaName={}, tableName={}, dataSourceNames={}",
+ databaseType.getType(), databaseName, schemaName, tableName,
database.getResource().getDataSources().keySet());
String sql = generateActualDDLSQL(databaseType, schemaName, tableName,
database);
StringBuilder result = new StringBuilder();
for (String each : sql.split(DELIMITER)) {
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/cache/subscriber/ScalingRegistrySubscriber.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/cache/subscriber/ScalingRegistrySubscriber.java
index 8b0ae3b29ae..c5af37f93e2 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/cache/subscriber/ScalingRegistrySubscriber.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/cache/subscriber/ScalingRegistrySubscriber.java
@@ -20,8 +20,10 @@ package
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.cach
import com.google.common.eventbus.Subscribe;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
+import org.apache.shardingsphere.infra.metadata.schema.model.TableMetaData;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.cache.event.StartScalingEvent;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.config.event.rule.ScalingTaskFinishedEvent;
+import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.config.event.schema.SchemaChangedEvent;
import
org.apache.shardingsphere.mode.manager.cluster.coordinator.registry.config.event.version.MetadataVersionPreparedEvent;
import
org.apache.shardingsphere.mode.metadata.persist.node.DatabaseMetaDataNode;
import
org.apache.shardingsphere.mode.metadata.persist.service.DatabaseVersionPersistService;
@@ -82,4 +84,16 @@ public final class ScalingRegistrySubscriber {
log.error("targetActiveVersion does not match current
activeVersion, targetActiveVersion={}, activeVersion={}", targetActiveVersion,
activeVersion.orElse(null));
}
}
+
+ /**
+ * Schema changed.
+ *
+ * @param event event
+ */
+ @Subscribe
+ public void schemaChanged(final SchemaChangedEvent event) {
+ TableMetaData changedTableMetaData = event.getChangedTableMetaData();
+ String changedTableName = null != changedTableMetaData ?
changedTableMetaData.getName() : null;
+ log.info("schemaChanged, databaseName={}, schemaName={},
changedTableName={}, deletedTable={}", event.getDatabaseName(),
event.getSchemaName(), changedTableName, event.getDeletedTable());
+ }
}