Production operations
This runbook documents released v0.4.3 behavior (port 6754, schema token 7) and
follows main for later documentation corrections. Use the
v0.4.3 runbook
for the exact release snapshot.
Use the v0.4.2 runbook
when operating that binary. In particular, lease-preserving startup and local
maintenance, coordinated broker shutdown, and the revised managed Receiver
behavior below are included in v0.4.3; see CHANGELOG.md.
v0.3.3 is withdrawn and
unsupported; its public assets and exact image remain available for forensic or
compatibility inspection and must not be deployed. v0.4.3 retains v0.4.0's
retraction of v0.3.3. Upgrading from v0.3.2 or another schema-5 release
requires a fresh database as described below.
Runtime-managed access keys require v0.3.1; v0.3.0 supports configured tokens only.
Unified Observe and configured monitor credentials require v0.3.2.
Upgrading from v0.2.0 changes both its default port (8080) and schema token (2);
follow upgrade and rollback before replacing the broker.
See deployment for installation and observability
for metric definitions and alerts.
v0.4.2 is a same-schema patch over v0.4.1. Broker-wide listen keys can provision
or update subscriptions and test filters; complete inventory and deletion remain
manage operations. Browser root requests that explicitly prefer HTML enter the
enabled console, while curl and JSON clients retain the discovery response. The
wire contract is unchanged. No database rebuild or metric migration is required.
Still quiesce clients and avoid overlapping brokers during the binary replacement.
Operating boundaries
- Run one active broker per database. A local file has one MQLite owner and one writer connection; it may also open one read-only observation connection. Use HTTP clients for other processes. A second broker sharing a Turso database is also unsupported: startup recovery assumes the previous owner has stopped. Do not perform a rolling overlap against the same database.
- Keep local storage on a persistent local filesystem or attached block volume, with working flush semantics. SQLite WAL is unsuitable for a network filesystem. Size for the peak backlog, WAL, temporary operations, backups and log retention.
- Use
MQLITE_SYNC=FULLfor production when an acknowledged commit must survive an OS or power failure. The defaultNORMALprotects against process crashes but can lose recent commits after power loss.FULLstill depends on the storage stack honoring flushes; SIGKILL tests do not simulate a power failure. - Set stable
MQLITE_TOKENS, terminate HTTPS, and keep the broker behind the proxy or a private network. Configured tokens are administrators; runtime keys can restrict sending or listening across the broker. There are no per-queue roles. Keep credentials in a restricted environment/secret file. - Consumers must be idempotent. Restarts, lost responses and restoring an older
snapshot can repeat work whose external side effects already happened. Reuse
stable
MessageID/body, receiveAttemptID, and the exact settlement request when retrying within their documented retention windows; do not treat an HTTP timeout as proof that a write failed. Send deduplication is off by default: enable a positive queue dedup window that covers the retry period before relying onMessageID, and keep metadata, TTL and scheduled time stable too. Duplicate sends do not extend that window. Settlement receipts expire after 30 minutes without extension on replay; resource deletion or fixed subscription expiry can end replay earlier. Keep an application-side ledger when reconciliation must outlive those bounds. A Peek-Lock AttemptID replays only while its saved record is unexpired and its entire saved batch still owns live leases. A broker restart preserves those unexpired leases and tokens; after lease expiry or settlement, the broker invalidates a stale response and safely re-evaluates eligible work in a fresh claim instead of returning obsolete ownership. Reuse that AttemptID only when the original Receive response was not observed. Once a response is available, retain its tokens and use a new AttemptID for later Receive calls; invalidating a partially stale cached batch deliberately leaves its other live leases with the original caller rather than creating concurrent delivery. For a planned broker replacement, keep the outage shorter than the remaining leases, or quiesce new receives and let handlers settle first. A lease that expires during the outage follows normal redelivery/final-attempt DLQ rules.
The next three boundaries apply to v0.4.0 and later. v0.3.2 has
the complete active-only ListSubscriptions operation, but it does not provide
queue/subscription deletion, lifecycle-aware paged subscription inventory, the
subscription capacity setting, or fixed subscription TTL.
- Give one controller exclusive ownership of queue or subscription deletion and
same-name recreation. Quiesce producers and consumers. Use the empty-only
default unless permanent loss is intended; force also discards locked work whose
external effects may already have happened. The accepting transaction moves the
resource to
deletingand starts cleanup. The marker reserves its name when cleanup continues; a small deletion can instead complete in that same commit. An accepted subscription leaves topic fan-out immediately. Confirm the name is absent before recreating it. Keep the name reserved while reconciling an uncertain result, and never replay an old delete after a replacement exists. - Treat the default 10,000 active-plus-deleting subscription limit as a metadata
safety ceiling. Choose a lower limit when the application needs a stricter
bound. Measure fan-out latency, database growth and observation cost at the
expected active count; each matching subscription creates another message copy.
Stable reply subscriptions plus
correlation_idscale better than one subscription per request. If temporary subscriptions are required, use globally unique one-use names and rate-limit creation/deletion so bounded cleanup can keep up. - Treat a fixed subscription TTL as forgotten-cleanup insurance. The deadline is absolute and expiry authorizes discarding every retained state; traffic and filter edits do not renew it. Delete explicitly on normal completion, stagger large expiry waves, and include unconsumed body bytes plus post-expiry cleanup time in capacity planning.
- Keep the broker host's UTC clock synchronized and alert on large time steps.
Subscription deadlines, scheduled delivery, message TTL and lock expiry all use
that clock. A forward step can make deadlines arrive early; a backward step can
delay a subscription expiry that has not yet been durably marked
deleting. Compare absolute deadlines with Status or Observeserver_time_ms; do not use the browser clock or cachedsampled_at_msas the lifecycle reference. - Treat global queue gauges as sampled monitoring data. Within one broker process,
Observe,/metricsand the console share them for about 10 seconds and expose the originalsampled_at_ms; use fresh per-queueStatswhen an operation needs a current drain decision. A very slow refresh adds its own duration to the possible message-gauge age. Keep normal scrape intervals at 15 seconds or longer unless a measured workload justifies more frequent probes. One cache refresh still scans retained messages and can consume CPU, storage bandwidth and WAL checkpoint headroom on a deep backlog.
Choose and record the application's recovery objectives before launch: acceptable snapshot age (RPO), recovery time (RTO), backlog age, and capacity limits. Measure restore time with representative data. A successful backup command alone is not a restore test.
Graceful broker shutdown
The coordinated shutdown and lease-preserving restart contract below requires
v0.4.3; an installed v0.4.2 broker does not provide these guarantees.
It also does not drain application consumers. Canceling Receiver.Run cancels
its in-flight handler contexts. Run still waits for handlers and settlement to
return, but offers no grace period for handlers to finish before cancellation.
Interrupted deliveries can consume delivery attempts or reach the DLQ at the
configured limit. Quiesce and drain consumers at the application layer before
canceling them when a planned consumer stop must finish its work.
mqlite serve treats the first SIGINT or SIGTERM as a graceful-shutdown request.
It stops accepting new HTTP connections and closes an internal no-new-claim gate for
Receive. A call parked between claim rounds wakes with 200 and an empty message list;
managed Receivers can therefore reconnect after the broker restarts. Caller-initiated
cancellation remains 499. Stop and claim admission share one atomic boundary: a round
admitted before shutdown retains the caller's context and returns its real message or
error, while no database operation starts for a later round. Only a call that already
completed a confirmed empty round receives the 200 wake-up. A Receive fenced before
its first round gets 503 unavailable with Retry-After (CORS-exposed when enabled),
preserving its AttemptID in case it is replaying a committed claim whose earlier
response was lost. Other admitted
requests retain their contexts and receive up to
25 seconds to drain; the broker does not abort an in-flight Send or settlement just
to wake a long poll. A handler that does not finish (for example, a client stalled
while uploading a request body) consumes that drain budget. The broker then closes
the engine's operation admission, joins admitted database work and background
maintenance, closes the database, and releases the local file lock. Engine and
diagnostic-log close failures make the command exit non-zero.
Broker startup preserves an unexpired Peek-Lock lease on an active resource, its
fencing token and its delivery count. Resource lifecycle and message TTL remain
authoritative. A remote handler that outlives a short broker restart can
therefore renew or complete the same delivery after reconnecting; the restart
does not by itself duplicate the message or consume another delivery attempt.
If the downtime reaches locked_until, startup recovery (or the reaper) applies
the ordinary expiry rule: the message returns to active below the delivery limit
or enters the DLQ on its final attempt. Size lock durations and deployment grace
periods so planned restarts normally finish inside the remaining lease.
Measure the full interval from stopping the old broker until the replacement
listener is ready, including database open and schema checks. The default lease
is 30 seconds; use a longer configured lease when measured remote-store restart
time and renewal/settlement latency need more margin.
The managed Go clients also have bounded renewal and settlement retry budgets:
terminal Complete/Abandon cleanup gets up to five seconds in total, including the
first request and all replays. Returning before lease
expiry is therefore necessary but not sufficient to preserve a particular
handler's settlement; an exhausted retry budget does not resume automatically
when the broker later returns. Retaining a valid token does not guarantee that an
external side effect ran only once.
A stopped broker's database may be opened by a local CLI inspection or maintenance
command without revoking an unexpired delivery: every Open preserves live leases by
default. The local file still has a single owner, so stop the broker first and never
open the same DB concurrently. Programmatic servers must use WithBrokerMode before
Serve to select its shutdown and lifecycle contract. A single-process embedded
owner may use WithReclaimUnexpiredLeases only when it knows every previous handler
is gone; that explicit takeover invalidates live tokens and may send final attempts
to the DLQ.
After the first signal has been observed, normal operating-system signal behavior is restored before graceful shutdown starts. A second SIGINT or SIGTERM therefore forces process termination immediately. Use that escalation only when abandoning the remaining HTTP handlers and cleanup is preferable to waiting: the process cannot run additional settlement or close code after the second signal. SQLite transactions still recover atomically. A committed, unexpired Peek-Lock lease is preserved on the next broker open; once its deadline passes it is eligible for redelivery or final-attempt DLQ. Application side effects may already have happened and must remain idempotent. Ctrl-D is terminal input EOF, not a shutdown signal; the broker does not read stdin.
The Receive gate is the no-new-claim barrier for a call parked between claim rounds. An already-admitted claim transaction keeps the caller's request context and may return work committed before shutdown began. Quiesce consumers before a planned broker replacement when even that in-flight boundary matters.
Set the platform's outer termination grace longer than:
View the original English text figure
25s HTTP drain + Engine.Close duration + log and process-exit margin
Engine.Close deliberately waits for admitted work and has no unsafe timeout that
releases ownership while a write may still be running. It immediately refuses new
database operations and wakes parked receivers, then gives admitted operations up
to five seconds to finish before canceling background maintenance. This internal
grace avoids interrupting a healthy commit; after it expires, an unacknowledged
commit remains outcome-unknown and must be reconciled. The grace is separate from
transaction cleanup and does not bound the total Close duration. This grace applies
to engine-admitted SQL operations; it does not give application message handlers a
graceful-drain phase. The outer platform deadline
is therefore the final hard bound. The repository's docker-compose.yml sets
stop_grace_period: 40s; plain Docker otherwise defaults to only 10 seconds and
can send SIGKILL while a deliberately stalled handler is still inside the 25-second
HTTP drain. Kubernetes commonly defaults to a 30-second termination grace, leaving
only about 5 seconds after the worst-case HTTP drain for engine close and process
exit; configure at least 40 seconds, and more when measured remote-store close time
requires it. Keep Turso/libSQL replacement single-active and stop-then-start; this
shutdown behavior does not make overlapping brokers safe.
Consumer stops and host interruptions
These boundaries describe released v0.4.3 and both Go clients' managed
Receiver.Run. The SDK does not install process signal handlers. The host
application decides how SIGINT/SIGTERM, stdin EOF, and platform grace periods
affect its contexts; Consumer.Shutdown and a stop-admission-then-drain API are
not implemented. Ctrl-D normally produces stdin EOF, not a process signal or
automatic context cancellation; mqlite serve does not read stdin.
| Event | Current behavior and required action |
|---|---|
| Broker stops and restarts within the remaining lease | A live Receiver retries and can reuse the persisted token. Renewal and settlement must also finish inside their retry budgets. Keep a single active broker and leave the Receiver's controlling context live. |
| Broker outage reaches lease expiry | The original token cannot renew or create a new settlement effect. The delivery returns to active below MaxDeliveryCount, or enters the DLQ at the limit. A retained exact-request receipt can still confirm an earlier committed settlement. |
Application cancels Run |
Receive retries stop and handler/renewal contexts are canceled immediately. Run still waits for workers and cleanup. A returning handler's nil result requests Complete; a non-nil result requests Abandon on a fresh context with up to five seconds, unless terminal renewal failure already made settlement unsafe. Cancellation offers no handler grace period. |
| Handler, error callback, or custom transport ignores cancellation | Shutdown can remain blocked while joining that work. Context cancellation is cooperative; it is not a goroutine kill or a hard return deadline. |
| Application calls a Close method | Receiver.Close is a no-op; Client.Close releases only SDK-owned idle HTTP connections. Neither cancels an active Run. Embedded.Close joins admitted database work, not application handlers. Cancel and join the Receiver before closing its client or engine. |
| Consumer is killed, SIGSTOPped, or container-paused while the broker stays available | A killed process cannot settle; a paused process cannot renew. Expired leases follow the ordinary redelivery/DLQ rule. A resumed handler may already have made an external change even though its old token is fenced. |
| Broker is killed | There is no HTTP drain or cleanup guarantee. Local transactions recover atomically; default startup preserves still-valid leases. If the response is lost around a commit, the caller must reconcile the result (for example through the exact-request receipt); process death alone does not prove rollback. :memory: loses all state when its process exits. |
| Screen turns off or locks; machine sleeps, freezes, or loses power | Turning off or locking the screen alone does not signal a process or cancel its contexts; the OS may separately suspend the host. During host sleep or failure, do not assume continued serving, renewal, or cleanup; broker-clock deadlines may be past on resumption. SIGSTOP, container pause/restart, and SIGKILL are process fault models, not proofs of host-sleep or power-loss behavior. |
For a planned consumer stop, arrange application-level admission control and let work settle before canceling it, or use an explicit Receive loop whose lifecycle the application owns. An interrupted final delivery can reach the DLQ without a business-handler failure. Do not repeatedly restart or redrive a non-idempotent handler without reconciling its external side effects.
A successful Send acknowledgement means the transaction committed under the
configured storage contract. It does not acknowledge completion of a consumer's
external work. Local NORMAL protects against process crashes; power-loss
durability requires FULL and a storage stack that honors flushes. Turso/libSQL
durability is the remote service's contract, not a setting proved by a local
container test. Recovery tests must state which of these failure models they
actually exercise.
Startup and routine checks
Pin the binary checksum or image digest and record its source commit, Go version, MQLite version and schema token. Use the same configuration when rehearsing and running the service, especially durability, message limits and DLQ retention.
GET /healthz is a process liveness check; its handler does not query storage.
Use authenticated AdminService/Status to inspect the backend (ping_ms >= 0)
and its lifecycle clock (server_time_ms), then a dedicated canary queue to
verify a complete write/consume/settle cycle.
A successful read does not prove that disk space remains for a write.
export MQLITE_ENDPOINT=http://127.0.0.1:6754
# Set MQLITE_TOKEN from your secret manager; do not paste it into shell history.
mqlite status --output json
mqlite create-queue ops-canary
mqlite send ops-canary "canary-$(date -u +%s)"
mqlite receive ops-canary
mqlite metrics ops-canary --output json
The CLI receive completes messages after printing them unless --no-ack is set.
The final canary queue total must be zero. Run one canary consumer at a time and
keep it separate from business traffic. A periodic canary should check the returned
body against its own sent identity and fail on an unexpected or missing message.
Monitor process/container restarts, memory, free disk, DB plus WAL size, recent backup age, RPC errors and queue age/depth. See observability for the difference between backlog gauges and the completion counter. Review DLQ messages before retention removes them; retention is a bounded failure buffer, not an archive. Leave space for a new backup and WAL growth during a long read.
Key rotation
Use a separate managed key for each producer, consumer or administrator. A
manage key can issue or revoke keys, including other administrators; a send
or listen key cannot. Console administration requires manage; use distinct
configured MQLITE_MONITOR_TOKENS for a read-only metrics scraper or monitoring
view. These credentials do not rely on the key database. See the
monitoring starter and cloud integration guide.
Create managed keys with mqlite key create, move clients to the replacement,
then mqlite key revoke --id <old-id>. These changes persist in the database and
take effect without restarting the broker. Revocation rejects new authentication
attempts; requests already authorized may finish. Keys issued by another key are
independent, so revoking their issuer does not revoke them.
Configured administrator rotation still uses MQLITE_TOKENS=old,new, a broker
restart, client/scraper cutover, then removal of the old configured token and
another restart. Quiesce clients during each replacement and verify the canary
before resuming traffic. A token explicitly configured here remains an
administrator even if a matching database key has expired or been revoked;
remove that configuration to revoke the static grant. Keep a configured
administrator available for recovery, and store secrets outside command history.
Consistent backups
These procedures are for a local SQLite file. Turso backups and point-in-time recovery belong to the remote service; rehearse that provider's restore process and keep one active MQLite owner during the switchover.
Protect backups like the live database: they include message bodies, properties, managed key digests/permissions/revocations and any embedded outbox business tables. Keep a verified copy outside the database's failure domain, together with the matching binary/image identity and configuration needed to restore it. Store plaintext credentials separately. Restoring a snapshot also restores its key state: newer keys may disappear and keys revoked after the snapshot may become valid again. Before reopening client traffic, use a configured administrator to review key metadata and revoke or replace credentials whose state changed after the backup.
Online snapshot
Use a read-only connection to the live source and a new destination filename:
umask 077
MQ_DB=/var/lib/mqlite/mq.db
MQ_BACKUP_DIR=/var/backups/mqlite
mkdir -p "$MQ_BACKUP_DIR"
MQ_SNAPSHOT="$MQ_BACKUP_DIR/mq-$(date -u +%Y%m%dT%H%M%SZ).db"
sqlite3 -readonly "$MQ_DB" '.timeout 10000' "VACUUM INTO '$MQ_SNAPSHOT'"
test "$(sqlite3 -readonly "$MQ_SNAPSHOT" 'PRAGMA integrity_check')" = ok
test -z "$(sqlite3 -readonly "$MQ_SNAPSHOT" 'PRAGMA foreign_key_check')"
test "$(sqlite3 -readonly "$MQ_SNAPSHOT" \
'SELECT COUNT(*) FROM messages m LEFT JOIN queues q ON q.name=m.queue WHERE q.name IS NULL')" = 0
sqlite3 -readonly "$MQ_SNAPSHOT" "SELECT value FROM meta WHERE key='schema_version'"
sha256sum "$MQ_SNAPSHOT" > "$MQ_SNAPSHOT.sha256"
Run the commands with error checking (set -e in a script). A failed or interrupted
snapshot is not a backup; preserve the error and choose a new filename for the next
attempt. Verify the checksum after copying the snapshot to backup storage.
VACUUM INTO makes a transactionally consistent snapshot, including business and
auxiliary tables. Do not copy only the main file while the broker is running, and
do not write or run an external checkpoint against the live source. Keep the
backup connection read-only and short-lived. SQLite's documented
WAL-reset issue requires multiple
connections concurrently writing/checkpointing. A local MQLite database has one
connection that may write or checkpoint plus one observation reader opened with
SQLite mode=ro and query_only; the reader cannot write or checkpoint. That
division and this backup restriction avoid the affected topology. See
dependency policy.
Offline directory copy
Stop producers and consumers, then stop the broker and confirm it has exited.
Copy the complete data directory while no process can change it; include the main
DB and any remaining -wal/-shm files. A clean shutdown normally checkpoints and
removes these files, but their absence must not be assumed after a crash.
Keep the matching set together. Do not delete a WAL file to make a backup look
self-contained. Restart the original service only after the directory copy finishes.
For the systemd recipe, systemctl stop mqlite must finish before copying
/var/lib/mqlite/. For Docker, stop the container and copy its named volume using
a helper with a read-only source mount. A volume snapshot taken while the broker
is still writing needs its own documented consistency guarantees.
Restore into a fresh directory
- Keep the original data and backup unchanged. Verify the backup checksum and
run
integrity_check,foreign_key_check, and the documented message-parent orphan query on the saved snapshot or a working copy. Engine writes enforce the message relation transactionally and indexed triggers guard parent retirement, so it is outside SQLite'sforeign_key_checkreport. Record the schema token and the binary version that created it. - Create an empty restore directory or volume. An online
VACUUM INTOsnapshot is a standalone DB; copy that file into the empty directory. For an offline copy, restore the complete matching directory. Never place a snapshot beside WAL/SHM files from another database lifetime. - Give the broker account read/write access to that directory. Start the matching
binary against it on an isolated endpoint, with authentication and
FULL, while business clients remain stopped. Do not attach the original database as well. - Verify configuration, subscriptions, message identities and body hashes against
recorded expectations. Broker startup preserves a locked row whose lease is
still unexpired; it retains the original token and delivery count until the
holder settles it or the deadline passes. An already-expired lock is reclaimed:
below the queue's delivery limit it becomes active; at the limit it goes to DLQ
with
MaxDeliveryCountExceeded, and its old token is invalid. A queue already markeddeletingnever participates in lock recovery; startup first continues one bounded cleanup pass, then the background loop resumes it. A saved receive-attempt response may replay only while every token in its batch still owns a preserved live lease. If expiry or recovery invalidates any token, the stale response is removed and cannot recreate ownership. - Check deferred/scheduled/DLQ work and topic filters, then run the authenticated canary. A restore replays the snapshot's state: later completions, sends, dedup records and external business effects require reconciliation against the application's own records. TTL and retention clocks continue to matter.
- Stop the isolated broker, point the service at the restored directory and start its single owner. Resume clients only after validation. Record actual recovery time and recovered snapshot age; retain the original for investigation.
The repeatable restore drill verifies all schema tables and columns, complete payloads, auxiliary records, outbox data and the explicitly requested embedded recovery transformations. Default preservation of live leases is covered separately by the engine and real Serve restart tests; the restore drill does not replace those checks. Run it for a candidate and rehearse the same procedure on representative operational data before relying on a backup.
Upgrade and rollback
Check schema tokens before replacing a binary. Version numbers alone do not establish database compatibility, and MQLite does not run schema migrations.
| Situation | Procedure |
|---|---|
| Same schema token | Quiesce clients, stop the old owner, take a consistent backup, start the candidate against a restored copy, validate, then replace the owner. Keep the old binary and snapshot for rollback. |
| Different schema token | Keep the old database with its old binary. Account for all retained work, then create a new database using the candidate. Do not edit the schema token or point the candidate at the old file as a migration. |
| Rollback before candidate accepts business writes | Stop the candidate and restore the matched old binary plus old snapshot/configuration; verify before resuming clients. |
| Rollback after candidate accepts business writes | First preserve candidate data and reconcile new messages and external effects. Blindly restoring the old snapshot would discard those new writes. |
Lease recovery behavior is implemented by the binary, not recorded in the schema
token. A build from before the safe-open default may reclaim every live lock when
it opens the database, even when the file itself is schema-compatible. Before such
a downgrade, stop new claims, drain and settle in-flight work (or wait for every
lease to expire), and verify every queue reports locked=0. Do not use an older
local CLI for inspection or vacuum during a maintenance window that still has live
tokens.
For a cutover from v0.3.0, v0.3.1, v0.3.2 or withdrawn v0.3.3 to v0.4.0, the schema changes from 5 → 7 while port 6754 stays unchanged. Durable queue lifecycle and fixed subscription-expiry columns and indexes make the database incompatible; there is no in-place migration. Schema 6 belonged only to an intermediate unreleased lifecycle build, was never tagged, and is refused too. Follow the different-token procedure above: stop producers and consumers, take a consistent schema-5 backup, account for every retained message state and managed key, preserve the matching old binary/database pair, and start v0.4.0 with a fresh database. Do not edit the schema token or point schema-7 code at the old file. Move work through an application-level drain/replay process with stable business identities if it must survive the cutover.
The v0.4.0 clients use the deletion contract
{name,force?} with a typed
{deleted,state} result; update broker, SDK, CLI, MCP and console together. A
rollback after schema-7 accepts writes requires preserving and reconciling those
writes before restoring the schema-5 snapshot. Retain broker stderr externally for
the destructive-operation reconciliation window; the private diagnostic log is
separate from access logs and database backups.
Before the cutover, replace Prometheus mqlite_queue_total queries with
mqlite_queue_retained_messages. Replace
mqlite_queue_oldest_message_age_ms with
mqlite_queue_oldest_message_age_seconds and divide thresholds by 1,000. The
v0.4.0 release removes both deprecated aliases; native Observe JSON keeps
queues[].oldest_message_age_ms. Validate recording rules, alerts and dashboards
against v0.4.0 before resuming traffic.
For v0.3.1 → v0.3.2, schema token 5, port 6754, message data and
managed-key storage remain unchanged. Follow the same-schema procedure above;
do not overlap brokers. Validate existing key permissions and a complete canary
cycle, then check Observe, the monitor credential and the new dashboard/rules.
Prometheus scraping is now disabled by default: set MQLITE_METRICS=on or use
--metrics to retain /metrics on the API port, and keep the route off public
ingress. Configure the collector with its distinct monitor token.
Process counters reset at restart; existing Prometheus history is separate from
the broker database.
When rolling back to v0.3.1, stop the candidate before starting the old binary.
Existing managed keys retain their permissions, but v0.3.1 has no Observe
endpoint or configured monitor credentials. Pause v0.3.2-only observers and
restore the previous authorized scraper/rule configuration; the old /metrics
endpoint requires an administrator. Keep administrator authentication enabled.
Preserve writes accepted by the candidate rather than blindly restoring the
pre-upgrade snapshot. The two deprecated metric aliases remain available in
v0.3.2 and are removed in v0.4.0; see
metric compatibility.
For v0.3.0 → v0.3.1 or v0.3.2, schema token 5 and the port remain unchanged.
The newer release adds the independent access_keys table without rewriting existing
queue or message tables. Rehearse opening a restored copy first. Rolling back to
v0.3.0 preserves that extra table, but the old binary cannot authenticate managed
keys or enforce their permissions: reconnect clients with configured administrator
tokens, or keep them stopped until v0.3.1 or later is restored. A database with an
unrelated, incompatible table named access_keys is rejected without modifying it.
For v0.2.0 → v0.3.0, schema 2 → 5 and default port 8080 → 6754 both change. Before the cutover, stop producers and account for every queue and subscription in every state, including future scheduled work, deferred work and DLQ messages. Drain retained messages with the old version, or make an explicit application-level replay plan with stable business identities. A queue that has no active messages may still contain scheduled, locked, deferred or DLQ work.
Create the candidate database in a new volume/directory; update the port, reverse proxy, clients and probes together. Preserve the old binary, configuration and snapshot. The new binary must reject a real schema-2 file and the old binary must reject a schema-5 file without changing its logical contents; the restore drill checks both directions. There is no general message export/import migration tool in this release, so do not improvise a direct SQL table copy between schemas.
Incident actions
| Symptom | First actions | Verify before resuming |
|---|---|---|
Full disk / SQLITE_FULL |
Stop ingress, preserve logs and acknowledged message identities. Expand storage or remove unrelated expired logs/backups; never remove the live DB or WAL. A full VACUUM needs working space and is unsuitable as an emergency first step. |
Backend status, a fresh canary, successful replay/reconciliation of ambiguous requests, and retained-message integrity. |
| Repeated broker crashes | Stop restart loops long enough to preserve the complete DB directory and logs. Check disk, memory/OOM and configuration. Restart only one owner. | Recovery of orphaned locks, DLQ reason/count, canary and consumer idempotency. |
| Old backlog / growing DLQ | Check consumers, lock expiry/renewal and handler failures. Inspect reasons and payloads; fix the cause before bounded redrive. | Backlog age falls and verified redriven identities complete. |
Queue or subscription remains deleting |
Keep producers stopped and the name reserved. Check storage availability, free disk and resource_cleanup, subscription_expiry, and lifecycle maintenance failures; do not remove lifecycle rows or subscription mappings with SQL. Cleanup is deliberately bounded and resumes after restart. |
list or list-subscriptions --include-deleting no longer contains the name; only then may the owner recreate it. Logical free pages can be reused before the DB/WAL files shrink. |
| Many subscriptions expire together | Stop additional temporary-subscription churn. Inspect active plus deleting inventory, retained message bytes, storage latency, capacity and both expiry/lifecycle maintenance diagnostics. Do not recreate names while rows remain. | Expired rows were unavailable at their exact deadline, deleting inventory and capacity usage converge, and foreground latency remains within the workload's measured bound. |
Subscription creation returns resource_exhausted |
Stop creation churn and inspect active plus deleting subscriptions with paged listing. Drain or explicitly force-retire abandoned entries, then let bounded cleanup finish. Raising the limit also raises metadata, fan-out and observation costs. | Deleting entries disappear, capacity becomes available and publish/observe latency remains within the workload's measured bound. |
An older database exposes a kind=subscription queue with no subscription mapping |
Wait for a capacity slot, call Subscribe with the intended topic and existing backing-queue name to restore the mapping, then keep it or retire it through DeleteSubscription. Never repair MQLite-owned tables with direct SQL. |
The exact topic/name appears in list-subscriptions; if retired, it disappears after bounded cleanup. |
| Storage/remote timeouts | Check backend reachability and latency. Treat lost write responses as ambiguous; keep retries within the idempotency contract. | Authenticated status plus a write/consume canary. |
ErrSchemaVersionMismatch |
Stop the attempted cutover. Recover the matching binary/database pair. | Schema token and the correct old or new port; no token restamping. |
SQLite backup semantics and WAL file handling describe the storage rules behind these procedures.