const char *fromfile, const char *tofile,
const char *nspname, const char *relname);
-/* used by scandir(), must be global */
-char scandir_file_pattern[MAXPGPATH];
/*
* transfer_all_new_dbs()
FileNameMap *maps, int size)
{
char old_dir[MAXPGPATH];
+ char file_pattern[MAXPGPATH];
struct dirent **namelist = NULL;
int numFiles = 0;
int mapnum;
pg_log(PG_REPORT, OVERWRITE_MESSAGE, old_file);
/*
- * Copy/link the relation file to the new cluster
+ * Copy/link the relation's primary file (segment 0 of main fork)
+ * to the new cluster
*/
unlink(new_file);
transfer_relfile(pageConverter, old_file, new_file,
/*
* Copy/link any fsm and vm files, if they exist
*/
- snprintf(scandir_file_pattern, sizeof(scandir_file_pattern), "%u_",
+ snprintf(file_pattern, sizeof(file_pattern), "%u_",
maps[mapnum].old_relfilenode);
for (fileno = 0; fileno < numFiles; fileno++)
if (vm_offset && strlen(vm_offset) == strlen("_vm"))
is_vm_file = true;
- if (strncmp(namelist[fileno]->d_name, scandir_file_pattern,
- strlen(scandir_file_pattern)) == 0 &&
+ if (strncmp(namelist[fileno]->d_name, file_pattern,
+ strlen(file_pattern)) == 0 &&
(!is_vm_file || !vm_crashsafe_change))
{
snprintf(old_file, sizeof(old_file), "%s/%s", maps[mapnum].old_dir,
* relfilenode.3, ... 'fsm' and 'vm' files use underscores so are not
* copied.
*/
- snprintf(scandir_file_pattern, sizeof(scandir_file_pattern), "%u.",
+ snprintf(file_pattern, sizeof(file_pattern), "%u.",
maps[mapnum].old_relfilenode);
for (fileno = 0; fileno < numFiles; fileno++)
{
- if (strncmp(namelist[fileno]->d_name, scandir_file_pattern,
- strlen(scandir_file_pattern)) == 0)
+ if (strncmp(namelist[fileno]->d_name, file_pattern,
+ strlen(file_pattern)) == 0)
{
snprintf(old_file, sizeof(old_file), "%s/%s", maps[mapnum].old_dir,
namelist[fileno]->d_name);
}
}
-
if (numFiles > 0)
{
for (fileno = 0; fileno < numFiles; fileno++)