From: John David Duncan Date: September 7 2011 5:14pm Subject: bzr push into mysql-5.1-telco-7.0 branch (john.duncan:4503 to 4505) List-Archive: http://lists.mysql.com/commits/140952 Message-Id: <201109071714.p87HElCn001576@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4505 John David Duncan 2011-09-07 New NDB API client stats; provide insignt on behavior of the adaptive send algorithm. modified: sql/ha_ndbcluster.cc storage/ndb/include/ndbapi/Ndb.hpp storage/ndb/src/ndbapi/Ndb.cpp storage/ndb/src/ndbapi/Ndbif.cpp storage/ndb/src/ndbapi/TransporterFacade.cpp storage/ndb/src/ndbapi/TransporterFacade.hpp storage/ndb/src/ndbapi/trp_client.cpp storage/ndb/src/ndbapi/trp_client.hpp 4504 John David Duncan 2011-09-07 Portability fix re. getaddrinfo() in portlib/NdbTCP EAI_NODATA is obsolete and has been removed from some platforms. modified: storage/ndb/src/common/portlib/NdbTCP.cpp 4503 jonas oreland 2011-09-05 ndb - reserve bit for coord trans modified: storage/ndb/include/kernel/signaldata/TcKeyReq.hpp === modified file 'sql/ha_ndbcluster.cc' --- a/sql/ha_ndbcluster.cc 2011-08-31 10:53:27 +0000 +++ b/sql/ha_ndbcluster.cc 2011-09-07 17:12:12 +0000 @@ -781,6 +781,15 @@ static int update_status_variables(Thd_n SHOW_LONGLONG}, \ {"api_trans_local_read_row_count" NAME_SUFFIX, \ (char*) ARRAY_LOCATION[ Ndb::TransLocalReadRowCount ], \ + SHOW_LONGLONG}, \ + {"api_adaptive_send_forced_count" NAME_SUFFIX, \ + (char *) ARRAY_LOCATION[ Ndb::ForcedSendsCount ], \ + SHOW_LONGLONG}, \ + {"api_adaptive_send_unforced_count" NAME_SUFFIX, \ + (char *) ARRAY_LOCATION[ Ndb::UnforcedSendsCount ], \ + SHOW_LONGLONG}, \ + {"api_adaptive_send_deferred_count" NAME_SUFFIX, \ + (char *) ARRAY_LOCATION[ Ndb::DeferredSendsCount ], \ SHOW_LONGLONG} SHOW_VAR ndb_status_variables_dynamic[]= { === modified file 'storage/ndb/include/ndbapi/Ndb.hpp' --- a/storage/ndb/include/ndbapi/Ndb.hpp 2011-06-30 15:59:25 +0000 +++ b/storage/ndb/include/ndbapi/Ndb.hpp 2011-09-07 17:12:12 +0000 @@ -1801,7 +1801,12 @@ public: NonDataEventsRecvdCount = 19, /* Number of non-data events received */ EventBytesRecvdCount = 20, /* Number of bytes of event data received */ - NumClientStatistics = 21 /* End marker */ + /* Adaptive Send */ + ForcedSendsCount = 21, /* Number of sends with force-send set */ + UnforcedSendsCount = 22, /* Number of sends without force-send */ + DeferredSendsCount = 23, /* Number of adaptive send calls not actually sent */ + + NumClientStatistics = 24 /* End marker */ }; Uint64 getClientStat(Uint32 id) const; === modified file 'storage/ndb/src/common/portlib/NdbTCP.cpp' --- a/storage/ndb/src/common/portlib/NdbTCP.cpp 2011-06-30 15:59:25 +0000 +++ b/storage/ndb/src/common/portlib/NdbTCP.cpp 2011-09-07 16:53:24 +0000 @@ -25,6 +25,11 @@ #define INADDR_NONE -1 /* Error value from inet_addr */ #endif +/* Return codes from getaddrinfo() */ +/* EAI_NODATA is obsolete and has been removed from some platforms */ +#ifndef EAI_NODATA +#define EAI_NODATA EAI_NONAME +#endif extern "C" int === modified file 'storage/ndb/src/ndbapi/Ndb.cpp' --- a/storage/ndb/src/ndbapi/Ndb.cpp 2011-06-30 15:59:25 +0000 +++ b/storage/ndb/src/ndbapi/Ndb.cpp 2011-09-07 17:12:12 +0000 @@ -2290,7 +2290,10 @@ const char* ClientStatNames [] = "TransLocalReadRowCount", "DataEventsRecvdCount", "NonDataEventsRecvdCount", - "EventBytesRecvdCount" + "EventBytesRecvdCount", + "ForcedSendsCount", + "UnforcedSendsCount", + "DeferredSendsCount" }; Uint64 === modified file 'storage/ndb/src/ndbapi/Ndbif.cpp' --- a/storage/ndb/src/ndbapi/Ndbif.cpp 2011-06-06 12:18:27 +0000 +++ b/storage/ndb/src/ndbapi/Ndbif.cpp 2011-09-07 17:12:12 +0000 @@ -1247,7 +1247,13 @@ Ndb::sendPrepTrans(int forceSend) insert_completed_list(a_con); }//for theNoOfPreparedTransactions = 0; - theImpl->do_forceSend(forceSend); + int did_send = theImpl->do_forceSend(forceSend); + if(forceSend) { + theImpl->incClientStat(Ndb::ForcedSendsCount, 1); + } + else { + theImpl->incClientStat(did_send ? Ndb::UnforcedSendsCount : Ndb::DeferredSendsCount, 1); + } return; }//Ndb::sendPrepTrans() === modified file 'storage/ndb/src/ndbapi/TransporterFacade.cpp' --- a/storage/ndb/src/ndbapi/TransporterFacade.cpp 2011-02-24 07:47:22 +0000 +++ b/storage/ndb/src/ndbapi/TransporterFacade.cpp 2011-09-07 17:12:12 +0000 @@ -815,7 +815,7 @@ void TransporterFacade::forceSend(Uint32 //------------------------------------------------- // Improving API performance //------------------------------------------------- -void +int TransporterFacade::checkForceSend(Uint32 block_number) { m_threads.m_statusNext[numberToIndex(block_number)] = ThreadData::ACTIVE; //------------------------------------------------- @@ -828,14 +828,16 @@ TransporterFacade::checkForceSend(Uint32 // time to increase so therefore we have to keep track of // how the users are performing adaptively. //------------------------------------------------- - - if (theTransporterRegistry->forceSendCheck(currentSendLimit) == 1) { + + int did_send = theTransporterRegistry->forceSendCheck(currentSendLimit); + if(did_send == 1) { sendPerformedLastInterval = 1; } checkCounter--; if (checkCounter < 0) { calculateSendLimit(); } + return did_send; } === modified file 'storage/ndb/src/ndbapi/TransporterFacade.hpp' --- a/storage/ndb/src/ndbapi/TransporterFacade.hpp 2011-05-23 14:05:08 +0000 +++ b/storage/ndb/src/ndbapi/TransporterFacade.hpp 2011-09-07 17:12:12 +0000 @@ -126,7 +126,7 @@ public: // Improving the API performance void forceSend(Uint32 block_number); - void checkForceSend(Uint32 block_number); + int checkForceSend(Uint32 block_number); TransporterRegistry* get_registry() { return theTransporterRegistry;}; === modified file 'storage/ndb/src/ndbapi/trp_client.cpp' --- a/storage/ndb/src/ndbapi/trp_client.cpp 2011-02-24 07:47:22 +0000 +++ b/storage/ndb/src/ndbapi/trp_client.cpp 2011-09-07 17:12:12 +0000 @@ -101,17 +101,19 @@ trp_client::complete_poll() m_facade->complete_poll(this); } -void +int trp_client::do_forceSend(int val) { + int did_send = 1; if (val == 0) { - m_facade->checkForceSend(m_blockNo); + did_send = m_facade->checkForceSend(m_blockNo); } else if (val == 1) { m_facade->forceSend(m_blockNo); } + return did_send; } int === modified file 'storage/ndb/src/ndbapi/trp_client.hpp' --- a/storage/ndb/src/ndbapi/trp_client.hpp 2011-02-24 07:47:22 +0000 +++ b/storage/ndb/src/ndbapi/trp_client.hpp 2011-09-07 17:12:12 +0000 @@ -44,7 +44,7 @@ public: void complete_poll(); void wakeup(); - void do_forceSend(int val = 1); + int do_forceSend(int val = 1); int raw_sendSignal(const NdbApiSignal*, Uint32 nodeId); int raw_sendSignal(const NdbApiSignal*, Uint32 nodeId, No bundle (reason: useless for push emails).