mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Optimize fileset usage in apply worker.
Use one fileset for the entire worker lifetime instead of using separate filesets for each streaming transaction. Now, the changes/subxacts files for every streaming transaction will be created under the same fileset and the files will be deleted after the transaction is completed. This patch extends the BufFileOpenFileSet and BufFileDeleteFileSet APIs to allow users to specify whether to give an error on missing files. Author: Dilip Kumar, based on suggestion by Thomas Munro Reviewed-by: Hou Zhijie, Masahiko Sawada, Amit Kapila Discussion: https://postgr.es/m/E1mCC6U-0004Ik-Fs@gemulon.postgresql.org
This commit is contained in:
		@@ -379,6 +379,7 @@ retry:
 | 
			
		||||
	worker->relid = relid;
 | 
			
		||||
	worker->relstate = SUBREL_STATE_UNKNOWN;
 | 
			
		||||
	worker->relstate_lsn = InvalidXLogRecPtr;
 | 
			
		||||
	worker->stream_fileset = NULL;
 | 
			
		||||
	worker->last_lsn = InvalidXLogRecPtr;
 | 
			
		||||
	TIMESTAMP_NOBEGIN(worker->last_send_time);
 | 
			
		||||
	TIMESTAMP_NOBEGIN(worker->last_recv_time);
 | 
			
		||||
@@ -648,8 +649,9 @@ logicalrep_worker_onexit(int code, Datum arg)
 | 
			
		||||
 | 
			
		||||
	logicalrep_worker_detach();
 | 
			
		||||
 | 
			
		||||
	/* Cleanup filesets used for streaming transactions. */
 | 
			
		||||
	logicalrep_worker_cleanupfileset();
 | 
			
		||||
	/* Cleanup fileset used for streaming transactions. */
 | 
			
		||||
	if (MyLogicalRepWorker->stream_fileset != NULL)
 | 
			
		||||
		FileSetDeleteAll(MyLogicalRepWorker->stream_fileset);
 | 
			
		||||
 | 
			
		||||
	ApplyLauncherWakeup();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user