timescaledb/sql/dist_internal.sql
Brian Rowe 31953f0dc6 Verify configuration before adding data node
This change will call a function on a remote database to validate
its configuration before following through with an add_data_node
call.  Right now the check will ensure that the data is able to use
prepared transactions, but further checks can be easily added in
the future.

Since this uses the timescaledb extension to validate the remote
database, it runs at the end of bootstrapping.  We may want to
consider adding code to undo our bootstrapping changes if this check
fails.
2020-05-27 17:31:09 +02:00

31 lines
1.3 KiB
SQL

-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
CREATE OR REPLACE FUNCTION _timescaledb_internal.set_dist_id(dist_id UUID) RETURNS BOOL
AS '@MODULE_PATHNAME@', 'ts_dist_set_id' LANGUAGE C VOLATILE STRICT;
CREATE OR REPLACE FUNCTION _timescaledb_internal.remove_from_dist_db() RETURNS BOOL
AS '@MODULE_PATHNAME@', 'ts_dist_remove_id' LANGUAGE C VOLATILE STRICT;
CREATE OR REPLACE FUNCTION _timescaledb_internal.set_peer_dist_id(dist_id UUID) RETURNS BOOL
AS '@MODULE_PATHNAME@', 'ts_dist_set_peer_id' LANGUAGE C VOLATILE STRICT;
CREATE OR REPLACE FUNCTION data_node_hypertable_info(
node_name NAME
)
RETURNS TABLE (id int,
table_schema name,
table_name name,
table_owner name,
num_dimensions smallint,
num_chunks bigint,
distributed bool,
table_bytes bigint,
index_bytes bigint,
toast_bytes bigint,
total_bytes bigint)
AS '@MODULE_PATHNAME@', 'ts_dist_remote_hypertable_info' LANGUAGE C VOLATILE STRICT;
CREATE OR REPLACE FUNCTION _timescaledb_internal.validate_as_data_node() RETURNS BOOL
AS '@MODULE_PATHNAME@', 'ts_dist_validate_as_data_node' LANGUAGE C VOLATILE STRICT;