If there is an intermittent failure to connect (or when using master/slave replication and the master is down) we have a bug since on cron we clear the cached luke data prior to being sure we have refilled it fmor the server. It would be better not to clear it if new data was not fetched.

Comments

pwolanin’s picture

Status: Active » Needs review
StatusFileSize
new4.43 KB

Here's code borrowed from #368245: implement optional caching of query results which should have the desired effect as far as this issue but doesn't cache any query results.

The reason this should work is that the cache is only cleared if an update of some sort succeeds - this will only happen if the master is available. While it's possible there will be a race condition between cron runs, this reduces them.

pwolanin’s picture

StatusFileSize
new6.87 KB

better

pwolanin’s picture

StatusFileSize
new7.83 KB

missed an update in apachesolr_search - refactor to a helper function rather than explicitly using the variable.

JacobSingh’s picture

Looks good, will apply and test

pwolanin’s picture

I think we should variable_set() time() or 0 instead of TRUE/FALSE

Then we can add code to not clear set the flag back to 0 cache unless the elapsed time is > the autocommit time (or some reasaonble default?).

Otherwise, a site running cron faster than the autocommit interval will cache stale results.

JacobSingh’s picture

Man, this triggered a huge run-around today unrelated to the actual patch (which seems to work okay).

I think this is good to go.

I'm not too worried about #5, but I suppose it would be an improvement. I think that even trying to clear and re-fill every cron run is not that bad. Perhaps only refreshing when there is an update, while nice, is not needed?

-J

pwolanin’s picture

StatusFileSize
new8.32 KB
pwolanin’s picture

Status: Needs review » Fixed
StatusFileSize
new8.29 KB

minor change to >=

committing to 6.x

pwolanin’s picture

Status: Fixed » Closed (fixed)