CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Custom Field Group logs missing - help!!!
Pages: [1] 2

Author Topic: Custom Field Group logs missing - help!!!  (Read 1725 times)

JohnFF

  • I post frequently
  • ***
  • Posts: 235
  • Karma: 6
  • CiviCRM version: 4.4.13
  • CMS version: Drupal 7.28
  • MySQL version: 5.5.31-1
  • PHP version: 5.3.27
Custom Field Group logs missing - help!!!
November 14, 2014, 08:41:01 am
This is really worrying - it seems that for custom field groups we're missing some entries, even at the more recent end. Has anyone encountered this before?

mysql> select count(distinct(entity_id)) from log_civicrm_value_contact_reference_9;
+----------------------------+
| count(distinct(entity_id)) |
+----------------------------+
|                      70071 |
+----------------------------+
1 row in set (0.25 sec)

mysql> select count(distinct(entity_id)) from civicrm_value_contact_reference_9;
+----------------------------+
| count(distinct(entity_id)) |
+----------------------------+
|                      99997 |
+----------------------------+
1 row in set (0.44 sec)

mysql> select min(entity_id) from civicrm_value_contact_reference_9;
+----------------+
| min(entity_id) |
+----------------+
|           3881 |
+----------------+
1 row in set (0.00 sec)

mysql> select min(entity_id) from log_civicrm_value_contact_reference_9;
+----------------+
| min(entity_id) |
+----------------+
|           3881 |
+----------------+
1 row in set (0.00 sec)

mysql> select max(entity_id) from log_civicrm_value_contact_reference_9;
+----------------+
| max(entity_id) |
+----------------+
|         128791 |
+----------------+
1 row in set (0.17 sec)

mysql> select max(entity_id) from civicrm_value_contact_reference_9;
+----------------+
| max(entity_id) |
+----------------+
|         129328 |
+----------------+
1 row in set (0.00 sec)

If you like empowering charities in a free and open way, then you're going to love Civi.

Email Amender: https://civicrm.org/extensions/email-amender
UK Phone Validator: https://civicrm.org/extensions/uk-phone-number-validator
http://civifirst.com
https://twitter.com/civifirst

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Custom Field Group logs missing - help!!!
November 14, 2014, 01:35:22 pm
No, haven't heard of that happening before. General thoughts/questions:

1) Do you see similar patterns with any other custom-data -- or is it just this one group?

2) Is that a single-value group (where entity_id is unique) or multi-value group (where entity_id is not unique)?

3) You might check the logs (Civi+Drupal+PHP+Apache -- as far back as you can go) to see if there's any reference to triggers, transactions, rollbacks, deadlocks, or constraints. As a general SQL matter, those types of things may be involved in integrity issues.

4) Could this be explained if we hypothesized some missing step in the lifecycle -- e.g. if the log layer didn't make records during a CREATE - or during an UPDATE?

5) It might be interesting to see a bit more of the distribution -- e.g. are the discrepancies distributed evenly across the ID space, or do they do appear in spurts?

Code: [Select]
SELECT distinct(v.entity_id)
FROM civicrm_value_contact_reference_9 v
LEFT JOIN log_civicrm_value_contact_reference_9 l on l.entity_id = v.entity_id
WHERE l.id IS NULL

JohnFF

  • I post frequently
  • ***
  • Posts: 235
  • Karma: 6
  • CiviCRM version: 4.4.13
  • CMS version: Drupal 7.28
  • MySQL version: 5.5.31-1
  • PHP version: 5.3.27
Re: Custom Field Group logs missing - help!!!
November 17, 2014, 04:37:23 am
Hi Totten,

Many thanks for your response. We're working on getting you those answers now.

It ranges from 0.31% - 100% of logs missing for a given custom values table.

We have an extension (https://civicrm.org/extensions/do-not-contact-until) that drops and then readds triggers. Could that be causing/impacting this? The tables involved in that have a seemingly high number of missing logs.

I've attached a spreadsheet indicating which tables are experiencing the most missing entries. We have even more custom tables than are here - 39 more - one for each school with custom questions.

J
If you like empowering charities in a free and open way, then you're going to love Civi.

Email Amender: https://civicrm.org/extensions/email-amender
UK Phone Validator: https://civicrm.org/extensions/uk-phone-number-validator
http://civifirst.com
https://twitter.com/civifirst

DaveFF

  • I post occasionally
  • **
  • Posts: 54
  • Karma: 5
  • Developer at Future First
    • Future First
  • CiviCRM version: 4.4.13
  • CMS version: Drupal 7.34
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom Field Group logs missing - help!!!
November 17, 2014, 07:39:44 am
I will add that when Do Not Contact Until calls dropTriggers and triggerRebuild it passes the name of its own table- ie. shouldn't be dropping all triggers. It does this because of something similar to CRM-13587 (the patch for that does the same thing).
Do Not Contact Until extension: https://civicrm.org/extensions/do-not-contact-until
Organisation Name De-duplicator extension: https://civicrm.org/extensions/organisation-name-de-duplicator

VitorFF

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 1
  • CiviCRM version: 4.4.11
  • CMS version: Drupal 7.27
  • MySQL version: 5.5
  • PHP version: 5.4
Re: Custom Field Group logs missing - help!!!
November 17, 2014, 09:09:27 am
I found out that a big part of the logs is missing between specific date intervals

17/09/2014 to 05/10/2014
05/10/2014 to 09/10/2014
09/10/2014 to 24/10/2014
24/10/2014 to 04/11/2014

Between these dates the logs didn't record anything.
There may be other holes in the logs, these are the ones I detected so far.

I also checked and the the log table for the contact is working OK for these dates, the custom field groups are the ones being affected.


EDIT: I just found out that the civicrm_email table also has missing logs. They appear to be consistent with the dates I described above.

Thank you
VitorFF
« Last Edit: November 17, 2014, 09:20:27 am by VitorFF »
Why don't you take a look at this? (You will not regret it!)

Capitalisation Corrector : https://civicrm.org/extensions/capitalisation-corrector

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Custom Field Group logs missing - help!!!
November 17, 2014, 12:22:04 pm
@Vitor, checking those dates seems like good idea, although I'm not sure that I follow correctly. Each of the ranges appears back-to-back (e.g. first range ends 05-Oct-2014; then the next one picks up on the same date, 05-Oct-2014) which makes it sound like the logs are missing continuously (except perhaps the named date). Would it be equivalent to say that logs are missing from 17-Sep to 04-Nov [exclusive] -- except for the specific dates of 5-Oct, 9-Oct, and 24-Oct?

JohnFF

  • I post frequently
  • ***
  • Posts: 235
  • Karma: 6
  • CiviCRM version: 4.4.13
  • CMS version: Drupal 7.28
  • MySQL version: 5.5.31-1
  • PHP version: 5.3.27
Re: Custom Field Group logs missing - help!!!
November 17, 2014, 12:27:22 pm
Dear totten,

That's correct.

Thanks for responding!
If you like empowering charities in a free and open way, then you're going to love Civi.

Email Amender: https://civicrm.org/extensions/email-amender
UK Phone Validator: https://civicrm.org/extensions/uk-phone-number-validator
http://civifirst.com
https://twitter.com/civifirst

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Custom Field Group logs missing - help!!!
November 17, 2014, 12:43:24 pm
Do you keep records about deployments (e.g. svn/git tags for each release)? Might be interesting to know if those dates (17-Sep, 5-Oct, 9-Oct, 24-Oct, 4-Nov, or the adjoining dates) correspond to particular changes/deployments.

@DaveFF - when does the "Do Not Contact Until" extension call dropTriggers and rebuildTriggers? During initial installation? During a cron task? Some other time?

DaveFF

  • I post occasionally
  • **
  • Posts: 54
  • Karma: 5
  • Developer at Future First
    • Future First
  • CiviCRM version: 4.4.13
  • CMS version: Drupal 7.34
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom Field Group logs missing - help!!!
November 18, 2014, 01:24:32 am
Quote from: totten on November 17, 2014, 12:43:24 pm
@DaveFF - when does the "Do Not Contact Until" extension call dropTriggers and rebuildTriggers? During initial installation? During a cron task? Some other time?
During a daily cron job. dropTriggers is called with the name of the extension's custom field table, a couple of queries are done, then rebuildTriggers is called on the same table. See here.
Do Not Contact Until extension: https://civicrm.org/extensions/do-not-contact-until
Organisation Name De-duplicator extension: https://civicrm.org/extensions/organisation-name-de-duplicator

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Re: Custom Field Group logs missing - help!!!
November 18, 2014, 03:00:49 am
FWIW.

On our site we have sometimes had logging stop working even though according to /civicrm/admin/setting/misc?reset=1 it should have been on.  We never did track down the cause, but Eileen mused at one time that perhaps enabling and disabling extensions was the culprit.

Addendum: "We never did track down the cause" translates to "The problem stopped happening and, as we never have enough money, we didn't ask Fuzion to investigate."
« Last Edit: November 19, 2014, 03:27:31 am by joanne »

JohnFF

  • I post frequently
  • ***
  • Posts: 235
  • Karma: 6
  • CiviCRM version: 4.4.13
  • CMS version: Drupal 7.28
  • MySQL version: 5.5.31-1
  • PHP version: 5.3.27
Re: Custom Field Group logs missing - help!!!
November 18, 2014, 04:02:44 am
Hi Joanne,

Was that no logging at all, or only no logging on some tables?

Cheers,
If you like empowering charities in a free and open way, then you're going to love Civi.

Email Amender: https://civicrm.org/extensions/email-amender
UK Phone Validator: https://civicrm.org/extensions/uk-phone-number-validator
http://civifirst.com
https://twitter.com/civifirst

VitorFF

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 1
  • CiviCRM version: 4.4.11
  • CMS version: Drupal 7.27
  • MySQL version: 5.5
  • PHP version: 5.4
Re: Custom Field Group logs missing - help!!!
November 18, 2014, 06:39:36 am
I found out that the missing logs started occurring around 01/05/2014, literally the day we did the 4.4.4 upgrade.

Log problems since 01/05/2014 to today.
 
Days where logging occurred, i.e. exceptions:
 
06/05/2014,
21/05/2014,
27/05/2014,
17/06/2014,
20/06/2014,
02/07/2014,
04/07/2014,
25/07/2014,
11/09/2014,
17/09/2014,
05/10/2014,
09/10/2014,
24/10/2014,
04/11/2014,
10/11/2014,
11/11/2014.

We have done another upgrade since then to 4.4.6 on 07/07/2014 but the logs don't seem to have reacted to it.
 
Thanks,
Vitor
« Last Edit: November 18, 2014, 08:37:04 am by VitorFF »
Why don't you take a look at this? (You will not regret it!)

Capitalisation Corrector : https://civicrm.org/extensions/capitalisation-corrector

VitorFF

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 1
  • CiviCRM version: 4.4.11
  • CMS version: Drupal 7.27
  • MySQL version: 5.5
  • PHP version: 5.4
Re: Custom Field Group logs missing - help!!!
November 18, 2014, 08:05:36 am
Just noticed another curiosity about the logs.

When there is a hole where the logs are missing the row id of the log table isn't sequential.

E.g. here we can see where the log stops at the 4th and resumes at the 10th.


+--------+-----------+---------------------+
| id     | entity_id | log_date            |
+--------+-----------+---------------------+
| 135234 |    128021 | 2014-11-04 19:03:43 |
| 135232 |    128020 | 2014-11-04 19:04:22 |
| 135234 |    128021 | 2014-11-04 19:05:04 |
| 135234 |    128021 | 2014-11-04 19:07:09 |
| 136444 |    128685 | 2014-11-10 10:39:01 |
| 136444 |    128685 | 2014-11-10 10:40:26 |
| 136444 |    128685 | 2014-11-10 10:42:22 |
| 136448 |    128692 | 2014-11-10 11:05:02 |

Notice how both the ID and the entity id suffer a bump. This would be expected from the entity_id, is it normal that the id also takes this sudden leap?

Could this mean that the log is being written and then deleted?
« Last Edit: November 18, 2014, 08:09:07 am by VitorFF »
Why don't you take a look at this? (You will not regret it!)

Capitalisation Corrector : https://civicrm.org/extensions/capitalisation-corrector

DaveFF

  • I post occasionally
  • **
  • Posts: 54
  • Karma: 5
  • Developer at Future First
    • Future First
  • CiviCRM version: 4.4.13
  • CMS version: Drupal 7.34
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Custom Field Group logs missing - help!!!
November 18, 2014, 08:25:20 am
You can't selectively update or delete from log tables, this is enforced by the MySQL engine type. Also, they have no primary key. id is not unique, it is the id column from the original table and you can have several log entries for the same row in the original table.
Do Not Contact Until extension: https://civicrm.org/extensions/do-not-contact-until
Organisation Name De-duplicator extension: https://civicrm.org/extensions/organisation-name-de-duplicator

VitorFF

  • I post occasionally
  • **
  • Posts: 35
  • Karma: 1
  • CiviCRM version: 4.4.11
  • CMS version: Drupal 7.27
  • MySQL version: 5.5
  • PHP version: 5.4
Re: Custom Field Group logs missing - help!!!
November 19, 2014, 03:03:15 am
Hello all,

Dave J. from Circle Interactive did some brilliant investigation and fount this out :

Quote
I can see that the logging triggers are not in place for civicrm_address, civicrm_email, civicrm_phone or civicrm_value_contact_reference_9 (as an example of a civicrm_value table that extends Contact). So that explains why those tables are not logging and this fits with the other site where we saw the problem.
I have run /civicrm/menu/rebuild&reset=1&triggerRebuild=1 and verified that this has restored the logging triggers for the above tables. So this should get the logging going again - but our experience with the other site suggests the triggers may get disabled again. In all the cases we have examined on the other site, this happened following admin operations on custom fields (creating or editing fields).
On the other site too, the problems began after upgrading from 4.3 to 4.4 .


I hope it sheds some light on the issue.

Thanks,
VitorFF
Why don't you take a look at this? (You will not regret it!)

Capitalisation Corrector : https://civicrm.org/extensions/capitalisation-corrector

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Custom Field Group logs missing - help!!!

This forum was archived on 2017-11-26.