mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
f40e0cc0d0
Removed a lot of compiler warnings Removed not used variables, functions and labels Initialize some variables that could be used unitialized (fatal bugs) %ll -> %l BitKeeper/etc/ignore: added storage/archive/archive_reader BUILD/SETUP.sh: ccache now works again BUILD/compile-pentium-gcov: Added marker that we are using gcov and need special version of ccache client/mysql_upgrade.c: after merge fixes client/mysqlbinlog.cc: after merge fixes client/mysqldump.c: Removed compiler warnings client/mysqlimport.c: Removed compiler warnings client/mysqltest.c: Removed compiler warnings mysql-test/t/mysqlcheck.test: After merge fixes mysys/my_bitmap.c: After merge fix sql/event_data_objects.cc: Removed not used variable sql/event_db_repository.cc: Removed not used variable sql/event_queue.cc: Removed not used variable sql/field.cc: After merge fixes sql/filesort.cc: Added missing initialization (could cause core dump on EOM) sql/ha_ndbcluster.cc: After merge fixes Removed not used variables false-> FALSE true -> TRUE %llu -> %lu (portability fix) Fixed bug where field could be used unitialized in build_scan_filter_predicate() sql/ha_ndbcluster_binlog.cc: Removed not used label sql/ha_partition.cc: Removed not used variables sql/handler.cc: Removed not used variable & function sql/item.cc: After merge fixes sql/item_cmpfunc.cc: Removed not used variable sql/item_func.cc: Removed compiler warning sql/item_xmlfunc.cc: Removed not used variables & declarations sql/log.cc: Removed compiler warnings Removed not used variables & label sql/log.h: After merge fixes sql/log_event.cc: Removed not used variable & function sql/mysqld.cc: After merge fixes sql/opt_range.cc: Removed not used declaration sql/partition_info.cc: Removed not used variable sql/protocol.cc: Removed compiler warnings sql/set_var.cc: Removed not used variable sql/set_var.h: After merge fix sql/slave.cc: After merge fixes sql/slave.h: Moved wrong declaration to slave.cc sql/sp.cc: Fixed format of DBUG_PRINT sql/sp_head.cc: After merge fixes sql/spatial.cc: Added DBUG_ASSERT() to verify that LINT_INIT is right sql/sql_class.cc: Removed not used variables sql/sql_insert.cc: After merge fixes sql/sql_parse.cc: Removed not used variable After merge fixes sql/sql_partition.cc: Removed not used variables sql/sql_plugin.cc: Removed compiler warnings when compiling embedded server sql/sql_servers.cc: Removed not used variables Moved wrong placed calle to use_all_columns() sql/sql_servers.h: Moved declaration to right sql_servers.cc sql/sql_show.cc: Removed not used variables and function After merge fixes sql/sql_table.cc: Removed not used variable sql/sql_yacc.yy: Removed not used variables Lex -> lex sql/table.cc: Indentation fix storage/archive/ha_archive.cc: After merge fixes storage/example/ha_example.cc: Indentation fixes storage/federated/ha_federated.cc: Removed not used variables storage/myisam/mi_rkey.c: Added 0x before address storage/myisammrg/ha_myisammrg.cc: Removed old declaration storage/ndb/include/kernel/signaldata/ArbitSignalData.hpp: After merge fixes storage/ndb/include/util/SimpleProperties.hpp: After merge fixes storage/ndb/src/common/debugger/EventLogger.cpp: Removed not used function storage/ndb/src/kernel/blocks/suma/Suma.cpp: Removed compiler warnings Removed not used variables storage/ndb/src/mgmsrv/MgmtSrvr.cpp: After merge fixes Removed not used variables storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: Removed not used varibles. storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp: Removed not used variables storage/ndb/src/ndbapi/NdbOperationDefine.cpp: Removed not used variables and label storage/ndb/src/ndbapi/NdbOperationSearch.cpp: Removed not used label storage/ndb/src/ndbapi/SignalSender.cpp: Removed not used function storage/ndb/src/ndbapi/TransporterFacade.cpp: Removed not used variables storage/ndb/src/ndbapi/ndb_cluster_connection.cpp: Moved static declaration from header file storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp: Moved static declaration from header file support-files/compiler_warnings.supp: Remove some warnings from ndb
156 lines
4.6 KiB
C++
156 lines
4.6 KiB
C++
/* Copyright (C) 2003 MySQL AB
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
#ifndef ARBIT_SIGNAL_DATA_H
|
|
#define ARBIT_SIGNAL_DATA_H
|
|
|
|
#include <string.h>
|
|
#include <NodeBitmask.hpp>
|
|
#include <NdbTick.h>
|
|
#include <NdbHost.h>
|
|
#include "SignalData.hpp"
|
|
#include "SignalDataPrint.hpp"
|
|
|
|
/**
|
|
* The ticket.
|
|
*/
|
|
class ArbitTicket {
|
|
private:
|
|
Uint32 data[2];
|
|
|
|
public:
|
|
ArbitTicket() {}
|
|
STATIC_CONST( DataLength = 2 );
|
|
STATIC_CONST( TextLength = DataLength * 8 ); // hex digits
|
|
|
|
inline void clear() {
|
|
data[0] = 0;
|
|
data[1] = 0;
|
|
}
|
|
|
|
inline void update() {
|
|
Uint16 cnt = data[0] & 0xFFFF; // previous count
|
|
Uint16 pid = NdbHost_GetProcessId();
|
|
data[0] = (pid << 16) | (cnt + 1);
|
|
data[1] = NdbTick_CurrentMillisecond();
|
|
}
|
|
|
|
inline bool match(ArbitTicket& aTicket) const {
|
|
return
|
|
data[0] == aTicket.data[0] &&
|
|
data[1] == aTicket.data[1];
|
|
}
|
|
|
|
inline void getText(char *buf, size_t buf_len) const {
|
|
BaseString::snprintf(buf, buf_len, "%08x%08x", data[0], data[1]);
|
|
}
|
|
|
|
/* inline char* getText() const {
|
|
static char buf[TextLength + 1];
|
|
getText(buf, sizeof(buf));
|
|
return buf;
|
|
} */
|
|
};
|
|
|
|
/**
|
|
* Result codes. Part of signal data. Each signal uses only
|
|
* a subset but a common namespace is convenient.
|
|
*/
|
|
class ArbitCode {
|
|
public:
|
|
STATIC_CONST( ErrTextLength = 80 );
|
|
|
|
enum {
|
|
NoInfo = 0,
|
|
|
|
// CFG signals
|
|
CfgRank1 = 1, // these have to be 1 and 2
|
|
CfgRank2 = 2,
|
|
|
|
// QMGR continueB thread state
|
|
ThreadStart = 11, // continueB thread started
|
|
|
|
// PREP signals
|
|
PrepPart1 = 21, // zero old ticket
|
|
PrepPart2 = 22, // get new ticket
|
|
PrepAtrun = 23, // late joiner gets ticket at RUN time
|
|
|
|
// arbitrator state
|
|
ApiStart = 31, // arbitrator thread started
|
|
ApiFail = 32, // arbitrator died
|
|
ApiExit = 33, // arbitrator reported it will exit
|
|
|
|
// arbitration result
|
|
LoseNodes = 41, // lose on ndb node count
|
|
WinNodes = 42, // win on ndb node count
|
|
WinGroups = 43, // we win, no need for arbitration
|
|
LoseGroups = 44, // we lose, missing node group
|
|
Partitioning = 45, // possible network partitioning
|
|
WinChoose = 46, // positive reply
|
|
LoseChoose = 47, // negative reply
|
|
LoseNorun = 48, // arbitrator required but not running
|
|
LoseNocfg = 49, // arbitrator required but none configured
|
|
|
|
// general error codes
|
|
ErrTicket = 91, // invalid arbitrator-ticket
|
|
ErrToomany = 92, // too many requests
|
|
ErrState = 93, // invalid state
|
|
ErrTimeout = 94, // timeout waiting for signals
|
|
ErrUnknown = 95 // unknown error
|
|
};
|
|
|
|
static inline void getErrText(Uint32 code, char* buf, size_t buf_len) {
|
|
switch (code) {
|
|
case ErrTicket:
|
|
BaseString::snprintf(buf, buf_len, "invalid arbitrator-ticket");
|
|
break;
|
|
case ErrToomany:
|
|
BaseString::snprintf(buf, buf_len, "too many requests");
|
|
break;
|
|
case ErrState:
|
|
BaseString::snprintf(buf, buf_len, "invalid state");
|
|
break;
|
|
case ErrTimeout:
|
|
BaseString::snprintf(buf, buf_len, "timeout");
|
|
break;
|
|
default:
|
|
BaseString::snprintf(buf, buf_len, "unknown error [code=%u]", code);
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Common class for arbitration signal data.
|
|
*/
|
|
class ArbitSignalData {
|
|
public:
|
|
Uint32 sender; // sender's node id (must be word 0)
|
|
Uint32 code; // result code or other info
|
|
Uint32 node; // arbitrator node id
|
|
ArbitTicket ticket; // ticket
|
|
NodeBitmask mask; // set of nodes
|
|
|
|
ArbitSignalData() {}
|
|
STATIC_CONST( SignalLength = 3 + ArbitTicket::DataLength + NodeBitmask::Size );
|
|
|
|
inline bool match(ArbitSignalData& aData) const {
|
|
return
|
|
node == aData.node &&
|
|
ticket.match(aData.ticket);
|
|
}
|
|
};
|
|
|
|
#endif
|