{"record":{"id":"b9714c9d4386b9a0","repo":"apache/seatunnel","slug":"no-maximum-lsn-recorded-in-db2-please-ensure-that","errorCode":null,"errorMessage":"No maximum LSN recorded in Db2. Please ensure that the Db2 capture agent is running","messagePattern":"No maximum LSN recorded in Db2\\. Please ensure that the Db2 capture agent is running","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/reader/fetch/transactionlog/Db2TransactionLogFetchTask.java","lineNumber":188,"sourceCode":"            Metronome metronome = Metronome.sleeper(pollInterval, clock);\n            Queue<Db2ChangeTable> schemaChangeCheckpoints =\n                    new PriorityQueue<>((x, y) -> x.getStopLsn().compareTo(y.getStopLsn()));\n            try {\n                AtomicReference<Db2ChangeTable[]> tablesSlot =\n                        new AtomicReference<>(getCdcTablesToQuery(partition, offsetContext));\n                TxLogPosition lastProcessedPositionOnStart = offsetContext.getChangePosition();\n                long lastProcessedEventSerialNoOnStart = offsetContext.getEventSerialNo();\n                LOG.info(\n                        \"Last position recorded in offsets is {}[{}]\",\n                        lastProcessedPositionOnStart,\n                        lastProcessedEventSerialNoOnStart);\n\n                TxLogPosition lastProcessedPosition = lastProcessedPositionOnStart;\n                boolean shouldIncreaseFromLsn = offsetContext.isSnapshotCompleted();\n                while (context.isRunning()) {\n                    Lsn currentMaxLsn = dataConnection.getMaxLsn();\n                    if (!currentMaxLsn.isAvailable()) {\n                        LOG.warn(\n                                \"No maximum LSN recorded in Db2. Please ensure that the Db2 capture agent is running\");\n                        metronome.pause();\n                        continue;\n                    }\n                    if (currentMaxLsn.equals(lastProcessedPosition.getCommitLsn())\n                            && shouldIncreaseFromLsn) {\n                        metronome.pause();\n                        continue;\n                    }\n\n                    Lsn fromLsn =\n                            lastProcessedPosition.getCommitLsn().isAvailable()\n                                            && shouldIncreaseFromLsn\n                                    ? dataConnection.incrementLsn(\n                                            lastProcessedPosition.getCommitLsn())\n                                    : lastProcessedPosition.getCommitLsn();\n                    shouldIncreaseFromLsn = true;\n","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/reader/fetch/transactionlog/Db2TransactionLogFetchTask.java#L170-L206","documentation":"During the Db2 incremental (LSN-based) streaming phase, Db2TransactionLogFetchTask.execute polls dataConnection.getMaxLsn(); if Db2 reports no available maximum LSN, meaning the change-data capture agent has not recorded any change data, the task logs this warning, pauses via metronome, and continues polling in a loop instead of failing.","triggerScenarios":"The streaming loop runs while the Db2 ASN capture agent is stopped, not started for the monitored database, has crashed, or is registered but has captured nothing yet, so getMaxLsn() returns an unavailable Lsn.","commonSituations":"Db2 capture agent never started after enabling CDC on the tables; capture program stopped for maintenance or crashed; CDC enabled but capture not registered for the database being read; freshly provisioned CDC setup with no changes captured yet.","solutions":["Start the Db2 capture/ASN capture agent on the Db2 server (e.g. start the ASN capture program / asnqccmd START) so it records LSNs.","Verify table registrations and capture status in SYSIBM replication tables (e.g. IBMQREP_CAPPARMS, capture status) and re-register tables if needed.","Check the capture agent logs for crashes and restart it after any Db2 maintenance window.","Confirm your connector config (database/server) points at the instance where capture actually runs; the task resumes automatically once an LSN becomes available."],"exampleFix":"-- before: capture agent stopped, connector loops on 'No maximum LSN recorded in Db2'\n-- after: start the capture agent on the Db2 server\ndb2start\nasnqccmd START CAPTURE SERVER=<DB> CAPTURE_SCHEMA=ASN\n-- verify registrations exist so LSNs are recorded\nSELECT * FROM SYSIBM.IBMQREP_CAPPARMS;","handlingStrategy":"retry","validationCode":"-- verify the capture agent is running before enabling incremental streaming\nSELECT CAPTURE_STATUS FROM SYSIBM.IBMQREP_CAPPARMS;\n-- and confirm tables are registered for capture","typeGuard":"null","tryCatchPattern":"// the task itself retries via metronome.pause(); wrap the streaming phase with a bounded alert\nint noLsnWarnings = 0;\nwhile (!maxLsnAvailable()) {\n    if (++noLsnWarnings > 30) {\n        alert(\"Db2 capture agent not producing LSNs — check ASN capture agent\");\n    }\n    pause(pollInterval);\n}","preventionTips":["Ensure the Db2 ASN capture agent is started and registered for your tables before switching to incremental reads.","Monitor capture-agent health (SYSIBM capture tables) with external alerting.","Restart the capture agent after Db2 maintenance windows or crashes.","Point the connector at the Db2 instance where capture actually runs so LSNs are available."],"tags":["db2","cdc","lsn","capture-agent"],"backgroundTag":"empty-result-set","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}