Skip to content

Commit

Permalink
Don't check for db exists
Browse files Browse the repository at this point in the history
In context of #6049 a check for the existance of the db file was introduced.
That check is performed before every db access... so several 100 times per second.
  • Loading branch information
TheOneRing committed Jul 22, 2022
1 parent 4ee1193 commit 8351736
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 9 additions & 0 deletions changelog/unreleased/9918
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Enhancement: We improved the performance of db access

We removed a check for the existence of the db that was executed before every access to the db.

The check was introduced in #6049 to prevent crashes if the db does not exist or is removed during runtime.
We nowadays gracefully handle missing dbs on startup, removing the db at runtime is too much of a corner case
to sacrifice that much performance however.

https://github.com/owncloud/client/pull/9918
7 changes: 0 additions & 7 deletions src/common/syncjournaldb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,6 @@ bool SyncJournalDb::checkConnect()
}

if (_db.isOpen()) {
// Unfortunately the sqlite isOpen check can return true even when the underlying storage
// has become unavailable - and then some operations may cause crashes. See #6049
if (!QFile::exists(_dbFile)) {
qCWarning(lcDb) << "Database open, but file" << _dbFile << "does not exist";
close();
return false;
}
return true;
}

Expand Down

0 comments on commit 8351736

Please sign in to comment.