mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-15 10:11:29 +08:00
Remove multinode from update/downgrade test
This commit is contained in:
parent
76fead4d1e
commit
5d3ab06295
@ -213,10 +213,6 @@ docker_pgcmd ${CONTAINER_UPDATED} "SELECT user_view_schema, user_view_name FROM
|
||||
|
||||
echo "Executing ALTER EXTENSION timescaledb UPDATE for update ($UPDATE_FROM_TAG -> $UPDATE_TO_TAG)"
|
||||
docker_pgcmd ${CONTAINER_UPDATED} "ALTER EXTENSION timescaledb UPDATE" "single"
|
||||
# PG16 does not support MN
|
||||
if [ "${PG_VERSION_MAJOR}" -lt 16 ]; then
|
||||
docker_pgcmd ${CONTAINER_UPDATED} "ALTER EXTENSION timescaledb UPDATE" "dn1"
|
||||
fi
|
||||
# Need to update also postgres DB since add_data_node may connect to
|
||||
# it and it will be borked if we don't upgrade to an extension binary
|
||||
# which is available in the image.
|
||||
@ -229,10 +225,6 @@ docker_pgcmd ${CONTAINER_UPDATED} "SELECT user_view_schema, user_view_name FROM
|
||||
# downgrade the just upgraded version.
|
||||
echo "Executing ALTER EXTENSION timescaledb UPDATE for downgrade ($UPDATE_TO_TAG -> $UPDATE_FROM_TAG)"
|
||||
docker_pgcmd ${CONTAINER_UPDATED} "ALTER EXTENSION timescaledb UPDATE TO '$VERSION'" "postgres"
|
||||
# PG16 does not support MN
|
||||
if [ "${PG_VERSION_MAJOR}" -lt 16 ]; then
|
||||
docker_pgcmd ${CONTAINER_UPDATED} "ALTER EXTENSION timescaledb UPDATE TO '$VERSION'" "dn1"
|
||||
fi
|
||||
docker_pgcmd ${CONTAINER_UPDATED} "ALTER EXTENSION timescaledb UPDATE TO '$VERSION'" "single"
|
||||
|
||||
# Check that there is nothing wrong before taking a backup
|
||||
@ -250,18 +242,9 @@ docker_pgscript ${CONTAINER_CLEAN_RERUN} /src/test/sql/updates/setup.post-downgr
|
||||
|
||||
docker_exec ${CONTAINER_UPDATED} "pg_dump -h localhost -U postgres -Fc single > /tmp/single.dump"
|
||||
docker cp ${CONTAINER_UPDATED}:/tmp/single.dump ${TEST_TMPDIR}/single.dump
|
||||
# PG16 does not support MN
|
||||
if [ "${PG_VERSION_MAJOR}" -lt 16 ]; then
|
||||
docker_exec ${CONTAINER_UPDATED} "pg_dump -h localhost -U postgres -Fc dn1 > /tmp/dn1.dump"
|
||||
docker cp ${CONTAINER_UPDATED}:/tmp/dn1.dump ${TEST_TMPDIR}/dn1.dump
|
||||
fi
|
||||
|
||||
echo "Restoring database on clean version"
|
||||
docker cp ${TEST_TMPDIR}/single.dump ${CONTAINER_CLEAN_RESTORE}:/tmp/single.dump
|
||||
# PG16 does not support MN
|
||||
if [ "${PG_VERSION_MAJOR}" -lt 16 ]; then
|
||||
docker cp ${TEST_TMPDIR}/dn1.dump ${CONTAINER_CLEAN_RESTORE}:/tmp/dn1.dump
|
||||
fi
|
||||
|
||||
# Restore single
|
||||
docker_exec ${CONTAINER_CLEAN_RESTORE} "createdb -h localhost -U postgres single"
|
||||
@ -269,14 +252,5 @@ docker_pgcmd ${CONTAINER_CLEAN_RESTORE} "ALTER DATABASE single SET timescaledb.r
|
||||
docker_exec ${CONTAINER_CLEAN_RESTORE} "pg_restore -h localhost -U postgres -d single /tmp/single.dump"
|
||||
docker_pgcmd ${CONTAINER_CLEAN_RESTORE} "ALTER DATABASE single RESET timescaledb.restoring"
|
||||
|
||||
# PG16 does not support MN
|
||||
if [ "${PG_VERSION_MAJOR}" -lt 16 ]; then
|
||||
# Restore dn1
|
||||
docker_exec ${CONTAINER_CLEAN_RESTORE} "createdb -h localhost -U postgres dn1"
|
||||
docker_pgcmd ${CONTAINER_CLEAN_RESTORE} "ALTER DATABASE dn1 SET timescaledb.restoring='on'"
|
||||
docker_exec ${CONTAINER_CLEAN_RESTORE} "pg_restore -h localhost -U postgres -d dn1 /tmp/dn1.dump"
|
||||
docker_pgcmd ${CONTAINER_CLEAN_RESTORE} "ALTER DATABASE dn1 RESET timescaledb.restoring"
|
||||
fi
|
||||
|
||||
echo "Comparing downgraded ($UPDATE_TO_TAG -> $UPDATE_FROM_TAG) with clean install ($UPDATE_TO_TAG)"
|
||||
docker_pgdiff_all /src/test/sql/updates/post.${TEST_VERSION}.sql "single"
|
||||
|
@ -11,7 +11,6 @@ TEST_TMPDIR=${TEST_TMPDIR:-$(mktemp -d 2>/dev/null || mktemp -d -t 'timescaledb_
|
||||
UPDATE_PG_PORT=${UPDATE_PG_PORT:-6432}
|
||||
CLEAN_PG_PORT=${CLEAN_PG_PORT:-6433}
|
||||
PG_VERSION=${PG_VERSION:-14.3}
|
||||
PG_VERSION_MAJOR=$(echo "${PG_VERSION}" | awk '{split($0,v,"."); print v[1]}')
|
||||
GIT_ID=$(git -C ${BASE_DIR} describe --dirty --always | sed -e "s|/|_|g")
|
||||
UPDATE_FROM_IMAGE=${UPDATE_FROM_IMAGE:-timescale/timescaledb}
|
||||
UPDATE_FROM_TAG=${UPDATE_FROM_TAG:-0.1.0}
|
||||
@ -199,10 +198,6 @@ docker_run_vol ${CONTAINER_UPDATED} ${UPDATE_VOLUME}:/var/lib/postgresql/data ${
|
||||
|
||||
echo "Executing ALTER EXTENSION timescaledb UPDATE ($UPDATE_FROM_TAG -> $UPDATE_TO_TAG)"
|
||||
docker_pgcmd ${CONTAINER_UPDATED} "ALTER EXTENSION timescaledb UPDATE" "single"
|
||||
# PG16 does not support MN
|
||||
if [ "${PG_VERSION_MAJOR}" -lt 16 ]; then
|
||||
docker_pgcmd ${CONTAINER_UPDATED} "ALTER EXTENSION timescaledb UPDATE" "dn1"
|
||||
fi
|
||||
# Need to update also postgres DB since add_data_node may connect to
|
||||
# it and it will be borked if we don't upgrade to an extension binary
|
||||
# which is available in the image.
|
||||
@ -219,18 +214,9 @@ docker_pgscript ${CONTAINER_CLEAN_RERUN} /src/test/sql/updates/setup.${TEST_VERS
|
||||
|
||||
docker_exec ${CONTAINER_UPDATED} "pg_dump -h localhost -U postgres -Fc single > /tmp/single.dump"
|
||||
docker cp ${CONTAINER_UPDATED}:/tmp/single.dump ${TEST_TMPDIR}/single.dump
|
||||
# PG16 does not support MN
|
||||
if [ "${PG_VERSION_MAJOR}" -lt 16 ]; then
|
||||
docker_exec ${CONTAINER_UPDATED} "pg_dump -h localhost -U postgres -Fc dn1 > /tmp/dn1.dump"
|
||||
docker cp ${CONTAINER_UPDATED}:/tmp/dn1.dump ${TEST_TMPDIR}/dn1.dump
|
||||
fi
|
||||
|
||||
echo "Restoring database on clean version"
|
||||
docker cp ${TEST_TMPDIR}/single.dump ${CONTAINER_CLEAN_RESTORE}:/tmp/single.dump
|
||||
# PG16 does not support MN
|
||||
if [ "${PG_VERSION_MAJOR}" -lt 16 ]; then
|
||||
docker cp ${TEST_TMPDIR}/dn1.dump ${CONTAINER_CLEAN_RESTORE}:/tmp/dn1.dump
|
||||
fi
|
||||
|
||||
# Restore single
|
||||
docker_exec ${CONTAINER_CLEAN_RESTORE} "createdb -h localhost -U postgres single"
|
||||
@ -238,14 +224,5 @@ docker_pgcmd ${CONTAINER_CLEAN_RESTORE} "ALTER DATABASE single SET timescaledb.r
|
||||
docker_exec ${CONTAINER_CLEAN_RESTORE} "pg_restore -h localhost -U postgres -d single /tmp/single.dump"
|
||||
docker_pgcmd ${CONTAINER_CLEAN_RESTORE} "ALTER DATABASE single RESET timescaledb.restoring"
|
||||
|
||||
# PG16 does not support MN
|
||||
if [ "${PG_VERSION_MAJOR}" -lt 16 ]; then
|
||||
# Restore dn1
|
||||
docker_exec ${CONTAINER_CLEAN_RESTORE} "createdb -h localhost -U postgres dn1"
|
||||
docker_pgcmd ${CONTAINER_CLEAN_RESTORE} "ALTER DATABASE dn1 SET timescaledb.restoring='on'"
|
||||
docker_exec ${CONTAINER_CLEAN_RESTORE} "pg_restore -h localhost -U postgres -d dn1 /tmp/dn1.dump"
|
||||
docker_pgcmd ${CONTAINER_CLEAN_RESTORE} "ALTER DATABASE dn1 RESET timescaledb.restoring"
|
||||
fi
|
||||
|
||||
echo "Comparing upgraded ($UPDATE_FROM_TAG -> $UPDATE_TO_TAG) with clean install ($UPDATE_TO_TAG)"
|
||||
docker_pgdiff_all /src/test/sql/updates/post.${TEST_VERSION}.sql "single"
|
||||
|
@ -1,12 +0,0 @@
|
||||
-- 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.
|
||||
|
||||
SELECT current_setting('server_version_num')::int < 160000 AS has_multinode_support
|
||||
\gset
|
||||
|
||||
\if :has_multinode_support
|
||||
DROP TABLE disthyper;
|
||||
SELECT delete_data_node('dn1');
|
||||
drop database if exists dn1 with (force);
|
||||
\endif
|
@ -2,11 +2,5 @@
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
|
||||
SELECT current_setting('server_version_num')::int < 160000 AS has_multinode_support
|
||||
\gset
|
||||
|
||||
\ir cleanup.v6.sql
|
||||
|
||||
\if :has_multinode_support
|
||||
\ir cleanup.multinode.sql
|
||||
\endif
|
||||
|
@ -2,26 +2,8 @@
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
|
||||
SELECT current_setting('server_version_num')::int < 160000 AS has_multinode_support
|
||||
\gset
|
||||
|
||||
CREATE DATABASE single;
|
||||
|
||||
\if :has_multinode_support
|
||||
-- Always pre-create the data node database 'dn1' so that we can dump
|
||||
-- and restore it even on TimescaleDB versions that don't support
|
||||
-- multinode. Otherwise, we'd have to create version-dependent scripts
|
||||
-- to specifically handle multinode tests. We use template0, or
|
||||
-- otherwise dn1 will have the same UUID as 'single' since template1
|
||||
-- has the extension pre-installed.
|
||||
CREATE DATABASE dn1 TEMPLATE template0;
|
||||
\c dn1
|
||||
-- Make sure the extension is installed so that extension versions
|
||||
-- that don't support multinode will still be able to update the
|
||||
-- extension with ALTER EXTENSION ... UPDATE.
|
||||
CREATE EXTENSION IF NOT EXISTS timescaledb;
|
||||
\endif
|
||||
|
||||
\c single
|
||||
CREATE EXTENSION IF NOT EXISTS timescaledb;
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
-- 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
|
||||
$$;
|
@ -2,11 +2,5 @@
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
|
||||
SELECT current_setting('server_version_num')::int < 160000 AS has_multinode_support
|
||||
\gset
|
||||
|
||||
\ir setup.v6.sql
|
||||
|
||||
\if :has_multinode_support
|
||||
\ir setup.multinode.sql
|
||||
\endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user