@@ -6,8 +6,9 @@ use tracing::{info, warn};
66
77use crate :: sharding:: ShardedSchema ;
88use crate :: {
9- EnumeratedDatabase , Memory , OmnishardedTable , PassthoughAuth , PreparedStatements ,
10- QueryParserEngine , QueryParserLevel , ReadWriteSplit , RewriteMode , Role ,
9+ system_catalogs, EnumeratedDatabase , Memory , OmnishardedTable , PassthoughAuth ,
10+ PreparedStatements , QueryParserEngine , QueryParserLevel , ReadWriteSplit , RewriteMode , Role ,
11+ SystemCatalogsBehavior ,
1112} ;
1213
1314use super :: database:: Database ;
@@ -249,32 +250,19 @@ impl Config {
249250
250251 // Automatically configure system catalogs
251252 // as omnisharded.
252- if self . general . system_catalogs_omnisharded {
253+ if self . general . system_catalogs != SystemCatalogsBehavior :: Sharded {
254+ let sticky_routing = matches ! (
255+ self . general. system_catalogs,
256+ SystemCatalogsBehavior :: OmnishardedSticky
257+ ) ;
253258 for database in databases {
254259 let entry = tables. entry ( database) . or_insert_with ( Vec :: new) ;
255260
256- for table in [
257- "pg_class" ,
258- "pg_attribute" ,
259- "pg_attrdef" ,
260- "pg_index" ,
261- "pg_constraint" ,
262- "pg_namespace" ,
263- "pg_database" ,
264- "pg_tablespace" ,
265- "pg_type" ,
266- "pg_proc" ,
267- "pg_operator" ,
268- "pg_cast" ,
269- "pg_enum" ,
270- "pg_range" ,
271- "pg_authid" ,
272- "pg_am" ,
273- ] {
274- if entry. iter ( ) . find ( |t| t. name == table) . is_none ( ) {
261+ for table in system_catalogs ( ) {
262+ if entry. iter ( ) . find ( |t| t. name == * table) . is_none ( ) {
275263 entry. push ( OmnishardedTable {
276264 name : table. to_string ( ) ,
277- sticky_routing : true ,
265+ sticky_routing,
278266 } ) ;
279267 }
280268 }
@@ -765,7 +753,7 @@ password = "users_admin_password"
765753[general]
766754host = "0.0.0.0"
767755port = 6432
768- system_catalogs_omnisharded = false
756+ system_catalogs = "sharded"
769757
770758[[databases]]
771759name = "db1"
@@ -821,7 +809,7 @@ tables = ["table_x"]
821809[general]
822810host = "0.0.0.0"
823811port = 6432
824- system_catalogs_omnisharded = true
812+ system_catalogs = "omnisharded_sticky"
825813
826814[[databases]]
827815name = "db1"
@@ -848,12 +836,12 @@ tables = ["my_table"]
848836 let pg_class = db1_tables. iter ( ) . find ( |t| t. name == "pg_class" ) . unwrap ( ) ;
849837 assert ! ( pg_class. sticky_routing) ;
850838
851- // Test with system_catalogs_omnisharded = false
839+ // Test with system_catalogs = "sharded" (no omnisharding)
852840 let source_disabled = r#"
853841[general]
854842host = "0.0.0.0"
855843port = 6432
856- system_catalogs_omnisharded = false
844+ system_catalogs = "sharded"
857845
858846[[databases]]
859847name = "db1"
0 commit comments