Merge pull request #15252 from ahrtr/walSync_failpoint_20230207

etcdserver: add failpoints walBeforeSync and walAfterSync
This commit is contained in:
Marek Siarkowicz 2023-02-08 09:59:46 +01:00 committed by GitHub
commit 586eaccc4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -115,7 +115,7 @@ GOFAIL_VERSION = $(shell cd tools/mod && go list -m -f {{.Version}} go.etcd.io/g
.PHONY: gofail-enable
gofail-enable: install-gofail
gofail enable server/etcdserver/ server/storage/backend/ server/storage/mvcc/
gofail enable server/etcdserver/ server/storage/backend/ server/storage/mvcc/ server/storage/wal/
cd ./server && go get go.etcd.io/gofail@${GOFAIL_VERSION}
cd ./etcdutl && go get go.etcd.io/gofail@${GOFAIL_VERSION}
cd ./etcdctl && go get go.etcd.io/gofail@${GOFAIL_VERSION}
@ -123,7 +123,7 @@ gofail-enable: install-gofail
.PHONY: gofail-disable
gofail-disable: install-gofail
gofail disable server/etcdserver/ server/storage/backend/ server/storage/mvcc/
gofail disable server/etcdserver/ server/storage/backend/ server/storage/mvcc/ server/storage/wal/
cd ./server && go mod tidy
cd ./etcdutl && go mod tidy
cd ./etcdctl && go mod tidy

View File

@ -950,7 +950,10 @@ func (w *WAL) Save(st raftpb.HardState, ents []raftpb.Entry) error {
}
if curOff < SegmentSizeBytes {
if mustSync {
return w.sync()
// gofail: var walBeforeSync struct{}
err = w.sync()
// gofail: var walAfterSync struct{}
return err
}
return nil
}