carlos / platform Public

tests: set the store's background passes aside in HA wake counts

CI caught kept wakes that read an L1 file or wrote a snapshot from the
store's own compaction pass, which now lands inside the wake (#1290).
wakePathRequests sets aside reads and writes of levels 1-9 and deletes,
under the root layout or a generation; TestHAWakeRequestCounts still
counts each wake's level-0 image exactly. 10/10 runs of the five tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev da1efdd146e3bbc7bedc4b0a281f40d0904b1054 parent 06ddc06
1 file changed, +18 −2
  • internal/activator/harelease_test.go +18 −2

CI failed — run details

diff --git a/internal/activator/harelease_test.go b/internal/activator/harelease_test.go
index f126e2ed0..eac8136f6 100644
--- a/internal/activator/harelease_test.go
+++ b/internal/activator/harelease_test.go
@@ -940,6 +940,12 @@ func (s *haSvc) wakeRequests(reqs []string, data bool) []string {
if rel, ok := strings.CutPrefix(r, "PUT "+prefix); ok && !data && replicaDataFile(rel) {
continue
}
+ // The store's own background passes (compaction reads and writes
+ // of levels 1-9, retention's deletes) run on their timers and,
+ // with the store ready inside the wake (#1290), can land in it.
+ if !data && s.storeMonitorRequest(r) {
+ continue
+ }
if rel, ok := strings.CutPrefix(r, "PUT "+prefix+"g-"); ok && !data {
if _, file, ok := strings.Cut(rel, "/"); ok && replicaDataFile(file) {
continue
@@ -958,7 +964,8 @@ func (s *haSvc) wakeRequests(reqs []string, data bool) []string {
}
// storeMonitorRequest reports whether r is the replica store's own
-// background work on this host's root prefix: a read or write of a level
+// background work on this host's prefix (the root layout or a storage
+// generation): a read or write of a level
// 1-9 file (compaction and snapshot passes), or any delete of a level file
// (retention).
func (s *haSvc) storeMonitorRequest(r string) bool {
@@ -967,7 +974,16 @@ func (s *haSvc) storeMonitorRequest(r string) bool {
return false
}
rel, ok := strings.CutPrefix(key, s.b.Cfg.hibernatePrefix(s.rt.Host)+"/")
- if !ok || len(rel) <= 5 || !isReplicaLevelDir(rel[:5]) || !strings.HasSuffix(rel, ".ltx") {
+ if !ok {
+ return false
+ }
+ if g, ok := strings.CutPrefix(rel, "g-"); ok {
+ // The same files under a storage generation (g-N/NNNN/...).
+ if _, rel, ok = strings.Cut(g, "/"); !ok {
+ return false
+ }
+ }
+ if len(rel) <= 5 || !isReplicaLevelDir(rel[:5]) || !strings.HasSuffix(rel, ".ltx") {
return false
}
switch method {