mirror of https://github.com/citusdata/citus.git
Remove HAS_TABLEAM config since we dropped pg11 support (#4862)
* Remove HAS_TABLEAM config * Drop columnar_ensure_objects_exist * Not call columnar_ensure_objects_exist in citus_finish_pg_upgraderebalance/notice_for_no_move
parent
716cc629f1
commit
fe5c985e1d
|
@ -93,7 +93,5 @@ endif
|
|||
override CPPFLAGS := @CPPFLAGS@ @CITUS_CPPFLAGS@ -I '${citus_abs_top_srcdir}/src/include' -I'${citus_top_builddir}/src/include' $(CPPFLAGS)
|
||||
override LDFLAGS += @LDFLAGS@ @CITUS_LDFLAGS@
|
||||
|
||||
HAS_TABLEAM:=@HAS_TABLEAM@
|
||||
|
||||
# optional file with user defined, additional, rules
|
||||
-include ${citus_abs_srcdir}/src/Makefile.custom
|
||||
|
|
|
@ -622,7 +622,6 @@ ac_includes_default="\
|
|||
|
||||
ac_subst_vars='LTLIBOBJS
|
||||
LIBOBJS
|
||||
HAS_TABLEAM
|
||||
HAS_DOTGIT
|
||||
POSTGRES_BUILDDIR
|
||||
POSTGRES_SRCDIR
|
||||
|
@ -4533,11 +4532,6 @@ cat >>confdefs.h <<_ACEOF
|
|||
_ACEOF
|
||||
|
||||
|
||||
HAS_TABLEAM=yes
|
||||
$as_echo "#define HAS_TABLEAM 1" >>confdefs.h
|
||||
|
||||
# Require lz4 & zstd only if we are compiling columnar
|
||||
if test "$HAS_TABLEAM" == 'yes'; then
|
||||
#
|
||||
# LZ4
|
||||
#
|
||||
|
@ -4724,8 +4718,6 @@ fi
|
|||
|
||||
fi
|
||||
|
||||
fi # test "$HAS_TABLEAM" == 'yes'
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -4852,8 +4844,6 @@ POSTGRES_BUILDDIR="$POSTGRES_BUILDDIR"
|
|||
|
||||
HAS_DOTGIT="$HAS_DOTGIT"
|
||||
|
||||
HAS_TABLEAM="$HAS_TABLEAM"
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files Makefile.global"
|
||||
|
||||
|
|
|
@ -216,11 +216,6 @@ PGAC_ARG_REQ(with, reports-hostname, [HOSTNAME],
|
|||
AC_DEFINE_UNQUOTED(REPORTS_BASE_URL, "$REPORTS_BASE_URL",
|
||||
[Base URL for statistics collection and update checks])
|
||||
|
||||
HAS_TABLEAM=yes
|
||||
AC_DEFINE([HAS_TABLEAM], 1, [Define to 1 to build with table access method support, pg12 and up])
|
||||
|
||||
# Require lz4 & zstd only if we are compiling columnar
|
||||
if test "$HAS_TABLEAM" == 'yes'; then
|
||||
#
|
||||
# LZ4
|
||||
#
|
||||
|
@ -259,8 +254,6 @@ if test "$HAS_TABLEAM" == 'yes'; then
|
|||
Use --without-zstd to disable zstd support.])])
|
||||
fi
|
||||
|
||||
fi # test "$HAS_TABLEAM" == 'yes'
|
||||
|
||||
|
||||
PGAC_ARG_BOOL(with, security-flags, no,
|
||||
[use security flags])
|
||||
|
@ -296,7 +289,6 @@ AC_SUBST(CITUS_LDFLAGS, "$LIBS $CITUS_LDFLAGS")
|
|||
AC_SUBST(POSTGRES_SRCDIR, "$POSTGRES_SRCDIR")
|
||||
AC_SUBST(POSTGRES_BUILDDIR, "$POSTGRES_BUILDDIR")
|
||||
AC_SUBST(HAS_DOTGIT, "$HAS_DOTGIT")
|
||||
AC_SUBST(HAS_TABLEAM, "$HAS_TABLEAM")
|
||||
|
||||
AC_CONFIG_FILES([Makefile.global])
|
||||
AC_CONFIG_HEADERS([src/include/citus_config.h] [src/include/citus_version.h])
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
*/
|
||||
|
||||
#include "citus_version.h"
|
||||
#if HAS_TABLEAM
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
|
@ -495,6 +494,3 @@ ColumnarScan_ExplainCustomScan(CustomScanState *node, List *ancestors,
|
|||
chunkGroupsFiltered, es);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* HAS_TABLEAM */
|
||||
|
|
|
@ -1393,7 +1393,6 @@ columnar_relation_storageid(PG_FUNCTION_ARGS)
|
|||
{
|
||||
uint64 storageId = -1;
|
||||
|
||||
#if HAS_TABLEAM
|
||||
Oid relationId = PG_GETARG_OID(0);
|
||||
Relation relation = relation_open(relationId, AccessShareLock);
|
||||
if (IsColumnarTableAmTable(relationId))
|
||||
|
@ -1406,7 +1405,6 @@ columnar_relation_storageid(PG_FUNCTION_ARGS)
|
|||
}
|
||||
|
||||
relation_close(relation, AccessShareLock);
|
||||
#endif
|
||||
|
||||
PG_RETURN_INT64(storageId);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "citus_version.h"
|
||||
#if HAS_TABLEAM
|
||||
|
||||
#include "postgres.h"
|
||||
|
||||
|
@ -1810,6 +1809,3 @@ alter_columnar_table_reset(PG_FUNCTION_ARGS)
|
|||
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -20,24 +20,18 @@
|
|||
#include "columnar/columnar.h"
|
||||
#include "columnar/mod.h"
|
||||
|
||||
#ifdef HAS_TABLEAM
|
||||
#include "columnar/columnar_tableam.h"
|
||||
#endif
|
||||
|
||||
void
|
||||
columnar_init(void)
|
||||
{
|
||||
columnar_init_gucs();
|
||||
#ifdef HAS_TABLEAM
|
||||
columnar_tableam_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
columnar_fini(void)
|
||||
{
|
||||
#if HAS_TABLEAM
|
||||
columnar_tableam_finish();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -16,3 +16,7 @@ ALTER TABLE columnar.chunk_group DROP CONSTRAINT chunk_group_storage_id_fkey;
|
|||
$$;
|
||||
END IF;
|
||||
END$proc$;
|
||||
|
||||
-- since we dropped pg11 support, we don't need to worry about missing
|
||||
-- columnar objects when upgrading postgres
|
||||
DROP FUNCTION citus_internal.columnar_ensure_objects_exist();
|
||||
|
|
|
@ -8,3 +8,6 @@ REFERENCES columnar.chunk_group(storage_id, stripe_num, chunk_group_num) ON DELE
|
|||
ALTER TABLE columnar.chunk_group
|
||||
ADD FOREIGN KEY (storage_id, stripe_num)
|
||||
REFERENCES columnar.stripe(storage_id, stripe_num) ON DELETE CASCADE;
|
||||
|
||||
-- define columnar_ensure_objects_exist again
|
||||
#include "../udfs/columnar_ensure_objects_exist/10.0-1.sql"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "postgres.h"
|
||||
#include "columnar/columnar.h"
|
||||
|
||||
#if HAS_TABLEAM
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
@ -378,8 +377,6 @@ PendingWritesInUpperTransactions(Oid relfilenode, SubTransactionId currentSubXid
|
|||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GetWriteContextForDebug exposes WriteStateContext for debugging
|
||||
* purposes.
|
||||
|
@ -387,9 +384,5 @@ PendingWritesInUpperTransactions(Oid relfilenode, SubTransactionId currentSubXid
|
|||
extern MemoryContext
|
||||
GetWriteContextForDebug(void)
|
||||
{
|
||||
#if HAS_TABLEAM
|
||||
return WriteStateContext;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -682,7 +682,6 @@ ConvertTable(TableConversionState *con)
|
|||
}
|
||||
|
||||
/* set columnar options */
|
||||
#if HAS_TABLEAM
|
||||
if (con->accessMethod == NULL && con->originalAccessMethod &&
|
||||
strcmp(con->originalAccessMethod, "columnar") == 0)
|
||||
{
|
||||
|
@ -702,7 +701,6 @@ ConvertTable(TableConversionState *con)
|
|||
|
||||
ExecuteQueryViaSPI(columnarOptionsSql, SPI_OK_SELECT);
|
||||
}
|
||||
#endif
|
||||
|
||||
con->newRelationId = get_relname_relid(con->tempName, con->schemaId);
|
||||
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
|
||||
#include "../../columnar/sql/columnar--10.0-3--10.1-1.sql"
|
||||
#include "udfs/create_distributed_table/10.1-1.sql";
|
||||
#include "udfs/citus_finish_pg_upgrade/10.1-1.sql"
|
||||
|
|
|
@ -15,3 +15,5 @@ COMMENT ON FUNCTION create_distributed_table(table_name regclass,
|
|||
distribution_type citus.distribution_type,
|
||||
colocate_with text)
|
||||
IS 'creates a distributed table';
|
||||
|
||||
#include "../udfs/citus_finish_pg_upgrade/10.0-1.sql"
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
CREATE OR REPLACE FUNCTION pg_catalog.citus_finish_pg_upgrade()
|
||||
RETURNS void
|
||||
LANGUAGE plpgsql
|
||||
SET search_path = pg_catalog
|
||||
AS $cppu$
|
||||
DECLARE
|
||||
table_name regclass;
|
||||
command text;
|
||||
trigger_name text;
|
||||
BEGIN
|
||||
--
|
||||
-- restore citus catalog tables
|
||||
--
|
||||
INSERT INTO pg_catalog.pg_dist_partition SELECT * FROM public.pg_dist_partition;
|
||||
INSERT INTO pg_catalog.pg_dist_shard SELECT * FROM public.pg_dist_shard;
|
||||
INSERT INTO pg_catalog.pg_dist_placement SELECT * FROM public.pg_dist_placement;
|
||||
INSERT INTO pg_catalog.pg_dist_node_metadata SELECT * FROM public.pg_dist_node_metadata;
|
||||
INSERT INTO pg_catalog.pg_dist_node SELECT * FROM public.pg_dist_node;
|
||||
INSERT INTO pg_catalog.pg_dist_local_group SELECT * FROM public.pg_dist_local_group;
|
||||
INSERT INTO pg_catalog.pg_dist_transaction SELECT * FROM public.pg_dist_transaction;
|
||||
INSERT INTO pg_catalog.pg_dist_colocation SELECT * FROM public.pg_dist_colocation;
|
||||
-- enterprise catalog tables
|
||||
INSERT INTO pg_catalog.pg_dist_authinfo SELECT * FROM public.pg_dist_authinfo;
|
||||
INSERT INTO pg_catalog.pg_dist_poolinfo SELECT * FROM public.pg_dist_poolinfo;
|
||||
|
||||
ALTER TABLE pg_catalog.pg_dist_rebalance_strategy DISABLE TRIGGER pg_dist_rebalance_strategy_enterprise_check_trigger;
|
||||
INSERT INTO pg_catalog.pg_dist_rebalance_strategy SELECT
|
||||
name,
|
||||
default_strategy,
|
||||
shard_cost_function::regprocedure::regproc,
|
||||
node_capacity_function::regprocedure::regproc,
|
||||
shard_allowed_on_node_function::regprocedure::regproc,
|
||||
default_threshold,
|
||||
minimum_threshold
|
||||
FROM public.pg_dist_rebalance_strategy;
|
||||
ALTER TABLE pg_catalog.pg_dist_rebalance_strategy ENABLE TRIGGER pg_dist_rebalance_strategy_enterprise_check_trigger;
|
||||
|
||||
--
|
||||
-- drop backup tables
|
||||
--
|
||||
DROP TABLE public.pg_dist_authinfo;
|
||||
DROP TABLE public.pg_dist_colocation;
|
||||
DROP TABLE public.pg_dist_local_group;
|
||||
DROP TABLE public.pg_dist_node;
|
||||
DROP TABLE public.pg_dist_node_metadata;
|
||||
DROP TABLE public.pg_dist_partition;
|
||||
DROP TABLE public.pg_dist_placement;
|
||||
DROP TABLE public.pg_dist_poolinfo;
|
||||
DROP TABLE public.pg_dist_shard;
|
||||
DROP TABLE public.pg_dist_transaction;
|
||||
DROP TABLE public.pg_dist_rebalance_strategy;
|
||||
|
||||
--
|
||||
-- reset sequences
|
||||
--
|
||||
PERFORM setval('pg_catalog.pg_dist_shardid_seq', (SELECT MAX(shardid)+1 AS max_shard_id FROM pg_dist_shard), false);
|
||||
PERFORM setval('pg_catalog.pg_dist_placement_placementid_seq', (SELECT MAX(placementid)+1 AS max_placement_id FROM pg_dist_placement), false);
|
||||
PERFORM setval('pg_catalog.pg_dist_groupid_seq', (SELECT MAX(groupid)+1 AS max_group_id FROM pg_dist_node), false);
|
||||
PERFORM setval('pg_catalog.pg_dist_node_nodeid_seq', (SELECT MAX(nodeid)+1 AS max_node_id FROM pg_dist_node), false);
|
||||
PERFORM setval('pg_catalog.pg_dist_colocationid_seq', (SELECT MAX(colocationid)+1 AS max_colocation_id FROM pg_dist_colocation), false);
|
||||
|
||||
--
|
||||
-- register triggers
|
||||
--
|
||||
FOR table_name IN SELECT logicalrelid FROM pg_catalog.pg_dist_partition
|
||||
LOOP
|
||||
trigger_name := 'truncate_trigger_' || table_name::oid;
|
||||
command := 'create trigger ' || trigger_name || ' after truncate on ' || table_name || ' execute procedure pg_catalog.citus_truncate_trigger()';
|
||||
EXECUTE command;
|
||||
command := 'update pg_trigger set tgisinternal = true where tgname = ' || quote_literal(trigger_name);
|
||||
EXECUTE command;
|
||||
END LOOP;
|
||||
|
||||
--
|
||||
-- set dependencies
|
||||
--
|
||||
INSERT INTO pg_depend
|
||||
SELECT
|
||||
'pg_class'::regclass::oid as classid,
|
||||
p.logicalrelid::regclass::oid as objid,
|
||||
0 as objsubid,
|
||||
'pg_extension'::regclass::oid as refclassid,
|
||||
(select oid from pg_extension where extname = 'citus') as refobjid,
|
||||
0 as refobjsubid ,
|
||||
'n' as deptype
|
||||
FROM pg_catalog.pg_dist_partition p;
|
||||
|
||||
-- restore pg_dist_object from the stable identifiers
|
||||
-- DELETE/INSERT to avoid primary key violations
|
||||
WITH old_records AS (
|
||||
DELETE FROM
|
||||
citus.pg_dist_object
|
||||
RETURNING
|
||||
type,
|
||||
object_names,
|
||||
object_args,
|
||||
distribution_argument_index,
|
||||
colocationid
|
||||
)
|
||||
INSERT INTO citus.pg_dist_object (classid, objid, objsubid, distribution_argument_index, colocationid)
|
||||
SELECT
|
||||
address.classid,
|
||||
address.objid,
|
||||
address.objsubid,
|
||||
naming.distribution_argument_index,
|
||||
naming.colocationid
|
||||
FROM
|
||||
old_records naming,
|
||||
pg_get_object_address(naming.type, naming.object_names, naming.object_args) address;
|
||||
END;
|
||||
$cppu$;
|
||||
|
||||
COMMENT ON FUNCTION pg_catalog.citus_finish_pg_upgrade()
|
||||
IS 'perform tasks to restore citus settings from a location that has been prepared before pg_upgrade';
|
|
@ -107,8 +107,6 @@ BEGIN
|
|||
FROM
|
||||
old_records naming,
|
||||
pg_get_object_address(naming.type, naming.object_names, naming.object_args) address;
|
||||
|
||||
PERFORM citus_internal.columnar_ensure_objects_exist();
|
||||
END;
|
||||
$cppu$;
|
||||
|
||||
|
|
|
@ -31,9 +31,6 @@
|
|||
/* A string containing the version number, platform, and C compiler */
|
||||
#undef CITUS_VERSION_STR
|
||||
|
||||
/* Define to 1 to build with table access method support, pg12 and up */
|
||||
#undef HAS_TABLEAM
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
|
|
|
@ -32,6 +32,3 @@
|
|||
|
||||
/* Base URL for statistics collection and update checks */
|
||||
#undef REPORTS_BASE_URL
|
||||
|
||||
/* columnar table access method capability */
|
||||
#undef HAS_TABLEAM
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "citus_version.h"
|
||||
#if HAS_TABLEAM
|
||||
|
||||
#include "postgres.h"
|
||||
#include "fmgr.h"
|
||||
|
@ -22,4 +21,3 @@ extern int64 ColumnarScanChunkGroupsFiltered(TableScanDesc scanDesc);
|
|||
extern bool IsColumnarTableAmTable(Oid relationId);
|
||||
extern TableDDLCommand * ColumnarGetTableOptionsDDL(Oid relationId);
|
||||
extern char * GetShardedTableDDLCommandColumnar(uint64 shardId, void *context);
|
||||
#endif
|
||||
|
|
|
@ -562,9 +562,10 @@ ALTER EXTENSION citus UPDATE TO '10.1-1';
|
|||
SELECT * FROM print_extension_changes();
|
||||
previous_object | current_object
|
||||
---------------------------------------------------------------------
|
||||
function citus_internal.columnar_ensure_objects_exist() |
|
||||
function create_distributed_table(regclass,text,citus.distribution_type,text) |
|
||||
| function create_distributed_table(regclass,text,citus.distribution_type,text,integer)
|
||||
(2 rows)
|
||||
(3 rows)
|
||||
|
||||
DROP TABLE prev_objects, extension_diff;
|
||||
-- show running version
|
||||
|
|
|
@ -56,7 +56,6 @@ ORDER BY 1;
|
|||
function citus_extradata_container(internal)
|
||||
function citus_finish_pg_upgrade()
|
||||
function citus_get_active_worker_nodes()
|
||||
function citus_internal.columnar_ensure_objects_exist()
|
||||
function citus_internal.find_groupid_for_node(text,integer)
|
||||
function citus_internal.pg_dist_node_trigger_func()
|
||||
function citus_internal.pg_dist_rebalance_strategy_enterprise_check()
|
||||
|
@ -243,5 +242,5 @@ ORDER BY 1;
|
|||
view citus_worker_stat_activity
|
||||
view pg_dist_shard_placement
|
||||
view time_partitions
|
||||
(227 rows)
|
||||
(226 rows)
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ ORDER BY 1;
|
|||
function citus_extradata_container(internal)
|
||||
function citus_finish_pg_upgrade()
|
||||
function citus_get_active_worker_nodes()
|
||||
function citus_internal.columnar_ensure_objects_exist()
|
||||
function citus_internal.find_groupid_for_node(text,integer)
|
||||
function citus_internal.pg_dist_node_trigger_func()
|
||||
function citus_internal.pg_dist_rebalance_strategy_enterprise_check()
|
||||
|
@ -239,5 +238,5 @@ ORDER BY 1;
|
|||
view citus_worker_stat_activity
|
||||
view pg_dist_shard_placement
|
||||
view time_partitions
|
||||
(223 rows)
|
||||
(222 rows)
|
||||
|
||||
|
|
Loading…
Reference in New Issue