1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

pgindent run for 9.4

This includes removing tabs after periods in C comments, which was
applied to back branches, so this change should not effect backpatching.
This commit is contained in:
Bruce Momjian
2014-05-06 12:12:18 -04:00
parent fb85cd4320
commit 0a78320057
854 changed files with 7848 additions and 7368 deletions

View File

@ -278,7 +278,7 @@ check_cluster_versions(void)
/* Only current PG version is supported as a target */
if (GET_MAJOR_VERSION(new_cluster.major_version) != GET_MAJOR_VERSION(PG_VERSION_NUM))
pg_fatal("This utility can only upgrade to PostgreSQL version %s.\n",
PG_MAJORVERSION);
PG_MAJORVERSION);
/*
* We can't allow downgrading because we use the target pg_dumpall, and
@ -316,17 +316,17 @@ check_cluster_compatibility(bool live_check)
if (GET_MAJOR_VERSION(new_cluster.major_version) == 900 &&
new_cluster.controldata.cat_ver < TABLE_SPACE_SUBDIRS_CAT_VER)
pg_fatal("This utility can only upgrade to PostgreSQL version 9.0 after 2010-01-11\n"
"because of backend API changes made during development.\n");
"because of backend API changes made during development.\n");
/* We read the real port number for PG >= 9.1 */
if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) < 901 &&
old_cluster.port == DEF_PGUPORT)
pg_fatal("When checking a pre-PG 9.1 live old server, "
"you must specify the old server's port number.\n");
"you must specify the old server's port number.\n");
if (live_check && old_cluster.port == new_cluster.port)
pg_fatal("When checking a live server, "
"the old and new port numbers must be different.\n");
"the old and new port numbers must be different.\n");
}
@ -438,7 +438,7 @@ equivalent_locale(const char *loca, const char *locb)
return (pg_strcasecmp(loca, locb) == 0);
/*
* Compare the encoding parts. Windows tends to use code page numbers for
* Compare the encoding parts. Windows tends to use code page numbers for
* the encoding part, which equivalent_encoding() won't like, so accept if
* the strings are case-insensitive equal; otherwise use
* equivalent_encoding() to compare.
@ -499,7 +499,7 @@ check_new_cluster_is_empty(void)
/* pg_largeobject and its index should be skipped */
if (strcmp(rel_arr->rels[relnum].nspname, "pg_catalog") != 0)
pg_fatal("New cluster database \"%s\" is not empty\n",
new_cluster.dbarr.dbs[dbnum].db_name);
new_cluster.dbarr.dbs[dbnum].db_name);
}
}
@ -526,7 +526,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
if ((script = fopen_priv(*analyze_script_file_name, "w")) == NULL)
pg_fatal("Could not open file \"%s\": %s\n",
*analyze_script_file_name, getErrorText(errno));
*analyze_script_file_name, getErrorText(errno));
#ifndef WIN32
/* add shebang header */
@ -581,7 +581,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
#ifndef WIN32
if (chmod(*analyze_script_file_name, S_IRWXU) != 0)
pg_fatal("Could not add execute permission to file \"%s\": %s\n",
*analyze_script_file_name, getErrorText(errno));
*analyze_script_file_name, getErrorText(errno));
#endif
if (os_info.user_specified)
@ -632,7 +632,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
if ((script = fopen_priv(*deletion_script_file_name, "w")) == NULL)
pg_fatal("Could not open file \"%s\": %s\n",
*deletion_script_file_name, getErrorText(errno));
*deletion_script_file_name, getErrorText(errno));
#ifndef WIN32
/* add shebang header */
@ -668,7 +668,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
}
else
{
char *suffix_path = pg_strdup(old_cluster.tablespace_suffix);
char *suffix_path = pg_strdup(old_cluster.tablespace_suffix);
/*
* Simply delete the tablespace directory, which might be ".old"
@ -686,7 +686,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
#ifndef WIN32
if (chmod(*deletion_script_file_name, S_IRWXU) != 0)
pg_fatal("Could not add execute permission to file \"%s\": %s\n",
*deletion_script_file_name, getErrorText(errno));
*deletion_script_file_name, getErrorText(errno));
#endif
check_ok();
@ -714,7 +714,7 @@ check_is_super_user(ClusterInfo *cluster)
if (PQntuples(res) != 1 || strcmp(PQgetvalue(res, 0, 0), "t") != 0)
pg_fatal("database user \"%s\" is not a superuser\n",
os_info.user);
os_info.user);
cluster->install_role_oid = atooid(PQgetvalue(res, 0, 1));
@ -757,7 +757,7 @@ check_for_prepared_transactions(ClusterInfo *cluster)
if (PQntuples(res) != 0)
pg_fatal("The %s cluster contains prepared transactions\n",
CLUSTER_NAME(cluster));
CLUSTER_NAME(cluster));
PQclear(res);
@ -822,7 +822,7 @@ check_for_isn_and_int8_passing_mismatch(ClusterInfo *cluster)
found = true;
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
pg_fatal("Could not open file \"%s\": %s\n",
output_path, getErrorText(errno));
output_path, getErrorText(errno));
if (!db_used)
{
fprintf(script, "Database: %s\n", active_db->db_name);
@ -847,10 +847,10 @@ check_for_isn_and_int8_passing_mismatch(ClusterInfo *cluster)
pg_fatal("Your installation contains \"contrib/isn\" functions which rely on the\n"
"bigint data type. Your old and new clusters pass bigint values\n"
"differently so this cluster cannot currently be upgraded. You can\n"
"manually upgrade databases that use \"contrib/isn\" facilities and remove\n"
"\"contrib/isn\" from the old cluster and restart the upgrade. A list of\n"
"the problem functions is in the file:\n"
" %s\n\n", output_path);
"manually upgrade databases that use \"contrib/isn\" facilities and remove\n"
"\"contrib/isn\" from the old cluster and restart the upgrade. A list of\n"
"the problem functions is in the file:\n"
" %s\n\n", output_path);
}
else
check_ok();
@ -926,7 +926,7 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
found = true;
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
pg_fatal("Could not open file \"%s\": %s\n",
output_path, getErrorText(errno));
output_path, getErrorText(errno));
if (!db_used)
{
fprintf(script, "Database: %s\n", active_db->db_name);
@ -952,9 +952,9 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
pg_fatal("Your installation contains one of the reg* data types in user tables.\n"
"These data types reference system OIDs that are not preserved by\n"
"pg_upgrade, so this cluster cannot currently be upgraded. You can\n"
"remove the problem tables and restart the upgrade. A list of the problem\n"
"columns is in the file:\n"
" %s\n\n", output_path);
"remove the problem tables and restart the upgrade. A list of the problem\n"
"columns is in the file:\n"
" %s\n\n", output_path);
}
else
check_ok();
@ -975,7 +975,7 @@ get_bin_version(ClusterInfo *cluster)
if ((output = popen(cmd, "r")) == NULL ||
fgets(cmd_output, sizeof(cmd_output), output) == NULL)
pg_fatal("Could not get pg_ctl version data using %s: %s\n",
cmd, getErrorText(errno));
cmd, getErrorText(errno));
pclose(output);

View File

@ -27,7 +27,7 @@
* pg_control data. pg_resetxlog cannot be run while the server is running
* so we use pg_controldata; pg_controldata doesn't provide all the fields
* we need to actually perform the upgrade, but it provides enough for
* check mode. We do not implement pg_resetxlog -n because it is hard to
* check mode. We do not implement pg_resetxlog -n because it is hard to
* return valid xid data for a running server.
*/
void
@ -119,7 +119,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
if ((output = popen(cmd, "r")) == NULL)
pg_fatal("Could not get control data using %s: %s\n",
cmd, getErrorText(errno));
cmd, getErrorText(errno));
/* Only pre-8.4 has these so if they are not set below we will check later */
cluster->controldata.lc_collate = NULL;
@ -156,8 +156,8 @@ get_control_data(ClusterInfo *cluster, bool live_check)
for (p = bufin; *p; p++)
if (!isascii(*p))
pg_fatal("The 8.3 cluster's pg_controldata is incapable of outputting ASCII, even\n"
"with LANG=C. You must upgrade this cluster to a newer version of PostgreSQL\n"
"8.3 to fix this bug. PostgreSQL 8.3.7 and later are known to work properly.\n");
"with LANG=C. You must upgrade this cluster to a newer version of PostgreSQL\n"
"8.3 to fix this bug. PostgreSQL 8.3.7 and later are known to work properly.\n");
}
#endif
@ -606,8 +606,8 @@ check_control_data(ControlData *oldctrl,
* This is a common 8.3 -> 8.4 upgrade problem, so we are more verbose
*/
pg_fatal("You will need to rebuild the new server with configure option\n"
"--disable-integer-datetimes or get server binaries built with those\n"
"options.\n");
"--disable-integer-datetimes or get server binaries built with those\n"
"options.\n");
}
/*

View File

@ -34,8 +34,8 @@ generate_old_dump(void)
/*
* Set umask for this function, all functions it calls, and all
* subprocesses/threads it creates. We can't use fopen_priv()
* as Windows uses threads and umask is process-global.
* subprocesses/threads it creates. We can't use fopen_priv() as Windows
* uses threads and umask is process-global.
*/
old_umask = umask(S_IRWXG | S_IRWXO);

