Commit ae2341e
fix(clickhouse): add opt-out for staging cleanup after QRep flow
PR #4200 (StagingStore abstraction) unified the avro upload and staging
cleanup paths onto the staging store's real bucket prefix. As a side
effect, CleanupQRepFlow now always deletes staging avro files once a
ClickHouse snapshot/QRep flow completes.
Previously cleanup keyed off config.StagingPath, which is empty for
ClickHouse mirrors that don't set SnapshotStagingPath (they get their
bucket from PEERDB_CLICKHOUSE_AWS_S3_BUCKET_NAME), so the prefix guard
`strings.HasPrefix(stagingPath, "s3://")` was false and cleanup was a
no-op. Staging avro files were effectively retained. Some deployments
have downstream pipelines that consume those files, and the upgrade
silently broke them by deleting the files as soon as the mirror
completed.
Keep cleanup as the default (it's the correct behavior and avoids
unbounded staging growth), but add PEERDB_CLICKHOUSE_SKIP_STAGING_CLEANUP
to opt out and retain staging artifacts.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 8d99a2a commit ae2341e
2 files changed
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
47 | 59 | | |
48 | 60 | | |
49 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
201 | 210 | | |
202 | 211 | | |
203 | 212 | | |
| |||
758 | 767 | | |
759 | 768 | | |
760 | 769 | | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
761 | 774 | | |
762 | 775 | | |
763 | 776 | | |
| |||
0 commit comments