mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Relax assumptions about all client request persisted in WAL to only require first and last request to be persisted
This assumption is not true during durability issues like #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 <siarkowicz@google.com>
This commit is contained in:
parent
7bff148052
commit
7181c7532f
@ -149,17 +149,38 @@ func validatePersistedRequestMatchClientRequests(reports []report.ClientReport,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for requestDump, op := range clientRequests {
|
var firstOp, lastOp porcupine.Operation
|
||||||
request := op.Input.(model.EtcdRequest)
|
for _, r := range reports {
|
||||||
response := op.Output.(model.MaybeEtcdResponse)
|
for _, op := range r.KeyValue {
|
||||||
if response.Error != "" || request.IsRead() {
|
request := op.Input.(model.EtcdRequest)
|
||||||
continue
|
response := op.Output.(model.MaybeEtcdResponse)
|
||||||
}
|
if response.Error != "" || request.IsRead() {
|
||||||
_, found := persistedRequestSet[requestDump]
|
continue
|
||||||
if !found {
|
}
|
||||||
return fmt.Errorf("succesful client write %+v was not persisted, required to validate", requestDump)
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user