test: add failpoint for mlock operation

Signed-off-by: Benjamin Wang <wachao@vmware.com>
pull/433/head
Benjamin Wang 2023-03-20 15:34:31 +08:00
parent 0c2c0a257a
commit c00862aa7c
1 changed files with 4 additions and 0 deletions

4
db.go
View File

@ -517,6 +517,8 @@ func (db *DB) mmapSize(size int) (int, error) {
}
func (db *DB) munlock(fileSize int) error {
// gofail: var munlockError string
// return errors.New(munlockError)
if err := munlock(db, fileSize); err != nil {
return fmt.Errorf("munlock error: " + err.Error())
}
@ -524,6 +526,8 @@ func (db *DB) munlock(fileSize int) error {
}
func (db *DB) mlock(fileSize int) error {
// gofail: var mlockError string
// return errors.New(mlockError)
if err := mlock(db, fileSize); err != nil {
return fmt.Errorf("mlock error: " + err.Error())
}