Jan Wieck wieck at lists.slony.info
Mon Jan 21 10:54:13 PST 2008
Update of /home/cvsd/slony1/slony1-engine/src/slon
In directory main.slony.info:/tmp/cvs-serv28743/slon

Modified Files:
	local_listen.c remote_worker.c 
Log Message:
New even type CLONE_NODE.

This will allow to duplicate an existing subscriber using pg_dump or
even filesystem level of copying the database cluster. See the script
src/ducttape/test_1_clonenode for an example of how this works.

Documentation still to be done.

Jan


Index: remote_worker.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/remote_worker.c,v
retrieving revision 1.162
retrieving revision 1.163
diff -C2 -d -r1.162 -r1.163
*** remote_worker.c	13 Dec 2007 17:19:28 -0000	1.162
--- remote_worker.c	21 Jan 2008 18:54:11 -0000	1.163
***************
*** 787,790 ****
--- 787,803 ----
  				need_reloadListen = true;
  			}
+ 			if (strcmp(event->ev_type, "CLONE_NODE") == 0)
+ 			{
+ 				int			no_id = (int)strtol(event->ev_data1, NULL, 10);
+ 				int			no_provider = (int)strtol(event->ev_data2, NULL, 10);
+ 				char	   *no_comment = event->ev_data3;
+ 
+ 				rtcfg_storeNode(no_id, no_comment);
+ 
+ 				slon_appendquery(&query1,
+ 								 "select %s.cloneNodePrepare_int(%d, %d, '%q'); ",
+ 								 rtcfg_namespace,
+ 								 no_id, no_provider, no_comment);
+ 			}
  			else if (strcmp(event->ev_type, "STORE_PATH") == 0)
  			{

Index: local_listen.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/local_listen.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -d -r1.44 -r1.45
*** local_listen.c	19 Oct 2007 18:38:35 -0000	1.44
--- local_listen.c	21 Jan 2008 18:54:11 -0000	1.45
***************
*** 285,288 ****
--- 285,303 ----
  				rtcfg_reloadListen(dbconn);
  			}
+ 			else if (strcmp(ev_type, "CLONE_NODE") == 0)
+ 			{
+ 				/*
+ 				 * CLONE_NODE
+ 				 */
+ 				int			no_id;
+ 				int			no_provider;
+ 				char	   *no_comment;
+ 
+ 				no_id = (int)strtol(PQgetvalue(res, tupno, 6), NULL, 10);
+ 				no_provider = (int)strtol(PQgetvalue(res, tupno, 7), NULL, 10);
+ 				no_comment = PQgetvalue(res, tupno, 8);
+ 
+ 				rtcfg_storeNode(no_id, no_comment);
+ 			}
  			else if (strcmp(ev_type, "STORE_PATH") == 0)
  			{



More information about the Slony1-commit mailing list