Repository navigation
[Store] Carry upstream #4180: centralize client session lifecycle and resource ownership - #20
Closed
Juhyun-Kim-Memphis wants to merge 1 commit into
Closed
Juhyun-Kim-Memphis wants to merge 1 commit into
Juhyun-Kim-Memphis wants to merge 1 commit into
Conversation
…ecycle and resource ownership Net diff of upstream kvcache-ai#4180 (still open) at head 9a698e0, squashed onto our_main. Its base 31dedeb and the upstream main it merged are ancestors of our_main, so this commit carries only the PR's own changes. Applied cleanly with no conflicts. Upstream commits (oldest first): 74ea924 [Store] Centralize client session lifecycle and resource ownership 7204b80 Merge origin/main and adapt session tests to MasterServiceTestPeer 2f83731 [Store] Isolate client session operations in per-client slots 2fc6b3d Merge origin/main and preserve session checks with offload metrics 30fc9ed [Store] Fix snapshot test helper formatting 1655ced [Store] Keep client heartbeats independent of session admission 37e8a0e [Store] Split client session ownership from transition delivery 4da335a [Store] Format session test call sites with clang-format 20 a634363 [Store] Let the session registry act on the transitions it causes fc3cf7e [Store] Keep the atomic session state buildable on GCC 11 9a698e0 [Store] Bind the ping loop's client id by reference Upstream: kvcache-ai#4180
Collaborator
Author
|
fork CI(
|
Collaborator
Author
P5 판정: 병합 보류 (사람이 결정)rig 합격 기준은 "B(sync + kvcache-ai#4180)의 모든 폭풍 실행에서 OFFLINE 0건"이었고, 이 기준을 통과하지 못했습니다. 그래서 이 PR은 draft로 두고 병합하지 않습니다. 병합 여부는 사람이 결정합니다.
대조군(A)을 3회로 늘린 결과 — 합류 폭풍(S1), 7.8M 키, 로컬 Docker(arm64, Release)A =
메커니즘 (로그와 코드로 확인)
운영과의 관계두 폭풍 경로 모두 현재 운영 형태에서는 발생하지 않습니다. S1은 HA 승격 뒤의 remount scan이고, S2는 snapshot이 켜진 unmount입니다. 또한
|
Collaborator
Author
|
INF-522 를 종료하면서 이 PR 도 병합하지 않고 닫습니다.
|
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.
upstream PR kvcache-ai/Mooncake#4180 (아직 열려 있음)을
our_main위에 net diff 커밋 하나로 얹는다. #15 와 같은 방식이다. INF-522 의 P3 단계이며, 병합은 rig 판정 뒤 P5 에서 한다. 그 전까지 이 PR 은 draft 로 둔다.kvcache-ai#4180 이 바꾸는 것
ClientSessionRegistry가 소유한다. 클라이언트마다 슬롯이 있고, 슬롯마다 admission gate 와 shared/exclusiveoperation_mutex가 있다. 세션 만료도 registry 의 자체 스레드가 처리한다.ClientSessionEventDispatcher가 registry 잠금 밖의 별도 스레드에서 전달한다.MasterService에서client_mutex_,ok_client_,client_liveness_records_,ClientMonitorFunc가 빠진다.ClientLivenessRecord에서ServingGuard·RetainingGuard·ObserveAndRun이 빠지므로, 레코드별 잠금은 O(1) 작업 동안만 잡힌다.Ping은 더 이상 master 전역client_mutex_나 레코드별 잠금을 오래 기다리지 않는다. 경로는 registry 의 shared 잠금으로 슬롯을 찾고,Observe한 뒤,remount_completed를 확인하는 것뿐이다.rpc_service는 그대로이고, heartbeat 가 데이터 경로와 같은 RPC 스레드를 쓰는 문제는 #4183 의 몫이다. 그건 별도 이슈로 다룬다.왜 upstream 병합 전에 들고 오는가
sync(#17)로 upstream #2991(2단계 liveness)이
our_main에 들어왔다. kvcache-ai#2991 은Ping이 레코드별 잠금과client_mutex_를 기다리게 만드는 지점을 추가한다. INF-504 rig(키 1,800만 개)에서, 폭풍 중 이런 잠금 의존이 heartbeat 를 멈추게 하면 정상 클라이언트가 OFFLINE 으로 오판되고 그 클라이언트의 키가 대량 삭제되는 것을 확인했다. kvcache-ai#4180 이 그 잠금 의존을 없앤다.그래서 kvcache-ai#2991 은 있고 kvcache-ai#4180 은 없는 master 는 절대 롤하지 않는다. 이 규칙은 INF-522 의 magma PR 에서
research/mooncake/README.mdConstraints 로 고정한다. 다음 이미지 빌드(INF-522 P6)가 이 PR 병합 뒤의our_main에서 나오도록 순서를 잡았다. 자세한 배경은 INF-507 과 INF-522 에 있다.무엇을 얹었나
9a698e02ce6428813bca2e3e0f2775b0fcb77749(2026-09-21 06:43Z, "[Store] Bind the ping loop's client id by reference"). 이 시점 upstream PR 상태는 OPEN,REVIEW_REQUIRED, upstream CI 25 pass / 1 skipping 이다. 커밋 11개 목록은 커밋 메시지에 있다.git merge --squash upstream/pr-4180를our_main(dcfb6b33)에 실행했다. [Store] Centralize client session lifecycle and resource ownership kvcache-ai/Mooncake#4180 의 base31dedebb와 그 PR 이 병합한 upstream main 은 모두our_main의 조상이므로 PR 자신의 변경만 들어온다. 충돌은 없었다. 35개 파일, +3372/−1116 이다.(7faef38b + #4180)트리와 이 브랜치의 차이는, sync 뒤7faef38b와our_main의 차이와 파일 13개, 변경 줄까지 동일하다(master: bound resident memory with a watermark, not a timer #8·master: keep MaybeTrimHeap buildable on glibc 2.28 (manylinux2_28) #10·store: populate a new shm segment with several threads #14·[Store] Fix silent loss of offload keys deferred to the ungrouped pool (#3006) #15·bench, [Wheel] Set the trunk wheel version to 0.3.15.dev0 #18 버전, [TransferEngine] Keep the TCP connection pool off by default #19 TCP pool). 즉 이 PR 은 정확히 [Store] Centralize client session lifecycle and resource ownership kvcache-ai/Mooncake#4180 만 더한다.재검증 방침
upstream head 는 아직 움직이는 중이다(2026-09-21 하루에만 커밋 5개). 그래서 P5 에서 병합하기 직전에 다음을 한다.
검증 결과
로컬 unit gate: PASS. magma
oss/build/mooncake/Dockerfile.unittest(INF-522 확장판,MAX_JOBS=3만 변경)를 Mac Docker(linux/amd64, ubuntu 24.04 / GCC 13)에서 실행했다. w-0529 가 다른 캠페인에 점유되어 있어 클러스터 Job 대신 로컬에서 돌렸고, #16~#19 와 같은 방식이다.36e3cc2cc953dde26d95c0a08a0e6243238db67e, 2026-09-21 10:13:07Z → 10:33:56Z = 20분 49초 (컴파일 781초, 테스트 331초)[unit-gate] suites:줄에서 [Store] Centralize client session lifecycle and resource ownership kvcache-ai/Mooncake#4180 의client_session_*세 suite 가 자동으로 선택된 것을 확인했다.client_session_registry_test36,client_session_event_dispatcher_test5,client_session_expiry_test11,client_liveness_test4,master_heartbeat_metric_test14,master_service_test63,master_service_config_test7,master_service_ssd_test7,promotion_on_hit_test55,rpc_timeout_test8,segment_test25,file_storage_test26 (숫자는 테스트 케이스 수). 재시도 없이 한 번에 통과했다.fork CI(
ci.yml수동 실행): https://github.com/vessl-ai/Mooncake/actions/runs/35587571670 — 결과는 아래 댓글로 덧붙인다.Check code format은 workflow_dispatch 에 base branch 가 없어서 매번 실패하고, 그 때문에 wheel job 들은 skip 된다(#17 과 같다).rig 검증은 아직이다. 폭풍 rig 판정(INF-522 P4)이 나온 뒤 P5 에서 병합 여부를 정한다.
Upstream: kvcache-ai#4180