{"action":"created","issue":{"url":"https://api.github.com/repos/magento/magento2/issues/17378","repository_url":"https://api.github.com/repos/magento/magento2","labels_url":"https://api.github.com/repos/magento/magento2/issues/17378/labels{/name}","comments_url":"https://api.github.com/repos/magento/magento2/issues/17378/comments","events_url":"https://api.github.com/repos/magento/magento2/issues/17378/events","html_url":"https://github.com/magento/magento2/issues/17378","id":347782914,"node_id":"MDU6SXNzdWUzNDc3ODI5MTQ=","number":17378,"title":"URL rewrites not being generated - calls to doReplace() actually insert instead.","user":{"login":"simonworkhouse","id":35518922,"node_id":"MDQ6VXNlcjM1NTE4OTIy","avatar_url":"https://avatars0.githubusercontent.com/u/35518922?v=4","gravatar_id":"","url":"https://api.github.com/users/simonworkhouse","html_url":"https://github.com/simonworkhouse","followers_url":"https://api.github.com/users/simonworkhouse/followers","following_url":"https://api.github.com/users/simonworkhouse/following{/other_user}","gists_url":"https://api.github.com/users/simonworkhouse/gists{/gist_id}","starred_url":"https://api.github.com/users/simonworkhouse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonworkhouse/subscriptions","organizations_url":"https://api.github.com/users/simonworkhouse/orgs","repos_url":"https://api.github.com/users/simonworkhouse/repos","events_url":"https://api.github.com/users/simonworkhouse/events{/privacy}","received_events_url":"https://api.github.com/users/simonworkhouse/received_events","type":"User","site_admin":false},"labels":[{"id":688811200,"node_id":"MDU6TGFiZWw2ODg4MTEyMDA=","url":"https://api.github.com/repos/magento/magento2/labels/Issue:%20Format%20is%20valid","name":"Issue: Format is valid","color":"0e8a16","default":false},{"id":161563561,"node_id":"MDU6TGFiZWwxNjE1NjM1NjE=","url":"https://api.github.com/repos/magento/magento2/labels/Progress:%20needs%20update","name":"Progress: needs update","color":"b60205","default":false}],"state":"closed","locked":false,"assignee":{"login":"engcom-backlog-pb","id":40756187,"node_id":"MDQ6VXNlcjQwNzU2MTg3","avatar_url":"https://avatars3.githubusercontent.com/u/40756187?v=4","gravatar_id":"","url":"https://api.github.com/users/engcom-backlog-pb","html_url":"https://github.com/engcom-backlog-pb","followers_url":"https://api.github.com/users/engcom-backlog-pb/followers","following_url":"https://api.github.com/users/engcom-backlog-pb/following{/other_user}","gists_url":"https://api.github.com/users/engcom-backlog-pb/gists{/gist_id}","starred_url":"https://api.github.com/users/engcom-backlog-pb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/engcom-backlog-pb/subscriptions","organizations_url":"https://api.github.com/users/engcom-backlog-pb/orgs","repos_url":"https://api.github.com/users/engcom-backlog-pb/repos","events_url":"https://api.github.com/users/engcom-backlog-pb/events{/privacy}","received_events_url":"https://api.github.com/users/engcom-backlog-pb/received_events","type":"User","site_admin":false},"assignees":[{"login":"engcom-backlog-pb","id":40756187,"node_id":"MDQ6VXNlcjQwNzU2MTg3","avatar_url":"https://avatars3.githubusercontent.com/u/40756187?v=4","gravatar_id":"","url":"https://api.github.com/users/engcom-backlog-pb","html_url":"https://github.com/engcom-backlog-pb","followers_url":"https://api.github.com/users/engcom-backlog-pb/followers","following_url":"https://api.github.com/users/engcom-backlog-pb/following{/other_user}","gists_url":"https://api.github.com/users/engcom-backlog-pb/gists{/gist_id}","starred_url":"https://api.github.com/users/engcom-backlog-pb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/engcom-backlog-pb/subscriptions","organizations_url":"https://api.github.com/users/engcom-backlog-pb/orgs","repos_url":"https://api.github.com/users/engcom-backlog-pb/repos","events_url":"https://api.github.com/users/engcom-backlog-pb/events{/privacy}","received_events_url":"https://api.github.com/users/engcom-backlog-pb/received_events","type":"User","site_admin":false}],"milestone":null,"comments":15,"created_at":"2018-08-06T05:27:20Z","updated_at":"2018-10-24T09:39:31Z","closed_at":"2018-08-13T09:37:26Z","author_association":"NONE","body":"<!---\r\n    Thank you for contributing to Magento.\r\n    To help us process this issue we recommend that you add the following information:\r\n     - Summary of the issue,\r\n     - Information on your environment,\r\n     - Steps to reproduce,\r\n     - Expected and actual results,\r\n\r\n    Please also have a look at our guidelines article before adding a new issue https://github.com/magento/magento2/wiki/Issue-reporting-guidelines\r\n-->\r\nWe have been experiencing an intermittent issue where entries into the url_rewrite table are not being generated automatically. I have noticed that this issue has been mentioned in the past but I believe that we have isolated the cause.\r\n\r\nMagento\\UrlRewrite\\Model\\Storage\\DbStorage::doReplace(...) doesn't do a REPLACE but an INSERT, and errors for duplicate entries aren't throwing an AlreadyExistsException as expected.\r\n\r\nA general gist of the code path is as follows:\r\nMagento\\CatalogUrlRewrite\\Model\\UrlRewriteBunchReplacer::doBunchReplace(...) ->\r\nMagento\\UrlRewrite\\Model\\Storage\\DbStorage::doReplace(...) ->\r\nMagento\\Framework\\DB\\Adapter\\Pdo\\Mysql::insertMultiple(...) ->\r\nMagento\\Framework\\DB\\Adapter\\Pdo\\Mysql::insertArray(...) \r\n\r\nWhen we updated the doReplace(...) and insertMultiple(...) functions to pass the replace strategy through to insertArray(...) everything worked as expected. Would I be correct in assuming that this was the intended strategy and that is was just missing from doReplace and insertMultiple? Why would it not be a replace?\r\n\r\nAlso, any calls to Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql::insertMultiple(...) will fail if there are duplicates in the data based on unique constraints. This function doesn't take this into account and doesn't have the ability to pass the strategy through to insertArray(...). There also doesn't appear to be an equivalent replaceMultiple(...).\r\n\r\nI would guess that this might be causing some other bugs we have noticed, particularly with importing catalog data from a CSV.\r\n\r\n### Preconditions\r\n<!---\r\n    Please provide as detailed information about your environment as possible.\r\n    For example Magento version, tag, HEAD, PHP & MySQL version, etc..\r\n-->\r\n1. Magento 2.2.5 \r\n2. PHP 7.1.20\r\n3. MySQL 5.7.23\r\n4. Multiple stores set up and enabled with the same products and root category\r\n\r\n### Steps to reproduce\r\n<!---\r\n    It is important to provide a set of clear steps to reproduce this bug.\r\n    If relevant please include code samples\r\n-->\r\nAssuming that the category data will fail for a duplicate entry:\r\n1. Update the URL key for a category\r\n\r\n### Actual result\r\n<!--- Tell us what happens instead -->\r\nReceived the following MySQL error running the query that Magento genereted:\r\nError Code: 1062. Duplicate entry 'some-product-1' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID'\r\n\r\nAn AlreadyExistsException didn't appear to have been thrown, or was silently handled.\r\n\r\n### Expected result\r\nThe correct entries in the url_rewrite table are created.   "},"comment":{"url":"https://api.github.com/repos/magento/magento2/issues/comments/432587471","html_url":"https://github.com/magento/magento2/issues/17378#issuecomment-432587471","issue_url":"https://api.github.com/repos/magento/magento2/issues/17378","id":432587471,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMjU4NzQ3MQ==","user":{"login":"koopjesboom","id":15247780,"node_id":"MDQ6VXNlcjE1MjQ3Nzgw","avatar_url":"https://avatars2.githubusercontent.com/u/15247780?v=4","gravatar_id":"","url":"https://api.github.com/users/koopjesboom","html_url":"https://github.com/koopjesboom","followers_url":"https://api.github.com/users/koopjesboom/followers","following_url":"https://api.github.com/users/koopjesboom/following{/other_user}","gists_url":"https://api.github.com/users/koopjesboom/gists{/gist_id}","starred_url":"https://api.github.com/users/koopjesboom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koopjesboom/subscriptions","organizations_url":"https://api.github.com/users/koopjesboom/orgs","repos_url":"https://api.github.com/users/koopjesboom/repos","events_url":"https://api.github.com/users/koopjesboom/events{/privacy}","received_events_url":"https://api.github.com/users/koopjesboom/received_events","type":"User","site_admin":false},"created_at":"2018-10-24T09:39:31Z","updated_at":"2018-10-24T09:39:31Z","author_association":"NONE","body":"Best,\n\n \n\nThank you very much for the information.\n\nI am going to try to get this patch.\n\n \n\nDo you have information about the patch, a patch number and file name?\n\n \n\nBest regards Bram Slagboom\n\n \n\nAdres/Address\n\nKoopjesboom V.O.F.\n\nLorentzweg 26\n\n2964LN Groot-Ammers\n\n \n\nTel/Phone : 0031184634329\n\nMobile : 0031651180371\n\nE-Mail : info@koopjesboom.com\n\n \n\n <https://kbmodelcars.com/> https://kbmodelcars.com\n\n <https://ownstock.eu/> https://ownstock.eu\n\n \n\nKVK : 58220259\n\n \n\nVan: eWolf62095 <notifications@github.com> \nVerzonden: woensdag 24 oktober 2018 11:36\nAan: magento/magento2 <magento2@noreply.github.com>\nCC: koopjesboom <info@koopjesboom.com>; Mention <mention@noreply.github.com>\nOnderwerp: Re: [magento/magento2] URL rewrites not being generated - calls to doReplace() actually insert instead. (#17378)\n\n \n\n@koopjesboom <https://github.com/koopjesboom>  hi sire, just for an update. Magento Support provided a patch for us. The patch was about \"URL Key not updated during product import\". The issue is different from what's in this thread however the patch provided also fixed the issue that I experienced same on this thread. Sadly I cannot share you the patch because it is the owned by our company and only our infra team has accessed on the support desk of Magento 2.\n\n—\nYou are receiving this because you were mentioned.\nReply to this email directly, view it on GitHub <https://github.com/magento/magento2/issues/17378#issuecomment-432586092> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AOippDHfpxWYTAsmGP0B-Zc5ps8iaKD_ks5uoDR7gaJpZM4VvxTE> .  <https://github.com/notifications/beacon/AOippG3scUJKU9Zx4YDKPk82V8o94Q3Mks5uoDR7gaJpZM4VvxTE.gif> \n\n"}}
{"actor":{"display_login":"koopjesboom"}}