Skip to content

INTERNAL: Release elements on a sweeper after the searches before them - #25

Merged
ing-eoking merged 1 commit into
developfrom
sweeper
Nov 13, 2026
Merged

ing-eoking merged 1 commit into
developfrom
sweeper

Conversation

@ing-eoking

@ing-eoking ing-eoking commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

🔗 Related Issue

⌨️ What I did

  • 그래프에서 빠진 element의 참조를 스위퍼 스레드가 돌려줍니다.
  • 지금까지는 delete나 replace를 처리하는 레인이 wait_for_searches()(write lock)로 진행 중인 search가 끝나기를 기다린 뒤 직접 release했습니다.
  • 이번 PR부터 레인은 release를 스위퍼에 넘기고 바로 다음 job으로 넘어갑니다.

스위퍼

이벤트 큐 하나를 두고, 들어온 순서대로 하나씩 처리합니다.

이벤트 보내는 곳 처리
Release(elem) delete·replace에서 그래프에서 키를 뺀 뒤 엔진에 element 참조 반환
Block(rx) search가 그래프를 읽기 전 그 search가 끝날 때까지(Reading drop) 뒤에 쌓인 이벤트를 막음
Shutdown shutdown() 닫힌 것을 확인하도록 스위퍼를 깨움
  • search가 먼저 시작한 경우: search가 시작 전에 넣은 Block 뒤에 Release가 들어갑니다. 그래서 search가 결과로 찾은 element를 다 읽기 전에는 release되지 않습니다.
  • search가 나중에 시작한 경우: search가 시작하기 전에 그래프에서 빠진 키는 그 search가 찾을 수 없습니다. 이 경우에는 Release가 먼저 처리되어도 안전합니다.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@ing-eoking
ing-eoking force-pushed the sweeper branch 2 times, most recently from d384b93 to 1fd2840 Compare November 5, 2026 23:59
@ing-eoking
ing-eoking force-pushed the lane-shutdown branch 2 times, most recently from 1473bee to fb39e69 Compare November 6, 2026 00:05
@ing-eoking
ing-eoking marked this pull request as draft November 6, 2026 03:15
@ing-eoking
ing-eoking force-pushed the sweeper branch 2 times, most recently from 193eb57 to 7c02867 Compare November 6, 2026 08:05
@ing-eoking
ing-eoking force-pushed the sweeper branch 2 times, most recently from 341ae01 to 9c32eb1 Compare November 8, 2026 23:59

@namsic namsic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

전체 구현 이후 재확인 예정으로 approve 합니다

@zhy2on zhy2on left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

리뷰 완료

Comment thread src/aio/sweeper.rs
let (events, rx) = channel();
let sweeper = Box::leak(Box::new(Sweeper {
events,
closed: AtomicBool::new(false),

@zhy2on zhy2on Nov 13, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lane은 기다리는 connection에 바로 응답하려고 closed로 남은 Task를 버리는 것으로 이해했습니다.
스위퍼 큐에는 기다리는 connection이 없으니, closed 없이 Shutdown을 받을 때 끝나도 될 것 같은데 어떻게 생각하시나요?

일관성 측면에서 스위퍼에도 closed를 쓰는 게 더 좋을까요?

Comment thread src/aio/sweeper.rs
.name("arcus-vector-sweeper".into())
.spawn(move || {
let _ = ready.send(());
run(sweeper, &events);

@zhy2on zhy2on Nov 13, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sweeper의 Sender(events)는 다른 스레드가 스위퍼에 보낼 때 쓰는 것이라, run에서는 closed만 쓰는 것 같습니다.
closed만 넘기면 될 것 같습니다.

Base automatically changed from lane-shutdown to develop November 13, 2026 07:19
@ing-eoking
ing-eoking merged commit 90177b5 into develop Nov 13, 2026
@ing-eoking
ing-eoking deleted the sweeper branch November 13, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants