MusicPlayerDaemon / MPD

Music Player Daemon
https://www.musicpd.org/
GNU General Public License v2.0
2.18k stars 352 forks source link

Database gets cleaned after update to >0.23 #1299

Closed 11xx closed 3 years ago

11xx commented 3 years ago

Bug report

Describe the bug

MPD wipes the database after upgrading from 0.22.11 to 0.23

Expected Behavior

MPD should be able to read the database file after the update.

Actual Behavior

MPD can't read the database and without warning or backup deletes the old file and creates a new empty one. It throws the error exception: Tag list mismatch, discarding database file on the --verbose log

Version

Music Player Daemon 0.23.1 (0.23.1)
Copyright 2003-2007 Warren Dukes <warren.dukes@gmail.com>
Copyright 2008-2021 Max Kellermann <max.kellermann@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Database plugins:
 simple proxy upnp

Storage plugins:
 local udisks nfs curl

Neighbor plugins:
 upnp udisks

Decoders plugins:
 [mad] mp3 mp2
 [mpg123] mp3
 [vorbis] ogg oga
 [oggflac] ogg oga
 [flac] flac
 [opus] opus ogg oga
 [sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2
 [audiofile] wav au aiff aif
 [dsdiff] dff
 [dsf] dsf
 [hybrid_dsd] m4a
 [faad] aac
 [mpcdec] mpc
 [wavpack] wv
 [openmpt] mptm mod s3m xm it 669 amf ams c67 dbm digi dmf dsm dtm far imf ice j2b m15 mdl med mms mt2 mtm nst okt plm psm pt36 ptm sfx sfx2 st26 stk stm stp ult wow gdm mo3 oxm umx xpk ppm mmcmp
 [modplug] 669 amf ams dbm dfm dsm far it med mdl mod mtm mt2 okt s3m stm ult umx xm
 [mikmod] amf dsm far gdm imf it med mod mtm s3m stm stx ult uni xm
 [sidplay] sid mus str prg P00
 [wildmidi] mid
 [fluidsynth] mid
 [ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg opus psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tak tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav webm wma wmv wsaud wsvga wv wve rtp:// rtsp:// rtsps://
 [gme] ay gbs gym hes kss nsf nsfe rsn sap spc vgm vgz
 [pcm]

Filters:
 libsamplerate soxr

Tag plugins:
 id3tag

Output plugins:
 shout null fifo pipe alsa ao oss openal solaris pipewire pulse jack httpd snapcast recorder

Encoder plugins:
 null vorbis opus lame twolame wave flac

Archive plugins:
 [bz2] bz2
 [zzip] zip
 [iso] iso

Input plugins:
 file io_uring archive alsa qobuz curl ffmpeg nfs mms cdio_paranoia

Playlist plugins:
 extm3u m3u pls xspf asx rss soundcloud flac cue embcue

Protocols:
 file:// alsa:// cdda:// ftp:// ftps:// gopher:// hls+http:// hls+https:// http:// https:// mms:// mmsh:// mmst:// mmsu:// nfs:// qobuz:// rtmp:// rtmpe:// rtmps:// rtmpt:// rtmpte:// rtmpts:// rtp:// rtsp:// rtsps:// scp:// sftp:// smb:// srtp://

Other features:
 avahi dbus udisks epoll icu inotify ipv6 systemd tcp un

Log

simple_db: reading DB
exception: Tag list mismatch, discarding database file
input: Input plugin 'qobuz' is not configured: %s
curl: version 7.79.1
curl: with OpenSSL/1.1.1l

Luckily I had a backup. Restoring it don't work in 0.23 or 0.23.1. But downgrading to 0.22.11 fixed it. This is important for my use case because I point MPD to a streamable rclone mount. It takes about two days to fully scan the entire directory for the first time. I also tried waiting a full fresh database scan but it got wiped out again after the next boot.

I'm on arch, kernel 5.14.12-zen1-1-zen

Also my config:

music_directory             "/home/music"
playlist_directory      "~/.local/share/mpd/playlists"
db_file                     "~/.local/share/mpd/database"
log_level           "default"
log_file            "~/.local/state/mpd/log"
pid_file            "~/.local/state/mpd/pid"
state_file          "~/.local/state/mpd/state"
sticker_file            "~/.local/share/mpd/sticker.sql"

max_output_buffer_size "131072"

auto_update "no"

audio_output {
 type "alsa"
 name "..."
 device "hw:2,0"
 mixer_type      "hardware"
# mixer_control   "'Master',0"
 auto_resample   "no"
 auto_format     "no"
 enabled         "yes"
# DoP-only for direct conversion to PCM,
# if DAC is not nativ DSD format
# dop            "yes"
}

audio_output {
    type "pulse"
    name "PulseAudio"
}

decoder {
        plugin   "hybrid_dsd"
        enabled  "no"
        gapless  "no"
}

audio_output {
    type                    "fifo"
    name                    "my_fifo"
    path                    "/tmp/mpd.fifo"
    format                  "44100:16:2"
}
MaxKellermann commented 3 years ago

As you see in the errro message, MPD 0.23 added new tag types. Since the set of enabled tags has changed (no matter which version), MPD needs to rescan all files, because the files in the database may have the tags that have been added, but are missing in the old database file. This is expected behavior, and can be mitigated by enabling exactly the tags that are in your database file. Configure metadata_to_use: https://mpd.readthedocs.io/en/stable/user.html#metadata-to-use

11xx commented 3 years ago

Thanks, It would not occur to me that Tag list mismatch meant that new tags were added and that it needs to re-scan everything.

Using metadata_to_use helped a lot :+1: