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: snappy downloader #5393

Open
wants to merge 38 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
28fb59b
fix: drain the relayer channel to alleviate block download pressure
jcnelson Oct 28, 2024
61d701b
chore: only consider block-bearing network results if in ibd mode or …
jcnelson Oct 28, 2024
e8cb18f
chore: shed network results when in ibd or with download backpressure…
jcnelson Oct 28, 2024
be96888
chore: fix compile issues
jcnelson Oct 28, 2024
c5ec5b3
fix: drive main loop wakeups when we're backlogged
jcnelson Oct 28, 2024
0d26d50
Merge branch 'develop' into fix/relayer-drain-channel
jcnelson Oct 29, 2024
0685670
chore: option to disable block pushes
jcnelson Oct 30, 2024
9bc3125
Merge branch 'fix/relayer-drain-channel' of https://github.com/stacks…
jcnelson Oct 30, 2024
babd3d9
feat: make NetworkResults mergeable
jcnelson Oct 31, 2024
596d41d
chore: make StackerDBSyncResult Debug and PartialEq
jcnelson Oct 31, 2024
1fc9d72
chore: test NetworkResult::update()
jcnelson Oct 31, 2024
225ada1
chore: remove logic to drain the network result channel (it's not nee…
jcnelson Oct 31, 2024
07b65cb
chore: remove dead code
jcnelson Oct 31, 2024
27e7301
chore: count download attempts, and don't download processed tenures,…
jcnelson Oct 31, 2024
d1bf24f
chore: p2p --> relayer channel only needs one slot
jcnelson Oct 31, 2024
72c9f54
chore: pub(crate) visibility to avoid private leakage
jcnelson Oct 31, 2024
9361bea
chore: log attempt failures, and only start as many downloaders as given
jcnelson Oct 31, 2024
c88d0e6
chore: log more downloader diagnostics
jcnelson Oct 31, 2024
fa493d5
chore: deprioritize unreliable peers
jcnelson Oct 31, 2024
71eccc9
Merge branch 'develop' into fix/relayer-drain-channel
jcnelson Nov 1, 2024
26d8a4d
Merge branch 'develop' into fix/relayer-drain-channel
jcnelson Nov 1, 2024
1074fe0
fix: off-by-one error in reward set caching logic in p2p stack
jcnelson Nov 1, 2024
e4e9b18
Merge branch 'fix/relayer-drain-channel' of https://github.com/stacks…
jcnelson Nov 1, 2024
e3b41fa
Merge branch 'develop' into fix/relayer-drain-channel
jcnelson Nov 1, 2024
ca3b2ae
chore: API sync
jcnelson Nov 4, 2024
06108f2
fix: use burnchain tip reward cycle to infer whether or not to sync t…
jcnelson Nov 4, 2024
3369de5
chore: API sync
jcnelson Nov 4, 2024
0e1058e
chore: store burnchain DB handle in p2p network and load burnchain he…
jcnelson Nov 4, 2024
ad4faaf
chore: API sync, and test fixes
jcnelson Nov 4, 2024
4365ebf
chore: API sync
jcnelson Nov 4, 2024
19b7c94
Merge branch 'fix/relayer-drain-channel' of https://github.com/stacks…
jcnelson Nov 4, 2024
30292cb
Merge branch 'develop' into fix/relayer-drain-channel
jcnelson Nov 4, 2024
18be1fe
chore: address PR feedback
jcnelson Nov 4, 2024
bce9839
fix: disconnect from neighbors serving unconfirmed tenures that are s…
jcnelson Nov 5, 2024
5ed737a
Merge branch 'develop' into fix/relayer-drain-channel
jcnelson Nov 5, 2024
ead50a8
fix: fix unit tests that broke due to PeerNetwork needing an existing…
jcnelson Nov 5, 2024
9731059
Merge branch 'develop' into fix/relayer-drain-channel
jcnelson Nov 5, 2024
45adc33
chore: address remaining PR feedback and get tests to pass
jcnelson Nov 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions stackslib/src/burnchains/burnchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,10 @@ impl Burnchain {
}

pub fn get_burnchaindb_path(&self) -> String {
if self.working_dir.as_str() == ":memory:" {
return ":memory:".to_string();
}

let chainstate_dir = Burnchain::get_chainstate_path_str(&self.working_dir);
let mut db_pathbuf = PathBuf::from(&chainstate_dir);
db_pathbuf.push("burnchain.sqlite");
Expand Down Expand Up @@ -743,12 +747,14 @@ impl Burnchain {
/// Open just the burnchain database
pub fn open_burnchain_db(&self, readwrite: bool) -> Result<BurnchainDB, burnchain_error> {
let burnchain_db_path = self.get_burnchaindb_path();
if let Err(e) = fs::metadata(&burnchain_db_path) {
warn!(
"Failed to stat burnchain DB path '{}': {:?}",
&burnchain_db_path, &e
);
return Err(burnchain_error::DBError(db_error::NoDBError));
if burnchain_db_path != ":memory:" {
if let Err(e) = fs::metadata(&burnchain_db_path) {
warn!(
"Failed to stat burnchain DB path '{}': {:?}",
&burnchain_db_path, &e
);
return Err(burnchain_error::DBError(db_error::NoDBError));
}
}
test_debug!(
"Open burnchain DB at {} (rw? {})",
Expand Down
55 changes: 30 additions & 25 deletions stackslib/src/burnchains/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,33 +1000,38 @@ impl BurnchainDB {
readwrite: bool,
) -> Result<BurnchainDB, BurnchainError> {
let mut create_flag = false;
let open_flags = match fs::metadata(path) {
Err(e) => {
if e.kind() == io::ErrorKind::NotFound {
// need to create
if readwrite {
create_flag = true;
let ppath = Path::new(path);
let pparent_path = ppath
.parent()
.unwrap_or_else(|| panic!("BUG: no parent of '{}'", path));
fs::create_dir_all(&pparent_path)
.map_err(|e| BurnchainError::from(DBError::IOError(e)))?;

OpenFlags::SQLITE_OPEN_READ_WRITE | OpenFlags::SQLITE_OPEN_CREATE
let open_flags = if path == ":memory:" {
create_flag = true;
OpenFlags::SQLITE_OPEN_READ_WRITE | OpenFlags::SQLITE_OPEN_CREATE
} else {
match fs::metadata(path) {
Err(e) => {
if e.kind() == io::ErrorKind::NotFound {
// need to create
if readwrite {
create_flag = true;
let ppath = Path::new(path);
let pparent_path = ppath
.parent()
.unwrap_or_else(|| panic!("BUG: no parent of '{}'", path));
fs::create_dir_all(&pparent_path)
.map_err(|e| BurnchainError::from(DBError::IOError(e)))?;

OpenFlags::SQLITE_OPEN_READ_WRITE | OpenFlags::SQLITE_OPEN_CREATE
} else {
return Err(BurnchainError::from(DBError::NoDBError));
}
} else {
return Err(BurnchainError::from(DBError::NoDBError));
return Err(BurnchainError::from(DBError::IOError(e)));
}
} else {
return Err(BurnchainError::from(DBError::IOError(e)));
}
}
Ok(_md) => {
// can just open
if readwrite {
OpenFlags::SQLITE_OPEN_READ_WRITE
} else {
OpenFlags::SQLITE_OPEN_READ_ONLY
Ok(_md) => {
// can just open
if readwrite {
OpenFlags::SQLITE_OPEN_READ_WRITE
} else {
OpenFlags::SQLITE_OPEN_READ_ONLY
}
}
}
};
Expand Down Expand Up @@ -1089,7 +1094,7 @@ impl BurnchainDB {
let conn = sqlite_open(path, open_flags, true)?;
let mut db = BurnchainDB { conn };

if readwrite {
if readwrite || path == ":memory:" {
db.add_indexes()?;
}
Ok(db)
Expand Down
Loading
Loading