Skip to content

Pr0623#181

Merged
deepin-bot[bot] merged 3 commits intolinuxdeepin:develop/snipefrom
wangrong1069:pr0623
Jun 24, 2025
Merged

Pr0623#181
deepin-bot[bot] merged 3 commits intolinuxdeepin:develop/snipefrom
wangrong1069:pr0623

Conversation

@wangrong1069
Copy link
Contributor

@wangrong1069 wangrong1069 commented Jun 24, 2025

Summary by Sourcery

Enhance configuration parsing, timestamp formatting, and index commit logic; update build dependencies and packaging scripts accordingly.

Enhancements:

  • Allow get_config_int64 to handle and convert double GVariant values with error logging
  • Replace manual chrono/string formatting for index status timestamps with GDateTime API
  • Guard index commits in timer_worker to skip when the thread pool is busy

Build:

  • Add Threads and Boost.System dependencies to the searcher CMakeLists
  • Remove redundant server service file installation from server CMakeLists

Chores:

  • Include <errno.h> in tools.c for proper error handling

- Remove installation of deepin-anything-server.service to fix installation failure of deb package.
- Enhance get_config_int64 function to support both int64 and double types.
- Update CMakeLists.txt file to include Boost and Threads dependencies to fix linking issues.
- Refactor time format in file_index_manager to fix compilation issues.
- Add errno header in tools.c to fix compilation issues.

Log: Adapt to V20
The current index submission logic is:
- When an event comes in, the dirty state will be set.
- When a large number of events come in, they will be immediately put into the thread pool for processing.
- The timer thread will process the currently unprocessed events and commit the index if the index commit timeout is reached.

Problem scenarios:
- When the thread pool size is 1 and a large number of events are pouring in, a large number of events will be put into the thread pool for processing.
- The last batch of events arrives, and then the timer thread starts running and processes the last batch of events and commit the index.
- If the thread pool is still processing events at this time, the subsequent batch of events will not be saved in the committed index, and can only be saved when the index is committed next time.

The solution is to commit the index and meet three conditions:
- timeout reached
- no unprocessed events
- the thread pool has processed the events

Log: Fix index updates not saved after a timeout
@sourcery-ai
Copy link

sourcery-ai bot commented Jun 24, 2025

Reviewer's Guide

This PR enhances configuration value parsing to handle both int64 and double types, refactors timestamp generation using GLib’s GDateTime API, adds thread and Boost dependencies to the searcher build, adds thread-pool busy guards to index commit logic, and adjusts packaging scripts for the systemd service.

Class diagram for updated config value parsing in config.cpp

classDiagram
    class Config {
        +get_config_int64(connection, resource_path, key)
    }
    class GVariant
    Config --|> GVariant : uses
    %% get_config_int64 now handles both int64 and double types
    %% and logs error for invalid types
Loading

Class diagram for file_index_manager timestamp refactor

classDiagram
    class file_index_manager {
        +save_index_status(index_status status)
    }
    class GDateTime
    file_index_manager --|> GDateTime : uses
    %% save_index_status now uses GDateTime for timestamp generation
Loading

Class diagram for base_event_handler index commit logic update

classDiagram
    class base_event_handler {
        +timer_worker(int64_t interval)
        -commit_volatile_index_timeout_
        -commit_persistent_index_timeout_
        -jobs_
        -pool_
        -index_manager_
        -index_status_
        -volatile_index_dirty_
        -config_
    }
    class pool {
        +busy()
    }
    base_event_handler --> pool : checks busy()
    %% timer_worker now checks pool_.busy() before committing indexes
Loading

File-Level Changes

Change Details Files
Enhanced get_config_int64 to handle double values
  • Introduced separate double and int64 variables
  • Added type checks for INT64 and DOUBLE variants
  • Casted double to int64 or logged error for invalid types
src/server/src/core/config.cpp
Refactored timestamp generation to use GLib GDateTime
  • Replaced chrono/system_clock and stringstream usage
  • Used g_date_time_new_now_local and g_date_time_format
  • Updated snprintf call to consume formatted time_str
src/server/src/core/file_index_manager.cpp
Added Threads and Boost dependencies to searcher build
  • Added find_package calls for Threads and Boost
  • Linked Threads::Threads and ${Boost_LIBRARIES} in target_link_libraries
src/searcher/CMakeLists.txt
Prevent index commits when thread pool is busy
  • Added !pool_.busy() to volatile index commit condition
  • Added !pool_.busy() to persistent index commit condition
src/server/src/core/base_event_handler.cpp
Commented out redundant systemd service installation
  • Disabled deepin-anything-server.service install
  • Noted that debhelper manages this service file
src/server/CMakeLists.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions
Copy link

TAG Bot

TAG: 7.0.22
EXISTED: no
DISTRIBUTION: unstable

Fix reuse lint failures.

Log: Update version to 7.0.22
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. .gitignore 文件新增了 .cursorindexingignore,需要确认这个文件是否确实不需要被版本控制。

  2. .reuse/dep5 文件被删除,需要确认这是否是有意为之,以及是否有其他文件需要更新以反映这一变化。

  3. 新增了 LICENSES/Apache-2.0.txtLICENSES/LGPL-3.0-or-later.txt 文件,需要确认这些许可证文件是否适用于项目的所有部分,并且是否已经获得了所有必要的许可。

  4. REUSE.toml 文件中新增了一些注释,需要确认这些注释是否正确反映了项目的许可证信息。

  5. debian/changelog 文件中新增了一个条目,需要确认这个条目的内容是否准确反映了项目的变更。

  6. debian/deepin-anything-server.install 文件中移除了 deepin-anything-server.service 的安装路径,需要确认这是否是有意为之,以及是否有其他配置文件需要更新以反映这一变化。

  7. src/searcher/CMakeLists.txt 文件中新增了对 ThreadsBoost 库的查找,需要确认这些库是否已经在项目的其他部分正确安装。

  8. src/server/CMakeLists.txt 文件中移除了 deepin-anything-server.service 的安装路径,需要确认这是否是有意为之,以及是否有其他配置文件需要更新以反映这一变化。

  9. src/server/include/analyzers/chineseanalyzer.hsrc/server/include/analyzers/chinesetokenizer.h 文件中新增了 SPDX 版权和许可证标识,需要确认这些标识是否正确。

  10. src/server/src/analyzers/chineseanalyzer.cppsrc/server/src/analyzers/chinesetokenizer.cpp 文件中新增了 SPDX 版权和许可证标识,需要确认这些标识是否正确。

  11. src/server/src/core/base_event_handler.cpp 文件中新增了对 pool_.busy() 的检查,需要确认这个改动是否解决了之前存在的问题。

  12. src/server/src/core/config.cpp 文件中新增了对配置值类型的检查,需要确认这个改动是否正确处理了所有可能的配置值类型。

  13. src/server/src/core/file_index_manager.cpp 文件中新增了对 g_date_time_new_now_local()g_date_time_format() 的使用,需要确认这些函数是否正确处理了时区问题。

  14. src/server/src/utils/tools.c 文件中新增了对 errno 的使用,需要确认这个改动是否正确处理了错误情况。

以上是针对代码提交的审查意见,希望能够帮助到您。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, wangrong1069

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@wangrong1069
Copy link
Contributor Author

/merge

@deepin-bot deepin-bot bot merged commit 6cd0738 into linuxdeepin:develop/snipe Jun 24, 2025
18 checks passed
@wangrong1069 wangrong1069 deleted the pr0623 branch June 24, 2025 13:00
@lzwind
Copy link

lzwind commented Jun 27, 2025

/topic cd-20250627

@lzwind
Copy link

lzwind commented Jun 27, 2025

/integr-topic cd-20250627

@deepin-ci-robot
Copy link

Add topic: cd-20250627 successed.

@deepin-ci-robot
Copy link

Integrated with pr deepin-community/Repository-Integration#2959

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants