H-A-180: judge a restore point's hold by its wait's words, kept whole
The engine writes a have's detail cut to its head and tail, and the indexer's live hold (315 bytes) lost "the recovery module could not be asked" there, so its cause read as a failed point: its wait was cleared and the operator asked, the opposite of H-A-180. The cause is now read from the wait's words, which the have keeps whole; the detail only for a hold with no wait. Builds: design 47 H-A-180
This commit is contained in:
@@ -792,6 +792,9 @@ func TestADataModuleIsBackedUpFirstAndHeldWhenItFails(t *testing.T) {
|
|||||||
// At a start: a backup the node agent's own stop interrupted (postgres on novox, 2026-10-31) is no failure, so it is
|
// At a start: a backup the node agent's own stop interrupted (postgres on novox, 2026-10-31) is no failure, so it is
|
||||||
// backed up again and applied while the want asks a backup; a backup that failed stays held for the operator's
|
// backed up again and applied while the want asks a backup; a backup that failed stays held for the operator's
|
||||||
// answer, and an answer the want already carries is acted on.
|
// answer, and an answer the want already carries is acted on.
|
||||||
|
if strings.Contains(cutAsAHaveIs(liveUnaskedWords), recoveryNotAsked) {
|
||||||
|
t.Fatal("the live hold's detail, cut as a have's is, still says its cause: the row below shows nothing")
|
||||||
|
}
|
||||||
for _, row := range []struct {
|
for _, row := range []struct {
|
||||||
detail, backup string
|
detail, backup string
|
||||||
backups, applied int
|
backups, applied int
|
||||||
@@ -829,6 +832,8 @@ func TestADataModuleIsBackedUpFirstAndHeldWhenItFails(t *testing.T) {
|
|||||||
// holder of mesh-recovery placed it moves without a point (H-A-177); with one placed the point is asked once (H-A-180).
|
// holder of mesh-recovery placed it moves without a point (H-A-177); with one placed the point is asked once (H-A-180).
|
||||||
{unaskedWords, "", 1, 1, nodeengineclient.PhaseRunning, false, unaskedWords, "none", 0, false},
|
{unaskedWords, "", 1, 1, nodeengineclient.PhaseRunning, false, unaskedWords, "none", 0, false},
|
||||||
{unaskedWords, "", 1, 1, nodeengineclient.PhaseRunning, false, unaskedWords, "placed", 1, false},
|
{unaskedWords, "", 1, 1, nodeengineclient.PhaseRunning, false, unaskedWords, "placed", 1, false},
|
||||||
|
// Its live have: the detail cut to its head and tail as the engine writes a have (shorten), the wait's words whole.
|
||||||
|
{cutAsAHaveIs(liveUnaskedWords), "", 1, 1, nodeengineclient.PhaseRunning, false, liveUnaskedWords, "none", 0, false},
|
||||||
} {
|
} {
|
||||||
r := newBed(t)
|
r := newBed(t)
|
||||||
r.comps.before(ck1, craw1)
|
r.comps.before(ck1, craw1)
|
||||||
@@ -838,6 +843,9 @@ func TestADataModuleIsBackedUpFirstAndHeldWhenItFails(t *testing.T) {
|
|||||||
held := Have{Module: "db", FP: fp1, Composed: dig1, Phase: string(nodeengineclient.PhaseHeld), Detail: row.detail}
|
held := Have{Module: "db", FP: fp1, Composed: dig1, Phase: string(nodeengineclient.PhaseHeld), Detail: row.detail}
|
||||||
if row.reason != "" {
|
if row.reason != "" {
|
||||||
held.Wait = &nodeengine.Wait{Owner: nodeengine.Seat, Step: nodeengine.WaitStepCompose, Reason: row.reason, Words: row.detail}
|
held.Wait = &nodeengine.Wait{Owner: nodeengine.Seat, Step: nodeengine.WaitStepCompose, Reason: row.reason, Words: row.detail}
|
||||||
|
if strings.HasPrefix(row.reason, pointNotTaken) {
|
||||||
|
held.Wait.Words = row.reason // a restore point's hold says its words whole as its reason and its wait's words (kept.go)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if row.namesNothing {
|
if row.namesNothing {
|
||||||
held.FP, held.Composed = "", ""
|
held.FP, held.Composed = "", ""
|
||||||
@@ -956,6 +964,21 @@ func TestADataModuleIsBackedUpFirstAndHeldWhenItFails(t *testing.T) {
|
|||||||
// unaskedWords is the hold a recovery module that could not be asked left (novox's indexer, 2026-11-20).
|
// unaskedWords is the hold a recovery module that could not be asked left (novox's indexer, 2026-11-20).
|
||||||
const unaskedWords = "the restore point of db's cache (form 1) was not taken: the recovery module could not be asked: not asked: nothing on this machine answers mesh.seat.mesh-recovery.call.snapshot-kept.node~n1 (nats: no responders available for request)"
|
const unaskedWords = "the restore point of db's cache (form 1) was not taken: the recovery module could not be asked: not asked: nothing on this machine answers mesh.seat.mesh-recovery.call.snapshot-kept.node~n1 (nats: no responders available for request)"
|
||||||
|
|
||||||
|
// liveUnaskedWords are the indexer's hold on the control-node as its wait says them (315 bytes, 2026-11-20 19:20): its detail,
|
||||||
|
// cut as a have's is, has lost "the recovery module could not be asked".
|
||||||
|
const liveUnaskedWords = "the restore point of mesh-delivery-indexer's config-candidates (form 0) was not taken: the recovery module could not be asked: " +
|
||||||
|
"mesh-recovery.snapshot-kept could not be asked: not asked: nothing on this machine answers " +
|
||||||
|
"mesh.seat.mesh-recovery.call.snapshot-kept.node~novox (nats: no responders available for request)"
|
||||||
|
|
||||||
|
// cutAsAHaveIs cuts words as the engine's have writer does (cmd/mesh-host shorten): the first 100 bytes, " … ", and the end, 300
|
||||||
|
// in all.
|
||||||
|
func cutAsAHaveIs(s string) string {
|
||||||
|
if len(s) <= 300 {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
return s[:100] + " … " + s[len(s)-(300-100-len(" … ")):]
|
||||||
|
}
|
||||||
|
|
||||||
// A data module with a good backup is applied after it; one that never ran has nothing to back up.
|
// A data module with a good backup is applied after it; one that never ran has nothing to back up.
|
||||||
func TestABackupDoneIsFollowedByTheApplyAndANewModuleIsNotBackedUp(t *testing.T) {
|
func TestABackupDoneIsFollowedByTheApplyAndANewModuleIsNotBackedUp(t *testing.T) {
|
||||||
t.Run("a move across a kept data's form change is taken as a restore point and restored at a revert", testAMoveAcrossAFormChange)
|
t.Run("a move across a kept data's form change is taken as a restore point and restored at a revert", testAMoveAcrossAFormChange)
|
||||||
|
|||||||
+10
-3
@@ -136,14 +136,21 @@ const (
|
|||||||
// recoveryCause says why a held have holds, where a restore point was not taken: the recovery module could not be asked
|
// recoveryCause says why a held have holds, where a restore point was not taken: the recovery module could not be asked
|
||||||
// (recoveryUnasked), or a holder answered and the point failed (recoveryFailed); recoveryNone for any other hold (design 47 H,
|
// (recoveryUnasked), or a holder answered and the point failed (recoveryFailed); recoveryNone for any other hold (design 47 H,
|
||||||
// H-A-180).
|
// H-A-180).
|
||||||
|
//
|
||||||
|
// The words are the wait's, which the have keeps whole; the detail is cut to its head and tail when the have is written (the
|
||||||
|
// indexer's on the control-node lost "could not be asked" so), and is read only for a hold with no wait.
|
||||||
func recoveryCause(h Have) int {
|
func recoveryCause(h Have) int {
|
||||||
if !strings.HasPrefix(h.Detail, pointNotTaken) {
|
words := h.Detail
|
||||||
|
if h.Wait != nil && h.Wait.Words != "" {
|
||||||
|
words = h.Wait.Words
|
||||||
|
}
|
||||||
|
if !strings.HasPrefix(words, pointNotTaken) {
|
||||||
return recoveryNone
|
return recoveryNone
|
||||||
}
|
}
|
||||||
if strings.Contains(h.Detail, recoveryNotAsked) {
|
if strings.Contains(words, recoveryNotAsked) {
|
||||||
return recoveryUnasked
|
return recoveryUnasked
|
||||||
}
|
}
|
||||||
if h.Detail == BackupInterrupted || strings.HasSuffix(h.Detail, BackupInterrupted) {
|
if words == BackupInterrupted || strings.HasSuffix(words, BackupInterrupted) {
|
||||||
return recoveryNone
|
return recoveryNone
|
||||||
}
|
}
|
||||||
return recoveryFailed
|
return recoveryFailed
|
||||||
|
|||||||
Reference in New Issue
Block a user