mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 12:19:03 +03:00
Optimize CaseConflictRecords search in local DB during the sync.
Signed-off-by: alex-z <blackslayer4@gmail.com>
This commit is contained in:
parent
b3f3cff16f
commit
fde7933585
3 changed files with 15 additions and 1 deletions
|
@ -824,6 +824,14 @@ bool SyncJournalDb::updateMetadataTableStructure()
|
||||||
addColumn(QStringLiteral("lockTime"), QStringLiteral("INTEGER"));
|
addColumn(QStringLiteral("lockTime"), QStringLiteral("INTEGER"));
|
||||||
addColumn(QStringLiteral("lockTimeout"), QStringLiteral("INTEGER"));
|
addColumn(QStringLiteral("lockTimeout"), QStringLiteral("INTEGER"));
|
||||||
|
|
||||||
|
SqlQuery query(_db);
|
||||||
|
query.prepare("CREATE INDEX IF NOT EXISTS caseconflicts_basePath ON caseconflicts(basePath);");
|
||||||
|
if (!query.exec()) {
|
||||||
|
sqlFail(QStringLiteral("caseconflictsTableStructure: create index basePath"), query);
|
||||||
|
return re = false;
|
||||||
|
}
|
||||||
|
commitInternal(QStringLiteral("update database structure: add basePath index"));
|
||||||
|
|
||||||
return re;
|
return re;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,8 @@ void ProcessDirectoryJob::start()
|
||||||
{
|
{
|
||||||
qCInfo(lcDisco) << "STARTING" << _currentFolder._server << _queryServer << _currentFolder._local << _queryLocal;
|
qCInfo(lcDisco) << "STARTING" << _currentFolder._server << _queryServer << _currentFolder._local << _queryLocal;
|
||||||
|
|
||||||
|
_discoveryData->_noCaseConflictRecordsInDb = _discoveryData->_statedb->caseClashConflictRecordPaths().isEmpty();
|
||||||
|
|
||||||
if (_queryServer == NormalQuery) {
|
if (_queryServer == NormalQuery) {
|
||||||
_serverJob = startAsyncServerQuery();
|
_serverJob = startAsyncServerQuery();
|
||||||
} else {
|
} else {
|
||||||
|
@ -799,7 +801,9 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo(const SyncFileItemPtr &it
|
||||||
item->_modtime = serverEntry.modtime;
|
item->_modtime = serverEntry.modtime;
|
||||||
item->_size = serverEntry.size;
|
item->_size = serverEntry.size;
|
||||||
|
|
||||||
const auto conflictRecord = _discoveryData->_statedb->caseConflictRecordByBasePath(item->_file);
|
const auto conflictRecord = _discoveryData->_noCaseConflictRecordsInDb
|
||||||
|
? ConflictRecord{} :
|
||||||
|
_discoveryData->_statedb->caseConflictRecordByBasePath(item->_file);
|
||||||
if (conflictRecord.isValid() && QString::fromUtf8(conflictRecord.path).contains(QStringLiteral("(case clash from"))) {
|
if (conflictRecord.isValid() && QString::fromUtf8(conflictRecord.path).contains(QStringLiteral("(case clash from"))) {
|
||||||
qCInfo(lcDisco) << "should ignore" << item->_file << "has already a case clash conflict record" << conflictRecord.path;
|
qCInfo(lcDisco) << "should ignore" << item->_file << "has already a case clash conflict record" << conflictRecord.path;
|
||||||
|
|
||||||
|
|
|
@ -321,6 +321,8 @@ public:
|
||||||
bool _hasUploadErrorItems = false;
|
bool _hasUploadErrorItems = false;
|
||||||
bool _hasDownloadRemovedItems = false;
|
bool _hasDownloadRemovedItems = false;
|
||||||
|
|
||||||
|
bool _noCaseConflictRecordsInDb = false;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void fatalError(const QString &errorString, const OCC::ErrorCategory errorCategory);
|
void fatalError(const QString &errorString, const OCC::ErrorCategory errorCategory);
|
||||||
void itemDiscovered(const OCC::SyncFileItemPtr &item);
|
void itemDiscovered(const OCC::SyncFileItemPtr &item);
|
||||||
|
|
Loading…
Reference in a new issue