Uploaded image for project: 'MusicBrainz Server'
  1. MusicBrainz Server
  2. MBS-10782

Reorder mediums edit for multiple media additions and deletions fails

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Edit system
    • Labels:
      None

      Description

      I was removing the 18 wrong media for this release (all media at the time) and added the 7 correct media at the same time. All the Add medium and Remove medium edits succeeded, but the edit to Reorder mediums (see attached preview image) got lost. In the preview this showed up as a huge edit (2x7 "partial edits") for medium 19 only, instead of affecting the positions of all media 19 to 25, which would have been correct. It seems like the code for media renumbering (starting with medium 1) after deletion of media works only for a single medium addition and fails for multiple.

      The release editor showed the following log in red beneath the Make all edits votable checkbox (instead of redirecting to the release):

      Failed query: 'UPDATE medium SET position = (SELECT position FROM (VALUES (?::INTEGER, ?::INTEGER), (?::INTEGER, ?::INTEGER), (?::INTEGER, ?::INTEGER), (?::INTEGER, ?::INTEGER), (?::INTEGER, ?::INTEGER), (?::INTEGER, ?::INTEGER), (?::INTEGER, ?::INTEGER), (?::INTEGER, ?::INTEGER)) AS mpos (medium, position) WHERE mpos.medium = medium.id) WHERE id IN (?,?,?,?,?,?,?,?)' (2915826 19 2915823 19 2915824 19 2916160 7 2915821 19 2915838 19 2915822 19 2915825 19 2915826 2915823 2915824 2916160 2915821 2915838 2915822 2915825) 23505 DBD::Pg::st execute failed: ERROR: duplicate key value violates unique constraint "medium_uniq" DETAIL: Key (release, "position")=(2684864, 19) already exists. [for Statement "UPDATE medium SET position = (SELECT position FROM (VALUES (?::INTEGER, ?::INTEGER), (?::INTEGER, ?::INTEGER), (?::INTEGER, ?::INTEGER), (?::INTEGER, ?::INTEGER), (?::INTEGER, ?::INTEGER), (?::INTEGER, ?::INTEGER), (?::INTEGER, ?::INTEGER), (?::INTEGER, ?::INTEGER)) AS mpos (medium, position) WHERE mpos.medium = medium.id) WHERE id IN (?,?,?,?,?,?,?,?)" with ParamValues: 1='2915826', 2='19', 3='2915823', 4='19', 5='2915824', 6='19', 7='2916160', 8='7', 9='2915821', 10='19', 11='2915838', 12='19', 13='2915822', 14='19', 15='2915825', 16='19', 17='2915826', 18='2915823', 19='2915824', 20='2916160', 21='2915821', 22='2915838', 23='2915822', 24='2915825'] at lib/Sql.pm line 116. Sql::catch {...} (MusicBrainz::Server::Exceptions::DatabaseError=HASH(0x1cfb1ae8)) called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 123 Try::Tiny::try(CODE(0x1dd7ccb0), Try::Tiny::Catch=REF(0x1de38d28)) called at lib/Sql.pm line 117 Sql::do(Sql=HASH(0x1955d7e8), "UPDATE medium SET position =\x{a} (SELECT position"..., 2915826, 19, 2915823, 19, 2915824, 19, 2916160, ...) called at lib/MusicBrainz/Server/Data/Medium.pm line 255 MusicBrainz::Server::Data::Medium::reorder(MusicBrainz::Server::Data::Medium=HASH(0x147fe318), 2915826, 19, 2915823, 19, 2915821, 19, 2915824, 19, ...) called at lib/MusicBrainz/Server/Edit/Release/ReorderMediums.pm line 128 MusicBrainz::Server::Edit::Release::ReorderMediums::accept(MusicBrainz::Server::Edit::Release::ReorderMediums=HASH(0x1de337f8)) called at lib/MusicBrainz/Server/Data/Edit.pm line 749 MusicBrainz::Server::Data::Edit::try {...} () called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 100 eval {...} called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 93 Try::Tiny::try(CODE(0x1de9b660), Try::Tiny::Catch=REF(0x19bad790)) called at lib/MusicBrainz/Server/Data/Edit.pm line 784 MusicBrainz::Server::Data::Edit::_do_accept(MusicBrainz::Server::Data::Edit=HASH(0xe754148), MusicBrainz::Server::Edit::Release::ReorderMediums=HASH(0x1de337f8)) called at lib/MusicBrainz/Server/Data/Edit.pm line 823 MusicBrainz::Server::Data::Edit::__ANON__(MusicBrainz::Server::Edit::Release::ReorderMediums=HASH(0x1de337f8)) called at lib/MusicBrainz/Server/Data/Edit.pm line 846 MusicBrainz::Server::Data::Edit::_close(MusicBrainz::Server::Data::Edit=HASH(0xe754148), MusicBrainz::Server::Edit::Release::ReorderMediums=HASH(0x1de337f8), CODE(0x1da05f10)) called at lib/MusicBrainz/Server/Data/Edit.pm line 823 MusicBrainz::Server::Data::Edit::accept(MusicBrainz::Server::Data::Edit=HASH(0xe754148), MusicBrainz::Server::Edit::Release::ReorderMediums=HASH(0x1de337f8)) called at lib/MusicBrainz/Server/Data/Edit.pm line 593 MusicBrainz::Server::Data::Edit::create(MusicBrainz::Server::Data::Edit=HASH(0xe754148), "edit_type", 313, "release", MusicBrainz::Server::Entity::Release=HASH(0x19ba2a98), "medium_positions", ARRAY(0x19363da0), "editor", MusicBrainz::Server::Authentication::User=HASH(0x19bb4310), ...) called at lib/MusicBrainz/Server/Controller/WS/js/Edit.pm line 565 MusicBrainz::Server::Controller::WS::js::Edit::try {...} () called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 102 eval {...} called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 93 Try::Tiny::try(CODE(0x19560e90), Try::Tiny::Catch=REF(0x191bd4e8)) called at lib/MusicBrainz/Server/Controller/WS/js/Edit.pm line 583 MusicBrainz::Server::Controller::WS::js::Edit::create_edits(MusicBrainz::Server::Controller::WS::js::Edit=HASH(0x156081e8), MusicBrainz::Server=HASH(0x19ba5690), HASH(0x19d49a30)) called at lib/MusicBrainz/Server/Controller/WS/js/Edit.pm line 640 MusicBrainz::Server::Controller::WS::js::Edit::__ANON__() called at lib/Sql.pm line 322 Sql::try {...} () called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 102 eval {...} called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 93 Try::Tiny::try(CODE(0x18db8480), Try::Tiny::Catch=REF(0x18cf3650)) called at lib/Sql.pm line 335 Sql::_auto_transaction(CODE(0x190821a8), Sql=HASH(0x1955d7e8)) called at lib/Sql.pm line 340 Sql::_run_in_transaction_one(CODE(0x190821a8), Sql=HASH(0x1955d7e8)) called at lib/Sql.pm line 355 Sql::run_in_transaction(CODE(0x190821a8), Sql=HASH(0x1955d7e8)) called at lib/MusicBrainz/Server/Model/MB.pm line 19 MusicBrainz::Server::Model::MB::with_transaction(MusicBrainz::Server::Model::MB=HASH(0x12fbf1f8), CODE(0x190821a8)) called at lib/MusicBrainz/Server/Controller/WS/js/Edit.pm line 651 MusicBrainz::Server::Controller::WS::js::Edit::submit_edits(MusicBrainz::Server::Controller::WS::js::Edit=HASH(0x156081e8), MusicBrainz::Server=HASH(0x19ba5690), HASH(0x19d49a30)) called at lib/MusicBrainz/Server/Controller/WS/js/Edit.pm line 615 MusicBrainz::Server::Controller::WS::js::Edit::create(MusicBrainz::Server::Controller::WS::js::Edit=HASH(0x156081e8), MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/Action.pm line 358 Catalyst::Action::execute(Catalyst::Action=HASH(0x15ac6da8), MusicBrainz::Server::Controller::WS::js::Edit=HASH(0x156081e8), MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst.pm line 2061 eval {...} called at /home/musicbrainz/carton-local/lib/perl5/Catalyst.pm line 2061 Catalyst::execute(MusicBrainz::Server=HASH(0x19ba5690), "MusicBrainz::Server::Controller::WS::js::Edit", Catalyst::Action=HASH(0x15ac6da8)) called at lib/Catalyst/Plugin/Sentry.pm line 23 Catalyst::Plugin::Sentry::execute(MusicBrainz::Server=HASH(0x19ba5690), "MusicBrainz::Server::Controller::WS::js::Edit", Catalyst::Action=HASH(0x15ac6da8)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/Action.pm line 353 Catalyst::Action::dispatch(Catalyst::Action=HASH(0x15ac6da8), MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/ActionChain.pm line 46 Catalyst::ActionChain::dispatch(Catalyst::ActionChain=HASH(0x1922f678), MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/Controller.pm line 170 Catalyst::Controller::_ACTION(MusicBrainz::Server::Controller::WS::js::Edit=HASH(0x156081e8), MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/Action.pm line 358 Catalyst::Action::execute(Catalyst::Action=HASH(0x15ac67a8), MusicBrainz::Server::Controller::WS::js::Edit=HASH(0x156081e8), MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst.pm line 2061 eval {...} called at /home/musicbrainz/carton-local/lib/perl5/Catalyst.pm line 2061 Catalyst::execute(MusicBrainz::Server=HASH(0x19ba5690), "MusicBrainz::Server::Controller::WS::js::Edit", Catalyst::Action=HASH(0x15ac67a8)) called at lib/Catalyst/Plugin/Sentry.pm line 23 Catalyst::Plugin::Sentry::execute(MusicBrainz::Server=HASH(0x19ba5690), "MusicBrainz::Server::Controller::WS::js::Edit", Catalyst::Action=HASH(0x15ac67a8)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/Action.pm line 353 Catalyst::Action::dispatch(Catalyst::Action=HASH(0x15ac67a8), MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/Dispatcher.pm line 261 Catalyst::Dispatcher::_do_forward(Catalyst::Dispatcher=HASH(0x93320c8), "forward", MusicBrainz::Server=HASH(0x19ba5690), "_ACTION") called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/Dispatcher.pm line 241 Catalyst::Dispatcher::forward(Catalyst::Dispatcher=HASH(0x93320c8), MusicBrainz::Server=HASH(0x19ba5690), "_ACTION") called at /home/musicbrainz/carton-local/lib/perl5/Catalyst.pm line 483 Catalyst::forward(MusicBrainz::Server=HASH(0x19ba5690), "_ACTION") called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/Controller.pm line 134 Catalyst::Controller::_DISPATCH(MusicBrainz::Server::Controller::WS::js::Edit=HASH(0x156081e8), MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/Action.pm line 358 Catalyst::Action::execute(Catalyst::Action=HASH(0x15abe510), MusicBrainz::Server::Controller::WS::js::Edit=HASH(0x156081e8), MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst.pm line 2061 eval {...} called at /home/musicbrainz/carton-local/lib/perl5/Catalyst.pm line 2061 Catalyst::execute(MusicBrainz::Server=HASH(0x19ba5690), "MusicBrainz::Server::Controller::WS::js::Edit", Catalyst::Action=HASH(0x15abe510)) called at lib/Catalyst/Plugin/Sentry.pm line 23 Catalyst::Plugin::Sentry::execute(MusicBrainz::Server=HASH(0x19ba5690), "MusicBrainz::Server::Controller::WS::js::Edit", Catalyst::Action=HASH(0x15abe510)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/Action.pm line 353 Catalyst::Action::dispatch(Catalyst::Action=HASH(0x15abe510), MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/Dispatcher.pm line 261 Catalyst::Dispatcher::_do_forward(Catalyst::Dispatcher=HASH(0x93320c8), "forward", MusicBrainz::Server=HASH(0x19ba5690), "/ws/js/edit/_DISPATCH") called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/Dispatcher.pm line 241 Catalyst::Dispatcher::forward(Catalyst::Dispatcher=HASH(0x93320c8), MusicBrainz::Server=HASH(0x19ba5690), "/ws/js/edit/_DISPATCH") called at /home/musicbrainz/carton-local/lib/perl5/Catalyst.pm line 483 Catalyst::forward(MusicBrainz::Server=HASH(0x19ba5690), "/ws/js/edit/_DISPATCH") called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/Dispatcher.pm line 107 Catalyst::Dispatcher::dispatch(Catalyst::Dispatcher=HASH(0x93320c8), MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst.pm line 2007 Catalyst::dispatch(MusicBrainz::Server=HASH(0x19ba5690)) called at lib/MusicBrainz/Server.pm line 320 MusicBrainz::Server::__ANON__() called at lib/MusicBrainz/Server.pm line 295 MusicBrainz::Server::with_translations(MusicBrainz::Server=HASH(0x19ba5690), CODE(0x190d2b50)) called at lib/MusicBrainz/Server.pm line 321 Class::MOP::Class:::around(CODE(0x4d1e2d8), MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/x86_64-linux-gnu-thread-multi/Class/MOP/Method/Wrapped.pm line 164 Class::MOP::Method::Wrapped::__ANON__(MusicBrainz::Server=HASH(0x19ba5690)) called at lib/MusicBrainz/Server.pm line 335 Class::MOP::Class:::around(CODE(0x1566cc60), MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/x86_64-linux-gnu-thread-multi/Class/MOP/Method/Wrapped.pm line 164 Class::MOP::Method::Wrapped::__ANON__(MusicBrainz::Server=HASH(0x19ba5690)) called at lib/MusicBrainz/Server.pm line 413 Class::MOP::Class:::around(CODE(0x1566cdc8), MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/x86_64-linux-gnu-thread-multi/Class/MOP/Method/Wrapped.pm line 164 Class::MOP::Method::Wrapped::__ANON__(MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/x86_64-linux-gnu-thread-multi/Class/MOP/Method/Wrapped.pm line 35 MusicBrainz::Server::_wrapped_dispatch(MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/x86_64-linux-gnu-thread-multi/Class/MOP/Method/Wrapped.pm line 95 MusicBrainz::Server::dispatch(MusicBrainz::Server=HASH(0x19ba5690)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst.pm line 2413 Catalyst::try {...} () called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 102 eval {...} called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 93 Try::Tiny::try(CODE(0x19563d28), Try::Tiny::Catch=REF(0x18764aa0)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst.pm line 2422 Catalyst::handle_request("MusicBrainz::Server", "env", HASH(0x19a93f70), "response_cb", CODE(0x19463bb0)) called at /home/musicbrainz/carton-local/lib/perl5/Catalyst/Engine.pm line 807 Catalyst::Engine::__ANON__(CODE(0x19463bb0)) called at /home/musicbrainz/carton-local/lib/perl5/Plack/Middleware/HTTPExceptions.pm line 32 Plack::Middleware::HTTPExceptions::try {...} () called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 102 eval {...} called at /home/musicbrainz/carton-local/lib/perl5/Try/Tiny.pm line 93 Try::Tiny::try(CODE(0x19468c70), Try::Tiny::Catch=REF(0x190e1148)) called at /home/musicbrainz/carton-local/lib/perl5/Plack/Middleware/HTTPExceptions.pm line 41 Plack::Middleware::HTTPExceptions::__ANON__(CODE(0x192a8a20)) called at /home/musicbrainz/carton-local/lib/perl5/Plack/Util.pm line 339 Plack::Util::__ANON__(CODE(0x19d36978)) called at /home/musicbrainz/carton-local/lib/perl5/Plack/Util.pm line 339 Plack::Util::__ANON__(CODE(0x195a1028)) called at /home/musicbrainz/carton-local/lib/perl5/Plack/Util.pm line 339 Plack::Util::__ANON__(CODE(0x19d41310)) called at /home/musicbrainz/carton-local/lib/perl5/Starlet/Server.pm line 377 Starlet::Server::handle_connection(Plack::Handler::Starlet=HASH(0xe83dbd8), HASH(0x19a93f70), IO::Socket::INET=GLOB(0x18828688), CODE(0x15b19d88), "", "", "") called at /home/musicbrainz/carton-local/lib/perl5/Starlet/Server.pm line 190 Starlet::Server::accept_loop(Plack::Handler::Starlet=HASH(0xe83dbd8), CODE(0x15b19d88), 63) called at /home/musicbrainz/carton-local/lib/perl5/Plack/Handler/Starlet.pm line 80 Plack::Handler::Starlet::run(Plack::Handler::Starlet=HASH(0xe83dbd8), CODE(0x15b19d88)) called at /home/musicbrainz/carton-local/lib/perl5/Plack/Loader.pm line 84 Plack::Loader::run(Plack::Loader=HASH(0x26d1a88), Plack::Handler::Starlet=HASH(0xe83dbd8)) called at /home/musicbrainz/carton-local/lib/perl5/Plack/Runner.pm line 277 Plack::Runner::run(Plack::Runner=HASH(0x26d1ab8)) called at /home/musicbrainz/carton-local/bin/plackup line 7 

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              kellnerd David Kellner
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Packages

                Version Package