1
1
pgpath=~/postgres/install/vanilla/
2
2
pathmanpath=~/postgres/pg_pathman
3
3
install_pathman=false
4
- logfile=$HOME /tmp/tmp/tmp .log
4
+ logfile=/tmp/shmn .log
5
5
6
- lord_datadir=~/postgres /data1
6
+ lord_datadir=/tmp /data1
7
7
lord_port=5432
8
8
9
9
# declare -a worker_datadirs=()
@@ -18,23 +18,51 @@ lord_port=5432
18
18
# declare -a worker_datadirs=("${HOME}/postgres/data2" "${HOME}/postgres/data3" "${HOME}/postgres/data4")
19
19
# declare -a worker_ports=("5433" "5434" "5435")
20
20
21
- declare -a worker_datadirs=("${HOME}/postgres /data2" "${HOME}/postgres /data3" "${HOME}/postgres /data4" "${HOME}/postgres /data5")
21
+ declare -a worker_datadirs=("/tmp /data2" "/tmp /data3" "/tmp /data4" "/tmp /data5")
22
22
declare -a worker_ports=("5433" "5434" "5435" "5436")
23
23
24
24
function run_demo()
25
25
{
26
26
:
27
- psql -p 5433 -c "drop table if exists pt cascade;"
28
- psql -p 5433 -c "CREATE TABLE pt(id INT NOT NULL, payload REAL);"
29
- psql -p 5433 -c "INSERT INTO pt SELECT generate_series(1, 10), random();"
30
- psql -c "select shardman.add_node('port=5433');"
31
- psql -c "select shardman.add_node('port=5434');"
32
- psql -c "select shardman.add_node('port=5435');"
33
- psql -c "select shardman.add_node('port=5436');"
34
- sleep 5
35
- psql -c "select shardman.create_hash_partitions(2, 'pt', 'id', 4, true);"
36
-
37
- # psql -c "select shardman.create_replica('pt_0', 3);"
38
- # psql -c "select shardman.create_replica('pt_0', 5);"
39
- # psql -c "select shardman.move_part('pt_0', 4, 3);"
27
+
28
+ for port in "${worker_ports[@]}" $lord_port; do
29
+ psql -p $port -c "set synchronous_commit to local; drop role if exists joe; create role joe login password '12345'; grant usage on FOREIGN DATA WRAPPER postgres_fdw to joe;"
30
+ done
31
+
32
+ psql -c "drop table if exists t cascade;"
33
+ psql -c "CREATE TABLE t(i int);"
34
+ psql -c "drop table if exists t cascade;"
35
+ psql -c "CREATE TABLE t(i int);"
36
+
37
+
38
+ psql -c "drop table if exists pt cascade;"
39
+ psql -c "CREATE TABLE pt(id INT primary key, payload REAL);"
40
+ psql -c "INSERT INTO pt SELECT generate_series(1, 10), random();"
41
+
42
+ psql -c "select shardman.add_node('port=5433', conn_string => 'user=joe password=12345 dbname=ars port=5433');"
43
+ psql -c "select shardman.add_node('port=5434', conn_string => 'user=joe password=12345 dbname=ars port=5434');"
44
+ psql -c "select shardman.add_node('port=5435', conn_string => 'user=joe password=12345 dbname=ars port=5435');"
45
+ psql -c "select shardman.add_node('port=5436', conn_string => 'user=joe password=12345 dbname=ars port=5436');"
46
+
47
+ psql -c "select shardman.create_hash_partitions('pt', 'id', 4);"
48
+ psql -c "select shardman.set_redundancy('pt', 2);"
49
+
50
+ # psql -c "select shardman.create_hash_partitions(2, 'pt', 'id', 4, true);"
51
+ # psql -c "select shardman.set_replevel('pt', 1);"
52
+
53
+ # psql -c "drop table if exists pgbench_accounts cascade";
54
+ # psql -c "drop table if exists pgbench_tellers cascade";
55
+ # psql -c "drop table if exists pgbench_branches cascade";
56
+ # psql -c "drop table if exists pgbench_tellers cascade;"
57
+ # psql -c "drop table if exists pgbench_accounts cascade;"
58
+ # pgbench -s 5 -i
59
+ # psql -c "select shardman.create_hash_partitions(2, 'pgbench_accounts', 'aid', 4);"
60
+ # psql -c "select shardman.set_replevel('pgbench_accounts', 1);"
61
+ # psql -c "select shardman.create_hash_partitions(2, 'pgbench_tellers', 'tid', 10);"
62
+ # psql -c "select shardman.set_replevel('pgbench_tellers', 1);"
63
+ # psql -c "select shardman.create_hash_partitions(2, 'pgbench_branches', 'bid', 10);"
64
+ # psql -c "select shardman.set_replevel('pgbench_branches', 1);"
65
+ # for port in "${worker_ports[@]}"; do
66
+ # psql -p $port -f /home/ars/postgres/pg_shardman/bin/pgbench_history.sql
67
+ # done
40
68
}
0 commit comments