hubert depesz lubaczewski depesz at depesz.com
Thu Oct 25 17:46:47 PDT 2007
hi
i need to add 1 field to soem table that is replicated.
so i wrote appropriate sql:
=> cat go.sql
ALTER TABLE XXX add column yyy integer;

and slonik call:
=> cat execute.sh
#!/bin/bash
. setshell.sh
slonik <<_EOF_
    cluster name = $CLUSTER;
    node 1 admin conninfo = '$MASTERCONNINFO';
    node 2 admin conninfo = '$SLAVECONNINFO';
    execute script ( set id = 1, filename = 'go.sql', event node = 1);
_EOF_

i run it wehn the load on machine is minimal (it's next to impossible to
get lower load, as i'm doing it at 3 a.m.!), but all i get is:

#v+
<stdin>:6: PGRES_FATAL_ERROR select "_QQQ".ddlScript_prepare(1, -1);  - ERROR:  deadlock detected
DETAIL:  Process 7628 waits for AccessExclusiveLock on relation 56719 of database 55909; blocked by process 6705.
Process 6705 waits for AccessShareLock on relation 56624 of database 55909; blocked by process 7628.
CONTEXT:  SQL statement "lock table "public"."ZZZ" in access exclusive mode"
PL/pgSQL function "altertablerestore" line 47 at execute statement
SQL statement "SELECT  "_QQQ".alterTableRestore(tab_id) from "_QQQ".sl_table where tab_set in (select set_id from "_QQQ".sl_set where set_origin = "_QQQ".getLocalNodeId('_QQQ'))"
PL/pgSQL function "ddlscript_prepare" line 34 at perform
#v-

what can i do?
i really think there should be better way of handling schema modifications -
execute script is very unfriendly. and, as it seems - in some cases it simply doesn't work :(

depesz

-- 
quicksil1er: "postgres is excellent, but like any DB it requires a
highly paid DBA.  here's my CV!" :)
http://www.depesz.com/ - blog dla ciebie (i moje CV)


More information about the Slony1-general mailing list