Repository navigation
fix: suppress zero-event log noise in fs event collector - #306
Merged
deepin-bot[bot] merged 1 commit intoDec 1, 2026
Merged
deepin-bot[bot] merged 1 commit into
deepin-bot[bot] merged 1 commit into
Conversation
1. Root cause: FSEventCollector::flushCollectedEvents() and FSEventController::onFlushFinished() unconditionally emit qDebug statistics every flush cycle (default 180s), even when all event lists are empty, producing ~180 lines of meaningless log per hour 2. Fix: add a guard condition so statistics are logged only when at least one event list is non-empty; remove the "No file system events to process" log and silently return when there are no events 3. Impact: no behavior change for event processing; only redundant debug logs are suppressed when the filesystem is idle fix: 抑制文件系统事件收集器的全0事件日志噪音 1. 根因:FSEventCollector::flushCollectedEvents() 和 FSEventController::onFlushFinished() 每次 flush 周期(默认180秒) 无条件输出 qDebug 统计日志,即使所有事件列表均为空, 每小时产生约180行无意义日志 2. 方案:添加守卫条件,仅当至少一个事件列表非空时才输出统计 日志;删除"No file system events to process"日志,无事件时 静默返回 3. 影响:不影响事件处理逻辑,仅在文件系统空闲时抑制冗余调试日志 Log: Suppressed redundant debug logs when no filesystem events are collected Influence: - Verify logs are silent when the filesystem is idle - Verify event statistics still appear when files are created, deleted, modified, or moved - Confirm no regression in file indexing functionality Log: 文件系统空闲时不再输出无意义的事件收集日志 Influence: - 验证文件系统空闲时日志静默 - 验证文件创建、删除、修改、移动时统计日志正常输出 - 确认文件索引功能无回归 PMS: TASK-399323
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Johnson-zs The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideImplementationSuppress flush statistics when no events were collected, in both the collector and controller, while retaining logging for non-empty batches.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Author
|
/forcemerge |
deepin-bot
Bot
merged commit Dec 1, 2026
1218d28
into
linuxdeepin:develop/snipe
18 of 20 checks passed
Contributor
|
This pr force merged! (status: unstable, merge_method: rebase) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root Cause Analysis
FSEventCollector::flushCollectedEvents()andFSEventController::onFlushFinished()unconditionally emitqDebugstatistics every flush cycle (default 180s), even when all event lists (Created/Deleted/Modified/Moved) are empty. This produces ~180 lines of meaningless log per hour. The three unconditionalqDebugcalls are atfseventcollector.cpp:541,fseventcontroller.cpp:311, andfseventcontroller.cpp:316. Root cause confirmed by minimal reproduction (repro/demo/demo.cpp→ 3 cycles × 3 lines of zero-event logs) and toggle experiment (adding guard → logs disappear, removing → logs reappear).Fix
Added a guard condition in
flushCollectedEvents()so statistics are logged only when at least one event list is non-empty. InonFlushFinished(), moved the "Flush finished, processing events" log after the empty-check and removed the "No file system events to process" log — when there are no events, the function silently returns. Implementation matches the fix suggestion in analysis-report.md section 10 with no deviation.Change Safety Assessment
Code Safety
flushFinishedsignal still emitted normally;requestProcessFileChangesandrequestProcessFileMovesstill triggered normally8d481bc, no subsequent modifications — no historical fix being revertedBusiness Impact Scope
Affects the
deepin-anything-indexservice's file system event monitoring module. When the file system is idle (no create/delete/modify/move events), debug logs are no longer printed. Event processing behavior is unchanged — file indexing continues to work as before. Users will notice reduced log noise injournalctlfor thedeepin-anything-indexservice.Verification Suggestion
Verify that
journalctl -u deepin-anything-indexproduces no "Flushing events" / "Flush finished" / "No file system events to process" logs when the file system is idle. Then create/modify/delete files and confirm event statistics logs still appear with correct counts.根因分析
FSEventCollector::flushCollectedEvents()和FSEventController::onFlushFinished()每次 flush 周期(默认 180 秒)无条件输出qDebug统计日志,即使 Created/Deleted/Modified/Moved 四个事件列表均为空。每小时产生约 180 行无意义日志。三处无条件qDebug调用分别位于fseventcollector.cpp:541、fseventcontroller.cpp:311、fseventcontroller.cpp:316。根因经最小载体复现(repro/demo/demo.cpp→ 3 周期 × 3 行全 0 事件日志)与翻转实验(添加守卫→日志消失,移除→日志复现)确认。修复方案
在
flushCollectedEvents()中添加守卫条件,仅当至少一个事件列表非空时才输出统计日志。在onFlushFinished()中,将 "Flush finished, processing events" 日志移到空检查之后,删除 "No file system events to process" 日志——无事件时静默返回。实现与分析报告第十节修复建议完全一致,无偏离。改动安全评估
代码安全评估
flushFinished信号仍正常发射;requestProcessFileChanges和requestProcessFileMoves仍正常触发8d481bc引入,无后续修改——不存在撤销历史修复的风险业务影响范围
影响
deepin-anything-index服务的文件系统事件监控模块。文件系统空闲时(无创建/删除/修改/移动事件)不再打印调试日志。事件处理行为不变——文件索引功能继续正常工作。用户将在journalctl中看到deepin-anything-index服务的日志噪音显著减少。验证建议
验证文件系统空闲时
journalctl -u deepin-anything-index不再出现 "Flushing events" / "Flush finished" / "No file system events to process" 日志。然后创建/修改/删除文件,确认事件统计日志仍正常输出且计数正确。Summary by Sourcery
Bug Fixes: