Bug 207493

Summary: Slow rescan after album added to collection.
Product: [Applications] amarok Reporter: Emanuele Cisotti <e.cisotti>
Component: Collections/LocalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED NOT A BUG    
Severity: normal CC: mitchell
Priority: NOR    
Version: 2.1.80   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Emanuele Cisotti 2009-09-15 20:54:06 UTC
I use Amarok 2.2 on Kubuntu 9.10 Alpha.
Starting from a fresh install select my collection of 50.000+ file on my NTFS External HD and Amarok takes about 40minutes to scan it all.
Now when I add a new album Amarok rescan ALL my collection and it takes about 1 or 2 hours!
Already tryed with another External HD (with the same collection) and with another computer with Amarok Nightly on Ubuntu 9.04 and I have exactly the same problem.
I came from here:
http://forum.kde.org/viewtopic.php?f=115&t=81162
Comment 1 Mikko C. 2009-09-15 20:57:32 UTC
Are you doing a full rescan on purpose? Why not just do an "update collection"?
Comment 2 Emanuele Cisotti 2009-09-15 21:04:17 UTC
Sorry I don't speak english good enough ;)
I mean that Amarok trying to add the new album takes about 2 hours!
I do (and click) nothing on my purpose.
Comment 3 Mikko C. 2009-09-15 21:07:35 UTC
What happens if you disable "Watch folders for changes" in the settings, and then add the album and manually choose "update collection"?

If it's still slow, post the relevant output of 'amarok --debug'
Comment 4 Jeff Mitchell 2009-09-15 21:33:29 UTC
If you are adding the album to the root of your collection, then it will cause the entire collection to be rescanned. Proper organization of files is a good thing...
Comment 5 Emanuele Cisotti 2009-09-16 00:09:26 UTC
@Mikko: no, it doesn't work, I will try tomorrow to debug.
@Jeff: my collection is made by 2 folder, and I putted it into one of this folder. So am I putting in in the root for the collection?
Comment 6 Jeff Mitchell 2009-09-16 06:00:17 UTC
I don't know, because I don't know the layout of your folder structure. But just remember, scanning is based on folder mtimes. The flatter your folder structure, the more will have to be rescanned when changes occur.
Comment 7 Emanuele Cisotti 2009-09-19 16:42:13 UTC
This is the first output when Amarok starts scanning again all my collection:
amarok: BEGIN: void ScanManager::startIncrementalScan()
amarok:   BEGIN: QStringList ScanManager::getDirsToScan()
amarok:   END__: QStringList ScanManager::getDirsToScan() - Took 2s
amarok:    GOING TO SCAN:
amarok:         "/home/ciso/Musica/Albums/"
amarok:   BEGIN: XmlParseJob::XmlParseJob(ScanManager*, SqlCollection*)
amarok:     BEGIN: void ProgressBar::setDescription(const QString&)
amarok:     END__: void ProgressBar::setDescription(const QString&) - Took 4.9e-05s
amarok:     BEGIN: void CompoundProgressBar::addProgressBar(ProgressBar*, QObject*)
amarok:       BEGIN: void ProgressBar::setDescription(const QString&)
amarok:       END__: void ProgressBar::setDescription(const QString&) - Took 3.9e-05s
amarok:     END__: void CompoundProgressBar::addProgressBar(ProgressBar*, QObject*) - Took 0.00037s
amarok:     BEGIN: ProgressBar* ProgressBar::setAbortSlot(QObject*, const char*)
amarok:        Setting abort slot for  "Scansione musica"
amarok:        connecting to  1abort()
amarok:     END__: ProgressBar* ProgressBar::setAbortSlot(QObject*, const char*) - Took 7.4e-05s
amarok:   END__: XmlParseJob::XmlParseJob(ScanManager*, SqlCollection*) - Took 0.0011s
amarok:   BEGIN: SqlCollectionDBusHandler::SqlCollectionDBusHandler(SqlCollection*)
amarok:      Register object:  true
amarok:     BEGIN: virtual void XmlParseJob::run()
amarok:     END__: SqlCollectionDBusHandler::SqlCollectionDBusHandler(SqlCollection*) - Took 0.00019s
amarok:     BEGIN: ScanResultProcessor::ScanResultProcessor(SqlCollection*)
amarok:     END__: ScanResultProcessor::ScanResultProcessor(SqlCollection*) - Took 9.6e-05s
amarok:   END__: void ScanManager::startIncrementalScan() - Took 2s
amarok:   BEGIN: void DatabaseUpdater::createTemporaryTables()
amarok:   END__: void DatabaseUpdater::createTemporaryTables() - Took 0.0073s
amarok:   BEGIN: void DatabaseUpdater::prepareTemporaryTables()
amarok:   END__: void DatabaseUpdater::prepareTemporaryTables() - Took 11s
Comment 8 Jeff Mitchell 2009-09-19 16:50:17 UTC
I'm not sure why you gave us that information.
Comment 9 Emanuele Cisotti 2009-09-19 16:52:14 UTC
Mirko asked for the output of amarok --debug.
I don't think that the cause is how much "flat" is my collection because in Amarok 1.4 was working great.
Comment 10 Emanuele Cisotti 2009-09-19 16:53:49 UTC
I also tried to put a new album inside the folder of another album (so not in the "main" directory) and amarok takes 2 hours for rescanning.