Lint for replication lag

Open
#131 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
postgres
Domain
databases

Research direction

The issue does not name an implementation file, test, or entry point. Start by reviewing existing lints and advisor tests in the repository, then determine the expected replication-lag checks for primary and replica databases; done should include a defined lint behavior and coverage for both cases.

Written by the indexing model from the issue text.

Description

enhancement

Need a lint for replication lag.

Something like:

SELECT
    pid,
    usename,
    application_name,
    client_addr,
    state,
    sync_state,
    replay_lag,
    flush_lag,
    write_lag,
    pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), sent_lsn))      AS sent_lag_size,
    pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), write_lsn))     AS write_lag_size,
    pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), flush_lsn))     AS flush_lag_size,
    pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), replay_lsn))    AS replay_lag_size
FROM pg_stat_replication;

Could probably do something different on the primary vs a replica.

Dominant language
PLpgSQL
Stars
275
Forks
102
Avg merge
2d 8h
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from supabase/splinter

All issues in supabase/splinter

Similar issues

More Databases issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.