Skip to content

Commit

Permalink
Relax assumptions about all client request persisted in WAL to only r…
Browse files Browse the repository at this point in the history
…equire first and last request to be persisted

This assumption is not true during durability issues like etcd-io#14370.
In reality we want to avoid situations where WAL is was truncated, for
that it's enough that we ensure that first and last operations are
present.

Found it when running `make test-robustness-issue14370` and instead of
getting `Model is not linearizable` I got that assumptions were broken.

Signed-off-by: Marek Siarkowicz <[email protected]>
  • Loading branch information
serathius committed May 8, 2024
1 parent 7bff148 commit 7181c75
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions tests/robustness/validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,38 @@ func validatePersistedRequestMatchClientRequests(reports []report.ClientReport,
}
}

for requestDump, op := range clientRequests {
request := op.Input.(model.EtcdRequest)
response := op.Output.(model.MaybeEtcdResponse)
if response.Error != "" || request.IsRead() {
continue
}
_, found := persistedRequestSet[requestDump]
if !found {
return fmt.Errorf("succesful client write %+v was not persisted, required to validate", requestDump)
var firstOp, lastOp porcupine.Operation
for _, r := range reports {
for _, op := range r.KeyValue {
request := op.Input.(model.EtcdRequest)
response := op.Output.(model.MaybeEtcdResponse)
if response.Error != "" || request.IsRead() {
continue
}
if firstOp.Call == 0 || op.Call < firstOp.Call {
firstOp = op
}
if lastOp.Call == 0 || op.Call > lastOp.Call {
lastOp = op
}
}
}
firstOpData, err := json.Marshal(firstOp.Input.(model.EtcdRequest))
if err != nil {
return err
}
_, found := persistedRequestSet[string(firstOpData)]
if !found {
return fmt.Errorf("first succesful client write %s was not persisted, required to validate", firstOpData)
}
lastOpData, err := json.Marshal(lastOp.Input.(model.EtcdRequest))
if err != nil {
return err
}
_, found = persistedRequestSet[string(lastOpData)]
if !found {
return fmt.Errorf("last succesful client write %s was not persisted, required to validate", lastOpData)
}
return nil
}

Expand Down

0 comments on commit 7181c75

Please sign in to comment.