|
SVN commit 1130153 by mwiesweg:
Regard a file as modified when its file size has changed, even if the modification date did not change. This seems necessary to prevent problems like bug 233222 to persist: Now the file may still be wrongly scanned during the copy operation, but at least at next rescan it will be corrected. Moreover it seems reasonable to assume a changed file when the file size changed (some operations will restore the modification date). Overhead: For my collections of 30000 images, scanning took 1550 msec without the change and 1750 including the check, with hot caches. With cold caches, the scan took 9300 msec in both cases, no significant difference here. Note: At first start with this check, there may be a good number of files rescanned. CCBUG: 233222 CCMAIL: [hidden email] M +10 -0 collectionscanner.cpp M +5 -6 imagescanner.cpp --- trunk/extragear/graphics/digikam/libs/database/collectionscanner.cpp #1130152:1130153 @@ -37,6 +37,7 @@ #include <QFileInfo> #include <QStringList> #include <QSet> +#include <QTime> // KDE includes @@ -204,6 +205,9 @@ void CollectionScanner::completeScan() { + QTime time; + time.start(); + emit startCompleteScan(); // lock database @@ -275,6 +279,8 @@ markDatabaseAsScanned(); emit finishedCompleteScan(); + + kDebug() << "Complete scan took:" << time.elapsed() << "msecs."; } void CollectionScanner::partialScan(const QString& filePath) @@ -731,8 +737,12 @@ scanModifiedFile(fi, scanInfo); } } + else if ((int)fi.size() != scanInfo.fileSize) + { + scanModifiedFile(fi, scanInfo); } } +} qlonglong CollectionScanner::scanNewFile(const QFileInfo& info, int albumId) { --- trunk/extragear/graphics/digikam/libs/database/imagescanner.cpp #1130152:1130153 @@ -150,7 +150,7 @@ bool ImageScanner::scanFromIdenticalFile() { // Get a list of other images that are identical. Source image shall not be included. - QList<ItemScanInfo> candidates = DatabaseAccess().db()->getIdenticalFiles((int)m_fileInfo.size(), + QList<ItemScanInfo> candidates = DatabaseAccess().db()->getIdenticalFiles(m_scanInfo.fileSize, m_scanInfo.uniqueHash, m_scanInfo.id); if (!candidates.isEmpty()) @@ -189,6 +189,8 @@ { m_scanInfo.itemName = m_fileInfo.fileName(); m_scanInfo.modificationDate = m_fileInfo.lastModified(); + // there is a limit here for file size <2TB + m_scanInfo.fileSize = (int)m_fileInfo.size(); // category is set by setCategory // the QByteArray is an ASCII hex string @@ -199,25 +201,22 @@ { prepareImage(); - // there is a limit here for file size <2TB - int fileSize = (int)m_fileInfo.size(); m_scanInfo.albumID = albumId; m_scanInfo.status = DatabaseItem::Visible; kDebug() << "Adding new item" << m_fileInfo.filePath(); m_scanInfo.id = DatabaseAccess().db()->addItem(m_scanInfo.albumID, m_scanInfo.itemName, m_scanInfo.status, m_scanInfo.category, - m_scanInfo.modificationDate, fileSize, + m_scanInfo.modificationDate, m_scanInfo.fileSize, m_scanInfo.uniqueHash); } void ImageScanner::updateImage() { prepareImage(); - int fileSize = (int)m_fileInfo.size(); DatabaseAccess().db()->updateItem(m_scanInfo.id, m_scanInfo.category, - m_scanInfo.modificationDate, fileSize, m_scanInfo.uniqueHash); + m_scanInfo.modificationDate, m_scanInfo.fileSize, m_scanInfo.uniqueHash); } void ImageScanner::scanFile(ScanMode mode) _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
| Free forum by Nabble | Edit this page |
