Skip to content

Commit 1dea9c1

Browse files
wbtlbwangbo
andauthored
feat(pisa-controller): add database table strategy config (#382)
* feat(pisa-controller): add database table config Signed-off-by: wangbo <wangbo@sphere-ex.com> * delete: delete unuse file Signed-off-by: wangbo <wangbo@sphere-ex.com> Signed-off-by: wangbo <wangbo@sphere-ex.com> Co-authored-by: wangbo <wangbo@sphere-ex.com>
1 parent f3fb9af commit 1dea9c1

File tree

4 files changed

+51
-3
lines changed

4 files changed

+51
-3
lines changed

pisa-controller/pkg/proxy/builder.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,19 @@ func (b *ProxyBuilder) Build() *Proxy {
302302
}
303303
case r.DatabaseStrategy != nil:
304304
s.DatabaseStrategy = (*DatabaseStrategy)(r.DatabaseStrategy)
305-
306-
// TODO: add DatabaseTableStrategy
305+
case r.DatabaseTableStrategy != nil:
306+
s.DatabaseTableStrategy = &DatabaseTableStrategy {
307+
TableStrategy {
308+
TableShardingAlgorithmName: r.DatabaseTableStrategy.TableShardingAlgorithmName,
309+
TableShardingColumn: r.DatabaseTableStrategy.TableShardingColumn,
310+
ShardingCount: r.DatabaseTableStrategy.ShardingCount,
311+
},
312+
DatabaseStrategy {
313+
DatabaseShardingAlgorithmName: r.DatabaseTableStrategy.DatabaseShardingAlgorithmName,
314+
DatabaseShardingColumn: r.DatabaseTableStrategy.DatabaseShardingColumn,
315+
316+
},
317+
}
307318
}
308319

309320
actualNodes := []string{}

pisa-daemon/Cargo.lock

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pisa-proxy/Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pisa-proxy/proxy/strategy/src/sharding_rewrite/generic_meta.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl ShardingMeta for StrategyType {
159159
unimplemented!()
160160
}
161161

162-
Self::DatabaseTableStrategyConfig(config) => (None, Some(config.shading_count.into())),
162+
Self::DatabaseTableStrategyConfig(config) => (None, Some(config.sharding_count.into())),
163163

164164
Self::TableStrategyConfig(config) => (None, Some(config.sharding_count.into())),
165165

0 commit comments

Comments
 (0)