Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@stelfrag
Copy link
Collaborator

@stelfrag stelfrag commented Dec 3, 2025

Summary
  • Handle race condition where multiple writers can obtain the same datafile and exceed the allowed max datafile size

Summary by cubic

Prevent datafiles from exceeding the configured max size by making the check atomic and accounting for the incoming extent size before writing. This eliminates the race where multiple writers could overfill a file.

  • Bug Fixes
    • Check datafile capacity using pos + extent_size against the target size.
    • Lock the mutex at the start of datafile selection to make the check-and-create step atomic.
    • Pass the real I/O size to the selection logic to ensure accurate capacity checks.

Written for commit 02a6308. Summary will update automatically on new commits.

@stelfrag stelfrag marked this pull request as ready for review December 3, 2025 08:44
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Copy link
Contributor

@thiagoftsm thiagoftsm left a comment

Choose a reason for hiding this comment

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

PR is working as expected, LGTM!

@stelfrag stelfrag merged commit a26cabb into netdata:master Dec 3, 2025
118 of 119 checks passed
@stelfrag stelfrag deleted the fix_datafile_size_check branch December 3, 2025 17:21
stelfrag added a commit to stelfrag/netdata that referenced this pull request Dec 5, 2025
Enhance datafile size check to prevent overflow during writes

(cherry picked from commit a26cabb)
@stelfrag stelfrag mentioned this pull request Dec 5, 2025
Ferroin pushed a commit that referenced this pull request Dec 15, 2025
Enhance datafile size check to prevent overflow during writes

(cherry picked from commit a26cabb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants