Skip to content

Commit 2c8570b

Browse files
committed
fix mmap_windows.go for read mode
can't / shouldn't Truncate or updateFileTime if read mode
1 parent ced4042 commit 2c8570b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

db19/stor/mmap_windows.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@ func (ms *mmapStor) close(size int64, unmap bool) {
7979
}
8080
exit.Progress(" unmapped")
8181
}
82-
ms.file.Truncate(size) // may not work if not unmap ms.updateFileTime()
83-
exit.Progress(" file time updating")
84-
ms.updateFileTime()
82+
if ms.mode != Read {
83+
ms.file.Truncate(size) // may not work if not unmap
84+
exit.Progress(" file time updating")
85+
ms.updateFileTime()
86+
}
8587
exit.Progress(" file unlocking")
8688
filelock.Unlock(ms.file)
8789
exit.Progress(" file unlocked")

0 commit comments

Comments
 (0)