Skip to content

Commit

Permalink
etcdserver: add failpoints walBeforeSync and walAfterSync
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Wang <wachao@vmware.com>
  • Loading branch information
ahrtr committed Feb 8, 2023
1 parent 9bae010 commit 1fe7b97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ 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}
cd ./tests && go get go.etcd.io/gofail@${GOFAIL_VERSION}

.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
Expand Down
5 changes: 4 additions & 1 deletion server/storage/wal/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 1fe7b97

Please sign in to comment.