fix(data-imports): disable automatic delta-rs log cleanup on writes/merges - #74594
fix(data-imports): disable automatic delta-rs log cleanup on writes/merges#74594Gilbert09 wants to merge 2 commits into
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Hey @Gilbert09! 👋 It looks like your git author email on this PR isn't your
You can fix it for this repo with: git config user.email "you@posthog.com"Or set it globally with |
5cdca53 to
dda00bd
Compare
There was a problem hiding this comment.
Contained bug fix disabling a delta-rs post-commit log-cleanup hook that was failing merges due to an S3 response-parsing mismatch; change is well-tested (4 new regression tests plus e2e assertions), author is on the owning team, and it doesn't touch schema, API contracts, auth, billing, or CI/deploy surfaces.
- Author wrote 0% of the modified lines and has 10 merged PRs in these paths (familiarity MODERATE).
- 👍 on the PR from hex-security-app[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 16L, 1F substantive, 107L/3F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1c-medium (107L, 3F, single-area, fix) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ 545937f · reviewed head dda00bd |
dda00bd to
5423013
Compare
New commits pushed (delta classified non_linear_history) — stamphog approval dismissed; re-review running automatically.
There was a problem hiding this comment.
Contained fix disabling an unused delta-rs log-cleanup hook to avoid a spurious post-commit error; diff matches the description exactly, is covered by new regression tests plus updated e2e assertions, and the author is on the owning team for these files.
- Author wrote 0% of the modified lines and has 13 merged PRs in these paths (familiarity MODERATE).
- 👍 on the PR from hex-security-app[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 15L, 1F substantive, 106L/3F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1c-medium (106L, 3F, single-area, fix) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ 30ad54b · reviewed head 5423013 |
5423013 to
f4267cb
Compare
New commits pushed (delta classified non_linear_history) — stamphog approval dismissed; re-review running automatically.
There was a problem hiding this comment.
Contained, well-tested pipeline reliability fix by an owning-team author; disables a non-essential delta-rs cleanup hook that was causing spurious commit failures, with regression tests at every call site and no risky-territory surface (no schema/API/auth/billing/CI changes).
- Author wrote 0% of the modified lines and has 18 merged PRs in these paths (familiarity MODERATE).
- 👍 on the PR from hex-security-app[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 16L, 1F substantive, 107L/3F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1c-medium (107L, 3F, single-area, fix) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ 0e33e42 · reviewed head f4267cb |
🤖 CI report
|
|
Retaining stamphog approval — delta since last review classified as |
…erges Every delta-rs write and merge commit runs a post-commit hook that, per table defaults, batch-deletes expired `_delta_log` JSON files once a commit's history crosses the retention window. That cleanup uses the same object_store bulk `DeleteObjects` call our storage backend can answer with a response shape delta-rs's XML parser doesn't recognize, failing the whole commit even though the write itself already succeeded. We don't rely on this automatic cleanup, so disable it explicitly on every write and merge in `delta_table_helper.py`. Co-Authored-By: PostHog Code Generated-By: PostHog Code Task-Id: 710c9b62-30ba-4ac7-b606-27fce571ea6b
…new post_commithook_properties kwarg CI caught this: the previous commit added post_commithook_properties to every delta-rs write/merge call, but several e2e tests assert exact-equality on the kwargs dict passed to write_deltalake/merge, so they failed on the new key. Add it to each expected dict. Generated-By: PostHog Code Task-Id: 710c9b62-30ba-4ac7-b606-27fce571ea6b
e372eed to
f97757c
Compare
|
Added the 🦉 via talyn.dev |
Problem
Error tracking surfaced an
OSErrorfrom the data-imports pipeline:Error tracking issue
The stack trace traces through
write_to_deltalake→_do_merge→ delta-rs'sTableMerger.execute(), i.e. it fires inside an otherwise-successfulMERGEcommit, not during our own file handling.Root cause
delta-rs runs a post-commit hook after every write/merge commit. By table default (
delta.enableExpiredLogCleanup=true, 30-daylogRetentionDuration), once a table's commit history crosses the retention window that hook batch-deletes expired_delta_logJSON files via the object_store crate's bulkDeleteObjectsAPI — the same call class thatTRANSIENT_OBJECT_STORE_ERRORSalready guards against elsewhere in this file foris_deltatable()/_purge_s3_prefix.Our storage backend can return a
DeleteObjectsresponse in a shape delta-rs's XML deserializer doesn't recognize, which fails the whole.execute()call even though the actual merge/write already committed. This only shows up once a table's log history passes the retention threshold, which matches this being a first-occurrence error on an established table rather than something hit on every sync.Changes
We don't read
_delta_loghistory ourselves and don't rely on delta-rs's automatic cleanup, so this disables it explicitly (post_commithook_properties=PostCommitHookProperties(cleanup_expired_logs=False)) on every write and merge call indelta_table_helper.py— both merge branches (partitioned/unpartitioned), the shared_write_deltalakehelper, and the SCD2 close-merge + append write. Checkpoint creation is left untouched (harmless, unrelated to the bug).How did you test this code?
Added 4 regression tests in
TestPostCommitHookDisablesLogCleanupassertingpost_commithook_properties=DISABLE_AUTO_LOG_CLEANUPis passed to each of the 5 delta-rs write/merge call sites (full-refresh write, partitioned merge, unpartitioned merge, SCD2 close-merge, SCD2 append write). Verified these tests fail with anImportErrorwhen the fix is reverted, confirming they exercise the actual code path. Ran the fulltest_delta_table_helper.pysuite (uv run pytest) — 70 passing, plus 4 pre-existing failures unrelated to this change (they require a localobjectstorage/SeaweedFS service not available in this sandbox, and fail identically on master). Also ranruff check,ruff format --check, and a repo-widemypy --cache-fine-grained .— all clean.Docs update
No user-facing behavior or API changed; no doc update needed.
🤖 Agent context
Autonomy: Fully autonomous
I (Claude, via PostHog Code) triaged this error-tracking issue end to end: pulled the stack trace and event properties from error tracking, read
delta_table_helper.pyand the pipeline_v3 batch consumer's retry classification (NON_RETRYABLE_ERROR_PATTERNS) to understand the call path, then inspected the installeddeltalake1.6.1 package source directly to findPostCommitHookPropertiesand confirm the post-commit-hook mechanism as the root cause, since no GitHub issue for this exact error string exists upstream.Searched open PRs (by exception type, message phrase, module path, and the maintainer's own open PRs) before starting — found related-but-distinct PRs (#74388, #69306, #74541) touching the same file for different failure modes (credential blips, maintenance-op retries, table-reuse), none overlapping this post-commit-hook fix.