-
Notifications
You must be signed in to change notification settings - Fork 666
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add citus_schema_move() function (#7180)
Add citus_schema_move() that can be used to move tenant tables within a distributed schema to another node. The function has two variations as simple wrappers around citus_move_shard_placement() and citus_move_shard_placement_with_nodeid() respectively. They pick a shard that belongs to the given tenant schema and resolve the source node that contain the shards under given tenant schema. Hence their signatures are quite similar to underlying functions: ```sql -- citus_schema_move(), using target node name and node port CREATE OR REPLACE FUNCTION pg_catalog.citus_schema_move( schema_id regnamespace, target_node_name text, target_node_port integer, shard_transfer_mode citus.shard_transfer_mode default 'auto') RETURNS void LANGUAGE C STRICT AS 'MODULE_PATHNAME', $$citus_schema_move$$; -- citus_schema_move(), using target node id CREATE OR REPLACE FUNCTION pg_catalog.citus_schema_move( schema_id regnamespace, target_node_id integer, shard_transfer_mode citus.shard_transfer_mode default 'auto') RETURNS void LANGUAGE C STRICT AS 'MODULE_PATHNAME', $$citus_schema_move_with_nodeid$$; ```
- Loading branch information
1 parent
8894c76
commit d628a4c
Showing
14 changed files
with
631 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/backend/distributed/sql/udfs/citus_schema_move/12.1-1.sql
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
src/backend/distributed/sql/udfs/citus_schema_move/latest.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
-- citus_schema_move, using target node name and node port | ||
CREATE OR REPLACE FUNCTION pg_catalog.citus_schema_move( | ||
schema_id regnamespace, | ||
target_node_name text, | ||
target_node_port integer, | ||
shard_transfer_mode citus.shard_transfer_mode default 'auto') | ||
RETURNS void | ||
LANGUAGE C STRICT | ||
AS 'MODULE_PATHNAME', $$citus_schema_move$$; | ||
COMMENT ON FUNCTION pg_catalog.citus_schema_move( | ||
schema_id regnamespace, | ||
target_node_name text, | ||
target_node_port integer, | ||
shard_transfer_mode citus.shard_transfer_mode) | ||
IS 'move a distributed schema to given node'; | ||
|
||
-- citus_schema_move, using target node id | ||
CREATE OR REPLACE FUNCTION pg_catalog.citus_schema_move( | ||
schema_id regnamespace, | ||
target_node_id integer, | ||
shard_transfer_mode citus.shard_transfer_mode default 'auto') | ||
RETURNS void | ||
LANGUAGE C STRICT | ||
AS 'MODULE_PATHNAME', $$citus_schema_move_with_nodeid$$; | ||
COMMENT ON FUNCTION pg_catalog.citus_schema_move( | ||
schema_id regnamespace, | ||
target_node_id integer, | ||
shard_transfer_mode citus.shard_transfer_mode) | ||
IS 'move a distributed schema to given node'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.