Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfaf26bf

Browse files
committed
Get rid of useless global variable in pg_upgrade.
Since the scandir() emulation was taken out of pg_upgrade, there'sno longer any need for scandir_file_pattern to exist as a globalvariable. Replace it with a local in the one remaining functionthat was making use of it.
1 parent3d6ec66 commitfaf26bf

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

‎contrib/pg_upgrade/pg_upgrade.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ extern UserOpts user_opts;
283283
externClusterInfoold_cluster,
284284
new_cluster;
285285
externOSInfoos_info;
286-
externcharscandir_file_pattern[];
287286

288287

289288
/* check.c */

‎contrib/pg_upgrade/relfilenode.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ static void transfer_relfile(pageCnvCtx *pageConverter,
2121
constchar*fromfile,constchar*tofile,
2222
constchar*nspname,constchar*relname);
2323

24-
/* used by scandir(), must be global */
25-
charscandir_file_pattern[MAXPGPATH];
2624

2725
/*
2826
* transfer_all_new_dbs()
@@ -134,6 +132,7 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
134132
FileNameMap*maps,intsize)
135133
{
136134
charold_dir[MAXPGPATH];
135+
charfile_pattern[MAXPGPATH];
137136
structdirent**namelist=NULL;
138137
intnumFiles=0;
139138
intmapnum;
@@ -175,7 +174,8 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
175174
pg_log(PG_REPORT,OVERWRITE_MESSAGE,old_file);
176175

177176
/*
178-
* Copy/link the relation file to the new cluster
177+
* Copy/link the relation's primary file (segment 0 of main fork)
178+
* to the new cluster
179179
*/
180180
unlink(new_file);
181181
transfer_relfile(pageConverter,old_file,new_file,
@@ -187,7 +187,7 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
187187
/*
188188
* Copy/link any fsm and vm files, if they exist
189189
*/
190-
snprintf(scandir_file_pattern,sizeof(scandir_file_pattern),"%u_",
190+
snprintf(file_pattern,sizeof(file_pattern),"%u_",
191191
maps[mapnum].old_relfilenode);
192192

193193
for (fileno=0;fileno<numFiles;fileno++)
@@ -199,8 +199,8 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
199199
if (vm_offset&&strlen(vm_offset)==strlen("_vm"))
200200
is_vm_file= true;
201201

202-
if (strncmp(namelist[fileno]->d_name,scandir_file_pattern,
203-
strlen(scandir_file_pattern))==0&&
202+
if (strncmp(namelist[fileno]->d_name,file_pattern,
203+
strlen(file_pattern))==0&&
204204
(!is_vm_file|| !vm_crashsafe_change))
205205
{
206206
snprintf(old_file,sizeof(old_file),"%s/%s",maps[mapnum].old_dir,
@@ -222,13 +222,13 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
222222
* relfilenode.3, ... 'fsm' and 'vm' files use underscores so are not
223223
* copied.
224224
*/
225-
snprintf(scandir_file_pattern,sizeof(scandir_file_pattern),"%u.",
225+
snprintf(file_pattern,sizeof(file_pattern),"%u.",
226226
maps[mapnum].old_relfilenode);
227227

228228
for (fileno=0;fileno<numFiles;fileno++)
229229
{
230-
if (strncmp(namelist[fileno]->d_name,scandir_file_pattern,
231-
strlen(scandir_file_pattern))==0)
230+
if (strncmp(namelist[fileno]->d_name,file_pattern,
231+
strlen(file_pattern))==0)
232232
{
233233
snprintf(old_file,sizeof(old_file),"%s/%s",maps[mapnum].old_dir,
234234
namelist[fileno]->d_name);
@@ -242,7 +242,6 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
242242
}
243243
}
244244

245-
246245
if (numFiles>0)
247246
{
248247
for (fileno=0;fileno<numFiles;fileno++)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp