magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.51k stars 9.31k forks source link

2.1.0 EE installation fails #5213

Closed mvillard closed 8 years ago

mvillard commented 8 years ago

Steps to reproduce

Install Magento EE 2.1.0 with sample data from downloaded ZIP file - Windows 10 - Wamp PHP 5.6.16

Apache 2.4.17

Error is step 6 Completion 51 %:

Module 'Magento_Cms': Installing data... [ERROR] exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (ee210.cms_page, CONSTRAINT CMS_PAGE_PAGE_ID_SEQUENCE_CMS_PAGE_SEQUENCE_VALUE FOREIGN KEY (page_id) REFERENCES sequence_cms_page (sequence_value) ON DELETE CASCADE)' in C:\wamp64\www\ee210.localhost.com\vendor\magento\zendframework1\library\Zend\Db\Statement\Pdo.php:228 Stack trace: #0 C:\wamp64\www\ee210.localhost.com\vendor\magento\zendframework1\library\Zend\Db\Statement\Pdo.php(228): PDOStatement->execute(Array) #1 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\DB\Statement\Pdo\Mysql.php(95): Zend_Db_Statement_Pdo->_execute(Array) #2 C:\wamp64\www\ee210.localhost.com\vendor\magento\zendframework1\library\Zend\Db\Statement.php(303): Magento\Framework\DB\Statement\Pdo\Mysql->_execute(Array) #3 C:\wamp64\www\ee210.localhost.com\vendor\magento\zendframework1\library\Zend\Db\Adapter\Abstract.php(480): Zend_Db_Statement->execute(Array) #4 C:\wamp64\www\ee210.localhost.com\vendor\magento\zendframework1\library\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO cm...', Array) #5 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\DB\Adapter\Pdo\Mysql.php(452): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTOcm...', Array) #6 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\DB\Adapter\Pdo\Mysql.php(507): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('INSERT INTO cm...', Array) #7 C:\wamp64\www\ee210.localhost.com\vendor\magento\zendframework1\library\Zend\Db\Adapter\Abstract.php(576): Magento\Framework\DB\Adapter\Pdo\Mysql->query('INSERT INTOcm...', Array) #8 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\EntityManager\Db\CreateRow.php(80): Zend_Db_Adapter_Abstract->insert('cms_page', Array) #9 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\EntityManager\Operation\Create\CreateMain.php(57): Magento\Framework\EntityManager\Db\CreateRow->execute('Magento\Cms\Api...', Array) #10 C:\wamp64\www\ee210.localhost.com\vendor\magento\module-staging\Model\Operation\Create.php(134): Magento\Framework\EntityManager\Operation\Create\CreateMain->execute(Object(Magento\Cms\Model\Page), Array) #11 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\EntityManager\EntityManager.php(87): Magento\Staging\Model\Operation\Create->execute(Object(Magento\Cms\Model\Page), Array) #12 C:\wamp64\www\ee210.localhost.com\vendor\magento\module-cms\Model\ResourceModel\Page.php(397): Magento\Framework\EntityManager\EntityManager->save(Object(Magento\Cms\Model\Page)) #13 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\Interception\Interceptor.php(74): Magento\Cms\Model\ResourceModel\Page->save(Object(Magento\Cms\Model\Page)) #14 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\Interception\Chain\Chain.php(70): Magento\Cms\Model\ResourceModel\Page\Interceptor->_callParent('save', Array) #15 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\Interception\Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Cms\Mod...', 'save', Object(Magento\Cms\Model\ResourceModel\Page\Interceptor), Array, 'clean_cache') #16 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\App\Cache\FlushCacheByTags.php(60): Magento\Cms\Model\ResourceModel\Page\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Cms\Model\Page)) #17 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\Interception\Interceptor.php(142): Magento\Framework\App\Cache\FlushCacheByTags->aroundSave(Object(Magento\Cms\Model\ResourceModel\Page\Interceptor), Object(Closure), Object(Magento\Cms\Model\Page)) #18 C:\wamp64\www\ee210.localhost.com\var\generation\Magento\Cms\Model\ResourceModel\Page\Interceptor.php(143): Magento\Cms\Model\ResourceModel\Page\Interceptor->___callPlugins('save', Array, Array) #19 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\Model\AbstractModel.php(631): Magento\Cms\Model\ResourceModel\Page\Interceptor->save(Object(Magento\Cms\Model\Page)) #20 C:\wamp64\www\ee210.localhost.com\vendor\magento\module-cms\Setup\InstallData.php(102): Magento\Framework\Model\AbstractModel->save() #21 C:\wamp64\www\ee210.localhost.com\setup\src\Magento\Setup\Model\Installer.php(843): Magento\Cms\Setup\InstallData->install(Object(Magento\Setup\Module\DataSetup), Object(Magento\Setup\Model\ModuleContext)) #22 C:\wamp64\www\ee210.localhost.com\setup\src\Magento\Setup\Model\Installer.php(795): Magento\Setup\Model\Installer->handleDBSchemaData(Object(Magento\Setup\Module\DataSetup), 'data') #23 [internal function]: Magento\Setup\Model\Installer->installDataFixtures() #24 C:\wamp64\www\ee210.localhost.com\setup\src\Magento\Setup\Model\Installer.php(344): call_user_func_array(Array, Array) #25 C:\wamp64\www\ee210.localhost.com\setup\src\Magento\Setup\Controller\Install.php(109): Magento\Setup\Model\Installer->install(Array) #26 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-mvc\src\Controller\AbstractActionController.php(82): Magento\Setup\Controller\Install->startAction() #27 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent)) #28 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-eventmanager\src\EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent)) #29 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-eventmanager\src\EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) #30 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-mvc\src\Controller\AbstractController.php(118): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) #31 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-mvc\src\DispatchListener.php(93): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response)) #32 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent)) #33 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-eventmanager\src\EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent)) #34 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-eventmanager\src\EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) #35 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-mvc\src\Application.php(314): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) #36 C:\wamp64\www\ee210.localhost.com\setup\index.php(31): Zend\Mvc\Application->run() #37 {main} Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (ee210.cms_page, CONSTRAINT CMS_PAGE_PAGE_ID_SEQUENCE_CMS_PAGE_SEQUENCE_VALUE FOREIGN KEY (page_id) REFERENCES sequence_cms_page (sequence_value) ON DELETE CASCADE), query was: INSERT INTO cms_page (row_id, page_id, created_in, updated_in, title, page_layout, meta_keywords, meta_description, identifier, content_heading, content, is_active, sort_order, layout_update_xml, custom_theme, custom_root_template, custom_layout_update_xml, custom_theme_from, custom_theme_to, meta_title) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' in C:\wamp64\www\ee210.localhost.com\vendor\magento\zendframework1\library\Zend\Db\Statement\Pdo.php:235 Stack trace: #0 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\DB\Statement\Pdo\Mysql.php(95): Zend_Db_Statement_Pdo->_execute(Array) #1 C:\wamp64\www\ee210.localhost.com\vendor\magento\zendframework1\library\Zend\Db\Statement.php(303): Magento\Framework\DB\Statement\Pdo\Mysql->_execute(Array) #2 C:\wamp64\www\ee210.localhost.com\vendor\magento\zendframework1\library\Zend\Db\Adapter\Abstract.php(480): Zend_Db_Statement->execute(Array) #3 C:\wamp64\www\ee210.localhost.com\vendor\magento\zendframework1\library\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO cm...', Array) #4 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\DB\Adapter\Pdo\Mysql.php(452): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTOcm...', Array) #5 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\DB\Adapter\Pdo\Mysql.php(507): Magento\Framework\DB\Adapter\Pdo\Mysql->_query('INSERT INTO cm...', Array) #6 C:\wamp64\www\ee210.localhost.com\vendor\magento\zendframework1\library\Zend\Db\Adapter\Abstract.php(576): Magento\Framework\DB\Adapter\Pdo\Mysql->query('INSERT INTOcm...', Array) #7 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\EntityManager\Db\CreateRow.php(80): Zend_Db_Adapter_Abstract->insert('cmspage', Array) #8 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\EntityManager\Operation\Create\CreateMain.php(57): Magento\Framework\EntityManager\Db\CreateRow->execute('Magento\Cms\Api...', Array) #9 C:\wamp64\www\ee210.localhost.com\vendor\magento\module-staging\Model\Operation\Create.php(134): Magento\Framework\EntityManager\Operation\Create\CreateMain->execute(Object(Magento\Cms\Model\Page), Array) #10 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\EntityManager\EntityManager.php(87): Magento\Staging\Model\Operation\Create->execute(Object(Magento\Cms\Model\Page), Array) #11 C:\wamp64\www\ee210.localhost.com\vendor\magento\module-cms\Model\ResourceModel\Page.php(397): Magento\Framework\EntityManager\EntityManager->save(Object(Magento\Cms\Model\Page)) #12 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\Interception\Interceptor.php(74): Magento\Cms\Model\ResourceModel\Page->save(Object(Magento\Cms\Model\Page)) #13 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\Interception\Chain\Chain.php(70): Magento\Cms\Model\ResourceModel\Page\Interceptor->callParent('save', Array) #14 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\Interception\Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Cms\Mod...', 'save', Object(Magento\Cms\Model\ResourceModel\Page\Interceptor), Array, 'clean_cache') #15 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\App\Cache\FlushCacheByTags.php(60): Magento\Cms\Model\ResourceModel\Page\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Cms\Model\Page)) #16 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\Interception\Interceptor.php(142): Magento\Framework\App\Cache\FlushCacheByTags->aroundSave(Object(Magento\Cms\Model\ResourceModel\Page\Interceptor), Object(Closure), Object(Magento\Cms\Model\Page)) #17 C:\wamp64\www\ee210.localhost.com\var\generation\Magento\Cms\Model\ResourceModel\Page\Interceptor.php(143): Magento\Cms\Model\ResourceModel\Page\Interceptor->___callPlugins('save', Array, Array) #18 C:\wamp64\www\ee210.localhost.com\vendor\magento\framework\Model\AbstractModel.php(631): Magento\Cms\Model\ResourceModel\Page\Interceptor->save(Object(Magento\Cms\Model\Page)) #19 C:\wamp64\www\ee210.localhost.com\vendor\magento\module-cms\Setup\InstallData.php(102): Magento\Framework\Model\AbstractModel->save() #20 C:\wamp64\www\ee210.localhost.com\setup\src\Magento\Setup\Model\Installer.php(843): Magento\Cms\Setup\InstallData->install(Object(Magento\Setup\Module\DataSetup), Object(Magento\Setup\Model\ModuleContext)) #21 C:\wamp64\www\ee210.localhost.com\setup\src\Magento\Setup\Model\Installer.php(795): Magento\Setup\Model\Installer->handleDBSchemaData(Object(Magento\Setup\Module\DataSetup), 'data') #22 [internal function]: Magento\Setup\Model\Installer->installDataFixtures() #23 C:\wamp64\www\ee210.localhost.com\setup\src\Magento\Setup\Model\Installer.php(344): call_user_func_array(Array, Array) #24 C:\wamp64\www\ee210.localhost.com\setup\src\Magento\Setup\Controller\Install.php(109): Magento\Setup\Model\Installer->install(Array) #25 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-mvc\src\Controller\AbstractActionController.php(82): Magento\Setup\Controller\Install->startAction() #26 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent)) #27 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-eventmanager\src\EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent)) #28 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-eventmanager\src\EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) #29 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-mvc\src\Controller\AbstractController.php(118): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) #30 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-mvc\src\DispatchListener.php(93): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response)) #31 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent)) #32 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-eventmanager\src\EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent)) #33 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-eventmanager\src\EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) #34 C:\wamp64\www\ee210.localhost.com\vendor\zendframework\zend-mvc\src\Application.php(314): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure)) #35 C:\wamp64\www\ee210.localhost.com\setup\index.php(31): Zend\Mvc\Application->run() #36 {main}

