mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-03 18:45:35 +00:00
* test(flow): wait for async source-table mirrors before FLUSH_FLOW Streaming flows execute inline in the flownode insert handler since #8976, and source-table inserts are mirrored from the frontend as detached tasks. Tests that INSERT then ADMIN FLUSH_FLOW then SELECT intermittently miss rows on slow CI runners because the flush no longer implies the mirror reached the flownode (flow_no_aggr lost row 'l', flow_advance_ttl lost row '23' after the post-restart reinsert). Add SQLNESS SLEEP 3s between those mirror inserts and the flush, the established pattern in the flow suite, so the assertions are stable. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> * test(flow): also guard first-section flushes in flow_advance_ttl Local reproduction without sleeps failed in a window the previous commit did not cover: the first INSERT (20,20,22) of each section is followed immediately by ADMIN FLUSH_FLOW, and the distributed run observed an empty sink on that SELECT (~1 in 8 iterations). Add the same SLEEP 3s guard before those two flushes. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com> --------- Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
69 lines
1.6 KiB
SQL
69 lines
1.6 KiB
SQL
CREATE TABLE base (
|
|
desc_str STRING,
|
|
ts TIMESTAMP TIME INDEX
|
|
);
|
|
|
|
CREATE TABLE sink (
|
|
desc_str STRING,
|
|
ts TIMESTAMP TIME INDEX
|
|
);
|
|
|
|
CREATE FLOW filter_out
|
|
SINK TO sink
|
|
AS
|
|
SELECT desc_str, ts FROM base
|
|
WHERE desc_str IN ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j');
|
|
|
|
SELECT options FROM INFORMATION_SCHEMA.FLOWS WHERE flow_name = 'filter_out';
|
|
|
|
INSERT INTO base VALUES
|
|
('a', '2023-01-01 00:00:00'),
|
|
('j', '2023-01-01 00:00:09'),
|
|
('l', '2023-01-01 00:00:08');
|
|
|
|
-- Mirror inserts reach the flownode asynchronously; wait before flushing.
|
|
-- SQLNESS SLEEP 3s
|
|
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
|
ADMIN FLUSH_FLOW('filter_out');
|
|
|
|
SELECT * FROM sink ORDER BY ts;
|
|
|
|
DROP FLOW filter_out;
|
|
DROP TABLE base;
|
|
DROP TABLE sink;
|
|
|
|
CREATE TABLE base (
|
|
desc_str STRING,
|
|
ts TIMESTAMP TIME INDEX
|
|
);
|
|
|
|
CREATE TABLE sink (
|
|
desc_str STRING,
|
|
ts TIMESTAMP TIME INDEX
|
|
);
|
|
|
|
CREATE FLOW filter_out
|
|
SINK TO sink
|
|
AS
|
|
SELECT desc_str, ts FROM base
|
|
WHERE desc_str NOT IN ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j');
|
|
|
|
SELECT options FROM INFORMATION_SCHEMA.FLOWS WHERE flow_name = 'filter_out';
|
|
|
|
INSERT INTO base VALUES
|
|
('a', '2023-01-01 00:00:00'),
|
|
('j', '2023-01-01 00:00:09'),
|
|
('l', '2023-01-01 00:00:08');
|
|
|
|
-- Mirror inserts reach the flownode asynchronously; wait before flushing.
|
|
-- SQLNESS SLEEP 3s
|
|
-- SQLNESS REPLACE (ADMIN\sFLUSH_FLOW\('\w+'\)\s+\|\n\+-+\+\n\|\s+)[0-9]+\s+\| $1 FLOW_FLUSHED |
|
|
ADMIN FLUSH_FLOW('filter_out');
|
|
|
|
SELECT * FROM sink ORDER BY ts;
|
|
|
|
DROP FLOW filter_out;
|
|
DROP TABLE base;
|
|
DROP TABLE sink;
|
|
|