Files
greptimedb/tests/cases/standalone/common/flow/flow_legacy_streaming.sql
discord9 f6c2c72192 feat(flow): remove the streaming executor and the dual-engine router
The legacy per-request Flow runtime is gone, leaving the batching scheduler as
the only execution profile. A flow whose SQL has no time window therefore needs
an explicit `EVAL INTERVAL`; without one it used to run as a request-local
streaming query and is now rejected with that hint.

Persisted flows whose options say `flow_type: streaming` are still listed and
droppable, but creating or recovering one fails with a "drop and recreate"
error, so no old definition can silently run on a scheduler that no longer
exists. `FlowType::Streaming` and `get_flow_type_from_options` stay for
deserializing old metadata and old procedure data, and the reserved `flow_type`
key keeps being written so the metadata shape does not change.

Instant-TTL sources are rejected for every flow: the batching scheduler cannot
read them, and there is no second profile to fall back to.

The full-row mirror RPC is deliberately kept. It is not a streaming leftover:
it is the only path that tells batching that a SQL `INSERT INTO` changed a
source table, since bulk/COPY and the HTTP batcher use the timestamp-only path.
`BatchingEngine::handle_inserts_inner` filters requests per task by source
table name, so forwarding all of them replaces the removed routing table.

Dead code that only the streaming runtime reached is removed as well: the
stateless query and its memtable source, the relation/repr row model, the
single-attempt frontend insert, and the `InsertIntoFlow` error variant. Those
were invisible to the compiler because the crate allows dead code.

Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
2026-11-12 14:42:24 +08:00

45 lines
1.5 KiB
SQL

-- The streaming runtime is gone, so the batching scheduler is the only execution
-- profile left. A flow whose SQL has no time window is exactly the shape the
-- streaming executor used to handle: it is now rejected, and the supported
-- migration is to recreate the flow with an explicit `EVAL INTERVAL`.
CREATE TABLE legacy_flow_src (
host STRING,
val DOUBLE,
ts TIMESTAMP TIME INDEX
);
CREATE TABLE legacy_flow_sink (
host STRING,
val DOUBLE,
ts TIMESTAMP TIME INDEX
);
CREATE FLOW legacy_flow SINK TO legacy_flow_sink AS
SELECT host, val, ts FROM legacy_flow_src;
SELECT count(*) FROM INFORMATION_SCHEMA.FLOWS WHERE flow_name = 'legacy_flow';
-- Recreating the flow with a schedule is the supported migration.
CREATE FLOW legacy_flow SINK TO legacy_flow_sink EVAL INTERVAL '1h' AS
SELECT host, val, ts FROM legacy_flow_src;
-- The persisted option is still `batching`, so the metadata shape is unchanged.
SELECT flow_name, options FROM INFORMATION_SCHEMA.FLOWS WHERE flow_name = 'legacy_flow';
INSERT INTO legacy_flow_src VALUES ('host_a', 1.0, '2024-01-01 00:00:00');
-- 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('legacy_flow');
SELECT host, val, ts FROM legacy_flow_sink ORDER BY ts;
DROP FLOW legacy_flow;
SELECT count(*) FROM INFORMATION_SCHEMA.FLOWS WHERE flow_name = 'legacy_flow';
DROP TABLE legacy_flow_src;
DROP TABLE legacy_flow_sink;