Skip to content

fix(ingester): reuse workers to bound Prometheus files - #2221

Merged
nuclearcat merged 2 commits into
kernelci:mainfrom
nuclearcat:fix/1695/persistent-ingester-workers
Nov 10, 2026
Merged

nuclearcat merged 2 commits into
kernelci:mainfrom
nuclearcat:fix/1695/persistent-ingester-workers

Conversation

@nuclearcat

Copy link
Copy Markdown
Member

Keep workers alive across cycles, acknowledge final flushes, and expose the Prometheus file count. Clean up connections, caches, and live-gauge files.

Abort on unexpected worker exits so the supervisor restarts with fresh queues and locks. Keep parent progress reads free of worker-owned locks. Preserve graceful group-signal handling and cleanup after parent loss.

Test repeated cycles, abandoned locks and retry, worker crashes, shutdown, parent loss, and retained metrics totals. All 101 focused tests pass.

Closes #1695

Keep workers alive across cycles, acknowledge final flushes, and expose the
Prometheus file count. Clean up connections, caches, and live-gauge files.

Abort on unexpected worker exits so the supervisor restarts with fresh queues
and locks. Keep parent progress reads free of worker-owned locks. Preserve
graceful group-signal handling and cleanup after parent loss.

Since a worker exit now aborts the whole command, a bad file must not raise
out of the worker: exceptions while preparing a file or building its
instances move that file to failed/ and the worker continues. A spool file
that vanishes before its batch is skipped. Only None ends a cycle, so a
stray empty batch cannot leave a stale sentinel in the persistent queue.
Pipe errors are treated as parent loss only on the control pipe itself.

Test repeated cycles, abandoned locks and retry, worker crashes, bad files,
shutdown, parent loss, and retained metrics totals. All 105 focused tests
pass.

Closes kernelci#1695
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
Flush every buffered table together before archiving submissions so killing
workers cannot lose records from an already archived file. Cover commit,
rollback, archive failure, and sibling crashes with durable process tests.

Part of kernelci#1695
Assisted-by: OpenAI Codex

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
@nuclearcat
nuclearcat force-pushed the fix/1695/persistent-ingester-workers branch from d12c8bd to 2496e13 Compare November 7, 2026 20:24
@nuclearcat

Copy link
Copy Markdown
Member Author

This change how ingester workers work:
comparison

for path in json_files[offset : offset + INGEST_FILES_BATCH_SIZE]:
try:
size = os.path.getsize(path)
except OSError:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

might be safer to go with FileNotFoundError, to avoid unrelated OSErrors that could also happen.

@alanpeixinho alanpeixinho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

overall working great.
One point of attention: when running locally, i got roughly 0.5x throughput with this version compared to main, so it might be safe to monitor the ingester.

@nuclearcat
nuclearcat added this pull request to the merge queue Nov 10, 2026
Merged via the queue into kernelci:main with commit 0d92d44 Nov 10, 2026
7 checks 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.

Improve response time in /metrics

2 participants