We are currently experiencing problems indexing nodes periodically. Nodes are sometimes indexed with the wrong status, resulting in unpredictable results from searches.

We have a setup with multiple webservers, where one out-of-rotation server acts as our cron-server. The servers have a shared memcache server. I have narrowed our problem down to the memcache layer. It seems that when one process marks the item to be reindexed, the other process on the cron server can pick that up before the entry has been completely cleared from memcache, resulting in indexing outdated data.

The problem is fixed by resetting entities when loaded using entity_load in includes/datasource_entity.inc on line 84:

public function loadItems(array $ids) {
  $items = entity_load($this->entityType, $ids);

I propose making it configurable whether or not entity_load should include $reset = TRUE, to force loading nodes from database.

CommentFileSizeAuthor
#2 loaditems_for_entity-2631746-2.patch1.07 KBmian3010

Comments

mian3010 created an issue. See original summary.

mian3010’s picture

StatusFileSize
new1.07 KB

Attached patch with proposed solution.

I have just implemented the simple, variable_get solution for configuring it. Maybe it should be refined, to better suit Search API.

drunken monkey’s picture

Category: Bug report » Support request
Status: Active » Fixed

While this solution certainly isn't very intrusive, I doubt that this is a problem a lot of sites have, and thus worth including in the module.
Try instead overriding the datasource controller class to add that parameter to the entity_load() call. (The used datasource controller can easily be changed with hook_search_api_item_type_info_alter().)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.