mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-28 12:02:14 +01:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20603205d9 |
No files matched your search
@@ -278,12 +278,6 @@ pub struct AppConfig {
|
||||
/// the field.
|
||||
#[serde(default)]
|
||||
pub local_first: Option<bool>,
|
||||
/// Send a file small enough, with its thumbnails, to fit 128 KiB in one
|
||||
/// request instead of three or more. `None` means on. `false` uploads
|
||||
/// every file in blocks, the way all files went before. Defaulted for
|
||||
/// configs predating the field.
|
||||
#[serde(default)]
|
||||
pub small_uploads: Option<bool>,
|
||||
/// Ask GitHub once a day whether a newer release is out, and say so in the
|
||||
/// desktop app. Off by default: GitHub then sees the address and version
|
||||
/// asking. Never used where a package manager installs updates (see
|
||||
@@ -1083,7 +1077,6 @@ mod tests {
|
||||
language: Some("de".to_string()),
|
||||
online_map: true,
|
||||
local_first: Some(false),
|
||||
small_uploads: Some(false),
|
||||
update_check: true,
|
||||
update_last_checked: Some(1_760_000_000),
|
||||
update_latest: Some("3.6.0".to_string()),
|
||||
@@ -1103,7 +1096,6 @@ mod tests {
|
||||
assert_eq!(decoded.update_latest.as_deref(), Some("3.6.0"));
|
||||
assert_eq!(decoded.language.as_deref(), Some("de"));
|
||||
assert_eq!(decoded.upload_limit, Some(500_000));
|
||||
assert_eq!(decoded.small_uploads, Some(false));
|
||||
assert_eq!(decoded.download_limit, None);
|
||||
assert_eq!(decoded.files_view, config.files_view);
|
||||
assert_eq!(decoded.photos_view, config.photos_view);
|
||||
|
||||
@@ -241,13 +241,6 @@ pub fn mount_once(mountpoint: Option<PathBuf>) -> Result<pdfs_fuse::MountOutcome
|
||||
let (client, session) = rt
|
||||
.block_on(auth::resume_client())
|
||||
.context("resume session (run `pdfs login` first)")?;
|
||||
// On unless the config turns it off: the one-request upload for small
|
||||
// files is new, and this lets it be switched off without a new build.
|
||||
let small_uploads = config.small_uploads.unwrap_or(true);
|
||||
if !small_uploads {
|
||||
tracing::info!("small files are uploaded in blocks: small_uploads is off in the config");
|
||||
}
|
||||
let client = client.with_small_file_upload(small_uploads);
|
||||
|
||||
// Token updates are persisted automatically in real-time. The SDK session has
|
||||
// a token refresh callback registered during `resume_client` that writes updated
|
||||
|
||||
@@ -2490,6 +2490,70 @@ mod tests {
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "mounts FUSE: run with `cargo test -p pdfs-fuse sim:: -- --ignored`"]
|
||||
fn a_mirror_create_whose_reply_was_lost_is_adopted_after_a_restart_and_its_edit_lands() {
|
||||
// Drive made the file, but the answer never came back, and the daemon
|
||||
// stopped before it tried again. While it was stopped the file was
|
||||
// written again. A one-request small upload makes this the common way
|
||||
// a create goes unanswered: it leaves a whole file, never a draft. The
|
||||
// start must find that file, take it as this one, and put the newer
|
||||
// bytes on it: one file, no conflict copy.
|
||||
take_logged();
|
||||
let drive = FakeDrive::new();
|
||||
let dir = scratch("mirror-lost-create-restart");
|
||||
let (daemon, folder, client) = start_mirror(&drive, &dir, &[("a.txt", b"one")]);
|
||||
let local = dir.join("local");
|
||||
quiet_pass(&daemon, folder).expect("a quiet pass is traced");
|
||||
|
||||
client.lose_reply_to_next_create();
|
||||
std::fs::write(local.join("new.txt"), b"first").unwrap();
|
||||
assert!(wait_until(Duration::from_secs(30), || {
|
||||
on_drive(&drive, "mirrored/new.txt").is_some_and(|bytes| bytes == b"first")
|
||||
}));
|
||||
assert!(matches!(daemon.stop(), Ok(MountOutcome::Shutdown)));
|
||||
|
||||
std::fs::write(local.join("new.txt"), b"second, written while stopped").unwrap();
|
||||
let daemon = Daemon::start(&dir, client).unwrap();
|
||||
let landed = wait_until(Duration::from_secs(60), || {
|
||||
on_drive(&drive, "mirrored/new.txt")
|
||||
.is_some_and(|bytes| bytes == b"second, written while stopped")
|
||||
});
|
||||
let logged = take_logged();
|
||||
assert!(
|
||||
landed,
|
||||
"{:#?}\n{:#?}",
|
||||
drive.tree(),
|
||||
logged
|
||||
.iter()
|
||||
.filter(|l| l.contains("sync") || l.contains("new"))
|
||||
.collect::<Vec<_>>()
|
||||
);
|
||||
quiet_pass(&daemon, folder).expect("a quiet pass is traced");
|
||||
|
||||
assert!(conflict_copies(&local, "new").is_empty());
|
||||
let tree = drive.tree();
|
||||
assert!(
|
||||
!tree.keys().any(|k| k.contains("sync-conflict")),
|
||||
"{tree:?}"
|
||||
);
|
||||
assert_eq!(
|
||||
tree.keys().filter(|k| k.contains("new")).count(),
|
||||
1,
|
||||
"{tree:?}"
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read(local.join("new.txt")).unwrap(),
|
||||
b"second, written while stopped"
|
||||
);
|
||||
assert!(matches!(daemon.stop(), Ok(MountOutcome::Shutdown)));
|
||||
assert!(
|
||||
reopen(&dir).sync_intents(Some(folder)).unwrap().is_empty(),
|
||||
"every intent settled"
|
||||
);
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "mounts FUSE: run with `cargo test -p pdfs-fuse sim:: -- --ignored`"]
|
||||
fn a_revision_made_during_a_mirror_download_still_arrives() {
|
||||
|
||||
@@ -11,7 +11,7 @@ use super::Db;
|
||||
use pdfs_core::Result;
|
||||
|
||||
/// Current schema version. Bump on every forward migration added below.
|
||||
pub(super) const SCHEMA_VERSION: i64 = 51;
|
||||
pub(super) const SCHEMA_VERSION: i64 = 52;
|
||||
|
||||
impl Db {
|
||||
pub(super) fn migrate(&self) -> Result<()> {
|
||||
@@ -563,6 +563,21 @@ impl Db {
|
||||
tx.execute_batch(MIGRATION_V51)?;
|
||||
}
|
||||
}
|
||||
if current < 52 {
|
||||
let has_intents: bool = tx.query_row(
|
||||
"SELECT COUNT(*) FROM sqlite_master WHERE type = 'table' AND name = 'sync_intent'",
|
||||
[],
|
||||
|row| row.get::<_, i64>(0).map(|n| n > 0),
|
||||
)?;
|
||||
let has_column: bool = tx.query_row(
|
||||
"SELECT COUNT(*) FROM pragma_table_info('sync_intent') WHERE name = 'sent_sha1s'",
|
||||
[],
|
||||
|row| row.get::<_, i64>(0).map(|n| n > 0),
|
||||
)?;
|
||||
if has_intents && !has_column {
|
||||
tx.execute_batch(MIGRATION_V52)?;
|
||||
}
|
||||
}
|
||||
tx.execute(
|
||||
"INSERT INTO sync_state (key, value) VALUES ('schema_version', ?1)
|
||||
ON CONFLICT(key) DO UPDATE SET value = excluded.value",
|
||||
@@ -1627,6 +1642,13 @@ BEGIN
|
||||
END;
|
||||
";
|
||||
|
||||
/// v52: the SHA-1s of the bytes each unsettled mirror upload sent, space
|
||||
/// separated. A reply that never came may hide an upload that landed, and its
|
||||
/// digest is how a later pass knows the file on Drive for its own.
|
||||
const MIGRATION_V52: &str = "
|
||||
ALTER TABLE sync_intent ADD COLUMN sent_sha1s TEXT;
|
||||
";
|
||||
|
||||
/// See [`MIGRATION_V49_COLUMNS`].
|
||||
const MIGRATION_V49: &str = "
|
||||
CREATE TABLE IF NOT EXISTS sync_remote_dirty (
|
||||
|
||||
@@ -34,6 +34,9 @@ pub struct StoredIntent {
|
||||
/// When it was last sent, in seconds since the epoch.
|
||||
pub issued_at: i64,
|
||||
pub last_error: Option<String>,
|
||||
/// For an upload: the SHA-1s of the bytes its attempts streamed without
|
||||
/// hearing a success back, lowercase. One of them may have landed.
|
||||
pub sent_sha1s: Vec<String>,
|
||||
}
|
||||
|
||||
/// What a mirror pass has walked of Drive, saved so a pass cut short
|
||||
@@ -901,6 +904,29 @@ impl Db {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Note that the upload `kind` of `rel_path` streamed bytes with SHA-1
|
||||
/// `sha1` and heard no success back. Nothing happens without an intent for
|
||||
/// it. A digest already noted is not added again.
|
||||
pub fn sync_intent_sent(
|
||||
&self,
|
||||
folder_id: i64,
|
||||
rel_path: &str,
|
||||
kind: &str,
|
||||
sha1: &str,
|
||||
) -> Result<()> {
|
||||
let sha1 = sha1.to_ascii_lowercase();
|
||||
let conn = self.conn.lock();
|
||||
conn.execute(
|
||||
"UPDATE sync_intent SET sent_sha1s = CASE
|
||||
WHEN sent_sha1s IS NULL OR sent_sha1s = '' THEN ?4
|
||||
WHEN instr(' ' || sent_sha1s || ' ', ' ' || ?4 || ' ') > 0 THEN sent_sha1s
|
||||
ELSE sent_sha1s || ' ' || ?4 END
|
||||
WHERE folder_id = ?1 AND rel_path = ?2 AND kind = ?3",
|
||||
params![folder_id, rel_path, kind, sha1],
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Every intent not settled, oldest first; only `folder_id`'s when given.
|
||||
pub fn sync_intents(&self, folder_id: Option<i64>) -> Result<Vec<StoredIntent>> {
|
||||
let conn = self.read()?;
|
||||
@@ -970,7 +996,7 @@ impl Db {
|
||||
}
|
||||
|
||||
const INTENT_COLUMNS: &str =
|
||||
"id, folder_id, rel_path, kind, state, attempts, issued_at, last_error";
|
||||
"id, folder_id, rel_path, kind, state, attempts, issued_at, last_error, sent_sha1s";
|
||||
|
||||
fn intent_row(row: &rusqlite::Row<'_>) -> rusqlite::Result<StoredIntent> {
|
||||
Ok(StoredIntent {
|
||||
@@ -982,6 +1008,10 @@ fn intent_row(row: &rusqlite::Row<'_>) -> rusqlite::Result<StoredIntent> {
|
||||
attempts: u32::try_from(row.get::<_, i64>(5)?).unwrap_or(u32::MAX),
|
||||
issued_at: row.get(6)?,
|
||||
last_error: row.get(7)?,
|
||||
sent_sha1s: row
|
||||
.get::<_, Option<String>>(8)?
|
||||
.map(|s| s.split_whitespace().map(str::to_owned).collect())
|
||||
.unwrap_or_default(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -8456,6 +8456,33 @@ fn a_deletion_window_is_kept_per_folder_until_the_folder_changes() {
|
||||
/// An intent is one row per folder, path and kind: sent again, it counts the
|
||||
/// attempt and says what state it was left in. It goes once settled, and with
|
||||
/// the folder.
|
||||
#[test]
|
||||
fn an_upload_notes_each_digest_it_sent_once() {
|
||||
let db = Db::open_in_memory().unwrap();
|
||||
let id = db.sync_folder_add("/home/me/Docs", "v~root", "s").unwrap();
|
||||
// Nothing to note without an intent.
|
||||
db.sync_intent_sent(id, "a.txt", "upload", "AA").unwrap();
|
||||
assert!(db.sync_intents(Some(id)).unwrap().is_empty());
|
||||
|
||||
db.sync_intent_issue(id, "a.txt", "upload", 10).unwrap();
|
||||
db.sync_intent_sent(id, "a.txt", "upload", "AA").unwrap();
|
||||
db.sync_intent_sent(id, "a.txt", "upload", "aa").unwrap();
|
||||
// Sent again with other bytes: both may have landed.
|
||||
db.sync_intent_issue(id, "a.txt", "upload", 20).unwrap();
|
||||
db.sync_intent_sent(id, "a.txt", "upload", "bb").unwrap();
|
||||
// Another kind of the same path keeps its own.
|
||||
db.sync_intent_issue(id, "a.txt", "upload-revision", 21)
|
||||
.unwrap();
|
||||
let intents = db.sync_intents(Some(id)).unwrap();
|
||||
let upload = intents.iter().find(|i| i.kind == "upload").unwrap();
|
||||
assert_eq!(upload.sent_sha1s, ["aa", "bb"]);
|
||||
let revision = intents
|
||||
.iter()
|
||||
.find(|i| i.kind == "upload-revision")
|
||||
.unwrap();
|
||||
assert!(revision.sent_sha1s.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_effect_intent_is_kept_until_it_is_settled_or_its_folder_changes() {
|
||||
let db = Db::open_in_memory().unwrap();
|
||||
|
||||
@@ -852,6 +852,18 @@ impl Syncer {
|
||||
}
|
||||
FilePlan::Conflict => {
|
||||
let remote = r.expect("conflict requires a remote file");
|
||||
if self.landed_unanswered(folder_id, rel, remote.sha1.as_deref()) {
|
||||
info!(
|
||||
rel,
|
||||
"sync: the file on Drive is an upload of ours that went unanswered; sending the newer local bytes as a revision of it"
|
||||
);
|
||||
batch.push(Pending::UploadRevision {
|
||||
rel: rel.clone(),
|
||||
uid: remote.uid.clone(),
|
||||
seen: RemoteSeen::from(remote),
|
||||
});
|
||||
continue;
|
||||
}
|
||||
batch.push(Pending::Conflict {
|
||||
rel: rel.clone(),
|
||||
uid: remote.uid.clone(),
|
||||
|
||||
@@ -194,6 +194,47 @@ impl Syncer {
|
||||
}
|
||||
}
|
||||
|
||||
/// Note that an upload of `rel` streamed bytes with SHA-1 `sha1` and did
|
||||
/// not hear a success back. They may have landed all the same.
|
||||
fn note_sent(&self, folder_id: i64, rel: &str, kind: &str, sha1: &str) {
|
||||
if let Err(error) = self.store.sync_intent_sent(folder_id, rel, kind, sha1) {
|
||||
debug!(rel, error = ?error, "sync: cannot note what an upload sent");
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the file Drive holds at `rel`, with SHA-1 `remote_sha1`, is one
|
||||
/// of this daemon's own uploads whose answer never came: an upload of
|
||||
/// `rel` not yet settled streamed exactly those bytes.
|
||||
///
|
||||
/// Then the file is ours, not another computer's, and a newer local edit
|
||||
/// is not a conflict with it: it goes up as a revision. A file that only
|
||||
/// happens to hold the same bytes loses nothing by that either.
|
||||
pub(super) fn landed_unanswered(
|
||||
&self,
|
||||
folder_id: i64,
|
||||
rel: &str,
|
||||
remote_sha1: Option<&str>,
|
||||
) -> bool {
|
||||
let Some(remote_sha1) = remote_sha1 else {
|
||||
return false;
|
||||
};
|
||||
let intents = match self.store.sync_intents(Some(folder_id)) {
|
||||
Ok(intents) => intents,
|
||||
Err(error) => {
|
||||
debug!(rel, error = ?error, "sync: cannot read the effect intents");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
intents.iter().any(|intent| {
|
||||
intent.rel_path == rel
|
||||
&& matches!(intent.kind.as_str(), "upload" | "upload-revision")
|
||||
&& intent
|
||||
.sent_sha1s
|
||||
.iter()
|
||||
.any(|sent| sent.eq_ignore_ascii_case(remote_sha1))
|
||||
})
|
||||
}
|
||||
|
||||
/// Settle the intents of `folder_id` that a pass begun at `began` did
|
||||
/// not send again, though it looked at every path: what they were for has
|
||||
/// changed, or is done.
|
||||
@@ -323,6 +364,15 @@ impl Syncer {
|
||||
return Ok(Applied::Vanished);
|
||||
}
|
||||
if !digest.eq_ignore_ascii_case(sha1) {
|
||||
if self.landed_unanswered(folder_id, rel, Some(sha1)) {
|
||||
info!(
|
||||
rel,
|
||||
"sync: the file on Drive is an upload of ours that went unanswered; sending the newer local bytes as a revision of it"
|
||||
);
|
||||
return self
|
||||
.upload_revision(folder_id, local_root, rel, uid, remote)
|
||||
.await;
|
||||
}
|
||||
info!(
|
||||
rel,
|
||||
"sync: same size as on Drive but different content; keeping a conflict copy"
|
||||
@@ -444,8 +494,14 @@ impl Syncer {
|
||||
Some(mtime),
|
||||
false,
|
||||
)
|
||||
.await
|
||||
.map_err(|e| format!("upload {rel}: {e}"))?;
|
||||
.await;
|
||||
let uid = match uid {
|
||||
Ok(uid) => uid,
|
||||
Err(e) => {
|
||||
self.note_sent(folder_id, rel, "upload", &sent.digest());
|
||||
return Err(format!("upload {rel}: {e}"));
|
||||
}
|
||||
};
|
||||
// The parent has gained a child that no cached listing of it knows
|
||||
// about. Without this, a folder later switched to on-demand serves a
|
||||
// snapshot that predates this upload (B86).
|
||||
@@ -513,10 +569,14 @@ impl Syncer {
|
||||
meta.len(),
|
||||
),
|
||||
));
|
||||
self.drive
|
||||
if let Err(e) = self
|
||||
.drive
|
||||
.upload_new_revision_from(uid, reader, meta.len() as i64, thumbnails, Some(mtime))
|
||||
.await
|
||||
.map_err(|e| format!("upload revision {rel}: {e}"))?;
|
||||
{
|
||||
self.note_sent(folder_id, rel, "upload-revision", &sent.digest());
|
||||
return Err(format!("upload revision {rel}: {e}"));
|
||||
}
|
||||
warn_if_torn(rel, &path, streamed);
|
||||
let remote = self
|
||||
.landed_as_sent(rel, uid, &sent.digest(), streamed)
|
||||
|
||||
@@ -96,6 +96,15 @@ pub trait SyncStore: Send + Sync {
|
||||
fn sync_intent_settle(&self, id: i64) -> Result<()>;
|
||||
/// Move an intent to `state`, with the error that put it there.
|
||||
fn sync_intent_set(&self, id: i64, state: &str, error: Option<&str>) -> Result<()>;
|
||||
/// Note that upload `kind` of `rel_path` streamed bytes with SHA-1 `sha1`
|
||||
/// and heard no success back.
|
||||
fn sync_intent_sent(
|
||||
&self,
|
||||
folder_id: i64,
|
||||
rel_path: &str,
|
||||
kind: &str,
|
||||
sha1: &str,
|
||||
) -> Result<()>;
|
||||
/// Every intent not settled; only `folder_id`'s when given.
|
||||
fn sync_intents(&self, folder_id: Option<i64>) -> Result<Vec<StoredIntent>>;
|
||||
/// Move every intent in state `from` to `to`.
|
||||
@@ -197,6 +206,15 @@ impl SyncStore for Db {
|
||||
fn sync_intent_set(&self, id: i64, state: &str, error: Option<&str>) -> Result<()> {
|
||||
Db::sync_intent_set(self, id, state, error)
|
||||
}
|
||||
fn sync_intent_sent(
|
||||
&self,
|
||||
folder_id: i64,
|
||||
rel_path: &str,
|
||||
kind: &str,
|
||||
sha1: &str,
|
||||
) -> Result<()> {
|
||||
Db::sync_intent_sent(self, folder_id, rel_path, kind, sha1)
|
||||
}
|
||||
fn sync_intents(&self, folder_id: Option<i64>) -> Result<Vec<StoredIntent>> {
|
||||
Db::sync_intents(self, folder_id)
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ a live account since.
|
||||
|
||||
| Entry | Title |
|
||||
|---|---|
|
||||
| [B305](#b305--a-mirrored-file-whose-upload-went-unanswered-gets-a-conflict-copy-of-its-own-edit) | A mirrored file whose upload went unanswered gets a conflict copy of its own edit |
|
||||
| [B304](#b304--a-write-released-while-its-files-create-lands-is-kept-as-a-conflict-copy) | A write released while its file's create lands is kept as a conflict copy |
|
||||
| [B303](#b303--a-file-made-where-a-withdrawn-create-was-listed-refuses-every-write) | A file made where a withdrawn create was listed refuses every write |
|
||||
| [B302](#b302--a-stop-during-a-replacing-rename-leaves-the-replaced-file-in-the-trash) | A stop during a replacing rename leaves the replaced file in the trash |
|
||||
@@ -407,6 +408,36 @@ a live account since.
|
||||
|
||||
Newest first.
|
||||
|
||||
### B305 — A mirrored file whose upload went unanswered gets a conflict copy of its own edit
|
||||
|
||||
**Status:** Fixed (unverified)
|
||||
**Found:** 2026-11-27, writing the simulation for the case the effect reducer is meant to handle
|
||||
(`FURTHER_IMPROVEMENTS.md`): a create accepted by Drive, the reply lost, a restart, and a newer
|
||||
local edit. The simulation failed on the first run. Drive held `new.txt` with the first bytes and
|
||||
`new (sync-conflict …).txt` with the edit.
|
||||
**Where:** the `FilePlan::Conflict` arm of the plan in `crates/pdfs-sync/src/mirror.rs`, and
|
||||
`Pending::Adopt` in `crates/pdfs-sync/src/mirror/apply.rs`
|
||||
|
||||
**Repro:** In a mirror folder, write a new file. Lose the answer to its upload after Drive has
|
||||
made the file. Stop the daemon, write the file again, and start the daemon.
|
||||
|
||||
**Cause.** The upload failed as far as the daemon knew, so no baseline was recorded. The next pass
|
||||
found the path on both sides with no baseline and different bytes, which is what two computers
|
||||
writing one new file look like, so it kept the local copy as a conflict copy. The edit itself is
|
||||
not lost. The one-request small upload makes this ending of a lost reply the usual one: it
|
||||
leaves a whole file, never a draft for the next attempt to replace.
|
||||
|
||||
**Fix.** An upload that hears no success back notes the SHA-1 of the bytes it streamed in its
|
||||
effect intent (`sent_sha1s`, schema 52). Before keeping a conflict copy, the plan checks the
|
||||
intents. If Drive's file holds exactly bytes an unsettled upload of that path sent, the file is
|
||||
this daemon's own. The local bytes then go up as a revision of it. A first-sync adopt of a
|
||||
same-size file with other bytes does the same. A file that holds those bytes by chance loses
|
||||
nothing either: they are what this computer sent.
|
||||
|
||||
**Verified:** `a_mirror_create_whose_reply_was_lost_is_adopted_after_a_restart_and_its_edit_lands`
|
||||
fails without the fix and passes with it. `an_upload_notes_each_digest_it_sent_once` covers the
|
||||
store.
|
||||
|
||||
### B304 — A write released while its file's create lands is kept as a conflict copy
|
||||
|
||||
**Status:** Fixed (unverified)
|
||||
|
||||
+9
-5
@@ -11,15 +11,13 @@ scratch (user data in `staging/` and `recovery/` is never touched by this).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
Schema: **51**. New tables save a mirror folder's walk of Proton Drive (48). A finished walk is
|
||||
Schema: **52**. New tables save a mirror folder's walk of Proton Drive (48). A finished walk is
|
||||
kept, with a list of the folders that changed on Proton Drive since (49). Each mirror folder
|
||||
counts the deletions it made in the last day (50). Each upload, download or folder a mirror pass
|
||||
sends is recorded until its result is in (51).
|
||||
sends is recorded until its result is in (51), and an upload that heard no answer keeps the
|
||||
digest of what it sent (52).
|
||||
|
||||
### Added
|
||||
- **`small_uploads` in `config.json` turns off the one-request upload for small files.** It is
|
||||
on by default. Set it to `false` to send every file as a draft, its blocks and a commit, as
|
||||
before. The service reads it at start. See [Configuration](CONFIGURATION.md#small_uploads).
|
||||
- **`pdfs diagnostics` says which of the daemon's background services are running.** If one
|
||||
ends while the drive is mounted, for example the sync engine after a crash, the journal says
|
||||
so once, by name, instead of saying nothing until a restart. It also lists the jobs running
|
||||
@@ -75,6 +73,12 @@ sends is recorded until its result is in (51).
|
||||
first pass, and whenever the change feed lost track (#53).
|
||||
|
||||
### Fixed
|
||||
- **A mirrored file whose upload went unanswered no longer gets a conflict copy of its own
|
||||
edit.** Proton Drive can make a file and lose the answer. If the file was then written again
|
||||
before the next sync, for example while the daemon was stopped, that sync saw two different
|
||||
files under one name. It kept this computer's newer edit as a conflict copy next to its own
|
||||
first upload. Now an upload that hears no answer keeps the digest of the bytes it sent. When
|
||||
Proton Drive holds exactly those bytes, the newer edit goes up as a new version of that file.
|
||||
- **A stop ends the loops that follow Proton Drive's change feed before the daemon exits.**
|
||||
The loops that read the Drive and photos event streams, and the gallery refresh, kept
|
||||
running after every other service had stopped, and could still write to the database while
|
||||
|
||||
@@ -88,7 +88,6 @@ fix it.
|
||||
| `device_uid` | string | none | Computers → Continue This Backup Here… or Sync With This Computer… | The computer this machine syncs into. Unset means "match by hostname" |
|
||||
| `conflict_sweep` | `off` / `report` / `enforce` | `report` | Sync → Conflict Copies | See [`conflict_sweep`](#conflict_sweep) |
|
||||
| `local_first` | bool | `true` | — | See [`local_first`](#local_first) |
|
||||
| `small_uploads` | bool | `true` | — | See [`small_uploads`](#small_uploads) |
|
||||
| `language` | gettext code | system | General → Appearance | Language of the app, tray and prompt, such as `de` or `pt_BR` |
|
||||
| `proton_theme` | bool | follow system | General → Appearance | Proton's colours instead of the system theme |
|
||||
| `online_map` | bool | `false` | General → Appearance | Street map for Places from OpenFreeMap |
|
||||
@@ -146,16 +145,6 @@ call returns at once. The change goes to Drive from the queue, the same way it d
|
||||
Set it to `false` to have these calls wait for Drive again, as before 3.0.0. The switch is there
|
||||
for one release, in case the queued path misbehaves for you; please report it if it does.
|
||||
|
||||
### `small_uploads`
|
||||
|
||||
A file that fits in 128 KiB with its thumbnails goes to Proton Drive in one request. A larger one
|
||||
goes as a draft, its blocks, and a commit, which takes three requests or more. Most synced files
|
||||
are small, so this is what decides how fast a folder of many small files syncs.
|
||||
|
||||
Set it to `false` to upload every file in blocks again. The setting is read when the service
|
||||
starts. The journal says `small files are uploaded in blocks` while it is off. Please report it if
|
||||
you need to turn it off.
|
||||
|
||||
### `open_with`
|
||||
|
||||
Decides how files picked in the search launcher or the app are opened. Rules are tried in order;
|
||||
|
||||
+31
-7
@@ -282,14 +282,38 @@ decides what happens next:
|
||||
is logged at info.
|
||||
- A change to what the folder is, or its removal, drops its rows.
|
||||
|
||||
The intents are kept in shadow for now: nothing reads them to decide what to send. The apply
|
||||
step's own checks still decide whether an effect that may have landed is sent again (B266 for a
|
||||
create, B39 for a download). Deletions on either side are not recorded yet. Trace counts:
|
||||
`unsure resent`, `retried`, `superseded`.
|
||||
The intents decide one thing so far: whether a file on Drive is an upload of this daemon's
|
||||
that went unanswered.
|
||||
- An upload that does not hear a success back notes the SHA-1 of the bytes it streamed in its
|
||||
intent (`sent_sha1s`, schema 52). Each attempt adds its digest.
|
||||
- When a later pass would keep a conflict copy, it checks the intent first. The path may be new
|
||||
on both sides, or changed on both sides since the baseline. If Drive's file holds exactly
|
||||
bytes an unsettled upload of that path sent, the file is ours. The newer local bytes then go up
|
||||
as a revision of it, with no conflict copy. The same holds for a first-sync adopt of a
|
||||
same-size file whose bytes differ.
|
||||
- This is the usual end of a lost reply to a one-request small upload. Such an upload leaves a
|
||||
whole file, never a draft. If the file was written again before the next pass, for example
|
||||
while the daemon was stopped, the next pass used to see two different files and fork a
|
||||
conflict copy of this computer's own edit.
|
||||
- A file that only happens to hold the same bytes loses nothing either: its content is what
|
||||
this computer sent.
|
||||
- A daemon killed in the middle of an upload notes no digest, so that case still ends in a
|
||||
conflict copy when the file is edited before the next pass. It is kept, and nothing is lost.
|
||||
|
||||
**Tests:** the `effect::tests` unit tests, `an_effect_intent_is_kept_until_it_is_settled_or_its_folder_changes`
|
||||
(DB), and `an_effect_left_unsure_by_a_stop_is_sent_again_or_settled` (sim: of two uploads a
|
||||
stopped daemon left unsure, the one still needed is sent again and the other is settled).
|
||||
Otherwise nothing reads the intents to decide what to send. The apply step's own checks still
|
||||
decide whether an effect that may have landed is sent again (B266 for a create, B39 for a
|
||||
download). Deletions on either side are not recorded yet. Trace counts: `unsure resent`,
|
||||
`retried`, `superseded`.
|
||||
|
||||
**Tests:**
|
||||
- the `effect::tests` unit tests;
|
||||
- DB: `an_effect_intent_is_kept_until_it_is_settled_or_its_folder_changes`, and
|
||||
`an_upload_notes_each_digest_it_sent_once`;
|
||||
- sim `an_effect_left_unsure_by_a_stop_is_sent_again_or_settled`: of two uploads a stopped daemon
|
||||
left unsure, the one still needed is sent again and the other is settled;
|
||||
- sim `a_mirror_create_whose_reply_was_lost_is_adopted_after_a_restart_and_its_edit_lands`:
|
||||
Drive makes the file and the answer is lost, then the daemon stops and the file is written
|
||||
again. After the start there is one file, holding the newer bytes, and no conflict copy.
|
||||
|
||||
## Plan of work (separate PRs)
|
||||
|
||||
|
||||
Reference in new issue
Block a user