Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky append regression test #7512

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
647 changes: 333 additions & 314 deletions test/expected/append-14.out

Large diffs are not rendered by default.

649 changes: 334 additions & 315 deletions test/expected/append-15.out

Large diffs are not rendered by default.

649 changes: 334 additions & 315 deletions test/expected/append-16.out

Large diffs are not rendered by default.

649 changes: 334 additions & 315 deletions test/expected/append-17.out

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions test/sql/include/append_load.sql
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ INSERT INTO append_test VALUES ('2017-03-22T09:18:22', 23.5, 1, '{"a": 1, "b": 2
('2017-05-22T09:18:22', 36.2, 2, '{"c": 3, "b": 2}'),
('2017-05-22T09:18:23', 15.2, 2, '{"c": 3}'),
('2017-08-22T09:18:22', 34.1, 3, '{"c": 4}');
VACUUM (ANALYZE) append_test;

-- Create another hypertable to join with
CREATE TABLE join_test(time timestamptz, temp float, colorid integer);
Expand All @@ -48,25 +49,27 @@ SELECT create_hypertable('join_test', 'time', chunk_time_interval => 26280000000
INSERT INTO join_test VALUES ('2017-01-22T09:18:22', 15.2, 1),
('2017-02-22T09:18:22', 24.5, 2),
('2017-08-22T09:18:22', 23.1, 3);
VACUUM (ANALYZE) join_test;

-- Create another table to join with which is not a hypertable.
CREATE TABLE join_test_plain(time timestamptz, temp float, colorid integer, attr jsonb);

INSERT INTO join_test_plain VALUES ('2017-01-22T09:18:22', 15.2, 1, '{"a": 1}'),
('2017-02-22T09:18:22', 24.5, 2, '{"b": 2}'),
('2017-08-22T09:18:22', 23.1, 3, '{"c": 3}');
VACUUM (ANALYZE) join_test_plain;

-- create hypertable with DATE time dimension
CREATE TABLE metrics_date(time DATE NOT NULL);
SELECT create_hypertable('metrics_date','time');
INSERT INTO metrics_date SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval);
ANALYZE metrics_date;
VACUUM (ANALYZE) metrics_date;

-- create hypertable with TIMESTAMP time dimension
CREATE TABLE metrics_timestamp(time TIMESTAMP NOT NULL);
SELECT create_hypertable('metrics_timestamp','time');
INSERT INTO metrics_timestamp SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval);
ANALYZE metrics_timestamp;
VACUUM (ANALYZE) metrics_timestamp;

-- create hypertable with TIMESTAMPTZ time dimension
CREATE TABLE metrics_timestamptz(time TIMESTAMPTZ NOT NULL, device_id INT NOT NULL);
Expand All @@ -75,7 +78,7 @@ SELECT create_hypertable('metrics_timestamptz','time');
INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 1;
INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 2;
INSERT INTO metrics_timestamptz SELECT generate_series('2000-01-01'::date, '2000-02-01'::date, '5m'::interval), 3;
ANALYZE metrics_timestamptz;
VACUUM (ANALYZE) metrics_timestamptz;

-- create space partitioned hypertable
CREATE TABLE metrics_space(time timestamptz NOT NULL, device_id int NOT NULL, v1 float, v2 float, v3 text);
Expand All @@ -87,7 +90,7 @@ FROM generate_series('2000-01-01'::timestamptz, '2000-01-14'::timestamptz, '5m':
generate_series(1,10,1) g2(device_id)
ORDER BY time, device_id;

ANALYZE metrics_space;
VACUUM (ANALYZE) metrics_space;

-- test ChunkAppend projection #2661
CREATE TABLE i2661 (
Expand All @@ -99,5 +102,4 @@ CREATE TABLE i2661 (
SELECT create_hypertable('i2661', 'timestamp');

INSERT INTO i2661 SELECT 1, 'speed', generate_series('2019-12-31 00:00:00', '2020-01-10 00:00:00', '2m'::interval), 0;
ANALYZE i2661;

VACUUM (ANALYZE) i2661;
3 changes: 2 additions & 1 deletion test/sql/include/append_query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ SELECT time, device_id
FROM generate_series('2000-01-01'::timestamptz,'2000-01-21','30m') g1(time),
generate_series(1,10,1) g2(device_id)
ORDER BY time, device_id;
VACUUM (ANALYZE) join_limit;

-- get 2nd chunk oid
SELECT tableoid AS "CHUNK_OID" FROM join_limit WHERE time > '2000-01-07' ORDER BY time LIMIT 1
Expand Down Expand Up @@ -353,7 +354,7 @@ CREATE TABLE i3030(time timestamptz NOT NULL, a int, b int);
SELECT table_name FROM create_hypertable('i3030', 'time', create_default_indexes=>false);
CREATE INDEX ON i3030(a,time);
INSERT INTO i3030 (time,a) SELECT time, a FROM generate_series('2000-01-01'::timestamptz,'2000-01-01 3:00:00'::timestamptz,'1min'::interval) time, generate_series(1,30) a;
ANALYZE i3030;
VACUUM (ANALYZE) i3030;

:PREFIX SELECT * FROM i3030 where time BETWEEN '2000-01-01'::text::timestamptz AND '2000-01-03'::text::timestamptz ORDER BY a,time LIMIT 1;
DROP TABLE i3030;
Expand Down
Loading