summaryrefslogtreecommitdiff
path: root/sql/ha_ndbcluster_binlog.cc
diff options
context:
space:
mode:
authorunknown <jonas@perch.ndb.mysql.com>2006-08-09 10:22:09 +0200
committerunknown <jonas@perch.ndb.mysql.com>2006-08-09 10:22:09 +0200
commit87a539a6e59d8e97195084f3cf870bb93fac2ec7 (patch)
tree2a324d9efb2a32ad64e92f975920fea354779534 /sql/ha_ndbcluster_binlog.cc
parentd0baba61141c6581f661459636c29b90c4f66eac (diff)
downloadmariadb-git-87a539a6e59d8e97195084f3cf870bb93fac2ec7.tar.gz
ndb - bug#21363
Add extra sleeps (conditionally) if user-ndb-object still exists during shutdown Note: This is not in anyway optimal, but i dont't really know in which order should be shutdown but it fixes problem... sql/ha_ndbcluster_binlog.cc: Add extra wait loop to make user "user" ndb-object go away... otherwise user thread can have ongoing SUB_DATA storage/ndb/include/ndbapi/ndb_cluster_connection.hpp: Add interface for getting active ndb-object count storage/ndb/src/ndbapi/Ndbif.cpp: Add return in case of incorrect magic storage/ndb/src/ndbapi/TransporterFacade.cpp: Add interface for getting active ndb-object count storage/ndb/src/ndbapi/ndb_cluster_connection.cpp: Add interface for getting active ndb-object count
Diffstat (limited to 'sql/ha_ndbcluster_binlog.cc')
-rw-r--r--sql/ha_ndbcluster_binlog.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
index 8e9f0077dd0..3b72b4f1be6 100644
--- a/sql/ha_ndbcluster_binlog.cc
+++ b/sql/ha_ndbcluster_binlog.cc
@@ -3858,13 +3858,38 @@ err:
close_thread_tables(thd);
pthread_mutex_lock(&injector_mutex);
/* don't mess with the injector_ndb anymore from other threads */
+ int ndb_obj_cnt= 1; // g_ndb
+ ndb_obj_cnt+= injector_ndb == 0 ? 0 : 1;
+ ndb_obj_cnt+= schema_ndb == 0 ? 0 : 1;
+ ndb_obj_cnt+= ndbcluster_util_inited ? 1 : 0;
injector_thd= 0;
injector_ndb= 0;
schema_ndb= 0;
pthread_mutex_unlock(&injector_mutex);
thd->db= 0; // as not to try to free memory
- sql_print_information("Stopping Cluster Binlog");
+ if (!ndb_extra_logging)
+ sql_print_information("Stopping Cluster Binlog");
+ else
+ sql_print_information("Stopping Cluster Binlog: %u(%u)",
+ g_ndb_cluster_connection->get_active_ndb_objects(),
+ ndb_obj_cnt);
+
+ /**
+ * Add extra wait loop to make user "user" ndb-object go away...
+ * otherwise user thread can have ongoing SUB_DATA
+ */
+ int sleep_cnt= 0;
+ while (sleep_cnt < 300 && g_ndb_cluster_connection->get_active_ndb_objects() > ndb_obj_cnt)
+ {
+ my_sleep(10000); // 10ms
+ sleep_cnt++;
+ }
+ if (ndb_extra_logging)
+ sql_print_information("Stopping Cluster Binlog: waited %ums %u(%u)",
+ 10*sleep_cnt, g_ndb_cluster_connection->get_active_ndb_objects(),
+ ndb_obj_cnt);
+
if (apply_status_share)
{
free_share(&apply_status_share);