Wed Apr 16 14:23:56 PDT 2008
- Previous message: [Slony1-commit] slony1-engine INSTALL configure configure.ac postgresql-slony1-engine.spec.in slony1.spec.in
- Next message: [Slony1-commit] slony1-engine/doc/adminguide firstdb.sgml
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main.slony.info:/tmp/cvs-serv2287/backend
Modified Files:
slony1_funcs.c slony1_funcs.sql
Log Message:
Rectify problem with DDL when hitting the following conditions:
- Running a DDL change that does updates on a replicated table
(e.g. - such as if you add a new column, and have to populate
it)
Error condition found:
- The denyaccess triggers *do* fire on the replica table;
there is nothing to suppress them
Solution:
- Change the denyaccess() function to check the replication
role GUC; it only needs to error out when in "origin" role;
if in "local" role (which is what slon sets, when running
DDL on a subscriber node), there is no problem.
- As above, when running "ONLY ON" a subscriber node
Error condition found:
- The DDL request is run by slonik, directly, and does not
set the session_replication_role to 'local'
Solution:
- Change the ddlscript_prepare(), when running ONLY ON, and
on a non-origin node, to set the session_replication_role to 'local'
Index: slony1_funcs.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** slony1_funcs.c 27 Mar 2008 15:01:54 -0000 1.64
--- slony1_funcs.c 16 Apr 2008 21:23:54 -0000 1.65
***************
*** 846,853 ****
elog(ERROR, "Slony-I: SPI_connect() failed in denyAccess()");
! elog(ERROR,
! "Slony-I: Table %s is replicated and cannot be "
! "modified on a subscriber node",
! NameStr(tg->tg_relation->rd_rel->relname));
SPI_finish();
--- 846,860 ----
elog(ERROR, "Slony-I: SPI_connect() failed in denyAccess()");
! /*
! * If the replication role is:
! * ORIGIN - default role --> FAIL
! * REPLICA - this trigger will not fire in --> N/A
! * LOCAL - role when running "local updates" --> PERMIT UPDATE
! */
! if (SessionReplicationRole == SESSION_REPLICATION_ROLE_ORIGIN)
! elog(ERROR,
! "Slony-I: Table %s is replicated and cannot be "
! "modified on a subscriber node - role=%d",
! NameStr(tg->tg_relation->rd_rel->relname), SessionReplicationRole);
SPI_finish();
Index: slony1_funcs.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.135
retrieving revision 1.136
diff -C2 -d -r1.135 -r1.136
*** slony1_funcs.sql 11 Apr 2008 15:08:19 -0000 1.135
--- slony1_funcs.sql 16 Apr 2008 21:23:54 -0000 1.136
***************
*** 3598,3601 ****
--- 3598,3608 ----
-- ----
perform @NAMESPACE at .createEvent(''_ at CLUSTERNAME@'', ''SYNC'', NULL);
+ else
+ -- If running "ONLY ON NODE", there are two possibilities:
+ -- 1. Running on origin, where denyaccess() triggers are already shut off
+ -- 2. Running on replica, where we need the LOCAL role to suppress denyaccess() triggers
+ if (v_set_origin <> @NAMESPACE at .getLocalNodeId(''_ at CLUSTERNAME@'') then
+ set session_replication_role to local;
+ end if
end if;
return 1;
- Previous message: [Slony1-commit] slony1-engine INSTALL configure configure.ac postgresql-slony1-engine.spec.in slony1.spec.in
- Next message: [Slony1-commit] slony1-engine/doc/adminguide firstdb.sgml
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list