btcd icon indicating copy to clipboard operation
btcd copied to clipboard

ffldb: close block files

Open kcalvinalvin opened this issue 1 year ago • 4 comments

On methods readBlock and readBlockRegion, the opened files were never closed which resulted in errors when attempting to delete these files on pruning on windows. Properly closing the files avoids this error.

Doing a full block sync on windows to make sure. Definitely seems to be the fix as I'm not having any issues so far (few hours into ibd).

kcalvinalvin avatar Jul 01 '24 11:07 kcalvinalvin

Pull Request Test Coverage Report for Build 9743641160

Details

  • 2 of 12 (16.67%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 57.228%

Changes Missing Coverage Covered Lines Changed/Added Lines %
database/ffldb/db.go 2 12 16.67%
<!-- Total: 2 12
Totals Coverage Status
Change from base Build 9701102084: 0.03%
Covered Lines: 29839
Relevant Lines: 52141

💛 - Coveralls

coveralls avatar Jul 01 '24 11:07 coveralls

Pull Request Test Coverage Report for Build 9744922494

Details

  • 17 of 20 (85.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 57.202%

Changes Missing Coverage Covered Lines Changed/Added Lines %
database/ffldb/blockio.go 14 17 82.35%
<!-- Total: 17 20
Totals Coverage Status
Change from base Build 9701102084: 0.002%
Covered Lines: 29824
Relevant Lines: 52138

💛 - Coveralls

coveralls avatar Jul 01 '24 13:07 coveralls

he opened files were never closed which resulted in errors when attempting to delete these files on pruning on windows.

I've had similar issues with Windows, basically that you always need to close files before doing operations such as rename or delete.

Roasbeef avatar Jul 01 '24 18:07 Roasbeef

he opened files were never closed which resulted in errors when attempting to delete these files on pruning on windows.

I've had similar issues with Windows, basically that you always need to close files before doing operations such as rename or delete.

Yeah that seems to have been the issue. No troubles syncing with pruning turned on

kcalvinalvin avatar Jul 02 '24 04:07 kcalvinalvin

cc: @guggero for review

saubyk avatar Jul 09 '24 16:07 saubyk