Skip to content

Ub/tent store - #59

Open
zchuango wants to merge 15 commits into
mainfrom
ub/tent-store
Open

zchuango wants to merge 15 commits into
mainfrom
ub/tent-store

Conversation

@zchuango

Copy link
Copy Markdown

Description

Suggested Merge Priority

  • P0 — Urgent: Critical security vulnerability, data loss/corruption, or widespread production outage requiring immediate action
  • P1 — High: Significant correctness or stability issue in existing functionality, or a regression blocking users without a practical workaround
  • P2 — Normal: Routine bug fix, validated performance/compatibility improvement, or new feature for a confirmed use case
  • P3 — Low: Experimental feature, optional enhancement, refactoring, or cleanup with no urgent user impact

Module

  • Transfer Engine (mooncake-transfer-engine)
  • Mooncake Store (mooncake-store)
  • Mooncake Conductor (mooncake-conductor)
  • Reshard (mooncake-reshard)
  • 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:

# Example: bash scripts/run_ci_test.sh

Test results:

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

Checklist

  • Every commit I contribute includes my Signed-off-by trailer certifying the DCO
  • 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 on the files changed in this PR 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)

Connor-Matthew and others added 8 commits November 9, 2026 15:14
Without liburma, createDefaultUrmaAdapter() returns an unavailable stub,
so topology discovery finds no UB NIC and transport_loader never builds
UbTransport. Store tests with MC_USE_TENT=1 then silently run on TCP and
never exercise the TENT UB path.

Add an in-process loopback URMA adapter that copies READ/WRITE data with
memcpy, and let the default factory return it in test-only builds:

- New CMake option USE_UB_MOCK (OFF by default, requires USE_UB). When ON,
  tests/ub_mock/loopback_urma_adapter.cpp is compiled into tent_xport_ub
  with TENT_UB_MOCK_ADAPTER=1. Normal builds are unchanged.
- createDefaultUrmaAdapter() returns the loopback adapter only in such a
  build and only when MC_TENT_UB_MOCK=1 is set, so other tests in a mock
  build still see no UB device.
- The adapter reports one device (ub:mock0:eid0), bounds-checks every WR
  against its local and remote segments, and keeps process-wide counters
  so tests can check that data went through UB.

Tests:
- tent_ub_loopback_engine_test: two in-process TENT engines with only UB
  enabled; 4 MiB write/read with byte checks, an unhinted batch that must
  pick UB, and an out-of-range write that must not complete.
- client_integration_ub_mock_test: client_integration_test with
  --protocol=ub, MC_USE_TENT=1, MC_TENT_UB_MOCK=1 and every other data
  transport disabled through MC_TENT_CONF.

The two tests/CMakeLists.txt files also pick up cmake-format whitespace
changes on lines this commit does not otherwise touch.

Tested in a Linux arm64 container (Debug, USE_TENT, USE_UB, USE_UB_MOCK,
WITH_STORE, no liburma) on main 48aa86c:
- tent_ub_* tests: 4/4 pass; tent_ub_loopback_engine_test 30/30 repeats.
- client_integration_ub_mock_test: 33 pass, 6 checksum cases skip,
  BatchQueryIpOperations fails because TENT reports the container IP
  instead of 127.0.0.1; it fails the same way with MC_USE_TENT=1 alone.
- TENT tests: 70/71 pass; transfer_engine_config_override_test fails the
  same 4 cases as on main in this container.
- Existing Store TENT ctests (5): all pass.

Signed-off-by: Connor-Matthew <60215777+Connor-Matthew@users.noreply.github.com>
client_integration_ub_mock_test relied on every non-UB transport being
disabled to show that data went through TENT UB. Add a direct check:
UbMockCarriesPutAndGet resets the loopback adapter's counters, puts and
gets a 1 MiB object, and expects UB write and read requests with at least
1 MiB moved each way, plus a byte-for-byte match.

The case is compiled only when USE_TENT and USE_UB_MOCK are on, and skips
unless MC_TENT_UB_MOCK is set.

Tested in the ub-mock container build:
- client_integration_ub_mock_test: new case passes (5/5 repeats); suite
  otherwise unchanged (only BatchQueryIpOperations fails, 6 skips).
- Without MC_TENT_UB_MOCK the case is skipped.
- With TCP enabled and UB disabled, Put/Get succeed but the case fails on
  all four counter expectations, so it catches a non-UB data path.

Signed-off-by: Connor-Matthew <60215777+Connor-Matthew@users.noreply.github.com>
Keep mmap-backed segments on the munmap teardown path even when the Store protocol is UB. Add a UB mock regression test that checks the hugepages are released after client teardown.

Signed-off-by: Connor-Matthew <60215777+Connor-Matthew@users.noreply.github.com>
TENT picks the data transport itself, and its UB transport is off unless
transports/ub/enable is set. A Store client started with MC_USE_TENT=1 and
protocol=ub therefore came up without error and carried its data over TCP.

