Skip to content

Bound logs collector memory to avoid ClickHouse INSERT spiral#67

Merged
kalabukdima merged 1 commit into
mainfrom
fix-memory-usage
Jun 29, 2026
Merged

Bound logs collector memory to avoid ClickHouse INSERT spiral#67
kalabukdima merged 1 commit into
mainfrom
fix-memory-usage

Conversation

@kalabukdima

Copy link
Copy Markdown
Collaborator

A failed oversized INSERT left the last timestamp unadvanced, so each round re-requested the same logs plus new ones, growing the next INSERT indefinitely.

  • Cap buffered logs by estimated memory; drop excess (re-collected later)
  • Dump in memory-bounded chunks so no single INSERT can be too large

Note that after this change some logs may end up never being collected if they were dropped and there was another log with the same timestamp.

@kalabukdima kalabukdima requested a review from define-null June 29, 2026 16:54
@kalabukdima kalabukdima self-assigned this Jun 29, 2026
A failed oversized INSERT left the watermark unadvanced, so each round
re-requested the same logs plus new ones, growing the next INSERT until
it could never succeed.

- Cap buffered logs by estimated memory; drop excess (re-collected later)
- Dump in memory-bounded chunks so no single INSERT can be too large

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@define-null define-null left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kalabukdima kalabukdima merged commit 9195818 into main Jun 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants