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 c3c5bbd Update distsql document. (#15237)
c3c5bbd is described below
commit c3c5bbddb0327289bb7b633f5abaaafd52cdd498
Author: yx9o <[email protected]>
AuthorDate: Thu Feb 3 11:07:52 2022 +0800
Update distsql document. (#15237)
---
.../distsql/syntax/ral/_index.cn.md | 5 ++---
.../distsql/syntax/ral/_index.en.md | 7 +++----
.../show/ExportSchemaConfigurationExecutorTest.java | 18 +++++++++---------
3 files changed, 14 insertions(+), 16 deletions(-)
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/_index.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/_index.cn.md
index a53760d..4bb0762 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/_index.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/_index.cn.md
@@ -35,7 +35,6 @@ RAL (Resource & Rule Administration Language) 为 Apache
ShardingSphere 的管
| stop scaling source writing xx | 旧的 ShardingSphere
数据源停写,xx:任务id | stop scaling source writing 1234
|
| apply scaling xx | 切换至新的 ShardingSphere
元数据,xx:任务id | apply scaling 1234
|
-
## 熔断
| 语句 | 说明
| 示例
|
@@ -45,7 +44,6 @@ RAL (Resource & Rule Administration Language) 为 Apache
ShardingSphere 的管
| show instance list | 查询 proxy
实例信息 | show instance list
|
| show readwrite_splitting read resources [from schema] | 查询所有读库的状态
| show readwrite_splitting read resources
|
-
## 全局规则
| 语句
| 说明
| 示例
[...]
@@ -71,7 +69,8 @@ RAL (Resource & Rule Administration Language) 为 Apache
ShardingSphere 的管
| parse SQL
| 解析 SQL 并输出抽象语法树 parse select * from
t_order |
| refresh table metadata
| 刷新所有表的元数据 | refresh table
metadata |
| refresh table metadata [tableName / tableName from resource resourceName]
| 刷新指定表的元数据 | refresh table
metadata t_order from resource ds_1 |
-| show table metadata tableName [, tableName] ...
| 查询表的元数据 | show table metadata
t_order |
+| show table metadata tableName [, tableName] ...
| 查询表的元数据 | show table metadata
t_order |
+| export schema config [from schema_name] [, file="file_path"]
| 查询 / 导出 schema 中的资源和规则配置 | export schema config
from readwrite_splitting_db |
## 注意事项
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/_index.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/_index.en.md
index 9f7f299..abb18eb 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/_index.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/ral/_index.en.md
@@ -43,7 +43,6 @@ RAL (Resource & Rule Administration Language) responsible for
the added-on featu
| show instance list | Query proxy
instance information | show instance list |
| show readwrite_splitting read resources [from schema] | Query all
read resources status | show readwrite_splitting read resources |
-
## Global Rule
| Statement
| Function
| Example
[...]
@@ -54,7 +53,6 @@ RAL (Resource & Rule Administration Language) responsible for
the added-on featu
| ALTER TRANSACTION RULE(DEFAULT=xx,TYPE(NAME=xxx,
PROPERTIES("key1"="value1","key2"="value2"...)))
| Alter transaction rule configuration,`DEFAULT`: default transaction
type,support LOCAL、XA、BASE; `NAME`: name of transaction manager, support
Atomikos, Narayana and Bitronix | ALTER
TRANSACTION RULE(DEFAULT=XA,TYPE(NAME=Narayana, PROPERTIES [...]
| ALTER SQL_PARSER RULE SQL_COMMENT_PARSE_ENABLE=xx,
PARSE_TREE_CACHE(INITIAL_CAPACITY=xx, MAXIMUM_SIZE=xx, CONCURRENCY_LEVEL=xx),
SQL_STATEMENT_CACHE(INITIAL_CAPACITY=xxx, MAXIMUM_SIZE=xxx,
CONCURRENCY_LEVEL=xxx) | Alter SQL parser rule configuration,
`SQL_COMMENT_PARSE_ENABLE`: whether to parse the SQL comment,
`PARSE_TREE_CACHE`: local cache configuration of syntax tree,
`SQL_STATEMENT_CACHE`: local cache of SQL statement | ALTER SQL_PARSER RULE
SQL_COMMENT_PARSE_ENABLE=false, PARSE_T [...]
-
## Other
| Statement
| Function
| Example |
@@ -69,8 +67,9 @@ RAL (Resource & Rule Administration Language) responsible for
the added-on featu
| preview SQL
| Preview the actual SQLs
| preview select * from t_order |
| parse SQL
| Parse SQL and output abstract syntax tree
| parse select * from t_order |
| refresh table metadata
| Refresh the metadata of all tables
| refresh table metadata |
-| refresh table metadata [tableName / tableName from resource resourceName]
| Refresh the metadata of a table
| refresh table metadata t_order from resource ds_1 |
-| show table metadata tableName [, tableName] ...
| Query table metadata
| show table metadata t_order |
+| refresh table metadata [tableName / tableName from resource resourceName]
| Refresh the metadata of a table
| refresh table metadata t_order from resource ds_1 |
+| show table metadata tableName [, tableName] ...
| Query table metadata
| show table metadata t_order |
+| export schema config [from schema_name] [, file="file_path"]
| Query / export resources and rule configuration in schema
| export schema config from readwrite_splitting_db |
## Notice
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/ExportSchemaConfigurationExecutorTest.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/ExportSchemaConfigurationExecutorTest.java
index a9ff2f8..87f84d1 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/ExportSchemaConfigurationExecutorTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/show/ExportSchemaConfigurationExecutorTest.java
@@ -58,7 +58,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public final class ExportSchemaConfigurationExecutorTest {
-
+
@Before
public void init() {
ContextManager contextManager = mock(ContextManager.class,
RETURNS_DEEP_STUBS);
@@ -70,7 +70,7 @@ public final class ExportSchemaConfigurationExecutorTest {
when(contextManager.getMetaDataContexts().getMetaData("sharding_db")).thenReturn(shardingSphereMetaData);
ProxyContext.getInstance().init(contextManager);
}
-
+
@Test
public void assertExportSchemaExecutor() throws SQLException {
ExportSchemaConfigurationExecutor executor = new
ExportSchemaConfigurationExecutor(createSqlStatement(),
mockConnectionSession());
@@ -80,7 +80,7 @@ public final class ExportSchemaConfigurationExecutorTest {
List<Object> data = new ArrayList<>(queryResponseRow.getData());
assertThat(data.size(), is(1));
}
-
+
private ShardingRuleConfiguration createShardingRuleConfiguration() {
ShardingRuleConfiguration result = new ShardingRuleConfiguration();
result.getTables().add(createTableRuleConfiguration());
@@ -95,14 +95,14 @@ public final class ExportSchemaConfigurationExecutorTest {
result.getScaling().put(scalingName, null);
return result;
}
-
+
private Map<String, DataSource> createDataSourceMap() {
Map<String, DataSource> result = new LinkedHashMap<>(2, 1);
result.put("ds_0", createDataSource("demo_ds_0"));
result.put("ds_1", createDataSource("demo_ds_1"));
return result;
}
-
+
private DataSource createDataSource(final String dbName) {
HikariDataSource result = new HikariDataSource();
result.setJdbcUrl(String.format("jdbc:mysql://127.0.0.1:3306/%s?serverTimezone=UTC&useSSL=false",
dbName));
@@ -115,7 +115,7 @@ public final class ExportSchemaConfigurationExecutorTest {
result.setMinimumIdle(1);
return result;
}
-
+
private Map<String, TableMetaData> createTableMap() {
Map<String, TableMetaData> result = new HashMap<>(1, 1);
List<ColumnMetaData> columns = Collections.singletonList(new
ColumnMetaData("order_id", 0, false, false, false));
@@ -123,17 +123,17 @@ public final class ExportSchemaConfigurationExecutorTest {
result.put("t_order", new TableMetaData("t_order", columns, indexes));
return result;
}
-
+
private ShardingTableRuleConfiguration createTableRuleConfiguration() {
ShardingTableRuleConfiguration result = new
ShardingTableRuleConfiguration("t_order", "ds_${0..1}.t_order_${0..1}");
result.setKeyGenerateStrategy(new
KeyGenerateStrategyConfiguration("order_id", "snowflake"));
return result;
}
-
+
private ExportSchemaConfigurationStatement createSqlStatement() {
return new ExportSchemaConfigurationStatement(new SchemaSegment(0, 0,
new IdentifierValue("sharding_db")), Optional.empty());
}
-
+
private ConnectionSession mockConnectionSession() {
return mock(ConnectionSession.class);
}