Tue Apr 3 14:55:06 PDT 2007
- Previous message: [Slony1-commit] slony1-engine/src/slon remote_worker.c
- Next message: [Slony1-commit] slony1-engine/tests/testddl ddl_update_part2.sql generate_dml.sh individual_ddl.sh init_subscribe_set.ik
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /home/cvsd/slony1/slony1-engine/src/slonik
In directory main.slony.info:/tmp/cvs-serv3668/src/slonik
Modified Files:
Tag: REL_1_2_STABLE
slonik.c
Log Message:
Update to DDL handling - when a script is specified with "EXECUTE ONLY ON"
a specific node, it should be invoked, by slonik, only on that node.
Index: slonik.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slonik/slonik.c,v
retrieving revision 1.67.2.6
retrieving revision 1.67.2.7
diff -C2 -d -r1.67.2.6 -r1.67.2.7
*** slonik.c 15 Mar 2007 18:52:02 -0000 1.67.2.6
--- slonik.c 3 Apr 2007 21:55:04 -0000 1.67.2.7
***************
*** 3850,3853 ****
--- 3850,3854 ----
ExecStatusType rstat;
+
#define PARMCOUNT 1
***************
*** 3856,3860 ****
int paramfmts[PARMCOUNT];
! adminfo1 = get_active_adminfo((SlonikStmt *) stmt, stmt->ev_origin);
if (adminfo1 == NULL)
return -1;
--- 3857,3865 ----
int paramfmts[PARMCOUNT];
! if(stmt->only_on_node > -1) {
! adminfo1 = get_active_adminfo((SlonikStmt*) stmt,stmt->only_on_node);
! } else {
! adminfo1 = get_active_adminfo((SlonikStmt *) stmt, stmt->ev_origin);
! }
if (adminfo1 == NULL)
return -1;
***************
*** 3883,3886 ****
--- 3888,3892 ----
"select \"_%s\".ddlScript_prepare(%d, %d); ",
stmt->hdr.script->clustername,
+
stmt->ddl_setid, /* dstring_data(&script), */
stmt->only_on_node);
***************
*** 3936,3966 ****
}
! printf("Submit DDL Event to subscribers...\n");
!
! slon_mkquery(&query, "select \"_%s\".ddlScript_complete(%d, $1::text, %d); ",
! stmt->hdr.script->clustername,
! stmt->ddl_setid,
! stmt->only_on_node);
!
! paramlens[PARMCOUNT-1] = 0;
! paramfmts[PARMCOUNT-1] = 0;
! params[PARMCOUNT-1] = dstring_data(&script);
!
! res = PQexecParams(adminfo1->dbconn, dstring_data(&query), PARMCOUNT,
! NULL, params, paramlens, paramfmts, 0);
!
! if (PQresultStatus(res) != PGRES_COMMAND_OK &&
! PQresultStatus(res) != PGRES_TUPLES_OK &&
! PQresultStatus(res) != PGRES_EMPTY_QUERY)
! {
! rstat = PQresultStatus(res);
! printf("Event submission for DDL failed - %s\n", PQresStatus(rstat));
! dstring_free(&query);
! return -1;
! } else {
! rstat = PQresultStatus(res);
! printf ("DDL on origin - %s\n", PQresStatus(rstat));
! }
!
dstring_free(&script);
dstring_free(&query);
--- 3942,3971 ----
}
! printf("Complete DDL Event...\n");
!
! slon_mkquery(&query, "select \"_%s\".ddlScript_complete(%d, $1::text, %d); ",
! stmt->hdr.script->clustername,
! stmt->ddl_setid,
! stmt->only_on_node);
!
! paramlens[PARMCOUNT-1] = 0;
! paramfmts[PARMCOUNT-1] = 0;
! params[PARMCOUNT-1] = dstring_data(&script);
!
! res = PQexecParams(adminfo1->dbconn, dstring_data(&query), PARMCOUNT,
! NULL, params, paramlens, paramfmts, 0);
!
! if (PQresultStatus(res) != PGRES_COMMAND_OK &&
! PQresultStatus(res) != PGRES_TUPLES_OK &&
! PQresultStatus(res) != PGRES_EMPTY_QUERY)
! {
! rstat = PQresultStatus(res);
! printf("Event submission for DDL failed - %s\n", PQresStatus(rstat));
! dstring_free(&query);
! return -1;
! } else {
! rstat = PQresultStatus(res);
! printf ("DDL submission to initial node - %s\n", PQresStatus(rstat));
! }
dstring_free(&script);
dstring_free(&query);
- Previous message: [Slony1-commit] slony1-engine/src/slon remote_worker.c
- Next message: [Slony1-commit] slony1-engine/tests/testddl ddl_update_part2.sql generate_dml.sh individual_ddl.sh init_subscribe_set.ik
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list