View Issue Details

IDProjectCategoryView StatusLast Update
0014094MMW v4DB/FileMonitorpublic2017-03-20 19:36
Reporterpeke Assigned To 
PriorityimmediateSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Target Version4.1.16Fixed in Version4.1.16 
Summary0014094: Incomplete (corrupted) DB can remain if MM is killed while DB optimization
DescriptionOn some databases upgrade fails making new DB corrupted

User DB is uploaded to FTP
Additional InformationLWO-580-22958
TagsNo tags attached.
Fixed in build1831

Activities

Ludek

2017-03-10 16:15

developer   ~0047454

I extracted the 'Backup of MM.DB prior to upgrade.zip', renamed the MM.DB.old to MM.DB and had no issue running this with 4.1.15.1830

Do you have any logs or some steps to replicate?

peke

2017-03-10 22:32

developer   ~0047456

As replied earlier on IM. The only thing I've done is that I deleted MM.DB (one from 14093) and left backup as MM.DB.old and then started MMW. After that MMW converted DB and I had same issue as user. No search results and could not browse Location Nodes.

Ludek

2017-03-13 10:20

developer   ~0047461

Last edited: 2017-03-13 10:28

If I leave just MM.DB.old and delete MM.DB then MMW creates new empty MM.DB and thus no location nodes are presented and no search results, because there are no songs on clean DB.

But If I rename MM.DB.old to MM.DB then I see no issues. User's database is loaded and seem to work fine.

Looking into code the MM.DB.old and MM.DB.temp are created during the 'Optimize database (complete)' or 'Rebuild Database' process, so it seems that you (or the user) killed MMW during the Rebuild Database process or deleted original MM.DB? Because even in case of an exception the MM.DB.old is renamed back to MM.DB, the only uncovered cases seems to be hard kill of MM or hard delete of MM.DB. I guess that that MM should be able to recover and use the MM.DB.old on the next start.

Ludek

2017-03-13 10:47

developer   ~0047462

Looking into the MM.DB uploaded to #14093 : it is really an incomplete MM.DB (only 100 MB against 350 MB MM.DB.old), Folders table is empty and SongsText table is missing. So it really looks like if the user killed database optimization process in the middle and thus get into this incomplete DB state.

The solution is to replace MM.DB by MM.DB.old on next MMW start (as mentioned above).

Ludek

2017-03-13 11:07

developer   ~0047463

Last edited: 2017-03-13 11:09

Peke, why this issue is called "Upgrade: Upgrade fail on some databases" ??
From LWO-580-22958 I see that user reported this problem two months ago (with 4.1.13) and said:
"For some reason I can no longer perform a search in my music library. When I try, a pop up box says there was a problem querying the database. Error executing SQL select songs."

=> so it seems that even two months ago he already had an incomplete database (probably caused by the interrupted DB optimize process), because MM.DB.old was there?

I renamed the issue to "Incomplete (corrupted ) DB can remain if MM is killed while DB optimization"

Ludek

2017-03-13 12:29

developer   ~0047465

Last edited: 2017-03-13 12:30

I can replicate the DB corruption if I force kill MMW while "Optimize database (complete)" is running. I guess that rather then creating MM.DB.old and re-writing MM.DB the approach should be changed.

MM should rather create 'MM.DB.new' and keep 'MM.DB' untouched until the whole process is successfully completed.

Ludek

2017-03-13 15:48

developer   ~0047469

Last edited: 2017-03-13 16:40

Fixed in 4.1.16.1831

peke

2017-03-20 19:36

developer   ~0047538

Verified 1831