当尝试重新索引catalog_product_flat时,我收到了未知错误

时间:2013-02-28 13:59:49

标签: magento

我正在尝试重新索引catalog_product_flat,我收到了这个错误:

Product Flat Data index process unknown error:
exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs' in /path/to/magento/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /path/to/magento/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /path/to/magento/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /path/to/magento/lib/Zend/Db/Statement.php(320): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /path/to/magento/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /path/to/magento/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('ALTER TABLE `ma...', Array)
#5 /path/to/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('ALTER TABLE `ma...', Array)
#6 /path/to/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(340): Varien_Db_Adapter_Pdo_Mysql->query('ALTER TABLE `ma...')
#7 /path/to/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(839): Varien_Db_Adapter_Pdo_Mysql->raw_query('ALTER TABLE `ma...')
#8 /path/to/magento/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(799): Varien_Db_Adapter_Pdo_Mysql->addColumn('mage_catalog_pr...', 'email_template', Array)
#9 /path/to/magento/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(1390): Mage_Catalog_Model_Resource_Product_Flat_Indexer->prepareFlatTable(1)
#10 /path/to/magento/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(296): Mage_Catalog_Model_Resource_Product_Flat_Indexer->reindexAll()
#11 /path/to/magento/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(336): Mage_Catalog_Model_Product_Flat_Indexer->reindexAll()
#12 /path/to/magento/app/code/core/Mage/Index/Model/Process.php(209): Mage_Catalog_Model_Product_Indexer_Flat->reindexAll()
#13 /path/to/magento/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()
#14 /path/to/magento/shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()
#15 /path/to/magento/shell/indexer.php(198): Mage_Shell_Compiler->run()
#16 {main}

对于从magento 1.3.4社区获取的数据,在magento enterprise 1.12上完成了Reindex。 从admin或shell索引器执行reindex时会发生这种情况。

3 个答案:

答案 0 :(得分:3)

好的,我发现解决方案我必须在方法_getFlatColumnsOldDefinition中的/path/to/magento/app/code/core/Mage/Eav/Model/Entity/Attribute/Abstract.php中更改此代码:

case 'varchar':
    $columns[$this->getAttributeCode()] = array(
        'type' => 'varchar(255)'

对此:

case 'varchar':
    $columns[$this->getAttributeCode()] = array(
        'type' => 'text'

答案 1 :(得分:1)

This answer解决了属性计数的根本问题,而无需借助模式或代码修改。

答案 2 :(得分:0)

magento以编程方式重新索引

ID代码

1 catalog_product_attribute

2 catalog_product_price

3 catalog_url

4 catalog_product_flat

5 catalog_category_flat

6 catalog_category_product

7 catalogsearch_stock

8 cataloginventory_stock

9 tag_summary

完成重新索引

for($ i = 1; $ i< = 9; $ i ++){

$ process = Mage :: getModel('index / process') - > load($ i);

$工序 - > reindexAll();

}  个人重新索引

$ process = Mage :: getModel('index / process') - > load(4);

$工序 - > reindexAll();