Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/rawdb: fix cornercase shutdown behaviour in freezer #1405

Merged
merged 1 commit into from
Jan 18, 2023
Merged

Conversation

ucwong
Copy link
Member

@ucwong ucwong commented Jan 17, 2023

This PR does a few things.
It fixes a shutdown-order flaw in the chainfreezer. Previously, the chain-freezer would shutdown the freezer backend first, and then signal for the loop to exit. This can lead to a scenario where the freezer tries to fsync closed files, which is an error-conditon that could lead to exit via log.Crit.

It also makes the printout more detailed when truncating 'dangling' items, by showing the exact number instead of approximate MB.

This PR also adds calls to fsync files before closing them, and also makes the db inspect command slightly more robust.

This PR does a few things.
It fixes a shutdown-order flaw in the chainfreezer. Previously, the chain-freezer would shutdown the freezer backend first, and then signal for the loop to exit. This can lead to a scenario where the freezer tries to fsync closed files, which is an error-conditon that could lead to exit via log.Crit.

It also makes the printout more detailed when truncating 'dangling' items, by showing the exact number instead of approximate MB.

This PR also adds calls to fsync files before closing them, and also makes the `db inspect` command slightly more robust.
@codecov
Copy link

codecov bot commented Jan 17, 2023

Codecov Report

Merging #1405 (102d7f7) into master (acecb39) will increase coverage by 0.04%.
The diff coverage is 96.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1405      +/-   ##
==========================================
+ Coverage   51.68%   51.73%   +0.04%     
==========================================
  Files         464      464              
  Lines       58392    58404      +12     
==========================================
+ Hits        30181    30215      +34     
+ Misses      25921    25891      -30     
- Partials     2290     2298       +8     
Impacted Files Coverage Δ
core/rawdb/freezer_table.go 76.15% <96.15%> (+1.25%) ⬆️
core/rawdb/chain_freezer.go 16.46% <100.00%> (-4.75%) ⬇️
trie/sync_bloom.go 58.33% <0.00%> (-5.96%) ⬇️
core/rawdb/chain_iterator.go 58.65% <0.00%> (-2.24%) ⬇️
p2p/simulations/mocker.go 33.63% <0.00%> (-0.91%) ⬇️
ctxc/downloader/downloader.go 76.65% <0.00%> (-0.63%) ⬇️
p2p/simulations/http.go 69.56% <0.00%> (-0.55%) ⬇️
p2p/peer.go 75.00% <0.00%> (ø)
p2p/server.go 66.35% <0.00%> (ø)
... and 7 more

@ucwong ucwong merged commit 665b42d into master Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants