Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 07456b4

Browse files
committed
Pgindent run on pg_upgrade source after restructuring.
1 parent e13f7e9 commit 07456b4

14 files changed

+79
-76
lines changed

contrib/pg_upgrade/check.c

+14-14
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static void check_new_db_is_empty(void);
1515
static void check_locale_and_encoding(ControlData *oldctrl,
1616
ControlData *newctrl);
1717
static void check_for_isn_and_int8_passing_mismatch(
18-
Cluster whichCluster);
18+
Cluster whichCluster);
1919
static void check_for_reg_data_type_usage(Cluster whichCluster);
2020

2121

@@ -156,9 +156,9 @@ issue_warnings(char *sequence_script_file_name)
156156
{
157157
prep_status("Adjusting sequences");
158158
exec_prog(true,
159-
SYSTEMQUOTE "\"%s/psql\" --set ON_ERROR_STOP=on "
160-
"--no-psqlrc --port %d --username \"%s\" "
161-
"-f \"%s\" --dbname template1 >> \"%s\"" SYSTEMQUOTE,
159+
SYSTEMQUOTE "\"%s/psql\" --set ON_ERROR_STOP=on "
160+
"--no-psqlrc --port %d --username \"%s\" "
161+
"-f \"%s\" --dbname template1 >> \"%s\"" SYSTEMQUOTE,
162162
new_cluster.bindir, new_cluster.port, os_info.user,
163163
sequence_script_file_name, log.filename);
164164
unlink(sequence_script_file_name);
@@ -418,12 +418,12 @@ create_script_for_old_cluster_deletion(
418418
/* remove PG_VERSION? */
419419
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804)
420420
fprintf(script, RM_CMD " %s%s/PG_VERSION\n",
421-
os_info.tablespaces[tblnum], old_cluster.tablespace_suffix);
421+
os_info.tablespaces[tblnum], old_cluster.tablespace_suffix);
422422

423423
for (dbnum = 0; dbnum < new_cluster.dbarr.ndbs; dbnum++)
424424
{
425425
fprintf(script, RMDIR_CMD " %s%s/%d\n",
426-
os_info.tablespaces[tblnum], old_cluster.tablespace_suffix,
426+
os_info.tablespaces[tblnum], old_cluster.tablespace_suffix,
427427
old_cluster.dbarr.dbs[dbnum].db_oid);
428428
}
429429
}
@@ -434,7 +434,7 @@ create_script_for_old_cluster_deletion(
434434
* or a version-specific subdirectory.
435435
*/
436436
fprintf(script, RMDIR_CMD " %s%s\n",
437-
os_info.tablespaces[tblnum], old_cluster.tablespace_suffix);
437+
os_info.tablespaces[tblnum], old_cluster.tablespace_suffix);
438438
}
439439

440440
fclose(script);
@@ -450,7 +450,7 @@ create_script_for_old_cluster_deletion(
450450

451451

452452
/*
453-
* check_for_isn_and_int8_passing_mismatch()
453+
* check_for_isn_and_int8_passing_mismatch()
454454
*
455455
* /contrib/isn relies on data type int8, and in 8.4 int8 can now be passed
456456
* by value. The schema dumps the CREATE TYPE PASSEDBYVALUE setting so
@@ -547,7 +547,7 @@ check_for_isn_and_int8_passing_mismatch(Cluster whichCluster)
547547
* pg_type.oid
548548
* pg_enum.oid
549549
*
550-
* Most of the reg* data types reference system catalog info that is
550+
* Most of the reg* data types reference system catalog info that is
551551
* not preserved, and hence these data types cannot be used in user
552552
* tables upgraded by pg_upgrade.
553553
*/
@@ -585,13 +585,13 @@ check_for_reg_data_type_usage(Cluster whichCluster)
585585
"WHERE c.oid = a.attrelid AND "
586586
" NOT a.attisdropped AND "
587587
" a.atttypid IN ( "
588-
" 'pg_catalog.regproc'::pg_catalog.regtype, "
588+
" 'pg_catalog.regproc'::pg_catalog.regtype, "
589589
" 'pg_catalog.regprocedure'::pg_catalog.regtype, "
590-
" 'pg_catalog.regoper'::pg_catalog.regtype, "
590+
" 'pg_catalog.regoper'::pg_catalog.regtype, "
591591
" 'pg_catalog.regoperator'::pg_catalog.regtype, "
592-
" 'pg_catalog.regclass'::pg_catalog.regtype, "
593-
/* regtype.oid is preserved, so 'regtype' is OK */
594-
" 'pg_catalog.regconfig'::pg_catalog.regtype, "
592+
" 'pg_catalog.regclass'::pg_catalog.regtype, "
593+
/* regtype.oid is preserved, so 'regtype' is OK */
594+
" 'pg_catalog.regconfig'::pg_catalog.regtype, "
595595
" 'pg_catalog.regdictionary'::pg_catalog.regtype) AND "
596596
" c.relnamespace = n.oid AND "
597597
" n.nspname != 'pg_catalog' AND "

contrib/pg_upgrade/controldata.c

+6-5
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
9494
#ifndef WIN32
9595
NULL);
9696
#else
97-
/* On Windows the default locale cannot be English, so force it */
97+
/* On Windows the default locale cannot be English, so force it */
9898
"en");
9999
#endif
100100
putenv2("LANGUAGE", NULL);
@@ -372,7 +372,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
372372
pclose(output);
373373

374374
/*
375-
* Restore environment variables
375+
* Restore environment variables
376376
*/
377377
putenv2("LC_COLLATE", lc_collate);
378378
putenv2("LC_CTYPE", lc_ctype);
@@ -393,7 +393,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
393393
pg_free(language);
394394
pg_free(lc_all);
395395
pg_free(lc_messages);
396-
396+
397397
/* verify that we got all the mandatory pg_control data */
398398
if (!got_xid || !got_oid ||
399399
(!live_check && !got_log_id) ||
@@ -549,9 +549,10 @@ putenv2(const char *var, const char *val)
549549

550550
sprintf(envstr, "%s=%s", var, val);
551551
putenv(envstr);
552+
552553
/*
553-
* Do not free envstr because it becomes part of the environment
554-
* on some operating systems. See port/unsetenv.c::unsetenv.
554+
* Do not free envstr because it becomes part of the environment on
555+
* some operating systems. See port/unsetenv.c::unsetenv.
555556
*/
556557
#else
557558
SetEnvironmentVariableA(var, val);

contrib/pg_upgrade/dump.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ generate_old_dump(void)
2424
exec_prog(true,
2525
SYSTEMQUOTE "\"%s/pg_dumpall\" --port %d --username \"%s\" "
2626
"--schema-only --binary-upgrade > \"%s/" ALL_DUMP_FILE "\""
27-
SYSTEMQUOTE, new_cluster.bindir, old_cluster.port, os_info.user, os_info.cwd);
27+
SYSTEMQUOTE, new_cluster.bindir, old_cluster.port, os_info.user, os_info.cwd);
2828
check_ok();
2929
}
3030

contrib/pg_upgrade/exec.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <grp.h>
1414

1515

16-
static void check_data_dir(const char *pg_data);
16+
static void check_data_dir(const char *pg_data);
1717
static void check_bin_dir(ClusterInfo *cluster);
1818
static int check_exec(const char *dir, const char *cmdName);
1919
static const char *validate_exec(const char *path);
@@ -128,7 +128,7 @@ check_data_dir(const char *pg_data)
128128
int subdirnum;
129129
const char *requiredSubdirs[] = {"base", "global", "pg_clog",
130130
"pg_multixact", "pg_subtrans", "pg_tblspc", "pg_twophase",
131-
"pg_xlog"};
131+
"pg_xlog"};
132132

133133
for (subdirnum = 0;
134134
subdirnum < sizeof(requiredSubdirs) / sizeof(requiredSubdirs[0]);
@@ -143,8 +143,8 @@ check_data_dir(const char *pg_data)
143143
report_status(PG_FATAL, "check for %s failed: %s",
144144
requiredSubdirs[subdirnum], getErrorText(errno));
145145
else if (!S_ISDIR(statBuf.st_mode))
146-
report_status(PG_FATAL, "%s is not a directory",
147-
requiredSubdirs[subdirnum]);
146+
report_status(PG_FATAL, "%s is not a directory",
147+
requiredSubdirs[subdirnum]);
148148
}
149149
}
150150

