Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(data-warehouse): drop the keyset full-load compatibility path (#110672)

Tom Owersdf4ff5cef091
diff --git a/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py b/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py
index f466a14fec1e..5d2401092bc1 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/external_data_job.py
@@ -893,7 +893,6 @@ class ExternalDataJobWorkflow(PostHogWorkflow):
statistics_needed = False
person_property_sync_enabled = False
fast_return_eligible = False
- keyset_full_load_enabled = False
scheduled_full_refresh = False
repartition_needed = True
billing_limit_checked = False
@@ -910,7 +909,6 @@ class ExternalDataJobWorkflow(PostHogWorkflow):
statistics_needed = create_job_result.statistics_needed
person_property_sync_enabled = create_job_result.person_property_sync_enabled
fast_return_eligible = create_job_result.fast_return_eligible
- keyset_full_load_enabled = create_job_result.keyset_full_load_enabled
scheduled_full_refresh = create_job_result.scheduled_full_refresh
repartition_needed = create_job_result.repartition_needed
billing_limit_checked = create_job_result.billing_limit_checked
@@ -981,7 +979,6 @@ class ExternalDataJobWorkflow(PostHogWorkflow):
reset_pipeline=inputs.reset_pipeline,
fast_return_eligible=fast_return_eligible,
scheduled_full_refresh=scheduled_full_refresh,
- keyset_full_load_enabled=keyset_full_load_enabled,
)
is_resumable_source = False
@@ -993,7 +990,6 @@ class ExternalDataJobWorkflow(PostHogWorkflow):
# row 0 on each of those extra attempts.
is_resumable_source = isinstance(source, ResumableSource) and source.resume_covers_run(
incremental_or_append=incremental_or_append,
- keyset_full_load_enabled=keyset_full_load_enabled,
schema_name=schema_name,
)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/attio/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/attio/source.py
index 61d836729330..14caeeb50e87 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/attio/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/attio/source.py
@@ -47,7 +47,6 @@ class AttioSource(ResumableSource[AttioSourceConfig, AttioResumeConfig]):
self,
*,
incremental_or_append: bool,
- keyset_full_load_enabled: bool = True,
schema_name: str | None = None,
) -> bool:
endpoint = ATTIO_ENDPOINTS.get(schema_name or "")
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/base.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/base.py
index b4fef33de81f..adf1e12bd7c9 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/base.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/base.py
@@ -507,7 +507,6 @@ class ResumableSource(_BaseSource[ConfigType], Generic[ConfigType, ResumableData
self,
*,
incremental_or_append: bool,
- keyset_full_load_enabled: bool = True,
schema_name: str | None = None,
) -> bool:
"""Whether this source's resume mechanism covers a run of this shape.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/typings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/typings.py
index a7e7f19d9582..23ee25bf47b4 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/typings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/typings.py
@@ -170,8 +170,6 @@ class SourceInputs:
# True when extraction batches should be bounded by accumulated bytes rather than by the
# sampled row count alone. Evaluated once per run alongside `fanout_warehouse_reuse`.
byte_bounded_extraction: bool = False
- # Compatibility switch for activity payloads recorded before keyset full loads became unconditional.
- keyset_full_load: bool = True
# Temporal's attempt number for this activity, starting at 1. A source can read a retry
# differently from a first run, because the first run has already shown what fails.
activity_attempt: int = 1
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/source.py
index 460242b7cea0..b8cd7680fbd8 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/intercom/source.py
@@ -64,7 +64,6 @@ class IntercomSource(ResumableSource[IntercomSourceConfig, IntercomResumeConfig]
self,
*,
incremental_or_append: bool,
- keyset_full_load_enabled: bool = True,
schema_name: str | None = None,
) -> bool:
# The companies Scroll API cannot preserve a cursor across worker hand-offs.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mongodb/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mongodb/source.py
index 643794c2c903..10e1de719827 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mongodb/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mongodb/source.py
@@ -450,7 +450,6 @@ class MongoDBSource(ResumableSource[MongoDBSourceConfig, MongoResumeConfig], Val
self,
*,
incremental_or_append: bool,
- keyset_full_load_enabled: bool = True,
schema_name: str | None = None,
) -> bool:
# The `_id` checkpoint covers only a full refresh. An incremental or append run restarts from
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py
index 4ff6113147a7..527e22dc132b 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py
@@ -103,7 +103,6 @@ class MySQLSource(
self,
*,
incremental_or_append: bool,
- keyset_full_load_enabled: bool = True,
schema_name: str | None = None,
) -> bool:
# Keyset seeking is a full-load path, and it is the default one here. An incremental run
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/postgres.py b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/postgres.py
index 3db90c0521d9..35fb29fc55db 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/postgres.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/postgres.py
@@ -3565,7 +3565,6 @@ def postgres_source(
byte_bounded_extraction: bool = False,
activity_attempt: int = 1,
resumable_source_manager: Optional[ResumableSourceManager[KeysetResumeState]] = None,
- keyset_full_load_enabled: bool = True,
) -> SourceResponse:
table_name = table_names[0]
if not table_name:
@@ -3958,13 +3957,12 @@ def postgres_source(
# reason stay measurable.
logger.info(f"Postgres keyset resume unavailable: reason={keyset.reason}")
- # New full loads over a seekable key page by keyset, which lets a drained worker resume rather
- # than restart the read. A False value can only come from an activity payload recorded before
- # rollout completed; honoring it keeps that activity on one cursor mode across worker versions.
- # The read-replica retry fallback remains unchanged for those old payloads.
- takes_keyset_path = keyset.columns is not None and (
- keyset_full_load_enabled or (activity_attempt > 1 and using_read_replica)
- )
+ # Every full load over a seekable key pages by keyset, which lets a drained worker resume rather
+ # than restart the read. It also avoids the read-replica failure of a server cursor: the cursor
+ # idles in an open transaction through every Delta merge, and a replica that cancels reads during
+ # that idle kills each attempt at the same place. Seeking pages in autocommit, so nothing idles
+ # and a conflict resumes at the last key.
+ takes_keyset_path = keyset.columns is not None
can_checkpoint = resumable_source_manager is not None and keyset.checkpointable
def keyset_resume_key(key_length: int) -> tuple[Any, ...] | None:
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.py
index 386ab135db4c..ed1d304e5c63 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.py
@@ -415,12 +415,11 @@ class PostgresSource(
self,
*,
incremental_or_append: bool,
- keyset_full_load_enabled: bool = True,
schema_name: str | None = None,
) -> bool:
- # Old activity payloads that recorded False keep the server-cursor path during the rolling
- # deploy, so only keyset full loads receive the resumable retry budget.
- return not incremental_or_append and keyset_full_load_enabled
+ # Keyset seeking is a full-load path, so an incremental or xmin run resumes from its watermark
+ # and keeps the incremental budget.
+ return not incremental_or_append
def get_resumable_source_manager(self, inputs: SourceInputs) -> ResumableSourceManager[KeysetResumeState]:
return ResumableSourceManager[KeysetResumeState](inputs, KeysetResumeState)
@@ -2051,7 +2050,6 @@ class PostgresSource(
byte_bounded_extraction=inputs.byte_bounded_extraction,
activity_attempt=inputs.activity_attempt,
resumable_source_manager=resumable_source_manager,
- keyset_full_load_enabled=inputs.keyset_full_load,
)
except SqlclientUnableToEstablishSqlconnection as e:
# A setup query (e.g. the duplicate-PK probe) touched a postgres_fdw foreign table and the
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py
index aebbe01aec94..7154977f678b 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py
@@ -4183,7 +4183,6 @@ class TestChunkedRereadAfterRecoveryConflict:
is_xmin: bool = False,
activity_attempt: int = 1,
resumable_source_manager: Any = None,
- keyset_full_load_enabled: bool = True,
pages_to_take: int | None = None,
arrow_schema: pa.Schema | None = None,
column_type: str = "integer",
@@ -4247,7 +4246,6 @@ class TestChunkedRereadAfterRecoveryConflict:
is_xmin=is_xmin,
activity_attempt=activity_attempt,
resumable_source_manager=resumable_source_manager,
- keyset_full_load_enabled=keyset_full_load_enabled,
)
self.last_response = response
pages = cast(Iterator[Any], iter(cast(Iterable[Any], response.items())))
@@ -4468,22 +4466,6 @@ class TestChunkedRereadAfterRecoveryConflict:
assert self.last_response.supports_resume is True
assert manager.save_state.call_count > 0
- def test_an_old_flag_off_activity_keeps_the_server_cursor(self):
- manager = MagicMock()
- manager.can_resume.return_value = False
-
- self._read_ids(
- should_use_incremental_field=False,
- rows_before_conflict=0,
- primary_keys=["id"],
- activity_attempt=1,
- resumable_source_manager=manager,
- keyset_full_load_enabled=False,
- )
-
- assert self.last_response.supports_resume is False
- manager.save_state.assert_not_called()
-
def test_an_incremental_run_does_not_seek(self):
# Seeking is the full-load path only. An incremental run already resumes from its watermark,
# and seeking it would read the table twice.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/singular/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/singular/source.py
index e858e3e22b2a..f38629f616bd 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/singular/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/singular/source.py
@@ -81,7 +81,6 @@ class SingularSource(ResumableSource[SingularSourceConfig, SingularResumeConfig]
self,
*,
incremental_or_append: bool,
- keyset_full_load_enabled: bool = True,
schema_name: str | None = None,
) -> bool:
# A lookup table is one request, so a retry has nothing to continue from.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/source.py
index 2b13225f97f4..bd7884804fb8 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/zendesk/source.py
@@ -68,7 +68,6 @@ class ZendeskSource(ResumableSource[ZendeskSourceConfig, ZendeskResumeConfig]):
self,
*,
incremental_or_append: bool,
- keyset_full_load_enabled: bool = True,
schema_name: str | None = None,
) -> bool:
endpoint = ZENDESK_ENDPOINTS.get(schema_name or "")
diff --git a/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/test_import_data.py b/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/test_import_data.py
index d684e387b9e4..b5f3e45a12c8 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/test_import_data.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/tests/e2e/test_import_data.py
@@ -179,7 +179,6 @@ async def test_job_inputs_with_whitespace(activity_environment, team, **kwargs):
byte_bounded_extraction=False,
activity_attempt=1,
resumable_source_manager=mock.ANY,
- keyset_full_load_enabled=True,
)
@@ -235,7 +234,6 @@ async def test_postgres_source_without_ssh_tunnel(activity_environment, team, **
byte_bounded_extraction=False,
activity_attempt=1,
resumable_source_manager=mock.ANY,
- keyset_full_load_enabled=True,
)
@@ -303,7 +301,6 @@ async def test_postgres_source_with_ssh_tunnel_disabled(activity_environment, te
byte_bounded_extraction=False,
activity_attempt=1,
resumable_source_manager=mock.ANY,
- keyset_full_load_enabled=True,
)
@@ -386,7 +383,6 @@ async def test_postgres_source_with_ssh_tunnel_enabled(activity_environment, tea
byte_bounded_extraction=False,
activity_attempt=1,
resumable_source_manager=mock.ANY,
- keyset_full_load_enabled=True,
)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/create_job_model.py b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/create_job_model.py
index 24b5b1048b7e..e0a63c91c553 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/create_job_model.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/create_job_model.py
@@ -329,10 +329,6 @@ class CreateExternalDataJobModelActivityOutputs:
# Computed here because this activity already resolves the repair gates the decision needs.
# Defaults False so a payload from a worker that predates the field takes the full path.
fast_return_eligible: bool = False
- # Always True for new jobs so workers from either release seek during a rolling deploy. The new
- # workflow also preserves an explicit False from an older recorded result. Remove after this
- # release is fully deployed.
- keyset_full_load_enabled: bool = True
# The workflow hands this to the import, which resets only while the schema is still due. Nothing is
# stored on the schema, so a run that stops before the wipe leaves no reset behind for later runs.
scheduled_full_refresh: bool = False
diff --git a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.py b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.py
index a227a6d50122..40d53036163d 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.py
@@ -117,10 +117,6 @@ class ImportDataActivityInputs:
fast_return_eligible: bool = False
# Kept apart from `reset_pipeline`, which every retry would read again and wipe the table again.
scheduled_full_refresh: bool = False
- # Fixed for the job lifetime so activity retries cannot switch cursor modes while old and new
- # workers overlap. Defaults True for new payloads; an old payload that recorded False keeps the
- # server-cursor path on both worker versions. Remove after this release is fully deployed.
- keyset_full_load_enabled: bool = True
@property
def properties_to_log(self) -> dict[str, Any]:
@@ -570,7 +566,6 @@ async def _import_data_with_reporting(inputs: ImportDataActivityInputs, logger:
api_version=new_source.resolve_api_version(schema.api_version or model.pipeline.api_version),
fanout_warehouse_reuse=fanout_warehouse_reuse,
byte_bounded_extraction=byte_bounded_extraction,
- keyset_full_load=inputs.keyset_full_load_enabled,
activity_attempt=activity.info().attempt if activity.in_activity() else 1,
source_cursor=source_cursor_manager,
)