Merge lp:~jamesh/mediascanner2/bug-1501990 into lp:mediascanner2
Status: | Merged |
---|---|
Approved by: | Michi Henning |
Approved revision: | 309 |
Merged at revision: | 310 |
Proposed branch: | lp:~jamesh/mediascanner2/bug-1501990 |
Merge into: | lp:mediascanner2 |
Diff against target: |
98 lines (+34/-8) 2 files modified
src/mediascanner/MediaStore.cc (+7/-4) test/test_mediastore.cc (+27/-4) |
To merge this branch: | bzr merge lp:~jamesh/mediascanner2/bug-1501990 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michi Henning (community) | Approve | ||
Review via email: mp+273649@code.launchpad.net |
Commit message
Remove the id column from media_attic so that we don't get conflicts when copying data between media and media_attic.
Description of the change
When removable media is plugged or unplugged, the media scanner copies rows from the media table to or from the media_attic table (the idea being to avoid the need to keep the metadata from the removable media around while it is unplugged but not in the search results).
In 0.106, we added an explicit integer primary key field to media and media_attic, since previously it was using the implicit rowid as a foreign key in the FTS index, which is not guaranteed to stay unchanged over various operations (e.g. vacuum). However, it seems the sequence used to allocate these IDs could be reuse values when they were removed from the table leading to duplicates. This meant that a future copy operation could fail.
Since nothing references the media_attic table, the easy solution was to simply remove its id column so IDs will be stripped when copying data to the attic, and new IDs assigned when copying back to the media table.
Looks good!