Skip to Content
Operations

Operations

Day-2 concerns for a managed database: auto-flush, mirror health, optional cron, and drop/cleanup behavior.

Built-in auto-flush

The same database worker that applies WAL also evaluates auto_flush tables on each koldstore.flush_check_interval_seconds tick (default 30):

  1. Apply available WAL
  2. Evaluate tables with auto_flush = true
  3. Run at most one needed flush_table

Failed auto-flush skips that table for about 60 seconds. Opt out per table:

SQL
SELECT koldstore.set_table_auto_flush(  table_name => 'app.messages'::regclass,  enabled => false);

Or pass auto_flush => false to manage_table. Manual flush still works.

Prefer ALTER DATABASE / ALTER SYSTEM for worker-facing GUCs — session SET does not always reach the background worker.

pg_cron fallback

Useful when you want wall-clock schedules or auto_flush = false:

SQL
SELECT cron.schedule(  'koldstore-flush-messages',  '*/5 * * * *',  $$SELECT koldstore.flush_table(table_name => 'app.messages'::regclass)$$);

A policy flush with nothing eligible returns safely (rows_flushed = 0).

Mirror health

SQL
SELECT koldstore.async_mirror_status();

Alert on:

  • healthy / retention flags in async_mirror_status()
  • Retained WAL bytes vs koldstore.async_mirror_max_retained_bytes (default 1 GiB)
  • Stale updated_at / apply rates

Crossing the retained-bytes threshold marks retention unhealthy but never stops the applier from draining WAL. Separately configure PostgreSQL disk guards and max_slot_wal_keep_size (an invalidated slot may require rebuild).

Strong application fence:

SQL
SELECT koldstore.wait_for_async_mirror();

The fence covers committed WAL only. It cannot expose uncommitted work or advance a snapshot that was acquired before the call.

Disable capture infrastructure

Only after every managed table is unmanaged:

SQL
SELECT koldstore.disable_async_mirror();

Idempotent. A later manage_table recreates compatible infrastructure.

DROP TABLE

Dropping a managed table cancels jobs, waits for locks, deactivates catalogs, deletes cold objects under the table prefix, drops __cl, and records a drop_table_cleanup job. Cold deletion currently happens before the PostgreSQL DDL transaction commits; rolling the DDL back cannot restore deleted objects. Use this only as a preview workflow until post-commit garbage collection lands.

Backup

  • There is no shipped coordinated backup/restore/PITR protocol yet
  • Cold storage is not WAL-protected
  • recover_segments(..., dry_run => true|false) exists for orphan discovery
  • Packaged backup_manifest / validate_cold_storage are not shipped yet
  • pg_dump -t and direct COPY table TO export the heap and can omit cold rows
  • COPY (SELECT ... FROM table) TO can use the merge scan for supported reads

See Status & Limits.

Suggested monitoring checklist

  1. SHOW shared_preload_libraries still includes koldstore
  2. koldstore.preload_status()loaded_via_shared_preload = true
  3. async_mirror_status() healthy; retained bytes under threshold
  4. table_status for hot/cold growth and last_error
  5. Flush job backlog (list_jobs pending/running)
  6. Disk for PostgreSQL data directory and cold backend

Next

Last updated on