If you unpublish or delete content, the Apache Solr module will contact the Solr server and delete the content from the index. This happens even on read-only environments, which are not supposed to affect the Solr server at all.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

David_Rothstein’s picture

Status: Active » Needs review
FileSize
556 bytes

I am not sure exactly the right place to fix this, but here is a patch that works.

There may be other places in the code that inappropriately write to the Solr index also.

pwolanin’s picture

Status: Needs review » Fixed

thanks committed to 7 and 6.x-3.x

theapi’s picture

Seems to be also true for:
apachesolr_index_delete_index() and apachesolr_index_delete_bundles()

pwolanin’s picture

Status: Fixed » Active
pwolanin’s picture

Status: Active » Needs review
FileSize
3.33 KB
pwolanin’s picture

FileSize
5.3 KB

Make the success value consistent and add logging when this occurs.

Nick_vh’s picture

Version: 7.x-1.x-dev » 6.x-3.x-dev
Status: Needs review » Patch (to be ported)

Looks good - tested and approved. Committed to 7.x-1.x and needs backport now

Dane Powell’s picture

Issue summary: View changes

Do we really want to be throwing warnings every time this occurs? This causes any site with the index set to read-only to generate prolific amounts of warnings, which is confusing and annoying- it makes it seem like something has gone wrong, when in fact everything is performing exactly as intended by the user.

danielmrichards’s picture

I agree with the point Dane raised. We run a Drupal commerce website and we are seeing huge amount of warnings in the logs containing "Trying to update the Solr index while the environment...".

I do still think we should react to an attempt to update the read only index, so the attached patch file changes the watchdog severity to notice instead of warning.

danielmrichards’s picture

I've been thinking since my previous comment and I can see a use case where having any kind of warning/notice thrown when updating a readonly index could be a problem.

Sites that perform large amounts of updates to a primary Solr index, but also have a readonly index connected, will very quickly create thousands of watchdog entries.

I've attached an alternative patch that removes the watchdog calls entirely.

Dane Powell’s picture

+1 to removing watchdog calls entirely.