Class WalStatementKinds

java.lang.Object
dev.frostlake.persistence.WalStatementKinds

public final class WalStatementKinds extends Object
Which statements belong in the write-ahead log, decided from the PARSE TREE.

A statement earns its way out of the log by being one of the five read-only or transaction-control families the grammar already distinguishes — a query, an EXPLAIN, a SHOW, a DESCRIBE, or BEGIN/COMMIT/ROLLBACK. Everything else is logged: DDL, DML, session and stage statements, security statements, task statements, and procedural blocks.

The rule is a DENYLIST on purpose. A new statement family added to the grammar is logged without anyone remembering to come here, which is the safe direction — a redundant log record costs space, while a missing one silently loses committed data on the next restart.

It reads the tree rather than the SQL text because the leading keyword does not determine the family. BEGIN opens a transaction AND a procedural block, so a text rule that skips "BEGIN" drops the DML inside an anonymous BEGIN … END block; WITH introduces a query today and could introduce WITH … INSERT tomorrow. Both are invisible from the text and unambiguous in the tree.

  • Method Details

    • isDurable

      public static boolean isDurable(FrostlakeParser.SqlScriptContext script)
      Whether this script has anything worth logging: true when ANY of its top-level statements mutates. A script is logged or skipped whole, since that is the unit the log replays.
    • isDurable

      public static boolean isDurable(FrostlakeParser.StatementContext statement)
      Whether one statement mutates anything the log would have to replay.