From: Date: September 15 2008 1:11pm Subject: bzr commit into mysql-5.1 branch (tomas.ulin:2695) Bug#39450 List-Archive: http://lists.mysql.com/commits/54080 X-Bug: 39450 Message-Id: <20080915111140.B409D4401E@linux.local> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///home/tomas/mysql_src/mysql-5.1-telco-6.3/ 2695 Tomas Ulin 2008-09-15 Bug #39450 embedded libmysqld with ndb does not drop table events modified: sql/ha_ndbcluster.cc sql/ha_ndbcluster_binlog.h === modified file 'sql/ha_ndbcluster.cc' --- a/sql/ha_ndbcluster.cc 2008-09-08 14:34:10 +0000 +++ b/sql/ha_ndbcluster.cc 2008-09-15 11:11:28 +0000 @@ -6850,6 +6850,17 @@ int ha_ndbcluster::final_drop_index(TABL DBUG_RETURN(error); } +/* + Find the base name in the format "/" +*/ +static const char *get_base_name(const char *ptr) +{ + ptr+= strlen(ptr); + while (*(--ptr) != '/'); + while (*(--ptr) != '/'); + return ptr+1; +} + /** Rename a table in NDB Cluster. */ @@ -6967,8 +6978,8 @@ int ha_ndbcluster::rename_table(const ch /* handle old table */ if (!is_old_table_tmpfile) { - ndbcluster_drop_event(thd, ndb, share, "rename table", - from + sizeof(share_prefix) - 1); + const char *ptr= get_base_name(from); + ndbcluster_drop_event(thd, ndb, share, "rename table", ptr); } if (!result && !is_new_table_tmpfile) @@ -6982,8 +6993,8 @@ int ha_ndbcluster::rename_table(const ch #endif /* always create an event for the table */ String event_name(INJECTOR_EVENT_LEN); - ndb_rep_event_name(&event_name, to + sizeof(share_prefix) - 1, 0, - get_binlog_full(share)); + const char *ptr= get_base_name(to); + ndb_rep_event_name(&event_name, ptr, 0, get_binlog_full(share)); if (!ndbcluster_create_event(thd, ndb, ndbtab, event_name.c_ptr(), share, share && ndb_binlog_running ? 2 : 1/* push warning */)) @@ -7202,9 +7213,9 @@ retry_temporary_error1: int table_dropped= dict->getNdbError().code != 709; { + const char *ptr= get_base_name(path); ndbcluster_handle_drop_table(thd, ndb, share, "delete table", - table_dropped ? - (path + sizeof(share_prefix) - 1) : 0); + table_dropped ? ptr : 0); } if (!IS_TMP_PREFIX(table_name) && share && === modified file 'sql/ha_ndbcluster_binlog.h' --- a/sql/ha_ndbcluster_binlog.h 2008-03-26 14:54:06 +0000 +++ b/sql/ha_ndbcluster_binlog.h 2008-09-15 11:11:28 +0000 @@ -94,7 +94,6 @@ enum SCHEMA_OP_TYPE const uint max_ndb_nodes= 256; /* multiple of 32 */ static const char *ha_ndb_ext=".ndb"; -static const char share_prefix[]= "./"; #ifdef HAVE_NDB_BINLOG #define NDB_EXCEPTIONS_TABLE_SUFFIX "$EX"