Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comments
Comment #1
David_Rothstein CreditAttribution: David_Rothstein commentedI 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.
Comment #2
pwolanin CreditAttribution: pwolanin commentedthanks committed to 7 and 6.x-3.x
Comment #3
theapi CreditAttribution: theapi commentedSeems to be also true for:
apachesolr_index_delete_index()
andapachesolr_index_delete_bundles()
Comment #4
pwolanin CreditAttribution: pwolanin commentedComment #5
pwolanin CreditAttribution: pwolanin commentedComment #6
pwolanin CreditAttribution: pwolanin commentedMake the success value consistent and add logging when this occurs.
Comment #7
Nick_vhLooks good - tested and approved. Committed to 7.x-1.x and needs backport now
Comment #8
Dane Powell CreditAttribution: Dane Powell commentedDo 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.
Comment #9
danielmrichards CreditAttribution: danielmrichards commentedI 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.
Comment #10
danielmrichards CreditAttribution: danielmrichards commentedI'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.
Comment #11
Dane Powell CreditAttribution: Dane Powell as a volunteer commented+1 to removing watchdog calls entirely.