Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1883 05/05/26 16:22:24 tomas@stripped +19 -0
added table_map_version to keep track of which table map events have been sent
added node id sending en EVENT_REP
+ some optimizations
+ added support for seding cluster log event from api/mysqld
storage/ndb/src/ndbapi/Ndbinit.cpp
1.35 05/05/26 16:22:16 tomas@stripped +2 -1
some optims
+ added support for seding cluster log event from api/mysqld
storage/ndb/src/ndbapi/Ndbif.cpp
1.50 05/05/26 16:22:16 tomas@stripped +26 -2
some optims
+ added support for seding cluster log event from api/mysqld
storage/ndb/src/ndbapi/NdbImpl.hpp
1.13 05/05/26 16:22:16 tomas@stripped +4 -0
added event for reporting event buffer usage
storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp
1.27 05/05/26 16:22:16 tomas@stripped +30 -3
added event for reporting event buffer usage
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
1.54 05/05/26 16:22:16 tomas@stripped +83 -34
some optimizations
storage/ndb/src/mgmsrv/MgmtSrvr.hpp
1.33 05/05/26 16:22:16 tomas@stripped +1 -1
added support for sending cluster log events from api
storage/ndb/src/mgmsrv/MgmtSrvr.cpp
1.80 05/05/26 16:22:16 tomas@stripped +11 -6
added support for sending cluster log events from api
storage/ndb/src/mgmapi/ndb_logevent.cpp
1.5 05/05/26 16:22:16 tomas@stripped +4 -0
added event for reporting event buffer usage
storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
1.24 05/05/26 16:22:16 tomas@stripped +6 -0
added support for sending cluster log events from api
storage/ndb/src/common/debugger/EventLogger.cpp
1.25 05/05/26 16:22:16 tomas@stripped +8 -0
added event for reporting event buffer usage
storage/ndb/include/ndbapi/Ndb.hpp
1.49 05/05/26 16:22:16 tomas@stripped +1 -0
added support for sending cluster log events from api
storage/ndb/include/mgmapi/ndb_logevent.h
1.5 05/05/26 16:22:16 tomas@stripped +11 -1
added event for reporting event buffer usage
storage/ndb/include/kernel/signaldata/EventReport.hpp
1.5 05/05/26 16:22:16 tomas@stripped +16 -2
added node id sending en EVENT_REP
sql/table.h
1.101 05/05/26 16:22:16 tomas@stripped +1 -0
added table_map_version to keep track of which table map events have been sent
sql/table.cc
1.165 05/05/26 16:22:16 tomas@stripped +1 -0
added table_map_version to keep track of which table map events have been sent
sql/sql_class.h
1.244 05/05/26 16:22:15 tomas@stripped +25 -6
added table_map_version to keep track of which table map events have been sent
+ some optimizations
sql/sql_class.cc
1.192 05/05/26 16:22:15 tomas@stripped +9 -28
added table_map_version to keep track of which table map events have been sent
+ some optimizations
sql/log.cc
1.169 05/05/26 16:22:15 tomas@stripped +10 -3
added table_map_version to keep track of which table map events have been sent
sql/ha_ndbcluster.cc
1.256 05/05/26 16:22:15 tomas@stripped +5 -4
better error printout
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: tomas
# Host: poseidon.ndb.mysql.com
# Root: /home/tomas/mysql-5.1-wl2325
--- 1.168/sql/log.cc 2005-05-24 12:03:26 +02:00
+++ 1.169/sql/log.cc 2005-05-26 16:22:15 +02:00
@@ -349,7 +349,7 @@
:bytes_written(0), last_time(0), query_start(0), name(0),
file_id(1), open_count(1), log_type(LOG_CLOSED), write_error(0), inited(0),
need_start_event(1), prepared_xids(0),
- m_next_table_id(0),
+ m_next_table_id(0), m_table_map_version(0),
description_event_for_exec(0), description_event_for_queue(0)
{
/*
@@ -2288,18 +2288,25 @@
goto get_table_id_set;
// get next id
- tid = m_next_table_id++;
+ tid= m_next_table_id++;
// There is one reserved number that cannot be used.
if (tid == table_mapping::NO_TABLE)
- tid = m_next_table_id++;
+ tid= m_next_table_id++;
table->s->table_map_id= tid;
+ table->s->table_map_version= m_table_map_version;
get_table_id_set:
pthread_mutex_unlock(&LOCK_next_table_id);
}
DBUG_PRINT("return", ("table_id=%d", tid));
DBUG_RETURN(tid);
+}
+
+void MYSQL_LOG::
+update_table_map_version()
+{
+ m_table_map_version++;
}
#endif // !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
--- 1.191/sql/sql_class.cc 2005-05-25 18:55:57 +02:00
+++ 1.192/sql/sql_class.cc 2005-05-26 16:22:15 +02:00
@@ -259,6 +259,10 @@
ulong tmp=sql_rnd_with_mutex();
randominit(&rand, tmp + (ulong) &rand, tmp + (ulong) ::query_id);
prelocked_mode= NON_PRELOCKED;
+
+#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+ m_table_map_version= &mysql_bin_log.m_table_map_version;
+#endif
}
@@ -1833,22 +1837,6 @@
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-int THD::
-set_pending_event(Rows_log_event* ev)
-{
- DBUG_ENTER("THD::set_pending_event(Rows_log_event*)");
- transaction.m_pending_rows_event= ev;
- DBUG_RETURN(0); // Ok
-}
-
-Rows_log_event* THD::
-get_pending_event() const
-{
- DBUG_ENTER("THD::get_pending_event()");
- Rows_log_event* ev= transaction.m_pending_rows_event;
- DBUG_RETURN(ev);
-}
-
extern ulong opt_binlog_rows_event_max_size;
/*
@@ -2039,28 +2027,21 @@
return "Unknown";
}
-
size_t THD::
-max_row_length(TABLE *table, const byte *record) const
+max_row_length_blob(TABLE *table, const byte *data) const
{
- DBUG_ENTER("THD::max_row_length");
- DBUG_PRINT("enter", ("record = 0x%0x", record));
-
+ size_t length= 0;
TABLE_SHARE *table_s= table->s;
- size_t length= table_s->reclength + 2 * table_s->fields;
- if (table_s->blob_fields == 0)
- DBUG_RETURN(length);
-
uint* const beg= table_s->blob_field;
uint* const end= beg + table_s->blob_fields;
for (uint *ptr= beg ; ptr != end ; ++ptr)
{
Field_blob* const blob= (Field_blob*) table->field[*ptr];
- length+= blob->get_length(record + blob->offset()) + 2;
+ length+= blob->get_length(data + blob->offset()) + 2;
}
- DBUG_RETURN(length);
+ return length;
}
size_t THD::
@@ -2320,6 +2301,7 @@
pending->set_flag(Rows_log_event::TRANS_END_F);
DBUG_ASSERT(mysql_bin_log.is_open());
+ mysql_bin_log.update_table_map_version();
}
}
@@ -2329,4 +2311,3 @@
}
#endif // !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
-
--- 1.243/sql/sql_class.h 2005-05-25 18:55:57 +02:00
+++ 1.244/sql/sql_class.h 2005-05-26 16:22:15 +02:00
@@ -242,6 +242,8 @@
pthread_mutex_t LOCK_next_table_id;
ulong m_next_table_id;
+public:
+ ulonglong m_table_map_version;
public:
MYSQL_LOG();
@@ -261,6 +263,7 @@
// This will return a table id for the table. If the table is not known, a
// new table id will be invented and returned.
ulong get_table_id(TABLE* table);
+ void update_table_map_version();
#endif // !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
/*
These describe the log's format. This is used only for relay logs.
@@ -1095,8 +1098,10 @@
/*
Member functions to handle pending event for row-level logging.
*/
- Rows_log_event* get_pending_event() const;
- int set_pending_event(Rows_log_event* ev);
+ Rows_log_event* get_pending_event() const
+ { return transaction.m_pending_rows_event; }
+ int set_pending_event(Rows_log_event* ev)
+ { transaction.m_pending_rows_event= ev; return 0; }
int flush_and_set_pending_event(Rows_log_event*);
template <class RowsEventT>
@@ -1105,14 +1110,26 @@
MY_BITMAP const* cols, size_t width,
size_t needed, bool is_transactional);
- size_t max_row_length(TABLE* table, const byte *data) const;
+ size_t max_row_length_blob(TABLE* table, const byte *data) const;
+ size_t max_row_length(TABLE* table, const byte *data) const
+ {
+ DBUG_ENTER("THD::max_row_length");
+ DBUG_PRINT("enter", ("record = 0x%0x", data));
+
+ TABLE_SHARE *table_s= table->s;
+ size_t length= table_s->reclength + 2 * table_s->fields;
+ if (table_s->blob_fields == 0)
+ DBUG_RETURN(length);
+
+ DBUG_RETURN(length+max_row_length_blob(table,data));
+ }
+
size_t pack_row(TABLE* table, MY_BITMAP const* cols,
byte *row_data, size_t max_len, const byte *data) const;
int flush_pending_event(bool transaction_end);
ulong get_new_table_id(TABLE* table);
-
ulong get_table_id(TABLE* table)
{
ulong id= table->s->table_map_id;
@@ -1121,12 +1138,14 @@
return get_new_table_id(table);
}
- int is_table_mapped(TABLE* table)
+ int is_table_mapped(TABLE* table) const
{
- return table->s->table_map_id != table_mapping::NO_TABLE;
+ return table->s->table_map_version == *m_table_map_version;
}
int write_table_map(TABLE*,bool);
+
+ ulonglong const *m_table_map_version;
#endif
public:
--- 1.164/sql/table.cc 2005-05-24 15:45:49 +02:00
+++ 1.165/sql/table.cc 2005-05-26 16:22:16 +02:00
@@ -850,6 +850,7 @@
#endif
#ifdef HAVE_REPLICATION
share->table_map_id= table_mapping::NO_TABLE;
+ share->table_map_version= ~(ulonglong)0;
#endif
DBUG_RETURN (0);
--- 1.100/sql/table.h 2005-05-24 15:45:49 +02:00
+++ 1.101/sql/table.h 2005-05-26 16:22:16 +02:00
@@ -165,6 +165,7 @@
my_bool name_lock, replace_with_name_lock;
#ifdef HAVE_REPLICATION
ulong table_map_id;
+ ulonglong table_map_version;
#endif
} TABLE_SHARE;
--- 1.4/storage/ndb/include/kernel/signaldata/EventReport.hpp 2005-04-08 02:43:50 +02:00
+++ 1.5/storage/ndb/include/kernel/signaldata/EventReport.hpp 2005-05-26 16:22:16 +02:00
@@ -68,6 +68,8 @@
4) Add SentHeartbeat in EventLogger::getText()
*/
+ void setNodeId(Uint32 nodeId);
+ Uint32 getNodeId() const;
void setEventType(Ndb_logevent_type type);
Ndb_logevent_type getEventType() const;
UintR eventType; // DATA 0
@@ -75,14 +77,26 @@
inline
void
+EventReport::setNodeId(Uint32 nodeId){
+ eventType = (nodeId << 16) | (eventType & 0xFFFF);
+}
+
+inline
+Uint32
+EventReport::getNodeId() const {
+ return eventType >> 16;
+}
+
+inline
+void
EventReport::setEventType(Ndb_logevent_type type){
- eventType = (UintR) type;
+ eventType = (eventType & 0xFFFF0000) | (((UintR) type) & 0xFFFF);
}
inline
Ndb_logevent_type
EventReport::getEventType() const {
- return (Ndb_logevent_type)eventType;
+ return (Ndb_logevent_type)(eventType & 0xFFFF);
}
#endif
--- 1.48/storage/ndb/include/ndbapi/Ndb.hpp 2005-04-27 23:32:56 +02:00
+++ 1.49/storage/ndb/include/ndbapi/Ndb.hpp 2005-05-26 16:22:16 +02:00
@@ -1063,6 +1063,7 @@
friend class NdbDictionaryImpl;
friend class NdbDictInterface;
friend class NdbBlob;
+ friend class NdbImpl;
#endif
public:
--- 1.24/storage/ndb/src/common/debugger/EventLogger.cpp 2005-04-27 23:32:56 +02:00
+++ 1.25/storage/ndb/src/common/debugger/EventLogger.cpp 2005-05-26 16:22:16 +02:00
@@ -569,6 +569,13 @@
void getTextInfoEvent(QQQQ) {
BaseString::snprintf(m_text, m_text_len, (char *)&theData[1]);
}
+void getTextEventBufferUsage(QQQQ) {
+ BaseString::snprintf(m_text, m_text_len,
+ "Event buffer usage: used=%d(%d\%) alloc=%d(%d\%) max=%d",
+ theData[1], theData[2] ? (theData[1]*100)/theData[2] : 0,
+ theData[2], theData[3] ? (theData[2]*100)/theData[3] : 0,
+ theData[3]);
+}
void getTextWarningEvent(QQQQ) {
BaseString::snprintf(m_text, m_text_len, (char *)&theData[1]);
}
@@ -713,6 +720,7 @@
ROW(SentHeartbeat, LogLevel::llInfo, 12, Logger::LL_INFO ),
ROW(CreateLogBytes, LogLevel::llInfo, 11, Logger::LL_INFO ),
ROW(InfoEvent, LogLevel::llInfo, 2, Logger::LL_INFO ),
+ ROW(EventBufferUsage, LogLevel::llInfo, 7, Logger::LL_INFO ),
// Backup
ROW(BackupStarted, LogLevel::llBackup, 7, Logger::LL_INFO ),
--- 1.23/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp 2005-05-24 15:44:26 +02:00
+++ 1.24/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp 2005-05-26 16:22:16 +02:00
@@ -188,6 +188,12 @@
//-----------------------------------------------------------------------
EventReport * const eventReport = (EventReport *)&signal->theData[0];
Ndb_logevent_type eventType = eventReport->getEventType();
+ Uint32 nodeId= eventReport->getNodeId();
+ if (nodeId == 0)
+ {
+ nodeId= refToNode(signal->getSendersBlockRef());
+ eventReport->setNodeId(nodeId);
+ }
jamEntry();
--- 1.79/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2005-05-24 15:44:27 +02:00
+++ 1.80/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2005-05-26 16:22:16 +02:00
@@ -1898,7 +1898,7 @@
break;
case GSN_EVENT_REP:
- eventReport(refToNode(signal->theSendersBlockRef), signal->getDataPtr());
+ eventReport(signal->getDataPtr());
break;
case GSN_STOP_REF:{
@@ -2079,12 +2079,14 @@
{
DBUG_ENTER("MgmtSrvr::handleStatus");
Uint32 theData[25];
+ EventReport *rep = (EventReport *)theData;
+
theData[1] = nodeId;
if (alive) {
m_started_nodes.push_back(nodeId);
- theData[0] = NDB_LE_Connected;
+ rep->setEventType(NDB_LE_Connected);
} else {
- theData[0] = NDB_LE_Disconnected;
+ rep->setEventType(NDB_LE_Connected);
if(nfComplete)
{
handleStopReply(nodeId, 0);
@@ -2098,8 +2100,9 @@
NdbCondition_Signal(theMgmtWaitForResponseCondPtr);
}
}
-
- eventReport(_ownNodeId, theData);
+
+ rep->setNodeId(_ownNodeId);
+ eventReport(theData);
DBUG_VOID_RETURN;
}
@@ -2413,11 +2416,13 @@
#include "Services.hpp"
void
-MgmtSrvr::eventReport(NodeId nodeId, const Uint32 * theData)
+MgmtSrvr::eventReport(const Uint32 * theData)
{
const EventReport * const eventReport = (EventReport *)&theData[0];
Ndb_logevent_type type = eventReport->getEventType();
+ Uint32 nodeId= eventReport->getNodeId();
+
// Log event
g_eventLogger.log(type, theData, nodeId,
&m_event_listner[0].m_logLevel);
--- 1.32/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2005-04-27 04:07:11 +02:00
+++ 1.33/storage/ndb/src/mgmsrv/MgmtSrvr.hpp 2005-05-26 16:22:16 +02:00
@@ -694,7 +694,7 @@
/**
* An event from <i>nodeId</i> has arrived
*/
- void eventReport(NodeId nodeId, const Uint32 * theData);
+ void eventReport(const Uint32 * theData);
//**************************************************************************
--- 1.53/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp 2005-05-25 18:18:07 +02:00
+++ 1.54/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp 2005-05-26 16:22:16 +02:00
@@ -381,10 +381,10 @@
unsigned tDataSz= AttributeHeader(*aAttrPtr).getDataSize();
assert(tAttr->attrId() ==
AttributeHeader(*aAttrPtr).getAttributeId());
- tAttr->receive_data(aDataPtr, tDataSz);
+ receive_data(tAttr, aDataPtr, tDataSz);
if (is_update)
{
- tAttr1->receive_data(aDataPtr, tDataSz);
+ receive_data(tAttr1, aDataPtr, tDataSz);
tAttr1= tAttr1->next();
}
// next
@@ -423,7 +423,7 @@
DBUG_PRINT("info",("set [%u] %u 0x%x [%u] 0x%x",
tAttrId, tDataSz, *aDataPtr, tRecAttrId, aDataPtr));
- tWorkingRecAttr->receive_data(aDataPtr, tDataSz);
+ receive_data(tWorkingRecAttr, aDataPtr, tDataSz);
tWorkingRecAttr = tWorkingRecAttr->next();
}
aAttrPtr++;
@@ -459,7 +459,7 @@
assert(!m_eventImpl->m_tableImpl->getColumn(tRecAttrId)->getPrimaryKey());
hasSomeData++;
- tWorkingRecAttr->receive_data(aDataPtr, tDataSz);
+ receive_data(tWorkingRecAttr, aDataPtr, tDataSz);
tWorkingRecAttr = tWorkingRecAttr->next();
}
aDataPtr += tDataSz;
@@ -550,6 +550,8 @@
m_ndb(ndb),
m_latestGCI(0),
m_waitGCI(0),
+ m_total_alloc(0),
+ m_total_used(0),
m_dropped_ev_op(0)
{
m_latest_command= "NdbEventBuffer::NdbEventBuffer";
@@ -612,9 +614,13 @@
int NdbEventBuffer::expand(unsigned sz)
{
+ unsigned alloc_size=
+ sizeof(EventBufData_chunk) +(sz-1)*sizeof(EventBufData);
EventBufData_chunk *chunk_data=
- (EventBufData_chunk *)NdbMem_Allocate(sizeof(EventBufData_chunk)
- +(sz-1)*sizeof(EventBufData));
+ (EventBufData_chunk *)NdbMem_Allocate(alloc_size);
+
+ m_total_alloc+= alloc_size;
+
chunk_data->sz= sz;
m_allocated_data.push_back(chunk_data);
@@ -763,13 +769,11 @@
static
Gci_container*
-find_bucket(Vector<Gci_container> * active, Uint64 gci)
+find_bucket_chained(Vector<Gci_container> * active, Uint64 gci)
{
Uint32 size = active->size();
Uint32 pos = (gci & ACTIVE_GCI_MASK);
Gci_container *bucket= active->getBase() + pos;
- if(likely(gci == bucket->m_gci))
- return bucket;
if(gci > bucket->m_gci)
{
@@ -805,6 +809,18 @@
}
}
+inline
+Gci_container*
+find_bucket(Vector<Gci_container> * active, Uint64 gci)
+{
+ Uint32 pos = (gci & ACTIVE_GCI_MASK);
+ Gci_container *bucket= active->getBase() + pos;
+ if(likely(gci == bucket->m_gci))
+ return bucket;
+
+ return find_bucket_chained(active,gci);
+}
+
void
NdbEventBuffer::latestGCI(Uint64 gci, Uint32 cnt)
{
@@ -1005,6 +1021,17 @@
if (unlikely(data == 0))
{
+#if 0
+ {
+ Uint32 data[3];
+ data[0]= NDB_LE_EventBufferUsage;
+ data[1]= 0;
+ data[2]= m_total_alloc;
+ data[3]= 0;
+ m_ndb->theImpl->send_event_report(data,4);
+ ndbout_c("m_total_alloc %d", m_total_alloc);
+ }
+#endif
expand(4000);
data= m_free_data;
if (unlikely(data == 0))
@@ -1024,7 +1051,7 @@
}
// remove data from free list
- m_free_data= m_free_data->m_next;
+ m_free_data= data->m_next;
m_free_data_count--;
// add it to received data
data->m_next= 0;
@@ -1045,8 +1072,7 @@
bucket->m_event_count++;
#endif
- if (copy_data_alloc(sdata, ptr,
- data->sdata, data->ptr))
+ if (copy_data_alloc(sdata, ptr, data))
{
op->m_has_error= 3;
DBUG_RETURN(-1);
@@ -1138,24 +1164,32 @@
int
NdbEventBuffer::copy_data_alloc(const SubTableData * const f_sdata,
LinearSectionPtr f_ptr[3],
- SubTableData * &t_sdata,
- LinearSectionPtr t_ptr[3])
+ EventBufData *ev_buf)
{
DBUG_ENTER("NdbEventBuffer::copy_data_alloc");
const unsigned min_alloc_size= 128;
const unsigned sz4= (sizeof(SubTableData)+3)>>2;
- SubTableData *sdata= t_sdata;
+ Uint32 f_ptr_sz_0= f_ptr[0].sz;
+ Uint32 f_ptr_sz_1= f_ptr[1].sz;
+ Uint32 f_ptr_sz_2= f_ptr[2].sz;
+ LinearSectionPtr *t_ptr= ev_buf->ptr;
+ SubTableData *sdata= ev_buf->sdata;
const unsigned alloc_size= (sz4 +
- f_ptr[0].sz +
- f_ptr[1].sz +
- f_ptr[2].sz) * sizeof(Uint32);
+ f_ptr_sz_0 +
+ f_ptr_sz_1 +
+ f_ptr_sz_2) * sizeof(Uint32);
Uint32 *ptr;
if (alloc_size > min_alloc_size)
{
- ptr= (Uint32*)NdbMem_Allocate(alloc_size);
- t_sdata= (SubTableData *)ptr;
if (sdata)
+ {
NdbMem_Free((char*)sdata);
+ m_total_alloc-= ev_buf->sz;
+ }
+ ptr= (Uint32*)NdbMem_Allocate(alloc_size);
+ ev_buf->sdata= (SubTableData *)ptr;
+ ev_buf->sz= alloc_size;
+ m_total_alloc+= alloc_size;
}
else /* alloc_size <= min_alloc_size */
{
@@ -1164,26 +1198,41 @@
else
{
ptr= (Uint32*)NdbMem_Allocate(min_alloc_size);
- t_sdata= (SubTableData *)ptr;
+ ev_buf->sdata= (SubTableData *)ptr;
+ ev_buf->sz= min_alloc_size;
+ m_total_alloc+= min_alloc_size;
}
}
- memcpy((SubTableData *)ptr,f_sdata,sizeof(SubTableData));
+ memcpy(ptr,f_sdata,sizeof(SubTableData));
ptr+= sz4;
- for (int i = 0; i < 3; i++) {
- LinearSectionPtr & f_p = f_ptr[i];
- LinearSectionPtr & t_p = t_ptr[i];
- if (f_p.sz > 0) {
- t_p.p= (Uint32 *)ptr;
- memcpy(t_p.p, f_p.p, sizeof(Uint32)*f_p.sz);
- ptr+= f_p.sz;
- t_p.sz= f_p.sz;
- } else {
- t_p.p= NULL;
- t_p.sz= 0;
- }
+ t_ptr->p= ptr;
+ t_ptr->sz= f_ptr_sz_0;
+
+ memcpy(ptr, f_ptr[0].p, sizeof(Uint32)*f_ptr_sz_0);
+ ptr+= f_ptr_sz_0;
+ t_ptr++;
+
+ t_ptr->p= ptr;
+ t_ptr->sz= f_ptr_sz_1;
+
+ memcpy(ptr, f_ptr[1].p, sizeof(Uint32)*f_ptr_sz_1);
+ ptr+= f_ptr_sz_1;
+ t_ptr++;
+
+ if (f_ptr_sz_2)
+ {
+ t_ptr->p= ptr;
+ t_ptr->sz= f_ptr_sz_2;
+ memcpy(ptr, f_ptr[2].p, sizeof(Uint32)*f_ptr_sz_2);
+ }
+ else
+ {
+ t_ptr->p= 0;
+ t_ptr->sz= 0;
}
+
DBUG_RETURN(0);
}
--- 1.26/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp 2005-05-25 18:18:07 +02:00
+++ 1.27/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp 2005-05-26 16:22:16 +02:00
@@ -20,14 +20,19 @@
#include <NdbEventOperation.hpp>
#include <signaldata/SumaImpl.hpp>
#include <transporter/TransporterDefinitions.hpp>
+#include <NdbRecAttr.hpp>
#define NDB_EVENT_OP_MAGIC_NUMBER 0xA9F301B4
class NdbEventOperationImpl;
struct EventBufData
{
- SubTableData *sdata;
+ union {
+ SubTableData *sdata;
+ char *memory;
+ };
LinearSectionPtr ptr[3];
+ unsigned sz;
NdbEventOperationImpl *m_event_op;
EventBufData *m_next; // Next wrt to global order
};
@@ -108,6 +113,8 @@
// managed by the ndb object
NdbEventOperationImpl *m_next;
NdbEventOperationImpl *m_prev;
+private:
+ void receive_data(NdbRecAttr *r, const Uint32 *data, Uint32 sz);
};
@@ -153,8 +160,7 @@
// used by both user thread and receive thread
int copy_data_alloc(const SubTableData * const f_sdata,
LinearSectionPtr f_ptr[3],
- SubTableData * &t_sdata,
- LinearSectionPtr t_ptr[3]);
+ EventBufData *ev_buf);
// Global Mutex used for some things
static NdbMutex *p_add_drop_mutex;
@@ -183,6 +189,9 @@
EventBufData *m_last_used_data;
unsigned m_used_data_count;
+ unsigned m_total_alloc; // total allocated memory
+ unsigned m_total_used; // used allocated memory
+
private:
int expand(unsigned sz);
@@ -205,6 +214,24 @@
NdbEventBuffer::getEventOperationImpl(NdbEventOperation* tOp)
{
return &tOp->m_impl;
+}
+
+inline void
+NdbEventOperationImpl::receive_data(NdbRecAttr *r,
+ const Uint32 *data,
+ Uint32 sz)
+{
+ r->receive_data(data,sz);
+#if 0
+ if (sz)
+ {
+ assert((r->attrSize() * r->arraySize() + 3) >> 2 == sz);
+ r->theNULLind= 0;
+ memcpy(r->aRef(), data, 4 * sz);
+ return;
+ }
+ r->theNULLind= 1;
+#endif
}
#endif
--- 1.12/storage/ndb/src/ndbapi/NdbImpl.hpp 2005-04-28 18:51:36 +02:00
+++ 1.13/storage/ndb/src/ndbapi/NdbImpl.hpp 2005-05-26 16:22:16 +02:00
@@ -40,6 +40,10 @@
NdbImpl(Ndb_cluster_connection *, Ndb&);
~NdbImpl();
+ int send_event_report(Uint32 *data, Uint32 length);
+
+ Ndb &m_ndb;
+
Ndb_cluster_connection_impl &m_ndb_cluster_connection;
NdbDictionaryImpl m_dictionary;
--- 1.49/storage/ndb/src/ndbapi/Ndbif.cpp 2005-05-25 18:18:07 +02:00
+++ 1.50/storage/ndb/src/ndbapi/Ndbif.cpp 2005-05-26 16:22:16 +02:00
@@ -723,7 +723,7 @@
const Uint32 gci= rep->gci;
const Uint32 cnt= rep->gcp_complete_rep_count;
theEventBuffer->latestGCI(gci, cnt);
- break;
+ return;
}
case GSN_SUB_TABLE_DATA:
{
@@ -746,7 +746,7 @@
else
g_eventLogger.error("dropped GSN_SUB_TABLE_DATA due to wrong magic "
"number");
- break;
+ return;
}
case GSN_DIHNDBTAMPER:
{
@@ -1419,4 +1419,28 @@
dataPtr[1] = transId2;
tp->sendSignal(aSignal, refToNode(aTCRef));
+}
+
+int
+NdbImpl::send_event_report(Uint32 *data, Uint32 length)
+{
+ NdbApiSignal aSignal(m_ndb.theMyRef);
+ TransporterFacade *tp = TransporterFacade::instance();
+ aSignal.theTrace = TestOrd::TraceAPI;
+ aSignal.theReceiversBlockNumber = CMVMI;
+ aSignal.theVerId_signalNumber = GSN_EVENT_REP;
+ aSignal.theLength = length;
+ memcpy((char *)aSignal.getDataPtrSend(), (char *)data, length*4);
+
+ Uint32 tNode;
+ Ndb_cluster_connection_node_iter node_iter;
+ m_ndb_cluster_connection.init_get_next_node(node_iter);
+ while ((tNode= m_ndb_cluster_connection.get_next_node(node_iter)))
+ {
+ if(tp->get_node_alive(tNode)){
+ tp->sendSignal(&aSignal, tNode);
+ return 0;
+ }
+ }
+ return 1;
}
--- 1.34/storage/ndb/src/ndbapi/Ndbinit.cpp 2005-04-28 18:51:36 +02:00
+++ 1.35/storage/ndb/src/ndbapi/Ndbinit.cpp 2005-05-26 16:22:16 +02:00
@@ -241,7 +241,8 @@
NdbImpl::NdbImpl(Ndb_cluster_connection *ndb_cluster_connection,
Ndb& ndb)
- : m_ndb_cluster_connection(ndb_cluster_connection->m_impl),
+ : m_ndb(ndb),
+ m_ndb_cluster_connection(ndb_cluster_connection->m_impl),
m_dictionary(ndb),
theCurrentConnectIndex(0),
theNdbObjectIdMap(1024,1024),
--- 1.255/sql/ha_ndbcluster.cc 2005-05-25 18:55:56 +02:00
+++ 1.256/sql/ha_ndbcluster.cc 2005-05-26 16:22:15 +02:00
@@ -2587,8 +2587,6 @@
DBUG_ENTER("print_results");
#ifndef DBUG_OFF
- const NDBTAB *tab= (const NDBTAB*) m_table;
-
if (!_db_on_)
DBUG_VOID_RETURN;
@@ -8343,9 +8341,12 @@
thd->proc_info= "Opening " NDB_REP_DB "." NDB_REP_TABLE;
tables->required_type= FRMTYPE_TABLE;
uint counter;
+ thd->clear_error();
if (open_tables(thd,&tables,&counter))
{
- sql_print_error("open_tables");
+ sql_print_error("Opening binlog_index: %d, '%s'",
+ thd->net.last_errno,
+ thd->net.last_error ? thd->net.last_error : "");
thd->proc_info= save_proc_info;
return -1;
}
@@ -8579,7 +8580,7 @@
int r;
if ((r= binlog_index->file->write_row(binlog_index->record[0])))
{
- sql_print_error("write_row: %d", r);
+ sql_print_error("Writing row to binlog_index: %d", r);
error= -1;
goto add_binlog_index_err;
}
--- 1.4/storage/ndb/include/mgmapi/ndb_logevent.h 2005-04-08 02:43:52 +02:00
+++ 1.5/storage/ndb/include/mgmapi/ndb_logevent.h 2005-05-26 16:22:16 +02:00
@@ -159,7 +159,11 @@
/** NDB_MGM_EVENT_CATEGORY_BACKUP */
NDB_LE_BackupCompleted = 56,
/** NDB_MGM_EVENT_CATEGORY_BACKUP */
- NDB_LE_BackupAborted = 57
+ NDB_LE_BackupAborted = 57,
+
+ /** NDB_MGM_EVENT_CATEGORY_INFO */
+ NDB_LE_EventBufferUsage = 58
+
};
/**
@@ -565,6 +569,12 @@
struct {
/* TODO */
} InfoEvent;
+ /** Log event specific data for for corresponding NDB_LE_ log event */
+ struct {
+ unsigned usage;
+ unsigned alloc;
+ unsigned max;
+ } EventBufferUsage;
/** Log event data for @ref NDB_LE_BackupStarted */
struct {
--- 1.4/storage/ndb/src/mgmapi/ndb_logevent.cpp 2005-04-08 02:44:09 +02:00
+++ 1.5/storage/ndb/src/mgmapi/ndb_logevent.cpp 2005-05-26 16:22:16 +02:00
@@ -269,6 +269,10 @@
/* TODO */
// ROW( InfoEvent),
+ ROW( EventBufferUsage, "usage", 1, usage),
+ ROW( EventBufferUsage, "alloc", 2, alloc),
+ ROW( EventBufferUsage, "max", 3, max),
+
// Backup
ROW_FN( BackupStarted, "starting_node", 1, starting_node, ref_to_node),
ROW( BackupStarted, "backup_id", 2, backup_id),
| Thread |
|---|
| • bk commit into 5.1 tree (tomas:1.1883) | tomas | 27 May |