2b.1b step 1: mark_object_committed (B1 MIN-driven commit)

Add CpSharedL2PageAllocator.mark_object_committed(object_key) -- the B1 commit path that marks an object committed directly, bypassing the per-(rank,layer,payload) commit_layer/_has_full_commit quorum. Under B1 the all-ranks-done consensus is the writing_check ReduceOp.MIN frontier (the same barrier that releases the node write lock), so every rank calls this with the same object_key at the MIN commit point and the committed set transitions rank-uniformly (feeds placement_digest).

Resolves opus-review MF4: split_committed_object stays coherent for a B1-committed object (no per-layer commit facts) -- it adds children to _committed_objects and the empty _commits_by_object is harmless because B1 never calls _has_full_commit.

7 unit tests (pure-Python): commit-without-quorum, idempotent, unknown-raises, stat bump, digest reflects committed set + lockstep equality, split-of-marked-object coherent, release-after-mark frees pages. Full suite 88/88 green on g0033.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-20 12:51:22 +00:00
parent 7850aab1a2
commit 50bc923ad6
2 changed files with 102 additions and 0 deletions

View File

@@ -804,6 +804,30 @@ class CpSharedL2PageAllocator:
self._stats["cp_shared_l2_objects_evicted"] += 1
return dropped
def mark_object_committed(self, object_key: str) -> bool:
"""B1 commit: mark an object committed directly, bypassing the per-(rank,
layer, payload) commit_layer quorum.
Under the B1 collective-free allocator the all-ranks-done consensus is the
writing_check ReduceOp.MIN frontier (the same barrier that releases the
node's write lock), NOT a per-layer all-gather. When that frontier commits a
node, every CP rank calls this with the same object_key, so the committed set
transitions rank-uniformly (and feeds placement_digest). Does not populate
_commits_by_object -- the per-layer quorum (_has_full_commit) is unused under
B1; is_committed / release / split_committed_object read _committed_objects,
which this maintains. Returns True on the first commit, False if already
committed. Raises on an unknown object (fail-loud: the node's reservation
must outlive its write lock).
"""
self._validate_object_key(object_key)
if object_key not in self._ranges_by_object:
raise ValueError(f"cannot commit unknown object {object_key!r}")
if object_key in self._committed_objects:
return False
self._committed_objects.add(object_key)
self._stats["cp_shared_l2_objects_committed"] += 1
return True
def split_committed_object(
self,
object_key: str,