mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-16 18:43:18 +08:00
Merged in olof_rensfelt/backend-database/ore/remove_clustering (pull request #87)
Make all tests use create_single_db.sql Approved-by: ci-vast Approved-by: RobAtticus NA Approved-by: enordstr NA
This commit is contained in:
commit
5e44e996f4
@ -2,37 +2,18 @@
|
||||
\o /dev/null
|
||||
\ir include/insert_two_partitions.sql
|
||||
\set ON_ERROR_STOP 1
|
||||
\ir create_clustered_db.sql
|
||||
\ir create_single_db.sql
|
||||
SET client_min_messages = WARNING;
|
||||
DROP DATABASE IF EXISTS meta;
|
||||
DROP DATABASE IF EXISTS "Test1";
|
||||
DROP DATABASE IF EXISTS test2;
|
||||
DROP DATABASE IF EXISTS single;
|
||||
SET client_min_messages = NOTICE;
|
||||
CREATE DATABASE meta;
|
||||
CREATE DATABASE "Test1";
|
||||
CREATE DATABASE test2;
|
||||
\c meta
|
||||
CREATE DATABASE single;
|
||||
\c single
|
||||
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
|
||||
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "dblink"
|
||||
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "postgres_fdw"
|
||||
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "hstore"
|
||||
select set_meta('localhost');
|
||||
\c Test1
|
||||
CREATE SCHEMA io_test;
|
||||
CREATE EXTENSION IF NOT EXISTS iobeamdb SCHEMA io_test CASCADE;
|
||||
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "dblink"
|
||||
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "postgres_fdw"
|
||||
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "hstore"
|
||||
ALTER DATABASE "Test1" SET search_path = "io_test";
|
||||
SET search_path = 'io_test';
|
||||
select join_cluster(meta_database => 'meta', meta_hostname => 'localhost', node_hostname => 'localhost');
|
||||
\c test2
|
||||
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
|
||||
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "dblink"
|
||||
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "postgres_fdw"
|
||||
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "hstore"
|
||||
select join_cluster(meta_database => 'meta', meta_hostname => 'localhost', node_hostname => 'localhost');
|
||||
\c Test1
|
||||
psql:include/create_single_db.sql:7: NOTICE: installing required extension "dblink"
|
||||
psql:include/create_single_db.sql:7: NOTICE: installing required extension "postgres_fdw"
|
||||
psql:include/create_single_db.sql:7: NOTICE: installing required extension "hstore"
|
||||
SELECT setup_single_node(hostname => 'fakehost'); -- fakehost makes sure there is no network connection
|
||||
\c single
|
||||
CREATE TABLE PUBLIC."testNs" (
|
||||
"timeCustom" BIGINT NOT NULL,
|
||||
device_id TEXT NOT NULL,
|
||||
@ -47,23 +28,19 @@ CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_1) WHERE
|
||||
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL;
|
||||
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL;
|
||||
SELECT * FROM create_hypertable('"public"."testNs"'::regclass, 'timeCustom'::name, 'device_id'::name, associated_schema_name=>'_iobeamdb_internal'::text, number_partitions => 2::smallint );
|
||||
\c Test1
|
||||
BEGIN;
|
||||
\COPY public."testNs" FROM 'data/ds1_dev1_1.tsv' NULL AS '';
|
||||
COMMIT;
|
||||
SELECT _iobeamdb_meta_api.close_chunk_end_immediate(c.id)
|
||||
FROM get_open_partition_for_key((SELECT id FROM _iobeamdb_catalog.hypertable WHERE table_name = 'testNs'), 'dev1') part
|
||||
INNER JOIN _iobeamdb_catalog.chunk c ON (c.partition_id = part.id);
|
||||
\c Test1
|
||||
INSERT INTO public."testNs"("timeCustom", device_id, series_0, series_1) VALUES
|
||||
(1257987600000000000, 'dev1', 1.5, 1),
|
||||
(1257987600000000000, 'dev1', 1.5, 2),
|
||||
(1257894000000000000, 'dev20', 1.5, 1),
|
||||
(1257894002000000000, 'dev1', 2.5, 3);
|
||||
\c test2
|
||||
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
|
||||
(1257894000000000000, 'dev20', 1.5, 2);
|
||||
\c test2
|
||||
CREATE TABLE chunk_closing_test(
|
||||
time BIGINT,
|
||||
metric INTEGER,
|
||||
|
@ -2,52 +2,23 @@
|
||||
\set ECHO ALL
|
||||
\ir include/insert_two_partitions.sql
|
||||
\set ON_ERROR_STOP 1
|
||||
\ir create_clustered_db.sql
|
||||
\ir create_single_db.sql
|
||||
SET client_min_messages = WARNING;
|
||||
DROP DATABASE IF EXISTS meta;
|
||||
DROP DATABASE IF EXISTS "Test1";
|
||||
DROP DATABASE IF EXISTS test2;
|
||||
DROP DATABASE IF EXISTS single;
|
||||
SET client_min_messages = NOTICE;
|
||||
CREATE DATABASE meta;
|
||||
CREATE DATABASE "Test1";
|
||||
CREATE DATABASE test2;
|
||||
\c meta
|
||||
CREATE DATABASE single;
|
||||
\c single
|
||||
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
|
||||
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "dblink"
|
||||
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "postgres_fdw"
|
||||
psql:include/create_clustered_db.sql:12: NOTICE: installing required extension "hstore"
|
||||
select set_meta('localhost');
|
||||
set_meta
|
||||
----------
|
||||
psql:include/create_single_db.sql:7: NOTICE: installing required extension "dblink"
|
||||
psql:include/create_single_db.sql:7: NOTICE: installing required extension "postgres_fdw"
|
||||
psql:include/create_single_db.sql:7: NOTICE: installing required extension "hstore"
|
||||
SELECT setup_single_node(hostname => 'fakehost'); -- fakehost makes sure there is no network connection
|
||||
setup_single_node
|
||||
-------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
\c Test1
|
||||
CREATE SCHEMA io_test;
|
||||
CREATE EXTENSION IF NOT EXISTS iobeamdb SCHEMA io_test CASCADE;
|
||||
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "dblink"
|
||||
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "postgres_fdw"
|
||||
psql:include/create_clustered_db.sql:17: NOTICE: installing required extension "hstore"
|
||||
ALTER DATABASE "Test1" SET search_path = "io_test";
|
||||
SET search_path = 'io_test';
|
||||
select join_cluster(meta_database => 'meta', meta_hostname => 'localhost', node_hostname => 'localhost');
|
||||
join_cluster
|
||||
--------------
|
||||
|
||||
(1 row)
|
||||
|
||||
\c test2
|
||||
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
|
||||
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "dblink"
|
||||
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "postgres_fdw"
|
||||
psql:include/create_clustered_db.sql:23: NOTICE: installing required extension "hstore"
|
||||
select join_cluster(meta_database => 'meta', meta_hostname => 'localhost', node_hostname => 'localhost');
|
||||
join_cluster
|
||||
--------------
|
||||
|
||||
(1 row)
|
||||
|
||||
\c Test1
|
||||
\c single
|
||||
CREATE TABLE PUBLIC."testNs" (
|
||||
"timeCustom" BIGINT NOT NULL,
|
||||
device_id TEXT NOT NULL,
|
||||
@ -67,7 +38,6 @@ SELECT * FROM create_hypertable('"public"."testNs"'::regclass, 'timeCustom'::nam
|
||||
|
||||
(1 row)
|
||||
|
||||
\c Test1
|
||||
BEGIN;
|
||||
\COPY public."testNs" FROM 'data/ds1_dev1_1.tsv' NULL AS '';
|
||||
COMMIT;
|
||||
@ -79,16 +49,13 @@ INNER JOIN _iobeamdb_catalog.chunk c ON (c.partition_id = part.id);
|
||||
|
||||
(1 row)
|
||||
|
||||
\c Test1
|
||||
INSERT INTO public."testNs"("timeCustom", device_id, series_0, series_1) VALUES
|
||||
(1257987600000000000, 'dev1', 1.5, 1),
|
||||
(1257987600000000000, 'dev1', 1.5, 2),
|
||||
(1257894000000000000, 'dev20', 1.5, 1),
|
||||
(1257894002000000000, 'dev1', 2.5, 3);
|
||||
\c test2
|
||||
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
|
||||
(1257894000000000000, 'dev20', 1.5, 2);
|
||||
\c test2
|
||||
CREATE TABLE chunk_closing_test(
|
||||
time BIGINT,
|
||||
metric INTEGER,
|
||||
@ -119,9 +86,9 @@ SELECT * FROM _iobeamdb_catalog.chunk c
|
||||
WHERE h.schema_name = 'public' AND h.table_name = 'chunk_closing_test';
|
||||
id | partition_id | start_time | end_time | chunk_id | partition_replica_id | database_name | schema_name | table_name | id | partition_id | hypertable_id | replica_id | schema_name | table_name | id | schema_name | table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | replication_factor | placement | time_column_name | time_column_type | created_on | chunk_size_bytes
|
||||
----+--------------+------------+----------+----------+----------------------+---------------+--------------------+---------------------+----+--------------+---------------+------------+--------------------+------------------------+----+-------------+--------------------+------------------------+-------------------------+--------------------+-----------------+--------------------+-----------+------------------+------------------+------------+------------------
|
||||
4 | 3 | | 1 | 4 | 3 | test2 | _iobeamdb_internal | _hyper_2_3_0_4_data | 3 | 3 | 2 | 0 | _iobeamdb_internal | _hyper_2_3_0_partition | 2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | 1 | STICKY | time | bigint | test2 | 10000
|
||||
5 | 3 | 2 | 2 | 5 | 3 | test2 | _iobeamdb_internal | _hyper_2_3_0_5_data | 3 | 3 | 2 | 0 | _iobeamdb_internal | _hyper_2_3_0_partition | 2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | 1 | STICKY | time | bigint | test2 | 10000
|
||||
6 | 3 | 3 | | 6 | 3 | test2 | _iobeamdb_internal | _hyper_2_3_0_6_data | 3 | 3 | 2 | 0 | _iobeamdb_internal | _hyper_2_3_0_partition | 2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | 1 | STICKY | time | bigint | test2 | 10000
|
||||
4 | 3 | | 1 | 4 | 3 | single | _iobeamdb_internal | _hyper_2_3_0_4_data | 3 | 3 | 2 | 0 | _iobeamdb_internal | _hyper_2_3_0_partition | 2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | 1 | STICKY | time | bigint | single | 10000
|
||||
5 | 3 | 2 | 2 | 5 | 3 | single | _iobeamdb_internal | _hyper_2_3_0_5_data | 3 | 3 | 2 | 0 | _iobeamdb_internal | _hyper_2_3_0_partition | 2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | 1 | STICKY | time | bigint | single | 10000
|
||||
6 | 3 | 3 | | 6 | 3 | single | _iobeamdb_internal | _hyper_2_3_0_6_data | 3 | 3 | 2 | 0 | _iobeamdb_internal | _hyper_2_3_0_partition | 2 | public | chunk_closing_test | _iobeamdb_internal | _hyper_2 | _iobeamdb_internal | _hyper_2_root | 1 | STICKY | time | bigint | single | 10000
|
||||
(3 rows)
|
||||
|
||||
\d+ "_iobeamdb_internal".*
|
||||
@ -139,6 +106,41 @@ Index "_iobeamdb_internal.10-testNs_timeCustom_series_bool_idx"
|
||||
series_bool | boolean | series_bool | plain
|
||||
btree, for table "_iobeamdb_internal._hyper_1_1_0_2_data", predicate (series_bool IS NOT NULL)
|
||||
|
||||
Index "_iobeamdb_internal.11-testNs_device_id_timeCustom_idx"
|
||||
Column | Type | Definition | Storage
|
||||
------------+--------+--------------+----------
|
||||
device_id | text | device_id | extended
|
||||
timeCustom | bigint | "timeCustom" | plain
|
||||
btree, for table "_iobeamdb_internal._hyper_1_2_0_3_data", predicate (device_id IS NOT NULL)
|
||||
|
||||
Index "_iobeamdb_internal.12-testNs_timeCustom_series_0_idx"
|
||||
Column | Type | Definition | Storage
|
||||
------------+------------------+--------------+---------
|
||||
timeCustom | bigint | "timeCustom" | plain
|
||||
series_0 | double precision | series_0 | plain
|
||||
btree, for table "_iobeamdb_internal._hyper_1_2_0_3_data", predicate (series_0 IS NOT NULL)
|
||||
|
||||
Index "_iobeamdb_internal.13-testNs_timeCustom_series_1_idx"
|
||||
Column | Type | Definition | Storage
|
||||
------------+------------------+--------------+---------
|
||||
timeCustom | bigint | "timeCustom" | plain
|
||||
series_1 | double precision | series_1 | plain
|
||||
btree, for table "_iobeamdb_internal._hyper_1_2_0_3_data", predicate (series_1 IS NOT NULL)
|
||||
|
||||
Index "_iobeamdb_internal.14-testNs_timeCustom_series_2_idx"
|
||||
Column | Type | Definition | Storage
|
||||
------------+------------------+--------------+---------
|
||||
timeCustom | bigint | "timeCustom" | plain
|
||||
series_2 | double precision | series_2 | plain
|
||||
btree, for table "_iobeamdb_internal._hyper_1_2_0_3_data", predicate (series_2 IS NOT NULL)
|
||||
|
||||
Index "_iobeamdb_internal.15-testNs_timeCustom_series_bool_idx"
|
||||
Column | Type | Definition | Storage
|
||||
-------------+---------+--------------+---------
|
||||
timeCustom | bigint | "timeCustom" | plain
|
||||
series_bool | boolean | series_bool | plain
|
||||
btree, for table "_iobeamdb_internal._hyper_1_2_0_3_data", predicate (series_bool IS NOT NULL)
|
||||
|
||||
Index "_iobeamdb_internal.2-testNs_timeCustom_series_0_idx"
|
||||
Column | Type | Definition | Storage
|
||||
------------+------------------+--------------+---------
|
||||
@ -263,19 +265,23 @@ Inherits: _iobeamdb_internal._hyper_1_0_replica
|
||||
Child tables: _iobeamdb_internal._hyper_1_1_0_1_data,
|
||||
_iobeamdb_internal._hyper_1_1_0_2_data
|
||||
|
||||
Foreign table "_iobeamdb_internal._hyper_1_2_0_3_data"
|
||||
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
|
||||
-------------+------------------+-----------+-------------+----------+--------------+-------------
|
||||
timeCustom | bigint | not null | | plain | |
|
||||
device_id | text | not null | | extended | |
|
||||
series_0 | double precision | | | plain | |
|
||||
series_1 | double precision | | | plain | |
|
||||
series_2 | double precision | | | plain | |
|
||||
series_bool | boolean | | | plain | |
|
||||
Table "_iobeamdb_internal._hyper_1_2_0_3_data"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
-------------+------------------+-----------+----------+--------------+-------------
|
||||
timeCustom | bigint | not null | plain | |
|
||||
device_id | text | not null | extended | |
|
||||
series_0 | double precision | | plain | |
|
||||
series_1 | double precision | | plain | |
|
||||
series_2 | double precision | | plain | |
|
||||
series_bool | boolean | | plain | |
|
||||
Indexes:
|
||||
"11-testNs_device_id_timeCustom_idx" btree (device_id, "timeCustom" DESC NULLS LAST) WHERE device_id IS NOT NULL
|
||||
"12-testNs_timeCustom_series_0_idx" btree ("timeCustom" DESC NULLS LAST, series_0) WHERE series_0 IS NOT NULL
|
||||
"13-testNs_timeCustom_series_1_idx" btree ("timeCustom" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL
|
||||
"14-testNs_timeCustom_series_2_idx" btree ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
|
||||
"15-testNs_timeCustom_series_bool_idx" btree ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
|
||||
Check constraints:
|
||||
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
|
||||
Server: Test1
|
||||
FDW Options: (schema_name '_iobeamdb_internal', table_name '_hyper_1_2_0_3_data')
|
||||
Inherits: _iobeamdb_internal._hyper_1_2_0_partition
|
||||
|
||||
Table "_iobeamdb_internal._hyper_1_2_0_partition"
|
||||
@ -301,7 +307,8 @@ Child tables: _iobeamdb_internal._hyper_1_2_0_3_data
|
||||
series_1 | double precision | | plain | |
|
||||
series_2 | double precision | | plain | |
|
||||
series_bool | boolean | | plain | |
|
||||
Child tables: _iobeamdb_internal._hyper_1_0_replica
|
||||
Child tables: _copy_temp_1,
|
||||
_iobeamdb_internal._hyper_1_0_replica
|
||||
|
||||
Table "_iobeamdb_internal._hyper_2_0_replica"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
@ -310,8 +317,7 @@ Child tables: _iobeamdb_internal._hyper_1_0_replica
|
||||
metric | integer | | plain | |
|
||||
device_id | text | | extended | |
|
||||
Inherits: _iobeamdb_internal._hyper_2_root
|
||||
Child tables: _iobeamdb_internal._hyper_2_3_0_partition,
|
||||
_iobeamdb_internal._hyper_2_4_0_partition
|
||||
Child tables: _iobeamdb_internal._hyper_2_3_0_partition
|
||||
|
||||
Table "_iobeamdb_internal._hyper_2_3_0_4_data"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
@ -320,7 +326,7 @@ Child tables: _iobeamdb_internal._hyper_2_3_0_partition,
|
||||
metric | integer | | plain | |
|
||||
device_id | text | | extended | |
|
||||
Check constraints:
|
||||
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
|
||||
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
|
||||
"time_range" CHECK ("time" <= '1'::bigint) NOT VALID
|
||||
Inherits: _iobeamdb_internal._hyper_2_3_0_partition
|
||||
|
||||
@ -331,7 +337,7 @@ Inherits: _iobeamdb_internal._hyper_2_3_0_partition
|
||||
metric | integer | | plain | |
|
||||
device_id | text | | extended | |
|
||||
Check constraints:
|
||||
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
|
||||
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
|
||||
"time_range" CHECK ("time" >= '2'::bigint AND "time" <= '2'::bigint) NOT VALID
|
||||
Inherits: _iobeamdb_internal._hyper_2_3_0_partition
|
||||
|
||||
@ -342,7 +348,7 @@ Inherits: _iobeamdb_internal._hyper_2_3_0_partition
|
||||
metric | integer | | plain | |
|
||||
device_id | text | | extended | |
|
||||
Check constraints:
|
||||
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
|
||||
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
|
||||
"time_range" CHECK ("time" >= '3'::bigint) NOT VALID
|
||||
Inherits: _iobeamdb_internal._hyper_2_3_0_partition
|
||||
|
||||
@ -353,22 +359,12 @@ Inherits: _iobeamdb_internal._hyper_2_3_0_partition
|
||||
metric | integer | | plain | |
|
||||
device_id | text | | extended | |
|
||||
Check constraints:
|
||||
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '16383'::smallint)
|
||||
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '0'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
|
||||
Inherits: _iobeamdb_internal._hyper_2_0_replica
|
||||
Child tables: _iobeamdb_internal._hyper_2_3_0_4_data,
|
||||
_iobeamdb_internal._hyper_2_3_0_5_data,
|
||||
_iobeamdb_internal._hyper_2_3_0_6_data
|
||||
|
||||
Table "_iobeamdb_internal._hyper_2_4_0_partition"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
-----------+---------+-----------+----------+--------------+-------------
|
||||
time | bigint | | plain | |
|
||||
metric | integer | | plain | |
|
||||
device_id | text | | extended | |
|
||||
Check constraints:
|
||||
"partition" CHECK (_iobeamdb_catalog.get_partition_for_key(device_id, 32768) >= '16384'::smallint AND _iobeamdb_catalog.get_partition_for_key(device_id, 32768) <= '32767'::smallint)
|
||||
Inherits: _iobeamdb_internal._hyper_2_0_replica
|
||||
|
||||
Table "_iobeamdb_internal._hyper_2_root"
|
||||
Column | Type | Modifiers | Storage | Stats target | Description
|
||||
-----------+---------+-----------+----------+--------------+-------------
|
||||
@ -408,12 +404,12 @@ SELECT * FROM _iobeamdb_catalog.chunk;
|
||||
SELECT * FROM _iobeamdb_catalog.chunk_replica_node;
|
||||
chunk_id | partition_replica_id | database_name | schema_name | table_name
|
||||
----------+----------------------+---------------+--------------------+---------------------
|
||||
1 | 1 | test2 | _iobeamdb_internal | _hyper_1_1_0_1_data
|
||||
2 | 1 | test2 | _iobeamdb_internal | _hyper_1_1_0_2_data
|
||||
3 | 2 | Test1 | _iobeamdb_internal | _hyper_1_2_0_3_data
|
||||
4 | 3 | test2 | _iobeamdb_internal | _hyper_2_3_0_4_data
|
||||
5 | 3 | test2 | _iobeamdb_internal | _hyper_2_3_0_5_data
|
||||
6 | 3 | test2 | _iobeamdb_internal | _hyper_2_3_0_6_data
|
||||
1 | 1 | single | _iobeamdb_internal | _hyper_1_1_0_1_data
|
||||
2 | 1 | single | _iobeamdb_internal | _hyper_1_1_0_2_data
|
||||
3 | 2 | single | _iobeamdb_internal | _hyper_1_2_0_3_data
|
||||
4 | 3 | single | _iobeamdb_internal | _hyper_2_3_0_4_data
|
||||
5 | 3 | single | _iobeamdb_internal | _hyper_2_3_0_5_data
|
||||
6 | 3 | single | _iobeamdb_internal | _hyper_2_3_0_6_data
|
||||
(6 rows)
|
||||
|
||||
SELECT * FROM _iobeamdb_catalog.partition_replica;
|
||||
@ -422,8 +418,7 @@ SELECT * FROM _iobeamdb_catalog.partition_replica;
|
||||
1 | 1 | 1 | 0 | _iobeamdb_internal | _hyper_1_1_0_partition
|
||||
2 | 2 | 1 | 0 | _iobeamdb_internal | _hyper_1_2_0_partition
|
||||
3 | 3 | 2 | 0 | _iobeamdb_internal | _hyper_2_3_0_partition
|
||||
4 | 4 | 2 | 0 | _iobeamdb_internal | _hyper_2_4_0_partition
|
||||
(4 rows)
|
||||
(3 rows)
|
||||
|
||||
SELECT * FROM chunk_closing_test;
|
||||
time | metric | device_id
|
||||
|
@ -4,46 +4,21 @@
|
||||
\o /dev/null
|
||||
\ir include/insert_two_partitions.sql
|
||||
\set ON_ERROR_STOP 1
|
||||
\ir create_clustered_db.sql
|
||||
\ir create_single_db.sql
|
||||
SET client_min_messages = WARNING;
|
||||
DROP DATABASE IF EXISTS meta;
|
||||
DROP DATABASE IF EXISTS "Test1";
|
||||
DROP DATABASE IF EXISTS test2;
|
||||
DROP DATABASE IF EXISTS single;
|
||||
SET client_min_messages = NOTICE;
|
||||
CREATE DATABASE meta;
|
||||
CREATE DATABASE "Test1";
|
||||
CREATE DATABASE test2;
|
||||
\c meta
|
||||
CREATE DATABASE single;
|
||||
\c single
|
||||
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
|
||||
psql:include/create_clustered_db.sql:12: NOTICE: 00000: installing required extension "dblink"
|
||||
psql:include/create_single_db.sql:7: NOTICE: 00000: installing required extension "dblink"
|
||||
LOCATION: CreateExtensionInternal, extension.c:1441
|
||||
psql:include/create_clustered_db.sql:12: NOTICE: 00000: installing required extension "postgres_fdw"
|
||||
psql:include/create_single_db.sql:7: NOTICE: 00000: installing required extension "postgres_fdw"
|
||||
LOCATION: CreateExtensionInternal, extension.c:1441
|
||||
psql:include/create_clustered_db.sql:12: NOTICE: 00000: installing required extension "hstore"
|
||||
psql:include/create_single_db.sql:7: NOTICE: 00000: installing required extension "hstore"
|
||||
LOCATION: CreateExtensionInternal, extension.c:1441
|
||||
select set_meta('localhost');
|
||||
\c Test1
|
||||
CREATE SCHEMA io_test;
|
||||
CREATE EXTENSION IF NOT EXISTS iobeamdb SCHEMA io_test CASCADE;
|
||||
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "dblink"
|
||||
LOCATION: CreateExtensionInternal, extension.c:1441
|
||||
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "postgres_fdw"
|
||||
LOCATION: CreateExtensionInternal, extension.c:1441
|
||||
psql:include/create_clustered_db.sql:17: NOTICE: 00000: installing required extension "hstore"
|
||||
LOCATION: CreateExtensionInternal, extension.c:1441
|
||||
ALTER DATABASE "Test1" SET search_path = "io_test";
|
||||
SET search_path = 'io_test';
|
||||
select join_cluster(meta_database => 'meta', meta_hostname => 'localhost', node_hostname => 'localhost');
|
||||
\c test2
|
||||
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
|
||||
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "dblink"
|
||||
LOCATION: CreateExtensionInternal, extension.c:1441
|
||||
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "postgres_fdw"
|
||||
LOCATION: CreateExtensionInternal, extension.c:1441
|
||||
psql:include/create_clustered_db.sql:23: NOTICE: 00000: installing required extension "hstore"
|
||||
LOCATION: CreateExtensionInternal, extension.c:1441
|
||||
select join_cluster(meta_database => 'meta', meta_hostname => 'localhost', node_hostname => 'localhost');
|
||||
\c Test1
|
||||
SELECT setup_single_node(hostname => 'fakehost'); -- fakehost makes sure there is no network connection
|
||||
\c single
|
||||
CREATE TABLE PUBLIC."testNs" (
|
||||
"timeCustom" BIGINT NOT NULL,
|
||||
device_id TEXT NOT NULL,
|
||||
@ -58,23 +33,19 @@ CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_1) WHERE
|
||||
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL;
|
||||
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL;
|
||||
SELECT * FROM create_hypertable('"public"."testNs"'::regclass, 'timeCustom'::name, 'device_id'::name, associated_schema_name=>'_iobeamdb_internal'::text, number_partitions => 2::smallint );
|
||||
\c Test1
|
||||
BEGIN;
|
||||
\COPY public."testNs" FROM 'data/ds1_dev1_1.tsv' NULL AS '';
|
||||
COMMIT;
|
||||
SELECT _iobeamdb_meta_api.close_chunk_end_immediate(c.id)
|
||||
FROM get_open_partition_for_key((SELECT id FROM _iobeamdb_catalog.hypertable WHERE table_name = 'testNs'), 'dev1') part
|
||||
INNER JOIN _iobeamdb_catalog.chunk c ON (c.partition_id = part.id);
|
||||
\c Test1
|
||||
INSERT INTO public."testNs"("timeCustom", device_id, series_0, series_1) VALUES
|
||||
(1257987600000000000, 'dev1', 1.5, 1),
|
||||
(1257987600000000000, 'dev1', 1.5, 2),
|
||||
(1257894000000000000, 'dev20', 1.5, 1),
|
||||
(1257894002000000000, 'dev1', 2.5, 3);
|
||||
\c test2
|
||||
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
|
||||
(1257894000000000000, 'dev20', 1.5, 2);
|
||||
\c test2
|
||||
CREATE TABLE chunk_closing_test(
|
||||
time BIGINT,
|
||||
metric INTEGER,
|
||||
@ -106,11 +77,11 @@ SELECT * FROM "testNs";
|
||||
1257894000000001000 | dev1 | 2.5 | 3 | |
|
||||
1257894001000000000 | dev1 | 3.5 | 4 | |
|
||||
1257897600000000000 | dev1 | 4.5 | 5 | | f
|
||||
1257894000000000000 | dev20 | 1.5 | 1 | |
|
||||
1257894002000000000 | dev1 | 2.5 | 3 | |
|
||||
1257894000000000000 | dev20 | 1.5 | 2 | |
|
||||
1257987600000000000 | dev1 | 1.5 | 1 | |
|
||||
1257987600000000000 | dev1 | 1.5 | 2 | |
|
||||
1257894000000000000 | dev20 | 1.5 | 1 | |
|
||||
1257894000000000000 | dev20 | 1.5 | 2 | |
|
||||
(10 rows)
|
||||
|
||||
--query for the extension tables/sequences that will not be dumped by pg_dump (should be empty)
|
||||
|
@ -89,7 +89,7 @@ FROM PUBLIC."testNs" GROUP BY time ORDER BY time ASC;
|
||||
The rest of the queries will be the same in output between UTC and EST
|
||||
--have to set the timezones on both Test1 and test2. Have to also kill ongoing dblinks as their sessions cache the timezone setting.
|
||||
SET timezone = 'UTC';
|
||||
ALTER DATABASE test2 SET timezone ='UTC';
|
||||
ALTER DATABASE single SET timezone ='UTC';
|
||||
SELECT dblink_disconnect(conn) FROM unnest(dblink_get_connections()) conn;
|
||||
dblink_disconnect
|
||||
-------------------
|
||||
@ -104,7 +104,7 @@ FROM PUBLIC."testNs" GROUP BY time ORDER BY time ASC;
|
||||
(2 rows)
|
||||
|
||||
SET timezone = 'EST';
|
||||
ALTER DATABASE test2 SET timezone ='EST';
|
||||
ALTER DATABASE single SET timezone ='EST';
|
||||
SELECT dblink_disconnect(conn) FROM unnest(dblink_get_connections()) conn;
|
||||
dblink_disconnect
|
||||
-------------------
|
||||
@ -119,7 +119,7 @@ FROM PUBLIC."testNs" GROUP BY time ORDER BY time ASC;
|
||||
(2 rows)
|
||||
|
||||
SET timezone = 'UTC';
|
||||
ALTER DATABASE test2 SET timezone ='UTC';
|
||||
ALTER DATABASE single SET timezone ='UTC';
|
||||
SELECT dblink_disconnect(conn) FROM unnest(dblink_get_connections()) conn;
|
||||
dblink_disconnect
|
||||
-------------------
|
||||
@ -137,7 +137,7 @@ AND "timeCustom" < TIMESTAMP '2009-11-12T01:00:00' ORDER BY "timeCustom" DESC;
|
||||
(3 rows)
|
||||
|
||||
SET timezone = 'EST';
|
||||
ALTER DATABASE test2 SET timezone ='EST';
|
||||
ALTER DATABASE single SET timezone ='EST';
|
||||
SELECT dblink_disconnect(conn) FROM unnest(dblink_get_connections()) conn;
|
||||
dblink_disconnect
|
||||
-------------------
|
||||
@ -155,7 +155,7 @@ AND "timeCustom" < TIMESTAMP '2009-11-12T01:00:00' ORDER BY "timeCustom" DESC;
|
||||
(3 rows)
|
||||
|
||||
SET timezone = 'UTC';
|
||||
ALTER DATABASE test2 SET timezone ='UTC';
|
||||
ALTER DATABASE single SET timezone ='UTC';
|
||||
SELECT dblink_disconnect(conn) FROM unnest(dblink_get_connections()) conn;
|
||||
dblink_disconnect
|
||||
-------------------
|
||||
@ -170,7 +170,7 @@ FROM PUBLIC."testNs" GROUP BY time ORDER BY time ASC LIMIT 2;
|
||||
(2 rows)
|
||||
|
||||
SET timezone = 'EST';
|
||||
ALTER DATABASE test2 SET timezone ='EST';
|
||||
ALTER DATABASE single SET timezone ='EST';
|
||||
SELECT dblink_disconnect(conn) FROM unnest(dblink_get_connections()) conn;
|
||||
dblink_disconnect
|
||||
-------------------
|
||||
@ -189,7 +189,7 @@ FROM PUBLIC."testNs" GROUP BY time ORDER BY time ASC LIMIT 2;
|
||||
------------------------------------
|
||||
\set ON_ERROR_STOP 0
|
||||
SET timezone = 'UTC';
|
||||
ALTER DATABASE test2 SET timezone ='UTC';
|
||||
ALTER DATABASE single SET timezone ='UTC';
|
||||
-- Conversion to timestamp using Postgres built-in function taking double
|
||||
SELECT to_timestamp(1486480176.236538);
|
||||
to_timestamp
|
||||
|
@ -1,24 +0,0 @@
|
||||
SET client_min_messages = WARNING;
|
||||
DROP DATABASE IF EXISTS meta;
|
||||
DROP DATABASE IF EXISTS "Test1";
|
||||
DROP DATABASE IF EXISTS test2;
|
||||
SET client_min_messages = NOTICE;
|
||||
|
||||
CREATE DATABASE meta;
|
||||
CREATE DATABASE "Test1";
|
||||
CREATE DATABASE test2;
|
||||
|
||||
\c meta
|
||||
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
|
||||
select set_meta('localhost');
|
||||
|
||||
\c Test1
|
||||
CREATE SCHEMA io_test;
|
||||
CREATE EXTENSION IF NOT EXISTS iobeamdb SCHEMA io_test CASCADE;
|
||||
ALTER DATABASE "Test1" SET search_path = "io_test";
|
||||
SET search_path = 'io_test';
|
||||
select join_cluster(meta_database => 'meta', meta_hostname => 'localhost', node_hostname => 'localhost');
|
||||
|
||||
\c test2
|
||||
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
|
||||
select join_cluster(meta_database => 'meta', meta_hostname => 'localhost', node_hostname => 'localhost');
|
@ -1,8 +1,8 @@
|
||||
\set ON_ERROR_STOP 1
|
||||
|
||||
\ir create_clustered_db.sql
|
||||
\ir create_single_db.sql
|
||||
|
||||
\c Test1
|
||||
\c single
|
||||
|
||||
CREATE TABLE PUBLIC."testNs" (
|
||||
"timeCustom" BIGINT NOT NULL,
|
||||
@ -20,7 +20,6 @@ CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_bool) WHER
|
||||
|
||||
SELECT * FROM create_hypertable('"public"."testNs"'::regclass, 'timeCustom'::name, 'device_id'::name, associated_schema_name=>'_iobeamdb_internal'::text, number_partitions => 2::smallint );
|
||||
|
||||
\c Test1
|
||||
BEGIN;
|
||||
\COPY public."testNs" FROM 'data/ds1_dev1_1.tsv' NULL AS '';
|
||||
COMMIT;
|
||||
@ -29,19 +28,15 @@ SELECT _iobeamdb_meta_api.close_chunk_end_immediate(c.id)
|
||||
FROM get_open_partition_for_key((SELECT id FROM _iobeamdb_catalog.hypertable WHERE table_name = 'testNs'), 'dev1') part
|
||||
INNER JOIN _iobeamdb_catalog.chunk c ON (c.partition_id = part.id);
|
||||
|
||||
\c Test1
|
||||
INSERT INTO public."testNs"("timeCustom", device_id, series_0, series_1) VALUES
|
||||
(1257987600000000000, 'dev1', 1.5, 1),
|
||||
(1257987600000000000, 'dev1', 1.5, 2),
|
||||
(1257894000000000000, 'dev20', 1.5, 1),
|
||||
(1257894002000000000, 'dev1', 2.5, 3);
|
||||
|
||||
\c test2
|
||||
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
|
||||
(1257894000000000000, 'dev20', 1.5, 2);
|
||||
|
||||
|
||||
\c test2
|
||||
CREATE TABLE chunk_closing_test(
|
||||
time BIGINT,
|
||||
metric INTEGER,
|
||||
|
@ -61,19 +61,19 @@ FROM PUBLIC."testNs" GROUP BY time ORDER BY time ASC;
|
||||
\echo 'The rest of the queries will be the same in output between UTC and EST'
|
||||
--have to set the timezones on both Test1 and test2. Have to also kill ongoing dblinks as their sessions cache the timezone setting.
|
||||
SET timezone = 'UTC';
|
||||
ALTER DATABASE test2 SET timezone ='UTC';
|
||||
ALTER DATABASE single SET timezone ='UTC';
|
||||
SELECT dblink_disconnect(conn) FROM unnest(dblink_get_connections()) conn;
|
||||
SELECT date_group("timeCustom", '1 day') AS time, sum(series_0)
|
||||
FROM PUBLIC."testNs" GROUP BY time ORDER BY time ASC;
|
||||
|
||||
SET timezone = 'EST';
|
||||
ALTER DATABASE test2 SET timezone ='EST';
|
||||
ALTER DATABASE single SET timezone ='EST';
|
||||
SELECT dblink_disconnect(conn) FROM unnest(dblink_get_connections()) conn;
|
||||
SELECT date_group("timeCustom", '1 day') AS time, sum(series_0)
|
||||
FROM PUBLIC."testNs" GROUP BY time ORDER BY time ASC;
|
||||
|
||||
SET timezone = 'UTC';
|
||||
ALTER DATABASE test2 SET timezone ='UTC';
|
||||
ALTER DATABASE single SET timezone ='UTC';
|
||||
SELECT dblink_disconnect(conn) FROM unnest(dblink_get_connections()) conn;
|
||||
|
||||
SELECT *
|
||||
@ -82,7 +82,7 @@ WHERE "timeCustom" >= TIMESTAMP '2009-11-10T23:00:00'
|
||||
AND "timeCustom" < TIMESTAMP '2009-11-12T01:00:00' ORDER BY "timeCustom" DESC;
|
||||
|
||||
SET timezone = 'EST';
|
||||
ALTER DATABASE test2 SET timezone ='EST';
|
||||
ALTER DATABASE single SET timezone ='EST';
|
||||
SELECT dblink_disconnect(conn) FROM unnest(dblink_get_connections()) conn;
|
||||
SELECT *
|
||||
FROM PUBLIC."testNs"
|
||||
@ -90,13 +90,13 @@ WHERE "timeCustom" >= TIMESTAMP '2009-11-10T23:00:00'
|
||||
AND "timeCustom" < TIMESTAMP '2009-11-12T01:00:00' ORDER BY "timeCustom" DESC;
|
||||
|
||||
SET timezone = 'UTC';
|
||||
ALTER DATABASE test2 SET timezone ='UTC';
|
||||
ALTER DATABASE single SET timezone ='UTC';
|
||||
SELECT dblink_disconnect(conn) FROM unnest(dblink_get_connections()) conn;
|
||||
SELECT date_group("timeCustom", '1 day') AS time, sum(series_0)
|
||||
FROM PUBLIC."testNs" GROUP BY time ORDER BY time ASC LIMIT 2;
|
||||
|
||||
SET timezone = 'EST';
|
||||
ALTER DATABASE test2 SET timezone ='EST';
|
||||
ALTER DATABASE single SET timezone ='EST';
|
||||
SELECT dblink_disconnect(conn) FROM unnest(dblink_get_connections()) conn;
|
||||
SELECT date_group("timeCustom", '1 day') AS time, sum(series_0)
|
||||
FROM PUBLIC."testNs" GROUP BY time ORDER BY time ASC LIMIT 2;
|
||||
@ -107,7 +107,7 @@ FROM PUBLIC."testNs" GROUP BY time ORDER BY time ASC LIMIT 2;
|
||||
\set ON_ERROR_STOP 0
|
||||
|
||||
SET timezone = 'UTC';
|
||||
ALTER DATABASE test2 SET timezone ='UTC';
|
||||
ALTER DATABASE single SET timezone ='UTC';
|
||||
|
||||
-- Conversion to timestamp using Postgres built-in function taking double
|
||||
SELECT to_timestamp(1486480176.236538);
|
||||
|
Loading…
x
Reference in New Issue
Block a user