Magento – How to solve indexer status “suspended” (n in backlog)

indexingmagento2magento2.2

One of the indexers that are configured to be updated on schedule is locked in the state "suspended" and does not get updated anymore.

Output of bin/magento indexer:status

+----------------------------+------------------+-----------+-------------------------------+---------------------+
| Title                      | Status           | Update On | Schedule Status               | Schedule Updated    |
+----------------------------+------------------+-----------+-------------------------------+---------------------+
| ...                        |                  |           |                               |                     |
| IntegerNet_Solr            | Reindex required | Schedule  | suspended (101028 in backlog) | 2018-09-24 15:28:44 |
| ...                        |                  |           |                               |                     |
+----------------------------+------------------+-----------+-------------------------------+---------------------+

Others show idle (0 in backlog) and the current time in the "Schedule Updated" column, so the indexer schedule is generally working.

How can I solve this?

Best Answer

I found out, that the status is set in \Magento\Framework\Mview\View::suspend() and removed in \Magento\Framework\Mview\View::resume().

These methods are only called in \Magento\Indexer\Model\Indexer::reindexAll() to suspend the scheduled indexing before a forced full reindexing and to resume it afterwards or if an exception occurs.

But if the process is terminated without exception, e.g. killed, segfaulted or even runs into a non-recoverable fatal error, the status stays "suspended" and there are no means to resume it.

Solution: make sure, there really is no full reindex running, then update the status via SQL.

You'll find all the statuses with:

select * from mview_state;

and update it like this:

update mview_state set status='idle' where view_id='integernet_solr';