timescaledb/test/sql/updates/setup.multinode.sql
Erik Nordström 973263a4f1 Add multi-node update test
The update scripts now test extension updates for a multi-node setup
with one access node and one data node. Currently the following is
tested:

* A distributed hypertable is created in the database where the update
  process is normally tested.
* A new database representing a data node is created. This database is
  updated and restored in the same way as the other database. However,
  no integrity or other validation checks are currently run on the
  datanode database; only the ability to update the extension is
  tested.
2020-12-21 12:31:43 +01:00

22 lines
793 B
PL/PgSQL

-- 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.
DO LANGUAGE PLPGSQL $$
DECLARE
ts_version TEXT;
BEGIN
SELECT extversion INTO ts_version FROM pg_extension WHERE extname = 'timescaledb';
-- Can only run multinode on 2.0.0+
IF ts_version >= '2.0.0' THEN
RAISE NOTICE 'creating multinode setup for version % on database %',
ts_version, current_database();
PERFORM add_data_node('dn1', host=>'localhost', database=>'dn1');
CREATE TABLE disthyper (time timestamptz, device int, temp float);
PERFORM create_distributed_hypertable('disthyper', 'time', 'device');
INSERT INTO disthyper VALUES ('2020-12-20 12:18', 1, 27.9);
END IF;
END
$$;