Skip to content

Commit

Permalink
Merge pull request etcd-io#15264 from ahrtr/3.5_walSync_failpoint_202…
Browse files Browse the repository at this point in the history
…30209

[3.5] etcdserver: add failpoints walBeforeSync and walAfterSync
  • Loading branch information
serathius authored and tjungblu committed Jul 26, 2023
2 parents 8d79b19 + f2ecc42 commit 9a1c0cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ GO_BUILD_ENV=("CGO_ENABLED=0" "GO_BUILD_FLAGS=${GO_BUILD_FLAGS}" "GOOS=${GOOS}"
toggle_failpoints() {
mode="$1"
if command -v gofail >/dev/null 2>&1; then
run gofail "$mode" server/etcdserver/ server/mvcc/backend/
run gofail "$mode" server/etcdserver/ server/mvcc/backend/ server/wal/
elif [[ "$mode" != "disable" ]]; then
log_error "FAILPOINTS set but gofail not found"
exit 1
Expand Down
5 changes: 4 additions & 1 deletion server/wal/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,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 9a1c0cb

Please sign in to comment.