From 5e793f604f7d302a0338b3f56bdd024d4b9e90e6 Mon Sep 17 00:00:00 2001 From: Adam Berlin Date: Mon, 9 Dec 2019 10:47:13 -0500 Subject: [PATCH] Move Greenplum specific headers into greenplum directory. --- contrib/pg_upgrade/check.c | 2 +- contrib/pg_upgrade/file.c | 2 +- contrib/pg_upgrade/greenplum/aotable.c | 4 +- contrib/pg_upgrade/greenplum/check_gp.c | 2 +- contrib/pg_upgrade/greenplum/file_gp.c | 3 +- .../pg_upgrade/greenplum/gpdb4_heap_convert.c | 3 +- .../greenplum/pg_upgrade_greenplum.h | 49 +++++++++++++++++++ contrib/pg_upgrade/greenplum/reporting.c | 3 +- contrib/pg_upgrade/greenplum/version_gp.c | 3 +- contrib/pg_upgrade/info.c | 1 + contrib/pg_upgrade/pg_upgrade.c | 2 + contrib/pg_upgrade/pg_upgrade.h | 38 ++------------ contrib/pg_upgrade/relfilenode.c | 1 + contrib/pg_upgrade/server.c | 1 + contrib/pg_upgrade/util.c | 1 + 15 files changed, 73 insertions(+), 42 deletions(-) create mode 100644 contrib/pg_upgrade/greenplum/pg_upgrade_greenplum.h diff --git a/contrib/pg_upgrade/check.c b/contrib/pg_upgrade/check.c index 16849ee570..8a216c55f9 100644 --- a/contrib/pg_upgrade/check.c +++ b/contrib/pg_upgrade/check.c @@ -11,7 +11,7 @@ #include "mb/pg_wchar.h" #include "pg_upgrade.h" - +#include "greenplum/pg_upgrade_greenplum.h" static void set_locale_and_encoding(ClusterInfo *cluster); static void check_new_cluster_is_empty(void); diff --git a/contrib/pg_upgrade/file.c b/contrib/pg_upgrade/file.c index 7e03ea3077..beb103b14a 100644 --- a/contrib/pg_upgrade/file.c +++ b/contrib/pg_upgrade/file.c @@ -13,7 +13,7 @@ #include - +#include "greenplum/pg_upgrade_greenplum.h" #ifndef WIN32 static int copy_file(const char *fromfile, const char *tofile, bool force); diff --git a/contrib/pg_upgrade/greenplum/aotable.c b/contrib/pg_upgrade/greenplum/aotable.c index 7ad0ec859b..f64bc49477 100644 --- a/contrib/pg_upgrade/greenplum/aotable.c +++ b/contrib/pg_upgrade/greenplum/aotable.c @@ -7,9 +7,11 @@ */ #include "postgres_fe.h" -#include "pg_upgrade.h" +#include "pg_upgrade_greenplum.h" + #include "pqexpbuffer.h" + /* * We cannot use executeQueryOrDie for the INSERTs below, because it has a size * limit on the query. diff --git a/contrib/pg_upgrade/greenplum/check_gp.c b/contrib/pg_upgrade/greenplum/check_gp.c index 2ca8157ae6..f230b06b09 100644 --- a/contrib/pg_upgrade/greenplum/check_gp.c +++ b/contrib/pg_upgrade/greenplum/check_gp.c @@ -14,7 +14,7 @@ * contrib/pg_upgrade/check_gp.c */ -#include "pg_upgrade.h" +#include "pg_upgrade_greenplum.h" #include "check_gp.h" static void check_external_partition(void); diff --git a/contrib/pg_upgrade/greenplum/file_gp.c b/contrib/pg_upgrade/greenplum/file_gp.c index 60e590fed4..a89980e88e 100644 --- a/contrib/pg_upgrade/greenplum/file_gp.c +++ b/contrib/pg_upgrade/greenplum/file_gp.c @@ -9,12 +9,13 @@ */ #include "postgres_fe.h" -#include "pg_upgrade.h" +#include "pg_upgrade_greenplum.h" #include "storage/bufpage.h" #include "storage/checksum.h" #include "storage/checksum_impl.h" + /* * rewriteHeapPageWithChecksum * diff --git a/contrib/pg_upgrade/greenplum/gpdb4_heap_convert.c b/contrib/pg_upgrade/greenplum/gpdb4_heap_convert.c index c74faf0341..28a88642c6 100644 --- a/contrib/pg_upgrade/greenplum/gpdb4_heap_convert.c +++ b/contrib/pg_upgrade/greenplum/gpdb4_heap_convert.c @@ -5,13 +5,14 @@ */ #include "postgres_fe.h" -#include "pg_upgrade.h" +#include "pg_upgrade_greenplum.h" #include "access/htup_details.h" #include "access/xlogdefs.h" #include "storage/bufpage.h" #include "storage/checksum.h" + /* * GPDB_94_MERGE_FIXME: VARSIZE_ANY_EXHDR() contains a TrapMacro, with * assertions enabled. But TrapMacro is not defined in FRONTEND diff --git a/contrib/pg_upgrade/greenplum/pg_upgrade_greenplum.h b/contrib/pg_upgrade/greenplum/pg_upgrade_greenplum.h new file mode 100644 index 0000000000..6085cb8f6b --- /dev/null +++ b/contrib/pg_upgrade/greenplum/pg_upgrade_greenplum.h @@ -0,0 +1,49 @@ +#ifndef PG_UPGRADE_GREENPLUM_H +#define PG_UPGRADE_GREENPLUM_H +/* + * greenplum/pg_upgrade_greenplum.h + * + * Portions Copyright (c) 2019-Present, Pivotal Software Inc + * contrib/pg_upgrade/greenplum/pg_upgrade_greenplum.h + */ + + +#include "pg_upgrade.h" + + +/* aotable.c */ + +void restore_aosegment_tables(void); + +/* gpdb4_heap_convert.c */ + +const char *convert_gpdb4_heap_file(const char *src, const char *dst, + bool has_numerics, AttInfo *atts, int natts); +void finish_gpdb4_page_converter(void); + +/* file_gp.c */ + +const char * rewriteHeapPageChecksum( const char *fromfile, const char *tofile, + const char *schemaName, const char *relName); + +/* version_gp.c */ + +void old_GPDB4_check_for_money_data_type_usage(void); +void old_GPDB4_check_no_free_aoseg(void); +void check_hash_partition_usage(void); +void new_gpdb5_0_invalidate_indexes(void); +void new_gpdb_invalidate_bitmap_indexes(void); +Oid *get_numeric_types(PGconn *conn); +void old_GPDB5_check_for_unsupported_distribution_key_data_types(void); + +/* check_gp.c */ + +void check_greenplum(void); + +/* reporting.c */ + +void report_progress(ClusterInfo *cluster, progress_type op, char *fmt,...) +pg_attribute_printf(3, 4); +void close_progress(void); + +#endif /* PG_UPGRADE_GREENPLUM_H */ diff --git a/contrib/pg_upgrade/greenplum/reporting.c b/contrib/pg_upgrade/greenplum/reporting.c index 21528762e9..84bb6197bf 100644 --- a/contrib/pg_upgrade/greenplum/reporting.c +++ b/contrib/pg_upgrade/greenplum/reporting.c @@ -6,10 +6,11 @@ * Copyright (c) 2017-Present, Pivotal Software Inc. */ -#include "pg_upgrade.h" +#include "pg_upgrade_greenplum.h" #include + static FILE *progress_file = NULL; static int progress_id = 0; static int progress_counter = 0; diff --git a/contrib/pg_upgrade/greenplum/version_gp.c b/contrib/pg_upgrade/greenplum/version_gp.c index cd9a3a0be8..4c23c0e989 100644 --- a/contrib/pg_upgrade/greenplum/version_gp.c +++ b/contrib/pg_upgrade/greenplum/version_gp.c @@ -8,10 +8,11 @@ */ #include "postgres_fe.h" -#include "pg_upgrade.h" +#include "pg_upgrade_greenplum.h" #include "access/transam.h" + /* * old_8_3_check_for_money_data_type_usage() * 8.2 -> 8.3 diff --git a/contrib/pg_upgrade/info.c b/contrib/pg_upgrade/info.c index 37c8cc0b8a..58093d6b42 100644 --- a/contrib/pg_upgrade/info.c +++ b/contrib/pg_upgrade/info.c @@ -15,6 +15,7 @@ #include "catalog/pg_class.h" #include "info_gp.h" +#include "greenplum/pg_upgrade_greenplum.h" static void create_rel_filename_map(const char *old_data, const char *new_data, const DbInfo *old_db, const DbInfo *new_db, diff --git a/contrib/pg_upgrade/pg_upgrade.c b/contrib/pg_upgrade/pg_upgrade.c index fcc459e9ee..339da14d02 100644 --- a/contrib/pg_upgrade/pg_upgrade.c +++ b/contrib/pg_upgrade/pg_upgrade.c @@ -43,6 +43,8 @@ #include #endif +#include "greenplum/pg_upgrade_greenplum.h" + static void prepare_new_cluster(void); static void prepare_new_databases(void); static void create_new_objects(void); diff --git a/contrib/pg_upgrade/pg_upgrade.h b/contrib/pg_upgrade/pg_upgrade.h index 7a55102c1c..427664bad6 100644 --- a/contrib/pg_upgrade/pg_upgrade.h +++ b/contrib/pg_upgrade/pg_upgrade.h @@ -1,3 +1,5 @@ +#ifndef PG_UPGRADE_H +#define PG_UPGRADE_H /* * pg_upgrade.h * @@ -677,44 +679,12 @@ bool reap_child(bool wait_for_child); #endif #define Assert(condition) ((void) (true || (condition))) -/* aotable.c */ - -void restore_aosegment_tables(void); - -/* gpdb4_heap_convert.c */ - -const char *convert_gpdb4_heap_file(const char *src, const char *dst, - bool has_numerics, AttInfo *atts, int natts); -void finish_gpdb4_page_converter(void); - -/* file_gp.c */ - void copy_distributedlog(void); -const char * rewriteHeapPageChecksum( const char *fromfile, const char *tofile, - const char *schemaName, const char *relName); - -/* version_gp.c */ - -void old_GPDB4_check_for_money_data_type_usage(void); -void old_GPDB4_check_no_free_aoseg(void); -void check_hash_partition_usage(void); -void new_gpdb5_0_invalidate_indexes(void); -void new_gpdb_invalidate_bitmap_indexes(void); -Oid *get_numeric_types(PGconn *conn); -void old_GPDB5_check_for_unsupported_distribution_key_data_types(void); - -/* check_gp.c */ - -void check_greenplum(void); - -/* reporting.c */ - -void report_progress(ClusterInfo *cluster, progress_type op, char *fmt,...) -__attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 4))); -void close_progress(void); static inline bool is_gpdb6(ClusterInfo *cluster) { return GET_MAJOR_VERSION(cluster->major_version) == 904; } + +#endif /* PG_UPGRADE_H */ \ No newline at end of file diff --git a/contrib/pg_upgrade/relfilenode.c b/contrib/pg_upgrade/relfilenode.c index f46e9a8d4e..6a89c0b9f7 100644 --- a/contrib/pg_upgrade/relfilenode.c +++ b/contrib/pg_upgrade/relfilenode.c @@ -17,6 +17,7 @@ #include "access/htup_details.h" #include "access/transam.h" +#include "greenplum/pg_upgrade_greenplum.h" static void transfer_single_new_db(pageCnvCtx *pageConverter, FileNameMap *maps, int size, char *old_tablespace); diff --git a/contrib/pg_upgrade/server.c b/contrib/pg_upgrade/server.c index fee7534a92..3a1d16d5a9 100644 --- a/contrib/pg_upgrade/server.c +++ b/contrib/pg_upgrade/server.c @@ -12,6 +12,7 @@ #include "fe_utils/connect.h" #include "pg_upgrade.h" +#include "greenplum/pg_upgrade_greenplum.h" static PGconn *get_db_conn(ClusterInfo *cluster, const char *db_name); diff --git a/contrib/pg_upgrade/util.c b/contrib/pg_upgrade/util.c index bce2ed0692..7b09650f4c 100644 --- a/contrib/pg_upgrade/util.c +++ b/contrib/pg_upgrade/util.c @@ -14,6 +14,7 @@ #include +#include "greenplum/pg_upgrade_greenplum.h" LogOpts log_opts; -- GitLab