View File

@ -52,7 +52,7 @@ exec_prog(const char *log_file, const char *opt_log_file,
va_list ap;
#ifdef WIN32
static DWORD mainThreadId = 0;
static DWORD mainThreadId = 0;
/* We assume we are called from the primary thread first */
if (mainThreadId == 0)
@ -73,14 +73,15 @@ static DWORD mainThreadId = 0;
pg_log(PG_VERBOSE, "%s\n", cmd);
#ifdef WIN32
/*
* For some reason, Windows issues a file-in-use error if we write data
* to the log file from a non-primary thread just before we create a
* subprocess that also writes to the same log file. One fix is to
* sleep for 100ms. A cleaner fix is to write to the log file _after_
* the subprocess has completed, so we do this only when writing from
* a non-primary thread. fflush(), running system() twice, and
* pre-creating the file do not see to help.
* For some reason, Windows issues a file-in-use error if we write data to
* the log file from a non-primary thread just before we create a
* subprocess that also writes to the same log file. One fix is to sleep
* for 100ms. A cleaner fix is to write to the log file _after_ the
* subprocess has completed, so we do this only when writing from a
* non-primary thread. fflush(), running system() twice, and pre-creating
* the file do not see to help.
*/
if (mainThreadId != GetCurrentThreadId())
result = system(cmd);
@ -101,7 +102,7 @@ static DWORD mainThreadId = 0;
for (iter = 0; iter < 4 && log == NULL; iter++)
{
pg_usleep(1000000); /* 1 sec */
pg_usleep(1000000); /* 1 sec */
log = fopen(log_file, "a");
}
}
@ -154,11 +155,12 @@ static DWORD mainThreadId = 0;
}
#ifndef WIN32
/*
* We can't do this on Windows because it will keep the "pg_ctl start"
* output filename open until the server stops, so we do the \n\n above on
* that platform. We use a unique filename for "pg_ctl start" that is
* never reused while the server is running, so it works fine. We could
* never reused while the server is running, so it works fine. We could
* log these commands to a third file, but that just adds complexity.
*/
if ((log = fopen(log_file, "a")) == NULL)
@ -189,7 +191,7 @@ pid_lock_file_exists(const char *datadir)
/* ENOTDIR means we will throw a more useful error later */
if (errno != ENOENT && errno != ENOTDIR)
pg_fatal("could not open file \"%s\" for reading: %s\n",
path, getErrorText(errno));
path, getErrorText(errno));
return false;
}
@ -238,7 +240,7 @@ win32_check_directory_write_permissions(void)
int fd;
/*
* We open a file we would normally create anyway. We do this even in
* We open a file we would normally create anyway. We do this even in
* 'check' mode, which isn't ideal, but this is the best we can do.
*/
if ((fd = open(GLOBALS_DUMP_FILE, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) < 0)
@ -255,7 +257,7 @@ win32_check_directory_write_permissions(void)
*
* This function validates the given cluster directory - we search for a
* small set of subdirectories that we expect to find in a valid $PGDATA
* directory. If any of the subdirectories are missing (or secured against
* directory. If any of the subdirectories are missing (or secured against
* us) we display an error message and exit()
*
*/
@ -295,7 +297,7 @@ check_data_dir(const char *pg_data)
* check_bin_dir()
*
* This function searches for the executables that we expect to find
* in the binaries directory. If we find that a required executable
* in the binaries directory. If we find that a required executable
* is missing (or secured against us), we display an error message and
* exit().
*/
@ -349,10 +351,10 @@ validate_exec(const char *dir, const char *cmdName)
*/
if (stat(path, &buf) < 0)
pg_fatal("check for \"%s\" failed: %s\n",
path, getErrorText(errno));
path, getErrorText(errno));
else if (!S_ISREG(buf.st_mode))
pg_fatal("check for \"%s\" failed: not an executable file\n",
path);
path);
/*
* Ensure that the file is both executable and readable (required for
@ -364,7 +366,7 @@ validate_exec(const char *dir, const char *cmdName)
if ((buf.st_mode & S_IRUSR) == 0)
#endif
pg_fatal("check for \"%s\" failed: cannot read file (permission denied)\n",
path);
path);
#ifndef WIN32
if (access(path, X_OK) != 0)
@ -372,5 +374,5 @@ validate_exec(const char *dir, const char *cmdName)
if ((buf.st_mode & S_IXUSR) == 0)
#endif
pg_fatal("check for \"%s\" failed: cannot execute (permission denied)\n",
path);
path);
}

View File

@ -214,8 +214,8 @@ check_hard_link(void)
if (pg_link_file(existing_file, new_link_file) == -1)
{
pg_fatal("Could not create hard link between old and new data directories: %s\n"
"In link mode the old and new data directories must be on the same file system volume.\n",
getErrorText(errno));
"In link mode the old and new data directories must be on the same file system volume.\n",
getErrorText(errno));
}
unlink(new_link_file);
}

View File

@ -296,7 +296,7 @@ check_loadable_libraries(void)
* plpython2u language was created with library name plpython2.so as a
* symbolic link to plpython.so. In Postgres 9.1, only the
* plpython2.so library was created, and both plpythonu and plpython2u
* pointing to it. For this reason, any reference to library name
* pointing to it. For this reason, any reference to library name
* "plpython" in an old PG <= 9.1 cluster must look for "plpython2" in
* the new cluster.
*
@ -327,7 +327,7 @@ check_loadable_libraries(void)
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
pg_fatal("Could not open file \"%s\": %s\n",
output_path, getErrorText(errno));
output_path, getErrorText(errno));
fprintf(script, "Could not load library \"%s\"\n%s\n",
lib,
PQerrorMessage(conn));
@ -343,10 +343,10 @@ check_loadable_libraries(void)
fclose(script);
pg_log(PG_REPORT, "fatal\n");
pg_fatal("Your installation references loadable libraries that are missing from the\n"
"new installation. You can add these libraries to the new installation,\n"
"or remove the functions using them from the old installation. A list of\n"
"problem libraries is in the file:\n"
" %s\n\n", output_path);
"new installation. You can add these libraries to the new installation,\n"
"or remove the functions using them from the old installation. A list of\n"
"problem libraries is in the file:\n"
" %s\n\n", output_path);
}
else
check_ok();

View File

@ -52,7 +52,7 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
if (old_rel->reloid != new_rel->reloid)
pg_fatal("Mismatch of relation OID in database \"%s\": old OID %d, new OID %d\n",
old_db->db_name, old_rel->reloid, new_rel->reloid);
old_db->db_name, old_rel->reloid, new_rel->reloid);
/*
* TOAST table names initially match the heap pg_class oid. In
@ -69,9 +69,9 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
strcmp(old_rel->nspname, "pg_toast") != 0) &&
strcmp(old_rel->relname, new_rel->relname) != 0))
pg_fatal("Mismatch of relation names in database \"%s\": "
"old name \"%s.%s\", new name \"%s.%s\"\n",
old_db->db_name, old_rel->nspname, old_rel->relname,
new_rel->nspname, new_rel->relname);
"old name \"%s.%s\", new name \"%s.%s\"\n",
old_db->db_name, old_rel->nspname, old_rel->relname,
new_rel->nspname, new_rel->relname);
create_rel_filename_map(old_pgdata, new_pgdata, old_db, new_db,
old_rel, new_rel, maps + num_maps);
@ -84,7 +84,7 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
*/
if (old_db->rel_arr.nrels != new_db->rel_arr.nrels)
pg_fatal("old and new databases \"%s\" have a different number of relations\n",
old_db->db_name);
old_db->db_name);
*nmaps = num_maps;
return maps;
@ -270,7 +270,8 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
i_relfilenode,
i_reltablespace;
char query[QUERY_ALLOC];
char *last_namespace = NULL, *last_tablespace = NULL;
char *last_namespace = NULL,
*last_tablespace = NULL;
/*
* pg_largeobject contains user data that does not appear in pg_dumpall
@ -322,7 +323,7 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
"SELECT reltoastrelid "
"FROM info_rels i JOIN pg_catalog.pg_class c "
" ON i.reloid = c.oid "
" AND c.reltoastrelid != %u", InvalidOid));
" AND c.reltoastrelid != %u", InvalidOid));
PQclear(executeQueryOrDie(conn,
"INSERT INTO info_rels "
"SELECT indexrelid "
@ -373,9 +374,9 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
curr->nsp_alloc = false;
/*
* Many of the namespace and tablespace strings are identical,
* so we try to reuse the allocated string pointers where possible
* to reduce memory consumption.
* Many of the namespace and tablespace strings are identical, so we
* try to reuse the allocated string pointers where possible to reduce
* memory consumption.
*/
/* Can we reuse the previous string allocation? */
if (last_namespace && strcmp(nspname, last_namespace) == 0)

View File

@ -188,7 +188,7 @@ parseCommandLine(int argc, char *argv[])
default:
pg_fatal("Try \"%s --help\" for more information.\n",
os_info.progname);
os_info.progname);
break;
}
}
@ -211,8 +211,9 @@ parseCommandLine(int argc, char *argv[])
/* Turn off read-only mode; add prefix to PGOPTIONS? */
if (getenv("PGOPTIONS"))
{
char *pgoptions = psprintf("%s %s", FIX_DEFAULT_READ_ONLY,
getenv("PGOPTIONS"));
char *pgoptions = psprintf("%s %s", FIX_DEFAULT_READ_ONLY,
getenv("PGOPTIONS"));
pg_putenv("PGOPTIONS", pgoptions);
pfree(pgoptions);
}
@ -319,8 +320,8 @@ check_required_directory(char **dirpath, char **configpath,
}
else
pg_fatal("You must identify the directory where the %s.\n"
"Please use the %s command-line option or the %s environment variable.\n",
description, cmdLineOption, envVarName);
"Please use the %s command-line option or the %s environment variable.\n",
description, cmdLineOption, envVarName);
}
/*
@ -373,7 +374,7 @@ adjust_data_dir(ClusterInfo *cluster)
/*
* We don't have a data directory yet, so we can't check the PG version,
* so this might fail --- only works for PG 9.2+. If this fails,
* so this might fail --- only works for PG 9.2+. If this fails,
* pg_upgrade will fail anyway because the data files will not be found.
*/
snprintf(cmd, sizeof(cmd), "\"%s/postmaster\" -D \"%s\" -C data_directory",
@ -382,7 +383,7 @@ adjust_data_dir(ClusterInfo *cluster)
if ((output = popen(cmd, "r")) == NULL ||
fgets(cmd_output, sizeof(cmd_output), output) == NULL)
pg_fatal("Could not get data directory using %s: %s\n",
cmd, getErrorText(errno));
cmd, getErrorText(errno));
pclose(output);

View File

@ -30,7 +30,7 @@ static pageCnvCtx *loadConverterPlugin(
* the PageLayoutVersion of the new cluster. If the versions differ, this
* function loads a converter plugin and returns a pointer to a pageCnvCtx
* object (in *result) that knows how to convert pages from the old format
* to the new format. If the versions are identical, this function just
* to the new format. If the versions are identical, this function just
* returns a NULL pageCnvCtx pointer to indicate that page-by-page conversion
* is not required.
*/
@ -110,7 +110,7 @@ getPageVersion(uint16 *version, const char *pathName)
* This function loads a page-converter plugin library and grabs a
* pointer to each of the (interesting) functions provided by that
* plugin. The name of the plugin library is derived from the given
* newPageVersion and oldPageVersion. If a plugin is found, this
* newPageVersion and oldPageVersion. If a plugin is found, this
* function returns a pointer to a pageCnvCtx object (which will contain
* a collection of plugin function pointers). If the required plugin
* is not found, this function returns NULL.

View File

@ -339,10 +339,10 @@ reap_child(bool wait_for_child)
thread_handles[thread_num] = thread_handles[parallel_jobs - 1];
/*
* Move last active thead arg struct into the now-dead slot,
* and the now-dead slot to the end for reuse by the next thread.
* Though the thread struct is in use by another thread, we can
* safely swap the struct pointers within the array.
* Move last active thead arg struct into the now-dead slot, and the
* now-dead slot to the end for reuse by the next thread. Though the
* thread struct is in use by another thread, we can safely swap the
* struct pointers within the array.
*/
tmp_args = cur_thread_args[thread_num];
cur_thread_args[thread_num] = cur_thread_args[parallel_jobs - 1];

View File

@ -125,7 +125,7 @@ main(int argc, char **argv)
/*
* Most failures happen in create_new_objects(), which has completed at
* this point. We do this here because it is just before linking, which
* this point. We do this here because it is just before linking, which
* will link the old and new cluster data files, preventing the old
* cluster from being safely started once the new cluster is started.
*/
@ -193,7 +193,7 @@ setup(char *argv0, bool *live_check)
{
/*
* If we have a postmaster.pid file, try to start the server. If it
* starts, the pid file was stale, so stop the server. If it doesn't
* starts, the pid file was stale, so stop the server. If it doesn't
* start, assume the server is running. If the pid file is left over
* from a server crash, this also allows any committed transactions
* stored in the WAL to be replayed so they are not lost, because WAL
@ -205,7 +205,7 @@ setup(char *argv0, bool *live_check)
{
if (!user_opts.check)
pg_fatal("There seems to be a postmaster servicing the old cluster.\n"
"Please shutdown that postmaster and try again.\n");
"Please shutdown that postmaster and try again.\n");
else
*live_check = true;
}
@ -218,7 +218,7 @@ setup(char *argv0, bool *live_check)
stop_postmaster(false);
else
pg_fatal("There seems to be a postmaster servicing the new cluster.\n"
"Please shutdown that postmaster and try again.\n");
"Please shutdown that postmaster and try again.\n");
}
/* get path to pg_upgrade executable */
@ -279,8 +279,8 @@ prepare_new_databases(void)
/*
* Install support functions in the global-object restore database to
* preserve pg_authid.oid. pg_dumpall uses 'template0' as its template
* database so objects we add into 'template1' are not propogated. They
* preserve pg_authid.oid. pg_dumpall uses 'template0' as its template
* database so objects we add into 'template1' are not propogated. They
* are removed on pg_upgrade exit.
*/
install_support_functions_in_new_db("template1");

View File

@ -142,10 +142,10 @@ typedef struct
*/
typedef struct
{
const char *old_tablespace;
const char *new_tablespace;
const char *old_tablespace_suffix;
const char *new_tablespace_suffix;
const char *old_tablespace;
const char *new_tablespace;
const char *old_tablespace_suffix;
const char *new_tablespace_suffix;
Oid old_db_oid;
Oid new_db_oid;
@ -167,7 +167,8 @@ typedef struct
{
Oid db_oid; /* oid of the database */
char *db_name; /* database name */
char db_tablespace[MAXPGPATH]; /* database default tablespace path */
char db_tablespace[MAXPGPATH]; /* database default tablespace
* path */
RelInfoArr rel_arr; /* array of all user relinfos */
} DbInfo;
@ -454,7 +455,7 @@ pg_log(eLogType type, const char *fmt,...)
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
void
pg_fatal(const char *fmt,...)
__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2),noreturn));
__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2), noreturn));
void end_progress_output(void);
void
prep_status(const char *fmt,...)

View File

@ -37,7 +37,7 @@ transfer_all_new_tablespaces(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr,
/*
* Transfering files by tablespace is tricky because a single database can
* use multiple tablespaces. For non-parallel mode, we just pass a NULL
* tablespace path, which matches all tablespaces. In parallel mode, we
* tablespace path, which matches all tablespaces. In parallel mode, we
* pass the default tablespace and all user-created tablespaces and let
* those operations happen in parallel.
*/
@ -108,7 +108,7 @@ transfer_all_new_dbs(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr,
if (new_dbnum >= new_db_arr->ndbs)
pg_fatal("old database \"%s\" not found in the new cluster\n",
old_db->db_name);
old_db->db_name);
n_maps = 0;
mappings = gen_db_file_maps(old_db, new_db, &n_maps, old_pgdata,
@ -135,7 +135,7 @@ transfer_all_new_dbs(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr,
/*
* get_pg_database_relfilenode()
*
* Retrieves the relfilenode for a few system-catalog tables. We need these
* Retrieves the relfilenode for a few system-catalog tables. We need these
* relfilenodes later in the upgrade process.
*/
void
@ -259,8 +259,8 @@ transfer_relfile(pageCnvCtx *pageConverter, FileNameMap *map,
return;
else
pg_fatal("error while checking for file existence \"%s.%s\" (\"%s\" to \"%s\"): %s\n",
map->nspname, map->relname, old_file, new_file,
getErrorText(errno));
map->nspname, map->relname, old_file, new_file,
getErrorText(errno));
}
close(fd);
}
@ -272,7 +272,7 @@ transfer_relfile(pageCnvCtx *pageConverter, FileNameMap *map,
if ((user_opts.transfer_mode == TRANSFER_MODE_LINK) && (pageConverter != NULL))
pg_fatal("This upgrade requires page-by-page conversion, "
"you must use copy mode instead of link mode.\n");
"you must use copy mode instead of link mode.\n");
if (user_opts.transfer_mode == TRANSFER_MODE_COPY)
{
@ -280,7 +280,7 @@ transfer_relfile(pageCnvCtx *pageConverter, FileNameMap *map,
if ((msg = copyAndUpdateFile(pageConverter, old_file, new_file, true)) != NULL)
pg_fatal("error while copying relation \"%s.%s\" (\"%s\" to \"%s\"): %s\n",
map->nspname, map->relname, old_file, new_file, msg);
map->nspname, map->relname, old_file, new_file, msg);
}
else
{
@ -288,7 +288,7 @@ transfer_relfile(pageCnvCtx *pageConverter, FileNameMap *map,
if ((msg = linkAndUpdateFile(pageConverter, old_file, new_file)) != NULL)
pg_fatal("error while creating link for relation \"%s.%s\" (\"%s\" to \"%s\"): %s\n",
map->nspname, map->relname, old_file, new_file, msg);
map->nspname, map->relname, old_file, new_file, msg);
}
}

