Details
-
New Feature
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
MXS-CAPACITY-Q4-2026
Description
Description
Add a read-only session variable @@last_route to SmartRouter. SELECT @@last_route; returns the service and the backend host that ran the previous query in the session, in the form <service>/<host>, for example RWS-Row/db-n3 or RWS-Column/exasol-1. This lets users, support and QA see where a query ran, and it makes the causal reads fallback to MariaDB directly testable.
Behavior
- MaxScale answers the statement itself, so it is not sent to the backends.
- The SELECT @@last_route statement does not update the value, so two selects in a row return the same result.
- A read with a new canonical, which SmartRouter sends to all clusters, reports the target whose response was used.
- A write reports the master target.
- If a causal read times out and falls back, it reports where the query finally ran.
- Session commands (SET, USE) do not update the value.
- Before any query has run, the value is NULL.
- If the downstream service cannot report which host handled the query, the value is the service name alone.
- The host is the address of the server as configured in MaxScale.
Acceptance criteria
- A read routed to the analytical target returns that service and its host.
- A write returns the master service and the primary's host.
- After a causal reads timeout, the value shows the MariaDB service and host.
- Two consecutive SELECT @@last_route statements return the same value.
- The variable works inside a transaction and with prepared statements.
- It is documented in the SmartRouter docs and covered by tests.
Out of scope
Engine-type labels such as InnoDB or Exasol. Port in the returned value.