Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-13670

Better implementation of Update Greetings and Addresses needed

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Incomplete
    • Affects Version/s: 4.4.0
    • Fix Version/s: None
    • Component/s: Core CiviCRM
    • Labels:
      None
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      We experienced some problems with memory alloc errors on cron jobs. Turned out the problem is with Update Greetings and Addressees (Daily) cron job. It tries to assign all contacts detail into $params array at line 1044 in /var/www/html/pj.campaigntool.ca/sites/all/modules/civicrm/CRM/Utils/Token.php. Our database has about 116k contacts, so that caused issues.

      Pradeep consulted with Deepak and what came back was:
      This can be handled in two ways

      1. Using temp table for contact tokens.
      2. Using batch method to update greetings rather then update all contacts at one time.

      2nd seems to be very easy and time consuming, But 1st method will take time to implement and also very reliable / optimized solution.

      I think we should do a single bulk query that updates only those records that need it for each of the greetings and addresses. Here's a bit of pseudocode:

      for each greeting / address format to be processed
      $sql_field_fragment = 'CONCAT('
      for each possible field in this $format
      $sql_field_fragment .= replace the

      {table.fieldname}

      token in $format with "', IF(sqltablename.sqlfieldname IS NULL, '', sqltablename.sqlfieldname), '",
      endfor
      $sql_field_fragment .= ')'
      $sql = "UPDATE civicrm_table as sqltablename SET sqlfieldname = $sql_field_fragment WHERE field<>$sql_field_fragment;"
      endfor

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              joemurray Joe Murray
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: