Open jmcclelland opened 11 years ago
This patch seems to do the trick:
Although... every 1,000th time you rebuild the dashboard, you will get a conflict so may it could be tightened.
Hmm - my original thinking was that I would check if a temp table existed & use it rather than building it twice - but I didn't manage to find the clash in my testing so didn't go any further. However, I think I will look at that fix rather than yours (I have done a previous thing in the past & used day + hour but unless you think I should only regenerate that often I'll do Y-m-d-h-i)
NB the clear caches job should (4.2.10 or later) delete the temp tables.
Oh just thinking the weakness in my plan is that two different searches in the same minute could possibly clash. hmmm
If you try to put two reports on your dashboard (which will create two temp tables during the same second), you get:
0 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/CRM/Core/Error.php(148): CRM_Core_Error::backtrace()
1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
2 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
3 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/packages/DB.php(969): PEAR_Error->PEAR_Error("DB Error: already exists", -5, 16, (Array:2), "CREATE TABLE civicrm_report_temp_entity_tag032607\n (\n
contact_id
...")4 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-5, 16, (Array:2), "CREATE TABLE civicrm_report_temp_entity_tag032607\n (\n
contact_id
...")5 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -5, NULL, NULL, "CREATE TABLE civicrm_report_temp_entity_tag032607\n (\n
contact_id
...", "DB_Error", TRUE)6 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/packages/DB/mysql.php(898): DB_common->raiseError(-5, NULL, NULL, NULL, "1050 \ Table 'civicrm_report_temp_entity_tag032607' already exists")
7 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/packages/DB/mysql.php(327): DB_mysql->mysqlRaiseError()
8 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("CREATE TABLE civicrm_report_temp_entity_tag032607\n (\n
contact_id
...")9 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/packages/DB/DataObject.php(2421): DB_common->query("CREATE TABLE civicrm_report_temp_entity_tag032607\n (\n
contact_id
...")10 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/packages/DB/DataObject.php(1613): DB_DataObject->_query("CREATE TABLE civicrm_report_temp_entity_tag032607\n (\n
contact_id
...")11 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/CRM/Core/DAO.php(155): DB_DataObject->query("CREATE TABLE civicrm_report_temp_entity_tag032607\n (\n
contact_id
...")12 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/CRM/Core/DAO.php(956): CRM_Core_DAO->query("CREATE TABLE civicrm_report_temp_entity_tag032607\n (\n
contact_id
...", TRUE)13 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/libraries/reportbase/CRM/Reportbase/Form/Report/ReportBase.php(3223): CRM_Core_DAO::executeQuery("CREATE TABLE civicrm_report_temp_entity_tag032607\n (\n
contact_id
...")14 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/libraries/reportbase/CRM/Reportbase/Form/Report/ReportBase.php(330): CRM_ReportBase_Form_Report_ReportBase->joinEntityTagFromContact("", (Array:0))
15 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/libraries/advancedfundraising/CRM/Advancedfundraising/Form/Report/Contribute/Renewals.php(106): CRM_ReportBase_Form_Report_ReportBase->from()
16 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/libraries/reportbase/CRM/Reportbase/Form/Report/ReportBase.php(914): CRM_Advancedfundraising_Form_Report_Contribute_Renewals->from()
17 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/libraries/reportbase/CRM/Reportbase/Form/Report/ReportBase.php(836): CRM_ReportBase_Form_Report_ReportBase->buildQuery()
18 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/libraries/reportbase/CRM/Reportbase/Form/Report/ReportBase.php(209): CRM_ReportBase_Form_Report_ReportBase->postProcess()
19 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/libraries/advancedfundraising/CRM/Advancedfundraising/Form/Report/Contribute/Renewals.php(102): CRM_ReportBase_Form_Report_ReportBase->preProcess()
20 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/CRM/Core/Form.php(336): CRM_Advancedfundraising_Form_Report_Contribute_Renewals->preProcess()
21 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php(93): CRM_Core_Form->buildForm()
22 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Advancedfundraising_Form_Report_Contribute_Renewals), "display")
23 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Advancedfundraising_Form_Report_Contribute_Renewals), "display")
24 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/CRM/Core/Controller.php(316): HTML_QuickForm_Page->handle("display")
25 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(117): CRM_Core_Controller->run()
26 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/CRM/Report/Page/Instance.php(104): CRM_Utils_Wrapper->run("CRM_Advancedfundraising_Form_Report_Contribute_Renewals", NULL, NULL)
27 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/CRM/Core/Invoke.php(292): CRM_Report_Page_Instance->run((Array:4), NULL)
28 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/CRM/Core/Invoke.php(70): CRM_Core_Invoke::runItem((Array:14))
29 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:4))
30 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/sites/all/modules/civicrm/drupal/civicrm.module(436): CRM_Core_Invoke::invoke((Array:4))
31 [internal function](): civicrm_invoke("report", "instance", "78")
32 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/includes/menu.inc(517): call_user_func_array("civicrm_invoke", (Array:3))
33 /var/aegir/platforms/nahuel-ourpowerbase-d7-c4.3/index.php(21): menu_execute_active_handler()
34 {main}
Sorry but we are not able to provide this at the moment. DB Error: already exists
Return to home page.