Fixing a bug when downloading changes, and making change download more efficient (more async)
[?]
Feb 27, 2021, 7:14 PM
TKEVOH7HXON7SOBGXTUDHAHO2U2GPTQRNESP6ERKUQAS526OZIRACDependencies
- [2]
TZ42DX3BProperly dropping a channel - [3]
DNQHXWRZaddress clippy hard errors - [4]
CCLLB7OIUpgrading to Sanakirja 0.15 + version bump - [5]
WTZXEWY7Flushing the futures pipeline when downloading over HTTP(S) - [6]
Q45QHPO4Feedback on network stuff - [7]
K6GWUOD5Styling progress bars - [8]
HXEIH4UQPulling more than 100 changes at once - [9]
5QTMRUXNFixing a race condition between progress bars - [10]
YN63NUZOSanakirja 1.0 - [11]
GHO6DWPIRefactoring iterators - [12]
VO5OQW4WRemoving anyhow in libpijul - [13]
SZWBLWZ4Reading ~/.ssh/config - [14]
IQ4FCHPZHTTP connections: pooling + retry on error - [15]
5XMUEZMZpijul-clone: avoid panics on parsing remote URLs - [16]
VBMXB443Retrying if the HTTP connection drops while reading the body - [17]
SXEYMYF7Fixing the bad changes in history (unfortunately, by rebooting). - [18]
76PCXGMLPushing to, and pulling from the local repository - [19]
WLUID7NADo not block when downloading more than 100 changes over SSH - [20]
BZSC7VMYaddress clippy lints - [21]
367UBQ6KForwarding SSH stderr, and progress bar for push - [22]
L4JXJHWXpijul/*: reorganize imports and remove extern crate - [23]
UDHP4ZVBFixing SSH asynchronicity issues - [24]
FBXYP7QMForgot to add remote::http - [25]
I52XSRUHMassive cleanup, and simplification - [26]
KTTKF3RWLocking stderr and the progress bar in SSH - [27]
QMTANHVNReset: only output changed files - [28]
X6YFD4WVDo not download changes if we already have them - [29]
LGEJSLTYFixing output (including its uses in reset and pull) - [30]
MU5GSJAWPartial push and pull (WARNING: breaks the existing protocol) - [*]
6YMDOZIBRefactoring apply
Change contents
- replacement in pijul/src/remote/ssh.rs at line 14
use log::{debug, error};use log::{debug, error, trace}; - replacement in pijul/src/remote/ssh.rs at line 400
debug!("data {:?} {:?}", channel, data.len());trace!("data {:?} {:?}", channel, data.len()); - replacement in pijul/src/remote/ssh.rs at line 430
debug!("state changes");trace!("state changes"); - edit in pijul/src/remote/ssh.rs at line 439
debug!("writing {:?} bytes", *remaining_len); - edit in pijul/src/remote/ssh.rs at line 462
debug!("before pop: {:?}", path); - edit in pijul/src/remote/ssh.rs at line 468
debug!("after pop: {:?}", path); - replacement in pijul/src/remote/ssh.rs at line 484
debug!("need more data");trace!("need more data"); - replacement in pijul/src/remote/ssh.rs at line 488
debug!("finished, {:?} {:?}", p, data.len());trace!("finished, {:?} {:?}", p, data.len()); - replacement in pijul/src/remote/ssh.rs at line 797
c: &[libpijul::pristine::Hash],c: &mut tokio::sync::mpsc::Receiver<libpijul::pristine::Hash>, - replacement in pijul/src/remote/ssh.rs at line 808
c: &[libpijul::pristine::Hash],c: &mut tokio::sync::mpsc::Receiver<libpijul::pristine::Hash>, - edit in pijul/src/remote/ssh.rs at line 813
if c.is_empty() {return Ok(());} - edit in pijul/src/remote/ssh.rs at line 815
libpijul::changestore::filesystem::push_filename(&mut path, &c[0]); - edit in pijul/src/remote/ssh.rs at line 818
debug!("changes_dir = {:?}", changes_dir); - replacement in pijul/src/remote/ssh.rs at line 825
hashes: c.to_vec(),hashes: Vec::new(), - replacement in pijul/src/remote/ssh.rs at line 829
for c in c {let mut len = 0;while let Some(c) = c.recv().await {if let State::Changes { ref mut hashes, .. } = *self.state.lock().await {hashes.push(c);} - edit in pijul/src/remote/ssh.rs at line 845
len += 1; - replacement in pijul/src/remote/ssh.rs at line 847
let progress = ProgressBar::new(c.len() as u64);let progress = ProgressBar::new(len as u64); - replacement in pijul/src/remote/ssh.rs at line 876
debug!("done downloading");debug!("done downloading {:?}", changes_dir); - replacement in pijul/src/remote/mod.rs at line 7
use libpijul::pristine::{Base32, ChannelRef, Hash, Merkle, MutTxnT, RemoteRef, TxnT};use libpijul::pristine::{Base32, ChannelRef, GraphIter, Hash, Merkle, MutTxnT, RemoteRef, TxnT}; - replacement in pijul/src/remote/mod.rs at line 350
hashes: &[libpijul::pristine::Hash],hashes: &mut tokio::sync::mpsc::Receiver<libpijul::pristine::Hash>, - edit in pijul/src/remote/mod.rs at line 363
libpijul::changestore::filesystem::pop_filename(path); - edit in pijul/src/remote/mod.rs at line 376
let mut self_ = std::mem::replace(self, RemoteRepo::None);let (hash_send, mut hash_recv) = tokio::sync::mpsc::channel(100);let mut change_path_ = repo.path.clone();change_path_.push(DOT_DIR);change_path_.push("changes");let t = tokio::spawn(async move {self_.download_changes(&mut hash_recv, &mut send, &mut change_path_, false).await?;Ok::<_, anyhow::Error>(self_)}); - replacement in pijul/src/remote/mod.rs at line 390
let mut to_download_ = Vec::new();let mut len = 0; - replacement in pijul/src/remote/mod.rs at line 394
to_download_.push(*h)hash_send.send(*h).await?;len += 1 - edit in pijul/src/remote/mod.rs at line 399
let to_download = to_download_.clone(); - edit in pijul/src/remote/mod.rs at line 400[3.1]→[3.1:293](∅→∅),[3.293]→[3.69754:69755](∅→∅),[3.11284]→[3.69754:69755](∅→∅),[3.69754]→[3.69754:69755](∅→∅)
let mut self_ = std::mem::replace(self, RemoteRepo::None);let t = tokio::spawn(async move {self_.download_changes(&to_download_, &mut send, &mut change_path_, false).await?;Ok::<_, anyhow::Error>(self_)}); - replacement in pijul/src/remote/mod.rs at line 403
let p = indicatif::ProgressBar::new(to_download.len() as u64);let p = indicatif::ProgressBar::new(len); - replacement in pijul/src/remote/mod.rs at line 497[3.71469]→[3.71469:71529](∅→∅),[3.71529]→[3.11285:11427](∅→∅),[3.11427]→[3.71732:71746](∅→∅),[3.71732]→[3.71732:71746](∅→∅)
while let Some(hash) = recv_hash.recv().await {self_.download_changes(&[hash], &mut send_signal, &mut change_path_, false).await?;}self_.download_changes(&mut recv_hash, &mut send_signal, &mut change_path_, false).await?; - replacement in pijul/src/remote/mod.rs at line 560
pub async fn complete_changes<T: MutTxnT + TxnTExt>(pub async fn complete_changes<T: MutTxnT + TxnTExt + GraphIter>( - edit in pijul/src/remote/mod.rs at line 568
debug!("complete changes {:?}", changes); - replacement in pijul/src/remote/mod.rs at line 575[3.75446]→[3.75446:75562](∅→∅),[3.75562]→[3.11428:11562](∅→∅),[3.11562]→[3.75825:75839](∅→∅),[3.75825]→[3.75825:75839](∅→∅),[3.75983]→[3.75983:76064](∅→∅)
while let Some(h) = recv_hash.recv().await {debug!("downloading full patch: {:?}", h);self_.download_changes(&[h], &mut send_sig, &mut changes_dir, true).await?;}let result: Result<_, anyhow::Error> = Ok(self_);resultself_.download_changes(&mut recv_hash, &mut send_sig, &mut changes_dir, true).await?;Ok::<_, anyhow::Error>(self_) - edit in pijul/src/remote/mod.rs at line 599
debug!("could not find internal for {:?}", sc); - replacement in pijul/src/remote/mod.rs at line 609[3.76925]→[3.8315:8360](∅→∅),[3.8360]→[3.899:942](∅→∅),[3.9672]→[3.899:942](∅→∅),[3.899]→[3.899:942](∅→∅)
if txn.is_alive(&channel, &v)? {send_hash.send(*c).await?;let graph = txn.graph(&channel);let mut it = txn.iter_graph(graph, Some(&v))?;while let Some(x) = txn.next_graph(&graph, &mut it) {let (v, e) = x?;if v.change > change {break;} else if e.flag().is_alive_parent() {send_hash.send(*c).await?;break;} - replacement in pijul/src/remote/local.rs at line 129
c: &[libpijul::pristine::Hash],hashes: &mut tokio::sync::mpsc::Receiver<libpijul::pristine::Hash>, - replacement in pijul/src/remote/local.rs at line 133
for c in c {libpijul::changestore::filesystem::push_filename(&mut self.changes_dir, c);libpijul::changestore::filesystem::push_filename(&mut path, c);while let Some(c) = hashes.recv().await {libpijul::changestore::filesystem::push_filename(&mut self.changes_dir, &c);libpijul::changestore::filesystem::push_filename(&mut path, &c); - replacement in pijul/src/remote/local.rs at line 149
send.send(*c).await?;send.send(c).await?; - replacement in pijul/src/remote/http.rs at line 74
hashes: &[libpijul::pristine::Hash],hashes: &mut tokio::sync::mpsc::Receiver<libpijul::pristine::Hash>, - replacement in pijul/src/remote/http.rs at line 79
let progress = ProgressBar::new(hashes.len() as u64);let progress = ProgressBar::new(0 as u64); - replacement in pijul/src/remote/http.rs at line 87[3.981]→[3.432:458](∅→∅),[3.1338]→[3.432:458](∅→∅),[3.1365]→[3.432:458](∅→∅),[3.1448]→[3.432:458](∅→∅),[3.1538]→[3.432:458](∅→∅),[3.432]→[3.432:458](∅→∅)
for c in hashes {while let Some(c) = hashes.recv().await {progress.inc_length(1); - replacement in pijul/src/remote/http.rs at line 97
*c,c, - replacement in libpijul/src/pristine/sanakirja.rs at line 552
fn iter_graph(&self, g: &Self::Graph) -> Result<Self::GraphCursor, TxnErr<Self::GraphError>> {Ok(::sanakirja::btree::cursor::Cursor::new(&self.txn, &g)?)fn iter_graph(&self,g: &Self::Graph,s: Option<&Vertex<ChangeId>>,) -> Result<Self::GraphCursor, TxnErr<Self::GraphError>> {let mut c = ::sanakirja::btree::cursor::Cursor::new(&self.txn, &g)?;if let Some(s) = s {c.set(&self.txn, s, None)?;}Ok(c) - replacement in libpijul/src/pristine/sanakirja.rs at line 1643
.map_err(|_| SanakirjaError::ChannelRc { c: name0.to_string() })?.map_err(|_| SanakirjaError::ChannelRc {c: name0.to_string(),})? - replacement in libpijul/src/pristine/mod.rs at line 350
fn iter_graph(&self, g: &Self::Graph) -> Result<Self::GraphCursor, TxnErr<Self::GraphError>>;fn iter_graph(&self,g: &Self::Graph,s: Option<&Vertex<ChangeId>>,) -> Result<Self::GraphCursor, TxnErr<Self::GraphError>>; - replacement in libpijul/src/pristine/mod.rs at line 913
let mut cursor = txn.iter_graph(&channel).unwrap();let mut cursor = txn.iter_graph(&channel, None).unwrap(); - replacement in libpijul/src/pristine/mod.rs at line 961
let mut cursor = txn.iter_graph(&channel).unwrap();let mut cursor = txn.iter_graph(&channel, None).unwrap(); - edit in libpijul/src/pristine/edge.rs at line 53[32.9044][32.9044]
- edit in libpijul/src/pristine/edge.rs at line 55[32.9058][32.9058]
pub fn is_alive_parent(&self) -> bool {*self & (EdgeFlags::DELETED | EdgeFlags::PARENT) == EdgeFlags::PARENT}#[inline]