Skip to content

License Refresh Strategy & SQL Commands #70

@fupelaqu

Description

@fupelaqu

Story 5.7: License Refresh Strategy & SQL Commands

FRs covered: FR37, FR38
Depends on: Issue #67 (Expiry Grace Period & Degradation)
Blocking: Issue #68 (Refresh Scheduler & Telemetry)

Description

Implement the LicenseRefreshStrategy trait with two runtime-context-aware implementations, plus SHOW LICENSE and REFRESH LICENSE SQL commands.

Two Refresh Strategies

  • AutoRefreshStrategy -- for long-running processes (REPL, Arrow Flight SQL, Federation). Delegates to the refresh scheduler (Story 5.8) for periodic background refresh (24h cycle).
  • OnDemandRefreshStrategy -- for driver contexts (JDBC, ADBC). Fetch-once at startup (cache -> config -> backend), then cache result. NO implicit network calls during query execution. On JWT expiry mid-session: silent fallback to Community tier. Refresh only via explicit REFRESH LICENSE command.

New SQL Commands

  • SHOW LICENSE -- returns license type (Community/Pro/Enterprise), quota values (max MVs, max clusters, max result rows, max concurrent queries), and expiration date (or "never" for Community)
  • REFRESH LICENSE -- forces immediate license refresh from backend (API key fetch), updates in-memory license and disk cache, returns previous tier -> new tier and new expiration

Acceptance Criteria

  • LicenseRefreshStrategy trait with initialize(): LicenseKey and refresh(): LicenseKey
  • AutoRefreshStrategy wired for REPL/Flight SQL/Federation contexts
  • OnDemandRefreshStrategy wired for JDBC/ADBC contexts -- no implicit network calls
  • Expired JWT in driver context -> silent Community fallback, no error
  • SHOW LICENSE parser rule (case-insensitive (?i)) producing ShowLicense query
  • REFRESH LICENSE parser rule (case-insensitive (?i)) producing RefreshLicense query
  • Both commands route through GatewayApi.run() like all other commands
  • REFRESH LICENSE with no API key returns informational message

Technical Notes

  • SQL parser rules must use (?i) regex for case-insensitivity (per Issue SQL parser SHOW/DDL/DML keywords are case-sensitive #61)
  • Strategy is injected by runtime context: JDBC/ADBC -> OnDemandRefreshStrategy, REPL/Flight SQL/Federation -> AutoRefreshStrategy
  • REFRESH LICENSE works in all contexts (manual override)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions