Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f532cf5

Browse files
committed
Massive renames.
Preparing for replica addition and move.
1 parent d46fe6e commit f532cf5

File tree

5 files changed

+296
-243
lines changed

5 files changed

+296
-243
lines changed

bin/common.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ function restart_nodes()
5757

5858
function run_demo()
5959
{
60-
psql -p 5433 -c "drop table if exists partitioned_table cascade;"
61-
psql -p 5433 -c "CREATE TABLE partitioned_table(id INT NOT NULL, payload REAL);"
62-
psql -p 5433 -c "INSERT INTO partitioned_table SELECT generate_series(1, 1000), random();"
60+
psql -p 5433 -c "drop table if exists pt cascade;"
61+
psql -p 5433 -c "CREATE TABLE pt(id INT NOT NULL, payload REAL);"
62+
psql -p 5433 -c "INSERT INTO pt SELECT generate_series(1, 1000), random();"
6363
psql -c "select shardman.add_node('port=5433');"
6464
psql -c "select shardman.add_node('port=5434');"
65-
psql -c "select shardman.create_hash_partitions(2, 'partitioned_table', 'id', 2);"
65+
psql -c "select shardman.create_hash_partitions(2, 'pt', 'id', 2);"
6666
}

pg_shardman--0.0.1.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ INSERT INTO @extschema@.local_meta VALUES ('node_id', NULL);
306306

307307
-- available commands
308308
CREATE TYPE cmd AS ENUM ('add_node', 'rm_node', 'create_hash_partitions',
309-
'move_mpart');
309+
'move_primary');
310310
-- command status
311311
CREATE TYPE cmd_status AS ENUM ('waiting', 'canceled', 'failed', 'in progress',
312312
'success');
@@ -673,11 +673,11 @@ $$ LANGUAGE plpgsql;
673673
-- Move master partition to another node. Params:
674674
-- 'part_name' is name of the partition to move
675675
-- 'dest' is id of the destination node
676-
CREATE FUNCTION move_mpart(part_name text, dest int) RETURNS int AS $$
676+
CREATE FUNCTION move_primary(part_name text, dest int) RETURNS int AS $$
677677
DECLARE
678678
c_id int;
679679
BEGIN
680-
INSERT INTO @extschema@.cmd_log VALUES (DEFAULT, 'move_mpart')
680+
INSERT INTO @extschema@.cmd_log VALUES (DEFAULT, 'move_primary')
681681
RETURNING id INTO c_id;
682682
INSERT INTO @extschema@.cmd_opts VALUES (DEFAULT, c_id, part_name);
683683
INSERT INTO @extschema@.cmd_opts VALUES (DEFAULT, c_id, dest);

src/include/shard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
#include "pg_shardman.h"
55

66
extern void create_hash_partitions(Cmd *cmd);
7-
extern void move_mpart(Cmd *cmd);
7+
extern void move_primary(Cmd *cmd);
88

99
#endif /* SHARD_H */

src/pg_shardman.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ shardmaster_main(Datum main_arg)
194194
rm_node(cmd);
195195
else if (strcmp(cmd->cmd_type, "create_hash_partitions") == 0)
196196
create_hash_partitions(cmd);
197-
else if (strcmp(cmd->cmd_type, "move_mpart") == 0)
198-
move_mpart(cmd);
197+
else if (strcmp(cmd->cmd_type, "move_primary") == 0)
198+
move_primary(cmd);
199199
else
200200
shmn_elog(FATAL, "Unknown cmd type %s", cmd->cmd_type);
201201
}

0 commit comments

Comments
 (0)