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) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • a terrifying case of massive spontaneious data loss
Pages: [1]

Author Topic: a terrifying case of massive spontaneious data loss  (Read 2070 times)

Sean Madsen

  • I post occasionally
  • **
  • Posts: 98
  • Karma: 5
  • CiviCRM implementer/developer
    • Bikes Not Bombs
  • CiviCRM version: 4.6
  • CMS version: Drupal 7
a terrifying case of massive spontaneious data loss
September 24, 2009, 09:41:39 pm
I'm administering a sizable CiviCRM 2.2.0 installation and we had an extremely troubling case of data loss last night. I have backups, which is good because were were able to recover, and also good because we have clear proof of the results of whatever it was that happened...

Sometime, within the span of two hours, something happened that resulted in many changes, of which I have noticed the following:
* rows in civicrm_phone decrease from 17685 to 13
* rows in civicrm_email decrease from 12555 to 9
* rows in civicrm_address decrease from 29998 to 30
* rows in civicmr_contact decrease from 36778 to 36740 -- which is actually what I would expect here because we were working on de-duping during this time.

The remaining rows in these tables to not appear to share any common information that would make them stand out from the many rows that were deleted... it all seems random.

Our database host is Dreamhost on a shared account, so we don't have a whole lot of access to the database system (eg. we can't get query logs)

Does anyone have any thoughts on what might have caused this data loss? Has anyone heard of or experienced anything similar?

Thanks for the help.
--
Sean

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: a terrifying case of massive spontaneious data loss
September 25, 2009, 10:34:16 am

hey sean:

1. do u have any idea of what operations u did that caused the above. Any chance you can take a look thru the access logs to see the various dedupe / merges that took place. Can u try to recreate on a copy of the database

2. seems like one or more of the 38 dedupe merges caused the issue. So we can potentially try to recreate it and see what merge(s) caused the mass deletion

3. if u have a sizable install, a shared hosting provider is definitely not recommeded :)

Would be good for you to investigate this a bit more and figure out what happened and why. We'd be happy to help and assist and narrow down the issue.


lobo


A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: a terrifying case of massive spontaneious data loss
October 04, 2009, 12:23:40 pm
Hi,

Have you been able to reproduce ? I'd be very useful if you could install a copy of the restored DB and try to do the dedupe again, see if you can cause all the phone/email/address to go missing.

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Sean Madsen

  • I post occasionally
  • **
  • Posts: 98
  • Karma: 5
  • CiviCRM implementer/developer
    • Bikes Not Bombs
  • CiviCRM version: 4.6
  • CMS version: Drupal 7
Re: a terrifying case of massive spontaneious data loss
October 05, 2009, 08:31:16 am
After a lot of research I am finally figured out how to reproduce this issue!!!! First off, I'll cut straight to an important point which is that taking the reproduction steps on a 3.0.0 installation does NOT appear to cause the same data loss. Nevertheless, here are the steps to reproduce the process on a 2.2.0 installation. This will pretty much delete the vast majority of your phone numbers, email address, and mailing addresses...

    * go to a de-dupe/merge screen that presents a list of contacts to be merged
    * click the merge link to open in a NEW TAB
    * check all boxes and press the merge button
    * go back to the list of contacts to be merged and click the SAME merge hyperlink
    * observe that a table with now rows is presented to the user as the contacts to merge
    * click the link to flip between contacts
    * observe now that the right side of the merge screen does not have any information (we're merging info INTO a contact that DOESN'T EXIST)
    * check all boxes
    * press the merge button
    * observe that Civi spits out nasty error message, which also appears in the Civi log file as as indicated at the end of this post
    * observe that the number of rows in the following tables have been drastically reduced: civicrm_address, civicrm_email, civicrm_phone


Here is the error message
Code: [Select]
Oct 01 11:27:53  [info] $Fatal Error Details = Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [c0de] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => UPDATE IGNORE civicrm_activity SET source_contact_id = 0 WHERE source_contact_id = 1242 [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`bnb_crm_civi/civicrm_activity`, CONSTRAINT `FK_civicrm_activity_source_contact_id` FOREIGN KEY (`source_contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]
    [type] => DB_Error
    [user_info] => UPDATE IGNORE civicrm_activity SET source_contact_id = 0 WHERE source_contact_id = 1242 [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`bnb_crm_civi/civicrm_activity`, CONSTRAINT `FK_civicrm_activity_source_contact_id` FOREIGN KEY (`source_contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="UPDATE IGNORE civicrm_activity SET source_contact_id = 0 WHERE source_contact_id = 1242 [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`bnb_crm_civi/civicrm_activity`, CONSTRAINT `FK_civicrm_activity_source_contact_id` FOREIGN KEY (`source_contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]"]
)


Oct 01 11:27:53  [info] $backTrace = /home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/CRM/Core/Error.php, backtrace, 192
, handle,
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/packages/PEAR.php, call_user_func, 912
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/packages/DB.php, PEAR_Error, 966
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/packages/PEAR.php, DB_Error, 574
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/packages/DB/common.php, raiseError, 1903
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/packages/DB/mysql.php, raiseError, 898
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/packages/DB/mysql.php, mysqlRaiseError, 327
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/packages/DB/common.php, simpleQuery, 1216
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/packages/DB/DataObject.php, query, 2394
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/packages/DB/DataObject.php, _query, 1587
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/CRM/Core/DAO.php, query, 144
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/CRM/Core/DAO.php, query, 861
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/CRM/Dedupe/Merger.php, executeQuery, 259
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/CRM/Contact/Form/Merge.php, moveContactBelongings, 407
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/CRM/Core/Form.php, postProcess, 247
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/CRM/Core/StateMachine.php, mainProcess, 166
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/CRM/Core/QuickForm/Action/Next.php, perform, 63
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/packages/HTML/QuickForm/Controller.php, perform, 203
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/packages/HTML/QuickForm/Page.php, handle, 103
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/CRM/Core/Controller.php, handle, 245
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/CRM/Utils/Wrapper.php, run, 114
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/CRM/Core/Invoke.php, run, 177
/home/.tertia/bnbftp/crm.bikesnotbombs.org/civicrm-2.2.0-drupal/drupal/civicrm.module, invoke, 339
, civicrm_invoke,
/home/.tertia/bnbftp/crm.bikesnotbombs.org/drupal-6.9/includes/menu.inc, call_user_func_array, 348
/home/.tertia/bnbftp/crm.bikesnotbombs.org/drupal-6.9/index.php, menu_execute_active_handler, 18


Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: a terrifying case of massive spontaneious data loss
October 05, 2009, 09:27:12 am

issue filed and fixed here: http://issues.civicrm.org/jira/browse/CRM-5177

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • a terrifying case of massive spontaneious data loss

This forum was archived on 2017-11-26.