Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: rollback scc#9442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hengfeiyang merged 6 commits intomainfromfix/rollback-scc
Dec 3, 2025
Merged

fix: rollback scc#9442

hengfeiyang merged 6 commits intomainfromfix/rollback-scc
Dec 3, 2025

Conversation

@hengfeiyang
Copy link
Contributor

fixed#9419

greptile-apps[bot], reneleonhardt, and hengfeiyang reacted with thumbs up emoji
@github-actionsgithub-actionsbot added the ☢️ BugSomething isn't working labelDec 2, 2025
@github-actions
Copy link
Contributor

Failed to generate code suggestions for PR

@greptile-apps
Copy link
Contributor

Greptile Overview

Greptile Summary

This PR rolls back usage of thescc (Scalable Concurrent Collections) crate across multiple modules, replacing it with standardparking_lot::RwLock ortokio::sync::RwLock wrappedHashMap/HashSet collections. This change addresses issue#9419 where searches were getting stuck after upgrading to version 0.20.1.

Key Changes:

  • WAL file locking (src/common/infra/wal.rs): Replacedscc::HashMap<String, AtomicIsize> withparking_lot::RwLock<SearchingFileLocker>. Functions are now synchronous instead of async, with explicit reference counting for file locks.
  • Local lock (src/infra/src/local_lock.rs): Changed fromscc::HashMap withOccupiedEntry toRwLock<HashMap> with a newLockHolder struct. The API now requires a two-step lock acquisition pattern.
  • File list storage (src/service/search/datafusion/storage/file_list.rs): Replacedscc::HashMap withparking_lot::RwLock<HashMap> for file and segment caching.
  • Various job/service modules: Consistently replacedscc::HashSet withRwLock<HashSet> for tracking processing files and ongoing jobs.

Memory management improvements:

  • Addedshrink_to_fit() calls after removing elements to prevent memory accumulation
  • Explicit lock dropping patterns to prevent potential deadlocks

The rollback fromscc to standard locking primitives suggests that the lock-free concurrent collections were causing issues with the search request lifecycle, potentially related to how entries were being acquired and released in the flight search context.

Confidence Score: 4/5

  • This PR addresses a critical P0 bug (search blocking) by rolling back to simpler, well-tested locking primitives.
  • The changes are consistent across all files, replacing scc collections with standard RwLock patterns. The logic is straightforward and follows established Rust concurrency patterns. Tests are updated to match the new API. Minor concern about the local_lock API change requiring callers to use two-step locking, but the only caller (schema.rs) is updated correctly.
  • Thesrc/infra/src/local_lock.rs change removes thelock_multi function - verify no other callers depend on it.

Important Files Changed

File Analysis

FilenameScoreOverview
src/common/infra/wal.rs5/5Major refactor: replaced scc::HashMap with parking_lot::RwLock for WAL file locking, converting async functions to sync. Added SearchingFileLocker struct with reference counting and shrink_to_fit for memory management.
src/handler/grpc/flight/mod.rs5/5Simplified clear_session_data by removing tokio::spawn wrapper since release_request is now synchronous.
src/infra/src/local_lock.rs4/5Replaced scc::HashMap with RwLock+LockHolder pattern. New design returns a LockHolder that must be explicitly locked, creating a two-step locking process. Removes lock_multi function.
src/service/schema.rs5/5Updated local_lock usage to two-step pattern: first obtain LockHolder via lock(), then acquire guard via locker.lock().await.
src/service/search/datafusion/storage/file_list.rs5/5Replaced scc::HashMap with parking_lot::RwLock for FILES and SEGMENTS. Changed clear() to explicit key collection and removal with shrink_to_fit.

Sequence Diagram

sequenceDiagram    participant Client    participant FlightHandler as Flight Handler    participant WAL as WAL Module    participant FileList as File List Storage    participant SearchFiles as SEARCHING_FILES    Client->>FlightHandler: Search Request    FlightHandler->>WAL: lock_files(files)    WAL->>SearchFiles: write().lock(file) for each file    Note over SearchFiles: Reference count incremented    FlightHandler->>WAL: lock_request(trace_id, files)    WAL->>WAL: Store files in SEARCHING_REQUESTS    FlightHandler->>FileList: set(trace_id, schema_key, files)    FileList->>FileList: Store file metadata    FlightHandler-->>Client: Stream Results    Client->>FlightHandler: Request Complete/Error    FlightHandler->>FlightHandler: clear_session_data(trace_id)    FlightHandler->>FileList: clear(trace_id)    FileList->>FileList: Remove entries + shrink_to_fit()    FlightHandler->>WAL: release_request(trace_id)    WAL->>WAL: Remove from SEARCHING_REQUESTS    WAL->>SearchFiles: write().release(file) for each file    Note over SearchFiles: Reference count decremented, removed if 0
Loading

Copy link
Contributor

@greptile-appsgreptile-appsbot left a comment

Choose a reason for hiding this comment

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

14 files reviewed, no comments

Edit Code Review Agent Settings |Greptile

@hengfeiyanghengfeiyang merged commit9c249f2 intomainDec 3, 2025
39 of 48 checks passed
@hengfeiyanghengfeiyang deleted the fix/rollback-scc branchDecember 3, 2025 03:08
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@uddhavdaveuddhavdaveuddhavdave approved these changes

@haohuaijinhaohuaijinhaohuaijin approved these changes

@oasiskoasiskAwaiting requested review from oasisk

+1 more reviewer

@greptile-appsgreptile-apps[bot]greptile-apps[bot] left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

☢️ BugSomething isn't working

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

search block

3 participants

@hengfeiyang@uddhavdave@haohuaijin

[8]ページ先頭

©2009-2025 Movatter.jp