Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-7796

SmartRouter: add @@last_route to show where the last query ran

    XMLWordPrintable

Details

    • New Feature
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • None
    • smartrouter
    • None

    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

      1. A read routed to the analytical target returns that service and its host.
      2. A write returns the master service and the primary's host.
      3. After a causal reads timeout, the value shows the MariaDB service and host.
      4. Two consecutive SELECT @@last_route statements return the same value.
      5. The variable works inside a transaction and with prepared statements.
      6. 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            allen.herrera Allen Herrera
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.