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

fix: Create a separate directory for estimates tables #2998

Merged
merged 3 commits into from
Jan 13, 2022

Conversation

gregorycoppola
Copy link
Contributor

fixes #2991

  1. Create a directory chainstate/estimates
  2. Ensure this exists
  3. Use this for the new estimation db's

@gregorycoppola gregorycoppola changed the base branch from master to develop January 12, 2022 21:18
@gregorycoppola gregorycoppola changed the title fix: Create a separate directory for estimation tables fix: Create a separate directory for estimates tables Jan 12, 2022
@codecov
Copy link

codecov bot commented Jan 12, 2022

Codecov Report

Merging #2998 (90e6a88) into develop (7011f32) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2998      +/-   ##
===========================================
+ Coverage    82.62%   82.64%   +0.01%     
===========================================
  Files          242      242              
  Lines       194443   194452       +9     
===========================================
+ Hits        160664   160698      +34     
+ Misses       33779    33754      -25     
Impacted Files Coverage Δ
testnet/stacks-node/src/config.rs 50.31% <100.00%> (+0.40%) ⬆️
src/deps/bitcoin/network/serialize.rs 43.00% <0.00%> (-5.00%) ⬇️
src/net/atlas/download.rs 82.63% <0.00%> (-1.31%) ⬇️
src/burnchains/bitcoin/indexer.rs 83.66% <0.00%> (-0.89%) ⬇️
src/util/bloom.rs 93.32% <0.00%> (-0.14%) ⬇️
src/burnchains/burnchain.rs 90.69% <0.00%> (-0.05%) ⬇️
src/net/relay.rs 34.11% <0.00%> (-0.04%) ⬇️
testnet/stacks-node/src/tests/neon_integrations.rs 84.82% <0.00%> (-0.02%) ⬇️
src/net/inv.rs 67.67% <0.00%> (ø)
src/burnchains/bitcoin/mod.rs 39.13% <0.00%> (ø)
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7011f32...90e6a88. Read the comment docs.

@kantai
Copy link
Member

kantai commented Jan 12, 2022

I think this PR is going to need to add a fs::create_dir_all call to create the new directory (https://doc.rust-lang.org/std/fs/fn.create_dir_all.html)

pub fn get_estimates_path(&self) -> PathBuf {
let mut path = self.get_chainstate_path();
path.push("estimates");
assert!(fs::create_dir_all(&path).is_ok());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kantai note the call to create_dir_all

What do you think about this location for it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, oops, sorry I missed this -- yeah, this works.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though, I would suggest changing from the assert to an expect:

Suggested change
assert!(fs::create_dir_all(&path).is_ok());
fs::create_dir_all(&path).expect("Failed to create cost estimates path in node chainstate directory.");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Copy link
Contributor

@pavitthrap pavitthrap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Copy link
Member

@kantai kantai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gregorycoppola
Copy link
Contributor Author

Thanks for the reviews.

I added Issue #3000 for the broken test because I think it's unrelated and flaky.

@gregorycoppola gregorycoppola merged commit c61a7da into develop Jan 13, 2022
@blockstack-devops
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@stacks-network stacks-network locked as resolved and limited conversation to collaborators Nov 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make a separate chainstate directory for fee_estimation constructs
4 participants