Don't wipe db if check fails while disk space is low #5357

An experimental fix for the issue, merged because it's low risk and
makes testing easier.
This commit is contained in:
Christian Kamm 2016-12-13 13:56:36 +01:00
parent bec67455c1
commit d8c479ab1e

View file

@ -97,6 +97,14 @@ bool SqlDatabase::openOrCreateReadWrite( const QString& filename )
}
if( !checkDb() ) {
// When disk space is low, checking the db may fail even though it's fine.
qint64 freeSpace = Utility::freeDiskSpace(filename);
if (freeSpace < 1000000) {
qDebug() << "Consistency check failed, disk space is low, aborting" << freeSpace;
close();
return false;
}
qDebug() << "Consistency check failed, removing broken db" << filename;
close();
QFile::remove(filename);