@@ -51,14 +51,14 @@ filemap_create(void)
51
51
}
52
52
53
53
/*
54
- * Callback for processing remote file list.
54
+ * Callback for processing source file list.
55
55
*
56
56
* This is called once for every file in the source server. We decide what
57
57
* action needs to be taken for the file, depending on whether the file
58
58
* exists in the target and whether the size matches.
59
59
*/
60
60
void
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 ,
62
62
const char * link_target )
63
63
{
64
64
bool exists ;
@@ -97,7 +97,7 @@ process_remote_file(const char *path, file_type_t type, size_t newsize,
97
97
98
98
snprintf (localpath , sizeof (localpath ), "%s/%s" , datadir_target , path );
99
99
100
- /* Does the corresponding local file exist? */
100
+ /* Does the corresponding file exist in the target data dir ? */
101
101
if (lstat (localpath , & statbuf ) < 0 )
102
102
{
103
103
if (errno != ENOENT )
@@ -185,18 +185,19 @@ process_remote_file(const char *path, file_type_t type, size_t newsize,
185
185
*
186
186
* If it's smaller in the target, it means that it has been
187
187
* 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
191
191
* system for the new blocks, so we wouldn't need to copy them
192
192
* here. But we don't know which scenario we're dealing with,
193
193
* and there's no harm in copying the missing blocks now, so
194
194
* do it now.
195
195
*
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.
200
201
*/
201
202
oldsize = statbuf .st_size ;
202
203
if (oldsize < newsize )
@@ -233,14 +234,15 @@ process_remote_file(const char *path, file_type_t type, size_t newsize,
233
234
}
234
235
235
236
/*
236
- * Callback for processing local file list.
237
+ * Callback for processing target file list.
237
238
*
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.
240
242
*/
241
243
void
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 )
244
246
{
245
247
bool exists ;
246
248
char localpath [MAXPGPATH ];
@@ -266,7 +268,7 @@ process_local_file(const char *path, file_type_t type, size_t oldsize,
266
268
if (map -> nlist == 0 )
267
269
{
268
270
/* should not happen */
269
- pg_fatal ("remote file list is empty\n" );
271
+ pg_fatal ("source file list is empty\n" );
270
272
}
271
273
272
274
filemap_list_to_array (map );
@@ -288,7 +290,7 @@ process_local_file(const char *path, file_type_t type, size_t oldsize,
288
290
exists = (bsearch (& key_ptr , map -> array , map -> narray , sizeof (file_entry_t * ),
289
291
path_cmp ) != NULL );
290
292
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. */
292
294
if (!exists )
293
295
{
294
296
entry = pg_malloc (sizeof (file_entry_t ));
@@ -313,16 +315,16 @@ process_local_file(const char *path, file_type_t type, size_t oldsize,
313
315
else
314
316
{
315
317
/*
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 ().
318
320
*/
319
321
}
320
322
}
321
323
322
324
/*
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.
326
328
*/
327
329
void
328
330
process_block_change (ForkNumber forknum , RelFileNode rnode , BlockNumber blkno )
@@ -388,8 +390,8 @@ process_block_change(ForkNumber forknum, RelFileNode rnode, BlockNumber blkno)
388
390
{
389
391
/*
390
392
* 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
393
395
* ignore it.
394
396
*/
395
397
}
0 commit comments