Skip to content

Commit

Permalink
tx.go: introduce failpoint before fdatasync
Browse files Browse the repository at this point in the history
It can be used for power failure cases.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
  • Loading branch information
fuweid committed Nov 26, 2023
1 parent 231772f commit 6c2d428
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ func (tx *Tx) write() error {

// Ignore file sync if flag is set on DB.
if !tx.db.NoSync || common.IgnoreNoSync {
// gofail: var beforeSyncDirtyPages struct{}
if err := fdatasync(tx.db); err != nil {
return err
}
Expand Down Expand Up @@ -512,6 +513,7 @@ func (tx *Tx) writeMeta() error {
return err
}
if !tx.db.NoSync || common.IgnoreNoSync {
// gofail: var beforeSyncMetaPage struct{}
if err := fdatasync(tx.db); err != nil {
return err
}
Expand Down

0 comments on commit 6c2d428

Please sign in to comment.