feat(matching): add bucket owner that hands out token slots - #8503
feat(matching): add bucket owner that hands out token slots#8503YaweiZhang-930 wants to merge 8 commits into
Conversation
A bucket is seeded as one conditional batch with a statement per token against a single partition, so the token count sets the size of one Paxos round. Past a few hundred statements the batch trips the datastore's own size limit and the seed fails with an error that says nothing about buckets. Cap the count at 250 and reject an oversized request in CreateSemaphore and again in SeedSemaphoreTokens, so a caller gets a clear error instead. Capping rather than chunking keeps the seed all-or-nothing, which is what makes re-seeding a different id set refused whole rather than half applied. Signed-off-by: YaweiZhang-930 <yawei930@gmail.com>
Signed-off-by: YaweiZhang-930 <yawei930@gmail.com>
Signed-off-by: YaweiZhang-930 <yawei930@gmail.com>
|
A couple of minor suggestions to strengthen this PR:
Everything else looks solid — the description clearly explains the motivation (avoiding read-before-write), the safety argument for the cache being advisory only, and the known TODOs (partition reload, slot release). Nice work keeping this PR scoped to the new package with nothing wired up yet. |
Signed-off-by: YaweiZhang-930 <yawei930@gmail.com>
Signed-off-by: YaweiZhang-930 <yawei930@gmail.com>
Signed-off-by: YaweiZhang-930 <yawei930@gmail.com>
Signed-off-by: YaweiZhang-930 <yawei930@gmail.com>
CI failed: Integration tests failed due to a timeout in TestArchival_ArchiverWorker and internal execution manager errors.Overview1 unique failure pattern and multiple logs analyzed, showing integration test execution timeouts and persistence/execution manager failures. FailuresIntegration Test Timeout (confidence: high)
Cassandra Execution Manager Failure (confidence: high)
Summary
Code Review ✅ Approved 1 resolved / 1 findingsNew ✅ 1 resolved✅ Edge Case: Transient write errors can permanently erode the free-set
Rules
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
| // Its free-set is only a cache; the conditional write in persistence decides every grant. | ||
| // Start reads the partition once and never again, so a lost slot stays lost until the bucket | ||
| // is loaded afresh. | ||
| type Bucket struct { |
There was a problem hiding this comment.
Consider renaming it to SemaphoreManager to be consistent with tasklistmanager.
| // Its free-set is only a cache; the conditional write in persistence decides every grant. | ||
| // Start reads the partition once and never again, so a lost slot stays lost until the bucket | ||
| // is loaded afresh. | ||
| type Bucket struct { |
There was a problem hiding this comment.
As discussed offline, we also need rangeID (host ownership) to ensure SemaphoreManager doesn't exist on two different hosts during deployment or network partition.
| } | ||
|
|
||
| // SemaphoreMetadataManager is used to manage distributed semaphore metadata (config) | ||
| SemaphoreMetadataManager interface { |
| } | ||
|
|
||
| // SemaphoreTokenManager is used to manage distributed semaphore token ownership | ||
| SemaphoreTokenManager interface { |
What changed?
New package service/matching/semaphore, plus its tests. Nothing calls it yet.
Why?
How did you test it?
Unit tests — no external dependencies:
go test -race -cover ./service/matching/semaphore/...
Potential risks
Release notes
None
Documentation Changes
None