Repository navigation
[Store] Add TCP owner-push SSD read engine and FileStorage streaming reader - #5789
Draft
MaskVulcan wants to merge 24 commits into
Draft
MaskVulcan wants to merge 24 commits into
MaskVulcan wants to merge 24 commits into
Conversation
Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Add portable POSIX pread bounded streaming read pipeline (ReadSource, ReadPipeline, ThreadedPipelineDriver, BoundedExecutor with WaitSubmit backpressure) and wire FileStorage::ReadLocalStreaming into RealClient whole and ranged local CPU restore paths under MOONCAKE_OFFLOAD_LOCAL_STREAMING_READ. Includes ranged read fallback safety for unregistered CPU user buffers, shared-mutex close drain, O_NONBLOCK clearing after regular-file validation, aligned direct short-read continuation, unit/integration tests, and design docs. Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Add optional io_uring streaming read executor and pipeline driver (UringReadExecutor, UringPipelineDriver) with fixed-buffer support, EBUSY/EINTR/EAGAIN retry handling, short-read continuation, liburing 2.1 user_data compatibility, atomic WaitForEvent ready/active check, ARM64 SYS_ppoll fallback in fault fixture, and CTest/ASan/UBSan coverage. Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
This was referenced Nov 24, 2026
[Store] Wire hardened HMAC-authenticated TCP SSD owner-push runtime into RealClient and Python
#5790
Draft
MaskVulcan
force-pushed
the
ssd/pr3-owner-push-engine
branch
2 times, most recently
from
November 24, 2026 15:44
5767cea to
a9470f7
Compare
Address review findings for submitAcknowledgedTcpWrite: - Enforce v2 framing and WRITE opcode before the zero-length fast path in TcpTransport::startTransfer, log rejected requests, and document local no-op semantics for zero-length acknowledged writes. - Validate classic TCP availability before selectTransports, pre-check v2 framing (MC_TCP_PROTO / peer tcp_proto_version) before mutating the batch so mixed v2/v1 batches cannot partially dispatch, and require an explicit require_ack argument on startTransferSequence. - Include tcp_proto_version in TransferMetadata::SegmentDesc::operator== so protocol-only metadata updates are installed by syncSegmentCache. - Dispatch unpooled one-shot ClientSession::initiate() onto socket->get_executor() in TcpTransport::startTransferWithSocket to avoid cross-thread progress timer races, and track one-shot sessions in ConnectionLaneState so shutdownConnectionLanes() cancels and fails in-flight unpooled work cleanly. - Encapsulate TcpTransport acknowledged-write helpers behind friend class MultiTransport. - Expand unit tests for zero-length legacy writes, legacy peer metadata, mixed batches, ungrouped and grouped mid-sequence metadata downgrades, grouped writes, unpooled connections, and unpooled shutdown while awaiting a receiver ACK. Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Address adversarial review findings across local streaming restore and io_uring: - Guard both can_use_pinned_restore_arena and local streaming under offload_rpc_drain_ in RealClient::execute_ranged_read, avoid holding offload_rpc_drain_ across outbound remote peer RPCs, null-guard file_storage_/client_ in offload RPC handlers, and skip redundant local streaming retries after fallback. - Propagate sys_errno from PosixReadSource and io_uring read completions to NotifyDiskError/OnDiskError, respect disk_fenced_, validate backend type via dynamic_cast, reject overlapping destinations before source acquisition or max_chunks checks, merge multi-object batches into a single multi-source ReadPlan/driver with graceful slot degradation and expired-lease reaping on slot miss, check Start/Drain returns defensively, and map plan limits to NO_AVAILABLE_HANDLE for clean fallback. - Probe IORING_OP_READ/IORING_OP_READ_FIXED via io_uring_get_probe_ring so pre-5.6 kernels cleanly fall back to POSIX pread, expose UringReadExecutor::healthy(), make UringReadExecutor::Impl::Fail() idempotent, flush retries inline in both UringReadExecutor and UringPipelineDriver, keep shutdown drain retrying short reads/EINTR, retry io_uring_unregister_buffers on EINTR, validate O_DIRECT alignment on local-ring reads, clamp Wait() deadlines against signed overflow in both drivers, return kInvalidArgument for null sources, cap read lengths at INT_MAX with saturating object-end arithmetic, and gate UringPipelineDriver::Create cleanly. - Fix uint64_t/size_t deduction on 32-bit/macOS in file_storage_config.cpp, keep the deterministic fault test liburing fixture independent of distro <linux/io_uring.h> versions, and link ssd_uring_read_executor_contract_test standalone for BUILD_SHARED_LIBS=ON. - Harden io_uring and config/storage tests with opcode/RLIMIT_MEMLOCK/ O_DIRECT probes, safe RAII teardown ordering, WaitAccepted synchronization, default config assertions, and regression coverage for unhealthy/unsupported-opcode executors, disk fencing, plan limits, overlap precedence, multi-object uring/degraded-slot batches, and lease GC. Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Replace the process-global coro_io::io_context_pool used by offload restore RPC reads with a RealClient-owned asio::thread_pool that is initialized lazily on first use and stopped and joined during teardown after in-flight offload RPCs drain. Lazily initialize FileStorage::streaming_reads_ only when the portable pread driver is needed so io_uring-backed local streaming restores do not spawn idle fallback read workers, and align the SSD offload design doc with per-batch fixed-buffer rings and fallback semantics. Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Clarify submitAcknowledgedTcpWrite as a fail-closed v2 downgrade guard on top of TCP v2's existing receiver-ACK write semantics, tighten internal boundaries, and streamline tests: - Replace friend class MultiTransport with public validation/submit helpers on TcpTransport and hide OneShotSession in tcp_transport_lane_impl.h. - Query getSegmentDescByID instead of getCachedSegmentDescByID during acknowledged-write preflight to eliminate a stale-cache race window. - Rate-limit dispatch-time rejection logs, drop the redundant opcode check, and assert transport identity in MultiTransport. - Consolidate tests into five focused cases covering pooled, grouped, and unpooled acknowledged writes, legacy/downgrade rejections, unpooled shutdown via submitTransfer, and SegmentDesc equality. Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Trim unused zero-caller abstractions and heavy test fixtures from the local streaming restore path while fixing four correctness/usability issues: - Remove unused O_DIRECT, fixed_buffers per-batch io_uring engine, RebindSource, Cancel/attempt_id/region_id fields, and TrySubmit overloads; compile ssd_uring_pipeline.cpp only on Linux with liburing. - Account for OffsetAllocator 3-bit-mantissa bin rounding in StreamingReadConfig::Validate() via OffsetAllocatorSlotBudget() with a lockstep test against OffsetAllocator::normalizedAllocationSize(). - Deduplicate bucket file descriptors and BucketReadGuards per bucket in BucketStorageBackend::AcquireReadSources() so large multi-key batches sharing a few buckets do not hit the open-source limit. - Return NOT_SUPPORTED on overlapping destinations so RealClient falls back to the legacy sequential restore path instead of failing. - Extract pure ClassifyUringReadResult() with table-driven unit tests, probe io_uring_enter via NOP during worker init, log warnings on io_uring init/runtime failure and pread fallback, and remove the fake liburing.h / libc-interposition fault test targets. Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
MaskVulcan
force-pushed
the
ssd/pr3-owner-push-engine
branch
from
November 25, 2026 17:40
a9470f7 to
bae08eb
Compare
…nd harden unpooled shutdown Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
… contracts Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
MaskVulcan
force-pushed
the
ssd/pr3-owner-push-engine
branch
from
November 25, 2026 21:14
bae08eb to
d509a8d
Compare
…e and split out TCP bugfixes Address review feedback on kvcache-ai#5773: - Split out unpooled TCP initiation/shutdown tracking and SegmentDesc::operator== tcp_proto_version comparison into standalone independent bugfix PRs, restoring TcpTransport::supportsParallelBatchSubmit() == true. - Rename submitAcknowledgedTcpWrite to guarantee-oriented submitReceiverVisibleWrite and move route validation/submission onto Transport virtual hooks (validateReceiverVisibleWrites / submitReceiverVisibleWriteTasks) so each transport decides whether it can satisfy receiver-visible write completion without MultiTransport special-casing TCP. - Share the completion-latch arming, seal/unseal, and pinned tail release lifecycle between submitTransfer and submitReceiverVisibleWrite via MultiTransport::submitTransferImpl. - Add Status::Code::kProtocolUnsupported (Status::ProtocolUnsupported / IsProtocolUnsupported) so legacy peer / MC_TCP_PROTO=1 rejections are machine-distinguishable from TENT NotImplemented and unsupported-transport NotSupportedTransport. - Simplify TcpTransport::validateReceiverVisibleWrites to a plain std::unordered_set<SegmentID> when metacache is enabled and document the deliberate per-stage descriptor refreshes when metacache is disabled. Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Add owner-push control primitives (DestinationRegistry, SsdReadProtocol, SsdOwnerRequestLedger with bounded retired-ID intervals and completion-time eviction, SsdControlWire codec, SsdDirectReadOwner, SsdFixedL2Requester with bounded ReadWithRecovery, and portable secureRandomBytes). Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Add classic host TCP v2 SourceDrainedWriteTarget adapter built on TransferEngine::submitAcknowledgedTcpWrite without TransferRequest ABI, submitScatter, RDMA/TENT, or global drain changes. Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Add FileStorage::ReadOwnerStreaming and MakeFileStorageOwnerReader connecting FileStorage's bounded staging pipeline (POSIX and io_uring) to SsdDirectReadOwner::Reader. - Holds streaming_mutex_ shared lock so FileStorage::Shutdown drains active owner reads before releasing staging memory. - Guards BuildColdReadFlightKey optional before dereference. - Falls back cleanly to ThreadedPipelineDriver when io_uring is unavailable. - Adds FileStorage owner streaming unit tests and an end-to-end TCP v2 owner-push restore test across two TransferEngines. Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
…aming tests Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
MaskVulcan
force-pushed
the
ssd/pr3-owner-push-engine
branch
from
November 26, 2026 05:05
d509a8d to
29ec5ac
Compare
EL8 wheel-builder containers ship liburing 1.0.7, which provides io_uring_get_probe_ring() and io_uring_opcode_supported() but predates io_uring_free_probe() (introduced in liburing 2.0). Fall back to std::free(probe) when IO_URING_VERSION_MAJOR < 2 (or undefined), matching uring_file.cpp's version guard. Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
Signed-off-by: MaskVulcan <9528071+MaskVulcan@users.noreply.github.com>
This branch has not been deployed
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.
Part 3 of 5 in the SSD Offload streaming & owner-push series tracked in RFC #5768.
Summary
Implements the complete in-process Owner-Push data and control engine without opening network listeners or modifying
RealClient/ Python APIs:DestinationRegistry,SsdOwnerRequestLedger,SsdDirectReadOwner,SsdFixedL2Requester,ssd_control_wire.*,random.h):requester,boot_epoch,request_id), rejects overlapping or out-of-bounds spans, and pins pending destination ranges until drain is proven.RetiredRanges, bounded bymax_records) and oldest-completion-time eviction (completed_at), tolerating out-of-order concurrent requests.ReadWithRecoveryenforces a bounded recovery budget;Close()rejects new reads while still servingkRecoverReadIntoand waking duplicate waiters promptly.secureRandomBytes(Linux + macOS<sys/random.h>).ssd_transfer_target.*):TransferEngine::submitReceiverVisibleWrite()with zeroTransferRequestABI, TENT, or RDMA changes.BufferDesc, submits in bounded waves across fixed TCP lanes, drains every submitted batch before releasing staging slots, null-checks metadata, handles negativeSegmentHandleerrors safely, and skips zero-length fragments.FileStorageowner streaming reader (file_storage.*,ssd_file_storage_owner_reader.*):FileStorage::ReadOwnerStreaming()andMakeFileStorageOwnerReader().LoadBatchShared), automatic streaming fallback under staging fragmentation or contended>=256 KiBreads, andShutdown()draining active owner reads before rejecting new ones.Series Overview (RFC #5768)
| PR 3 | #5789 (this PR) | TCP owner-push SSD read engine &
FileStorage::ReadOwnerStreaming| Depends on #5773 + #5788 || PR 4 | #5790 | Hardened HMAC-SHA256 control RPC, peer directory,
RealClient& Python_store| Depends on #5789 || PR 5 | #5791 | V6 object write generations, SSD task fencing & HA durable retirement | Independent (
main) |Local Validation
submitReceiverVisibleWrite):ssd_tcp_write_target_test,ssd_direct_read_test, and 22/22file_storage_test --gtest_filter='*Owner*:*Streaming*'PASS (alongside full 15-suite prior validation includingssd_fixed_l2_requester_test --gtest_repeat=5).clang-format 20.1.80 diff,typos 1.30.20 issues, DCO verified.