contrib/pg_upgrade/file.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ copy_file(const char *srcfile, const char *dstfile, bool force)
173173

174174
if (nbytes < 0)
175175
{
176-
int save_errno = errno;
177-
176+
int save_errno = errno;
177+
178178
if (buffer != NULL)
179179
free(buffer);
180180

@@ -196,7 +196,7 @@ copy_file(const char *srcfile, const char *dstfile, bool force)
196196
if (write(dest_fd, buffer, nbytes) != nbytes)
197197
{
198198
/* if write didn't set errno, assume problem is no disk space */
199-
int save_errno = errno ? errno : ENOSPC;
199+
int save_errno = errno ? errno : ENOSPC;
200200

201201
if (buffer != NULL)
202202
free(buffer);

contrib/pg_upgrade/function.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ check_loadable_libraries(void)
253253
fclose(script);
254254
pg_log(PG_REPORT, "fatal\n");
255255
pg_log(PG_FATAL,
256-
"| Your installation references loadable libraries that are missing\n"
256+
"| Your installation references loadable libraries that are missing\n"
257257
"| from the new installation. You can add these libraries to\n"
258258
"| the new installation, or remove the functions using them\n"
259259
"| from the old installation. A list of the problem libraries\n"

contrib/pg_upgrade/info.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ print_maps(FileNameMap *maps, int n, const char *dbName)
201201
for (mapnum = 0; mapnum < n; mapnum++)
202202
pg_log(PG_DEBUG, "%s.%s:%u ==> %s.%s:%u\n",
203203
maps[mapnum].old_nspname, maps[mapnum].old_relname,
204-
maps[mapnum].old_relfilenode,
204+
maps[mapnum].old_relfilenode,
205205
maps[mapnum].new_nspname, maps[mapnum].new_relname,
206-
maps[mapnum].new_relfilenode);
206+
maps[mapnum].new_relfilenode);
207207

208208
pg_log(PG_DEBUG, "\n\n");
209209
}

contrib/pg_upgrade/option.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static void get_pkglibdirs(void);
2323
static char *get_pkglibdir(const char *bindir);
2424

2525

26-
UserOpts user_opts;
26+
UserOpts user_opts;
2727

2828

2929
/*

contrib/pg_upgrade/pg_upgrade.c

+8-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ static void set_frozenxids(void);
2222
static void setup(char *argv0, bool live_check);
2323
static void cleanup(void);
2424

25-
ClusterInfo old_cluster, new_cluster;
25+
ClusterInfo old_cluster,
26+
new_cluster;
2627
OSInfo os_info;
2728

2829
int
@@ -82,7 +83,7 @@ main(int argc, char **argv)
8283
prep_status("Setting next oid for new cluster");
8384
exec_prog(true, SYSTEMQUOTE "\"%s/pg_resetxlog\" -o %u \"%s\" > "
8485
DEVNULL SYSTEMQUOTE,
85-
new_cluster.bindir, old_cluster.controldata.chkpnt_nxtoid, new_cluster.pgdata);
86+
new_cluster.bindir, old_cluster.controldata.chkpnt_nxtoid, new_cluster.pgdata);
8687
check_ok();
8788

8889
create_script_for_old_cluster_deletion(&deletion_script_file_name);
@@ -161,7 +162,7 @@ prepare_new_cluster(void)
161162
exec_prog(true,
162163
SYSTEMQUOTE "\"%s/vacuumdb\" --port %d --username \"%s\" "
163164
"--all --analyze >> %s 2>&1" SYSTEMQUOTE,
164-
new_cluster.bindir, new_cluster.port, os_info.user, log.filename);
165+
new_cluster.bindir, new_cluster.port, os_info.user, log.filename);
165166
check_ok();
166167

167168
/*
@@ -174,7 +175,7 @@ prepare_new_cluster(void)
174175
exec_prog(true,
175176
SYSTEMQUOTE "\"%s/vacuumdb\" --port %d --username \"%s\" "
176177
"--all --freeze >> %s 2>&1" SYSTEMQUOTE,
177-
new_cluster.bindir, new_cluster.port, os_info.user, log.filename);
178+
new_cluster.bindir, new_cluster.port, os_info.user, log.filename);
178179
check_ok();
179180

180181
get_pg_database_relfilenode(CLUSTER_NEW);
@@ -202,7 +203,7 @@ prepare_new_databases(void)
202203
prep_status("Creating databases in the new cluster");
203204
exec_prog(true,
204205
SYSTEMQUOTE "\"%s/psql\" --set ON_ERROR_STOP=on "
205-
/* --no-psqlrc prevents AUTOCOMMIT=off */
206+
/* --no-psqlrc prevents AUTOCOMMIT=off */
206207
"--no-psqlrc --port %d --username \"%s\" "
207208
"-f \"%s/%s\" --dbname template1 >> \"%s\"" SYSTEMQUOTE,
208209
new_cluster.bindir, new_cluster.port, os_info.user, os_info.cwd,
@@ -273,14 +274,14 @@ copy_clog_xlog_xid(void)
273274
/* set the next transaction id of the new cluster */
274275
prep_status("Setting next transaction id for new cluster");
275276
exec_prog(true, SYSTEMQUOTE "\"%s/pg_resetxlog\" -f -x %u \"%s\" > " DEVNULL SYSTEMQUOTE,
276-
new_cluster.bindir, old_cluster.controldata.chkpnt_nxtxid, new_cluster.pgdata);
277+
new_cluster.bindir, old_cluster.controldata.chkpnt_nxtxid, new_cluster.pgdata);
277278
check_ok();
278279

279280
/* now reset the wal archives in the new cluster */
280281
prep_status("Resetting WAL archives");
281282
exec_prog(true, SYSTEMQUOTE "\"%s/pg_resetxlog\" -l %u,%u,%u \"%s\" >> \"%s\" 2>&1" SYSTEMQUOTE,
282283
new_cluster.bindir, old_cluster.controldata.chkpnt_tli,
283-
old_cluster.controldata.logid, old_cluster.controldata.nxtlogseg,
284+
old_cluster.controldata.logid, old_cluster.controldata.nxtlogseg,
284285
new_cluster.pgdata, log.filename);
285286
check_ok();
286287
}

contrib/pg_upgrade/pg_upgrade.h

+15-14
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
#endif
5454

5555
#define CLUSTERNAME(cluster) ((cluster) == CLUSTER_OLD ? "old" : "new")
56-
#define ACTIVE_CLUSTER(cluster) (((cluster) == CLUSTER_OLD) ? \
56+
#define ACTIVE_CLUSTER(cluster) (((cluster) == CLUSTER_OLD) ? \
5757
&old_cluster : &new_cluster)
5858

5959
#define atooid(x) ((Oid) strtoul((x), NULL, 10))
@@ -85,8 +85,8 @@ typedef struct
8585
*/
8686
typedef struct
8787
{
88-
Oid old_relfilenode; /* Relfilenode of the old relation */
89-
Oid new_relfilenode; /* Relfilenode of the new relation */
88+
Oid old_relfilenode; /* Relfilenode of the old relation */
89+
Oid new_relfilenode; /* Relfilenode of the new relation */
9090
char old_file[MAXPGPATH];
9191
char new_file[MAXPGPATH];
9292
char old_nspname[NAMEDATALEN]; /* old name of the namespace */
@@ -240,10 +240,11 @@ typedef struct
240240
/*
241241
* Global variables
242242
*/
243-
extern Log log;
244-
extern UserOpts user_opts;
245-
extern ClusterInfo old_cluster, new_cluster;
246-
extern OSInfo os_info;
243+
extern Log log;
244+
extern UserOpts user_opts;
245+
extern ClusterInfo old_cluster,
246+
new_cluster;
247+
extern OSInfo os_info;
247248
extern char scandir_file_pattern[];
248249

249250

@@ -260,7 +261,7 @@ void output_completion_banner(
260261
char *deletion_script_file_name);
261262
void check_cluster_versions(void);
262263
void check_cluster_compatibility(bool live_check);
263-
void create_script_for_old_cluster_deletion(char **deletion_script_file_name);
264+
void create_script_for_old_cluster_deletion(char **deletion_script_file_name);
264265

265266

266267
/* controldata.c */
@@ -402,12 +403,12 @@ void new_9_0_populate_pg_largeobject_metadata(
402403

403404
/* version_old_8_3.c */
404405

405-
void old_8_3_check_for_name_data_type_usage(Cluster whichCluster);
406-
void old_8_3_check_for_tsquery_usage(Cluster whichCluster);
406+
void old_8_3_check_for_name_data_type_usage(Cluster whichCluster);
407+
void old_8_3_check_for_tsquery_usage(Cluster whichCluster);
407408
void old_8_3_rebuild_tsvector_tables(bool check_mode,
408-
Cluster whichCluster);
409+
Cluster whichCluster);
409410
void old_8_3_invalidate_hash_gin_indexes(bool check_mode,
410-
Cluster whichCluster);
411+
Cluster whichCluster);
411412
void old_8_3_invalidate_bpchar_pattern_ops_indexes(bool check_mode,
412-
Cluster whichCluster);
413-
char *old_8_3_create_sequence_script(Cluster whichCluster);
413+
Cluster whichCluster);
414+
char *old_8_3_create_sequence_script(Cluster whichCluster);

contrib/pg_upgrade/relfilenode.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ transfer_all_new_dbs(DbInfoArr *olddb_arr,
6363
}
6464
}
6565

66-
prep_status(""); /* in case nothing printed */
66+
prep_status(""); /* in case nothing printed */
6767
check_ok();
6868

6969
return msg;
@@ -122,9 +122,9 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
122122
/* Copying files might take some time, so give feedback. */
123123

124124
snprintf(old_file, sizeof(old_file), "%s/%u", maps[mapnum].old_file,
125-
maps[mapnum].old_relfilenode);
125+
maps[mapnum].old_relfilenode);
126126
snprintf(new_file, sizeof(new_file), "%s/%u", maps[mapnum].new_file,
127-
maps[mapnum].new_relfilenode);
127+
maps[mapnum].new_relfilenode);
128128
pg_log(PG_REPORT, OVERWRITE_MESSAGE, old_file);
129129

130130
/*
@@ -142,15 +142,15 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
142142
* Now copy/link any fsm and vm files, if they exist
143143
*/
144144
snprintf(scandir_file_pattern, sizeof(scandir_file_pattern), "%u_",
145-
maps[mapnum].old_relfilenode);
145+
maps[mapnum].old_relfilenode);
146146
numFiles = pg_scandir(maps[mapnum].old_file, &namelist, dir_matching_filenames);
147147

148148
while (numFiles--)
149149
{
150150
snprintf(old_file, sizeof(old_file), "%s/%s", maps[mapnum].old_file,
151151
namelist[numFiles]->d_name);
152152
snprintf(new_file, sizeof(new_file), "%s/%u%s", maps[mapnum].new_file,
153-
maps[mapnum].new_relfilenode, strchr(namelist[numFiles]->d_name, '_'));
153+
maps[mapnum].new_relfilenode, strchr(namelist[numFiles]->d_name, '_'));
154154

155155
unlink(new_file);
156156
transfer_relfile(pageConverter, old_file, new_file,
@@ -171,15 +171,15 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
171171
* copied.
172172
*/
173173
snprintf(scandir_file_pattern, sizeof(scandir_file_pattern), "%u.",
174-
maps[mapnum].old_relfilenode);
174+
maps[mapnum].old_relfilenode);
175175
numFiles = pg_scandir(maps[mapnum].old_file, &namelist, dir_matching_filenames);
176176

177177
while (numFiles--)
178178
{
179179
snprintf(old_file, sizeof(old_file), "%s/%s", maps[mapnum].old_file,
180180
namelist[numFiles]->d_name);
181181
snprintf(new_file, sizeof(new_file), "%s/%u%s", maps[mapnum].new_file,
182-
maps[mapnum].new_relfilenode, strchr(namelist[numFiles]->d_name, '.'));
182+
maps[mapnum].new_relfilenode, strchr(namelist[numFiles]->d_name, '.'));
183183

184184
unlink(new_file);
185185
transfer_relfile(pageConverter, old_file, new_file,

0 commit comments

Comments
 (0)