From 748f589ecde3fca1610db5e5512daacc6e14aba2 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 Jun 2006 01:19:13 +0200 Subject: [PATCH 1/2] correct initialization of event operation to enable early delete --- storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp index c8f05f3a96c..e0b8043a8ff 100644 --- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp +++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp @@ -79,7 +79,8 @@ NdbEventOperationImpl::NdbEventOperationImpl(NdbEventOperation &f, NdbEventOperation(*this), m_facade(&f), m_ndb(theNdb), - m_state(EO_ERROR) + m_state(EO_ERROR), + m_oid(~(Uint32)0) { DBUG_ENTER("NdbEventOperationImpl::NdbEventOperationImpl"); @@ -88,7 +89,11 @@ NdbEventOperationImpl::NdbEventOperationImpl(NdbEventOperation &f, assert(myDict != NULL); const NdbDictionary::Event *myEvnt = myDict->getEvent(eventName); - if (!myEvnt) { m_error.code= myDict->getNdbError().code; DBUG_VOID_RETURN; } + if (!myEvnt) + { + m_error.code= myDict->getNdbError().code; + DBUG_VOID_RETURN; + } init(myEvnt->m_impl); DBUG_VOID_RETURN; @@ -99,7 +104,8 @@ NdbEventOperationImpl::NdbEventOperationImpl(Ndb *theNdb, NdbEventOperation(*this), m_facade(this), m_ndb(theNdb), - m_state(EO_ERROR) + m_state(EO_ERROR), + m_oid(~(Uint32)0) { DBUG_ENTER("NdbEventOperationImpl::NdbEventOperationImpl [evnt]"); init(evnt); @@ -113,7 +119,6 @@ NdbEventOperationImpl::init(NdbEventImpl& evnt) m_magic_number = 0; mi_type = 0; - m_oid = ~(Uint32)0; m_change_mask = 0; #ifdef VM_TRACE m_data_done_count = 0; @@ -173,6 +178,9 @@ NdbEventOperationImpl::~NdbEventOperationImpl() DBUG_ENTER("NdbEventOperationImpl::~NdbEventOperationImpl"); m_magic_number= 0; + if (m_oid == ~(Uint32)0) + DBUG_VOID_RETURN; + stop(); // m_bufferHandle->dropSubscribeEvent(m_bufferId); ; // ToDo? We should send stop signal here From 17f566506efaed3edd6d37e9ca2bed98dc402715 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 14 Jun 2006 01:20:39 +0200 Subject: [PATCH 2/2] ndb: add missing LOCK_open --- sql/ha_ndbcluster.cc | 2 ++ sql/ha_ndbcluster_binlog.cc | 1 + 2 files changed, 3 insertions(+) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 94fb7e6eb5c..d8f4ddac73c 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -5848,6 +5848,7 @@ int ndbcluster_drop_database_impl(const char *path) while ((tabname=it++)) { tablename_to_filename(tabname, tmp, FN_REFLEN - (tmp - full_path)-1); + VOID(pthread_mutex_lock(&LOCK_open)); if (ha_ndbcluster::delete_table(0, ndb, full_path, dbname, tabname)) { const NdbError err= dict->getNdbError(); @@ -5857,6 +5858,7 @@ int ndbcluster_drop_database_impl(const char *path) ret= ndb_to_mysql_error(&err); } } + VOID(pthread_mutex_unlock(&LOCK_open)); } DBUG_RETURN(ret); } diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index af6eb74a236..022c8a021cb 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -286,6 +286,7 @@ ndbcluster_binlog_open_table(THD *thd, NDB_SHARE *share, int error; DBUG_ENTER("ndbcluster_binlog_open_table"); + safe_mutex_assert_owner(&LOCK_open); init_tmp_table_share(table_share, share->db, 0, share->table_name, share->key); if ((error= open_table_def(thd, table_share, 0)))