[Commits] 4ca3507b293: MDEV-7914 spider/bg.ha, spider/bg.ha_part fail sporadically in buildbot

jacob.mathew at mariadb.com jacob.mathew at mariadb.com
Thu Jun 22 01:35:23 EEST 2017


revision-id: 4ca3507b2937c344982049e3b67c029c839725fe (mariadb-10.2.6-55-g4ca3507b293)
parent(s): 0cf993c24f482663ba1685ecf97a23ab44f6912e
author: Jacob Mathew
committer: Jacob Mathew
timestamp: 2017-06-21 15:23:47 -0700
message:

MDEV-7914 spider/bg.ha, spider/bg.ha_part fail sporadically in buildbot

Fixed the bug by adding calls to thd_set_ha_data() to prevent the Spider
plugin from being uninstalled before all Spider active transactions had ended.

---
 storage/spider/spd_trx.cc | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc
index 8ba46774cfb..bd39f22e66b 100644
--- a/storage/spider/spd_trx.cc
+++ b/storage/spider/spd_trx.cc
@@ -1395,7 +1395,7 @@ SPIDER_TRX *spider_get_trx(
         pthread_mutex_unlock(&spider_allocated_thds_mutex);
         trx->registed_allocated_thds = TRUE;
       }
-      *thd_ha_data(thd, spider_hton_ptr) = (void *) trx;
+      thd_set_ha_data(thd, spider_hton_ptr, trx);
     }
   }
 
@@ -1511,7 +1511,8 @@ int spider_free_trx(
   bool need_lock
 ) {
   DBUG_ENTER("spider_free_trx");
-  if (trx->thd)
+  THD *thd = trx->thd;
+  if (thd)
   {
     if (trx->registed_allocated_thds)
     {
@@ -1519,18 +1520,19 @@ int spider_free_trx(
         pthread_mutex_lock(&spider_allocated_thds_mutex);
 #ifdef HASH_UPDATE_WITH_HASH_VALUE
       my_hash_delete_with_hash_value(&spider_allocated_thds,
-        trx->thd_hash_value, (uchar*) trx->thd);
+        trx->thd_hash_value, (uchar*) thd);
 #else
-      my_hash_delete(&spider_allocated_thds, (uchar*) trx->thd);
+      my_hash_delete(&spider_allocated_thds, (uchar*) thd);
 #endif
       if (need_lock)
         pthread_mutex_unlock(&spider_allocated_thds_mutex);
     }
-    *thd_ha_data(trx->thd, spider_hton_ptr) = (void *) NULL;
   }
   spider_free_trx_alloc(trx);
   spider_merge_mem_calc(trx, TRUE);
   spider_free(NULL, trx, MYF(0));
+  if (thd)
+    thd_set_ha_data(thd, spider_hton_ptr, NULL);
   DBUG_RETURN(0);
 }
 


More information about the commits mailing list