Problems with Magento Reindex (attributes) - mysql

I have problems with reindex Magento CMS after integrate some products.
here is the LOG from the shell reindex
/usr/home/sinusi/public_html/_duplicateshop/shell$ php indexer.php --status
Product Attributes index process unknown error:
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '32363-974-1-327' for key 'PRIMARY'' in /usr/www/users/sinusi/_duplicateshop/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /usr/www/users/sinusi/_duplicateshop/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /usr/www/users/sinusi/_duplicateshop/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /usr/www/users/sinusi/_duplicateshop/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /usr/www/users/sinusi/_duplicateshop/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#4 /usr/www/users/sinusi/_duplicateshop/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
#5 /usr/www/users/sinusi/_duplicateshop/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
#6 /usr/www/users/sinusi/_duplicateshop/lib/Varien/Db/Adapter/Pdo/Mysql.php(1998): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...', Array)
#7 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php(280): Varien_Db_Adapter_Pdo_Mysql->insertArray('catalog_product...', Array, Array)
#8 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php(261): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source->_saveIndexData(Array)
#9 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php(84): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source->_prepareMultiselectIndex(NULL, NULL)
#10 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php(50): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source->_prepareIndex()
#11 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav.php(185): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Abstract->reindexAll()
#12 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Mage_Catalog_Model_Resource_Product_Indexer_Eav->reindexAll()
#13 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Index/Model/Process.php(210): Mage_Index_Model_Indexer_Abstract->reindexAll()
#14 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Index/Model/Process.php(258): Mage_Index_Model_Process->reindexAll()
#15 /usr/www/users/sinusi/_duplicateshop/shell/indexer.php(166): Mage_Index_Model_Process->reindexEverything()
#16 /usr/www/users/sinusi/_duplicateshop/shell/indexer.php(212): Mage_Shell_Compiler->run()
#17 {main}
Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '32363-974-1-327' for key 'PRIMARY'' in /usr/www/users/sinusi/_duplicateshop/lib/Zend/Db/Statement/Pdo.php:234
Stack trace:
#0 /usr/www/users/sinusi/_duplicateshop/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /usr/www/users/sinusi/_duplicateshop/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /usr/www/users/sinusi/_duplicateshop/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /usr/www/users/sinusi/_duplicateshop/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
#4 /usr/www/users/sinusi/_duplicateshop/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
#5 /usr/www/users/sinusi/_duplicateshop/lib/Varien/Db/Adapter/Pdo/Mysql.php(1998): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...', Array)
#6 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php(280): Varien_Db_Adapter_Pdo_Mysql->insertArray('catalog_product...', Array, Array)
#7 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php(261): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source->_saveIndexData(Array)
#8 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Source.php(84): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source->_prepareMultiselectIndex(NULL, NULL)
#9 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php(50): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Source->_prepareIndex()
#10 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav.php(185): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Abstract->reindexAll()
#11 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Mage_Catalog_Model_Resource_Product_Indexer_Eav->reindexAll()
#12 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Index/Model/Process.php(210): Mage_Index_Model_Indexer_Abstract->reindexAll()
#13 /usr/www/users/sinusi/_duplicateshop/app/code/core/Mage/Index/Model/Process.php(258): Mage_Index_Model_Process->reindexAll()
#14 /usr/www/users/sinusi/_duplicateshop/shell/indexer.php(166): Mage_Index_Model_Process->reindexEverything()
#15 /usr/www/users/sinusi/_duplicateshop/shell/indexer.php(212): Mage_Shell_Compiler->run()
#16 {main}
I have truncated catalog_flats and deleted the lock files
but error is still the same

First, you can try to drop completely the flat tables as they will be recreated by the indexing process.
The fact that you reach a duplicate entry maybe means that an unique index have been removed from an origin table. Maybe a product attribute that must be unique as twice the same value in the database after human intervention straighly in the db.
If you can identify the field that is problematic, I can maybe extend my answer.

Try the solution provided in
http://www.magikcommerce.com/blog/how-to-resolve-magento-reindexing-errors-in-your-magento-store/#
Before run this method, Make sure to take the full back up of database.

Solved - there was a duplicate entry in attribute
sorry for my question and thanks for your input!

Related

Changing Magento database

I have installed magento 1.7 with the database name magento1.7 and now I want to replace this with current live dump with the name magento.
I have changed dbnames in local.xml and config.xml,cleared cache and other things in magento. But now I am getting the below error when i load my magento local.
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '921923' for key 'PRIMARY'
Trace:
#0 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `lo...', Array)
#4 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `lo...', Array)
#5 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `lo...', Array)
#6 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Log/Model/Resource/Visitor.php(174): Zend_Db_Adapter_Abstract->insert('log_visitor_inf...', Array)
#7 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Log/Model/Resource/Visitor.php(108): Mage_Log_Model_Resource_Visitor->_saveVisitorInfo(Object(Mage_Log_Model_Visitor))
#8 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(463): Mage_Log_Model_Resource_Visitor->_afterSave(Object(Mage_Log_Model_Visitor))
#9 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Log_Model_Visitor))
#10 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Log/Model/Visitor.php(167): Mage_Core_Model_Abstract->save()
#11 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/App.php(1338): Mage_Log_Model_Visitor->initByRequest(Object(Varien_Event_Observer))
#12 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Log_Model_Visitor), 'initByRequest', Object(Varien_Event_Observer))
#13 /Applications/XAMPP/xamppfiles/htdocs/magento/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#14 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(528): Mage::dispatchEvent('controller_acti...', Array)
#15 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Front/Action.php(64): Mage_Core_Controller_Varien_Action->preDispatch()
#16 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(408): Mage_Core_Controller_Front_Action->preDispatch()
#17 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#18 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#19 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#20 /Applications/XAMPP/xamppfiles/htdocs/magento/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#21 /Applications/XAMPP/xamppfiles/htdocs/magento/index.php(87): Mage::run('', 'store')
I searched in the log tables for the value "921923" but couldn't able to find any match. Can someone help/guide me to resolve this issue?
SET FOREIGN_KEY_CHECKS=0;
this then import and delete all value in log_visitor_inf.. tables then its run your website. Delete this folder var then check the website.

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY', query was: INSERT INTO `log_visitor`

I have installed Magento 1.9.1 But now following error message appears when try enter to magento, before this error works correctly my site but now not know whats happend i hope can help me thanks!.
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY', query was: INSERT INTO `log_visitor` (`session_id`, `first_visit_at`, `last_visit_at`, `last_url_id`, `store_id`) VALUES (?, ?, ?, ?, ?)
Trace:
#0 /home/chikatrendy/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/chikatrendy/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/chikatrendy/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/chikatrendy/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `lo...', Array)
#4 /home/chikatrendy/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `lo...', Array)
#5 /home/chikatrendy/public_html/lib/Zend/Db/Adapter/Abstract.php(576): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `lo...', Array)
#6 /home/chikatrendy/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('log_visitor', Array)
#7 /home/chikatrendy/public_html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Log_Model_Visitor))
#8 /home/chikatrendy/public_html/app/code/core/Mage/Log/Model/Visitor.php(168): Mage_Core_Model_Abstract->save()
#9 /home/chikatrendy/public_html/app/code/core/Mage/Core/Model/App.php(1338): Mage_Log_Model_Visitor->initByRequest(Object(Varien_Event_Observer))
#10 /home/chikatrendy/public_html/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Log_Model_Visitor), 'initByRequest', Object(Varien_Event_Observer))
#11 /home/chikatrendy/public_html/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#12 /home/chikatrendy/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(527): Mage::dispatchEvent('controller_acti...', Array)
#13 /home/chikatrendy/public_html/app/code/core/Mage/Core/Controller/Front/Action.php(64): Mage_Core_Controller_Varien_Action->preDispatch()
#14 /home/chikatrendy/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(407): Mage_Core_Controller_Front_Action->preDispatch()
#15 /home/chikatrendy/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#16 /home/chikatrendy/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#17 /home/chikatrendy/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#18 /home/chikatrendy/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#19 /home/chikatrendy/public_html/index.php(87): Mage::run('', 'store')
#20 {main}
I have read a lot of threads and also used Google but could not find a solution. I am a beginner and the shop should work tomorrow again :-( I very much appreciate your help!
Thanks a lot for your help & best regards
Try adding the below line to
SET foreign_key_checks=0;
at the beginning of the .sql backup file and the below line at the end.
SET foreign_key_checks=1;
Hope it works.

SQLSTATE[23000] & UNQ_INDEX_PROCESS_INDEXER_CODE

a few time per day i get the following error (as listed in the reports)
a:5:{i:0;s:124:"SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'catalog_url' for key 'UNQ_INDEX_PROCESS_INDEXER_CODE'";i:1;s:1900:"#0 /path-to-magento/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /path-to-magento/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /path-to-magento/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /path-to-magento/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `in...', Array)
#4 /path-to-magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `in...', Array)
#5 /path-to-magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(1998): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `in...', Array)
#6 /path-to-magento/app/code/core/Mage/Index/Model/Resource/Setup.php(82): Varien_Db_Adapter_Pdo_Mysql->insertArray('index_process', Array, Array)
#7 /path-to-magento/app/code/core/Mage/Index/Model/Resource/Setup.php(45): Mage_Index_Model_Resource_Setup->_syncIndexes()
#8 /path-to-magento/app/code/core/Mage/Core/Model/Resource/Setup.php(235): Mage_Index_Model_Resource_Setup->applyUpdates()
#9 /path-to-magento/app/code/core/Mage/Core/Model/App.php(417): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#10 /path-to-magento/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
#11 /path-to-magento/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#12 /path-to-magento/index.php(89): Mage::run('', 'store')
#13 {main}";s:3:"url";s:98:"/accessoires/peuter_80_98.html";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}
I have magento 1.8.1 CE.
Does anyone know what is wrong?
The problem was found in the index_process table.
The flat_catalog index was disabled but needed reindexing.
Which wasn't shown in the index module of magento

magento 1.7.0.2 SQLSTATE[HY000]: General error: 1005 Can't create table 'irtto.catalog_product_flat_5'

I manually refresh the index Product_Flat_Data, but it doesn't succeed. I get the following exceptions:
[root#www shell]# /www/wdlinux/php/bin/php -f indexer.php -- -reindex catalog_product_flat
Product Flat Data index process unknown error:
exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1005 Can't create table 'irtto.catalog_product_flat_5' (errno: 150)' in /home/www/irtto/public_html/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/www/irtto/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/www/irtto/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/www/irtto/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/www/irtto/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /home/www/irtto/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('CREATE TABLE `c...', Array)
#5 /home/www/irtto/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('CREATE TABLE `c...', Array)
#6 /home/www/irtto/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(2039): Varien_Db_Adapter_Pdo_Mysql->query('CREATE TABLE `c...')
#7 /home/www/irtto/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(702): Varien_Db_Adapter_Pdo_Mysql->createTable(Object(Varien_Db_Ddl_Table))
#8 /home/www/irtto/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(1390): Mage_Catalog_Model_Resource_Product_Flat_Indexer->prepareFlatTable(5)
#9 /home/www/irtto/public_html/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(296): Mage_Catalog_Model_Resource_Product_Flat_Indexer->reindexAll()
#10 /home/www/irtto/public_html/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(336): Mage_Catalog_Model_Product_Flat_Indexer->reindexAll()
#11 /home/www/irtto/public_html/app/code/core/Mage/Index/Model/Process.php(209): Mage_Catalog_Model_Product_Indexer_Flat->reindexAll()
#12 /home/www/irtto/public_html/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()
#13 /home/www/irtto/public_html/shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()
#14 /home/www/irtto/public_html/shell/indexer.php(198): Mage_Shell_Compiler->run()
#15 {main}
Next exception
'Zend_Db_Statement_Exception' with message 'SQLSTATE[HY000]: General error: 1005 Can't create table 'irtto.catalog_product_flat_5' (errno: 150)' in /home/www/irtto/public_html/lib/Zend/Db/Statement/Pdo.php:234
Stack trace:
#0 /home/www/irtto/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/www/irtto/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/www/irtto/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/www/irtto/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('CREATE TABLE `c...', Array)
#4 /home/www/irtto/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('CREATE TABLE `c...', Array)
#5 /home/www/irtto/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(2039): Varien_Db_Adapter_Pdo_Mysql->query('CREATE TABLE `c...')
#6 /home/www/irtto/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(702): Varien_Db_Adapter_Pdo_Mysql->createTable(Object(Varien_Db_Ddl_Table))
#7 /home/www/irtto/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(1390): Mage_Catalog_Model_Resource_Product_Flat_Indexer->prepareFlatTable(5)
#8 /home/www/irtto/public_html/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(296): Mage_Catalog_Model_Resource_Product_Flat_Indexer->reindexAll()
#9 /home/www/irtto/public_html/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(336): Mage_Catalog_Model_Product_Flat_Indexer->reindexAll()
#10 /home/www/irtto/public_html/app/code/core/Mage/Index/Model/Process.php(209): Mage_Catalog_Model_Product_Indexer_Flat->reindexAll()
#11 /home/www/irtto/public_html/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()
#12 /home/www/irtto/public_html/shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()
#13 /home/www/irtto/public_html/shell/indexer.php(198): Mage_Shell_Compiler->run()
#14 {main}
The mysql user you have used in indexer.php (/www/wdlinux/php/bin/php -f indexer.php) do not have write privileges to database. Give that user write privileges.

Magento site down due to mysql error General error: 1030 Got error -1 from storage engine

I even deleted all records from log_visitor table, still getting the same issue. Following is the stack I am getting.
SQLSTATE[HY000]: General error: 1030 Got error -1 from storage engine
#0 /home/site/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/site/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/site/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /home/site/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `lo...', Array)
#4 /home/site/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `lo...', Array)
#5 /home/site/public_html/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `lo...', Array)
#6 /home/site/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(453): Zend_Db_Adapter_Abstract->insert('log_visitor', Array)
#7 /home/site/public_html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Log_Model_Visitor))
#8 /home/site/public_html/app/code/core/Mage/Log/Model/Visitor.php(167): Mage_Core_Model_Abstract->save()
#9 /home/site/public_html/app/code/core/Mage/Core/Model/App.php(1338): Mage_Log_Model_Visitor->initByRequest(Object(Varien_Event_Observer))
#10 /home/site/public_html/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Log_Model_Visitor), 'initByRequest', Object(Varien_Event_Observer))
#11 /home/site/public_html/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#12 /home/site/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(528): Mage::dispatchEvent('controller_acti...', Array)
#13 /home/site/public_html/app/code/core/Mage/Core/Controller/Front/Action.php(64): Mage_Core_Controller_Varien_Action->preDispatch()
#14 /home/site/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(408): Mage_Core_Controller_Front_Action->preDispatch()
#15 /home/site/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#16 /home/site/public_html/app/code/local/SM/Vendors/Controller/Router/Vendor.php(76): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#17 /home/site/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): SM_Vendors_Controller_Router_Vendor->match(Object(Mage_Core_Controller_Request_Http))
#18 /home/site/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#19 /home/site/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#20 /home/site/public_html/index.php(87): Mage::run('', 'store')
#21 {main}
Fatal error: Exception thrown without a stack frame in Unknown on line 0
This is a live site, I need make it live as soon as possible. Please help.
This is a general error that happens when InnoDB cannot write to its data files.
I've seen reports of this when the disk is full, or if permissions on the files changed so you can't write to them.
Another report was when someone enabled innodb_force_recovery to a value greater than 0, not realizing that in recovery modes >0, InnoDB is effectively read-only.
I hope this helps.
try deleting the folders var/cache and var/session it works for me