Jan Wieck wieck at lists.slony.info
Thu Sep 27 07:23:06 PDT 2007
Update of /home/cvsd/slony1/slony1-engine/src/slon
In directory main.slony.info:/tmp/cvs-serv12449/src/slon

Modified Files:
      Tag: REL_1_2_STABLE
	remote_worker.c 
Log Message:
Fixing the archive sequence generations. All non-SYNC events must
start the local transaction before creating the archive as well, so
that the lock on the archive counter table serializes archive creation.

Jan


Index: remote_worker.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/remote_worker.c,v
retrieving revision 1.124.2.25
retrieving revision 1.124.2.26
diff -C2 -d -r1.124.2.25 -r1.124.2.26
*** remote_worker.c	18 Sep 2007 16:09:42 -0000	1.124.2.25
--- remote_worker.c	27 Sep 2007 14:23:03 -0000	1.124.2.26
***************
*** 586,589 ****
--- 586,593 ----
  						{
  							slon_log(SLON_FATAL, "ABORT at sync %d per command line request%n", quit_sync_finalsync);
+ 							slon_mkquery(&query2, "rollback transaction; ");
+ 							query_execute(node, local_dbconn, &query2);
+ 							dstring_reset(&query2);
+ 
  							slon_retry();
  						}
***************
*** 634,637 ****
--- 638,642 ----
  				 * specified timeout.
  				 */
+ 				archive_terminate(node);
  				slon_mkquery(&query2, "rollback transaction");
  				if (query_execute(node, local_dbconn, &query2) < 0)
***************
*** 663,667 ****
  				slon_retry();
  		}
! 		else
  		{
  			/*
--- 668,672 ----
  				slon_retry();
  		}
! 		else /* not SYNC */
  		{
  			/*
***************
*** 672,675 ****
--- 677,683 ----
  							 "lock table %s.sl_config_lock; ",
  							 rtcfg_namespace);
+ 			if (query_execute(node, local_dbconn, &query1) < 0)
+ 				slon_retry();
+ 			dstring_reset(&query1);
  
  			/*
***************
*** 4683,4694 ****
  		if (rc < 0)
  			slon_retry();
- 			
- 		if (command_on_logarchive) {
- 			char command[512];
- 			sprintf(command, "%s %s", command_on_logarchive, node->archive_name);
- 			slon_log(SLON_INFO, "remoteWorkerThread_%d: Run Archive Command %s\n",
- 				 node->no_id, command);
- 			system(command);
- 		}
  	}
  
--- 4691,4694 ----
***************
*** 5470,5474 ****
  
  	sprintf(node->archive_name, "%s/slony1_log_%d_", archive_dir, 
! 			node->no_id);
  	for (i = strlen(node->archive_counter); i < 20; i++)
  		strcat(node->archive_name, "0");
--- 5470,5474 ----
  
  	sprintf(node->archive_name, "%s/slony1_log_%d_", archive_dir, 
! 			rtcfg_nodeid);
  	for (i = strlen(node->archive_counter); i < 20; i++)
  		strcat(node->archive_name, "0");
***************
*** 5574,5577 ****
--- 5574,5585 ----
  	}
  
+ 	if (command_on_logarchive) {
+ 		char command[1024];
+ 		sprintf(command, "%s %s", command_on_logarchive, node->archive_name);
+ 		slon_log(SLON_DEBUG1, "remoteWorkerThread_%d: Run Archive Command %s\n",
+ 			 node->no_id, command);
+ 		system(command);
+ 	}
+ 
  	return 0;
  }



More information about the Slony1-commit mailing list