Chris Browne cbbrowne at lists.slony.info
Fri Oct 19 08:19:36 PDT 2007
Update of /home/cvsd/slony1/slony1-engine/tests/testinherit
In directory main.slony.info:/tmp/cvs-serv6750

Modified Files:
	generate_dml.sh 
Log Message:
Inheritance test now does some subtransactions with rollback, with
some SLEEP statements to encourage potential for locking


Index: generate_dml.sh
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/tests/testinherit/generate_dml.sh,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** generate_dml.sh	25 Sep 2007 21:36:29 -0000	1.6
--- generate_dml.sh	19 Oct 2007 15:19:34 -0000	1.7
***************
*** 65,102 ****
    status "done initial test"
  
!   SUBTRANSACTIONQUERY=<<EOF
    begin;
-   -- Get a random list of products/regions
    select product_id into temp table products_foo from products order by random() limit 10;
    select region_code into temp table regions_foo from regions order by random() limit 10;
    savepoint a;
-   -- Purchase some products...
    select purchase_product( region_code, product_id, (random()*5+random()*8+random()*7)::integer) from products_foo, regions_foo order by random() limit 10;
! \!sh -c 'sleep2'
    savepoint b;
-   -- Then purchase some more products
    select purchase_product( region_code, product_id, (random()*5+random()*8+random()*7)::integer) from products_foo, regions_foo order by random() limit 5;
-   -- but psyche!!!  rollback to the previous savepoint!
    rollback to savepoint b;
    savepoint c;
-   -- Get another random listing of products/regions
    select product_id into temp table products_bar from products order by random() limit 5;
    select region_code into temp table regions_bar from regions order by random() limit 5;
    savepoint d;
! \!sh -c 'sleep2'
!   -- Now, do a purchase
    select purchase_product( region_code, product_id, (random()*5+random()*8+random()*7)::integer) from products_bar, regions_bar order by random() limit 5;
-   -- psyche!!!
    rollback to savepoint d;
    savepoint e;
    select purchase_product( region_code, product_id, (random()*5+random()*8+random()*7)::integer) from products_bar, regions_bar order by random() limit 10;
! \!sh -c 'sleep2'
    commit;
! EOF
  
    status "run a series of transactions that use subtransactions"
    for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do
        status "subtransaction set ${i}"
!       (sleep 2; $pgbindir/psql -h $host -p $port -d $db -U $user -c "${QUERY}"; status "done subtransaction set ${i}") &
        sleep 1
    done
--- 65,97 ----
    status "done initial test"
  
!   SUBTRANSACTIONQUERY="
    begin;
    select product_id into temp table products_foo from products order by random() limit 10;
    select region_code into temp table regions_foo from regions order by random() limit 10;
    savepoint a;
    select purchase_product( region_code, product_id, (random()*5+random()*8+random()*7)::integer) from products_foo, regions_foo order by random() limit 10;
! \!sh -c 'sleep 2'
    savepoint b;
    select purchase_product( region_code, product_id, (random()*5+random()*8+random()*7)::integer) from products_foo, regions_foo order by random() limit 5;
    rollback to savepoint b;
    savepoint c;
    select product_id into temp table products_bar from products order by random() limit 5;
    select region_code into temp table regions_bar from regions order by random() limit 5;
    savepoint d;
! \!sh -c 'sleep 2'
    select purchase_product( region_code, product_id, (random()*5+random()*8+random()*7)::integer) from products_bar, regions_bar order by random() limit 5;
    rollback to savepoint d;
    savepoint e;
    select purchase_product( region_code, product_id, (random()*5+random()*8+random()*7)::integer) from products_bar, regions_bar order by random() limit 10;
! \!sh -c 'sleep 2'
    commit;
! "
! 
! echo $SUBTRANSACTIONQUERY
  
    status "run a series of transactions that use subtransactions"
    for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do
        status "subtransaction set ${i}"
!       (sleep 2; echo "${SUBTRANSACTIONQUERY}" | $pgbindir/psql -h $host -p $port -d $db -U $user; status "done subtransaction set ${i}") &
        sleep 1
    done



More information about the Slony1-commit mailing list