- Add tent::TransferEngine::hasTransport(TransportType), which reports
  whether a transport was loaded and installed.
- In TENT mode, Client::InitTransferEngine now returns INTERNAL_ERROR for
  protocol=ub when the UB transport is missing, and logs how to enable it.
  The classic (non-TENT) UB path is unchanged.

Behavior change: MC_USE_TENT=1 with protocol=ub and UB disabled used to
start on TCP and now fails to start.

Tested in the ub-mock container build (USE_TENT, USE_UB, USE_UB_MOCK):
- tent_ub_loopback_engine_test: new ReportsInstalledTransports passes.
- client_integration_ub_mock_test: new
  UbRequestedWithoutTentUbTransportFails passes. The suite passed 2 of 3
  runs; the third failed BasicPutGetOperations and UpsertNewKey with
  OBJECT_HAS_LEASE, existing cases that Remove right after sleeping one
  lease TTL.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Connor-Matthew <60215777+Connor-Matthew@users.noreply.github.com>
No workflow built with USE_UB_MOCK, so the TENT UB loopback tests and the
Store tests on top of it only ran locally.

- tent-ci (ub-mock): add -DUSE_UB_MOCK=ON, turn Store on, and build the
  transfer engine tree plus client_integration_test and
  real_client_hugepage_register_test.
- Add a step that runs client_integration_ub_mock_test and
  real_client_hugepage_ub_mock_test. tent_ub_loopback_engine_test is picked
  up by the existing TENT test step.
- Leave BatchQueryIpOperations out of client_integration_ub_mock_test: it
  expects a loopback address, but TENT advertises the host NIC address
  with any transport.

The workflow change has not run on GitHub Actions yet. The hugepage case
skips itself if the runner grants no hugepages.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Connor-Matthew <60215777+Connor-Matthew@users.noreply.github.com>
# Conflicts:
#	mooncake-store/tests/client_integration_test.cpp
#	mooncake-store/tests/real_client_hugepage_register_test.cpp
Signed-off-by: zchuango <zchuang185@gmail.com>
Signed-off-by: zchuango <zchuang185@gmail.com>
@github-actions github-actions Bot added size/M 100-1000 changed lines (additions + deletions) run-ci store Transfer Engine Common CI/Build and removed size/M 100-1000 changed lines (additions + deletions) labels Nov 20, 2026
CAICAIIs and others added 7 commits November 21, 2026 20:37
…#5525)

* [TENT] Add an array entry point for synchronous transfers

A batch of transfer descriptors reaches the engine as a list of Request
objects: the caller builds one Python object per descriptor and pybind
copies the list into a std::vector, so a batch of a few thousand ranges
spends most of its time in that conversion.

transfer_sync_arrays takes the descriptors as three 1-D uint64 arrays
(src, dst, lengths), submits one batch, waits for it with the GIL
released, and returns one uint8 terminal state per entry. It waits until
every descriptor is terminal and takes no timeout; a caller that needs
one uses submit_transfer and wait_transfer with a batch it owns. Arrays
with a wrong dtype, wrong rank, non-unit stride or mismatched lengths
are rejected without touching the engine, and failed submissions stay
INVALID.

Tested with a new Python test that covers the malformed inputs and moves
bytes between two engines over TCP, registered with CTest.

Signed-off-by: CAICAIIs <3360776475@qq.com>

* [TENT] Reject malformed empty inputs and surface wait failures

transfer_sync_arrays treated every empty array as a successful zero-range
call: an empty float64 array, an empty two-dimensional array, or an empty
source with a non-empty target all returned a zero-length status array.
Validate such inputs and raise InvalidArgumentError, while keeping a batch
of three empty uint64 vectors as a no-op.

The wait result was discarded, so a failed wait or a status list of the
wrong length still looked like successful submission with INVALID states.
Check both and raise InternalError instead of returning the array.

Signed-off-by: CAICAIIs <3360776475@qq.com>

* [TENT] Cancel and settle a failed transfer_sync_arrays batch

The batch guard frees the batch on scope exit, and freeBatch defers while
tasks are still pending: the transport can keep reading or writing the
caller's buffers after the call has raised. Cancel every task and wait up
to 250 ms for a terminal state before letting the guard free the batch,
and say so in the error when the batch stays pending, because a caller
cannot wait on a batch it does not own.

The same cleanup now runs when submitTransfer is rejected, since a
rejected submit can leave part of the batch in flight.

Signed-off-by: CAICAIIs <3360776475@qq.com>

* [TENT] Cancel and settle a batch in the engine

transfer_sync_arrays used to leave buffers owned by the transport when the
wait failed: freeBatch defers releasing a batch whose tasks are still
pending, and the caller has no batch id to wait on.

