added assert for when ndb share is not released as it should

+ corrected the bugs in this resuling from mysql-test-run
+removed some debug printouts
parent f569266b
......@@ -5307,7 +5307,7 @@ int ndbcluster_find_all_files(THD *thd)
pthread_mutex_lock(&ndbcluster_mutex);
if (((share= (NDB_SHARE*)hash_search(&ndbcluster_open_tables,
(byte*) key, strlen(key)))
&& share->op == 0 && share->op_old == 0)
&& share->op == 0 && share->op_old == 0 && ! (share->flags & NSF_NO_BINLOG))
|| share == 0)
{
/*
......@@ -5451,7 +5451,7 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path,
end= strxnmov(end1, sizeof(name) - (end1 - name), file_name, NullS);
if ((share= (NDB_SHARE*)hash_search(&ndbcluster_open_tables,
(byte*)name, end - name))
&& share->op == 0 && share->op_old == 0)
&& share->op == 0 && share->op_old == 0 && ! (share->flags & NSF_NO_BINLOG))
{
/*
there is no binlog creation setup for this table
......@@ -5464,6 +5464,8 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path,
pthread_mutex_unlock(&LOCK_open);
pthread_mutex_lock(&ndbcluster_mutex);
}
/* Table existed in the mysqld so there should be a share */
DBUG_ASSERT(share != NULL);
}
pthread_mutex_unlock(&ndbcluster_mutex);
}
......@@ -6276,6 +6278,11 @@ int handle_trailing_share(NDB_SHARE *share)
share->key, share->use_count);
dbug_print_open_tables();
/*
Ndb share has not been released as it should
*/
DBUG_ASSERT(FALSE);
/*
This is probably an error. We can however save the situation
at the cost of a possible mem leak, by "renaming" the share
......
......@@ -113,6 +113,7 @@ typedef struct st_ndbcluster_share {
#ifdef HAVE_NDB_BINLOG
/* NDB_SHARE.flags */
#define NSF_HIDDEN_PK 1 /* table has hidden primary key */
#define NSF_NO_BINLOG 4 /* table should not be binlogged */
#endif
typedef enum ndb_item_type {
......
......@@ -1714,7 +1714,16 @@ ndbcluster_create_event(Ndb *ndb, const NDBTAB *ndbtab,
{
DBUG_ENTER("ndbcluster_create_event");
if (!share)
{
DBUG_PRINT("info", ("share == NULL"));
DBUG_RETURN(0);
}
if (share->flags & NSF_NO_BINLOG)
{
DBUG_PRINT("info", ("share->flags & NSF_NO_BINLOG, flags: %x %d", share->flags, share->flags & NSF_NO_BINLOG));
DBUG_RETURN(0);
}
NDBDICT *dict= ndb->getDictionary();
NDBEVENT my_event(event_name);
my_event.setTable(*ndbtab);
......@@ -1831,6 +1840,12 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
DBUG_ASSERT(share != 0);
if (share->flags & NSF_NO_BINLOG)
{
DBUG_PRINT("info", ("share->flags & NSF_NO_BINLOG, flags: %x", share->flags));
DBUG_RETURN(0);
}
if (share->op)
{
assert(share->op->getCustomData() == (void *) share);
......@@ -1854,6 +1869,7 @@ ndbcluster_create_event_ops(NDB_SHARE *share, const NDBTAB *ndbtab,
{
sql_print_error("NDB Binlog: logging of blob table %s "
"is not supported", share->key);
share->flags|= NSF_NO_BINLOG;
DBUG_RETURN(0);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment