in_tail: drop redundant fstat() on event collection#11692
in_tail: drop redundant fstat() on event collection#11692
Conversation
The event collection path in in_tail_collect_event() performed an early fstat() only to remove the file on failure, then immediately called flb_tail_file_chunk(), which already reaches adjust_counters() and does its own fstat()-based validation and counter update. Removing the pre-check reduces one fstat() per event-driven collection cycle without changing truncation, rotation, deletion, or pending-byte handling. Those behaviors remain in the backend-specific handlers and in adjust_counters(). This change is intentionally narrow and is based on a conversation about Fluent Bit tail syscall cost with Fabian Ponce from OpenAI (@FabianPonce). Verification: - cmake -S . -B build -DFLB_TESTS_RUNTIME=On -DFLB_TESTS_INTERNAL=On - cmake --build build -j8 --target flb-rt-in_tail - ./build/bin/flb-rt-in_tail inotify_watcher_false - ./build/bin/flb-rt-in_tail db Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe change removes an upfront Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The event collection path in in_tail_collect_event() performed an early fstat() only to remove the file on failure, then immediately called flb_tail_file_chunk(), which already reaches adjust_counters() and does its own fstat()-based validation and counter update.
Removing the pre-check reduces one fstat() per event-driven collection cycle without changing truncation, rotation, deletion, or pending-byte handling. Those behaviors remain in the backend-specific handlers and in adjust_counters().
This change is intentionally narrow and is based on a conversation about Fluent Bit tail syscall cost with Fabian Ponce from OpenAI (@FabianPonce).
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit