什么时候自动部分重建索引实际在Magento EE 1.13中运行? [英] When does automatic partial reindexing actually run in Magento EE 1.13?

查看:179
本文介绍了什么时候自动部分重建索引实际在Magento EE 1.13中运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Magento 1.13为大多数索引添加了部分索引,并且能够将索引过程推迟到异步运行的cron作业。

Magento 1.13 added partial indexing for most indexes along with the ability to defer the indexing process to a cron job that runs asynchronously.

我的问题是,是否存在执行此操作的现有cron作业,或者这是我必须自行设置的内容?

My question then is, is there an existing cron job that does this or is this something I have to set up myself?

文档不清楚:
http://www.magentocommerce.com/knowledge-base/entry/ee113-indexing#reindex-options



  • 按计划更新以使用您的Magento cron作业安排重建索引。

  • 更改发生在一分钟内或者根据你的cron工作时间表。

  • Update when scheduled to schedule reindexing using your Magento cron job.
  • The change occurs either within the minute or according to your cron job schedule.

这让我相信它是一个运行的现有流程每次cron运行时。

This leads me to believe it's an existing process that runs every time the cron runs.

我看到索引清理程序,但只显示清除更改日志表中的旧记录。它实际上似乎没有做任何索引。

I see the index cleaner schedule, but that only appears to clear out old records in the change log tables. It does not seem to actually do any indexing.

我似乎无法在运行这些索引的核心代码中找到一个cron作业。

I can't seem to find a cron job in core code that runs these indexes.

推荐答案

我想我找到了它。 enterprise_refresh_index

I think I found it. enterprise_refresh_index

<enterprise_refresh_index>
    <schedule>
        <cron_expr>always</cron_expr>
    </schedule>
    <run>
        <model>enterprise_index/observer::refreshIndex</model>
    </run>
</enterprise_refresh_index>







public function refreshIndex(Mage_Cron_Model_Schedule $schedule)
{
    /** @var $helper Enterprise_Index_Helper_Data */
    $helper = Mage::helper('enterprise_index');

    /** @var $lock Enterprise_Index_Model_Lock */
    $lock   = Enterprise_Index_Model_Lock::getInstance();

    if ($lock->setLock(self::REINDEX_FULL_LOCK)) {

        /**
         * Workaround for fatals and memory crashes: Invalidating indexers that are in progress
         * Successful lock setting is considered that no other full reindex processes are running
         */
        $this->_invalidateInProgressIndexers();

        $client = Mage::getModel('enterprise_mview/client');
        try {

            //full re-index
            $inactiveIndexes = $this->_getInactiveIndexersByPriority();
            $rebuiltIndexes = array();
            foreach ($inactiveIndexes as $inactiveIndexer) {
                $tableName  = (string)$inactiveIndexer->index_table;
                $actionName = (string)$inactiveIndexer->action_model->all;
                $client->init($tableName);
                if ($actionName) {
                    $client->execute($actionName);
                    $rebuiltIndexes[] = $tableName;
                }
            }

            //re-index by changelog
            $indexers = $helper->getIndexers(true);
            foreach ($indexers as $indexerName => $indexerData) {
                $indexTable = (string)$indexerData->index_table;
                $actionName = (string)$indexerData->action_model->changelog;
                $client->init($indexTable);
                if (isset($actionName) && !in_array($indexTable, $rebuiltIndexes)) {
                    $client->execute($actionName);
                }
            }

        } catch (Exception $e) {
            $lock->releaseLock(self::REINDEX_FULL_LOCK);
            throw $e;
        }

        $lock->releaseLock(self::REINDEX_FULL_LOCK);
    }

    return $this;
}

每次执行cron都会始终运行。它为需要的索引运行完全重新索引,并为那些不需要的索引处理更改日志。

This runs "always" on every cron execution. It runs full reindexes for the indexes that need and and processes the changelog for those that don't.

这篇关于什么时候自动部分重建索引实际在Magento EE 1.13中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