Add TransferEngine::cancelAndWait(batch_id, timeout_ms): it stops admitting
queued owners, cancels the in-flight tasks, refills the dispatch window once
and polls until every task leaves PENDING or the timeout expires. The Python
entry point calls it after a failed submit or wait and reports InternalError
when the batch could not be settled, so buffers stay untouched until tasks
report a final state.

Verified on qjh000: 23 dispatch, 12 lifecycle, 5 poll backoff and 3 delegate
rpc tests pass; the 9 array binding tests pass.

Signed-off-by: CAICAIIs <3360776475@qq.com>

* [TENT] Settle failed array transfers with waitTransfer

The settle logic does not need its own public entry point: waitTransfer
already cancels queued owners, asks in-flight tasks to stop and reports the
final per-descriptor states. Call it again with a short timeout after a
failed submit or wait, and treat an empty status list as "nothing was
published".

This removes the cancelAndWait API added by the previous commit and keeps the
binding as the only caller of the settle path.

Signed-off-by: CAICAIIs <3360776475@qq.com>

* [TENT] Base the settle window on the transport retry budget

The failure path waited a fixed 250 ms for cancelled tasks to stop, which
does not cover the QP retry timer. With the default send_timeout (14) and
send_retry_count (7) one task can take ~540 ms to drain, so a batch that
settled inside 250 ms was not the worst case the check claimed to cover.

Wait one full retry budget (600 ms) instead, so a settled batch means the
transport is actually done. The docstring no longer quotes an unexplained
number.

Signed-off-by: CAICAIIs <3360776475@qq.com>

* [TENT] Report slot exhaustion and tighten the settle path

- Raise TooManyRequests instead of returning all-INVALID when no batch slot
  is free; the result previously looked like malformed input.
- Treat a short settle status list as not settled instead of safe.
- Stop appending a second location marker to errors that already carry one.
- Describe the 600 ms budget as a wait for completion; cancellation only
  happens at the deadline.
- Use None as the segment sentinel in the write/read test.

Signed-off-by: CAICAIIs <3360776475@qq.com>

---------

Signed-off-by: CAICAIIs <3360776475@qq.com>
* [Conductor] Add Go RPC client and C ABI bindings

Signed-off-by: w00593015 <wanghaibo33@huawei.com>

* [Conductor] Keep negative RPC timeouts as "no timeout"

ConductorClient::Setup rejected every non-positive timeout, so a negative
value, which previously disabled the ylt timer, started failing with
INVALID_PARAMS for Python, Rust, and C callers.

Accept negative timeouts again and clamp them to -1 so ylt's nanosecond
conversion cannot overflow. Keep rejecting 0, which expires at once, and
values above INT64_MAX / 1000000 ms.

- Go maps a negative Duration to -1 instead of returning InvalidParams.
- Rust rounds sub-millisecond durations up, so a nonzero Duration never
  becomes the rejected 0 ms.
- Document the accepted range in the C and C++ headers and the Rust
  ClientConfig.
- Cover 0, out-of-range, -1, and INT64_MIN in the C ABI test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Chase Rong <lolopop.rong@gmail.com>

* [Conductor] Nest root_digest in the Go service hash profile

RegisteredService embedded ServiceConfig and carried RootDigest at the top
level. Rust ServiceInfo, the Python services dict, and Go ContextView all
keep root_digest inside the hash profile.

Give RegisteredService its own fields with a ResolvedHashProfile, and share
the C-to-Go hash profile conversion between ListServices and GetGlobalView.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Chase Rong <lolopop.rong@gmail.com>

---------

Signed-off-by: w00593015 <wanghaibo33@huawei.com>
Signed-off-by: Chase Rong <lolopop.rong@gmail.com>
Co-authored-by: w00593015 <wanghaibo33@huawei.com>
Co-authored-by: Chase Rong <lolopop.rong@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…ad (kvcache-ai#5698)

Preserve the 1000 ms default, allow 0 for first-transfer measurements, reuse the validated payload size, and reserve each per-transfer request vector in both backends.

Signed-off-by: wuyaole <112309453+LeslieWylie@users.noreply.github.com>
Co-authored-by: wuyaole <112309453+LeslieWylie@users.noreply.github.com>
…ache-ai#5686)

* [Doc] Add logos and links to the ecosystem integration directory

Give each integration a linked logo and point every project name at its upstream repository, including integrations that are still open pull requests.

---------

Signed-off-by: Teng Ma <stmatengss@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Enflame GCU support landed in kvcache-ai#5383, but the README hardware overview still omitted the vendor.

Signed-off-by: Teng Ma <stmatengss@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Picks up kvcache-ai#5725, which fixes the master_service_ha_test build break that
failed CTest on kvcache-ai#5703.

Signed-off-by: Connor-Matthew <60215777+Connor-Matthew@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation Mooncake Conductor size/L 1001+ changed lines (additions + deletions) labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/Build Common documentation Improvements or additions to documentation Mooncake Conductor run-ci size/L 1001+ changed lines (additions + deletions) store Transfer Engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants