Missed records not backfilling
# ask-ai
c
Missed records not backfilling
k
Airbyte offers the option to backfill new or renamed columns as part of the sync process. This means that anytime a new column is detected through the auto-propagation of schema changes, Airbyte will sync the entire stream again so that all values in the new columns will be completely filled, even if the row was not updated. If this option is not enabled, only rows that are updated as part of the regular sync will be populated with a value. This feature will only perform the backfill when
Detect and propagate schema changes
is set to
Propagate all changes
or
Propagate columns changes only
and Airbyte detects the schema change as part of a sync. Refreshing the schema manually and applying schema changes will not allow the backfill to occur [[source](https://docs.airbyte.com/using-airbyte/schema-change-management#backfill-new-or-renamed-columns)]. However, if you are experiencing missing records that are not being backfilled, it could be due to a variety of reasons. For instance, if the source API is unreliable, you might want to use checkpoint state to ensure data is not lost between syncs [[source](https://discuss.airbyte.io/t/1420)]. If you are using Salesforce as a source, you might need to reset the stream and sync a historical backfill to pull in all the updated values of the field if the formula of a field changes in Salesforce and no other field on the record is updated [[source](https://docs.airbyte.com/integrations/sources/salesforce#syncing-formula-fields)]. If you are still experiencing issues, it would be best to open a new topic on the Airbyte forum or GitHub issues to get further assistance from the community or the Airbyte team [[source](https://discuss.airbyte.io/t/418)].
c
@kapa.ai How do I use the checkpoint state?
k
In Airbyte, checkpointing state is a way to control when the state is saved while reading data from a connector. This is particularly useful for incremental syncs, allowing a source to pick up where it left off in case of interruptions. There are two ways to implement checkpointing: 1. Interval-based checkpointing: This method saves the state after a certain number of records have been output by the connector. For example, if the interval is set to 100, the state is saved after reading 100 records, then 200, 300, and so on. This method requires that records are output in ascending order with regards to the cursor field. You can implement interval-based checkpointing by setting the
Stream.state_checkpoint_interval
property. Here's an example:
Copy code
python class MyAmazingStream(Stream):     # Save the state every 100 records     state_checkpoint_interval = 100
(Source: [Airbyte Documentation](https://docs.airbyte.com/connector-development/cdk-python/incremental-stream#checkpointing-state)) 2. Stream Slices: This method is not explicitly mentioned in the provided sources, but it's another way to handle checkpointing in Airbyte. Remember, the state is checkpointed after successful read of a stream slice or after reading a batch of records corresponding to
state_checkpoint_interval
. This helps avoid re-reading already successfully synced data. For more detailed information, you can refer to the [Airbyte Protocol Documentation](https://docs.airbyte.com/understanding-airbyte/airbyte-protocol#state--source).
c
@kapa.ai Why is xmin replication more reliable than user defined cursor?
k
A message from kapa.ai
The xmin replication method in Postgres is considered more reliable than the standard method with a user-defined cursor for several reasons: 1. Cursorless Syncs: The xmin replication method allows for cursorless syncs. This means you can set up Standard Replication to sync new or updated rows without explicitly choosing a cursor for incremental replication. This is particularly useful when there isn't a well-defined cursor candidate to use for Standard incremental mode. The xmin system column, available in all Postgres databases, is used to track inserts and updates to your source data ([source](https://docs.airbyte.com/integrations/sources/postgres#postgres-replication-methods)). 2. Row-level Granularity: The xmin column is stored at the row level. This means that a row will still be synced if it had been modified, regardless of whether the modification corresponded to the subset of columns the user is interested in ([source](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#xmin-limitations)). However, it's important to note that the xmin replication method also has some limitations. For instance, it cannot support row deletions, requires a full table scan which can lead to poor performance, and has an issue with Transaction ID (XID) wraparound which can lead to resyncing data that had already been synced ([source](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#xmin-limitations)). In cases where these limitations are a concern, the CDC (Change Data Capture) replication method is recommended. It uses logical replication of the Postgres write-ahead log (WAL) to incrementally capture deletes using a replication plugin ([source](https://docs.airbyte.com/integrations/sources/postgres#postgres-replication-methods)).
c
@kapa.ai WHY IS THIS error occurring? java.lang.RuntimeException: Unknown state type: xmin
k
A message from kapa.ai
The error message
java.lang.RuntimeException: Unknown state type: xmin
suggests that there's an issue with the xmin state type during the sync process. This error might occur if the system is unable to retrieve the raw state due to some unsupported operations or configurations. In the context of Airbyte and Postgres, the xmin system column is used for tracking inserts and updates to your source data. However, there are some notable limitations associated with the xmin replication method, such as unsupported DDL operations, performance issues due to full table scans, and issues with Transaction ID (XID) wraparound ([source](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#xmin-limitations)). If you're encountering this error after an Airbyte upgrade, it could be due to some incompatibility or issue with the Postgres connector version or the configuration of the sync process ([source](https://github.com/airbytehq/airbyte/issues/30998)). To troubleshoot this issue, you might want to: 1. Check the version of your Postgres connector and consider updating it if necessary. 2. Review your sync configurations, particularly those related to the xmin system column and incremental sync. 3. If the issue persists, consider switching to a different replication method, such as CDC replication, especially if your database is experiencing Xmin wraparound ([source](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#xmin-wraparound)). Remember to always backup your data and test any changes in a controlled environment before applying them to your production system.
c
@kapa.ai I am using a user defined cursor for my update method. why am I getting this xmin error? java.lang.RuntimeException: Unknown state type: xmin
k
A message from kapa.ai
The error message
java.lang.RuntimeException: Unknown state type: xmin
suggests that there's an issue with the xmin state type during the sync process. This error might occur if the system is unable to retrieve the raw state due to some unsupported operations or configurations. In the context of Airbyte and Postgres, the xmin system column is used for tracking inserts and updates to your source data. However, there are some notable limitations associated with the xmin replication method, such as unsupported DDL operations, performance issues due to full table scans, and issues with Transaction ID (XID) wraparound ([source](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#xmin-limitations)). If you're encountering this error after an Airbyte upgrade, it could be due to some incompatibility or issue with the Postgres connector version or the configuration of the sync process ([source](https://github.com/airbytehq/airbyte/issues/30998)). To troubleshoot this issue, you might want to: 1. Check the version of your Postgres connector and consider updating it if necessary. 2. Review your sync configurations, particularly those related to the xmin system column and incremental sync. 3. If the issue persists, consider switching to a different replication method, such as CDC replication, especially if your database is experiencing Xmin wraparound ([source](https://docs.airbyte.com/integrations/sources/postgres/postgres-troubleshooting#xmin-wraparound)). Remember to always backup your data and test any changes in a controlled environment before applying them to your production system.