This is an automated email from the ASF dual-hosted git repository.
chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/cbdb-postgres-merge by this
push:
new 2b0cc459acb fix src/bin
2b0cc459acb is described below
commit 2b0cc459acb29c70f756ab1717376b66bbcda064
Author: liushengsong <[email protected]>
AuthorDate: Fri Feb 6 15:39:05 2026 +0800
fix src/bin
---
src/bin/Makefile | 30 +--
src/bin/pg_alterckey/pg_alterckey.c | 4 +-
src/bin/pg_upgrade/check.c | 294 +-------------------------
src/bin/pg_upgrade/controldata.c | 40 +---
src/bin/pg_upgrade/dump.c | 10 -
src/bin/pg_upgrade/exec.c | 1 -
src/bin/pg_upgrade/function.c | 12 --
src/bin/pg_upgrade/greenplum/controldata_gp.c | 2 +-
src/bin/pg_upgrade/info.c | 19 --
src/bin/pg_upgrade/option.c | 13 +-
src/bin/pg_upgrade/pg_upgrade.c | 109 +---------
src/bin/pg_upgrade/pg_upgrade.h | 38 +---
src/bin/pg_upgrade/relfilenumber.c | 89 +-------
src/bin/pg_upgrade/server.c | 11 -
src/bin/pg_upgrade/tablespace.c | 4 +-
src/bin/pg_upgrade/util.c | 40 +---
src/bin/pg_upgrade/version.c | 149 +------------
src/bin/pg_verifybackup/pg_verifybackup.c | 8 -
src/bin/pgbench/pgbench.c | 146 +------------
19 files changed, 30 insertions(+), 989 deletions(-)
diff --git a/src/bin/Makefile b/src/bin/Makefile
index 80adb09debb..2aa122a9113 100644
--- a/src/bin/Makefile
+++ b/src/bin/Makefile
@@ -16,34 +16,12 @@ include $(top_builddir)/src/Makefile.global
unittest-check:
$(MAKE) -C pg_dump/test check
-#SUBDIRS = \
-# initdb \
-# gpfts \
-# pg_amcheck \
-# pg_archivecleanup \
-# pg_alterckey \
-# pg_basebackup \
-# pg_checksums \
-# pg_config \
-# pg_controldata \
-# pg_ctl \
-# pg_dump \
-# pg_resetwal \
-# pg_rewind \
-# pg_test_fsync \
-# pg_test_timing \
-# pg_upgrade \
-# pg_verifybackup \
-# pg_waldump \
-# pgbench \
-# psql \
-# scripts
-
SUBDIRS = \
initdb \
gpfts \
pg_amcheck \
pg_archivecleanup \
+ pg_alterckey \
pg_basebackup \
pg_checksums \
pg_config \
@@ -52,6 +30,12 @@ SUBDIRS = \
pg_dump \
pg_resetwal \
pg_rewind \
+ pg_test_fsync \
+ pg_test_timing \
+ pg_upgrade \
+ pg_verifybackup \
+ pg_waldump \
+ pgbench \
psql \
scripts
diff --git a/src/bin/pg_alterckey/pg_alterckey.c
b/src/bin/pg_alterckey/pg_alterckey.c
index 6449e5b896d..c699c597616 100644
--- a/src/bin/pg_alterckey/pg_alterckey.c
+++ b/src/bin/pg_alterckey/pg_alterckey.c
@@ -750,7 +750,7 @@ get_hex(const char *cp)
res = hexlookup[c];
if (res < 0)
- pg_log_fatal("invalid hexadecimal digit: \"%s\"",cp);
+ pg_fatal("invalid hexadecimal digit: \"%s\"",cp);
return (char) res;
}
@@ -777,7 +777,7 @@ hex_decode(const char *src, size_t len, char *dst)
v1 = get_hex(s) << 4;
s++;
if (s >= srcend)
- pg_log_fatal("invalid hexadecimal data: odd number of
digits");
+ pg_fatal("invalid hexadecimal data: odd number of
digits");
v2 = get_hex(s);
s++;
diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c
index cadcb3beefb..28ebbb221d4 100644
--- a/src/bin/pg_upgrade/check.c
+++ b/src/bin/pg_upgrade/check.c
@@ -27,10 +27,7 @@ static void check_for_incompatible_polymorphics(ClusterInfo
*cluster);
static void check_for_tables_with_oids(ClusterInfo *cluster);
static void check_for_composite_data_type_usage(ClusterInfo *cluster);
static void check_for_reg_data_type_usage(ClusterInfo *cluster);
-<<<<<<< HEAD
-=======
static void check_for_aclitem_data_type_usage(ClusterInfo *cluster);
->>>>>>> REL_16_9
static void check_for_removed_data_type_usage(ClusterInfo *cluster,
const char *version,
const char *datatype);
@@ -122,7 +119,6 @@ check_and_dump_old_cluster(bool live_check, char
**sequence_script_file_name)
check_for_isn_and_int8_passing_mismatch(&old_cluster);
/*
-<<<<<<< HEAD
* Check for various Greenplum failure cases
*/
check_greenplum();
@@ -130,7 +126,8 @@ check_and_dump_old_cluster(bool live_check, char
**sequence_script_file_name)
/* GPDB 7 removed support for SHA-256 hashed passwords */
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 905)
old_GPDB6_check_for_unsupported_sha256_password_hashes();
-=======
+
+ /*
* PG 16 increased the size of the 'aclitem' type, which breaks the
* on-disk format for existing data.
*/
@@ -147,7 +144,6 @@ check_and_dump_old_cluster(bool live_check, char
**sequence_script_file_name)
check_for_removed_data_type_usage(&old_cluster, "12",
"tinterval");
}
->>>>>>> REL_16_9
/*
* PG 14 changed the function signature of encoding conversion
functions.
* Conversions from older versions cannot be upgraded automatically
@@ -226,12 +222,9 @@ check_and_dump_old_cluster(bool live_check, char
**sequence_script_file_name)
old_9_3_check_for_line_data_type_usage(&old_cluster);
#endif
-<<<<<<< HEAD
teardown_GPDB6_data_type_checks(&old_cluster);
dump_old_cluster:
-=======
->>>>>>> REL_16_9
/*
* While not a check option, we do this now because this is the only
time
* the old server is running.
@@ -281,7 +274,6 @@ report_clusters_compatible(void)
{
if (user_opts.check)
{
-<<<<<<< HEAD
if (get_check_fatal_occurred())
{
char cwd[MAXPGPATH];
@@ -299,13 +291,6 @@ report_clusters_compatible(void)
if (get_check_fatal_occurred())
exit(1);
-=======
- pg_log(PG_REPORT, "\n*Clusters are compatible*");
- /* stops new cluster */
- stop_postmaster(false);
-
- cleanup_output_dirs();
->>>>>>> REL_16_9
exit(0);
}
@@ -383,7 +368,6 @@ check_cluster_versions(void)
* upgrades
*/
-<<<<<<< HEAD
/*
* Upgrading from anything older than an 9.4 based Greenplum (GPDB6) is
not supported.
*/
@@ -391,6 +375,10 @@ check_cluster_versions(void)
if (GET_MAJOR_VERSION(old_cluster.major_version) < 904)
pg_fatal("This utility can only upgrade from Greenplum version
6 and later.\n");
+ if (GET_MAJOR_VERSION(old_cluster.major_version) < 902)
+ pg_fatal("This utility can only upgrade from PostgreSQL version
%s and later.",
+ "9.2");
+
/* Ensure binaries match the designated data directories */
if (GET_MAJOR_VERSION(old_cluster.major_version) !=
GET_MAJOR_VERSION(old_cluster.bin_version))
@@ -408,15 +396,6 @@ 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 Greenplum version
%s.\n",
-=======
- if (GET_MAJOR_VERSION(old_cluster.major_version) < 902)
- pg_fatal("This utility can only upgrade from PostgreSQL version
%s and later.",
- "9.2");
-
- /* 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.",
->>>>>>> REL_16_9
PG_MAJORVERSION);
/*
@@ -425,18 +404,12 @@ check_cluster_versions(void)
* older versions.
*/
if (old_cluster.major_version > new_cluster.major_version)
-<<<<<<< HEAD
pg_fatal("This utility cannot be used to downgrade to older
major Greenplum versions.\n");
/* Ensure binaries match the designated data directories */
-=======
- pg_fatal("This utility cannot be used to downgrade to older
major PostgreSQL versions.");
-
- /* Ensure binaries match the designated data directories */
if (GET_MAJOR_VERSION(old_cluster.major_version) !=
GET_MAJOR_VERSION(old_cluster.bin_version))
pg_fatal("Old cluster data and binary directories are from
different major versions.");
->>>>>>> REL_16_9
if (GET_MAJOR_VERSION(new_cluster.major_version) !=
GET_MAJOR_VERSION(new_cluster.bin_version))
pg_fatal("New cluster data and binary directories are from
different major versions.");
@@ -451,7 +424,6 @@ check_cluster_compatibility(bool live_check)
/* get/check pg_control data of servers */
get_control_data(&old_cluster, live_check);
-<<<<<<< HEAD
if(!is_skip_target_check())
{
get_control_data(&new_cluster, false);
@@ -466,88 +438,6 @@ check_cluster_compatibility(bool live_check)
}
}
-
-/*
- * check_locale_and_encoding()
- *
- * Check that locale and encoding of a database in the old and new clusters
- * are compatible.
- */
-static void
-check_locale_and_encoding(DbInfo *olddb, DbInfo *newdb)
-{
- if (olddb->db_encoding != newdb->db_encoding)
- pg_fatal("encodings for database \"%s\" do not match: old
\"%s\", new \"%s\"\n",
- olddb->db_name,
- pg_encoding_to_char(olddb->db_encoding),
- pg_encoding_to_char(newdb->db_encoding));
- if (!equivalent_locale(LC_COLLATE, olddb->db_collate,
newdb->db_collate))
- gp_fatal_log("lc_collate values for database \"%s\" do not
match: old \"%s\", new \"%s\"\n",
- olddb->db_name, olddb->db_collate,
newdb->db_collate);
- if (!equivalent_locale(LC_CTYPE, olddb->db_ctype, newdb->db_ctype))
- gp_fatal_log("lc_ctype values for database \"%s\" do not match:
old \"%s\", new \"%s\"\n",
- olddb->db_name, olddb->db_ctype,
newdb->db_ctype);
-}
-
-/*
- * equivalent_locale()
- *
- * Best effort locale-name comparison. Return false if we are not 100% sure
- * the locales are equivalent.
- *
- * Note: The encoding parts of the names are ignored. This function is
- * currently used to compare locale names stored in pg_database, and
- * pg_database contains a separate encoding field. That's compared directly
- * in check_locale_and_encoding().
- */
-static bool
-equivalent_locale(int category, const char *loca, const char *locb)
-{
- const char *chara;
- const char *charb;
- char *canona;
- char *canonb;
- int lena;
- int lenb;
-
- /*
- * If the names are equal, the locales are equivalent. Checking this
first
- * avoids calling setlocale() in the common case that the names are
equal.
- * That's a good thing, if setlocale() is buggy, for example.
- */
- if (pg_strcasecmp(loca, locb) == 0)
- return true;
-
- /*
- * Not identical. Canonicalize both names, remove the encoding parts,
and
- * try again.
- */
- canona = get_canonical_locale_name(category, loca);
- chara = strrchr(canona, '.');
- lena = chara ? (chara - canona) : strlen(canona);
-
- canonb = get_canonical_locale_name(category, locb);
- charb = strrchr(canonb, '.');
- lenb = charb ? (charb - canonb) : strlen(canonb);
-
- if (lena == lenb && pg_strncasecmp(canona, canonb, lena) == 0)
- {
- pg_free(canona);
- pg_free(canonb);
- return true;
- }
-
- pg_free(canona);
- pg_free(canonb);
- return false;
-=======
- 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.");
->>>>>>> REL_16_9
-}
-
-
static void
check_new_cluster_is_empty(void)
{
@@ -571,11 +461,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)
-<<<<<<< HEAD
gp_fatal_log("New cluster database \"%s\" is
not empty: found relation \"%s.%s\"\n",
-=======
- pg_fatal("New cluster database \"%s\" is not
empty: found relation \"%s.%s\"",
->>>>>>> REL_16_9
new_cluster.dbarr.dbs[dbnum].db_name,
rel_arr->rels[relnum].nspname,
rel_arr->rels[relnum].relname);
@@ -609,11 +495,7 @@ check_for_new_tablespace_dir(ClusterInfo *new_cluster)
new_cluster->tablespace_suffix);
if (stat(new_tablespace_dir, &statbuf) == 0 || errno != ENOENT)
-<<<<<<< HEAD
gp_fatal_log("new cluster tablespace directory already
exists: \"%s\"\n",
-=======
- pg_fatal("new cluster tablespace directory already
exists: \"%s\"",
->>>>>>> REL_16_9
new_tablespace_dir);
}
@@ -860,11 +742,7 @@ check_is_install_user(ClusterInfo *cluster)
*/
if (PQntuples(res) != 1 ||
atooid(PQgetvalue(res, 0, 1)) != BOOTSTRAP_SUPERUSERID)
-<<<<<<< HEAD
gp_fatal_log("database user \"%s\" is not the install user\n",
-=======
- pg_fatal("database user \"%s\" is not the install user",
->>>>>>> REL_16_9
os_info.user);
PQclear(res);
@@ -875,11 +753,7 @@ check_is_install_user(ClusterInfo *cluster)
"WHERE rolname !~
'^pg_'");
if (PQntuples(res) != 1)
-<<<<<<< HEAD
gp_fatal_log("could not determine the number of users\n");
-=======
- pg_fatal("could not determine the number of users");
->>>>>>> REL_16_9
/*
* We only allow the install user in the new cluster because other
defined
@@ -892,15 +766,10 @@ check_is_install_user(ClusterInfo *cluster)
* Cloudberry cluster upgrade scheme will overwrite the QE's schema
* with the QD's schema, making this check inappropriate for a QE
upgrade.
*/
-<<<<<<< HEAD
if (is_greenplum_dispatcher_mode() &&
cluster == &new_cluster &&
atooid(PQgetvalue(res, 0, 0)) != 1)
pg_fatal("Only the install user can be defined in the new
cluster.\n");
-=======
- if (cluster == &new_cluster && strcmp(PQgetvalue(res, 0, 0), "1") != 0)
- pg_fatal("Only the install user can be defined in the new
cluster.");
->>>>>>> REL_16_9
PQclear(res);
@@ -928,10 +797,7 @@ check_proper_datallowconn(ClusterInfo *cluster)
int i_datallowconn;
FILE *script = NULL;
char output_path[MAXPGPATH];
-<<<<<<< HEAD
bool found = false;
-=======
->>>>>>> REL_16_9
prep_status("Checking database connection settings");
@@ -970,14 +836,9 @@ check_proper_datallowconn(ClusterInfo *cluster)
*/
if (strcmp(datallowconn, "f") == 0)
{
-<<<<<<< HEAD
found = true;
if (script == NULL && (script =
fopen_priv(output_path, "w")) == NULL)
pg_fatal("could not open file \"%s\":
%s\n",
-=======
- if (script == NULL && (script =
fopen_priv(output_path, "w")) == NULL)
- pg_fatal("could not open file \"%s\":
%s",
->>>>>>> REL_16_9
output_path,
strerror(errno));
fprintf(script, "%s\n", datname);
@@ -990,7 +851,6 @@ check_proper_datallowconn(ClusterInfo *cluster)
PQfinish(conn_template1);
if (script)
-<<<<<<< HEAD
fclose(script);
if (found)
@@ -1004,18 +864,6 @@ check_proper_datallowconn(ClusterInfo *cluster)
"| or drop the databases which do not allow
connections. A list of\n"
"| databases with the problem is in the
file:\n"
"| %s\n\n", output_path);
-=======
- {
- fclose(script);
- pg_log(PG_REPORT, "fatal");
- pg_fatal("All non-template0 databases must allow connections,
i.e. their\n"
- "pg_database.datallowconn must be true. Your
installation contains\n"
- "non-template0 databases with their
pg_database.datallowconn set to\n"
- "false. Consider allowing connection for all
non-template0 databases\n"
- "or drop the databases which do not allow
connections. A list of\n"
- "databases with the problem is in the file:\n"
- " %s", output_path);
->>>>>>> REL_16_9
}
else
check_ok();
@@ -1043,15 +891,9 @@ check_for_prepared_transactions(ClusterInfo *cluster)
if (PQntuples(res) != 0)
{
if (cluster == &old_cluster)
-<<<<<<< HEAD
gp_fatal_log("The source cluster contains prepared
transactions\n");
else
gp_fatal_log("The target cluster contains prepared
transactions\n");
-=======
- pg_fatal("The source cluster contains prepared
transactions");
- else
- pg_fatal("The target cluster contains prepared
transactions");
->>>>>>> REL_16_9
}
PQclear(res);
@@ -1134,7 +976,6 @@ check_for_isn_and_int8_passing_mismatch(ClusterInfo
*cluster)
if (script)
{
-<<<<<<< HEAD
pg_log(PG_REPORT, "fatal\n");
gp_fatal_log(
"| Your installation contains \"contrib/isn\"
functions which rely on the\n"
@@ -1144,17 +985,6 @@ check_for_isn_and_int8_passing_mismatch(ClusterInfo
*cluster)
"| facilities, drop them, perform the upgrade,
and then restore them. A\n"
"| list of the problem functions is in the
file:\n"
"| %s\n\n", output_path);
-=======
- fclose(script);
- pg_log(PG_REPORT, "fatal");
- 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 dump databases in the old cluster
that use \"contrib/isn\"\n"
- "facilities, drop them, perform the upgrade,
and then restore them. A\n"
- "list of the problem functions is in the
file:\n"
- " %s", output_path);
->>>>>>> REL_16_9
}
else
check_ok();
@@ -1447,7 +1277,6 @@ check_for_tables_with_oids(ClusterInfo *cluster)
if (script)
{
-<<<<<<< HEAD
pg_log(PG_REPORT, "fatal\n");
gp_fatal_log(
"| Your installation contains tables declared
WITH OIDS, which is not\n"
@@ -1455,15 +1284,6 @@ check_for_tables_with_oids(ClusterInfo *cluster)
"| ALTER TABLE ... SET WITHOUT OIDS;\n"
"| A list of tables with the problem is in the
file:\n"
"| %s\n\n", output_path);
-=======
- fclose(script);
- pg_log(PG_REPORT, "fatal");
- pg_fatal("Your installation contains tables declared WITH OIDS,
which is not\n"
- "supported anymore. Consider removing the oid
column using\n"
- " ALTER TABLE ... SET WITHOUT OIDS;\n"
- "A list of tables with the problem is in the
file:\n"
- " %s", output_path);
->>>>>>> REL_16_9
}
else
check_ok();
@@ -1492,10 +1312,6 @@ check_for_composite_data_type_usage(ClusterInfo *cluster)
snprintf(output_path, sizeof(output_path), "%s/%s",
log_opts.basedir,
"tables_using_composite.txt");
-<<<<<<< HEAD
-=======
-
->>>>>>> REL_16_9
/*
* Look for composite types that were made during initdb *or* belong to
* information_schema; that's important in case information_schema was
@@ -1520,7 +1336,6 @@ check_for_composite_data_type_usage(ClusterInfo *cluster)
if (found)
{
-<<<<<<< HEAD
pg_log(PG_REPORT, "fatal\n");
gp_fatal_log(
"| Your installation contains system-defined
composite type(s) in user tables.\n"
@@ -1529,15 +1344,6 @@ check_for_composite_data_type_usage(ClusterInfo *cluster)
"| drop the problem columns and restart the
upgrade.\n"
"| A list of the problem columns is in the
file:\n"
"| %s\n\n", output_path);
-=======
- pg_log(PG_REPORT, "fatal");
- pg_fatal("Your installation contains system-defined composite
types in user tables.\n"
- "These type OIDs are not stable across
PostgreSQL versions,\n"
- "so this cluster cannot currently be upgraded.
You can\n"
- "drop the problem columns and restart the
upgrade.\n"
- "A list of the problem columns is in the
file:\n"
- " %s", output_path);
->>>>>>> REL_16_9
}
else
check_ok();
@@ -1592,7 +1398,6 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
if (found)
{
-<<<<<<< HEAD
pg_log(PG_REPORT, "fatal\n");
gp_fatal_log(
"| Your installation contains one of the reg*
data types in user tables.\n"
@@ -1601,14 +1406,6 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
"| remove the problem tables and restart the
upgrade. A list of the\n"
"| problem columns is in the file:\n"
"| %s\n\n", output_path);
-=======
- pg_log(PG_REPORT, "fatal");
- 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"
- "drop the problem columns and restart the
upgrade.\n"
- "A list of the problem columns is in the
file:\n"
- " %s", output_path);
}
else
check_ok();
@@ -1638,7 +1435,6 @@ check_for_aclitem_data_type_usage(ClusterInfo *cluster)
"problem columns and restart the upgrade. A
list of the problem\n"
"columns is in the file:\n"
" %s", output_path);
->>>>>>> REL_16_9
}
else
check_ok();
@@ -1660,18 +1456,12 @@ check_for_removed_data_type_usage(ClusterInfo *cluster,
const char *version,
prep_status("Checking for removed \"%s\" data type in user tables",
datatype);
-<<<<<<< HEAD
- snprintf(output_path, sizeof(output_path), "%s/tables_using_%s.txt",
- log_opts.basedir,
-=======
snprintf(output_path, sizeof(output_path), "tables_using_%s.txt",
->>>>>>> REL_16_9
datatype);
snprintf(typename, sizeof(typename), "pg_catalog.%s", datatype);
if (check_for_data_type_usage(cluster, typename, output_path))
{
-<<<<<<< HEAD
pg_log(PG_REPORT, "fatal\n");
gp_fatal_log(
"| Your installation contains the \"%s\" data
type in user tables.\n"
@@ -1680,15 +1470,6 @@ check_for_removed_data_type_usage(ClusterInfo *cluster,
const char *version,
"| problem columns, or change them to another
data type, and restart\n"
"| the upgrade. A list of the problem columns
is in the file:\n"
"| %s\n\n", datatype, datatype, version,
output_path);
-=======
- pg_log(PG_REPORT, "fatal");
- pg_fatal("Your installation contains the \"%s\" data type in
user tables.\n"
- "The \"%s\" type has been removed in
PostgreSQL version %s,\n"
- "so this cluster cannot currently be upgraded.
You can drop the\n"
- "problem columns, or change them to another
data type, and restart\n"
- "the upgrade. A list of the problem columns
is in the file:\n"
- " %s", datatype, datatype, version,
output_path);
->>>>>>> REL_16_9
}
else
check_ok();
@@ -1713,7 +1494,6 @@ check_for_jsonb_9_4_usage(ClusterInfo *cluster)
if (check_for_data_type_usage(cluster, "pg_catalog.jsonb", output_path))
{
-<<<<<<< HEAD
pg_log(PG_REPORT, "fatal\n");
gp_fatal_log(
"| Your installation contains the \"jsonb\"
data type in user tables.\n"
@@ -1722,15 +1502,6 @@ check_for_jsonb_9_4_usage(ClusterInfo *cluster)
"| tables and restart the upgrade. A list of
the problem columns is\n"
"| in the file:\n"
"| %s\n\n", output_path);
-=======
- pg_log(PG_REPORT, "fatal");
- pg_fatal("Your installation contains the \"jsonb\" data type in
user tables.\n"
- "The internal format of \"jsonb\" changed
during 9.4 beta so this\n"
- "cluster cannot currently be upgraded. You
can\n"
- "drop the problem columns and restart the
upgrade.\n"
- "A list of the problem columns is in the
file:\n"
- " %s", output_path);
->>>>>>> REL_16_9
}
else
check_ok();
@@ -1769,11 +1540,7 @@ check_for_pg_role_prefix(ClusterInfo *cluster)
for (int rowno = 0; rowno < ntups; rowno++)
{
if (script == NULL && (script = fopen_priv(output_path, "w"))
== NULL)
-<<<<<<< HEAD
gp_fatal_log("could not open file \"%s\": %s",
-=======
- pg_fatal("could not open file \"%s\": %s",
->>>>>>> REL_16_9
output_path, strerror(errno));
fprintf(script, "%s (oid=%s)\n",
PQgetvalue(res, rowno, i_rolname),
@@ -1787,21 +1554,12 @@ check_for_pg_role_prefix(ClusterInfo *cluster)
if (script)
{
fclose(script);
-<<<<<<< HEAD
pg_log(PG_REPORT, "fatal\n");
gp_fatal_log("| Your installation contains roles starting with
\"pg_\".\n"
"| \"pg_\" is a reserved prefix for system
roles, the cluster\n"
"| cannot be upgraded until these roles are
renamed.\n"
"| A list of roles starting with \"pg_\" is in
the file:\n"
"| %s", output_path);
-=======
- pg_log(PG_REPORT, "fatal");
- pg_fatal("Your installation contains roles starting with
\"pg_\".\n"
- "\"pg_\" is a reserved prefix for system
roles. The cluster\n"
- "cannot be upgraded until these roles are
renamed.\n"
- "A list of roles starting with \"pg_\" is in
the file:\n"
- " %s", output_path);
->>>>>>> REL_16_9
}
else
check_ok();
@@ -1888,7 +1646,6 @@ check_for_user_defined_encoding_conversions(ClusterInfo
*cluster)
else
check_ok();
}
-<<<<<<< HEAD
/*
@@ -1916,42 +1673,3 @@ check_for_cluster_key_failure(ClusterInfo *cluster)
check_ok();
}
-
-/*
- * get_canonical_locale_name
- *
- * Send the locale name to the system, and hope we get back a canonical
- * version. This should match the backend's check_locale() function.
- */
-static char *
-get_canonical_locale_name(int category, const char *locale)
-{
- char *save;
- char *res;
-
- /* get the current setting, so we can restore it. */
- save = setlocale(category, NULL);
- if (!save)
- pg_fatal("failed to get the current locale\n");
-
- /* 'save' may be pointing at a modifiable scratch variable, so copy it.
*/
- save = (char *) pg_strdup(save);
-
- /* set the locale with setlocale, to see if it accepts it. */
- res = setlocale(category, locale);
-
- if (!res)
- pg_fatal("failed to get system locale name for \"%s\"\n",
locale);
-
- res = pg_strdup(res);
-
- /* restore old value. */
- if (!setlocale(category, save))
- pg_fatal("failed to restore old locale \"%s\"\n", save);
-
- pg_free(save);
-
- return res;
-}
-=======
->>>>>>> REL_16_9
diff --git a/src/bin/pg_upgrade/controldata.c b/src/bin/pg_upgrade/controldata.c
index 43f8d037ea0..60594273d51 100644
--- a/src/bin/pg_upgrade/controldata.c
+++ b/src/bin/pg_upgrade/controldata.c
@@ -13,17 +13,13 @@
#include <ctype.h>
#include "pg_upgrade.h"
-<<<<<<< HEAD
#include "greenplum/pg_upgrade_greenplum.h"
+#include "common/string.h"
#include "access/xlog_internal.h"
#include "common/controldata_utils.h"
#include "common/file_utils.h"
#include "common/kmgr_utils.h"
-=======
-#include "common/string.h"
-
->>>>>>> REL_16_9
/*
* get_control_data()
@@ -385,11 +381,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
p = strchr(p, ':');
if (p == NULL || strlen(p) <= 1)
-<<<<<<< HEAD
- pg_fatal("%d: controldata retrieval problem\n",
__LINE__);
-=======
pg_fatal("%d: controldata retrieval problem",
__LINE__);
->>>>>>> REL_16_9
p++; /* remove ':' char */
cluster->controldata.chkpnt_oldstxid = str2uint(p);
@@ -724,12 +716,8 @@ get_control_data(ClusterInfo *cluster, bool live_check)
#if 0 /* not mandatory in GPDB, see comment in check_control_data() */
if (!got_toast)
-<<<<<<< HEAD
- pg_log(PG_REPORT, " maximum TOAST chunk size\n");
-#endif
-=======
pg_log(PG_REPORT, " maximum TOAST chunk size");
->>>>>>> REL_16_9
+#endif
if (!got_large_object &&
cluster->controldata.ctrl_ver >=
LARGE_OBJECT_SIZE_PG_CONTROL_VER)
@@ -746,13 +734,10 @@ get_control_data(ClusterInfo *cluster, bool live_check)
if (!got_data_checksum_version)
pg_log(PG_REPORT, " data checksum version");
-<<<<<<< HEAD
/* value added in Postgres 14 */
if (!got_file_encryption_method)
pg_log(PG_REPORT, " file encryption method\n");
-=======
->>>>>>> REL_16_9
pg_fatal("Cannot continue without required control information,
terminating");
}
}
@@ -789,12 +774,9 @@ check_control_data(ControlData *oldctrl,
if (oldctrl->index == 0 || oldctrl->index != newctrl->index)
pg_fatal("old and new pg_controldata maximum indexed columns
are invalid or do not match");
-<<<<<<< HEAD
-=======
if (oldctrl->toast == 0 || oldctrl->toast != newctrl->toast)
pg_fatal("old and new pg_controldata maximum TOAST chunk sizes
are invalid or do not match");
->>>>>>> REL_16_9
/* large_object added in 9.5, so it might not exist in the old cluster
*/
if (oldctrl->large_object != 0 &&
oldctrl->large_object != newctrl->large_object)
@@ -805,21 +787,7 @@ check_control_data(ControlData *oldctrl,
* still keep it to support upgrading from GPDB 5
*/
if (oldctrl->date_is_int != newctrl->date_is_int)
-<<<<<<< HEAD
- {
- pg_log(PG_WARNING,
- "\nOld and new pg_controldata date/time storage
types do not match.\n");
-
- /*
- * 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");
- }
-=======
pg_fatal("old and new pg_controldata date/time storage types do
not match");
->>>>>>> REL_16_9
/*
* float8_pass_by_value does not need to match, but is used in
@@ -838,10 +806,6 @@ check_control_data(ControlData *oldctrl,
pg_fatal("old cluster uses data checksums but the new one does
not");
else if (oldctrl->data_checksum_version !=
newctrl->data_checksum_version)
pg_fatal("old and new cluster pg_controldata checksum versions
do not match");
-<<<<<<< HEAD
-
-=======
->>>>>>> REL_16_9
}
diff --git a/src/bin/pg_upgrade/dump.c b/src/bin/pg_upgrade/dump.c
index 5960424d7b5..8b6fa2cc70d 100644
--- a/src/bin/pg_upgrade/dump.c
+++ b/src/bin/pg_upgrade/dump.c
@@ -22,14 +22,9 @@ generate_old_dump(void)
/* run new pg_dumpall binary for globals */
exec_prog(UTILITY_LOG_FILE, NULL, true, true,
-<<<<<<< HEAD
"%s \"%s/pg_dumpall\" %s --globals-only
--quote-all-identifiers "
"--resource-groups --resource-queues --binary-upgrade
%s -f \"%s/%s\"",
PG_OPTIONS_UTILITY_MODE_VERSION(old_cluster.major_version),
-=======
- "\"%s/pg_dumpall\" %s --globals-only
--quote-all-identifiers "
- "--binary-upgrade %s -f \"%s/%s\"",
->>>>>>> REL_16_9
new_cluster.bindir, cluster_conn_opts(&old_cluster),
log_opts.verbose ? "--verbose" : "",
log_opts.dumpdir,
@@ -59,14 +54,9 @@ generate_old_dump(void)
snprintf(log_file_name, sizeof(log_file_name),
DB_DUMP_LOG_FILE_MASK, old_db->db_oid);
parallel_exec_prog(log_file_name, NULL,
-<<<<<<< HEAD
"%s \"%s/pg_dump\" %s
--schema-only --quote-all-identifiers "
"--binary-upgrade
--format=custom %s --file=\"%s/%s\" %s",
PG_OPTIONS_UTILITY_MODE_VERSION(old_cluster.major_version),
-=======
- "\"%s/pg_dump\" %s
--schema-only --quote-all-identifiers "
- "--binary-upgrade
--format=custom %s --file=\"%s/%s\" %s",
->>>>>>> REL_16_9
new_cluster.bindir,
cluster_conn_opts(&old_cluster),
log_opts.verbose ?
"--verbose" : "",
log_opts.dumpdir,
diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
index c7106d1878f..ace89275f62 100644
--- a/src/bin/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -444,7 +444,6 @@ check_exec(const char *dir, const char *program, bool
check_version)
char cmd[MAXPGPATH];
char versionstr[128];
char gp_versionstr[128];
- int ret;
snprintf(path, sizeof(path), "%s/%s", dir, program);
diff --git a/src/bin/pg_upgrade/function.c b/src/bin/pg_upgrade/function.c
index 6e3d5f5c608..f63202970b4 100644
--- a/src/bin/pg_upgrade/function.c
+++ b/src/bin/pg_upgrade/function.c
@@ -81,7 +81,6 @@ get_loadable_libraries(void)
FirstNormalObjectId);
totaltups += PQntuples(ress[dbnum]);
-<<<<<<< HEAD
/*
* Systems that install plpython before 8.1 have
* plpython_call_handler() defined in the "public" schema,
causing
@@ -141,8 +140,6 @@ get_loadable_libraries(void)
PQclear(res);
}
-=======
->>>>>>> REL_16_9
PQfinish(conn);
}
@@ -247,7 +244,6 @@ check_loadable_libraries(void)
if (script)
{
fclose(script);
-<<<<<<< HEAD
pg_log(PG_REPORT, "fatal\n");
gp_fatal_log(
"| Your installation references loadable
libraries that are missing from the\n"
@@ -255,14 +251,6 @@ check_loadable_libraries(void)
"| 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);
-=======
- pg_log(PG_REPORT, "fatal");
- 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", output_path);
->>>>>>> REL_16_9
}
else
check_ok();
diff --git a/src/bin/pg_upgrade/greenplum/controldata_gp.c
b/src/bin/pg_upgrade/greenplum/controldata_gp.c
index 7d67dbc236a..3d6e3a9eb87 100644
--- a/src/bin/pg_upgrade/greenplum/controldata_gp.c
+++ b/src/bin/pg_upgrade/greenplum/controldata_gp.c
@@ -125,7 +125,7 @@ freeze_master_data(void)
if (txns_from_freeze < 0)
{
/* Needed if a wrap around occurs between txid after
and before. */
- txns_from_freeze = INT32_MAX - Abs(txns_from_freeze);
+ txns_from_freeze = INT32_MAX - abs(txns_from_freeze);
}
/* Reset datallowconn flag before possibly raising an error. */
diff --git a/src/bin/pg_upgrade/info.c b/src/bin/pg_upgrade/info.c
index 75b23918dd7..800e0364107 100644
--- a/src/bin/pg_upgrade/info.c
+++ b/src/bin/pg_upgrade/info.c
@@ -401,9 +401,6 @@ get_db_infos(ClusterInfo *cluster)
char query[QUERY_ALLOC];
snprintf(query, sizeof(query),
-<<<<<<< HEAD
- "SELECT d.oid, d.datname, d.encoding, d.datcollate,
d.datctype, "
-=======
"SELECT d.oid, d.datname, d.encoding, d.datcollate,
d.datctype, ");
if (GET_MAJOR_VERSION(cluster->major_version) < 1500)
snprintf(query + strlen(query), sizeof(query) - strlen(query),
@@ -412,18 +409,13 @@ get_db_infos(ClusterInfo *cluster)
snprintf(query + strlen(query), sizeof(query) - strlen(query),
"datlocprovider, daticulocale, ");
snprintf(query + strlen(query), sizeof(query) - strlen(query),
->>>>>>> REL_16_9
"pg_catalog.pg_tablespace_location(t.oid) AS
spclocation "
"FROM pg_catalog.pg_database d "
" LEFT OUTER JOIN pg_catalog.pg_tablespace t "
" ON d.dattablespace = t.oid "
"WHERE d.datallowconn = true "
-<<<<<<< HEAD
/* we don't preserve pg_database.oid so we sort by name */
"ORDER BY 2");
-=======
- "ORDER BY 1");
->>>>>>> REL_16_9
res = executeQueryOrDie(conn, "%s", query);
@@ -562,10 +554,7 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
*/
snprintf(query + strlen(query), sizeof(query) - strlen(query),
"SELECT all_rels.*, n.nspname, c.relname, "
-<<<<<<< HEAD
" %s as relstorage, c.relkind, "
-=======
->>>>>>> REL_16_9
" c.relfilenode, c.reltablespace, "
" pg_catalog.pg_tablespace_location(t.oid) AS
spclocation "
"FROM (SELECT * FROM regular_heap "
@@ -580,7 +569,6 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
" %s"
" LEFT OUTER JOIN pg_catalog.pg_tablespace t "
" ON c.reltablespace = t.oid "
-<<<<<<< HEAD
"ORDER BY 1;",
/*
* GPDB 7 with PostgreSQL v12 merge removed the relstorage column.
@@ -596,9 +584,6 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
(GET_MAJOR_VERSION(cluster->major_version) <= 1000) ?
"" : "LEFT OUTER JOIN pg_catalog.pg_am am ON c.relam =
am.oid");
-=======
- "ORDER BY 1;");
->>>>>>> REL_16_9
res = executeQueryOrDie(conn, "%s", query);
@@ -611,13 +596,9 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
i_toastheap = PQfnumber(res, "toastheap");
i_nspname = PQfnumber(res, "nspname");
i_relname = PQfnumber(res, "relname");
-<<<<<<< HEAD
i_relstorage = PQfnumber(res, "relstorage");
i_relkind = PQfnumber(res, "relkind");
- i_relfilenode = PQfnumber(res, "relfilenode");
-=======
i_relfilenumber = PQfnumber(res, "relfilenode");
->>>>>>> REL_16_9
i_reltablespace = PQfnumber(res, "reltablespace");
i_spclocation = PQfnumber(res, "spclocation");
diff --git a/src/bin/pg_upgrade/option.c b/src/bin/pg_upgrade/option.c
index 86e2608f073..ab4ae366ef5 100644
--- a/src/bin/pg_upgrade/option.c
+++ b/src/bin/pg_upgrade/option.c
@@ -108,11 +108,7 @@ parseCommandLine(int argc, char *argv[])
if (os_user_effective_id == 0)
pg_fatal("%s: cannot be run as root", os_info.progname);
-<<<<<<< HEAD
- while ((option = getopt_long(argc, argv, "d:D:b:B:cj:ko:O:p:P:rRs:U:v",
-=======
- while ((option = getopt_long(argc, argv, "b:B:cd:D:j:kNo:O:p:P:rs:U:v",
->>>>>>> REL_16_9
+ while ((option = getopt_long(argc, argv, "b:B:cd:D:j:kNo:O:p:P:rRs:U:v",
long_options,
&optindex)) != -1)
{
switch (option)
@@ -227,11 +223,7 @@ parseCommandLine(int argc, char *argv[])
}
if (optind < argc)
-<<<<<<< HEAD
- pg_fatal("too many command-line arguments (first is \"%s\")\n",
argv[optind]);
-=======
pg_fatal("too many command-line arguments (first is \"%s\")",
argv[optind]);
->>>>>>> REL_16_9
if (log_opts.verbose)
pg_log(PG_REPORT, "Running in verbose mode");
@@ -317,12 +309,9 @@ usage(void)
printf(_(" -v, --verbose enable verbose internal
logging\n"));
printf(_(" -V, --version display version information,
then exit\n"));
printf(_(" --clone clone instead of copying
files to new cluster\n"));
-<<<<<<< HEAD
printf(_(" --continue-check-on-fatal goes through all pg_upgrade
checks; should be used with -c\n"));
printf(_(" --skip-target-check skip all checks and
comparisons of new cluster; should be used with -c\n"));
-=======
printf(_(" --copy copy files to new cluster
(default)\n"));
->>>>>>> REL_16_9
printf(_(" -?, --help show this help, then
exit\n"));
printf(_("\n"
"Before running pg_upgrade you must:\n"
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index 306d279a7bc..9d34b1f6e7c 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -3,12 +3,8 @@
*
* main source file
*
-<<<<<<< HEAD
* Portions Copyright (c) 2016-Present, VMware, Inc. or its affiliates
- * Copyright (c) 2010-2021, PostgreSQL Global Development Group
-=======
* Copyright (c) 2010-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
* src/bin/pg_upgrade/pg_upgrade.c
*/
@@ -57,12 +53,9 @@
#include "fe_utils/string_utils.h"
#include "pg_upgrade.h"
-<<<<<<< HEAD
#include "greenplum/pg_upgrade_greenplum.h"
-=======
static void set_locale_and_encoding(void);
->>>>>>> REL_16_9
static void prepare_new_cluster(void);
static void prepare_new_globals(void);
static void create_new_objects(void);
@@ -70,15 +63,12 @@ static void copy_xact_xlog_xid(void);
static void set_frozenxids(bool minmxid_only);
static void make_outputdirs(char *pgdata);
static void setup(char *argv0, bool *live_check);
-<<<<<<< HEAD
static void copy_subdir_files(const char *old_subdir, const char *new_subdir);
#ifdef WIN32
static int CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION
*processInfo, const char *progname);
#endif
-=======
->>>>>>> REL_16_9
ClusterInfo old_cluster,
new_cluster;
@@ -131,7 +121,6 @@ main(int argc, char **argv)
adjust_data_dir(&old_cluster);
-<<<<<<< HEAD
if(!is_skip_target_check())
adjust_data_dir(&new_cluster);
@@ -162,36 +151,6 @@ main(int argc, char **argv)
make_outputdirs_gp(output_dir);
else
make_outputdirs(new_cluster.pgdata);
-=======
- /*
- * Set mask based on PGDATA permissions, needed for the creation of the
- * output directories with correct permissions.
- */
- if (!GetDataDirectoryCreatePerm(new_cluster.pgdata))
- pg_fatal("could not read permissions of directory \"%s\": %s",
- new_cluster.pgdata, strerror(errno));
-
- umask(pg_mode_mask);
-
- /*
- * This needs to happen after adjusting the data directory of the new
- * cluster in adjust_data_dir().
- */
- make_outputdirs(new_cluster.pgdata);
-
- setup(argv[0], &live_check);
-
- output_check_banner(live_check);
-
- check_cluster_versions();
-
- get_sock_dir(&old_cluster, live_check);
- get_sock_dir(&new_cluster, false);
-
- check_cluster_compatibility(live_check);
-
- check_and_dump_old_cluster(live_check);
->>>>>>> REL_16_9
setup(argv[0], &live_check);
@@ -358,7 +317,6 @@ main(int argc, char **argv)
return 0;
}
-<<<<<<< HEAD
#ifdef WIN32
typedef BOOL(WINAPI * __CreateRestrictedToken) (HANDLE, DWORD, DWORD,
PSID_AND_ATTRIBUTES, DWORD, PLUID_AND_ATTRIBUTES, DWORD, PSID_AND_ATTRIBUTES,
PHANDLE);
@@ -468,8 +426,6 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION
*processInfo, const char
}
#endif
-=======
->>>>>>> REL_16_9
/*
* Create and assign proper permissions to the set of output directories
* used to store any data generated internally, filling in log_opts in
@@ -490,11 +446,7 @@ make_outputdirs(char *pgdata)
log_opts.rootdir = (char *) pg_malloc0(MAXPGPATH);
len = snprintf(log_opts.rootdir, MAXPGPATH, "%s/%s", pgdata,
BASE_OUTPUTDIR);
if (len >= MAXPGPATH)
-<<<<<<< HEAD
- pg_fatal("directory path for new cluster is too long\n");
-=======
pg_fatal("directory path for new cluster is too long");
->>>>>>> REL_16_9
/* BASE_OUTPUTDIR/$timestamp/ */
gettimeofday(&time, NULL);
@@ -507,48 +459,27 @@ make_outputdirs(char *pgdata)
len = snprintf(log_opts.basedir, MAXPGPATH, "%s/%s", log_opts.rootdir,
timebuf);
if (len >= MAXPGPATH)
-<<<<<<< HEAD
- pg_fatal("directory path for new cluster is too long\n");
-=======
pg_fatal("directory path for new cluster is too long");
->>>>>>> REL_16_9
/* BASE_OUTPUTDIR/$timestamp/dump/ */
log_opts.dumpdir = (char *) pg_malloc0(MAXPGPATH);
len = snprintf(log_opts.dumpdir, MAXPGPATH, "%s/%s/%s",
log_opts.rootdir,
timebuf, DUMP_OUTPUTDIR);
if (len >= MAXPGPATH)
-<<<<<<< HEAD
- pg_fatal("directory path for new cluster is too long\n");
-=======
pg_fatal("directory path for new cluster is too long");
->>>>>>> REL_16_9
/* BASE_OUTPUTDIR/$timestamp/log/ */
log_opts.logdir = (char *) pg_malloc0(MAXPGPATH);
len = snprintf(log_opts.logdir, MAXPGPATH, "%s/%s/%s", log_opts.rootdir,
timebuf, LOG_OUTPUTDIR);
if (len >= MAXPGPATH)
-<<<<<<< HEAD
- pg_fatal("directory path for new cluster is too long\n");
-=======
pg_fatal("directory path for new cluster is too long");
->>>>>>> REL_16_9
/*
* Ignore the error case where the root path exists, as it is kept the
* same across runs.
*/
if (mkdir(log_opts.rootdir, pg_dir_create_mode) < 0 && errno != EEXIST)
-<<<<<<< HEAD
- pg_fatal("could not create directory \"%s\": %m\n",
log_opts.rootdir);
- if (mkdir(log_opts.basedir, pg_dir_create_mode) < 0)
- pg_fatal("could not create directory \"%s\": %m\n",
log_opts.basedir);
- if (mkdir(log_opts.dumpdir, pg_dir_create_mode) < 0)
- pg_fatal("could not create directory \"%s\": %m\n",
log_opts.dumpdir);
- if (mkdir(log_opts.logdir, pg_dir_create_mode) < 0)
- pg_fatal("could not create directory \"%s\": %m\n",
log_opts.logdir);
-=======
pg_fatal("could not create directory \"%s\": %m",
log_opts.rootdir);
if (mkdir(log_opts.basedir, pg_dir_create_mode) < 0)
pg_fatal("could not create directory \"%s\": %m",
log_opts.basedir);
@@ -556,22 +487,14 @@ make_outputdirs(char *pgdata)
pg_fatal("could not create directory \"%s\": %m",
log_opts.dumpdir);
if (mkdir(log_opts.logdir, pg_dir_create_mode) < 0)
pg_fatal("could not create directory \"%s\": %m",
log_opts.logdir);
->>>>>>> REL_16_9
len = snprintf(filename_path, sizeof(filename_path), "%s/%s",
log_opts.logdir, INTERNAL_LOG_FILE);
if (len >= sizeof(filename_path))
-<<<<<<< HEAD
- pg_fatal("directory path for new cluster is too long\n");
-
- if ((log_opts.internal = fopen_priv(filename_path, "a")) == NULL)
- pg_fatal("could not open log file \"%s\": %m\n", filename_path);
-=======
pg_fatal("directory path for new cluster is too long");
if ((log_opts.internal = fopen_priv(filename_path, "a")) == NULL)
pg_fatal("could not open log file \"%s\": %m", filename_path);
->>>>>>> REL_16_9
/* label start of upgrade in logfiles */
for (filename = output_files; *filename != NULL; filename++)
@@ -579,15 +502,9 @@ make_outputdirs(char *pgdata)
len = snprintf(filename_path, sizeof(filename_path), "%s/%s",
log_opts.logdir, *filename);
if (len >= sizeof(filename_path))
-<<<<<<< HEAD
- pg_fatal("directory path for new cluster is too
long\n");
- if ((fp = fopen_priv(filename_path, "a")) == NULL)
- pg_fatal("could not write to log file \"%s\": %m\n",
filename_path);
-=======
pg_fatal("directory path for new cluster is too long");
if ((fp = fopen_priv(filename_path, "a")) == NULL)
pg_fatal("could not write to log file \"%s\": %m",
filename_path);
->>>>>>> REL_16_9
fprintf(fp,
"-----------------------------------------------------------------\n"
@@ -654,22 +571,14 @@ setup(char *argv0, bool *live_check)
/* same goes for the new postmaster */
if (!is_skip_target_check())
{
-<<<<<<< HEAD
if (pid_lock_file_exists(new_cluster.pgdata))
{
if (start_postmaster(&new_cluster, false))
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.");
}
-=======
- if (start_postmaster(&new_cluster, false))
- stop_postmaster(false);
- else
- pg_fatal("There seems to be a postmaster servicing the
new cluster.\n"
- "Please shutdown that postmaster and
try again.");
->>>>>>> REL_16_9
}
}
@@ -800,12 +709,8 @@ prepare_new_globals(void)
prep_status("Restoring global objects in the new cluster");
exec_prog(UTILITY_LOG_FILE, NULL, true, true,
-<<<<<<< HEAD
"%s \"%s/psql\" " EXEC_PSQL_ARGS " %s -f \"%s/%s\"",
PG_OPTIONS_UTILITY_MODE_VERSION(new_cluster.major_version),
-=======
- "\"%s/psql\" " EXEC_PSQL_ARGS " %s -f \"%s/%s\"",
->>>>>>> REL_16_9
new_cluster.bindir, cluster_conn_opts(&new_cluster),
log_opts.dumpdir,
GLOBALS_DUMP_FILE);
@@ -852,10 +757,7 @@ create_new_objects(void)
true,
true,
"\"%s/pg_restore\" %s %s --exit-on-error
--verbose "
-<<<<<<< HEAD
"--binary-upgrade "
-=======
->>>>>>> REL_16_9
"--dbname postgres \"%s/%s\"",
new_cluster.bindir,
cluster_conn_opts(&new_cluster),
@@ -893,15 +795,10 @@ create_new_objects(void)
parallel_exec_prog(log_file_name,
NULL,
-<<<<<<< HEAD
"%s \"%s/pg_restore\" %s %s
--exit-on-error --verbose "
"--binary-upgrade "
"--dbname template1
\"%s/%s\"",
PG_OPTIONS_UTILITY_MODE_VERSION(new_cluster.major_version),
-=======
- "\"%s/pg_restore\" %s %s
--exit-on-error --verbose "
- "--dbname template1
\"%s/%s\"",
->>>>>>> REL_16_9
new_cluster.bindir,
cluster_conn_opts(&new_cluster),
create_opts,
@@ -1002,11 +899,7 @@ copy_xact_xlog_xid(void)
prep_status("Setting oldest XID for new cluster");
exec_prog(UTILITY_LOG_FILE, NULL, true, true,
-<<<<<<< HEAD
"\"%s/pg_resetwal\" --binary-upgrade -f -u %u \"%s\"",
-=======
- "\"%s/pg_resetwal\" -f -u %u \"%s\"",
->>>>>>> REL_16_9
new_cluster.bindir,
old_cluster.controldata.chkpnt_oldstxid,
new_cluster.pgdata);
check_ok();
diff --git a/src/bin/pg_upgrade/pg_upgrade.h b/src/bin/pg_upgrade/pg_upgrade.h
index 5f1c6adf6ed..80bfab1e30b 100644
--- a/src/bin/pg_upgrade/pg_upgrade.h
+++ b/src/bin/pg_upgrade/pg_upgrade.h
@@ -3,12 +3,8 @@
/*
* pg_upgrade.h
*
-<<<<<<< HEAD
* Portions Copyright (c) 2016-Present, VMware, Inc. or its affiliates
* Copyright (c) 2010-2021, PostgreSQL Global Development Group
-=======
- * Copyright (c) 2010-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
* src/bin/pg_upgrade/pg_upgrade.h
*/
@@ -17,11 +13,8 @@
#include <sys/stat.h>
#include <sys/time.h>
-<<<<<<< HEAD
#include "postgres.h"
-=======
#include "common/relpath.h"
->>>>>>> REL_16_9
#include "libpq-fe.h"
#include "pqexpbuffer.h"
#include "common/kmgr_utils.h"
@@ -29,9 +22,6 @@
/* For now, pg_upgrade does not use common/logging.c; use our own pg_fatal */
#undef pg_fatal
-/* For now, pg_upgrade does not use common/logging.c; use our own pg_fatal */
-#undef pg_fatal
-
/* Use port in the private/dynamic port number range */
#define DEF_PGUPORT 50432
@@ -118,15 +108,10 @@ extern char *output_files[];
#endif
-<<<<<<< HEAD
#define atooid(x) ((Oid) strtoul((x), NULL, 10))
-/*
- * The format of visibility map is changed with this 9.6 commit,
-=======
/*
* The format of visibility map was changed with this 9.6 commit.
->>>>>>> REL_16_9
*/
#define VISIBILITY_MAP_FROZEN_BIT_CAT_VER 201603011
@@ -225,12 +210,8 @@ typedef struct
char *nspname; /* namespace name */
char *relname; /* relation name */
Oid reloid; /* relation OID */
-<<<<<<< HEAD
char relstorage;
- Oid relfilenode; /* relation file node */
-=======
RelFileNumber relfilenumber; /* relation file number */
->>>>>>> REL_16_9
Oid indtable; /* if index, OID of its
table, else 0 */
Oid toastheap; /* if toast table, OID
of base table, else 0 */
char *tablespace; /* tablespace path; "" for cluster
default */
@@ -270,20 +251,9 @@ typedef struct
const char *new_tablespace;
const char *old_tablespace_suffix;
const char *new_tablespace_suffix;
-<<<<<<< HEAD
- Oid old_db_oid;
- Oid new_db_oid;
-
- /*
- * old/new relfilenodes might differ for pg_largeobject(_metadata)
indexes
- * due to VACUUM FULL or REINDEX. Other relfilenodes are preserved.
- */
- Oid old_relfilenode;
- Oid new_relfilenode;
-=======
+
Oid db_oid;
RelFileNumber relfilenumber;
->>>>>>> REL_16_9
/* the rest are used only for logging and error reporting */
char *nspname; /* namespaces */
char *relname;
@@ -359,10 +329,7 @@ typedef struct
bool date_is_int;
bool float8_pass_by_value;
uint32 data_checksum_version;
-<<<<<<< HEAD
int file_encryption_method;
-=======
->>>>>>> REL_16_9
} ControlData;
/*
@@ -388,11 +355,8 @@ typedef enum
PG_FATAL
} eLogType;
-<<<<<<< HEAD
typedef long pgpid_t;
-=======
->>>>>>> REL_16_9
/*
* cluster
diff --git a/src/bin/pg_upgrade/relfilenumber.c
b/src/bin/pg_upgrade/relfilenumber.c
index 42ac6f07a1d..2815a4bf534 100644
--- a/src/bin/pg_upgrade/relfilenumber.c
+++ b/src/bin/pg_upgrade/relfilenumber.c
@@ -164,7 +164,6 @@ transfer_single_new_db(FileNameMap *maps, int size, char
*old_tablespace)
{
RelType type = maps[mapnum].type;
-<<<<<<< HEAD:src/bin/pg_upgrade/relfilenode.c
if (type == AO || type == AOCS)
{
transfer_ao(&maps[mapnum]);
@@ -180,13 +179,6 @@ transfer_single_new_db(FileNameMap *maps, int size, char
*old_tablespace)
transfer_relfile(&maps[mapnum], "_fsm",
vm_must_add_frozenbit);
transfer_relfile(&maps[mapnum], "_vm",
vm_must_add_frozenbit);
}
-=======
- /*
- * Copy/link any fsm and vm files, if they exist
- */
- transfer_relfile(&maps[mapnum], "_fsm",
vm_must_add_frozenbit);
- transfer_relfile(&maps[mapnum], "_vm",
vm_must_add_frozenbit);
->>>>>>> REL_16_9:src/bin/pg_upgrade/relfilenumber.c
}
}
}
@@ -210,81 +202,8 @@ transfer_relfile(FileNameMap *map, const char
*type_suffix, bool vm_must_add_fro
*/
for (segno = 0;; segno++)
{
-<<<<<<< HEAD:src/bin/pg_upgrade/relfilenode.c
if (!transfer_relfile_segment(segno, map, type_suffix,
vm_must_add_frozenbit))
break;
-=======
- if (segno == 0)
- extent_suffix[0] = '\0';
- else
- snprintf(extent_suffix, sizeof(extent_suffix), ".%d",
segno);
-
- snprintf(old_file, sizeof(old_file), "%s%s/%u/%u%s%s",
- map->old_tablespace,
- map->old_tablespace_suffix,
- map->db_oid,
- map->relfilenumber,
- type_suffix,
- extent_suffix);
- snprintf(new_file, sizeof(new_file), "%s%s/%u/%u%s%s",
- map->new_tablespace,
- map->new_tablespace_suffix,
- map->db_oid,
- map->relfilenumber,
- type_suffix,
- extent_suffix);
-
- /* Is it an extent, fsm, or vm file? */
- if (type_suffix[0] != '\0' || segno != 0)
- {
- /* Did file open fail? */
- if (stat(old_file, &statbuf) != 0)
- {
- /* File does not exist? That's OK, just return
*/
- if (errno == ENOENT)
- return;
- else
- pg_fatal("error while checking for file
existence \"%s.%s\" (\"%s\" to \"%s\"): %s",
- map->nspname,
map->relname, old_file, new_file,
- strerror(errno));
- }
-
- /* If file is empty, just return */
- if (statbuf.st_size == 0)
- return;
- }
-
- unlink(new_file);
-
- /* Copying files might take some time, so give feedback. */
- pg_log(PG_STATUS, "%s", old_file);
-
- if (vm_must_add_frozenbit && strcmp(type_suffix, "_vm") == 0)
- {
- /* Need to rewrite visibility map format */
- pg_log(PG_VERBOSE, "rewriting \"%s\" to \"%s\"",
- old_file, new_file);
- rewriteVisibilityMap(old_file, new_file, map->nspname,
map->relname);
- }
- else
- switch (user_opts.transfer_mode)
- {
- case TRANSFER_MODE_CLONE:
- pg_log(PG_VERBOSE, "cloning \"%s\" to
\"%s\"",
- old_file, new_file);
- cloneFile(old_file, new_file,
map->nspname, map->relname);
- break;
- case TRANSFER_MODE_COPY:
- pg_log(PG_VERBOSE, "copying \"%s\" to
\"%s\"",
- old_file, new_file);
- copyFile(old_file, new_file,
map->nspname, map->relname);
- break;
- case TRANSFER_MODE_LINK:
- pg_log(PG_VERBOSE, "linking \"%s\" to
\"%s\"",
- old_file, new_file);
- linkFile(old_file, new_file,
map->nspname, map->relname);
- }
->>>>>>> REL_16_9:src/bin/pg_upgrade/relfilenumber.c
}
}
@@ -320,15 +239,15 @@ transfer_relfile_segment(int segno, FileNameMap *map,
snprintf(old_file, sizeof(old_file), "%s%s/%u/%u%s%s",
map->old_tablespace,
map->old_tablespace_suffix,
- map->old_db_oid,
- map->old_relfilenode,
+ map->db_oid,
+ map->relfilenumber,
type_suffix,
extent_suffix);
snprintf(new_file, sizeof(new_file), "%s%s/%u/%u%s%s",
map->new_tablespace,
map->new_tablespace_suffix,
- map->new_db_oid,
- map->new_relfilenode,
+ map->db_oid,
+ map->relfilenumber,
type_suffix,
extent_suffix);
diff --git a/src/bin/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c
index bef99401297..dc3af6ece7a 100644
--- a/src/bin/pg_upgrade/server.c
+++ b/src/bin/pg_upgrade/server.c
@@ -258,7 +258,6 @@ start_postmaster(ClusterInfo *cluster, bool
report_and_exit_on_error)
}
snprintf(cmd, sizeof(cmd),
-<<<<<<< HEAD
"\"%s/pg_ctl\" -w -l \"%s/%s\" -D \"%s\" -o \"-p %d -c
%s -b%s %s %s%s\" start",
cluster->bindir,
log_opts.logdir,
@@ -271,16 +270,6 @@ start_postmaster(ClusterInfo *cluster, bool
report_and_exit_on_error)
socket_string,
version_opts);
-=======
- "\"%s/pg_ctl\" -w -l \"%s/%s\" -D \"%s\" -o \"-p %d
-b%s %s%s\" start",
- cluster->bindir,
- log_opts.logdir,
- SERVER_LOG_FILE, cluster->pgconfig, cluster->port,
- (cluster == &new_cluster) ?
- " -c synchronous_commit=off -c fsync=off -c
full_page_writes=off" : "",
- cluster->pgopts ? cluster->pgopts : "", socket_string);
->>>>>>> REL_16_9
-
/*
* Don't throw an error right away, let connecting throw the error
because
* it might supply a reason for the failure.
diff --git a/src/bin/pg_upgrade/tablespace.c b/src/bin/pg_upgrade/tablespace.c
index a69a3541201..f0fb92519b6 100644
--- a/src/bin/pg_upgrade/tablespace.c
+++ b/src/bin/pg_upgrade/tablespace.c
@@ -23,7 +23,6 @@ init_tablespaces(void)
set_tablespace_directory_suffix(&old_cluster);
-<<<<<<< HEAD
if(!is_skip_target_check())
{
set_tablespace_directory_suffix(&new_cluster);
@@ -33,12 +32,11 @@ init_tablespaces(void)
pg_fatal("Cannot upgrade to/from the same system
catalog version when\n"
"using tablespaces.\n");
}
-=======
+
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.");
->>>>>>> REL_16_9
}
diff --git a/src/bin/pg_upgrade/util.c b/src/bin/pg_upgrade/util.c
index e121ecc1cf7..07de1b596aa 100644
--- a/src/bin/pg_upgrade/util.c
+++ b/src/bin/pg_upgrade/util.c
@@ -49,18 +49,12 @@ end_progress_output(void)
* nicely.
*/
if (log_opts.isatty)
-<<<<<<< HEAD
- pg_log(PG_REPORT, "\r%-*s", MESSAGE_WIDTH, "");
- else if (log_opts.verbose)
- pg_log(PG_REPORT, "%-*s", MESSAGE_WIDTH, "");
-=======
{
printf("\r");
pg_log(PG_REPORT_NONL, "%-*s", MESSAGE_WIDTH, "");
}
else if (log_opts.verbose)
pg_log(PG_REPORT_NONL, "%-*s", MESSAGE_WIDTH, "");
->>>>>>> REL_16_9
}
/*
@@ -75,16 +69,12 @@ cleanup_output_dirs(void)
if (log_opts.retain)
return;
-<<<<<<< HEAD
- (void) rmtree(log_opts.basedir, true);
-=======
/*
* Try twice. The second time might wait for files to finish being
* unlinked, on Windows.
*/
if (!rmtree(log_opts.basedir, true))
rmtree(log_opts.basedir, true);
->>>>>>> REL_16_9
/* Remove pg_upgrade_output.d only if empty */
switch (pg_check_dir(log_opts.rootdir))
@@ -96,9 +86,6 @@ cleanup_output_dirs(void)
case 1: /* exists and empty */
case 2: /* exists and contains
only dot files */
-<<<<<<< HEAD
- (void) rmtree(log_opts.rootdir, true);
-=======
/*
* Try twice. The second time might wait for files to
finish
@@ -106,7 +93,6 @@ cleanup_output_dirs(void)
*/
if (!rmtree(log_opts.rootdir, true))
rmtree(log_opts.rootdir, true);
->>>>>>> REL_16_9
break;
case 4: /* exists */
@@ -151,11 +137,7 @@ prep_status(const char *fmt,...)
va_end(args);
/* trim strings */
-<<<<<<< HEAD
- pg_log(PG_REPORT, "%-*s", MESSAGE_WIDTH, message);
-=======
pg_log(PG_REPORT_NONL, "%-*s", MESSAGE_WIDTH, message);
->>>>>>> REL_16_9
}
/*
@@ -186,15 +168,9 @@ prep_status_progress(const char *fmt,...)
* put the individual progress items onto the next line.
*/
if (log_opts.isatty || log_opts.verbose)
-<<<<<<< HEAD
- pg_log(PG_REPORT, "%-*s\n", MESSAGE_WIDTH, message);
- else
- pg_log(PG_REPORT, "%-*s", MESSAGE_WIDTH, message);
-=======
pg_log(PG_REPORT, "%-*s", MESSAGE_WIDTH, message);
else
pg_log(PG_REPORT_NONL, "%-*s", MESSAGE_WIDTH, message);
->>>>>>> REL_16_9
}
static void
@@ -231,42 +207,28 @@ pg_log_v(eLogType type, const char *fmt, va_list ap)
break;
case PG_STATUS:
-<<<<<<< HEAD
- /*
- * For output to a display, do leading truncation.
Append \r so
- * that the next message is output at the start of the
line.
-=======
/*
* For output to a terminal, we add two leading spaces
and no
* newline; instead append \r so that the next message
is output
* on the same line. Truncate on the left to fit into
* MESSAGE_WIDTH (counting the spaces as part of that).
->>>>>>> REL_16_9
- *
+ *
* If going to non-interactive output, only display
progress if
* verbose is enabled. Otherwise the output gets
unreasonably
* large by default.
*/
if (log_opts.isatty)
-<<<<<<< HEAD
- /* -2 because we use a 2-space indent */
- printf(" %s%-*.*s\r",
-=======
{
bool itfits = (strlen(message) <=
MESSAGE_WIDTH - 2);
->>>>>>> REL_16_9
/* prefix with "..." if we do leading
truncation */
printf(" %s%-*.*s\r",
itfits ? "" : "...",
MESSAGE_WIDTH - 2, MESSAGE_WIDTH - 2,
itfits ? message :
message + strlen(message) -
MESSAGE_WIDTH + 3 + 2);
-<<<<<<< HEAD
-=======
}
->>>>>>> REL_16_9
else if (log_opts.verbose)
printf(" %s\n", message);
break;
diff --git a/src/bin/pg_upgrade/version.c b/src/bin/pg_upgrade/version.c
index 70f86947b64..51637748a98 100644
--- a/src/bin/pg_upgrade/version.c
+++ b/src/bin/pg_upgrade/version.c
@@ -14,7 +14,6 @@
#include "pg_upgrade.h"
-<<<<<<< HEAD
static PQExpBuffer
create_recursive_oids(PGconn *conn, int major_version, const char *base_query)
{
@@ -91,8 +90,6 @@ create_recursive_oids(PGconn *conn, int major_version, const
char *base_query)
return querybuf;
}
-=======
->>>>>>> REL_16_9
/*
* check_for_data_types_usage()
* Detect whether there are any stored columns depending on given type(s)
@@ -137,7 +134,6 @@ check_for_data_types_usage(ClusterInfo *cluster,
* concern here). To handle all these cases we need a
recursive CTE.
*/
initPQExpBuffer(&querybuf);
-<<<<<<< HEAD
if (GET_MAJOR_VERSION(cluster->major_version) <= 904)
{
/*
@@ -179,36 +175,10 @@ check_for_data_types_usage(ClusterInfo *cluster,
appendPQExpBuffer(&querybuf,
" UNION
ALL "
/* ranges containing any type selected so far */
-=======
- appendPQExpBuffer(&querybuf,
- "WITH RECURSIVE oids AS ( "
- /* start with the type(s) returned by base_query */
- " %s "
- " UNION ALL "
- " SELECT * FROM ( "
- /* inner WITH because we can only reference the CTE once */
- " WITH x AS
(SELECT oid FROM oids) "
- /* domains on any type selected so far */
- " SELECT
t.oid FROM pg_catalog.pg_type t, x WHERE typbasetype = x.oid AND typtype = 'd' "
- " UNION
ALL "
- /* arrays over any type selected so far */
- " SELECT
t.oid FROM pg_catalog.pg_type t, x WHERE typelem = x.oid AND typtype = 'b' "
- " UNION
ALL "
- /* composite types containing any type selected so far */
- " SELECT
t.oid FROM pg_catalog.pg_type t, pg_catalog.pg_class c, pg_catalog.pg_attribute
a, x "
- " WHERE
t.typtype = 'c' AND "
- "
t.oid = c.reltype AND "
- "
c.oid = a.attrelid AND "
- "
NOT a.attisdropped AND "
- "
a.atttypid = x.oid "
- " UNION
ALL "
- /* ranges containing any type selected so far */
->>>>>>> REL_16_9
" SELECT
t.oid FROM pg_catalog.pg_type t, pg_catalog.pg_range r, x "
" WHERE
t.typtype = 'r' AND r.rngtypid = t.oid AND r.rngsubtype = x.oid"
" ) foo "
") "
-<<<<<<< HEAD
/* now look for stored columns of any such type */
"SELECT n.nspname,
c.relname, a.attname "
"FROM
pg_catalog.pg_class c, "
@@ -228,27 +198,6 @@ check_for_data_types_usage(ClusterInfo *cluster,
/* exclude system catalogs, too */
"
n.nspname NOT IN ('pg_catalog', 'information_schema')");
}
-=======
- /* now look for stored columns of any such type */
- "SELECT n.nspname, c.relname,
a.attname "
- "FROM pg_catalog.pg_class c, "
- "
pg_catalog.pg_namespace n, "
- "
pg_catalog.pg_attribute a "
- "WHERE c.oid =
a.attrelid AND "
- " NOT
a.attisdropped AND "
- " a.atttypid IN
(SELECT oid FROM oids) AND "
- " c.relkind IN ("
-
CppAsString2(RELKIND_RELATION) ", "
- CppAsString2(RELKIND_MATVIEW)
", "
- CppAsString2(RELKIND_INDEX)
") AND "
- " c.relnamespace
= n.oid AND "
- /* exclude possible orphaned temp tables */
- " n.nspname !~
'^pg_temp_' AND "
- " n.nspname !~
'^pg_toast_temp_' AND "
- /* exclude system catalogs, too */
- " n.nspname NOT
IN ('pg_catalog', 'information_schema')",
- base_query);
->>>>>>> REL_16_9
res = executeQueryOrDie(conn, "%s", querybuf.data);
destroyPQExpBuffer(cte_oids);
@@ -372,23 +321,13 @@ old_9_6_check_for_unknown_data_type_usage(ClusterInfo
*cluster)
prep_status("Checking for invalid \"unknown\" user columns");
snprintf(output_path, sizeof(output_path), "%s/%s",
-<<<<<<< HEAD
- log_opts.basedir,
- "tables_using_unknown.txt");
-
- if (check_for_data_type_usage(cluster, "pg_catalog.unknown",
output_path))
- {
- pg_log(PG_REPORT, "fatal\n");
- gp_fatal_log("Your installation contains the \"unknown\" data
type in user tables.\n"
-=======
log_opts.basedir,
"tables_using_unknown.txt");
if (check_for_data_type_usage(cluster, "pg_catalog.unknown",
output_path))
{
- pg_log(PG_REPORT, "fatal");
- pg_fatal("Your installation contains the \"unknown\" data type
in user tables.\n"
->>>>>>> REL_16_9
+ pg_log(PG_REPORT, "fatal\n");
+ gp_fatal_log("Your installation contains the \"unknown\" data
type in user tables.\n"
"This data type is no longer allowed in
tables, so this\n"
"cluster cannot currently be upgraded. You
can\n"
"drop the problem columns and restart the
upgrade.\n"
@@ -527,23 +466,13 @@
old_11_check_for_sql_identifier_data_type_usage(ClusterInfo *cluster)
prep_status("Checking for invalid \"sql_identifier\" user columns");
snprintf(output_path, sizeof(output_path), "%s/%s",
-<<<<<<< HEAD
log_opts.basedir, "tables_using_sql_identifier.txt");
-=======
- log_opts.basedir,
- "tables_using_sql_identifier.txt");
->>>>>>> REL_16_9
if (check_for_data_type_usage(cluster,
"information_schema.sql_identifier",
output_path))
{
-<<<<<<< HEAD
pg_log(PG_REPORT, "fatal\n");
gp_fatal_log("Your installation contains the \"sql_identifier\"
data type in user tables.\n"
-=======
- pg_log(PG_REPORT, "fatal");
- pg_fatal("Your installation contains the \"sql_identifier\"
data type in user tables.\n"
->>>>>>> REL_16_9
"The on-disk format for this data type has
changed, so this\n"
"cluster cannot currently be upgraded. You
can\n"
"drop the problem columns and restart the
upgrade.\n"
@@ -554,80 +483,6 @@
old_11_check_for_sql_identifier_data_type_usage(ClusterInfo *cluster)
check_ok();
}
-
-/*
- * report_extension_updates()
- * Report extensions that should be updated.
- */
-void
-report_extension_updates(ClusterInfo *cluster)
-{
- int dbnum;
- FILE *script = NULL;
- char *output_path = "update_extensions.sql";
-
- prep_status("Checking for extension updates");
-
- for (dbnum = 0; dbnum < cluster->dbarr.ndbs; dbnum++)
- {
- PGresult *res;
- bool db_used = false;
- int ntups;
- int rowno;
- int i_name;
- DbInfo *active_db = &cluster->dbarr.dbs[dbnum];
- PGconn *conn = connectToServer(cluster, active_db->db_name);
-
- /* find extensions needing updates */
- res = executeQueryOrDie(conn,
- "SELECT name "
- "FROM
pg_available_extensions "
- "WHERE
installed_version != default_version"
- );
-
- ntups = PQntuples(res);
- i_name = PQfnumber(res, "name");
- for (rowno = 0; rowno < ntups; rowno++)
- {
- if (script == NULL && (script = fopen_priv(output_path,
"w")) == NULL)
- pg_fatal("could not open file \"%s\": %s",
output_path,
- strerror(errno));
- if (!db_used)
- {
- PQExpBufferData connectbuf;
-
- initPQExpBuffer(&connectbuf);
- appendPsqlMetaConnect(&connectbuf,
active_db->db_name);
- fputs(connectbuf.data, script);
- termPQExpBuffer(&connectbuf);
- db_used = true;
- }
- fprintf(script, "ALTER EXTENSION %s UPDATE;\n",
- quote_identifier(PQgetvalue(res, rowno,
i_name)));
- }
-
- PQclear(res);
-
- PQfinish(conn);
- }
-
- if (script)
- {
- fclose(script);
- report_status(PG_REPORT, "notice");
- pg_log(PG_REPORT, "\n"
- "Your installation contains extensions that should
be updated\n"
- "with the ALTER EXTENSION command. The file\n"
- " %s\n"
- "when executed by psql by the database superuser
will update\n"
- "these extensions.",
- output_path);
- }
- else
- check_ok();
-}
-
-
/*
* report_extension_updates()
* Report extensions that should be updated.
diff --git a/src/bin/pg_verifybackup/pg_verifybackup.c
b/src/bin/pg_verifybackup/pg_verifybackup.c
index 1ce42ddc425..889da627d0a 100644
--- a/src/bin/pg_verifybackup/pg_verifybackup.c
+++ b/src/bin/pg_verifybackup/pg_verifybackup.c
@@ -320,16 +320,8 @@ main(int argc, char **argv)
pg_fatal("program \"%s\" is needed by %s but
was not found in the same directory as \"%s\"",
"pg_waldump",
"pg_verifybackup", full_path);
else
-<<<<<<< HEAD
- pg_log_fatal("The program \"%s\" was found by
\"%s\"\n"
- "but was not the same
version as %s.\n"
- "Check your
installation.",
- "pg_waldump",
full_path, "pg_verifybackup");
- exit(1);
-=======
pg_fatal("program \"%s\" was found by \"%s\"
but was not the same version as %s",
"pg_waldump", full_path,
"pg_verifybackup");
->>>>>>> REL_16_9
}
}
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 535a1572a2d..201bde19a0c 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -279,10 +279,6 @@ bool report_per_command = false; /* report
per-command latencies,
* (errors without retrying) */
int main_pid; /* main process id used
in log filename */
-<<<<<<< HEAD
-
-int use_unique_key=1; /* indexes will be primary key
if set, otherwise non-unique indexes */
-=======
/*
* There are different types of restrictions for deciding that the current
* transaction with a serialization/deadlock error can no longer be retried and
@@ -305,13 +301,11 @@ uint32 max_tries = 1;
bool failures_detailed = false; /* whether to group failures in
* reports or logs by basic types */
->>>>>>> REL_16_9
const char *pghost = NULL;
const char *pgport = NULL;
const char *username = NULL;
const char *dbName = NULL;
-char *storage_clause = "appendonly=false";
char *logfile_prefix = NULL;
const char *progname;
@@ -893,8 +887,6 @@ usage(void)
" -q, --quiet quiet logging (one message each
5 seconds)\n"
" -s, --scale=NUM scaling factor\n"
" --foreign-keys create foreign key constraints
between tables\n"
- " --use-unique-keys make the indexes that are
created non-unique indexes\n"
- " (default: unique)\n"
" --index-tablespace=TABLESPACE\n"
" create indexes in the specified
tablespace\n"
" --partition-method=(range|hash)\n"
@@ -5128,13 +5120,6 @@ initCreatePKeys(PGconn *con)
"alter table pgbench_tellers add primary key (tid)",
"alter table pgbench_accounts add primary key (aid)"
};
- static const char *const NON_UNIQUE_INDEX_DDLINDEXes[] = {
- "CREATE INDEX branch_idx ON pgbench_branches (bid) ",
- "CREATE INDEX teller_idx ON pgbench_tellers (tid) ",
- "CREATE INDEX account_idx ON pgbench_accounts (aid) "
- };
- StaticAssertStmt(lengthof(DDLINDEXes) ==
lengthof(NON_UNIQUE_INDEX_DDLINDEXes),
- "NON_UNIQUE_INDEX_DDLINDEXes must have
same size as DDLINDEXes");
int i;
PQExpBufferData query;
@@ -5145,10 +5130,7 @@ initCreatePKeys(PGconn *con)
{
resetPQExpBuffer(&query);
- if (use_unique_key)
- appendPQExpBufferStr(&query, DDLINDEXes[i]);
- else
- appendPQExpBufferStr(&query,
NON_UNIQUE_INDEX_DDLINDEXes[i]);
+ appendPQExpBufferStr(&query, DDLINDEXes[i]);
if (index_tablespace != NULL)
@@ -6654,7 +6636,6 @@ main(int argc, char **argv)
{"show-script", required_argument, NULL, 10},
{"partitions", required_argument, NULL, 11},
{"partition-method", required_argument, NULL, 12},
- {"use-unique-keys", no_argument, &use_unique_key, 1},
{"failures-detailed", no_argument, NULL, 13},
{"max-tries", required_argument, NULL, 14},
{"verbose-errors", no_argument, NULL, 15},
@@ -6729,137 +6710,12 @@ main(int argc, char **argv)
if (!set_random_seed(getenv("PGBENCH_RANDOM_SEED")))
pg_fatal("error while setting random seed from
PGBENCH_RANDOM_SEED environment variable");
-<<<<<<< HEAD
- while ((c = getopt_long(argc, argv,
"iI:h:nvp:dqb:SNc:j:Crs:t:T:U:lf:D:F:M:P:R:L:x:", long_options, &optindex)) !=
-1)
-=======
while ((c = getopt_long(argc, argv,
"b:c:CdD:f:F:h:iI:j:lL:M:nNp:P:qrR:s:St:T:U:v", long_options, &optindex)) != -1)
->>>>>>> REL_16_9
{
char *script;
switch (c)
{
-<<<<<<< HEAD
- case 'i':
- is_init_mode = true;
- break;
- case 'x':
- storage_clause = optarg;
- break;
- case 'I':
- if (initialize_steps)
- pg_free(initialize_steps);
- initialize_steps = pg_strdup(optarg);
- checkInitSteps(initialize_steps);
- initialization_option_set = true;
- break;
- case 'h':
- pghost = pg_strdup(optarg);
- break;
- case 'n':
- is_no_vacuum = true;
- break;
- case 'v':
- benchmarking_option_set = true;
- do_vacuum_accounts = true;
- break;
- case 'p':
- pgport = pg_strdup(optarg);
- break;
- case 'd':
- pg_logging_increase_verbosity();
- break;
- case 'c':
- benchmarking_option_set = true;
- nclients = atoi(optarg);
- if (nclients <= 0)
- {
- pg_log_fatal("invalid number of
clients: \"%s\"", optarg);
- exit(1);
- }
-#ifdef HAVE_GETRLIMIT
-#ifdef RLIMIT_NOFILE /* most platforms use RLIMIT_NOFILE */
- if (getrlimit(RLIMIT_NOFILE, &rlim) == -1)
-#else /* but BSD doesn't ...
*/
- if (getrlimit(RLIMIT_OFILE, &rlim) == -1)
-#endif /* RLIMIT_NOFILE */
- {
- pg_log_fatal("getrlimit failed: %m");
- exit(1);
- }
- if (rlim.rlim_cur < nclients + 3)
- {
- pg_log_fatal("need at least %d open
files, but system limit is %ld",
- nclients + 3,
(long) rlim.rlim_cur);
- pg_log_info("Reduce number of clients,
or use limit/ulimit to increase the system limit.");
- exit(1);
- }
-#endif /* HAVE_GETRLIMIT */
- break;
- case 'j': /* jobs */
- benchmarking_option_set = true;
- nthreads = atoi(optarg);
- if (nthreads <= 0)
- {
- pg_log_fatal("invalid number of
threads: \"%s\"", optarg);
- exit(1);
- }
-#ifndef ENABLE_THREAD_SAFETY
- if (nthreads != 1)
- {
- pg_log_fatal("threads are not supported
on this platform; use -j1");
- exit(1);
- }
-#endif /*
!ENABLE_THREAD_SAFETY */
- break;
- case 'C':
- benchmarking_option_set = true;
- is_connect = true;
- break;
- case 'r':
- benchmarking_option_set = true;
- report_per_command = true;
- break;
- case 's':
- scale_given = true;
- scale = atoi(optarg);
- if (scale <= 0)
- {
- pg_log_fatal("invalid scaling factor:
\"%s\"", optarg);
- exit(1);
- }
- break;
- case 't':
- benchmarking_option_set = true;
- nxacts = atoi(optarg);
- if (nxacts <= 0)
- {
- pg_log_fatal("invalid number of
transactions: \"%s\"", optarg);
- exit(1);
- }
- break;
- case 'T':
- benchmarking_option_set = true;
- duration = atoi(optarg);
- if (duration <= 0)
- {
- pg_log_fatal("invalid duration:
\"%s\"", optarg);
- exit(1);
- }
- break;
- case 'U':
- username = pg_strdup(optarg);
- break;
- case 'l':
- benchmarking_option_set = true;
- use_log = true;
- break;
- case 'q':
- initialization_option_set = true;
- use_quiet = true;
- break;
-=======
->>>>>>> REL_16_9
case 'b':
if (strcmp(optarg, "list") == 0)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]