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

What "Safely save database files" means? #1724

Closed
tuberculo opened this issue Mar 13, 2018 · 18 comments
Closed

What "Safely save database files" means? #1724

tuberculo opened this issue Mar 13, 2018 · 18 comments

Comments

@tuberculo
Copy link

tuberculo commented Mar 13, 2018

There is a checkbox in settings which is "Safely save database files (may be incompatible with Dropbox, etc)".
I could not find any documentation about that, so I will just ask here.

What does "safely save" mean? How does that affect Dropbox?

@droidmonkey
Copy link
Member

If you have to ask, don't touch it 😉

Safe saving uses a temporary file in the same directory as your current database which is closed and written prior to deleting your existing db file and then renamed to your filename. This makes it a transaction that prevents data loss 99.9% of the time.

Unsafe saves use the temp directory to make the new database. Then your old db is deleted and the temp db moved in its place.

Dropbox has a nasty habit of taking ownership of new files that prevents us from renaming the temp db in the same directory as your current db.

@tomhundt
Copy link

Thanks for explaining, I was wondering the same thing. I tracked it down via the CHANGELOG document (where it's listed as "allow unsafe saving") to Issue #1385 .

So, per that issue, the failure mode (after three failures) is a popup prompting one to disable safe saving. This is good to know (I'm using a database each on Dropbox and Google Drive File Stream, and haven't noticed any problems).

P.S. There was also some discussion of the "atomic save" terminology. This is indeed technical: atomicity comes from database systems design, and means "all or nothing" of the operation succeeds -- the "A" of the ACID properties of database transactions that serve to guarantee a database works as expected. In our case, the transaction is the save of the keepass database.

@jazoom
Copy link

jazoom commented Jun 11, 2018

If you have to ask, don't touch it

Well, considering it says "may be incompatible with Dropbox", I think it's quite reasonable that someone who uses Dropbox might ask what it does since they might need to "touch it".

@droidmonkey
Copy link
Member

It was a joke.

@jazoom
Copy link

jazoom commented Jun 11, 2018

@droidmonkey in hindsight it would seem obvious since you used the winkey smiley. Unfortunately that is an attitude actually held by many people on the interwebs.

@kapad
Copy link

kapad commented Jun 19, 2018

I've been using Keepassxc (and before that keepassx) along with dropbox for a couple of years now and haven't faced a single issue.

PS: I use a Linux system, and the dropbox linux agent for syncing with dropbox.

@slcpunk
Copy link

slcpunk commented Jul 17, 2018

Sorry, feel like a dolt for having to ask this even after reading this thread ... but what's the recommendation here? I used to use keepass 2 with triggers to deal with Dropbox syncs to avoid the "conflicted copy" thing. Should I leave "safely save" checked or should I uncheck it because I use Dropbox? It wasn't clear to me that either would work 100% of the time. Which is actually better if you use Dropbox. Should I just use google drive instead and forget about it? ;)
Thanks.

@droidmonkey
Copy link
Member

Google drive has recently moved to the same behavior as dropbox... So maybe we should all go to OneDrive...

The choice is really yours, I prefer safe saves just to be sure and will shutdown drive sync if it starts acting up. Unsafe saves are risky if you lose power or whatever in the middle of the file move.

@slcpunk
Copy link

slcpunk commented Jul 17, 2018

onedrive = MS only. doesn't work for us linux folk. I'll stick with safe and see how it goes. I make changes to the DB fairly rarely ... so it seems actually unlikely that I would get hurt by a bad save. ( and in that case, I would have copies/backups on DropBox in anyway, so should be easy recovery )
thanks for the input.

@droidmonkey
Copy link
Member

https://github.com/skilion/onedrive

OneDrive Linux client, just in case one wants it.

@MarkJaroski
Copy link

What about using an alternative temp directory like /var/tmp, which won't get wiped on system restart?

@droidmonkey
Copy link
Member

We use the temporary file construct from Qt. We don't decide where the temp directory is.

@J-a-n-u-s
Copy link

Reviving this thread for a follow-up. What's the format/extension/regex of the temp name? Could be added to the ignore list of cloud sync client (can't remember if dropbox has this, but owncloud/nextcloud do).
This would prevent the above issue and still allow cloud sync.

@J-a-n-u-s
Copy link

J-a-n-u-s commented Nov 20, 2019

Quick update for those interested, found extension here
By adding *.old.kdbx to Ignored Files in ownCloud/NextCloud appears to solve sync issues when keepassxc is open on multiple devices.
Anyone using Dropbox, it's worth giving it a shot and report back.

@droidmonkey
Copy link
Member

If you ignore that extension then you are ignoring the automatic backup of your database. Although if you are saving to cloud you should just disable backup database on save since you have version control.

@J-a-n-u-s
Copy link

Hi @droidmonkey I misread. I was under the impression that the .old.kdbx was the extensions used by the temp file construct from Qt. I just reread that section of code and see you're right, it's just the backup of the db. I believe the recent problem I'm having (has worked without issue for years now) is related to the server config running my cloud. A mismatched hash problem.
I withdraw my claim that adding .old.kdbx to list of ignored files remedies the above issue.

@seniorm0ment
Copy link

seniorm0ment commented Jun 7, 2020

Wanted to confirm here, there should be no issues here when using Syncthing, Nextcloud, or Rsync to keep this enabled correct?

@droidmonkey
Copy link
Member

Keep it enabled

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

No branches or pull requests

9 participants