View File

@ -240,28 +240,26 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
return false;
/*
* We set this here to make sure atexit() shuts down the server,
* but only if we started the server successfully. We do it
* before checking for connectivity in case the server started but
* there is a connectivity failure. If pg_ctl did not return success,
* we will exit below.
* We set this here to make sure atexit() shuts down the server, but only
* if we started the server successfully. We do it before checking for
* connectivity in case the server started but there is a connectivity
* failure. If pg_ctl did not return success, we will exit below.
*
* Pre-9.1 servers do not have PQping(), so we could be leaving the server
* running if authentication was misconfigured, so someday we might went to
* be more aggressive about doing server shutdowns even if pg_ctl fails,
* but now (2013-08-14) it seems prudent to be cautious. We don't want to
* shutdown a server that might have been accidentally started during the
* upgrade.
* running if authentication was misconfigured, so someday we might went
* to be more aggressive about doing server shutdowns even if pg_ctl
* fails, but now (2013-08-14) it seems prudent to be cautious. We don't
* want to shutdown a server that might have been accidentally started
* during the upgrade.
*/
if (pg_ctl_return)
os_info.running_cluster = cluster;
/*
* pg_ctl -w might have failed because the server couldn't be started,
* or there might have been a connection problem in _checking_ if the
* server has started. Therefore, even if pg_ctl failed, we continue
* and test for connectivity in case we get a connection reason for the
* failure.
* pg_ctl -w might have failed because the server couldn't be started, or
* there might have been a connection problem in _checking_ if the server
* has started. Therefore, even if pg_ctl failed, we continue and test
* for connectivity in case we get a connection reason for the failure.
*/
if ((conn = get_db_conn(cluster, "template1")) == NULL ||
PQstatus(conn) != CONNECTION_OK)
@ -271,18 +269,19 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
if (conn)
PQfinish(conn);
pg_fatal("could not connect to %s postmaster started with the command:\n"
"%s\n",
CLUSTER_NAME(cluster), cmd);
"%s\n",
CLUSTER_NAME(cluster), cmd);
}
PQfinish(conn);
/*
* If pg_ctl failed, and the connection didn't fail, and throw_error is
* enabled, fail now. This could happen if the server was already running.
* enabled, fail now. This could happen if the server was already
* running.
*/
if (!pg_ctl_return)
pg_fatal("pg_ctl failed to start the %s server, or connection failed\n",
CLUSTER_NAME(cluster));
CLUSTER_NAME(cluster));
return true;
}
@ -340,7 +339,7 @@ check_pghost_envvar(void)
(strcmp(value, "localhost") != 0 && strcmp(value, "127.0.0.1") != 0 &&
strcmp(value, "::1") != 0 && value[0] != '/'))
pg_fatal("libpq environment variable %s has a non-local server value: %s\n",
option->envvar, value);
option->envvar, value);
}
}

