{"record":{"id":"b0ae7683be1b4ada","repo":"apache/seatunnel","slug":"restart-lsn-could-be-found","errorCode":null,"errorMessage":"restart_lsn could be found","messagePattern":"restart_lsn could be found","errorType":"exception","errorClass":"ConnectException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-opengauss/src/main/java/io/debezium/connector/postgresql/connection/PostgresConnection.java","lineNumber":403,"sourceCode":"            LOGGER.info(\"unable to find confirmed_flushed_lsn, falling back to restart_lsn\");\n            try {\n                confirmedFlushedLsn =\n                        tryParseLsn(slotName, pluginName, database, rs, \"restart_lsn\");\n            } catch (SQLException e2) {\n                throw new ConnectException(\n                        \"Neither confirmed_flush_lsn nor restart_lsn could be found\");\n            }\n        }\n\n        return confirmedFlushedLsn;\n    }\n\n    private Lsn parseRestartLsn(String slotName, String pluginName, String database, ResultSet rs) {\n        Lsn restartLsn = null;\n        try {\n            restartLsn = tryParseLsn(slotName, pluginName, database, rs, \"restart_lsn\");\n        } catch (SQLException e) {\n            throw new ConnectException(\"restart_lsn could be found\");\n        }\n\n        return restartLsn;\n    }\n\n    private Lsn tryParseLsn(\n            String slotName, String pluginName, String database, ResultSet rs, String column)\n            throws ConnectException, SQLException {\n        Lsn lsn = null;\n\n        String lsnStr = rs.getString(column);\n        if (lsnStr == null) {\n            return null;\n        }\n        try {\n            lsn = Lsn.valueOf(lsnStr);\n        } catch (Exception e) {\n            throw new ConnectException(","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-opengauss/src/main/java/io/debezium/connector/postgresql/connection/PostgresConnection.java#L385-L421","documentation":"parseRestartLsn reads restart_lsn from pg_replication_slots for the slot and throws this ConnectException if the column read fails (note the message omits 'not' — it means restart_lsn could NOT be found). restart_lsn is required as the fallback position when confirmed_flush_lsn is unavailable, so its absence is fatal.","triggerScenarios":"tryParseLsn's SELECT of restart_lsn throws SQLException for the slot row — the slot was dropped between queries, the user cannot read pg_replication_slots, or the column is absent on this server version.","commonSituations":"Monitoring/HA tooling removed the slot mid-startup; restricted DB user; older OpenGauss builds with a trimmed pg_replication_slots view.","solutions":["Confirm the slot still exists and exposes restart_lsn: SELECT slot_name, restart_lsn FROM pg_replication_slots WHERE slot_name = '<slot>';","Grant the connector user REPLICATION / read access to pg_catalog.pg_replication_slots.","Stop external tooling from dropping the slot while the connector starts.","Ensure wal_level=logical and that the slot was created as a logical (not physical) slot, since restart_lsn semantics differ."],"exampleFix":"// before: unprivileged user triggers SQLException on restart_lsn\n-- after\nALTER USER cdc_user WITH REPLICATION;\nGRANT SELECT ON pg_catalog.pg_replication_slots TO cdc_user;","handlingStrategy":"validation","validationCode":"SELECT restart_lsn FROM pg_replication_slots WHERE slot_name = 'seatunnel_slot' AND slot_type = 'logical'; -- row must exist with a non-null restart_lsn","typeGuard":null,"tryCatchPattern":"try {\n    connection.restartLsn(slotName);\n} catch (ConnectException e) {\n    // slot vanished or is unreadable: recreate before retry\n}","preventionTips":["Grant SELECT on pg_catalog.pg_replication_slots to the connector user.","Verify the slot is logical, not physical.","Lock slot lifecycle management to the connector tooling only."],"tags":["cdc","postgres","replication-slot","lsn"],"backgroundTag":"database-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}