Skip to content

[Store] Add P2P hot standby runtime#2882

Merged
wanyue-wy merged 3 commits into
kvcache-ai:P2P-Mooncake-Storefrom
skygragon:feat/oplog-ha-p2p-hot-standby-v25
Jul 15, 2026
Merged

[Store] Add P2P hot standby runtime#2882
wanyue-wy merged 3 commits into
kvcache-ai:P2P-Mooncake-Storefrom
skygragon:feat/oplog-ha-p2p-hot-standby-v25

Conversation

@skygragon

@skygragon skygragon commented Jul 13, 2026

Copy link
Copy Markdown

Description

Add a P2P-specific hot standby runtime for replaying P2P metadata OpLog entries into P2PStandbyMetadataStore.

This PR introduces P2PHotStandbyService, which reuses the shared OpLog and standby components (StandbyStateMachine, OpLogStoreFactory, OpLogChangeNotifier, and OpLogReplicator) while keeping the orchestration layer P2P-specific. It
intentionally does not inherit from the centralized HotStandbyService because P2P promotion needs P2PStandbyMetadataStore, P2POpLogApplier, and an export shape covering clients, segments, objects, and replicas.

Module

  • Transfer Engine (mooncake-transfer-engine)
  • Mooncake Store (mooncake-store)
  • Mooncake EP (mooncake-ep)
  • Mooncake PG (mooncake-pg)
  • Integration (mooncake-integration)
  • P2P Store (mooncake-p2p-store)
  • Python Wheel (mooncake-wheel)
  • Common (mooncake-common)
  • Mooncake RL (mooncake-rl)
  • CI/CD
  • Docs
  • Other

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation update
  • Performance improvement
  • Other

How Has This Been Tested?

Test commands:

./scripts/code_format.sh --base P2P-Mooncake-Store
cmake --build build-verify-noetcd --target p2p_oplog_test -j3
cd build-verify-noetcd && ctest -R "^p2p_oplog_test$" --output-on-failure

Test results:

  • Unit tests pass
  • Integration tests pass (if applicable)
  • Manual testing done (describe below)

p2p_oplog_test passed in the local verification container. The new p2p_hot_standby_service_test.cpp is included in the p2p_oplog_test target.

Checklist

  • I have performed a self-review of my own code
  • I have formatted my code using ./scripts/code_format.sh
  • I have run pre-commit run --all-files and all hooks pass
  • I have updated the documentation (if applicable)
  • I have added tests to prove my changes are effective
  • For changes >500 LOC: I have filed an RFC issue

AI Assistance Disclosure

  • No AI tools were used
  • AI tools were used (specify below)

AI tools were used to help draft code changes, review diffs, and prepare PR text. The human submitter reviewed the changes and is responsible for them.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the P2PHotStandbyService class and its corresponding unit tests to orchestrate P2P hot standby replication and promotion. The feedback highlights a critical data race on P2PStandbyMetadataStore during concurrent metadata exports and background replication, potential resource leaks on Start() and Promote() failures due to uncleaned pointers, and the lack of a reconnection or recovery orchestration loop to handle network interruptions.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread mooncake-store/src/ha/oplog/p2p_hot_standby_service.cpp
Comment thread mooncake-store/src/ha/oplog/p2p_hot_standby_service.cpp
Comment thread mooncake-store/src/ha/oplog/p2p_hot_standby_service.cpp
Comment thread mooncake-store/src/ha/oplog/p2p_hot_standby_service.cpp
@codecov-commenter

codecov-commenter commented Jul 13, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 81.23324% with 70 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ake-store/src/ha/oplog/p2p_hot_standby_service.cpp 62.90% 69 Missing ⚠️
...-store/src/ha/oplog/p2p_standby_metadata_store.cpp 96.15% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@skygragon
skygragon force-pushed the feat/oplog-ha-p2p-hot-standby-v25 branch from 6ca1542 to 73c9b44 Compare July 13, 2026 14:15
@skygragon skygragon changed the title [WIP][Store] Add P2P hot standby runtime [Store] Add P2P hot standby runtime Jul 14, 2026
Comment thread mooncake-store/src/ha/oplog/p2p_standby_metadata_store.cpp
Comment thread mooncake-store/src/ha/oplog/p2p_hot_standby_service.cpp
Comment thread mooncake-store/src/ha/oplog/p2p_hot_standby_service.cpp
Comment thread mooncake-store/src/ha/oplog/p2p_hot_standby_service.cpp
Comment thread mooncake-store/src/ha/oplog/p2p_hot_standby_service.cpp
Comment thread mooncake-store/src/ha/oplog/p2p_hot_standby_service.cpp
@wanyue-wy
wanyue-wy merged commit d245b0f into kvcache-ai:P2P-Mooncake-Store Jul 15, 2026
13 checks passed
@skygragon
skygragon deleted the feat/oplog-ha-p2p-hot-standby-v25 branch July 15, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants