ffldb: close block files before deleting them

The block files may be open when deleteFile is called.  This resulted in
files not being deleted and erroring out on windows.  Properly closing
the files closing the files avoids this error.
This commit is contained in:
Calvin Kim 2024-07-01 20:15:18 +09:00
parent 8ed8ef1340
commit c9fae1ac7c

View file

@ -1630,6 +1630,9 @@ func (tx *transaction) writePendingAndCommit() error {
// We do this first before doing any of the writes as we can't undo
// deletions of files.
for _, fileNum := range tx.pendingDelFileNums {
// Make sure the file is closed before attempting to delete it.
tx.db.store.closeFile(fileNum)
err := tx.db.store.deleteFileFunc(fileNum)
if err != nil {
// Nothing we can do if we fail to delete blocks besides