diff options
author | unknown <tomas@poseidon.ndb.mysql.com> | 2005-01-14 14:30:30 +0100 |
---|---|---|
committer | unknown <tomas@poseidon.ndb.mysql.com> | 2005-01-14 14:30:30 +0100 |
commit | 2acfc2b9e13eca9f4e93e4afecf758fa4425b4ad (patch) | |
tree | 91aba037de9366c2d41de12d3e889826ed5b8810 /ndb | |
parent | d078687a78aefb3b5410aeb6aa645a12338f88bb (diff) | |
parent | 9d9d7582084212fa85355cc1dad850b231d9c876 (diff) | |
download | mariadb-git-2acfc2b9e13eca9f4e93e4afecf758fa4425b4ad.tar.gz |
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into poseidon.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
ndb/include/ndbapi/NdbDictionary.hpp:
Auto merged
ndb/src/ndbapi/NdbDictionary.cpp:
Auto merged
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
Auto merged
sql/mysqld.cc:
Auto merged
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/examples/ndbapi_event_example/ndbapi_event.cpp | 11 | ||||
-rw-r--r-- | ndb/include/kernel/AttributeHeader.hpp | 1 | ||||
-rw-r--r-- | ndb/include/kernel/trigger_definitions.h | 1 | ||||
-rw-r--r-- | ndb/include/ndbapi/NdbDictionary.hpp | 6 | ||||
-rw-r--r-- | ndb/include/ndbapi/ndb_cluster_connection.hpp | 1 | ||||
-rw-r--r-- | ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp | 7 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbDictionary.cpp | 6 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbDictionaryImpl.cpp | 9 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbEventOperationImpl.cpp | 28 | ||||
-rw-r--r-- | ndb/src/ndbapi/NdbEventOperationImpl.hpp | 6 | ||||
-rw-r--r-- | ndb/src/ndbapi/ndb_cluster_connection.cpp | 6 |
11 files changed, 67 insertions, 15 deletions
diff --git a/ndb/examples/ndbapi_event_example/ndbapi_event.cpp b/ndb/examples/ndbapi_event_example/ndbapi_event.cpp index f03564744c7..286f6fafbab 100644 --- a/ndb/examples/ndbapi_event_example/ndbapi_event.cpp +++ b/ndb/examples/ndbapi_event_example/ndbapi_event.cpp @@ -70,12 +70,13 @@ * mysql> use TEST_DB; * mysql> create table TAB0 (COL0 int primary key, COL1 int, COL11 int) engine=ndb; * - * In another window start ndbapi_example5, wait until properly started + * In another window start ndbapi_event, wait until properly started * - * mysql> insert into TAB0 values (1,2,3); - * mysql> insert into TAB0 values (2,2,3); - * mysql> insert into TAB0 values (3,2,9); - * mysql> + insert into TAB0 values (1,2,3); + insert into TAB0 values (2,2,3); + insert into TAB0 values (3,2,9); + update TAB0 set COL1=10 where COL0=1; + delete from TAB0 where COL0=1; * * you should see the data popping up in the example window * diff --git a/ndb/include/kernel/AttributeHeader.hpp b/ndb/include/kernel/AttributeHeader.hpp index e3900b63fdc..3af5d01f007 100644 --- a/ndb/include/kernel/AttributeHeader.hpp +++ b/ndb/include/kernel/AttributeHeader.hpp @@ -40,6 +40,7 @@ public: STATIC_CONST( RANGE_NO = 0xFFFB ); // Read range no (when batched ranges) STATIC_CONST( ROW_SIZE = 0xFFFA ); + STATIC_CONST( FRAGMENT_MEMORY= 0xFFF9 ); /** Initialize AttributeHeader at location aHeaderPtr */ static AttributeHeader& init(void* aHeaderPtr, Uint32 anAttributeId, diff --git a/ndb/include/kernel/trigger_definitions.h b/ndb/include/kernel/trigger_definitions.h index 7ce74877de4..11410654a15 100644 --- a/ndb/include/kernel/trigger_definitions.h +++ b/ndb/include/kernel/trigger_definitions.h @@ -56,6 +56,7 @@ struct TriggerActionTime { }; struct TriggerEvent { + /** TableEvent must match 1 << TriggerEvent */ enum Value { TE_INSERT = 0, TE_DELETE = 1, diff --git a/ndb/include/ndbapi/NdbDictionary.hpp b/ndb/include/ndbapi/NdbDictionary.hpp index 5bf71adb0d3..80c0831f675 100644 --- a/ndb/include/ndbapi/NdbDictionary.hpp +++ b/ndb/include/ndbapi/NdbDictionary.hpp @@ -438,6 +438,7 @@ public: const char* getDefaultValue() const; static const Column * FRAGMENT; + static const Column * FRAGMENT_MEMORY; static const Column * ROW_COUNT; static const Column * COMMIT_COUNT; static const Column * ROW_SIZE; @@ -716,6 +717,8 @@ public: int getRowSizeInBytes() const ; int createTableInDb(Ndb*, bool existingEqualIsOk = true) const ; + + int getReplicaCount() const ; #endif private: @@ -916,6 +919,9 @@ public: /** * Specifies the type of database operations an Event listens to */ +#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL + /** TableEvent must match 1 << TriggerEvent */ +#endif enum TableEvent { TE_INSERT=1, ///< Insert event on table TE_DELETE=2, ///< Delete event on table diff --git a/ndb/include/ndbapi/ndb_cluster_connection.hpp b/ndb/include/ndbapi/ndb_cluster_connection.hpp index 2b59ff1a055..97db76563aa 100644 --- a/ndb/include/ndbapi/ndb_cluster_connection.hpp +++ b/ndb/include/ndbapi/ndb_cluster_connection.hpp @@ -86,6 +86,7 @@ public: void set_optimized_node_selection(int val); unsigned no_db_nodes(); + unsigned node_id(); #endif private: diff --git a/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp b/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp index 06b2b3f4cb4..c3f85cdebd5 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp @@ -1001,6 +1001,13 @@ Dbtup::read_psuedo(Uint32 attrId, Uint32* outBuffer){ case AttributeHeader::FRAGMENT: * outBuffer = operPtr.p->fragId >> 1; // remove "hash" bit return 1; + case AttributeHeader::FRAGMENT_MEMORY: + { + Uint64 tmp= fragptr.p->noOfPages; + tmp*= 32768; + memcpy(outBuffer,&tmp,8); + } + return 2; case AttributeHeader::ROW_SIZE: * outBuffer = tabptr.p->tupheadsize << 2; return 1; diff --git a/ndb/src/ndbapi/NdbDictionary.cpp b/ndb/src/ndbapi/NdbDictionary.cpp index 3299abdb2b4..93a82e4bc83 100644 --- a/ndb/src/ndbapi/NdbDictionary.cpp +++ b/ndb/src/ndbapi/NdbDictionary.cpp @@ -438,6 +438,11 @@ NdbDictionary::Table::getRowSizeInBytes() const { } int +NdbDictionary::Table::getReplicaCount() const { + return m_impl.m_replicaCount; +} + +int NdbDictionary::Table::createTableInDb(Ndb* pNdb, bool equalOk) const { const NdbDictionary::Table * pTab = pNdb->getDictionary()->getTable(getName()); @@ -1005,6 +1010,7 @@ operator<<(NdbOut& out, const NdbDictionary::Column& col) } const NdbDictionary::Column * NdbDictionary::Column::FRAGMENT = 0; +const NdbDictionary::Column * NdbDictionary::Column::FRAGMENT_MEMORY = 0; const NdbDictionary::Column * NdbDictionary::Column::ROW_COUNT = 0; const NdbDictionary::Column * NdbDictionary::Column::COMMIT_COUNT = 0; const NdbDictionary::Column * NdbDictionary::Column::ROW_SIZE = 0; diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index 06248bceee1..2a9f9be5a30 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -232,6 +232,11 @@ NdbColumnImpl::create_psuedo(const char * name){ col->m_impl.m_attrId = AttributeHeader::FRAGMENT; col->m_impl.m_attrSize = 4; col->m_impl.m_arraySize = 1; + } else if(!strcmp(name, "NDB$FRAGMENT_MEMORY")){ + col->setType(NdbDictionary::Column::Bigunsigned); + col->m_impl.m_attrId = AttributeHeader::FRAGMENT_MEMORY; + col->m_impl.m_attrSize = 8; + col->m_impl.m_arraySize = 1; } else if(!strcmp(name, "NDB$ROW_COUNT")){ col->setType(NdbDictionary::Column::Bigunsigned); col->m_impl.m_attrId = AttributeHeader::ROW_COUNT; @@ -685,10 +690,12 @@ NdbDictionaryImpl::~NdbDictionaryImpl() m_globalHash->lock(); if(--f_dictionary_count == 0){ delete NdbDictionary::Column::FRAGMENT; + delete NdbDictionary::Column::FRAGMENT_MEMORY; delete NdbDictionary::Column::ROW_COUNT; delete NdbDictionary::Column::COMMIT_COUNT; delete NdbDictionary::Column::ROW_SIZE; NdbDictionary::Column::FRAGMENT= 0; + NdbDictionary::Column::FRAGMENT_MEMORY= 0; NdbDictionary::Column::ROW_COUNT= 0; NdbDictionary::Column::COMMIT_COUNT= 0; NdbDictionary::Column::ROW_SIZE= 0; @@ -754,6 +761,8 @@ NdbDictionaryImpl::setTransporter(class Ndb* ndb, if(f_dictionary_count++ == 0){ NdbDictionary::Column::FRAGMENT= NdbColumnImpl::create_psuedo("NDB$FRAGMENT"); + NdbDictionary::Column::FRAGMENT_MEMORY= + NdbColumnImpl::create_psuedo("NDB$FRAGMENT_MEMORY"); NdbDictionary::Column::ROW_COUNT= NdbColumnImpl::create_psuedo("NDB$ROW_COUNT"); NdbDictionary::Column::COMMIT_COUNT= diff --git a/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/ndb/src/ndbapi/NdbEventOperationImpl.cpp index 44af495df51..9cea3ec83cd 100644 --- a/ndb/src/ndbapi/NdbEventOperationImpl.cpp +++ b/ndb/src/ndbapi/NdbEventOperationImpl.cpp @@ -224,9 +224,8 @@ NdbEventOperationImpl::execute() int hasSubscriber; - int r= - m_bufferHandle->prepareAddSubscribeEvent(m_eventImpl->m_eventId, - hasSubscriber /* return value */); + int r= m_bufferHandle->prepareAddSubscribeEvent(this, + hasSubscriber /*return value*/); m_error.code= 4709; if (r < 0) @@ -697,10 +696,11 @@ NdbGlobalEventBufferHandle::drop(NdbGlobalEventBufferHandle *handle) } */ int -NdbGlobalEventBufferHandle::prepareAddSubscribeEvent(Uint32 eventId, - int& hasSubscriber) +NdbGlobalEventBufferHandle::prepareAddSubscribeEvent +(NdbEventOperationImpl *eventOp, int& hasSubscriber) { - ADD_DROP_LOCK_GUARDR(int,real_prepareAddSubscribeEvent(this, eventId, hasSubscriber)); + ADD_DROP_LOCK_GUARDR(int,real_prepareAddSubscribeEvent(this, eventOp, + hasSubscriber)); } void NdbGlobalEventBufferHandle::addSubscribeEvent @@ -891,13 +891,15 @@ NdbGlobalEventBuffer::real_remove(NdbGlobalEventBufferHandle *h) exit(-1); } -int +int NdbGlobalEventBuffer::real_prepareAddSubscribeEvent -(NdbGlobalEventBufferHandle *aHandle, Uint32 eventId, int& hasSubscriber) +(NdbGlobalEventBufferHandle *aHandle, NdbEventOperationImpl *eventOp, + int& hasSubscriber) { DBUG_ENTER("NdbGlobalEventBuffer::real_prepareAddSubscribeEvent"); int i; int bufferId= -1; + Uint32 eventId= eventOp->m_eventId; // add_drop_lock(); // only one thread can do add or drop at a time @@ -939,6 +941,7 @@ found_bufferId: bufferId= NO_ID(0, bufferId); b.gId= eventId; + b.eventType= (Uint32)eventOp->m_eventImpl->mi_type; if ((b.p_buf_mutex= NdbMutex_Create()) == NULL) { ndbout_c("NdbGlobalEventBuffer: NdbMutex_Create() failed"); @@ -1137,6 +1140,8 @@ NdbGlobalEventBuffer::real_insertDataL(int bufferId, #ifdef EVENT_DEBUG int n = NO(bufferId); #endif + + if ( b.eventType & (1 << (Uint32)sdata->operation) ) { if (b.subs) { #ifdef EVENT_DEBUG @@ -1175,6 +1180,13 @@ NdbGlobalEventBuffer::real_insertDataL(int bufferId, #endif } } + else + { +#ifdef EVENT_DEBUG + ndbout_c("skipped"); +#endif + } + DBUG_RETURN(0); } diff --git a/ndb/src/ndbapi/NdbEventOperationImpl.hpp b/ndb/src/ndbapi/NdbEventOperationImpl.hpp index fae9dda45e4..3fcbfd8fe7c 100644 --- a/ndb/src/ndbapi/NdbEventOperationImpl.hpp +++ b/ndb/src/ndbapi/NdbEventOperationImpl.hpp @@ -79,7 +79,7 @@ public: //static NdbGlobalEventBufferHandle *init(int MAX_NUMBER_ACTIVE_EVENTS); // returns bufferId 0-N if ok otherwise -1 - int prepareAddSubscribeEvent(Uint32 eventId, int& hasSubscriber); + int prepareAddSubscribeEvent(NdbEventOperationImpl *, int& hasSubscriber); void unprepareAddSubscribeEvent(int bufferId); void addSubscribeEvent(int bufferId, NdbEventOperationImpl *ndbEventOperationImpl); @@ -133,7 +133,8 @@ private: int MAX_NUMBER_ACTIVE_EVENTS); int real_prepareAddSubscribeEvent(NdbGlobalEventBufferHandle *h, - Uint32 eventId, int& hasSubscriber); + NdbEventOperationImpl *, + int& hasSubscriber); void real_unprepareAddSubscribeEvent(int bufferId); void real_addSubscribeEvent(int bufferId, void *ndbEventOperation); @@ -177,6 +178,7 @@ private: // local mutex for each event/buffer NdbMutex *p_buf_mutex; Uint32 gId; + Uint32 eventType; struct Data { SubTableData *sdata; LinearSectionPtr ptr[3]; diff --git a/ndb/src/ndbapi/ndb_cluster_connection.cpp b/ndb/src/ndbapi/ndb_cluster_connection.cpp index 2b3743e013a..aefcb0d97d0 100644 --- a/ndb/src/ndbapi/ndb_cluster_connection.cpp +++ b/ndb/src/ndbapi/ndb_cluster_connection.cpp @@ -183,6 +183,12 @@ Ndb_cluster_connection::no_db_nodes() return m_impl.m_all_nodes.size(); } +unsigned +Ndb_cluster_connection::node_id() +{ + return m_impl.m_transporter_facade->ownId(); +} + int Ndb_cluster_connection::wait_until_ready(int timeout, |