This is an automated email from the ASF dual-hosted git repository.
jianglongtao 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 d682bf3 [FAQ] Delete FAQ number serial number & Add custom algorithm
FAQ (#14140)
d682bf3 is described below
commit d682bf331feef153faa670c9a083a769ec64bdb7
Author: lanchengx <[email protected]>
AuthorDate: Fri Dec 17 18:14:14 2021 +0800
[FAQ] Delete FAQ number serial number & Add custom algorithm FAQ (#14140)
* Delete FAQ number serial number.
Add custom algorithm FAQ.
* Update _index.en.md
* Update _index.cn.md
* Update _index.en.md
---
docs/document/content/reference/faq/_index.cn.md | 66 +++++++++++++-----------
docs/document/content/reference/faq/_index.en.md | 66 +++++++++++++-----------
2 files changed, 72 insertions(+), 60 deletions(-)
diff --git a/docs/document/content/reference/faq/_index.cn.md
b/docs/document/content/reference/faq/_index.cn.md
index 1280af2..399cbec 100644
--- a/docs/document/content/reference/faq/_index.cn.md
+++ b/docs/document/content/reference/faq/_index.cn.md
@@ -5,14 +5,14 @@ weight = 8
chapter = true
+++
-## 1. [JDBC] 为什么配置了某个数据连接池的 spring-boot-starter(比如 druid)和
shardingsphere-jdbc-spring-boot-starter 时,系统启动会报错?
+## [JDBC] 为什么配置了某个数据连接池的 spring-boot-starter(比如 druid)和
shardingsphere-jdbc-spring-boot-starter 时,系统启动会报错?
回答:
1. 因为数据连接池的 starter(比如 druid)可能会先加载并且其创建一个默认数据源,这将会使得 ShardingSphere-JDBC
创建数据源时发生冲突。
2. 解决办法为,去掉数据连接池的 starter 即可,ShardingSphere-JDBC 自己会创建数据连接池。
-## 2. [JDBC] 使用Spring命名空间时找不到xsd?
+## [JDBC] 使用Spring命名空间时找不到xsd?
回答:
@@ -21,13 +21,13 @@ Spring 命名空间使用规范并未强制要求将 xsd 文件部署至公网
实际上 shardingsphere-jdbc-spring-namespace 的 jar 包中 META-INF\spring.schemas 配置了
xsd 文件的位置:
META-INF\namespace\sharding.xsd 和 META-INF\namespace\replica-query.xsd,只需确保
jar 包中该文件存在即可。
-## 3. [JDBC] 引入 `shardingsphere-transaction-xa-core` 后,如何避免 spring-boot
自动加载默认的 JtaTransactionManager?
+## [JDBC] 引入 `shardingsphere-transaction-xa-core` 后,如何避免 spring-boot 自动加载默认的
JtaTransactionManager?
回答:
1. 需要在 spring-boot 的引导类中添加 `@SpringBootApplication(exclude =
JtaAutoConfiguration.class)`。
-## 4. [Proxy] Windows 环境下,运行 ShardingSphere-Proxy,找不到或无法加载主类
org.apache.shardingsphere.proxy.Bootstrap,如何解决?
+## [Proxy] Windows 环境下,运行 ShardingSphere-Proxy,找不到或无法加载主类
org.apache.shardingsphere.proxy.Bootstrap,如何解决?
回答:
@@ -40,7 +40,7 @@ META-INF\namespace\sharding.xsd 和
META-INF\namespace\replica-query.xsd,只
tar zxvf
apache-shardingsphere-${RELEASE.VERSION}-shardingsphere-proxy-bin.tar.gz
```
-## 5. [Proxy] 在使用 ShardingSphere-Proxy 的时候,如何动态在添加新的 logic schema?
+## [Proxy] 在使用 ShardingSphere-Proxy 的时候,如何动态在添加新的 logic schema?
回答:
@@ -60,7 +60,7 @@ CREATE DATABASE sharding_db;
DROP SCHEMA sharding_db;
```
-## 6. [Proxy] 在使用 ShardingSphere-Proxy时,怎么使用合适的工具连接到 ShardingSphere-Proxy?
+## [Proxy] 在使用 ShardingSphere-Proxy时,怎么使用合适的工具连接到 ShardingSphere-Proxy?
回答:
@@ -71,7 +71,7 @@ DROP SCHEMA sharding_db;
- DataGrip:2020.1、2021.1(使用 IDEA/DataGrip 时打开 `introspect using JDBC
metadata` 选项)。
- WorkBench:8.0.25。
-## 7. [Proxy] 使用 Navicat 等第三方数据库工具连接 ShardingSphere-Proxy 时,如果
ShardingSphere-Proxy 没有创建 Schema 或者没有添加 Resource,连接失败?
+## [Proxy] 使用 Navicat 等第三方数据库工具连接 ShardingSphere-Proxy 时,如果
ShardingSphere-Proxy 没有创建 Schema 或者没有添加 Resource,连接失败?
回答:
@@ -79,32 +79,38 @@ DROP SCHEMA sharding_db;
2. 推荐先创建 `schema` 和 `resource` 之后再使用第三方数据库工具连接。
3. 有关 `resource`
的详情请参考。[相关介绍](/cn/user-manual/shardingsphere-proxy/distsql/syntax/rdl/resource-definition/)
-## 8. [分片] Cloud not resolve placeholder ... in string value ...异常的解决方法?
+## [分片] Cloud not resolve placeholder ... in string value ...异常的解决方法?
回答:
行表达式标识符可以使用`${...}`或`$->{...}`,但前者与Spring本身的属性文件占位符冲突,因此在Spring环境中使用行表达式标识符建议使用`$->{...}`。
-## 9. [分片] inline 表达式返回结果为何出现浮点数?
+## [分片] inline 表达式返回结果为何出现浮点数?
回答:
Java的整数相除结果是整数,但是对于 inline 表达式中的 Groovy 语法则不同,整数相除结果是浮点数。
想获得除法整数结果需要将 A/B 改为 A.intdiv(B)。
-## 10. [分片] 如果只有部分数据库分库分表,是否需要将不分库分表的表也配置在分片规则中?
+## [分片] 如果只有部分数据库分库分表,是否需要将不分库分表的表也配置在分片规则中?
回答:
不需要,ShardingSphere 会自动识别。
-## 11. [分片] 指定了泛型为 Long 的 `SingleKeyTableShardingAlgorithm`,遇到
`ClassCastException: Integer can not cast to Long`?
+## [分片] 指定了泛型为 Long 的 `SingleKeyTableShardingAlgorithm`,遇到
`ClassCastException: Integer can not cast to Long`?
回答:
必须确保数据库表中该字段和分片算法该字段类型一致,如:数据库中该字段类型为 int(11),泛型所对应的分片类型应为 Integer,如果需要配置为
Long 类型,请确保数据库中该字段类型为 bigint。
-## 12. [分片] ShardingSphere 提供的默认分布式自增主键策略为什么是不连续的,且尾数大多为偶数?
+## [分片、PROXY] 实现 `StandardShardingAlgorithm` 自定义算法时,指定了 `Comparable` 的具体类型为
Long, 且数据库表中字段类型为 bigint,出现 `ClassCastException: Integer can not cast to Long`
异常。
+
+回答:
+
+实现 `doSharding` 方法时,不建议指定方法声明中 `Comparable` 具体的类型,而是在 `doSharding`
方法实现中对类型进行转换,可以参考 `ModShardingAlgorithm#doSharding` 方法
+
+## [分片] ShardingSphere 提供的默认分布式自增主键策略为什么是不连续的,且尾数大多为偶数?
回答:
@@ -114,7 +120,7 @@ ShardingSphere 采用 snowflake 算法作为默认的分布式自增主键策略
在 3.1.0
版本中,尾数大多为偶数的问题已彻底解决,参见:https://github.com/apache/shardingsphere/issues/1617
-## 13. [分片] 如何在 inline 分表策略时,允许执行范围查询操作(BETWEEN AND、\>、\<、\>=、\<=)?
+## [分片] 如何在 inline 分表策略时,允许执行范围查询操作(BETWEEN AND、\>、\<、\>=、\<=)?
回答:
@@ -123,7 +129,7 @@ ShardingSphere 采用 snowflake 算法作为默认的分布式自增主键策略
- 4.x版本:`allow.range.query.with.inline.sharding`设置为true即可(默认为false)。
- 5.x版本:在 InlineShardingStrategy 中将`allow-range-query-with-inline-sharding`
设置为 true 即可(默认为 false)。
-## 14. [分片] 为什么我实现了 `KeyGenerateAlgorithm` 接口,也配置了 Type,但是自定义的分布式主键依然不生效?
+## [分片] 为什么我实现了 `KeyGenerateAlgorithm` 接口,也配置了 Type,但是自定义的分布式主键依然不生效?
回答:
@@ -133,7 +139,7 @@ ShardingSphere 采用 snowflake 算法作为默认的分布式自增主键策略
与分布式主键 `KeyGenerateAlgorithm` 接口相同,其他 ShardingSphere
的[扩展功能](/cn/concepts/pluggable/)也需要用相同的方式注入才能生效。
-## 15. [分片] ShardingSphere 除了支持自带的分布式自增主键之外,还能否支持原生的自增主键?
+## [分片] ShardingSphere 除了支持自带的分布式自增主键之外,还能否支持原生的自增主键?
回答:是的,可以支持。但原生自增主键有使用限制,即不能将原生自增主键同时作为分片键使用。
@@ -141,7 +147,7 @@ ShardingSphere 采用 snowflake 算法作为默认的分布式自增主键策略
而原生自增主键返回的前提条件是 INSERT SQL 必须最终路由至一张表,因此,面对返回多表的 INSERT SQL,自增主键则会返回零。
-## 16. [数据加密] JPA 和 数据加密无法一起使用,如何解决?
+## [数据加密] JPA 和 数据加密无法一起使用,如何解决?
回答:
@@ -153,7 +159,7 @@ ShardingSphere 采用 snowflake 算法作为默认的分布式自增主键策略
2. 关闭 JPA 的 auto-ddl,如 auto-ddl=none。
3. 手动建表,建表时应使用数据加密配置的 `cipherColumn`,`plainColumn` 和 `assistedQueryColumn`
代替逻辑列。
-## 17. [DistSQL] 使用 DistSQL 添加数据源时,如何设置自定义的 JDBC 连接参数或连接池属性?
+## [DistSQL] 使用 DistSQL 添加数据源时,如何设置自定义的 JDBC 连接参数或连接池属性?
回答:
@@ -161,7 +167,7 @@ ShardingSphere 采用 snowflake 算法作为默认的分布式自增主键策略
2. ShardingSphere预置了必要的连接池参数,如 `maxPoolSize`、`idleTimeout` 等。如需增加或覆盖参数配置,请在
`dataSource` 中通过 `PROPERTIES` 指定。
3. 以上规则请参考
[相关介绍](/cn/user-manual/shardingsphere-proxy/distsql/syntax/rdl/resource-definition/)
-## 18. [DistSQL] 使用 `DistSQL` 删除资源时,出现 `Resource [xxx] is still used by
[SingleTableRule]`。
+## [DistSQL] 使用 `DistSQL` 删除资源时,出现 `Resource [xxx] is still used by
[SingleTableRule]`。
回答:
@@ -169,13 +175,13 @@ ShardingSphere 采用 snowflake 算法作为默认的分布式自增主键策略
2. 若资源只被 single table rule 引用,且用户确认可以忽略该限制,则可以添加可选参数 ignore single tables
进行强制删除
-## 19. [DistSQL] 使用 `DistSQL` 添加资源时,出现 `Failed to get driver instance for
jdbcURL=xxx`。
+## [DistSQL] 使用 `DistSQL` 添加资源时,出现 `Failed to get driver instance for
jdbcURL=xxx`。
回答:
ShardingSphere-Proxy 在部署过程中没有添加 jdbc 驱动,需要将 jdbc 驱动放入 ShardingSphere-Proxy
解压后的 ext-lib 目录,例如:`mysql-connector`。
-## 20. [其他] 如果 SQL 在 ShardingSphere 中执行不正确,该如何调试?
+## [其他] 如果 SQL 在 ShardingSphere 中执行不正确,该如何调试?
回答:
@@ -184,7 +190,7 @@ ShardingSphere-Proxy 在部署过程中没有添加 jdbc 驱动,需要将 jdbc
> 注意:5.x版本以后,`sql.show`参数调整为`sql-show`。
-## 21. [其他] 阅读源码时为什么会出现编译错误? IDEA 不索引生成的代码?
+## [其他] 阅读源码时为什么会出现编译错误? IDEA 不索引生成的代码?
回答:
@@ -199,7 +205,7 @@ ShardingSphere 使用 lombok 实现极简代码。关于更多使用和安装细
生成的代码例如
`org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser` 等 Java
文件由于较大,默认配置的 IDEA 可能不会索引该文件。
可以调整 IDEA 的属性:`idea.max.intellisense.filesize=10000`
-## 22. [其他] 使用 SQLSever 和 PostgreSQL 时,聚合列不加别名会抛异常?
+## [其他] 使用 SQLSever 和 PostgreSQL 时,聚合列不加别名会抛异常?
回答:
@@ -217,7 +223,7 @@ SQLServer获取到的列为空字符串和(2),PostgreSQL获取到的列为空s
SELECT SUM(num) AS sum_num, SUM(num2) AS sum_num2 FROM tablexxx;
```
-## 23. [其他] Oracle 数据库使用 Timestamp 类型的 Order By 语句抛出异常提示 “Order by value must
implements Comparable”?
+## [其他] Oracle 数据库使用 Timestamp 类型的 Order By 语句抛出异常提示 “Order by value must
implements Comparable”?
回答:
@@ -273,7 +279,7 @@ SELECT SUM(num) AS sum_num, SUM(num2) AS sum_num2 FROM
tablexxx;
}
```
-## 24. [其他] Windows 环境下,通过 Git 克隆 ShardingSphere 源码时为什么提示文件名过长,如何解决?
+## [其他] Windows 环境下,通过 Git 克隆 ShardingSphere 源码时为什么提示文件名过长,如何解决?
回答:
@@ -294,13 +300,13 @@ git config --global core.longpaths true
https://docs.microsoft.com/zh-cn/windows/desktop/FileIO/naming-a-file
https://ourcodeworld.com/articles/read/109/how-to-solve-filename-too-long-error-in-git-powershell-and-github-application-for-windows
-## 25. [其他] Type is required 异常的解决方法?
+## [其他] Type is required 异常的解决方法?
回答:
ShardingSphere 中很多功能实现类的加载方式是通过 [SPI](/cn/concepts/pluggable/)
注入的方式完成的,如分布式主键,注册中心等;这些功能通过配置中 type 类型来寻找对应的 SPI 实现,因此必须在配置文件中指定类型。
-## 26. [其他] 服务启动时如何加快 `metadata` 加载速度?
+## [其他] 服务启动时如何加快 `metadata` 加载速度?
回答:
@@ -309,7 +315,7 @@ ShardingSphere 中很多功能实现类的加载方式是通过 [SPI](/cn/concep
- 配置项`max.connections.size.per.query`(默认值为1)调高(版本 >= 3.0.0.M3 且低于 5.0.0)。
- 配置项`max-connections-size-per-query`(默认值为1)调高(版本 >= 5.0.0)。
-## 27. [其他] ANTLR 插件在 src 同级目录下生成代码,容易误提交,如何避免?
+## [其他] ANTLR 插件在 src 同级目录下生成代码,容易误提交,如何避免?
回答:
@@ -317,7 +323,7 @@ ShardingSphere 中很多功能实现类的加载方式是通过 [SPI](/cn/concep

-## 28. [其他] 使用 `Proxool` 时分库结果不正确?
+## [其他] 使用 `Proxool` 时分库结果不正确?
回答:
@@ -335,7 +341,7 @@ ShardingSphere 中很多功能实现类的加载方式是通过 [SPI](/cn/concep
PS:sourceforge 网站需要翻墙访问。
-## 29. [其他] 使用 Spring Boot 2.x 集成 ShardingSphere 时,配置文件中的属性设置不生效?
+## [其他] 使用 Spring Boot 2.x 集成 ShardingSphere 时,配置文件中的属性设置不生效?
回答:
@@ -377,4 +383,4 @@ Caused by: java.lang.NullPointerException: Inline sharding
algorithm expression
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:431)
...
```
-从异常堆栈中分析可知: `AbstractAlgorithmProvidedBeanRegistry.registerBean` 方法调用
`PropertyUtil.containPropertyPrefix(environment, prefix)` 方法判断指定前缀 `prefix`
的配置是否存在,而 `PropertyUtil.containPropertyPrefix(environment, prefix)` 方法,在 Spring
Boot 2.x 环境下使用了 Binder,不规范的属性名称(如:驼峰或下划线等)会导致属性设置不生效。
\ No newline at end of file
+从异常堆栈中分析可知: `AbstractAlgorithmProvidedBeanRegistry.registerBean` 方法调用
`PropertyUtil.containPropertyPrefix(environment, prefix)` 方法判断指定前缀 `prefix`
的配置是否存在,而 `PropertyUtil.containPropertyPrefix(environment, prefix)` 方法,在 Spring
Boot 2.x 环境下使用了 Binder,不规范的属性名称(如:驼峰或下划线等)会导致属性设置不生效。
diff --git a/docs/document/content/reference/faq/_index.en.md
b/docs/document/content/reference/faq/_index.en.md
index 9aab5cc..7538ba6 100644
--- a/docs/document/content/reference/faq/_index.en.md
+++ b/docs/document/content/reference/faq/_index.en.md
@@ -5,14 +5,14 @@ weight = 8
chapter = true
+++
-## 1. [JDBC] Why there may be an error when configure both
shardingsphere-jdbc-spring-boot-starter and a spring-boot-starter of certain
datasource pool(such as druid)?
+## [JDBC] Why there may be an error when configure both
shardingsphere-jdbc-spring-boot-starter and a spring-boot-starter of certain
datasource pool(such as druid)?
Answer:
1. Because the spring-boot-starter of certain datasource pool (such as druid)
will be configured before shardingsphere-jdbc-spring-boot-starter and create a
default datasource, then conflict occur when ShardingSphere-JDBC create
datasources.
2. A simple way to solve this issue is removing the spring-boot-starter of
certain datasource pool, shardingsphere-jdbc create datasources with suitable
pools.
-## 2. [JDBC] Why is xsd unable to be found when Spring Namespace is used?
+## [JDBC] Why is xsd unable to be found when Spring Namespace is used?
Answer:
@@ -21,13 +21,13 @@ The use norm of Spring Namespace does not require to deploy
xsd files to the off
Actually, META-INF\spring.schemas in the jar package of
shardingsphere-jdbc-spring-namespace has been configured with the position of
xsd files:
META-INF\namespace\sharding.xsd and META-INF\namespace\replica-query.xsd, so
you only need to make sure that the file is in the jar package.
-## 3. [JDBC] Found a JtaTransactionManager in spring boot project when
integrating with transaction of XA
+## [JDBC] Found a JtaTransactionManager in spring boot project when
integrating with transaction of XA
Answer:
1. `shardingsphere-transaction-xa-core` include atomikos, it will trigger
auto-configuration mechanism in spring-boot, add
`@SpringBootApplication(exclude = JtaAutoConfiguration.class)` will solve it.
-## 4. [Proxy] In Windows environment, could not find or load main class
org.apache.shardingsphere.proxy.Bootstrap, how to solve it?
+## [Proxy] In Windows environment, could not find or load main class
org.apache.shardingsphere.proxy.Bootstrap, how to solve it?
Answer:
@@ -40,7 +40,7 @@ Open cmd.exe and execute the following command:
tar zxvf
apache-shardingsphere-${RELEASE.VERSION}-shardingsphere-proxy-bin.tar.gz
```
-## 5. [Proxy] How to add a new logic schema dynamically when use
ShardingSphere-Proxy?
+## [Proxy] How to add a new logic schema dynamically when use
ShardingSphere-Proxy?
Answer:
@@ -60,7 +60,7 @@ CREATE DATABASE sharding_db;
DROP SCHEMA sharding_db;
```
-## 6. [Proxy] How to use a suitable database tools connecting
ShardingSphere-Proxy?
+## [Proxy] How to use a suitable database tools connecting
ShardingSphere-Proxy?
Answer:
@@ -71,7 +71,7 @@ Answer:
- DataGrip:2020.1、2021.1 (turn on "introspect using jdbc metadata" in idea
or datagrip).
- WorkBench:8.0.25.
-## 7. [Proxy] When using a client such as Navicat to connect to Sharding
Sphere-Proxy, if Sharding Sphere-Proxy does not create a Schema or does not add
a Resource, the client connection will fail?
+## [Proxy] When using a client such as Navicat to connect to Sharding
Sphere-Proxy, if Sharding Sphere-Proxy does not create a Schema or does not add
a Resource, the client connection will fail?
Answer:
@@ -79,32 +79,38 @@ Answer:
2. It is recommended to create `schema` and `resource` first, and then use
third-party database tools to connect.
3. Please refer to [Related
introduction](/en/user-manual/shardingsphere-proxy/distsql/syntax/rdl/resource-definition/)
the details about `resource`.
-## 8. [Sharding] How to solve `Cloud not resolve placeholder … in string value
…` error?
+## [Sharding] How to solve `Cloud not resolve placeholder … in string value …`
error?
Answer:
`${...}` or `$->{...}` can be used in inline expression identifiers, but the
former one clashes with place holders in Spring property files, so `$->{...}`
is recommended to be used in Spring as inline expression identifiers.
-## 9. [Sharding] Why does float number appear in the return result of inline
expression?
+## [Sharding] Why does float number appear in the return result of inline
expression?
Answer:
The division result of Java integers is also integer, but in Groovy syntax of
inline expression, the division result of integers is float number.
To obtain integer division result, A/B needs to be modified as A.intdiv(B).
-## 10. [Sharding] If sharding database is partial, should tables without
sharding database & table be configured in sharding rules?
+## [Sharding] If sharding database is partial, should tables without sharding
database & table be configured in sharding rules?
Answer:
No, ShardingSphere will recognize it automatically.
-## 11. [Sharding] When generic Long type `SingleKeyTableShardingAlgorithm` is
used, why does`ClassCastException: Integer can not cast to Long` exception
appear?
+## [Sharding] When generic Long type `SingleKeyTableShardingAlgorithm` is
used, why does`ClassCastException: Integer can not cast to Long` exception
appear?
Answer:
You must make sure the field in database table consistent with that in
sharding algorithms. For example, the field type in database is int(11) and the
sharding type corresponds to genetic type is Integer, if you want to configure
Long type, please make sure the field type in the database is bigint.
-## 12. [Sharding] Why are the default distributed auto-augment key strategy
provided by ShardingSphere not continuous and most of them end with even
numbers?
+## [Sharding\PROXY] When implementing the `StandardShardingAlgorithm` custom
algorithm, the specific type of `Comparable` is specified as Long, and the
field type in the database table is bigint, a `ClassCastException: Integer can
not cast to Long` exception occurs.
+
+Answer:
+
+When implementing the `doSharding` method, it is not recommended to specify
the specific type of `Comparable` in the method declaration, but to convert the
type in the implementation of the `doSharding` method. You can refer to the
`ModShardingAlgorithm#doSharding` method.
+
+## [Sharding] Why are the default distributed auto-augment key strategy
provided by ShardingSphere not continuous and most of them end with even
numbers?
Answer:
@@ -114,7 +120,7 @@ But the last four numbers of snowflake algorithm are
incremental value within on
In 3.1.0 version, the problem of ending with even numbers has been totally
solved, please refer to: https://github.com/apache/shardingsphere/issues/1617
-## 13. [Sharding] How to allow range query with using inline sharding
strategy(BETWEEN AND, \>, \<, \>=, \<=)?
+## [Sharding] How to allow range query with using inline sharding
strategy(BETWEEN AND, \>, \<, \>=, \<=)?
Answer:
@@ -123,7 +129,7 @@ Answer:
- Version 4.x: `allow.range.query.with.inline.sharding` to `true` (Default
value is `false`).
- Version 5.x: `allow-range-query-with-inline-sharding` to `true` in
InlineShardingStrategy (Default value is `false`).
-## 14. [Sharding] Why does my custom distributed primary key do not work after
implementing `KeyGenerateAlgorithm` interface and configuring `type` property?
+## [Sharding] Why does my custom distributed primary key do not work after
implementing `KeyGenerateAlgorithm` interface and configuring `type` property?
Answer:
@@ -133,7 +139,7 @@ More detail for SPI usage, please search by yourself.
Other ShardingSphere [functionality implementation](/en/concepts/pluggable/)
will take effect in the same way.
-## 15. [Sharding] In addition to internal distributed primary key, does
ShardingSphere support other native auto-increment keys?
+## [Sharding] In addition to internal distributed primary key, does
ShardingSphere support other native auto-increment keys?
Answer:
@@ -143,7 +149,7 @@ Since ShardingSphere does not have the database table
structure and native auto-
The premise for returning native auto-increment key is that INSERT SQL is
eventually routed to one table. Therefore, auto-increment key will return zero
when INSERT SQL returns multiple tables.
-## 16. [Encryption] How to solve that `data encryption` can't work with JPA?
+## [Encryption] How to solve that `data encryption` can't work with JPA?
Answer:
@@ -155,7 +161,7 @@ The solutions are as follows:
2. Disable JPA auto-ddl, For example setting auto-ddl=none.
3. Create table manually. Table structure should use
`cipherColumn`,`plainColumn` and `assistedQueryColumn` to replace the
logicColumn.
-## 17. [DistSQL] How to set custom JDBC connection properties or connection
pool properties when adding a data source using DistSQL?
+## [DistSQL] How to set custom JDBC connection properties or connection pool
properties when adding a data source using DistSQL?
Answer:
@@ -163,7 +169,7 @@ Answer:
2. ShardingSphere presets necessary connection pool properties, such as
`maxPoolSize`, `idleTimeout`, etc. If you need to add or overwrite the
properties, please specify it with `PROPERTIES` in the `dataSource`.
3. Please refer to [Related
introduction](/en/user-manual/shardingsphere-proxy/distsql/syntax/rdl/resource-definition/)
for above rules.
-## 18. [DistSQL] How to solve ` Resource [xxx] is still used by
[SingleTableRule].` exception when dropping a data source using DistSQL?
+## [DistSQL] How to solve ` Resource [xxx] is still used by
[SingleTableRule].` exception when dropping a data source using DistSQL?
Answer:
@@ -175,7 +181,7 @@ Answer:
DROP RESOURCE dataSourceName [, dataSourceName] ... [ignore single tables]
```
-## 19. [DistSQL] How to solve ` Failed to get driver instance for
jdbcURL=xxx.` exception when adding a data source using DistSQL?
+## [DistSQL] How to solve ` Failed to get driver instance for jdbcURL=xxx.`
exception when adding a data source using DistSQL?
Answer:
@@ -185,7 +191,7 @@ ShardingSphere Proxy do not have jdbc driver during
deployment. Some example of
ADD RESOURCE dataSourceName [..., dataSourceName]
```
-## 20. [Other] How to debug when SQL can not be executed rightly in
ShardingSphere?
+## [Other] How to debug when SQL can not be executed rightly in ShardingSphere?
Answer:
@@ -193,7 +199,7 @@ Answer:
A Tip: Property `sql.show` has changed to `sql-show` in version 5.x.
-## 21. [Other] Why do some compiling errors appear? Why did not the IDEA index
the generated codes?
+## [Other] Why do some compiling errors appear? Why did not the IDEA index the
generated codes?
Answer:
@@ -208,7 +214,7 @@ The codes under the package
`org.apache.shardingsphere.sql.parser.autogen` are g
The generated codes such as
`org.apache.shardingsphere.sql.parser.autogen.PostgreSQLStatementParser` may be
too large to be indexed by the IDEA.
You may configure the IDEA's property `idea.max.intellisense.filesize=10000`.
-## 22. [Other] In SQLSever and PostgreSQL, why does the aggregation column
without alias throw exception?
+## [Other] In SQLSever and PostgreSQL, why does the aggregation column without
alias throw exception?
Answer:
@@ -226,7 +232,7 @@ The right SQL should be written as:
SELECT SUM(num) AS sum_num, SUM(num2) AS sum_num2 FROM tablexxx;
```
-## 23. [Other] Why does Oracle database throw “Order by value must implements
Comparable” exception when using Timestamp Order By?
+## [Other] Why does Oracle database throw “Order by value must implements
Comparable” exception when using Timestamp Order By?
Answer:
@@ -279,7 +285,7 @@ After using resultSet.getObject(int index), for TimeStamp
oracle, the system wil
}
```
-## 24. [Other] In Windows environment,when cloning ShardingSphere source code
through Git, why prompt filename too long and how to solve it?
+## [Other] In Windows environment,when cloning ShardingSphere source code
through Git, why prompt filename too long and how to solve it?
Answer:
@@ -303,13 +309,13 @@ Reference material:
https://docs.microsoft.com/zh-cn/windows/desktop/FileIO/naming-a-file
https://ourcodeworld.com/articles/read/109/how-to-solve-filename-too-long-error-in-git-powershell-and-github-application-for-windows
-## 25. [Other] How to solve `Type is required` error?
+## [Other] How to solve `Type is required` error?
Answer:
In Apache ShardingSphere, many functionality implementation are uploaded
through [SPI](/en/concepts/pluggable/), such as Distributed Primary Key. These
functions load SPI implementation by configuring the `type`,so the `type` must
be specified in the configuration file.
-## 26. [Other] How to speed up the metadata loading when service starts up?
+## [Other] How to speed up the metadata loading when service starts up?
Answer:
@@ -318,7 +324,7 @@ Answer:
- `max.connections.size.per.query`(Default value is 1) higher referring to
connection pool you adopt(Version >= 3.0.0.M3 & Version < 5.0.0).
- `max-connections-size-per-query`(Default value is 1) higher referring to
connection pool you adopt(Version >= 5.0.0).
-## 27. [Other] The ANTLR plugin generates codes in the same level directory as
src, which is easy to commit by mistake. How to avoid it?
+## [Other] The ANTLR plugin generates codes in the same level directory as
src, which is easy to commit by mistake. How to avoid it?
Answer:
@@ -326,7 +332,7 @@ Goto [Settings -> Languages & Frameworks -> ANTLR v4
default project settings](j

-## 28. [Other] Why is the database sharding result not correct when using
`Proxool`?
+## [Other] Why is the database sharding result not correct when using
`Proxool`?
Answer:
@@ -342,7 +348,7 @@ The followings are core codes from ProxoolDataSource
getConnection method in `Pr
For more alias usages, please refer to
[Proxool](http://proxool.sourceforge.net/configure.html) official website.
-## 29. [Other] The property settings in the configuration file do not take
effect when integrating ShardingSphere with Spring Boot 2.x ?
+## [Other] The property settings in the configuration file do not take effect
when integrating ShardingSphere with Spring Boot 2.x ?
Answer:
@@ -384,4 +390,4 @@ Caused by: java.lang.NullPointerException: Inline sharding
algorithm expression
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:431)
...
```
-From the exception stack, the
`AbstractAlgorithmProvidedBeanRegistry.registerBean` method calls
`PropertyUtil.containPropertyPrefix (environment, prefix)` , and
`PropertyUtil.containPropertyPrefix (environment, prefix)` determines that the
configuration of the specified prefix does not exist, while the method uses
Binder in an unsatisfied property name (such as camelcase or underscore)
causing property settings does not to take effect.
\ No newline at end of file
+From the exception stack, the
`AbstractAlgorithmProvidedBeanRegistry.registerBean` method calls
`PropertyUtil.containPropertyPrefix (environment, prefix)` , and
`PropertyUtil.containPropertyPrefix (environment, prefix)` determines that the
configuration of the specified prefix does not exist, while the method uses
Binder in an unsatisfied property name (such as camelcase or underscore)
causing property settings does not to take effect.