Thu Mar 5 14:37:25 PST 2009
- Previous message: [Slony1-commit] slony1-engine/src/backend slony1_funcs.sql
- Next message: [Slony1-commit] slony1-engine/src/slonik slonik.c
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /home/cvsd/slony1/slony1-engine/src/ducttape In directory main.slony.info:/tmp/cvs-serv5923/src/ducttape Modified Files: Tag: REL_1_2_STABLE test_2_pgbench.in Log Message: Fixed a problem where slonik cannot perform a failover if multiple origins fail at once. Jan Index: test_2_pgbench.in =================================================================== RCS file: /home/cvsd/slony1/slony1-engine/src/ducttape/test_2_pgbench.in,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -d -r1.2 -r1.2.2.1 *** test_2_pgbench.in 1 Jun 2006 12:35:52 -0000 1.2 --- test_2_pgbench.in 5 Mar 2009 22:37:23 -0000 1.2.2.1 *************** *** 13,19 **** # - starts the second replication daemon # - creates the pgbench tables (schema only) ! # - subscribes the replication set from the primary node ! # - creates a 3rd database node similar that replicates # cascaded from the second node. # - waits until the pgbench is terminated and the user # stopped all 3 replication engines. --- 13,20 ---- # - starts the second replication daemon # - creates the pgbench tables (schema only) ! # - creates a 3rd database node similar that will replicate # cascaded from the second node. + # - subscribes the replication set to node 2 + # - subscribes the replication set to node 3 # - waits until the pgbench is terminated and the user # stopped all 3 replication engines. *************** *** 30,36 **** DB2=slony_test2 DB3=slony_test3 DEBUG_LEVEL=2 ! PGBENCH_SCALE=10 PGBENCH_CLIENTS=5 PGBENCH_TRANS=`expr 50000 / $PGBENCH_CLIENTS` --- 31,38 ---- DB2=slony_test2 DB3=slony_test3 + DB4=slony_test4 DEBUG_LEVEL=2 ! PGBENCH_SCALE=2 PGBENCH_CLIENTS=5 PGBENCH_TRANS=`expr 50000 / $PGBENCH_CLIENTS` *************** *** 55,58 **** --- 57,64 ---- kill -15 $slon3_pid fi + if [ ! -z $slon4_pid ] ; then + echo "**** killing node daemon 4" + kill -15 $slon4_pid + fi exit -1 ' 2 15 *************** *** 94,97 **** --- 100,105 ---- dropdb $DB3 || echo "**** ignored" sleep 1 + dropdb $DB4 || echo "**** ignored" + sleep 1 ##### *************** *** 129,134 **** cluster name = T1; node 1 admin conninfo = 'dbname=$DB1'; ! node 2 admin conninfo = 'dbname=$DB1'; ! node 3 admin conninfo = 'dbname=$DB1'; init cluster (id = 1, comment = 'Node 1'); echo 'Database $DB1 initialized as Node 1'; --- 137,144 ---- cluster name = T1; node 1 admin conninfo = 'dbname=$DB1'; ! node 2 admin conninfo = 'dbname=$DB2'; ! node 3 admin conninfo = 'dbname=$DB3'; ! node 4 admin conninfo = 'dbname=$DB4'; ! init cluster (id = 1, comment = 'Node 1'); echo 'Database $DB1 initialized as Node 1'; *************** *** 150,153 **** --- 160,164 ---- node 2 admin conninfo = 'dbname=$DB2'; node 3 admin conninfo = 'dbname=$DB3'; + node 4 admin conninfo = 'dbname=$DB4'; try { *************** *** 219,222 **** --- 230,234 ---- node 2 admin conninfo = 'dbname=$DB2'; node 3 admin conninfo = 'dbname=$DB3'; + node 4 admin conninfo = 'dbname=$DB4'; try { *************** *** 257,282 **** cat pgbench_schema.sql ) | psql -q $DB2 - slonik <<_EOF_ - cluster name = T1; - node 1 admin conninfo = 'dbname=$DB1'; - node 2 admin conninfo = 'dbname=$DB2'; - node 3 admin conninfo = 'dbname=$DB3'; - - subscribe set ( id = 1, provider = 1, receiver = 2, forward = yes ); - _EOF_ - - echo "" - echo "**********************************************************************" - echo "**** $DB2 should now be copying data and attempting to catch up." - echo "**********************************************************************" - echo "" ###################################################################### ! # Setup DB2 as a subscriber node and let it subscribe the replication # set of the running pgbench ###################################################################### - # echo -n "**** Hit enter when node 2 is done with copy set" - # read line - sleep `expr 60 \* $PGBENCH_SCALE` echo "**** creating database for Node 3" if ! createdb $DB3 ; then --- 269,277 ---- cat pgbench_schema.sql ) | psql -q $DB2 ###################################################################### ! # Setup DB3 as a subscriber node and let it subscribe the replication # set of the running pgbench ###################################################################### echo "**** creating database for Node 3" if ! createdb $DB3 ; then *************** *** 301,305 **** store path (server = 3, client = 2, conninfo = 'dbname=$DB3'); ! echo 'Database $DB2 added as Node 2'; _EOF_ --- 296,300 ---- store path (server = 3, client = 2, conninfo = 'dbname=$DB3'); ! echo 'Database $DB3 added as Node 3'; _EOF_ *************** *** 328,335 **** # Create the pgbench tables and subscribe to set 1 ###################################################################### ! echo "**** creating pgbench tables and subscribing Node 2 to set 1" ( cat pgbench_schema.sql ) | psql -q $DB3 slonik <<_EOF_ cluster name = T1; --- 323,345 ---- # Create the pgbench tables and subscribe to set 1 ###################################################################### ! echo "**** creating pgbench tables and subscribing Node 3 to set 1" ( cat pgbench_schema.sql ) | psql -q $DB3 + + + ###################################################################### + # Setup DB4 as a subscriber node and let it subscribe the replication + # set of the running pgbench + ###################################################################### + echo "**** creating database for Node 4" + if ! createdb $DB4 ; then + kill $pgbench_pid 2>/dev/null + kill $slon1_pid 2>/dev/null + kill $slon2_pid 2>/dev/null + exit -1 + fi + + echo "**** initializing $DB4 as Node 4 of Slony-I cluster T1" slonik <<_EOF_ cluster name = T1; *************** *** 337,352 **** node 2 admin conninfo = 'dbname=$DB2'; node 3 admin conninfo = 'dbname=$DB3'; ! subscribe set ( id = 1, provider = 2, receiver = 3, forward = no ); _EOF_ echo "" echo "**********************************************************************" ! echo "**** $DB3 should now be copying data and attempting to catch up." echo "**********************************************************************" echo "" - echo -n "**** waiting for pgbench to finish " while kill -0 $pgbench_pid 2>/dev/null ; do --- 347,437 ---- node 2 admin conninfo = 'dbname=$DB2'; node 3 admin conninfo = 'dbname=$DB3'; + node 4 admin conninfo = 'dbname=$DB4'; ! store node (id = 4, comment = 'Node 4'); ! ! store path (server = 1, client = 4, conninfo = 'dbname=$DB1'); ! store path (server = 3, client = 4, conninfo = 'dbname=$DB3'); ! store path (server = 4, client = 1, conninfo = 'dbname=$DB4'); ! store path (server = 4, client = 3, conninfo = 'dbname=$DB4'); ! ! echo 'Database $DB4 added as Node 4'; ! _EOF_ ! ! if [ $? -ne 0 ] ; then ! kill $pgbench_pid 2>/dev/null ! kill $slon1_pid 2>/dev/null ! kill $slon2_pid 2>/dev/null ! kill $slon3_pid 2>/dev/null ! exit -1 ! fi ! ! echo "**** starting the Slony-I node daemon for $DB4" ! $TERMPROG -title "Slon node 4" -e sh -c "slon -d$DEBUG_LEVEL T1 dbname=$DB4; echo -n 'Enter>'; read line" & ! slon4_pid=$! ! echo "slon[$slon4_pid] on dbname=$DB4" ! ! ##### ! # Check that pgbench is still running ! ##### ! if ! kill -0 $pgbench_pid 2>/dev/null ; then ! echo "**** pgbench terminated ???" ! kill $slon1_pid 2>/dev/null ! kill $slon2_pid 2>/dev/null ! kill $slon3_pid 2>/dev/null ! kill $slon4_pid 2>/dev/null ! exit -1 ! fi ! ! ###################################################################### ! # Create the pgbench tables and subscribe to set 1 ! ###################################################################### ! echo "**** creating pgbench tables and subscribing Node 4 to set 1" ! ( ! cat pgbench_schema.sql ! ) | psql -q $DB4 ! ! ! ###################################################################### ! # Now subscribe both nodes and use WAIT properly ! ###################################################################### ! slonik <<_EOF_ ! cluster name = T1; ! node 1 admin conninfo = 'dbname=$DB1'; ! node 2 admin conninfo = 'dbname=$DB2'; ! node 3 admin conninfo = 'dbname=$DB3'; ! node 4 admin conninfo = 'dbname=$DB4'; ! ! echo 'Subscribing node 2'; ! subscribe set ( id = 1, provider = 1, receiver = 2, forward = yes ); ! echo 'Generating SYNC on Origin and waiting for that'; ! sync (id = 1); ! wait for event (origin = 1, confirmed = all, wait on = 2, timeout = 0); ! echo 'Subscription of node 2 complete'; ! ! echo 'Subscribing node 3'; ! subscribe set ( id = 1, provider = 2, receiver = 3, forward = yes ); ! echo 'Waiting for SUBSCRIBE_SET to arrive at 1'; ! wait for event (origin = 2, confirmed = all, wait on = 1, timeout = 0); ! echo 'Generating SYNC on Origin and waiting for that'; ! sync (id = 1); ! wait for event (origin = 1, confirmed = all, wait on = 3, timeout = 0); ! ! echo 'Subscribing node 4'; ! subscribe set ( id = 1, provider = 3, receiver = 4, forward = no ); ! echo 'Waiting for SUBSCRIBE_SET to arrive at 1'; ! wait for event (origin = 3, confirmed = all, wait on = 1, timeout = 0); ! echo 'Generating SYNC on Origin and waiting for that'; ! sync (id = 1); ! wait for event (origin = 1, confirmed = all, wait on = 4, timeout = 0); _EOF_ echo "" echo "**********************************************************************" ! echo "**** $DB3 should now be done copying data and attempting to catch up." echo "**********************************************************************" echo "" echo -n "**** waiting for pgbench to finish " while kill -0 $pgbench_pid 2>/dev/null ; do *************** *** 355,362 **** done echo "**** pgbench finished" ! echo "**** please terminate the replication engines when caught up." wait $slon1_pid wait $slon2_pid wait $slon3_pid kill $pgbench_pid 2>/dev/null --- 440,460 ---- done echo "**** pgbench finished" ! sleep 5 ! slonik <<_EOF_ ! cluster name = T1; ! node 1 admin conninfo = 'dbname=$DB1'; ! node 2 admin conninfo = 'dbname=$DB2'; ! node 3 admin conninfo = 'dbname=$DB3'; ! node 4 admin conninfo = 'dbname=$DB4'; ! ! echo 'Generating final SYNC on Origin and waiting for that'; ! sync (id = 1); ! wait for event (origin = 1, confirmed = all, wait on = 1, timeout = 0); ! _EOF_ ! echo "**** please terminate the replication engines." wait $slon1_pid wait $slon2_pid wait $slon3_pid + wait $slon4_pid kill $pgbench_pid 2>/dev/null *************** *** 364,367 **** --- 462,466 ---- kill $slon2_pid 2>/dev/null kill $slon3_pid 2>/dev/null + kill $slon4_pid 2>/dev/null echo -n "**** comparing databases ... " *************** *** 396,399 **** --- 495,508 ---- "_Slony-I_T1_rowID" from history order by "_Slony-I_T1_rowID"; _EOF_ + psql $DB4 -o dump.tmp.4.$$ <<_EOF_ + select 'accounts:'::text, aid, bid, abalance, filler + from accounts order by aid; + select 'branches:'::text, bid, bbalance, filler + from branches order by bid; + select 'tellers:'::text, tid, bid, tbalance, filler + from tellers order by tid; + select 'history:'::text, tid, bid, aid, delta, mtime, filler, + "_Slony-I_T1_rowID" from history order by "_Slony-I_T1_rowID"; + _EOF_ if diff dump.tmp.1.$$ dump.tmp.2.$$ >test_2.1-2.diff ; then *************** *** 408,414 **** echo "success - databases 1 and 3 are equal." rm dump.tmp.3.$$ - rm dump.tmp.1.$$ rm test_2.1-3.diff else echo "FAILED - see test_2.1-3.diff for database differences" fi --- 517,531 ---- echo "success - databases 1 and 3 are equal." rm dump.tmp.3.$$ rm test_2.1-3.diff else echo "FAILED - see test_2.1-3.diff for database differences" fi + echo -n "**** comparing databases ... " + if diff dump.tmp.1.$$ dump.tmp.4.$$ >test_2.1-4.diff ; then + echo "success - databases 1 and 4 are equal." + rm dump.tmp.4.$$ + rm dump.tmp.1.$$ + rm test_2.1-4.diff + else + echo "FAILED - see test_2.1-4.diff for database differences" + fi
- Previous message: [Slony1-commit] slony1-engine/src/backend slony1_funcs.sql
- Next message: [Slony1-commit] slony1-engine/src/slonik slonik.c
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list