hi <@U04S8PLJWMT> we are seeing that our replicati...
# ask-ai
a
hi @kapa.ai we are seeing that our replications to Redshift for the COPY query there is a 5 to 7 secconds of lock wait time, sometime a bit higher. Do you know if this may lead to any error in connection from Postgres?
k
Based on the available knowledge sources, there is no explicit mention of Redshift COPY query lock wait times directly causing connection errors from Postgres. However, several related issues are documented: - Connection errors between Airbyte and Postgres can occur due to timeouts, resource constraints, or issues with replicas, but these are not directly tied to lock wait times on the Redshift side. For example, connection resets and timeouts are often related to database load, network issues, or hardcoded timeout values in the connector, rather than downstream lock waits in Redshift [[source](https://discuss.airbyte.io/t/1715)]. - Performance considerations for Redshift are mentioned, and cluster scaling issues can impact sync performance, but there is no direct link to causing Postgres connection errors [[source](https://docs.airbyte.com/integrations/destinations/redshift#performance-considerations)]. - Errors in the sync process are more commonly associated with configuration issues, timeouts, or resource limitations on either the source (Postgres) or destination (Redshift), rather than lock waits during COPY operations [[source](https://github.com/airbytehq/airbyte/issues/45381)]. In summary, while high lock wait times in Redshift COPY operations could potentially slow down the overall sync process, the knowledge sources do not explicitly state that this would cause connection errors from Postgres. If you are experiencing connection errors, it is more likely due to timeouts, resource constraints, or configuration issues on the Postgres side or within Airbyte itself. If you need to troubleshoot Postgres connection errors, reviewing timeout settings and monitoring resource usage on the Postgres server is recommended [[source](https://discuss.airbyte.io/t/1715)]. If you have specific error messages or logs, sharing those could help narrow down the root cause.
a
@kapa.ai the thing is that we tihink we are experiencing this issue: When the Postgres connector successfully reads the WAL and acknowledges it to Postgres, but the destination connector fails to consume the data, the Postgres connector will try to read the same WAL again, which may have been removed by Postgres, since the WAL record is already acknowledged
k
A message from kapa.ai
Yes, your understanding matches a scenario described in the Airbyte documentation. Specifically, under CDC incremental mode, if the Postgres connector successfully reads the WAL and acknowledges it to Postgres, but the destination connector (such as Redshift) fails to consume the data, the connector may attempt to read the same WAL again. If, in the meantime, Postgres has already removed the WAL record (since it was acknowledged), Airbyte will not be able to continue from the last offset and will trigger a full refresh sync instead. This is described as follows: > When the Postgres connector successfully reads the WAL and acknowledges it to Postgres, but the destination connector fails to consume the data, the Postgres connector will try to read the same WAL again, which may have been removed by Postgres, since the WAL record is already acknowledged. This scenario is rare, because it can happen, and currently there is no way to prevent it. The correct behavior is to perform a full refresh. [See documentation](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#troubleshooting) So, if you are seeing repeated full refreshes and the logs indicate that the saved offset is before the replication slot's confirmed_flush_lsn, this is likely the cause. Unfortunately, as per the documentation, there is currently no way to prevent this scenario, and a full refresh is the expected fallback behavior.
a
@kapa.ai is there any way to see that data has been transferred/copy into Redshift. I wanna be 100% sure this is the caus
k
A message from kapa.ai
To verify that data has actually been transferred and copied into Redshift, you can directly query the destination tables in your Redshift database. After a sync, Airbyte typically writes data into tables with names like
_airbyte_raw_<stream_name>
. You can use a SQL query such as:
Copy code
sql SELECT * FROM _airbyte_raw_<your_stream_name>;
Replace
<your_stream_name>
with the actual name of your stream. If the sync was successful, you should see records in these tables. This approach is recommended in Airbyte tutorials and documentation as a way to confirm that data has landed in the destination [[Explore incremental deduped + history synchronization](https://airbyte.com/tutorials/incremental-data-synchronization#step-7)]. Additionally, the Airbyte UI provides a Status tab for each connection, which shows sync health, and you can check the Timeline tab for sync events and errors. However, the most direct and reliable way is to query the destination tables in Redshift itself [[Set up a Connection](https://docs.airbyte.com/platform/1.7/using-airbyte/getting-started/set-up-a-connection#connection-overview)]. If you do not see any data in the expected tables, it suggests that the data was not successfully written to Redshift, which could help confirm if your issue is related to the scenario you described.
a
@kapa.ai can you explain me for dummies this log 2025-08-22 110143 info INFO main i.a.i.s.p.c.PostgresDebeziumStateUtil(extractLsn):191 Found previous partition offset PostgresPartition [sourcePartition={server=ipr_suite_db}]: {lsn_proc=418535663279416, messageType=UPDATE, lsn_commit=418535664836720, lsn=418535664836720, txId=4127655232, ts_usec=1755851438944963} 2025-08-22 110143 info INFO main i.a.i.s.p.c.PostgresDebeziumStateUtil(parseSavedOffset):171 Closing offsetStorageReader and fileOffsetBackingStore 2025-08-22 110143 info INFO main o.a.k.c.s.FileOffsetBackingStore(stop):71 Stopped FileOffsetBackingStore 2025-08-22 110143 info INFO main i.a.i.s.p.c.PostgresDebeziumStateUtil(isSavedOffsetAfterReplicationSlotLSN):69 Replication slot confirmed_flush_lsn : 418535664836720 Saved offset LSN : 418535664836720 2025-08-22 110143 info INFO main i.a.i.s.p.c.PostgresCdcCtidInitializer(getCtidInitialLoadGlobalStateManager):117 Streams to be synced via ctid (can include RFR streams) : 0 2025-08-22 110143 info INFO main i.a.i.s.p.c.PostgresCdcCtidInitializer(getCtidInitialLoadGlobalStateManager):118 Streams: 2025-08-22 110143 info INFO main i.a.i.s.p.c.PostgresDebeziumStateUtil(format):240 Initial Debezium state constructed: {"[\"ipr_suite_db\",{\"server\":\"ipr_suite_db\"}]":"{\"transaction_id\":null,\"lsn\":418538123039320,\"txId\":8422733708,\"ts_usec\":1755853303692295}"} 2025-08-22 110143 info INFO main i.a.i.s.p.PostgresUtils(isCdc):70 using CDC: true 2025-08-22 110143 info INFO main i.a.i.s.p.PostgresSource(getIncrementalIterators):508 Using ctid + CDC 2025-08-22 110143 info INFO main i.a.i.s.p.PostgresUtils(getFirstRecordWaitTime):171 First record waiting time: 300 seconds 2025-08-22 110143 info INFO main i.a.c.i.s.r.InitialLoadTimeoutUtil(getInitialLoadTimeout):44 Initial Load timeout: 28800 seconds 2025-08-22 110143 info INFO main i.a.i.s.p.c.PostgresCdcCtidInitializer(cdcCtidIteratorsCombined):149 First record waiting time: 300 seconds 2025-08-22 110143 info INFO main i.a.i.s.p.c.PostgresCdcCtidInitializer(cdcCtidIteratorsCombined):150 Initial load timeout: 8 hours 2025-08-22 110143 info INFO main i.a.i.s.p.c.PostgresCdcCtidInitializer(cdcCtidIteratorsCombined):151 Queue size: 10000 2025-08-22 110143 info INFO main i.a.i.s.p.c.PostgresDebeziumStateUtil(format):240 Initial Debezium state constructed: {"[\"ipr_suite_db\",{\"server\":\"ipr_suite_db\"}]":"{\"transaction_id\":null,\"lsn\":418538123040872,\"txId\":8422733709,\"ts_usec\":1755853303699518}"} 2025-08-22 110143 info INFO main i.a.i.s.p.PostgresUtils(shouldFlushAfterSync):78 Should flush after sync: false 2025-08-22 110143 info INFO main i.a.i.s.p.PostgresSource(toSslJdbcParamInternal):924 DISABLED toSslJdbcParam disable
k
A message from kapa.ai
Certainly! Here’s a “for dummies” explanation of the log you posted, using information from the knowledge sources: --- What’s happening in this log? 1. Found previous partition offset... - Airbyte is reading the last saved position (offset) in the Postgres WAL (Write-Ahead Log) that it processed. This includes: -
lsn_proc
,
lsn_commit
, `lsn`: These are Log Sequence Numbers, which are markers in the WAL showing where Airbyte last read. - `messageType=UPDATE`: The last change was an UPDATE. - `txId`: The transaction ID. - `ts_usec`: The timestamp in microseconds. 2. Closing offsetStorageReader and fileOffsetBackingStore - Airbyte is closing the file where it keeps track of the last WAL position it read. 3. Stopped FileOffsetBackingStore - Confirms the above step: the file used to store the offset is now closed. 4. Replication slot confirmed_flush_lsn : ... Saved offset LSN : ... - Airbyte checks if the last saved position (
Saved offset LSN
) matches the position that Postgres has confirmed as safe to remove (
confirmed_flush_lsn
). In your log, they are equal, which is good—no WAL data has been lost. 5. Streams to be synced via ctid... - Airbyte is checking which tables (streams) need to be synced using a special method (ctid). Here, it’s zero, so nothing extra to sync. 6. Initial Debezium state constructed... - Airbyte is preparing the state for the next sync, including the latest LSN and transaction info. 7. using CDC: true - Confirms that Change Data Capture (CDC) mode is being used, which means Airbyte is reading changes from the WAL, not doing a full refresh. 8. Using ctid + CDC - Airbyte is using both ctid and CDC methods for incremental sync. 9. First record waiting time: 300 seconds - Airbyte will wait up to 5 minutes for the first change record to appear. 10. Initial Load timeout: 28800 seconds - The maximum time allowed for the initial load is 8 hours. 11. Queue size: 10000 - Airbyte can buffer up to 10,000 records in memory during sync. 12. Should flush after sync: false - Airbyte decided it does not need to flush (commit) the state after this sync. 13. DISABLED toSslJdbcParam disable - SSL is disabled for the Postgres connection. --- In summary: Airbyte is starting a CDC sync from Postgres. It checks the last position it read, confirms that no WAL data has been lost, prepares to read new changes, and sets up its internal timers and buffers. Everything in this log looks normal and healthy for a CDC sync—no errors or warnings are present. If you want to know more about how Airbyte tracks WAL positions and CDC, see the [Airbyte CDC documentation](https://docs.airbyte.com/platform/understanding-airbyte/cdc).
a
@kapa.ai why this Airbyte decided it does not need to flush (commit) the state after this sync?
k
A message from kapa.ai
I'm sorry, but the knowledge sources provided do not explicitly explain why Airbyte decided it does not need to flush (commit) the state after this sync in your specific log. The available documentation describes that sources have broad latitude to decide how frequently they emit state records, and that state emission is up to the source implementation, but it does not detail the internal logic or conditions under which Airbyte chooses to flush or not flush the state in a given sync [[Airbyte Protocol: State & Checkpointing](https://docs.airbyte.com/platform/1.7/understanding-airbyte/airbyte-protocol#state--checkpointing)]. If you need a precise answer for this behavior, you may need to consult the source code for the connector or reach out to the Airbyte community for more detailed, implementation-specific guidance.