ALTER MATERIALIZED VIEW RESUME WAL
Restarts WAL transactions on a materialized view after resolving errors that caused suspension.
Syntax
ALTER MATERIALIZED VIEW viewName RESUME WAL [ FROM TRANSACTION sequencerTxn ]
Parameters
| Parameter | Description |
|---|---|
viewName | Name of the materialized view to resume |
FROM TRANSACTION | Optional starting transaction number (defaults to failed transaction) |
When to use
Use this command when a materialized view's WAL processing has been suspended
due to an error. The view will be marked as suspended = true in the
wal_tables() output.
Examples
Check WAL status
Use wal_tables() to identify
suspended views:
SELECT name, suspended, writerTxn, sequencerTxn, errorTag
FROM wal_tables()
WHERE suspended;
| name | suspended | writerTxn | sequencerTxn | errorTag |
|---|---|---|---|---|
| trades_1h | true | 3 | 5 | DISK FULL |
The trades_1h view is suspended. The last successful commit was transaction
3.
wal_tables() also reports the errorTag and errorMessage of a suspended
view. OUT OF MEMORY means a WAL apply batch on the view ran out of memory, by
breaching its own
memory limit or the
process-wide one. This is distinct from a refresh that breaches
cairo.mat.view.refresh.memory.limit.bytes:
that does not suspend the view but, once its retries are exhausted,
invalidates it, which
RESUME WAL does not repair.
Resume from failed transaction
Restart processing from the next transaction after the last successful one:
ALTER MATERIALIZED VIEW trades_1h RESUME WAL;
This resumes from transaction 4 (the failed transaction).
Resume from specific transaction
Skip problematic transactions by specifying a starting point:
ALTER MATERIALIZED VIEW trades_1h RESUME WAL FROM TRANSACTION 5;
Behavior
| Aspect | Description |
|---|---|
| Default resume point | Resumes from the transaction after writerTxn |
| Skipped transactions | When using FROM TRANSACTION, earlier transactions are skipped |
| Error resolution | Fix the underlying issue before resuming, or skip past it |
Permissions (Enterprise)
Resuming WAL on a materialized view requires the ALTER MATERIALIZED VIEW
permission on the specific view:
GRANT ALTER MATERIALIZED VIEW ON trades_1h TO user1;
Errors
| Error | Cause |
|---|---|
materialized view does not exist | View with specified name doesn't exist |
view is not suspended | WAL is already running normally |
permission denied | Missing ALTER MATERIALIZED VIEW permission (Enterprise) |