You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/04/27 09:26:04 UTC
[GitHub] [shardingsphere] menghaoranss opened a new pull request #10206: Load metadata for tables without table rule
menghaoranss opened a new pull request #10206:
URL: https://github.com/apache/shardingsphere/pull/10206
Fixes #10205 .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero merged pull request #10206: Load metadata for tables without table rule
Posted by GitBox <gi...@apache.org>.
tristaZero merged pull request #10206:
URL: https://github.com/apache/shardingsphere/pull/10206
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on a change in pull request #10206: Load metadata for tables without table rule
Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #10206:
URL: https://github.com/apache/shardingsphere/pull/10206#discussion_r622721481
##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/CreateTableStatementSchemaRefresher.java
##########
@@ -58,4 +62,18 @@ private boolean containsInTableContainedRule(final String tableName, final Schem
}
return false;
}
+
+ private TableMetaData loadTableMetaData(final String tableName, final Collection<String> routeDataSourceNames,
+ final SchemaBuilderMaterials materials) throws SQLException {
+ for (String routeDataSourceName : routeDataSourceNames) {
+ DataSource dataSource = materials.getDataSourceMap().get(routeDataSourceName);
Review comment:
Is it possible that `Objects.isNull(dataSource)` == true?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on a change in pull request #10206: Load metadata for tables without table rule
Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #10206:
URL: https://github.com/apache/shardingsphere/pull/10206#discussion_r621064913
##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/CreateTableStatementSchemaRefresherTest.java
##########
@@ -31,90 +36,79 @@
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.ddl.SQLServerCreateTableStatement;
import org.junit.Test;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public final class CreateTableStatementSchemaRefresherTest {
+ private SchemaBuilderMaterials materials = mock(SchemaBuilderMaterials.class);
+
@Test
public void refreshForMySQL() throws SQLException {
MySQLCreateTableStatement createTableStatement = new MySQLCreateTableStatement();
createTableStatement.setNotExisted(false);
+ when(materials.getDatabaseType()).thenReturn(new MySQLDatabaseType());
refresh(createTableStatement);
}
@Test
public void refreshForOracle() throws SQLException {
OracleCreateTableStatement createTableStatement = new OracleCreateTableStatement();
+ when(materials.getDatabaseType()).thenReturn(new OracleDatabaseType());
refresh(createTableStatement);
}
@Test
public void refreshForPostgreSQL() throws SQLException {
PostgreSQLCreateTableStatement createTableStatement = new PostgreSQLCreateTableStatement();
createTableStatement.setNotExisted(false);
+ when(materials.getDatabaseType()).thenReturn(new PostgreSQLDatabaseType());
refresh(createTableStatement);
}
@Test
public void refreshForSQL92() throws SQLException {
SQL92CreateTableStatement createTableStatement = new SQL92CreateTableStatement();
+ when(materials.getDatabaseType()).thenReturn(new SQL92DatabaseType());
refresh(createTableStatement);
}
@Test
public void refreshForSQLServer() throws SQLException {
SQLServerCreateTableStatement createTableStatement = new SQLServerCreateTableStatement();
+ when(materials.getDatabaseType()).thenReturn(new SQLServerDatabaseType());
refresh(createTableStatement);
}
+ // TODO add more tests for tables with table rule
private void refresh(final CreateTableStatement createTableStatement) throws SQLException {
- ShardingSphereSchema schema = ShardingSphereSchemaBuildUtil.buildSchema();
createTableStatement.setTable(new SimpleTableSegment(new TableNameSegment(1, 3, new IdentifierValue("t_order_0"))));
+ Map<String, DataSource> dataSourceMap = mock(HashMap.class);
+ when(materials.getDataSourceMap()).thenReturn(dataSourceMap);
+ DataSource dataSource = mock(DataSource.class);
+ when(dataSourceMap.get(eq("ds"))).thenReturn(dataSource);
+ Connection connection = mock(Connection.class);
+ when(dataSource.getConnection()).thenReturn(connection);
+ DatabaseMetaData metaData = mock(DatabaseMetaData.class);
+ when(connection.getMetaData()).thenReturn(metaData);
+ ResultSet resultSet = mock(ResultSet.class);
+ when(metaData.getTables(any(), any(), any(), any())).thenReturn(resultSet);
+ when(resultSet.next()).thenReturn(false);
+ ShardingSphereSchema schema = ShardingSphereSchemaBuildUtil.buildSchema();
SchemaRefresher<CreateTableStatement> schemaRefresher = new CreateTableStatementSchemaRefresher();
- SchemaBuilderMaterials materials = mock(SchemaBuilderMaterials.class);
schemaRefresher.refresh(schema, Collections.singleton("ds"), createTableStatement, materials);
assertTrue(schema.containsTable("t_order_0"));
}
-
- @Test
- public void refreshWithUnConfiguredForMySQL() throws SQLException {
- MySQLCreateTableStatement createTableStatement = new MySQLCreateTableStatement();
- createTableStatement.setNotExisted(false);
- refreshWithUnConfigured(createTableStatement);
- }
-
- @Test
- public void refreshWithUnConfiguredForOracle() throws SQLException {
- OracleCreateTableStatement createTableStatement = new OracleCreateTableStatement();
- refreshWithUnConfigured(createTableStatement);
- }
-
- @Test
- public void refreshWithUnConfiguredForPostgreSQL() throws SQLException {
- PostgreSQLCreateTableStatement createTableStatement = new PostgreSQLCreateTableStatement();
- createTableStatement.setNotExisted(false);
- refreshWithUnConfigured(createTableStatement);
- }
-
- @Test
- public void refreshWithUnConfiguredForSQL92() throws SQLException {
- SQL92CreateTableStatement createTableStatement = new SQL92CreateTableStatement();
- refreshWithUnConfigured(createTableStatement);
- }
-
- @Test
- public void refreshWithUnConfiguredForSQLServer() throws SQLException {
- SQLServerCreateTableStatement createTableStatement = new SQLServerCreateTableStatement();
Review comment:
Do we add a UT to cover the branch of `!containsInTableContainedRule(tableName, materials)` ?
##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/AlterTableStatementSchemaRefresher.java
##########
@@ -38,7 +39,8 @@ public void refresh(final ShardingSphereSchema schema, final Collection<String>
final AlterTableStatement sqlStatement, final SchemaBuilderMaterials materials) throws SQLException {
String tableName = sqlStatement.getTable().getTableName().getIdentifier().getValue();
if (!containsInTableContainedRule(tableName, materials)) {
- return;
+ TableMetaDataLoader.load(materials.getDataSourceMap().get(routeDataSourceNames.iterator().next()),
+ tableName, materials.getDatabaseType()).ifPresent(tableMetaData -> schema.put(tableName, tableMetaData));
}
if (null != schema && schema.containsTable(tableName)) {
TableMetaDataBuilder.build(tableName, materials).ifPresent(tableMetaData -> schema.put(tableName, tableMetaData));
Review comment:
Do you think `if() {} else if() {}` is more appropriate?
##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/CreateTableStatementSchemaRefresher.java
##########
@@ -44,7 +45,7 @@ public void refresh(final ShardingSphereSchema schema, final Collection<String>
if (containsInTableContainedRule(tableName, materials)) {
tableMetaData = TableMetaDataBuilder.build(tableName, materials).orElse(new TableMetaData());
} else {
- tableMetaData = new TableMetaData();
+ tableMetaData = TableMetaDataLoader.load(materials.getDataSourceMap().get(routeDataSourceNames.iterator().next()), tableName, materials.getDatabaseType()).orElse(new TableMetaData());
Review comment:
Is it necessary to check `routeDataSourceNames.size()`
##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/AlterTableStatementSchemaRefresher.java
##########
@@ -38,7 +39,8 @@ public void refresh(final ShardingSphereSchema schema, final Collection<String>
final AlterTableStatement sqlStatement, final SchemaBuilderMaterials materials) throws SQLException {
String tableName = sqlStatement.getTable().getTableName().getIdentifier().getValue();
if (!containsInTableContainedRule(tableName, materials)) {
- return;
+ TableMetaDataLoader.load(materials.getDataSourceMap().get(routeDataSourceNames.iterator().next()),
+ tableName, materials.getDatabaseType()).ifPresent(tableMetaData -> schema.put(tableName, tableMetaData));
}
if (null != schema && schema.containsTable(tableName)) {
TableMetaDataBuilder.build(tableName, materials).ifPresent(tableMetaData -> schema.put(tableName, tableMetaData));
Review comment:
Beside, we still need to give a check on `routeDataSourceNames.size()`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] menghaoranss commented on a change in pull request #10206: Load metadata for tables without table rule
Posted by GitBox <gi...@apache.org>.
menghaoranss commented on a change in pull request #10206:
URL: https://github.com/apache/shardingsphere/pull/10206#discussion_r621189515
##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/CreateTableStatementSchemaRefresherTest.java
##########
@@ -31,90 +36,79 @@
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.ddl.SQLServerCreateTableStatement;
import org.junit.Test;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public final class CreateTableStatementSchemaRefresherTest {
+ private SchemaBuilderMaterials materials = mock(SchemaBuilderMaterials.class);
+
@Test
public void refreshForMySQL() throws SQLException {
MySQLCreateTableStatement createTableStatement = new MySQLCreateTableStatement();
createTableStatement.setNotExisted(false);
+ when(materials.getDatabaseType()).thenReturn(new MySQLDatabaseType());
refresh(createTableStatement);
}
@Test
public void refreshForOracle() throws SQLException {
OracleCreateTableStatement createTableStatement = new OracleCreateTableStatement();
+ when(materials.getDatabaseType()).thenReturn(new OracleDatabaseType());
refresh(createTableStatement);
}
@Test
public void refreshForPostgreSQL() throws SQLException {
PostgreSQLCreateTableStatement createTableStatement = new PostgreSQLCreateTableStatement();
createTableStatement.setNotExisted(false);
+ when(materials.getDatabaseType()).thenReturn(new PostgreSQLDatabaseType());
refresh(createTableStatement);
}
@Test
public void refreshForSQL92() throws SQLException {
SQL92CreateTableStatement createTableStatement = new SQL92CreateTableStatement();
+ when(materials.getDatabaseType()).thenReturn(new SQL92DatabaseType());
refresh(createTableStatement);
}
@Test
public void refreshForSQLServer() throws SQLException {
SQLServerCreateTableStatement createTableStatement = new SQLServerCreateTableStatement();
+ when(materials.getDatabaseType()).thenReturn(new SQLServerDatabaseType());
refresh(createTableStatement);
}
+ // TODO add more tests for tables with table rule
private void refresh(final CreateTableStatement createTableStatement) throws SQLException {
- ShardingSphereSchema schema = ShardingSphereSchemaBuildUtil.buildSchema();
createTableStatement.setTable(new SimpleTableSegment(new TableNameSegment(1, 3, new IdentifierValue("t_order_0"))));
+ Map<String, DataSource> dataSourceMap = mock(HashMap.class);
+ when(materials.getDataSourceMap()).thenReturn(dataSourceMap);
+ DataSource dataSource = mock(DataSource.class);
+ when(dataSourceMap.get(eq("ds"))).thenReturn(dataSource);
+ Connection connection = mock(Connection.class);
+ when(dataSource.getConnection()).thenReturn(connection);
+ DatabaseMetaData metaData = mock(DatabaseMetaData.class);
+ when(connection.getMetaData()).thenReturn(metaData);
+ ResultSet resultSet = mock(ResultSet.class);
+ when(metaData.getTables(any(), any(), any(), any())).thenReturn(resultSet);
+ when(resultSet.next()).thenReturn(false);
+ ShardingSphereSchema schema = ShardingSphereSchemaBuildUtil.buildSchema();
SchemaRefresher<CreateTableStatement> schemaRefresher = new CreateTableStatementSchemaRefresher();
- SchemaBuilderMaterials materials = mock(SchemaBuilderMaterials.class);
schemaRefresher.refresh(schema, Collections.singleton("ds"), createTableStatement, materials);
assertTrue(schema.containsTable("t_order_0"));
}
-
- @Test
- public void refreshWithUnConfiguredForMySQL() throws SQLException {
- MySQLCreateTableStatement createTableStatement = new MySQLCreateTableStatement();
- createTableStatement.setNotExisted(false);
- refreshWithUnConfigured(createTableStatement);
- }
-
- @Test
- public void refreshWithUnConfiguredForOracle() throws SQLException {
- OracleCreateTableStatement createTableStatement = new OracleCreateTableStatement();
- refreshWithUnConfigured(createTableStatement);
- }
-
- @Test
- public void refreshWithUnConfiguredForPostgreSQL() throws SQLException {
- PostgreSQLCreateTableStatement createTableStatement = new PostgreSQLCreateTableStatement();
- createTableStatement.setNotExisted(false);
- refreshWithUnConfigured(createTableStatement);
- }
-
- @Test
- public void refreshWithUnConfiguredForSQL92() throws SQLException {
- SQL92CreateTableStatement createTableStatement = new SQL92CreateTableStatement();
- refreshWithUnConfigured(createTableStatement);
- }
-
- @Test
- public void refreshWithUnConfiguredForSQLServer() throws SQLException {
- SQLServerCreateTableStatement createTableStatement = new SQLServerCreateTableStatement();
Review comment:
Added.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] menghaoranss commented on a change in pull request #10206: Load metadata for tables without table rule
Posted by GitBox <gi...@apache.org>.
menghaoranss commented on a change in pull request #10206:
URL: https://github.com/apache/shardingsphere/pull/10206#discussion_r621188235
##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/CreateTableStatementSchemaRefresher.java
##########
@@ -44,7 +45,7 @@ public void refresh(final ShardingSphereSchema schema, final Collection<String>
if (containsInTableContainedRule(tableName, materials)) {
tableMetaData = TableMetaDataBuilder.build(tableName, materials).orElse(new TableMetaData());
} else {
- tableMetaData = new TableMetaData();
+ tableMetaData = TableMetaDataLoader.load(materials.getDataSourceMap().get(routeDataSourceNames.iterator().next()), tableName, materials.getDatabaseType()).orElse(new TableMetaData());
Review comment:
The tables in DDL and not in table rule, there should be only one route data source,may be we should check `routeDataSourceNames.size() !=0` ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-commenter commented on pull request #10206: Load metadata for tables without table rule
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #10206:
URL: https://github.com/apache/shardingsphere/pull/10206#issuecomment-828125120
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/10206?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#10206](https://codecov.io/gh/apache/shardingsphere/pull/10206?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (100caa3) into [master](https://codecov.io/gh/apache/shardingsphere/commit/c5b86fa8f3a5c541976b3c861603a94e47d16199?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c5b86fa) will **decrease** coverage by `0.04%`.
> The diff coverage is `66.66%`.
[](https://codecov.io/gh/apache/shardingsphere/pull/10206?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #10206 +/- ##
============================================
- Coverage 68.07% 68.03% -0.05%
Complexity 680 680
============================================
Files 1696 1696
Lines 29110 29117 +7
Branches 5217 5217
============================================
- Hits 19818 19810 -8
- Misses 7772 7787 +15
Partials 1520 1520
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/10206?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...esher/type/AlterTableStatementSchemaRefresher.java](https://codecov.io/gh/apache/shardingsphere/pull/10206/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvcmVmcmVzaGVyL3R5cGUvQWx0ZXJUYWJsZVN0YXRlbWVudFNjaGVtYVJlZnJlc2hlci5qYXZh) | `75.00% <66.66%> (+41.66%)` | `0.00 <0.00> (ø)` | |
| [...sher/type/CreateTableStatementSchemaRefresher.java](https://codecov.io/gh/apache/shardingsphere/pull/10206/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9tZXRhZGF0YS9zY2hlbWEvcmVmcmVzaGVyL3R5cGUvQ3JlYXRlVGFibGVTdGF0ZW1lbnRTY2hlbWFSZWZyZXNoZXIuamF2YQ==) | `80.00% <66.66%> (+26.15%)` | `0.00 <0.00> (ø)` | |
| [...sphere/scaling/core/job/schedule/JobScheduler.java](https://codecov.io/gh/apache/shardingsphere/pull/10206/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvY29yZS9qb2Ivc2NoZWR1bGUvSm9iU2NoZWR1bGVyLmphdmE=) | `22.22% <0.00%> (-29.63%)` | `0.00% <0.00%> (ø%)` | |
| [...re/scaling/core/executor/engine/ExecuteEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/10206/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvY29yZS9leGVjdXRvci9lbmdpbmUvRXhlY3V0ZUVuZ2luZS5qYXZh) | `88.88% <0.00%> (-11.12%)` | `0.00% <0.00%> (ø%)` | |
| [...scaling/core/job/task/inventory/InventoryTask.java](https://codecov.io/gh/apache/shardingsphere/pull/10206/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvY29yZS9qb2IvdGFzay9pbnZlbnRvcnkvSW52ZW50b3J5VGFzay5qYXZh) | `68.88% <0.00%> (-6.67%)` | `0.00% <0.00%> (ø%)` | |
| [...ing/core/job/task/incremental/IncrementalTask.java](https://codecov.io/gh/apache/shardingsphere/pull/10206/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc2NhbGluZy9zaGFyZGluZ3NwaGVyZS1zY2FsaW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NjYWxpbmcvY29yZS9qb2IvdGFzay9pbmNyZW1lbnRhbC9JbmNyZW1lbnRhbFRhc2suamF2YQ==) | `72.91% <0.00%> (-2.09%)` | `0.00% <0.00%> (ø%)` | |
| [...ine/type/unicast/ShardingUnicastRoutingEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/10206/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctcm91dGUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NoYXJkaW5nL3JvdXRlL2VuZ2luZS90eXBlL3VuaWNhc3QvU2hhcmRpbmdVbmljYXN0Um91dGluZ0VuZ2luZS5qYXZh) | `94.73% <0.00%> (-0.39%)` | `0.00% <0.00%> (ø%)` | |
| [...e/context/metadata/GovernanceMetaDataContexts.java](https://codecov.io/gh/apache/shardingsphere/pull/10206/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvbnRleHQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29udGV4dC9tZXRhZGF0YS9Hb3Zlcm5hbmNlTWV0YURhdGFDb250ZXh0cy5qYXZh) | `85.06% <0.00%> (+0.19%)` | `0.00% <0.00%> (ø%)` | |
| [...phere/governance/core/registry/RegistryCenter.java](https://codecov.io/gh/apache/shardingsphere/pull/10206/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS9yZWdpc3RyeS9SZWdpc3RyeUNlbnRlci5qYXZh) | `57.89% <0.00%> (+0.44%)` | `0.00% <0.00%> (ø%)` | |
| ... and [1 more](https://codecov.io/gh/apache/shardingsphere/pull/10206/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/10206?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/10206?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [c5b86fa...100caa3](https://codecov.io/gh/apache/shardingsphere/pull/10206?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tristaZero commented on a change in pull request #10206: Load metadata for tables without table rule
Posted by GitBox <gi...@apache.org>.
tristaZero commented on a change in pull request #10206:
URL: https://github.com/apache/shardingsphere/pull/10206#discussion_r621804444
##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/AlterTableStatementSchemaRefresher.java
##########
@@ -38,9 +42,12 @@ public void refresh(final ShardingSphereSchema schema, final Collection<String>
final AlterTableStatement sqlStatement, final SchemaBuilderMaterials materials) throws SQLException {
String tableName = sqlStatement.getTable().getTableName().getIdentifier().getValue();
if (!containsInTableContainedRule(tableName, materials)) {
- return;
- }
- if (null != schema && schema.containsTable(tableName)) {
+ DataSource dataSource = materials.getDataSourceMap().get(routeDataSourceNames.iterator().next());
Review comment:
Is there any change `null == dataSource`?
##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/refresher/type/AlterTableStatementSchemaRefresher.java
##########
@@ -38,9 +42,12 @@ public void refresh(final ShardingSphereSchema schema, final Collection<String>
final AlterTableStatement sqlStatement, final SchemaBuilderMaterials materials) throws SQLException {
String tableName = sqlStatement.getTable().getTableName().getIdentifier().getValue();
if (!containsInTableContainedRule(tableName, materials)) {
- return;
- }
- if (null != schema && schema.containsTable(tableName)) {
+ DataSource dataSource = materials.getDataSourceMap().get(routeDataSourceNames.iterator().next());
+ TableMetaData tableMetaData = Objects.isNull(dataSource) ? new TableMetaData()
+ : TableMetaDataLoader.load(materials.getDataSourceMap().get(routeDataSourceNames.iterator().next()),
+ tableName, materials.getDatabaseType()).orElse(new TableMetaData());
Review comment:
if the first ds has no this table, how about the remaining ds?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org