Maintenance and Management

View Runtime Status

Parameter Description
domino.decoder_info() Displays decoder information for the current database.
domino.decoder_info_all() Displays decoder information for all databases.
domino.decoder_workers() Queries the PID of worker processes and the databases they are connected to.
domino.decoder_metrics() Shows performance counters for decoders.
domino.stream_metrics() Shows scheduling performance counters and error information for streams.
domino.stream_strategy() Displays scheduling strategy and status for streams.
domino.stream_progress() Shows stream progress and XLog retention status.
domino.ticker_info() Checks whether the ticker is running or paused.
domino.ticker_metric() Shows what conditions triggered the ticker.
domino.tlog_page(text) Displays TLog content; used for debugging.

Usage Examples

  • domino.decoder_workers(): Query worker PIDs and connected databases.

    =# select * from domino.decoder_workers();
    segid | dbid  | dbname |  pid
    -------+-------+--------+-------
       0 | 18745 | haoyu  | 20351
       1 | 18745 | haoyu  | 20353
       2 | 18745 | haoyu  | 20352
      -1 | 18745 | haoyu  | 20354
    (4 rows)
  • domino.decoder_metrics(): View performance counters for decoders.

    =# select * from domino.decoder_metrics();
    segid | dbid  | dbname | bytes_in | xacts | spills | tuples_new | tuples_old | snapshots | latency_ms | loops | total_duration_ms | last_duration_ms
    -------+-------+--------+----------+-------+--------+------------+------------+-----------+------------+-------+-------------------+------------------
       0 | 18745 | haoyu  |    36048 |     0 |      0 |          0 |          0 |       119 |          0 | 25851 |             26616 |                1
       1 | 18745 | haoyu  |    35872 |     0 |      0 |          0 |          0 |       119 |          0 | 26755 |             27517 |                1
       2 | 18745 | haoyu  |    36048 |     0 |      0 |          0 |          0 |       119 |          0 | 25814 |             26576 |                1
      -1 | 18745 | haoyu  |    36784 |     0 |      0 |          0 |          0 |       119 |          0 | 22781 |             23444 |                1
    (4 rows)
  • domino.stream_metrics(): View stream scheduling performance counters and error messages.

    =# select * from domino.stream_metrics();
    db   | db_name | stream | stream_name | loops | tuples | total_slip_ms | last_slip_ms | last_lag_ms | total_duration_ms | last_duration_ms |           last_run            |          held_until           | has_error | error_message | error_detail | error_hint | error_context
    -------+---------+--------+-------------+-------+--------+---------------+--------------+-------------+-------------------+------------------+-------------------------------+-------------------------------+-----------+---------------+--------------+------------+---------------
    18745 | haoyu   |  18792 | s1          |     4 |      0 |             6 |            2 |        1709 |                57 |                7 | 2025-05-23 14:14:26.249188+08 | 2025-05-23 14:14:27.242299+08 | f         |               |              |            |
    (1 row)
  • domino.stream_strategy(): View stream scheduling strategy and status.

    =# select * from domino.stream_strategy();
    id |  db   | db_name | stream | stream_name |  strategy  |                 summary
    ----+-------+---------+--------+-------------+------------+------------------------------------------
    0 | 18745 | haoyu   |  18792 | s1          | roundrobin | held until 2025-05-23 14:14:56.279678+08
    (1 row)
  • domino.stream_progress(): View stream progress and XLog retention status.

    =# select * from domino.stream_progress();
    segid |  db   | db_name | stream | stream_name | restart_lsn | flush_lsn |   tsn   | xmin |  end_lsn  | lag_size | pending_xid | pending_restart | pending_flush | pending_tsn | pending_xmin | wal_status | safe_wal_size
    -------+-------+---------+--------+-------------+-------------+-----------+---------+------+-----------+----------+-------------+-----------------+---------------+-------------+--------------+------------+---------------
       0 | 18745 | haoyu   |  18792 | s1          | 0/C246788   | 0/C249420 | 0/1A160 |  645 | 0/C249CE0 |     2240 |         647 | 0/C246788       | 0/C249610     | 0/1A240     |          646 | reserved   |
       1 | 18745 | haoyu   |  18792 | s1          | 0/C2466F0   | 0/C249388 | 0/1A160 |  645 | 0/C249C48 |     2240 |         647 | 0/C2466F0       | 0/C249578     | 0/1A240     |          646 | reserved   |
       2 | 18745 | haoyu   |  18792 | s1          | 0/C246788   | 0/C249420 | 0/1A160 |  645 | 0/C249CE0 |     2240 |         647 | 0/C246788       | 0/C249610     | 0/1A240     |          646 | reserved   |
    (3 rows)
  • domino.ticker_info(): Check whether the ticker is running or paused.

    -- Return values: (invalid: not started, running: active, paused: paused)
    ticker_info
    -------------
    running
    (1 row)
  • domino.ticker_metric(): View conditions that trigger the ticker.

    =# SELECT * FROM domino.ticker_metric();
    segid | ticks_by_time | ticks_by_size | ticks_by_force
    -------+---------------+---------------+----------------
       0 |         18894 |             2 |              1
       1 |         18894 |             2 |              1
       2 |         18894 |             2 |              1
      -1 |             0 |             0 |              0
    (4 rows)

Information Views

The Domino plugin provides two views: domino.decoder_info and domino.stream_info, used to monitor the status and metrics of logical decoders and data streams.

decoder_info

domino.decoder_info displays the runtime status and metrics of logical decoders on each segment.

Field Descriptions

Field Name Type Description
segid integer Segment ID
dbid oid Database OID
dbname text Database name
restart_lsn pg_lsn Starting LSN of XLog retained (XLog is retained from this position)
confirmed_flush pg_lsn Flush LSN of XLog
start_tsn pg_lsn Start TSN of the last generated TLog
end_tsn pg_lsn End TSN of the last generated TLog
prog_xmin xid xmin of catalog/dimension tables (data is retained based on this xid)
pid integer Decoder process ID; 0 means not running
bytes_in bigint Total volume of consumed XLog data
xacts bigint Total number of transactions consumed
spills bigint Number of transactions spilled to disk
tuples_new bigint Number of inserted rows
tuples_old bigint Number of updated/deleted old rows
snapshots bigint Number of snapshots generated
latency_ms bigint Latency of the last decoding cycle
loops bigint Number of decoder execution cycles
total_duration_ms bigint Cumulative execution time
last_duration_ms bigint Duration of the last execution cycle

Query Example

-- Check segments with high decoding latency
SELECT segid, dbid, dbname, dbname, latency_ms
FROM domino.decoder_info
WHERE latency_ms > 60 * 1000;

stream_info

domino.stream_info displays overall progress, status, and scheduling information for each logical stream.

Field Descriptions

Field Name Type Description
segid integer Segment ID
db oid Database OID
db_name text Database name
stream oid Stream OID
stream_name text Stream name
restart_lsn pg_lsn Starting LSN of XLog retained (XLog is retained from this position)
flush_lsn pg_lsn Flush LSN of XLog
start_tsn pg_lsn Start TSN of the last consumed TLog
end_tsn pg_lsn End TSN of the last consumed TLog
xmin xid xmin of catalog/dimension tables (data is retained based on this xid)
end_lsn pg_lsn Latest LSN on this segment
lag_size bigint Size difference between flush_lsn and end_lsn
pending_xid xid Uncommitted transaction ID
pending_restart pg_lsn Uncommitted XLog restart LSN (XLog is retained from this position)
pending_flush pg_lsn Uncommitted XLog flush LSN
pending_tsn pg_lsn Uncommitted TLog start TSN
pending_xmin xid Uncommitted xmin of catalog/dimension tables
wal_status text WAL status: active: within max_wal_size limit, not cleaned; reserved: exceeds max_wal_size but protected by logical slot or stream, not cleaned; unprotected: beyond protection of slot and stream, will be cleaned at next checkpoint; removed: already cleaned
safe_wal_size bigint Safe maximum WAL size limit; WAL beyond this size may be cleaned
loops bigint Number of execution cycles
tuples bigint Number of processed rows
total_slip_ms bigint Cumulative sleep time (task scheduling delay)
last_slip_ms bigint Last sleep duration
last_lag_ms bigint Stream processing delay (time difference between last processed tick and latest tick)
total_duration_ms bigint Total execution time
last_duration_ms bigint Duration of last execution
last_run timestamp with time zone Last execution time
held_until timestamp with time zone Next scheduled execution time (on error, sleeps for one minute before retry)
has_error boolean Whether an error occurred
error_message text Error message
error_detail text Error details
error_hint text Error hint
error_context text Error context
slot_id integer Domino worker slot in use
strategy text Scheduling strategy
summary text Summary of strategy description

Query Examples

-- Check all streams with errors
SELECT stream_name, error_message
FROM domino.stream_info
WHERE has_error;

-- Check streams with large lag
SELECT stream_name, pg_size_pretty(lag_size) AS lag
FROM domino.stream_info
WHERE lag_size > 64*1024*1024;

Management Functions

Function Description
domino.start_all() Starts all components. After plugin creation, v2 components do not start automatically on restart; manual start is required.
domino.stop_all() Stops all components.
domino.start_decoder() Starts the decoder.
domino.stop_decoder() Stops the decoder.
domino.start_ticker() Starts the ticker.
domino.stop_ticker() Stops the ticker.
domino.pause_ticker() Pauses the ticker.
domino.resume_ticker() Resumes the ticker.
domino.reset_ticker() Resets the ticker.
domino.wait_next_tick() Waits for the next tick.

Progress Control

Used primarily for troubleshooting.

Function Description
domino.wait_for_decoder() Waits for the decoder to catch up.
domino.wait_for_stream() Waits for the stream to catch up.
domino.pause_stream(oid) Pauses a specific stream.
domino.pause_all_streams() Pauses all streams.
domino.resume_stream(oid) Resumes a specific stream.
domino.resume_all_streams() Resumes all streams.
domino.rotate_tlog() Rotates TLog file (Segment).