Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): add sharding docs #334

Merged
merged 8 commits into from
Sep 26, 2022
7 changes: 4 additions & 3 deletions docs/docs/Features/sharding.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ SELECT order_id FROM order.t_order WHERE order_id = 1;
```
SELECT order_id FROM order.t_order_00001 WHERE order_id = 1;
```

**特别说明: SQL rewrite 在修改标识符计算实际表名时会自动根据分片规则添加表索引,索引规则位 表名_索引,索引位为5位表示。例如:`t_order` 表改写后为 `t_order_00000`。因此用户需要根据实际业务场景先创建好对应的表名**

#### 2. 补列
需要在查询语句中补列通常由两种情况导致。 第一种情况是 Pisa-Proxy 需要在结果归并时获取相应数据,但该数据并未能通过查询的SQL返回。 这种情况主要是针对 GROUP BY 和 ORDER BY。结果归并时,需要根据 GROUP BY 和 ORDER BY 的字段项进行分组和排序,但如果原始SQL的选择项中若并未包含分组项或排序项,则需要对原始SQL进行改写。
例如有以下 SQL 语句:
Expand Down Expand Up @@ -82,6 +85,4 @@ SELECT COUNT(price) AS AVG_DERIVED_COUNT_00000, SUM(price) AS AVG_DERIVED_SUM_00
|broadcast_tables|Vec\<String\>|否|无|暂不支持||
|table_sharding_algorithm_name|enum|是|无|分片算法|
|table_sharding_column|String|是|无|分片键|
|sharding_count|u64|是|无|分片数|


|sharding_count|u64|是|无|分片数|
22 changes: 22 additions & 0 deletions docs/docs/UseCases/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,28 @@ spec:
db: "socksdb"
```

- DataShard

```yaml
apiVersion: core.database-mesh.io/v1alpha1
kind: DataShard
metadata:
name: catalogue
namespace: demotest
labels:
source: catalogue
spec:
rules:
- tableName: "t_order"
tableStrategy:
tableShardingAlgorithmName: "mod"
tableShardingColumn: "id"
shardingCount: 4
actualDatanodes:
valueSource:
nodes:
- value: "ds001"
```

#### 应用访问数据库切换至 Pisanix

Expand Down