wert2all commented 8 years ago

Please report this issue in partner portal.

katmoon commented 8 years ago

Does anybody know how to fix this issue? I also experience it.

katmoon commented 8 years ago

$ mysql -u root -e "SET GLOBAL FOREIGN_KEY_CHECKS=0; fixes it

navarr commented 8 years ago

@katmoon That's a workaround - but not a solution. We also had this issue and have a ticket in partner portal.

katmoon commented 8 years ago

There is internal ticket MAGETWO-55201 to fix this issue.

dchaykas commented 7 years ago

Any update on this issue? Still getting it while installing today.

IgorVitol commented 7 years ago

Hi! Tried to install Magento 2.1.2 EE and had the same issue. Spent few hours on debugging this - by some reason all "sequence_" tables was created with "MyISAM" engine - http://prntscr.com/db1ret

Workaround for now:

  1. Wait until error occurs. Do not close install window.
  2. Go and change engine to InnoDB for all "sequence_" tables.
  3. Empty/truncate (or just delete all records) from theese tables.
  4. Click - "Try again" in install window.
dchaykas commented 7 years ago

Interesting, I did the workaround of turning foreign key check off and then on again. They should really fix the issue.

navarr commented 7 years ago

We've done the foreign key check but down the road had foreign key issues.

That workaround should not be used

IgorVitol commented 7 years ago

I did the workaround of turning foreign key check off and then on again. They should really fix the issue.

This will solve installation issues. But I beleive that if you will re-enable foreign key checks after install, you will be unable to add any entities (products, categories, e.t.c.).

That's because sequence tables has MyISAM engine, which didn't support foreign keys. Correct fix for that issue would be to set InnoDB engine while creating these tables.

navarr commented 7 years ago

This issue unbelievably still exists in Magento 2.1.4 EE

I've recreated it in MySQL 5.6.35

navarr commented 7 years ago

For those still subscribed to this issue, we may have found the culprit.

We did three things: upgrade to MySQL 5.7 (unlikely to be necessary)

Updated the MySQL open_files_limit configuration. The default for us was 5,000 and our hosting provider upped it all the way to 65,535. If you're having issues with this, I'd recommend seeing if doubling open_files_limit results in success.

If that doesn't work, the other thing that our provider did is changed our max_allowed_packet to "32M".

IgorVitol commented 7 years ago

This issue related to: Magento\Framework\DB\Ddl\Sequence::getCreateSequenceDdl

As you can see, sql statement for CREATE TABLE is without specified InnoDB engine, which is required for foreign keys. On most Windows mysql servers, it is set to MyISAM by default, so tables will be created incorectly and is the reason for such error. Adding engine to this statement fixed my issue and Magento EE installed without any issues.

csned commented 7 years ago

I've resolved this issue. I'll merge in the fix, which is to ensure that calls to save() come after startSetup(), which disabled FK checks.