@@ -51,14 +51,14 @@ filemap_create(void)
5151}
5252
5353/*
54- * Callback for processing remote file list.
54+ * Callback for processing source file list.
5555 *
5656 * This is called once for every file in the source server. We decide what
5757 * action needs to be taken for the file, depending on whether the file
5858 * exists in the target and whether the size matches.
5959 */
6060void
61- process_remote_file (const char * path , file_type_t type , size_t newsize ,
61+ process_source_file (const char * path , file_type_t type , size_t newsize ,
6262 const char * link_target )
6363{
6464 bool exists ;
@@ -97,7 +97,7 @@ process_remote_file(const char *path, file_type_t type, size_t newsize,
9797
9898 snprintf (localpath , sizeof (localpath ), "%s/%s" , datadir_target , path );
9999
100- /* Does the corresponding local file exist? */
100+ /* Does the corresponding file exist in the target data dir ? */
101101 if (lstat (localpath , & statbuf ) < 0 )
102102 {
103103 if (errno != ENOENT )
@@ -185,18 +185,19 @@ process_remote_file(const char *path, file_type_t type, size_t newsize,
185185 *
186186 * If it's smaller in the target, it means that it has been
187187 * truncated in the target, or enlarged in the source, or
188- * both. If it was truncated locally , we need to copy the
189- * missing tail from the remote system. If it was enlarged in
190- * the remote system, there will be WAL records in the remote
188+ * both. If it was truncated in the target , we need to copy the
189+ * missing tail from the source system. If it was enlarged in
190+ * the source system, there will be WAL records in the source
191191 * system for the new blocks, so we wouldn't need to copy them
192192 * here. But we don't know which scenario we're dealing with,
193193 * and there's no harm in copying the missing blocks now, so
194194 * do it now.
195195 *
196- * If it's the same size, do nothing here. Any locally
197- * modified blocks will be copied based on parsing the local
198- * WAL, and any remotely modified blocks will be updated after
199- * rewinding, when the remote WAL is replayed.
196+ * If it's the same size, do nothing here. Any blocks modified
197+ * in the target will be copied based on parsing the target
198+ * system's WAL, and any blocks modified in the source will be
199+ * updated after rewinding, when the source system's WAL is
200+ * replayed.
200201 */
201202 oldsize = statbuf .st_size ;
202203 if (oldsize < newsize )
@@ -233,14 +234,15 @@ process_remote_file(const char *path, file_type_t type, size_t newsize,
233234}
234235
235236/*
236- * Callback for processing local file list.
237+ * Callback for processing target file list.
237238 *
238- * All remote files must be already processed before calling this. This only
239- * marks local files that didn't exist in the remote system for deletion.
239+ * All source files must be already processed before calling this. This only
240+ * marks target data directory's files that didn't exist in the source for
241+ * deletion.
240242 */
241243void
242- process_local_file (const char * path , file_type_t type , size_t oldsize ,
243- const char * link_target )
244+ process_target_file (const char * path , file_type_t type , size_t oldsize ,
245+ const char * link_target )
244246{
245247 bool exists ;
246248 char localpath [MAXPGPATH ];
@@ -266,7 +268,7 @@ process_local_file(const char *path, file_type_t type, size_t oldsize,
266268 if (map -> nlist == 0 )
267269 {
268270 /* should not happen */
269- pg_fatal ("remote file list is empty\n" );
271+ pg_fatal ("source file list is empty\n" );
270272 }
271273
272274 filemap_list_to_array (map );
@@ -288,7 +290,7 @@ process_local_file(const char *path, file_type_t type, size_t oldsize,
288290 exists = (bsearch (& key_ptr , map -> array , map -> narray , sizeof (file_entry_t * ),
289291 path_cmp ) != NULL );
290292
291- /* Remove any file or folder that doesn't exist in the remote system. */
293+ /* Remove any file or folder that doesn't exist in the source system. */
292294 if (!exists )
293295 {
294296 entry = pg_malloc (sizeof (file_entry_t ));
@@ -313,16 +315,16 @@ process_local_file(const char *path, file_type_t type, size_t oldsize,
313315 else
314316 {
315317 /*
316- * We already handled all files that exist in the remote system in
317- * process_remote_file ().
318+ * We already handled all files that exist in the source system in
319+ * process_source_file ().
318320 */
319321 }
320322}
321323
322324/*
323- * This callback gets called while we read the old WAL, for every block that
324- * have changed in the local system. It makes note of all the changed blocks
325- * in the pagemap of the file.
325+ * This callback gets called while we read the WAL in the target , for every
326+ * block that have changed in the target system. It makes note of all the
327+ * changed blocks in the pagemap of the file.
326328 */
327329void
328330process_block_change (ForkNumber forknum , RelFileNode rnode , BlockNumber blkno )
@@ -388,8 +390,8 @@ process_block_change(ForkNumber forknum, RelFileNode rnode, BlockNumber blkno)
388390 {
389391 /*
390392 * If we don't have any record of this file in the file map, it means
391- * that it's a relation that doesn't exist in the remote system, and
392- * it was subsequently removed in the local system, too. We can safely
393+ * that it's a relation that doesn't exist in the source system, and
394+ * it was subsequently removed in the target system, too. We can safely
393395 * ignore it.
394396 */
395397 }
0 commit comments