acquia_search: Extra search environment creation

Created on 15 January 2023, almost 2 years ago
Updated 25 January 2023, almost 2 years ago

Problem/Motivation

There is acquia_search_apachesolr_create_server() function which creates an apachesolr server and is being called on every page request in acquia_search_init().

When I update acquia_connector module from 7.x-3.x to the 7.x-4.x version, then it could be a case during site deployment when acquia_search_init() is called before update hooks have been completed.
As a result, an additional search environment is created on an environment with already configured and running search.

There is a condition in acquia_search_apachesolr_create_server() function:
https://git.drupalcode.org/project/acquia_connector/-/blob/7.x-4.x/acqui...

    if (isset($environment['service_class']) && $environment['service_class'] == $service_class) {
      return;
    }

The root cause is that $environment['service_class'] is not equal to $service_class

Proposed resolution

Do not perform $environment['service_class'] == $service_class comparison and leave isset($environment['service_class'] only.

πŸ› Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

πŸ‡§πŸ‡ΎBelarus yurikulinkovich

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Needs review almost 2 years ago
  • Status changed to Needs work almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States japerry KVUO

    The problem with this approach is that it will not create an Acquia search server if any server exists. Can you debug what your service class was? My guess is we need to upgrade the service class from 3.x before trying to create a server.

  • @japerry opened merge request.
  • Status changed to Needs review almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States japerry KVUO

    I've opened up a slightly different approach to the original MR. We're reviewing internally but would love external review as well.

  • πŸ‡§πŸ‡ΎBelarus yurikulinkovich

    @japerry my service class was 'AcquiaSearchSolrService'
    I've checked MR!36, it works fine for me.
    Thanks.

  • Status changed to Fixed almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States japerry KVUO
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024