Source MSSQL fails migrating empty legacy stream state when first records arrive
type/bugconnectors/source/mssqlteam/db-dw-sources
A Slack thread reported a Source MSSQL edge case where streams that were empty during migration from the legacy MSSQL connector retained legacy stream state and later failed when the first records arrived.
Slack context: https://app.slack.com/client/T02TET08MDH/C0B6NTCHFPW
Requested by: Rodi (rodi@airbyte.io)
Note: Customer/workspace/connection identifiers are intentionally omitted because this is a public issue.
### Issue category
Confirmed connector bug, likely minor severity because the affected connection was unblocked by refreshing the streams, but the connector should handle this state migration path automatically.
### What happened
- A connection was migrated from the legacy MSSQL source connector to the new MSSQL source connector.
- Two selected tables were empty at migration time.
- Because the tables were empty, their per-stream state apparently did not migrate and remained on legacy state with `"version": 2`.
- On May 26, both previously-empty streams received a single row.
- The next sync hit an edge case while moving those streams to `"version": 3` state with no previous cursor value.
- Refreshing both streams moved them to correct `"version": 3` state and unblocked the connection.
### Expected behavior
The new MSSQL connector should gracefully handle per-stream state migration from `"version": 2` to `"version": 3` when:
- the stream had no records at migration time,
- there is no previous cursor value in state, and
- the stream later receives its first record.
### Actual behavior
The connector appears to fail this state migration path instead of initializing the missing cursor/state for the first observed record.
### Suggested investigation
- Reproduce with an MSSQL incremental stream that is empty during legacy-to-new connector migration, preserving legacy `"version": 2` stream state.
- Insert the first row after migration.
- Confirm the next sync migrates to `"version": 3` state without requiring a stream refresh.
- Add regression coverage for the no-previous-cursor-value path.
### Workaround observed
Refreshing the affected streams moved them to `"version": 3` state and unblocked syncs.
---
[Devin session](https://app.devin.ai/sessions/dbc6dfdd3b5141399df1b722447c6d86)
---
**Internal Tracking:** https://github.com/airbytehq/oncall/issues/12733
3 条评论