Files
greptimedb/src/sql
discord9 c2e7262068 refactor(flow): add the generic admin flow route (#10609)
* feat(flow): route backfill admin to owning flownode

Signed-off-by: discord9 <discord9@163.com>

* fix(flow): harden routed backfill admin

Signed-off-by: discord9 <discord9@163.com>

* feat(flow): route flow admin calls through one shared request

Replace the per-function backfill/backfill_status handlers, operator methods and FlowRequest bodies with one admin(catalog, flow, function, args) route. The owning flownode dispatches the function name to its batching execution factory and answers with flow_admin_result.

Signed-off-by: discord9 <discord9@163.com>

* fix(flow): carry the routed flow id through admin execution

Populate AdminFlow.flow_id from the frontend-resolved id and reject a backend name resolution that no longer matches it. Update the admin route tests.

Signed-off-by: discord9 <discord9@163.com>

* refactor(flow): dispatch flow admin through a registry

Move ADMIN flow_* dispatch out of BatchingExecutionFactory. A deployment installs FlowAdminRegistry; the flownode resolves the requested function there and handlers own their arguments. The registry rejects duplicates and centralizes unknown-function errors.

Signed-off-by: discord9 <discord9@163.com>

* chore: refresh Cargo.lock for routed flow admin

Signed-off-by: discord9 <discord9@163.com>

* test(operator): gate the flow backfill numeric test on enterprise

Signed-off-by: discord9 <discord9@163.com>

* test(operator): gate backfill test imports on enterprise

Signed-off-by: discord9 <discord9@163.com>

* feat(flow): route flow audit through the admin registry

Signed-off-by: discord9 <discord9@163.com>

* chore(ci): refresh compatibility release window

Signed-off-by: discord9 <discord9@163.com>

* fix(flow): reject truncated flow-admin targets

Signed-off-by: discord9 <discord9@163.com>

* refactor(flow): keep the generic admin route out of enterprise functions

Signed-off-by: discord9 <discord9@163.com>

* refactor(flow): carry nullable admin arguments as optional text

Signed-off-by: discord9 <discord9@163.com>

* refactor(flow): keep the served function names readable by the registry's consumer

Signed-off-by: discord9 <discord9@163.com>

* refactor(operator): reject statement modifiers on ADMIN function calls

`ADMIN fn(...)` executes a bare call, but the parser accepts modifiers on
any function call and they were silently dropped: `FILTER`, `DISTINCT`/`ALL`,
in-argument `ORDER BY`/`LIMIT`/`WITHIN GROUP`, `IGNORE`/`RESPECT NULLS`, `OVER`,
parametric arguments and ODBC `{fn ...}` syntax.

Collect every modifier field that exists on `sqlparser::ast::Function` and
reject the statement with `BuildAdminFunctionArgs` before the function lookup,
so the answer does not depend on whether the function exists.

Signed-off-by: discord9 <discord9@163.com>

* refactor(flow): drop the unused query-context field from FlowAdminRequest

Only one consumer ever read `ctx`, and it checked nothing but presence: the
route does not authenticate or authorize, so the field could only ever be a
protocol-shape check dressed up as a trust boundary. Remove it rather than
keep a field whose doc has to disclaim what it looks like it promises.

Signed-off-by: discord9 <discord9@163.com>

* refactor(flow): drop registry docs that restate the code

Three doc comments translated what the signature or the error branch
already said: the registry keys handlers by name, try_new fails on a
repeated name, dispatch refuses an unserved name with Unsupported.

Signed-off-by: discord9 <discord9@163.com>

* refactor(flow): second deslopify pass over the admin route docs

An independent audit reviewed every added doc and comment; this pass
keeps what a caller cannot learn from the signature and drops what
merely translates the code.

- restore the two failure-contract docs the first pass over-deleted:
  try_new refusing a repeated handler name, dispatch refusing an
  unserved name with Unsupported
- drop the remaining restating docs and test comments; keep the
  partition/peer, fence and NULL-position explanations
- inline dispatch_flow_admin and FlowAdminRegistry::names (one consumer
  each); the refusal message keeps its text
- drop the uses_odbc_syntax modifier check: the ADMIN parser reads the
  object name first, so {fn ...} never reaches it
- fix the modifier doc's claim that the parser accepts modifiers on any
  function call; which ones depend on the dialect

Signed-off-by: discord9 <discord9@163.com>

* revert(flow): restore FlowAdminRegistry::names

The deletion test missed a consumer: the enterprise flownode test
asserts the installed function set through names(). Restoring it;
dispatch's refusal message uses it again too.

Signed-off-by: discord9 <discord9@163.com>

* chore: pin greptime-proto to its merged main head

proto #361 squash-merged as 67dcc5ef; be611f6 is its pre-merge branch
commit and is not reachable from main, so the check-git-deps gate needs
the merged rev. Same content, no code change.

Signed-off-by: discord9 <discord9@163.com>

---------

Signed-off-by: discord9 <discord9@163.com>
2026-12-04 07:44:09 +00:00
..