Bug 6748 - MySQL > 5.0.45: Newly added albums play in the wrong order
: MySQL > 5.0.45: Newly added albums play in the wrong order
Status: RESOLVED INVALID
Product: Logitech Media Server
Classification: Unclassified
Component: Database
: 7.0
: Other Debian Linux
: -- normal (vote)
: Future
Assigned To: Unassigned bug - please assign me!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-23 12:16 UTC by Ed Fisher
Modified: 2013-10-11 13:34 UTC (History)
6 users (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Fisher 2008-01-23 12:16:48 UTC
When I rescan my library (a non-wipe rescan) and play a newly added album, the tracks are added to the playlist in the order they appear in the database, rather than ordered by their track number.  The tracks play in the correct order if I do a wipe+scan, but that takes far longer than I'd like.

I have tested this on 6.5.4 (debian stable package), 6.5.5 (testing package) and rev 16607 of squeezecenter.

The following playlist was added simply by hitting "play" from the new music page:


mysql> select position,track,tracknum from playlist_track join tracks on playlist_track.track=tracks.id;
+----------+-------+----------+
| position | track | tracknum |
+----------+-------+----------+
|        0 | 16911 |       12 | 
|        1 | 16912 |        7 | 
|        2 | 16914 |        6 | 
|        3 | 16917 |       15 | 
|        4 | 16918 |        2 | 
|        5 | 16922 |        4 | 
|        6 | 16925 |       10 | 
|        7 | 16926 |        1 | 
|        8 | 16927 |        5 | 
|        9 | 16928 |        3 | 
|       10 | 16929 |       13 | 
|       11 | 16931 |        9 | 
|       12 | 16932 |        8 | 
|       13 | 16935 |       14 | 
|       14 | 16938 |       11 | 
+----------+-------+----------+
15 rows in set (0.01 sec)


--------------


Version Info

SqueezeCenter Version: 7.0 - 16607 - Debian - EN - iso-8859-1
Server IP address: 192.168.0.3
Perl Version: 5.8.8 i486-linux-gnu-thread-multi
MySQL Version: 5.0.51-2
Debian sid (unstable)


Let me know what, if any, debug logging you need me to turn on to test this.
Comment 1 Ed Fisher 2008-01-23 12:29:39 UTC
To clarify: this only occurs when adding the album to the playlist from the "new music" page.  If I add it from an artist or album page, the tracks play in the correct order.
Comment 2 Jim McAtee 2008-01-23 13:47:03 UTC
I'm not seeing this in 7.0.  Normally on my system tracks are scanned in tracknumber order - maybe because I have the tracknumber as the first item in the file name.  So I tested by scrambling all the tracknumbers in the tracks table for one album and then played the album from New Music.  The tracks are loaded and played in tracknum order, as expected.
Comment 3 Ed Fisher 2008-01-23 13:55:16 UTC
Yeah, they're played in the order they were added to the database.

My track naming format is tracknum first, so alphabetically they sort properly.  But the scanner isn't loading them into the database in alphanumeric order.  It's also not loading them by last modified time, or by filesize, or by putting the filenames in alphabetical order.

Regardless of whether it lies with the scanner, it seems like the "Play this album" button should play the tracks according to track number, not their internal id number in the database.
Comment 4 Blackketter Dean 2008-01-23 14:24:04 UTC
It sounds like it's ok in 7.0.  Ed, can you try this on 7.0 and re-open the bug if it's still happening?
Comment 5 Ed Fisher 2008-01-23 14:25:57 UTC
As noted above, I'm currently using rev 16607 of 7.0 and experiencing this problem.
Comment 6 KDF 2008-01-23 19:14:47 UTC
does the id order happen to match alphabetical order or is it just the id number that is ordered?
Comment 7 Ed Fisher 2008-01-23 20:19:06 UTC
It does not match alphabetically, it is only by ID.

Here's what the web interface shows for those tracks when I play from the "New Music" page:

       1.  12. Do Your Thing by Basement Jaxx from The Singles
       2.  7. Rendez-Vu by Basement Jaxx from The Singles
       3.  6. Where's Your Head At by Basement Jaxx from The Singles
       4.  15. Samba Magic by Basement Jaxx from The Singles
       5.  2. Good Luck by Basement Jaxx from The Singles
       6.  4. Oh My Gosh by Basement Jaxx from The Singles
       7.  10. Plug It In by Basement Jaxx from The Singles
       8.  1. Red Alert by Basement Jaxx from The Singles
       9.  5. Bingo Bango by Basement Jaxx from The Singles
       10.  3. Romeo by Basement Jaxx from The Singles
       11.  13. Jus 1 Kiss by Basement Jaxx from The Singles
       12.  9. Lucky Star by Basement Jaxx from The Singles
       13.  8. Jump N' Shout by Basement Jaxx from The Singles
       14.  14. Flylife by Basement Jaxx from The Singles
       15.  11. U Don't Know Me by Basement Jaxx from The Singles

Comment 8 KDF 2008-01-23 21:02:11 UTC
In that case, it "looks" like the 'age' sort continuing through to the track level.  However, I'm not seeing either this on any of my new music albums at 16692.  database.sql at DEBUG might show/confirm what's being called through the query. control.command would be another idea, but that can be awfully chatty for just catching a single command.
Comment 9 Ed Fisher 2008-01-23 23:09:13 UTC
Chatty's no problems.  here's what looks relevant:

[08-01-23 23:08:50.9751] Slim::Control::Request::__parse (2313) Request: parse(playlist loadtracks content=&userAgent=Mozilla/5.0 (Macintosh; U; Intel Mac OS X;
 en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9&pageAntiCSRFToken=b2e35350cfcd84172179a7d8977d019e&ajaxRequest=1&webroot=/&command=playlist&cookies=HASH(0xc0
3cc90)&player=00:04:20:07:96:94&path=status.html&url_query=command=playlist&subcommand=loadtracks&age.id=1279&player=00%3A04%3A20%3A07%3A96%3A94&ajaxRequest=1&f
orce=1&s=0.14865626906822638&s=0.14865626906822638&force=1&host=blinky:9000&browserType=Firefox&subcommand=loadtracks&age.id=1279)

[08-01-23 23:08:50.9976] Slim::Schema::Debug::query_start (26) SELECT me.id, me.url, me.content_type, me.title, me.titlesort, me.titlesearch, me.album, me.tracknum, me.timestamp, me.filesize, me.disc, me.remote, me.audio, me.audio_size, me.audio_offset, me.year, me.secs, me.cover, me.vbr_scale, me.bitrate, me.samplerate, me.samplesize, me.channels, me.block_alignment, me.endian, me.bpm, me.tagversion, me.drm, me.musicmagic_mixable, me.musicbrainz_id, me.playcount, me.lastplayed, me.lossless, me.lyrics, me.rating, me.replay_gain, me.replay_peak FROM tracks me  JOIN albums album ON ( album.id = me.album ) WHERE ( album.id = ? AND audio = ? AND remote = ? ) GROUP BY me.id ORDER BY concat(album.titlesort, '0'), me.disc, me.tracknum, concat(me.titlesort, '0'): '1279', '1', '0'


When I run that command on the CLI I get this result: 

+-------+-----------------------------------------------------------------------------------------------+--------------+----------------------+----------------------+----------------------+-------+----------+------------+----------+------+--------+-------+------------+--------------+------+---------+----------------------------------------------------------+-----------+-------------+------------+------------+----------+-----------------+--------+------+------------+------+--------------------+----------------+-----------+------------+----------+--------+--------+-------------+-------------+
| id    | url                                                                                           | content_type | title                | titlesort            | titlesearch          | album | tracknum | timestamp  | filesize | disc | remote | audio | audio_size | audio_offset | year | secs    | cover                                                    | vbr_scale | bitrate     | samplerate | samplesize | channels | block_alignment | endian | bpm  | tagversion | drm  | musicmagic_mixable | musicbrainz_id | playcount | lastplayed | lossless | lyrics | rating | replay_gain | replay_peak |
+-------+-----------------------------------------------------------------------------------------------+--------------+----------------------+----------------------+----------------------+-------+----------+------------+----------+------+--------+-------+------------+--------------+------+---------+----------------------------------------------------------+-----------+-------------+------------+------------+----------+-----------------+--------+------+------------+------+--------------------+----------------+-----------+------------+----------+--------+--------+-------------+-------------+
| 16911 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/12-Do%20Your%20Thing.flac            | flc          | Do Your Thing        | DO YOUR THING        | DO YOUR THING        |  1279 |       12 | 1201116709 | 30847985 | NULL |      0 |     1 |   30847985 |            0 | 2005 |   259.6 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         |      948784 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         6 | 1201151331 |        1 | NULL   |      0 |       -9.74 |    0.980011 | 
| 16912 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/07-Rendez-Vu.flac                    | flc          | Rendez-Vu            | RENDEZ VU            | RENDEZ VU            |  1279 |        7 | 1201116709 | 25732432 | NULL |      0 |     1 |   25732432 |            0 | 2005 | 224.707 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         |      913993 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         2 | 1201126942 |        1 | NULL   |      0 |       -6.57 |    0.980011 | 
| 16914 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/06-Where%27s%20Your%20Head%20At.flac | flc          | Where's Your Head At | WHERE S YOUR HEAD AT | WHERE S YOUR HEAD AT |  1279 |        6 | 1201116708 | 29471767 | NULL |      0 |     1 |   29471767 |            0 | 2005 | 239.653 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         |      981813 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         2 | 1201126704 |        1 | NULL   |      0 |       -8.25 |    0.980011 | 
| 16917 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/15-Samba%20Magic.flac                | flc          | Samba Magic          | SAMBA MAGIC          | SAMBA MAGIC          |  1279 |       15 | 1201116709 | 36664114 | NULL |      0 |     1 |   36664114 |            0 | 2005 | 298.547 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         |      980861 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         2 | 1201128758 |        1 | NULL   |      0 |          -7 |    0.980011 | 
| 16918 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/02-Good%20Luck.flac                  | flc          | Good Luck            | GOOD LUCK            | GOOD LUCK            |  1279 |        2 | 1201116708 | 27539970 | NULL |      0 |     1 |   27539970 |            0 | 2005 | 211.547 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         | 1.03921e+06 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         1 | 1201125818 |        1 | NULL   |      0 |       -9.08 |    0.980011 | 
| 16922 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/04-Oh%20My%20Gosh.flac               | flc          | Oh My Gosh           | OH MY GOSH           | OH MY GOSH           |  1279 |        4 | 1201116708 | 28105212 | NULL |      0 |     1 |   28105212 |            0 | 2005 | 237.267 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         |      945612 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         1 | 1201126239 |        1 | NULL   |      0 |       -7.32 |    0.980011 | 
| 16925 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/10-Plug%20It%20In.flac               | flc          | Plug It In           | PLUG IT IN           | PLUG IT IN           |  1279 |       10 | 1201116709 | 26450587 | NULL |      0 |     1 |   26450587 |            0 | 2005 | 199.973 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         | 1.05577e+06 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         1 | 1201127625 |        1 | NULL   |      0 |      -10.28 |    0.980011 | 
| 16926 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/01-Red%20Alert.flac                  | flc          | Red Alert            | RED ALERT            | RED ALERT            |  1279 |        1 | 1201116708 | 26882125 | NULL |      0 |     1 |   26882125 |            0 | 2005 | 218.027 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         |      984182 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         2 | 1201125626 |        1 | NULL   |      0 |       -9.57 |    0.980011 | 
| 16927 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/05-Bingo%20Bango.flac                | flc          | Bingo Bango          | BINGO BANGO          | BINGO BANGO          |  1279 |        5 | 1201116708 | 27538841 | NULL |      0 |     1 |   27538841 |            0 | 2005 |   227.6 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         |      965868 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         1 | 1201126481 |        1 | NULL   |      0 |       -8.32 |    0.980011 | 
| 16928 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/03-Romeo.flac                        | flc          | Romeo                | ROMEO                | ROMEO                |  1279 |        3 | 1201116708 | 24359139 | NULL |      0 |     1 |   24359139 |            0 | 2005 | 206.253 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         |      942502 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         1 | 1201126037 |        1 | NULL   |      0 |       -8.35 |    0.980011 | 
| 16929 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/13-Jus%201%20Kiss.flac               | flc          | Jus 1 Kiss           | JUS 1 KISS           | JUS 1 KISS           |  1279 |       13 | 1201116709 | 25667754 | NULL |      0 |     1 |   25667754 |            0 | 2005 | 217.347 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         |      942563 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         1 | 1201128295 |        1 | NULL   |      0 |       -8.98 |    0.980011 | 
| 16931 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/09-Lucky%20Star.flac                 | flc          | Lucky Star           | LUCKY STAR           | LUCKY STAR           |  1279 |        9 | 1201116709 | 30869371 | NULL |      0 |     1 |   30869371 |            0 | 2005 | 233.653 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         | 1.05488e+06 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         1 | 1201127385 |        1 | NULL   |      0 |       -9.01 |     0.97998 | 
| 16932 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/08-Jump%20N%27%20Shout.flac          | flc          | Jump N' Shout        | JUMP N SHOUT         | JUMP N SHOUT         |  1279 |        8 | 1201116709 | 24011620 | NULL |      0 |     1 |   24011620 |            0 | 2005 | 218.573 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         |      876657 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         1 | 1201127163 |        1 | NULL   |      0 |       -8.81 |     0.97998 | 
| 16935 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/14-Flylife.flac                      | flc          | Flylife              | FLYLIFE              | FLYLIFE              |  1279 |       14 | 1201116709 | 29432152 | NULL |      0 |     1 |   29432152 |            0 | 2005 | 244.227 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         |      962130 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         1 | 1201128510 |        1 | NULL   |      0 |       -7.31 |    0.980011 | 
| 16938 | file:///usr/tmp/music/flac/Basement%20Jaxx/The%20Singles/11-U%20Don%27t%20Know%20Me.flac      | flc          | U Don't Know Me      | U DON T KNOW ME      | U DON T KNOW ME      |  1279 |       11 | 1201116709 | 25669193 | NULL |      0 |     1 |   25669193 |            0 | 2005 | 215.467 | /usr/tmp/music/flac/Basement Jaxx/The Singles/folder.jpg | 1         |      950841 |      44100 |       NULL |        2 |            NULL |   NULL | NULL | NULL       |    0 |               NULL | NULL           |         1 | 1201127828 |        1 | NULL   |      0 |       -8.94 |    0.980011 | 
+-------+-----------------------------------------------------------------------------------------------+--------------+----------------------+----------------------+----------------------+-------+----------+------------+----------+------+--------+-------+------------+--------------+------+---------+----------------------------------------------------------+-----------+-------------+------------+------------+----------+-----------------+--------+------+------------+------+--------------------+----------------+-----------+------------+----------+--------+--------+-------------+-------------+


If I remove the "GROUP BY me.id" (which is redundant, since me.id is the primary key and the join is one-to-one), I get the results in the proper order. 

It looks like this is caused by this bug: http://bugs.mysql.com/bug.php?id=32202

This should probably be closed, because it's a MySQL bug.  That said, a temporary fix (since there hasn't been a new community MySQL version released with the fix in place) is to remove the GROUP BY clause in that query or to revert to 5.0.45.
Comment 10 KDF 2008-01-23 23:24:07 UTC
That might explain why I don't see it.  My system has 5.0.32.  
My thinking is to leave it open so that people see it, but resolved would also be valid as it's fixable
with a different version of mysql. SC can't specifically remove the GROUP.BY as the actual query is generated via Class:DBIx 

Only question is which version is used for the included mysql? If that's on ok version, its more likely this can be called resolved.
Comment 11 Max Spicer 2008-04-21 08:42:20 UTC
*** Bug 7035 has been marked as a duplicate of this bug. ***
Comment 12 KDF 2008-04-22 16:56:43 UTC
*** Bug 7942 has been marked as a duplicate of this bug. ***
Comment 13 KDF 2008-07-13 00:32:31 UTC
*** Bug 8703 has been marked as a duplicate of this bug. ***
Comment 14 Chris Owens 2008-09-22 09:41:54 UTC
*** Bug 9335 has been marked as a duplicate of this bug. ***
Comment 15 Alan Young 2011-11-06 23:24:59 UTC
Unassigned bugs cannot have a priority.
Comment 16 Michael Herger 2013-10-11 13:34:44 UTC
We're no longer using MySQL