Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
a3b9039f
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
a3b9039f
编写于
4月 15, 2020
作者:
J
Juan Pan(Trista)
提交者:
GitHub
4月 15, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Provide inline implement for standard algorithm (#5195)
* Provide inline implement for standard algorithm * fix
上级
5560b579
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
273 addition
and
73 deletion
+273
-73
examples/docker/sharding-proxy/sharding/conf/config-sharding.yaml
.../docker/sharding-proxy/sharding/conf/config-sharding.yaml
+10
-4
sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/sharding/InlineShardingAlgorithm.java
...phere/core/strategy/sharding/InlineShardingAlgorithm.java
+78
-0
sharding-core/sharding-core-common/src/main/resources/META-INF/services/org.apache.shardingsphere.spi.algorithm.ShardingAlgorithm
...org.apache.shardingsphere.spi.algorithm.ShardingAlgorithm
+18
-0
sharding-core/sharding-core-common/src/test/java/org/apache/shardingsphere/core/yaml/engine/YamlEngineShadowShardingConfigurationTest.java
...aml/engine/YamlEngineShadowShardingConfigurationTest.java
+3
-2
sharding-core/sharding-core-common/src/test/java/org/apache/shardingsphere/core/yaml/engine/YamlEngineShardingConfigurationTest.java
...core/yaml/engine/YamlEngineShardingConfigurationTest.java
+3
-2
sharding-core/sharding-core-common/src/test/resources/yaml/shadow-sharding-rule.yaml
...-common/src/test/resources/yaml/shadow-sharding-rule.yaml
+10
-4
sharding-core/sharding-core-common/src/test/resources/yaml/sharding-rule.yaml
...ng-core-common/src/test/resources/yaml/sharding-rule.yaml
+10
-4
sharding-core/sharding-core-rewrite/src/test/resources/yaml/mix/query-with-cipher.yaml
...ewrite/src/test/resources/yaml/mix/query-with-cipher.yaml
+15
-6
sharding-core/sharding-core-rewrite/src/test/resources/yaml/mix/query-with-plain.yaml
...rewrite/src/test/resources/yaml/mix/query-with-plain.yaml
+15
-6
sharding-core/sharding-core-rewrite/src/test/resources/yaml/sharding/sharding-rule.yaml
...write/src/test/resources/yaml/sharding/sharding-rule.yaml
+10
-4
sharding-integration-test/sharding-jdbc-test/src/test/resources/integrate/env/shadow/sharding-rule.yaml
...rc/test/resources/integrate/env/shadow/sharding-rule.yaml
+10
-4
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
...aml/integrate/sharding/configWithDataSourceWithProps.yaml
+10
-4
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
.../integrate/sharding/configWithDataSourceWithoutProps.yaml
+11
-5
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
.../integrate/sharding/configWithoutDataSourceWithProps.yaml
+10
-4
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
...tegrate/sharding/configWithoutDataSourceWithoutProps.yaml
+10
-4
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithProps.yaml
.../integrate/sharding_ms/configWithDataSourceWithProps.yaml
+10
-4
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutProps.yaml
...tegrate/sharding_ms/configWithDataSourceWithoutProps.yaml
+10
-4
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithoutProps.yaml
...rate/sharding_ms/configWithoutDataSourceWithoutProps.yaml
+10
-4
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/unit/sharding.yaml
...-orchestration/src/test/resources/yaml/unit/sharding.yaml
+20
-8
未找到文件。
examples/docker/sharding-proxy/sharding/conf/config-sharding.yaml
浏览文件 @
a3b9039f
...
...
@@ -50,16 +50,22 @@ shardingRule:
t_order
:
actualDataNodes
:
ds_${0..1}.t_order_${0..1}
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_${order_id % 2}
keyGeneratorColumnName
:
order_id
t_order_item
:
actualDataNodes
:
ds_${0..1}.t_order_item_${0..1}
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_item_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_item_${order_id % 2}
keyGeneratorColumnName
:
order_item_id
bindingTables
:
-
t_order,t_order_item
...
...
sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/sharding/InlineShardingAlgorithm.java
0 → 100644
浏览文件 @
a3b9039f
/*
* 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.core.strategy.sharding
;
import
com.google.common.base.Preconditions
;
import
groovy.lang.Closure
;
import
groovy.util.Expando
;
import
org.apache.shardingsphere.api.sharding.standard.PreciseShardingValue
;
import
org.apache.shardingsphere.api.sharding.standard.RangeShardingValue
;
import
org.apache.shardingsphere.api.sharding.standard.StandardShardingAlgorithm
;
import
org.apache.shardingsphere.underlying.common.config.inline.InlineExpressionParser
;
import
java.util.Collection
;
import
java.util.Properties
;
/**
* Inline sharding algorithm.
*/
public
final
class
InlineShardingAlgorithm
implements
StandardShardingAlgorithm
<
Comparable
<?>>
{
private
static
final
String
ALLOW_RANGE_QUERY
=
"allow.range.query.with.inline.sharding"
;
private
static
final
String
ALGORITHM_EXPRESSION
=
"algorithm.expression"
;
private
Properties
properties
=
new
Properties
();
@Override
public
String
doSharding
(
final
Collection
<
String
>
availableTargetNames
,
final
PreciseShardingValue
<
Comparable
<?>>
shardingValue
)
{
Preconditions
.
checkNotNull
(
properties
.
get
(
ALGORITHM_EXPRESSION
),
"Inline sharding algorithm expression cannot be null."
);
Closure
<?>
closure
=
new
InlineExpressionParser
(
properties
.
get
(
ALGORITHM_EXPRESSION
).
toString
()).
evaluateClosure
();
Closure
<?>
result
=
closure
.
rehydrate
(
new
Expando
(),
null
,
null
);
result
.
setResolveStrategy
(
Closure
.
DELEGATE_ONLY
);
result
.
setProperty
(
shardingValue
.
getColumnName
(),
shardingValue
.
getValue
());
return
result
.
call
().
toString
();
}
@Override
public
Collection
<
String
>
doSharding
(
final
Collection
<
String
>
availableTargetNames
,
final
RangeShardingValue
<
Comparable
<?>>
shardingValue
)
{
if
(
isAllowRangeQuery
())
{
return
availableTargetNames
;
}
throw
new
UnsupportedOperationException
(
"Since the property of `allow.range.query.with.inline.sharding` is false, inline sharding algorithm can not tackle with range query."
);
}
private
boolean
isAllowRangeQuery
()
{
return
null
!=
properties
.
get
(
ALLOW_RANGE_QUERY
)
&&
Boolean
.
parseBoolean
(
properties
.
get
(
ALLOW_RANGE_QUERY
).
toString
());
}
@Override
public
String
getType
()
{
return
"INLINE"
;
}
@Override
public
Properties
getProperties
()
{
return
properties
;
}
@Override
public
void
setProperties
(
final
Properties
properties
)
{
this
.
properties
=
properties
;
}
}
sharding-core/sharding-core-common/src/main/resources/META-INF/services/org.apache.shardingsphere.spi.algorithm.ShardingAlgorithm
0 → 100644
浏览文件 @
a3b9039f
#
# 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.core.strategy.sharding.InlineShardingAlgorithm
sharding-core/sharding-core-common/src/test/java/org/apache/shardingsphere/core/yaml/engine/YamlEngineShadowShardingConfigurationTest.java
浏览文件 @
a3b9039f
...
...
@@ -100,8 +100,9 @@ public final class YamlEngineShadowShardingConfigurationTest {
private
void
assertTOrder
(
final
YamlRootShadowConfiguration
actual
)
{
assertThat
(
actual
.
getShadowRule
().
getShardingRule
().
getTables
().
get
(
"t_order"
).
getActualDataNodes
(),
is
(
"ds_${0..1}.t_order_${0..1}"
));
assertThat
(
actual
.
getShadowRule
().
getShardingRule
().
getTables
().
get
(
"t_order"
).
getTableStrategy
().
getInline
().
getShardingColumn
(),
is
(
"order_id"
));
assertThat
(
actual
.
getShadowRule
().
getShardingRule
().
getTables
().
get
(
"t_order"
).
getTableStrategy
().
getInline
().
getAlgorithmExpression
(),
is
(
"t_order_${order_id % 2}"
));
assertThat
(
actual
.
getShadowRule
().
getShardingRule
().
getTables
().
get
(
"t_order"
).
getTableStrategy
().
getStandard
().
getShardingColumn
(),
is
(
"order_id"
));
assertThat
(
actual
.
getShadowRule
().
getShardingRule
().
getTables
().
get
(
"t_order"
).
getTableStrategy
().
getStandard
().
getShardingAlgorithm
().
getProps
().
getProperty
(
"algorithm.expression"
),
is
(
"t_order_${order_id % 2}"
));
assertThat
(
actual
.
getShadowRule
().
getShardingRule
().
getTables
().
get
(
"t_order"
).
getKeyGenerator
().
getColumn
(),
is
(
"order_id"
));
assertThat
(
actual
.
getShadowRule
().
getShardingRule
().
getTables
().
get
(
"t_order"
).
getKeyGenerator
().
getType
(),
is
(
"SNOWFLAKE"
));
}
...
...
sharding-core/sharding-core-common/src/test/java/org/apache/shardingsphere/core/yaml/engine/YamlEngineShardingConfigurationTest.java
浏览文件 @
a3b9039f
...
...
@@ -99,8 +99,9 @@ public final class YamlEngineShardingConfigurationTest {
private
void
assertTOrder
(
final
YamlRootShardingConfiguration
actual
)
{
assertThat
(
actual
.
getShardingRule
().
getTables
().
get
(
"t_order"
).
getActualDataNodes
(),
is
(
"ds_${0..1}.t_order_${0..1}"
));
assertThat
(
actual
.
getShardingRule
().
getTables
().
get
(
"t_order"
).
getTableStrategy
().
getInline
().
getShardingColumn
(),
is
(
"order_id"
));
assertThat
(
actual
.
getShardingRule
().
getTables
().
get
(
"t_order"
).
getTableStrategy
().
getInline
().
getAlgorithmExpression
(),
is
(
"t_order_${order_id % 2}"
));
assertThat
(
actual
.
getShardingRule
().
getTables
().
get
(
"t_order"
).
getTableStrategy
().
getStandard
().
getShardingColumn
(),
is
(
"order_id"
));
assertThat
(
actual
.
getShardingRule
().
getTables
().
get
(
"t_order"
).
getTableStrategy
().
getStandard
().
getShardingAlgorithm
().
getProps
().
getProperty
(
"algorithm.expression"
),
is
(
"t_order_${order_id % 2}"
));
assertThat
(
actual
.
getShardingRule
().
getTables
().
get
(
"t_order"
).
getKeyGenerator
().
getColumn
(),
is
(
"order_id"
));
assertThat
(
actual
.
getShardingRule
().
getTables
().
get
(
"t_order"
).
getKeyGenerator
().
getType
(),
is
(
"SNOWFLAKE"
));
}
...
...
sharding-core/sharding-core-common/src/test/resources/yaml/shadow-sharding-rule.yaml
浏览文件 @
a3b9039f
...
...
@@ -92,9 +92,12 @@ shadowRule:
t_order
:
actualDataNodes
:
ds_${0..1}.t_order_${0..1}
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_${order_id % 2}
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_id
...
...
@@ -112,9 +115,12 @@ shadowRule:
broadcastTables
:
-
t_config
defaultDatabaseStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
ds_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
ds_${order_id % 2}
defaultTableStrategy
:
none
:
masterSlaveRules
:
...
...
sharding-core/sharding-core-common/src/test/resources/yaml/sharding-rule.yaml
浏览文件 @
a3b9039f
...
...
@@ -79,9 +79,12 @@ shardingRule:
t_order
:
actualDataNodes
:
ds_${0..1}.t_order_${0..1}
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_${order_id % 2}
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_id
...
...
@@ -99,9 +102,12 @@ shardingRule:
broadcastTables
:
-
t_config
defaultDatabaseStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
ds_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
ds_${order_id % 2}
defaultTableStrategy
:
none
:
masterSlaveRules
:
...
...
sharding-core/sharding-core-rewrite/src/test/resources/yaml/mix/query-with-cipher.yaml
浏览文件 @
a3b9039f
...
...
@@ -27,27 +27,36 @@ shardingRule:
t_account
:
actualDataNodes
:
db.t_account_${0..1}
tableStrategy
:
inline
:
standard
:
shardingColumn
:
account_id
algorithmExpression
:
t_account_${account_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_account_${account_id % 2}
keyGenerator
:
type
:
TEST
column
:
account_id
t_account_bak
:
actualDataNodes
:
db.t_account_bak_${0..1}
tableStrategy
:
inline
:
standard
:
shardingColumn
:
account_id
algorithmExpression
:
t_account_bak_${account_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_account_bak_${account_id % 2}
keyGenerator
:
type
:
TEST
column
:
account_id
t_account_detail
:
actualDataNodes
:
db.t_account_detail_${0..1}
tableStrategy
:
inline
:
standard
:
shardingColumn
:
account_id
algorithmExpression
:
t_account_${account_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_account_${account_id % 2}
bindingTables
:
-
t_account, t_account_detail
...
...
sharding-core/sharding-core-rewrite/src/test/resources/yaml/mix/query-with-plain.yaml
浏览文件 @
a3b9039f
...
...
@@ -27,27 +27,36 @@ shardingRule:
t_account
:
actualDataNodes
:
db.t_account_${0..1}
tableStrategy
:
inline
:
standard
:
shardingColumn
:
account_id
algorithmExpression
:
t_account_${account_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_account_${account_id % 2}
keyGenerator
:
type
:
TEST
column
:
account_id
t_account_bak
:
actualDataNodes
:
db.t_account_bak_${0..1}
tableStrategy
:
inline
:
standard
:
shardingColumn
:
account_id
algorithmExpression
:
t_account_bak_${account_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_account_bak_${account_id % 2}
keyGenerator
:
type
:
TEST
column
:
account_id
t_account_detail
:
actualDataNodes
:
db.t_account_detail_${0..1}
tableStrategy
:
inline
:
standard
:
shardingColumn
:
account_id
algorithmExpression
:
t_account_${account_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_account_${account_id % 2}
bindingTables
:
-
t_account, t_account_detail
...
...
sharding-core/sharding-core-rewrite/src/test/resources/yaml/sharding/sharding-rule.yaml
浏览文件 @
a3b9039f
...
...
@@ -27,17 +27,23 @@ shardingRule:
t_account
:
actualDataNodes
:
db.t_account_${0..1}
tableStrategy
:
inline
:
standard
:
shardingColumn
:
account_id
algorithmExpression
:
t_account_${account_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_account_${account_id % 2}
keyGenerator
:
type
:
TEST
column
:
account_id
t_account_detail
:
actualDataNodes
:
db.t_account_detail_${0..1}
tableStrategy
:
inline
:
standard
:
shardingColumn
:
account_id
algorithmExpression
:
t_account_detail_${account_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_account_detail_${account_id % 2}
bindingTables
:
-
t_account, t_account_detail
sharding-integration-test/sharding-jdbc-test/src/test/resources/integrate/env/shadow/sharding-rule.yaml
浏览文件 @
a3b9039f
...
...
@@ -24,13 +24,19 @@ shadowRule:
t_order_item
:
actualDataNodes
:
db.t_order_item
databaseStrategy
:
inline
:
standard
:
shardingColumn
:
item_id
algorithmExpression
:
db
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
db
tableStrategy
:
inline
:
standard
:
shardingColumn
:
item_id
algorithmExpression
:
t_order_item
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_item
keyGenerator
:
type
:
Constant
column
:
item_id
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
浏览文件 @
a3b9039f
...
...
@@ -42,9 +42,12 @@ shardingRule:
shardingAlgorithm
:
type
:
STANDARD_TEST
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_${order_id % 2}
keyGenerator
:
type
:
INCREMENT
column
:
order_id
...
...
@@ -56,9 +59,12 @@ shardingRule:
shardingAlgorithm
:
type
:
STANDARD_TEST
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_item_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_item_${order_id % 2}
bindingTables
:
-
t_order,t_order_item
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
浏览文件 @
a3b9039f
...
...
@@ -41,10 +41,13 @@ shardingRule:
shardingColumn
:
user_id
shardingAlgorithm
:
type
:
STANDARD_TEST
tableStrategy
:
inline
:
tableStrategy
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_${order_id % 2}
keyGenerator
:
type
:
INCREMENT
column
:
order_id
...
...
@@ -56,9 +59,12 @@ shardingRule:
shardingAlgorithm
:
type
:
STANDARD_TEST
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_item_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_${order_id % 2}
bindingTables
:
-
t_order,t_order_item
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
浏览文件 @
a3b9039f
...
...
@@ -28,9 +28,12 @@ shardingRule:
shardingAlgorithm
:
type
:
STANDARD_TEST
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_${order_id % 2}
keyGenerator
:
type
:
INCREMENT
column
:
order_id
...
...
@@ -42,9 +45,12 @@ shardingRule:
shardingAlgorithm
:
type
:
STANDARD_TEST
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_item_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_item_${order_id % 2}
bindingTables
:
-
t_order,t_order_item
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
浏览文件 @
a3b9039f
...
...
@@ -27,9 +27,12 @@ shardingRule:
shardingAlgorithm
:
type
:
STANDARD_TEST
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_${order_id % 2}
keyGenerator
:
type
:
INCREMENT
column
:
order_id
...
...
@@ -41,9 +44,12 @@ shardingRule:
shardingAlgorithm
:
type
:
STANDARD_TEST
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_item_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_item_${order_id % 2}
bindingTables
:
-
t_order,t_order_item
defaultDatabaseStrategy
:
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithProps.yaml
浏览文件 @
a3b9039f
...
...
@@ -54,9 +54,12 @@ shardingRule:
shardingAlgorithm
:
type
:
STANDARD_TEST
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_${order_id % 2}
keyGenerator
:
type
:
INCREMENT
column
:
order_id
...
...
@@ -68,9 +71,12 @@ shardingRule:
shardingAlgorithm
:
type
:
STANDARD_TEST
tableStrategy
:
inline
:
standard
:
shardingColumn
:
id
algorithmExpression
:
t_order_item_${id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_item_${id % 2}
bindingTables
:
-
t_order,t_order_item
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutProps.yaml
浏览文件 @
a3b9039f
...
...
@@ -54,9 +54,12 @@ shardingRule:
shardingAlgorithm
:
type
:
STANDARD_TEST
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_${order_id % 2}
keyGenerator
:
type
:
INCREMENT
column
:
order_id
...
...
@@ -68,9 +71,12 @@ shardingRule:
shardingAlgorithm
:
type
:
STANDARD_TEST
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_item_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_item_${order_id % 2}
bindingTables
:
-
t_order,t_order_item
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithoutProps.yaml
浏览文件 @
a3b9039f
...
...
@@ -28,9 +28,12 @@ shardingRule:
shardingAlgorithm
:
type
:
STANDARD_TEST
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_${order_id % 2}
keyGenerator
:
type
:
INCREMENT
column
:
order_id
...
...
@@ -42,9 +45,12 @@ shardingRule:
shardingAlgorithm
:
type
:
STANDARD_TEST
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_item_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_item_${order_id % 2}
bindingTables
:
-
t_order,t_order_item
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/unit/sharding.yaml
浏览文件 @
a3b9039f
...
...
@@ -32,13 +32,19 @@ shardingRule:
t_order
:
actualDataNodes
:
ds_ms.t_order_${0..1}
databaseStrategy
:
inline
:
standard
:
shardingColumn
:
user_id
algorithmExpression
:
t_order_${user_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_${user_id % 2}
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_${order_id % 2}
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_id
...
...
@@ -47,9 +53,12 @@ shardingRule:
t_order_item
:
actualDataNodes
:
ds_ms.t_order_item_${0..1}
tableStrategy
:
inline
:
standard
:
shardingColumn
:
order_id
algorithmExpression
:
t_order_item_${order_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
t_order_item_${order_id % 2}
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_item_id
...
...
@@ -63,9 +72,12 @@ shardingRule:
slaveDataSourceNames
:
-
ds_s
defaultDatabaseStrategy
:
inline
:
standard
:
shardingColumn
:
user_id
algorithmExpression
:
ds_ms_${user_id % 2}
shardingAlgorithm
:
type
:
INLINE
props
:
algorithm.expression
:
ds_ms_${user_id % 2}
defaultTableStrategy
:
none
:
props
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录