apache/seatunnel · error · ConnectException

Neither confirmed_flush_lsn nor restart_lsn could be found

Error message

Neither confirmed_flush_lsn nor restart_lsn could be found

What it means

parseConfirmedFlushLsn reads confirmed_flush_lsn from pg_replication_slots; on SQLException it falls back to restart_lsn. If that fallback also throws SQLException, it throws this ConnectException because the connector cannot determine how far the slot has been flushed/restarted, which is required to compute the starting offset.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-opengauss/src/main/java/io/debezium/connector/postgresql/connection/PostgresConnection.java:390

    /**
     * Obtains the LSN to resume streaming from. On PG 9.5 there is no confirmed_flushed_lsn yet, so
     * restart_lsn will be read instead. This may result in more records to be re-read after a
     * restart.
     */
    private Lsn parseConfirmedFlushLsn(
            String slotName, String pluginName, String database, ResultSet rs) {
        Lsn confirmedFlushedLsn = null;

        try {
            confirmedFlushedLsn =
                    tryParseLsn(slotName, pluginName, database, rs, "confirmed_flush_lsn");
        } catch (SQLException e) {
            LOGGER.info("unable to find confirmed_flushed_lsn, falling back to restart_lsn");
            try {
                confirmedFlushedLsn =
                        tryParseLsn(slotName, pluginName, database, rs, "restart_lsn");
            } catch (SQLException e2) {
                throw new ConnectException(
                        "Neither confirmed_flush_lsn nor restart_lsn could be found");
            }
        }

        return confirmedFlushedLsn;
    }

    private Lsn parseRestartLsn(String slotName, String pluginName, String database, ResultSet rs) {
        Lsn restartLsn = null;
        try {
            restartLsn = tryParseLsn(slotName, pluginName, database, rs, "restart_lsn");
        } catch (SQLException e) {
            throw new ConnectException("restart_lsn could be found");
        }

        return restartLsn;
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Re-check the slot exists and is stable: SELECT slot_name, confirmed_flush_lsn, restart_lsn FROM pg_replication_slots; then restart the connector.
  2. Grant sufficient privileges to the connector user (REPLICATION role or pg_monitor/pg_read_all_data).
  3. Ensure the slot is not being dropped concurrently by other tooling (check pg_drop_replication_slot callers, monitoring agents with slot retention policies).
  4. If the server does not expose these columns, upgrade to a version where pg_replication_slots reports LSNs.

Example fix

-- before: connector user lacks visibility
CREATE USER cdc_user WITH PASSWORD '...';
-- after: grant replication privileges
ALTER USER cdc_user WITH REPLICATION;
GRANT pg_read_all_data TO cdc_user; -- or SELECT on pg_catalog.pg_replication_slots
Defensive patterns

Strategy: validation

Validate before calling

SELECT confirmed_flush_lsn, restart_lsn FROM pg_replication_slots WHERE slot_name = 'seatunnel_slot'; -- both columns must be readable and non-null

Try / catch

try {
    connection.readReplicationSlotInfo(slotName, pluginName);
} catch (ConnectException e) {
    // recreate slot and retry with fresh connection
    dropSlot(slotName); createSlot(slotName, pluginName);
}

Prevention

When it happens

Trigger: The ResultSet for the slot lacks both the confirmed_flush_lsn and restart_lsn columns or throws when reading them — e.g. the row disappeared mid-query (slot dropped concurrently), the connected user lacks privileges on pg_replication_slots, or the server/pg_catalog version lacks these columns.

Common situations: Slot dropped by another process between listing and reading; connecting with an under-privileged monitoring user; connecting to an old OpenGauss/PostgreSQL variant with a reduced pg_replication_slots schema.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/0ab6f6b08d378afd. Report an issue: GitHub.