View File

@ -28,7 +28,7 @@ init_tablespaces(void)
if (os_info.num_old_tablespaces > 0 &&
strcmp(old_cluster.tablespace_suffix, new_cluster.tablespace_suffix) == 0)
pg_fatal("Cannot upgrade to/from the same system catalog version when\n"
"using tablespaces.\n");
"using tablespaces.\n");
}
@ -78,10 +78,9 @@ get_tablespace_paths(void)
* Effectively, this is checking only for tables/indexes in
* non-existent tablespace directories. Databases located in
* non-existent tablespaces already throw a backend error.
* Non-existent tablespace directories can occur when a data
* directory that contains user tablespaces is moved as part
* of pg_upgrade preparation and the symbolic links are not
* updated.
* Non-existent tablespace directories can occur when a data directory
* that contains user tablespaces is moved as part of pg_upgrade
* preparation and the symbolic links are not updated.
*/
if (stat(os_info.old_tablespaces[tblnum], &statBuf) != 0)
{
@ -91,13 +90,13 @@ get_tablespace_paths(void)
os_info.old_tablespaces[tblnum]);
else
report_status(PG_FATAL,
"cannot stat() tablespace directory \"%s\": %s\n",
os_info.old_tablespaces[tblnum], getErrorText(errno));
"cannot stat() tablespace directory \"%s\": %s\n",
os_info.old_tablespaces[tblnum], getErrorText(errno));
}
if (!S_ISDIR(statBuf.st_mode))
report_status(PG_FATAL,
"tablespace path \"%s\" is not a directory\n",
os_info.old_tablespaces[tblnum]);
report_status(PG_FATAL,
"tablespace path \"%s\" is not a directory\n",
os_info.old_tablespaces[tblnum]);
}
PQclear(res);

View File

@ -82,7 +82,7 @@ prep_status(const char *fmt,...)
static
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 0)))
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 0)))
void
pg_log_v(eLogType type, const char *fmt, va_list ap)
{
@ -280,7 +280,7 @@ pg_putenv(const char *var, const char *val)
/*
* Do not free envstr because it becomes part of the environment on
* some operating systems. See port/unsetenv.c::unsetenv.
* some operating systems. See port/unsetenv.c::unsetenv.
*/
#else
SetEnvironmentVariableA(var, val);

View File

@ -98,10 +98,10 @@ old_8_3_check_for_name_data_type_usage(ClusterInfo *cluster)
pg_log(PG_REPORT, "fatal\n");
pg_fatal("Your installation contains the \"name\" data type in user tables. This\n"
"data type changed its internal alignment between your old and new\n"
"clusters so this cluster cannot currently be upgraded. You can remove\n"
"clusters so this cluster cannot currently be upgraded. You can remove\n"
"the problem tables and restart the upgrade. A list of the problem\n"
"columns is in the file:\n"
" %s\n\n", output_path);
"columns is in the file:\n"
" %s\n\n", output_path);
}
else
check_ok();
@ -187,11 +187,11 @@ old_8_3_check_for_tsquery_usage(ClusterInfo *cluster)
{
pg_log(PG_REPORT, "fatal\n");
pg_fatal("Your installation contains the \"tsquery\" data type. This data type\n"
"added a new internal field between your old and new clusters so this\n"
"added a new internal field between your old and new clusters so this\n"
"cluster cannot currently be upgraded. You can remove the problem\n"
"columns and restart the upgrade. A list of the problem columns is in the\n"
"file:\n"
" %s\n\n", output_path);
"columns and restart the upgrade. A list of the problem columns is in the\n"
"file:\n"
" %s\n\n", output_path);
}
else
check_ok();
@ -242,7 +242,7 @@ old_8_3_check_ltree_usage(ClusterInfo *cluster)
found = true;
if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
pg_fatal("Could not open file \"%s\": %s\n",
output_path, getErrorText(errno));
output_path, getErrorText(errno));
if (!db_used)
{
fprintf(script, "Database: %s\n", active_db->db_name);
@ -265,12 +265,12 @@ old_8_3_check_ltree_usage(ClusterInfo *cluster)
{
pg_log(PG_REPORT, "fatal\n");
pg_fatal("Your installation contains the \"ltree\" data type. This data type\n"
"changed its internal storage format between your old and new clusters so this\n"
"cluster cannot currently be upgraded. You can manually upgrade databases\n"
"that use \"contrib/ltree\" facilities and remove \"contrib/ltree\" from the old\n"
"cluster and restart the upgrade. A list of the problem functions is in the\n"
"file:\n"
" %s\n\n", output_path);
"changed its internal storage format between your old and new clusters so this\n"
"cluster cannot currently be upgraded. You can manually upgrade databases\n"
"that use \"contrib/ltree\" facilities and remove \"contrib/ltree\" from the old\n"
"cluster and restart the upgrade. A list of the problem functions is in the\n"
"file:\n"
" %s\n\n", output_path);
}
else
check_ok();