Commit febc5460 authored by unknown's avatar unknown

Merge bk@192.168.21.1:mysql-4.1

into mysql.com:/home/hf/work/mysql-4.1.clean
parents 8f19b407 3d590258
......@@ -310,10 +310,11 @@ case $SYSTEM_TYPE in
fi
;;
*)
# Just to be safe, we test for ".so" anyway
eval shrexts=\"$shrext_cmds\"
if test \( -f "$mysql_zlib_dir/lib/libz.a" -o -f "$mysql_zlib_dir/lib/libz.so" -o \
-f "$mysql_zlib_dir/lib/libz$shrexts" \) \
# Test for libz using all known library file endings
if test \( -f "$mysql_zlib_dir/lib/libz.a" -o \
-f "$mysql_zlib_dir/lib/libz.so" -o \
-f "$mysql_zlib_dir/lib/libz.sl" -o \
-f "$mysql_zlib_dir/lib/libz.dylib" \) \
-a -f "$mysql_zlib_dir/include/zlib.h"; then
ZLIB_INCLUDES="-I$mysql_zlib_dir/include"
ZLIB_LIBS="-L$mysql_zlib_dir/lib -lz"
......@@ -968,7 +969,6 @@ AC_DEFUN([MYSQL_CHECK_VIO], [
AC_DEFUN([MYSQL_FIND_OPENSSL], [
incs="$1"
libs="$2"
eval shrexts=\"$shrext_cmds\"
case "$incs---$libs" in
---)
for d in /usr/ssl/include /usr/local/ssl/include /usr/include \
......@@ -982,8 +982,9 @@ AC_DEFUN([MYSQL_FIND_OPENSSL], [
for d in /usr/ssl/lib /usr/local/ssl/lib /usr/lib/openssl \
/usr/lib /usr/lib64 /opt/ssl/lib /opt/openssl/lib \
/usr/freeware/lib32 /usr/local/lib/ ; do
# Just to be safe, we test for ".so" anyway
if test -f $d/libssl.a || test -f $d/libssl.so || test -f $d/libssl$shrexts ; then
# Test for libssl using all known library file endings
if test -f $d/libssl.a || test -f $d/libssl.so || \
test -f $d/libssl.sl || test -f $d/libssl.dylib ; then
OPENSSL_LIB=$d
fi
done
......@@ -995,8 +996,9 @@ AC_DEFUN([MYSQL_FIND_OPENSSL], [
if test -f $incs/openssl/ssl.h ; then
OPENSSL_INCLUDE=-I$incs
fi
# Just to be safe, we test for ".so" anyway
if test -f $libs/libssl.a || test -f $libs/libssl.so || test -f "$libs/libssl$shrexts" ; then
# Test for libssl using all known library file endings
if test -f $libs/libssl.a || test -f $libs/libssl.so || \
test -f $libs/libssl.sl || test -f $d/libssl.dylib ; then
OPENSSL_LIB=$libs
fi
;;
......
......@@ -329,12 +329,14 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */
we want to make sure that no such flags are set.
*/
#if defined(HAVE_SIGACTION) && !defined(my_sigset)
#define my_sigset(A,B) do { struct sigaction s; sigset_t set; \
#define my_sigset(A,B) do { struct sigaction s; sigset_t set; int rc; \
DBUG_ASSERT((A) != 0); \
sigemptyset(&set); \
s.sa_handler = (B); \
s.sa_mask = set; \
s.sa_flags = 0; \
sigaction((A), &s, (struct sigaction *) NULL); \
rc= sigaction((A), &s, (struct sigaction *) NULL);\
DBUG_ASSERT(rc == 0); \
} while (0)
#elif defined(HAVE_SIGSET) && !defined(my_sigset)
#define my_sigset(A,B) sigset((A),(B))
......
......@@ -3613,6 +3613,37 @@ os_aio_posix_handle(
}
#endif
/**************************************************************************
Do a 'last millisecond' check that the page end is sensible;
reported page checksum errors from Linux seem to wipe over the page end. */
static
void
os_file_check_page_trailers(
/*========================*/
byte* combined_buf, /* in: combined write buffer */
ulint total_len) /* in: size of combined_buf, in bytes
(a multiple of UNIV_PAGE_SIZE) */
{
ulint len;
for (len = 0; len + UNIV_PAGE_SIZE <= total_len;
len += UNIV_PAGE_SIZE) {
byte* buf = combined_buf + len;
if (memcmp(buf + (FIL_PAGE_LSN + 4), buf + (UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4), 4)) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n"
"InnoDB: Writing a block of %lu bytes, currently at offset %lu\n",
(ulong)total_len, (ulong)len);
buf_page_print(buf);
fprintf(stderr,
"InnoDB: ERROR: The page to be written seems corrupt!\n");
}
}
}
/**************************************************************************
Does simulated aio. This function should be called by an i/o-handler
thread. */
......@@ -3650,7 +3681,6 @@ os_aio_simulated_handle(
ibool ret;
ulint n;
ulint i;
ulint len2;
segment = os_aio_get_array_and_local_segment(&array, global_segment);
......@@ -3857,33 +3887,16 @@ os_aio_simulated_handle(
(ulong) total_len);
ut_error;
}
/* Do a 'last millisecond' check that the page end
is sensible; reported page checksum errors from
Linux seem to wipe over the page end */
for (len2 = 0; len2 + UNIV_PAGE_SIZE <= total_len;
len2 += UNIV_PAGE_SIZE) {
if (mach_read_from_4(combined_buf + len2
+ FIL_PAGE_LSN + 4)
!= mach_read_from_4(combined_buf + len2
+ UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n");
fprintf(stderr,
"InnoDB: Writing a block of %lu bytes, currently writing at offset %lu\n",
(ulong)total_len, (ulong)len2);
buf_page_print(combined_buf + len2);
fprintf(stderr,
"InnoDB: ERROR: The page to be written seems corrupt!\n");
}
}
os_file_check_page_trailers(combined_buf, total_len);
}
ret = os_file_write(slot->name, slot->file, combined_buf,
slot->offset, slot->offset_high, total_len);
if (array == os_aio_write_array) {
os_file_check_page_trailers(combined_buf, total_len);
}
} else {
ret = os_file_read(slot->file, combined_buf,
slot->offset, slot->offset_high, total_len);
......
drop table if exists t1, t2;
create table t1 (a int key) engine=ndbcluster;
begin;
insert into t1 values (1);
insert into t1 values (2);
ERROR HY000: Got temporary error 4025 'Node failure caused abort of transaction' from ndbcluster
commit;
ERROR HY000: Got error 4350 'Transaction already aborted' from ndbcluster
drop table t1;
create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster;
insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1);
select * from t2 order by a limit 3;
a b
1 1
2 1
3 1
create table t2 (a int key) engine=ndbcluster;
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t2 order by a limit 3;
a
1
2
3
select * from t2 order by a limit 3;
ERROR HY000: Can't lock file (errno: 241)
select * from t2 order by a limit 3;
a
1
2
3
show tables;
Tables_in_test
create table t2 (a int key) engine=ndbcluster;
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t2 order by a limit 3;
a
1
2
3
select * from t2 order by a limit 3;
a
1
2
3
drop table t2;
......@@ -118,7 +118,7 @@ select HEX(f) from t4;
#14157: utf8 encoding in binlog without set character_set_client
#
flush logs;
--exec $MYSQL --character-sets-dir=../sql/share/charsets/ --default-character-set=koi8r test -e 'create table if not exists t5 (a int); set names koi8r; create temporary table ` ` (a int); insert into ` ` values (1); insert into t5 select * from ` `'
--exec $MYSQL --character-sets-dir=../sql/share/charsets/ --default-character-set=koi8r test -e 'create table if not exists t5 (a int); set names koi8r; create temporary table `` (a int); insert into `` values (1); insert into t5 select * from ``'
# resulted log is client charset insensitive (latin1 not koi8r) as it must be
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000006 | $MYSQL --default-character-set=latin1
......
-- source include/have_ndb.inc
-- source include/have_multi_ndb.inc
-- source include/not_embedded.inc
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
#
# Transaction ongoing while cluster is restarted
#
--connection server1
create table t1 (a int key) engine=ndbcluster;
begin;
insert into t1 values (1);
--exec $NDB_MGM --no-defaults -e "all restart" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
--error 1297
insert into t1 values (2);
--error 1296
commit;
drop table t1;
#
# Stale cache after restart -i
#
--connection server1
create table t2 (a int, b int, primary key(a,b)) engine=ndbcluster;
insert into t2 values (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1),(10,1);
select * from t2 order by a limit 3;
--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
--connection server2
create table t2 (a int key) engine=ndbcluster;
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t2 order by a limit 3;
# server 1 should have a stale cache, and in this case wrong frm, transaction must be retried
--connection server1
--error 1015
select * from t2 order by a limit 3;
select * from t2 order by a limit 3;
--exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT
--exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults >> $NDB_TOOLS_OUTPUT
--connection server1
show tables;
create table t2 (a int key) engine=ndbcluster;
insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t2 order by a limit 3;
# server 2 should have a stale cache, but with right frm, transaction need not be retried
--connection server2
select * from t2 order by a limit 3;
drop table t2;
# End of 4.1 tests
......@@ -164,7 +164,7 @@ drop table t1;
#
#14157: utf8 encoding in binlog without set character_set_client
#
--exec $MYSQL --character-sets-dir=../sql/share/charsets/ --default-character-set=koi8r test -e 'create table t1 (a int); set names koi8r; create temporary table `ÔÏÌØËÏ ÇÅÒÏÉ ÓÒÅÚÁÀÔ ÒÁÛÐÉÌÅÍ ÇÒÉÍ` (a int); insert into `ÔÏÌØËÏ ÇÅÒÏÉ ÓÒÅÚÁÀÔ ÒÁÛÐÉÌÅÍ ÇÒÉÍ` values (1); insert into t1 select * from `ÔÏÌØËÏ ÇÅÒÏÉ ÓÒÅÚÁÀÔ ÒÁÛÐÉÌÅÍ ÇÒÉÍ`'
--exec $MYSQL --character-sets-dir=../sql/share/charsets/ --default-character-set=latin1 test -e 'create table t1 (a int); set names latin1; create temporary table `äöüÄÖÜ` (a int); insert into `äöüÄÖÜ` values (1); insert into t1 select * from `äöüÄÖÜ`'
sync_slave_with_master;
#connection slave;
......
......@@ -65,6 +65,7 @@
#define CFG_DB_BACKUP_DATA_BUFFER_MEM 134
#define CFG_DB_BACKUP_LOG_BUFFER_MEM 135
#define CFG_DB_BACKUP_WRITE_SIZE 136
#define CFG_DB_BACKUP_MAX_WRITE_SIZE 139
#define CFG_LOG_DESTINATION 147
......
......@@ -83,6 +83,7 @@ public:
void set_optimized_node_selection(int val);
unsigned no_db_nodes();
unsigned get_connect_count() const;
#endif
private:
......
......@@ -74,7 +74,7 @@ public:
/**
* Constructor / Destructor
*/
SocketServer(int maxSessions = 32);
SocketServer(unsigned maxSessions = ~(unsigned)0);
~SocketServer();
/**
......
......@@ -100,10 +100,10 @@ Transporter::connect_server(NDB_SOCKET_TYPE sockfd) {
}
{
struct sockaddr addr;
struct sockaddr_in addr;
SOCKET_SIZE_TYPE addrlen= sizeof(addr);
int r= getpeername(sockfd, &addr, &addrlen);
m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr;
int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen);
m_connect_address= (&addr)->sin_addr;
}
bool res = connect_server_impl(sockfd);
......@@ -173,10 +173,10 @@ Transporter::connect_client() {
}
{
struct sockaddr addr;
struct sockaddr_in addr;
SOCKET_SIZE_TYPE addrlen= sizeof(addr);
int r= getpeername(sockfd, &addr, &addrlen);
m_connect_address= ((struct sockaddr_in *)&addr)->sin_addr;
int r= getpeername(sockfd, (struct sockaddr*)&addr, &addrlen);
m_connect_address= (&addr)->sin_addr;
}
bool res = connect_client_impl(sockfd);
......
......@@ -27,7 +27,7 @@
#define DEBUG(x) ndbout << x << endl;
SocketServer::SocketServer(int maxSessions) :
SocketServer::SocketServer(unsigned maxSessions) :
m_sessions(10),
m_services(5)
{
......@@ -124,7 +124,7 @@ SocketServer::setup(SocketServer::Service * service,
DBUG_RETURN(false);
}
if (listen(sock, m_maxSessions) == -1){
if (listen(sock, m_maxSessions > 32 ? 32 : m_maxSessions) == -1){
DBUG_PRINT("error",("listen() - %d - %s",
errno, strerror(errno)));
NDB_CLOSE_SOCKET(sock);
......
......@@ -66,15 +66,16 @@ Backup::Backup(const Configuration & conf) :
Uint32 szDataBuf = (2 * 1024 * 1024);
Uint32 szLogBuf = (2 * 1024 * 1024);
Uint32 szWrite = 32768;
Uint32 szWrite = 32768, maxWriteSize = (256 * 1024);
ndb_mgm_get_int_parameter(p, CFG_DB_BACKUP_DATA_BUFFER_MEM, &szDataBuf);
ndb_mgm_get_int_parameter(p, CFG_DB_BACKUP_LOG_BUFFER_MEM, &szLogBuf);
ndb_mgm_get_int_parameter(p, CFG_DB_BACKUP_WRITE_SIZE, &szWrite);
ndb_mgm_get_int_parameter(p, CFG_DB_BACKUP_MAX_WRITE_SIZE, &maxWriteSize);
c_defaults.m_logBufferSize = szLogBuf;
c_defaults.m_dataBufferSize = szDataBuf;
c_defaults.m_minWriteSize = szWrite;
c_defaults.m_maxWriteSize = szWrite;
c_defaults.m_maxWriteSize = maxWriteSize;
{ // Init all tables
ArrayList<Table> tables(c_tablePool);
......
......@@ -1494,6 +1494,7 @@ int Dbtup::interpreterNextLab(Signal* signal,
// word read. Thus we set the register to be a 32 bit register.
/* ------------------------------------------------------------- */
TregMemBuffer[theRegister] = 0x50;
// arithmetic conversion if big-endian
* (Int64*)(TregMemBuffer+theRegister+2) = TregMemBuffer[theRegister+1];
} else if (TnoDataRW == 3) {
/* ------------------------------------------------------------- */
......@@ -1557,6 +1558,11 @@ int Dbtup::interpreterNextLab(Signal* signal,
Tlen = TattrNoOfWords + 1;
if (Toptype == ZUPDATE) {
if (TattrNoOfWords <= 2) {
if (TattrNoOfWords == 1) {
// arithmetic conversion if big-endian
TdataForUpdate[1] = *(Int64*)&TregMemBuffer[theRegister + 2];
TdataForUpdate[2] = 0;
}
if (TregType == 0) {
/* --------------------------------------------------------- */
// Write a NULL value into the attribute
......
......@@ -638,10 +638,12 @@ ndb_mgm_get_status(NdbMgmHandle handle)
Vector<BaseString> split;
tmp.split(split, ":");
if(split.size() != 2){
SET_ERROR(handle, NDB_MGM_ILLEGAL_NODE_STATUS, buf);
return NULL;
}
if(!(split[0].trim() == "nodes")){
SET_ERROR(handle, NDB_MGM_ILLEGAL_NODE_STATUS, buf);
return NULL;
}
......@@ -690,6 +692,7 @@ ndb_mgm_get_status(NdbMgmHandle handle)
if(i+1 != noOfNodes){
free(state);
SET_ERROR(handle, NDB_MGM_ILLEGAL_NODE_STATUS, "Node count mismatch");
return NULL;
}
......
......@@ -1191,7 +1191,19 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
false,
ConfigInfo::CI_INT,
"32K",
"0",
"2K",
STR_VALUE(MAX_INT_RNIL) },
{
CFG_DB_BACKUP_MAX_WRITE_SIZE,
"BackupMaxWriteSize",
DB_TOKEN,
"Max size of filesystem writes made by backup (in bytes)",
ConfigInfo::CI_USED,
false,
ConfigInfo::CI_INT,
"256K",
"2K",
STR_VALUE(MAX_INT_RNIL) },
/***************************************************************************
......
......@@ -2107,6 +2107,7 @@ int
MgmtSrvr::abortBackup(Uint32 backupId)
{
SignalSender ss(theFacade);
ss.lock(); // lock will be released on exit
bool next;
NodeId nodeId = 0;
......
......@@ -427,9 +427,9 @@ MgmApiSession::get_nodeid(Parser_t::Context &,
return;
}
struct sockaddr addr;
struct sockaddr_in addr;
SOCKET_SIZE_TYPE addrlen= sizeof(addr);
int r = getpeername(m_socket, &addr, &addrlen);
int r = getpeername(m_socket, (struct sockaddr*)&addr, &addrlen);
if (r != 0 ) {
m_output->println(cmd);
m_output->println("result: getpeername(%d) failed, err= %d", m_socket, r);
......@@ -441,7 +441,7 @@ MgmApiSession::get_nodeid(Parser_t::Context &,
if(tmp == 0 || !m_allocated_resources->is_reserved(tmp)){
BaseString error_string;
if (!m_mgmsrv.alloc_node_id(&tmp, (enum ndb_mgm_node_type)nodetype,
&addr, &addrlen, error_string)){
(struct sockaddr*)&addr, &addrlen, error_string)){
const char *alias;
const char *str;
alias= ndb_mgm_get_node_type_alias_string((enum ndb_mgm_node_type)
......
......@@ -70,6 +70,7 @@ ClusterMgr::ClusterMgr(TransporterFacade & _facade):
noOfAliveNodes= 0;
noOfConnectedNodes= 0;
theClusterMgrThread= 0;
m_connect_count = 0;
DBUG_VOID_RETURN;
}
......@@ -456,6 +457,10 @@ ClusterMgr::reportNodeFailed(NodeId nodeId){
theNode.nfCompleteRep = false;
if(noOfAliveNodes == 0){
theFacade.m_globalDictCache.lock();
theFacade.m_globalDictCache.invalidate_all();
theFacade.m_globalDictCache.unlock();
m_connect_count ++;
NFCompleteRep rep;
for(Uint32 i = 1; i<MAX_NODES; i++){
if(theNodes[i].defined && theNodes[i].nfCompleteRep == false){
......
......@@ -78,6 +78,7 @@ public:
const Node & getNodeInfo(NodeId) const;
Uint32 getNoOfConnectedNodes() const;
Uint32 m_connect_count;
private:
Uint32 noOfAliveNodes;
......
......@@ -255,6 +255,42 @@ GlobalDictCache::drop(NdbTableImpl * tab)
abort();
}
unsigned
GlobalDictCache::get_size()
{
NdbElement_t<Vector<TableVersion> > * curr = m_tableHash.getNext(0);
int sz = 0;
while(curr != 0){
sz += curr->theData->size();
curr = m_tableHash.getNext(curr);
}
return sz;
}
void
GlobalDictCache::invalidate_all()
{
DBUG_ENTER("GlobalDictCache::invalidate_all");
NdbElement_t<Vector<TableVersion> > * curr = m_tableHash.getNext(0);
while(curr != 0){
Vector<TableVersion> * vers = curr->theData;
if (vers->size())
{
TableVersion * ver = & vers->back();
ver->m_impl->m_status = NdbDictionary::Object::Invalid;
ver->m_status = DROPPED;
if (ver->m_refCount == 0)
{
delete ver->m_impl;
vers->erase(vers->size() - 1);
}
}
curr = m_tableHash.getNext(curr);
}
DBUG_VOID_RETURN;
}
void
GlobalDictCache::release(NdbTableImpl * tab){
unsigned i;
......
......@@ -71,6 +71,9 @@ public:
void alter_table_rep(const char * name,
Uint32 tableId, Uint32 tableVersion, bool altered);
unsigned get_size();
void invalidate_all();
public:
enum Status {
OK = 0,
......
......@@ -75,7 +75,9 @@ SignalSender::SignalSender(TransporterFacade *facade)
{
m_cond = NdbCondition_Create();
theFacade = facade;
lock();
m_blockNo = theFacade->open(this, execSignal, execNodeStatus);
unlock();
assert(m_blockNo > 0);
}
......
......@@ -264,6 +264,12 @@ TransporterFacade::unlock_mutex()
#include "ClusterMgr.hpp"
inline
unsigned Ndb_cluster_connection_impl::get_connect_count() const
{
return TransporterFacade::instance()->theClusterMgr->m_connect_count;
}
inline
bool
TransporterFacade::check_send_size(Uint32 node_id, Uint32 send_size)
......
......@@ -236,6 +236,12 @@ Ndb_cluster_connection::wait_until_ready(int timeout,
} while (1);
}
unsigned Ndb_cluster_connection::get_connect_count() const
{
return m_impl.get_connect_count();
}
/*
......
......@@ -49,6 +49,7 @@ class Ndb_cluster_connection_impl : public Ndb_cluster_connection
void init_get_next_node(Ndb_cluster_connection_node_iter &iter);
Uint32 get_next_node(Ndb_cluster_connection_node_iter &iter);
inline unsigned get_connect_count() const;
private:
friend class Ndb;
friend class NdbImpl;
......
......@@ -24,6 +24,7 @@ testOIBasic \
testOperations \
testRestartGci \
testScan \
testInterpreter \
testScanInterpreter \
testScanPerf \
testSystemRestart \
......@@ -61,6 +62,7 @@ testOIBasic_SOURCES = testOIBasic.cpp
testOperations_SOURCES = testOperations.cpp
testRestartGci_SOURCES = testRestartGci.cpp
testScan_SOURCES = testScan.cpp ScanFunctions.hpp
testInterpreter_SOURCES = testInterpreter.cpp
testScanInterpreter_SOURCES = testScanInterpreter.cpp ScanFilter.hpp ScanInterpretTest.hpp
testScanPerf_SOURCES = testScanPerf.cpp
testSystemRestart_SOURCES = testSystemRestart.cpp
......@@ -152,3 +154,4 @@ testScan.dsp: Makefile \
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(testScan_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LINK $(LDADD)
......@@ -79,46 +79,46 @@ int runTestIncValue32(NDBT_Context* ctx, NDBT_Step* step){
Ndb* pNdb = GETNDB(step);
NdbConnection* pTrans = pNdb->startTransaction();
if (pTrans == NULL){
ERR(pNdb->getNdbError());
return NDBT_FAILED;
}
NdbOperation* pOp = pTrans->getNdbOperation(pTab->getName());
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
int check = pOp->interpretedUpdateTuple();
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
// Primary keys
Uint32 pkVal = 1;
check = pOp->equal("KOL1", pkVal );
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
// Attributes
// Update column
Uint32 valToIncWith = 1;
check = pOp->incValue("KOL2", valToIncWith);
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
NdbConnection* pTrans = pNdb->startTransaction();
if (pTrans == NULL){
ERR(pNdb->getNdbError());
return NDBT_FAILED;
}
NdbOperation* pOp = pTrans->getNdbOperation(pTab->getName());
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
int check = pOp->interpretedUpdateTuple();
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
// Primary keys
Uint32 pkVal = 1;
check = pOp->equal("KOL1", pkVal );
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
// Attributes
// Update column
Uint32 valToIncWith = 1;
check = pOp->incValue("KOL2", valToIncWith);
if( check == -1 ) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
NdbRecAttr* valueRec = pOp->getValue("KOL2");
if( valueRec == NULL ) {
......@@ -142,6 +142,122 @@ int runTestIncValue32(NDBT_Context* ctx, NDBT_Step* step){
return NDBT_OK;
}
int runTestBug19537(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
const NdbDictionary::Table * pTab = ctx->getTab();
Ndb* pNdb = GETNDB(step);
if (strcmp(pTab->getName(), "T1") != 0) {
g_err << "runTestBug19537: skip, table != T1" << endl;
return NDBT_OK;
}
NdbConnection* pTrans = pNdb->startTransaction();
if (pTrans == NULL){
ERR(pNdb->getNdbError());
return NDBT_FAILED;
}
NdbOperation* pOp = pTrans->getNdbOperation(pTab->getName());
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
if (pOp->interpretedUpdateTuple() == -1) {
ERR(pOp->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
// Primary keys
const Uint32 pkVal = 1;
if (pOp->equal("KOL1", pkVal) == -1) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
// Load 64-bit constant into register 1 and
// write from register 1 to 32-bit column KOL2
const Uint64 reg_val = 0x0102030405060708ULL;
const Uint32* reg_ptr32 = (const Uint32*)&reg_val;
if (reg_ptr32[0] == 0x05060708 && reg_ptr32[1] == 0x01020304) {
g_err << "runTestBug19537: platform is LITTLE endian" << endl;
} else if (reg_ptr32[0] == 0x01020304 && reg_ptr32[1] == 0x05060708) {
g_err << "runTestBug19537: platform is BIG endian" << endl;
} else {
g_err << "runTestBug19537: impossible platform"
<< hex << " [0]=" << reg_ptr32[0] << " [1]=" <<reg_ptr32[1] << endl;
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
if (pOp->load_const_u64(1, reg_val) == -1 ||
pOp->write_attr("KOL2", 1) == -1) {
ERR(pOp->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
if (pTrans->execute(Commit) == -1) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
// Read value via a new transaction
pTrans = pNdb->startTransaction();
if (pTrans == NULL){
ERR(pNdb->getNdbError());
return NDBT_FAILED;
}
pOp = pTrans->getNdbOperation(pTab->getName());
if (pOp == NULL) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
Uint32 kol2 = 0x09090909;
if (pOp->readTuple() == -1 ||
pOp->equal("KOL1", pkVal) == -1 ||
pOp->getValue("KOL2", (char*)&kol2) == 0) {
ERR(pOp->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
if (pTrans->execute(Commit) == -1) {
ERR(pTrans->getNdbError());
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
// Expected conversion as in C - truncate to lower (logical) word
if (kol2 == 0x01020304) {
g_err << "runTestBug19537: the bug manifests itself !" << endl;
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
if (kol2 != 0x05060708) {
g_err << "runTestBug19537: impossible KOL2 " << hex << kol2 << endl;
pNdb->closeTransaction(pTrans);
return NDBT_FAILED;
}
pNdb->closeTransaction(pTrans);
return NDBT_OK;
}
NDBT_TESTSUITE(testInterpreter);
TESTCASE("IncValue32",
......@@ -156,6 +272,12 @@ TESTCASE("IncValue64",
INITIALIZER(runTestIncValue64);
FINALIZER(runClearTable);
}
TESTCASE("Bug19537",
"Test big-endian write_attr of 32 bit integer\n"){
INITIALIZER(runLoadTable);
INITIALIZER(runTestBug19537);
FINALIZER(runClearTable);
}
#if 0
TESTCASE("MaxTransactions",
"Start transactions until no more can be created\n"){
......
......@@ -129,6 +129,12 @@ getStatus(){
ndbout << "status==NULL, retries="<<retries<<endl;
MGMERR(handle);
retries++;
ndb_mgm_disconnect(handle);
if (ndb_mgm_connect(handle,0,0,1)) {
MGMERR(handle);
g_err << "Reconnect failed" << endl;
break;
}
continue;
}
int count = status->no_of_nodes;
......
......@@ -3431,6 +3431,8 @@ ha_innobase::index_prev(
mysql_byte* buf) /* in/out: buffer for previous row in MySQL
format */
{
statistic_increment(ha_read_prev_count, &LOCK_status);
return(general_fetch(buf, ROW_SEL_PREV, 0));
}
......
......@@ -3306,8 +3306,23 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
{
m_table= (void *)tab;
m_table_version = tab->getObjectVersion();
if (!(my_errno= build_index_list(ndb, table, ILBP_OPEN)))
if ((my_errno= build_index_list(ndb, table, ILBP_OPEN)))
DBUG_RETURN(my_errno);
const void *data, *pack_data;
uint length, pack_length;
if (readfrm(table->path, &data, &length) ||
packfrm(data, length, &pack_data, &pack_length) ||
pack_length != tab->getFrmLength() ||
memcmp(pack_data, tab->getFrmData(), pack_length))
{
my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR));
NdbError err= ndb->getNdbError(NDB_INVALID_SCHEMA_OBJECT);
DBUG_RETURN(ndb_to_mysql_error(&err));
}
my_free((char*)data, MYF(MY_ALLOW_ZERO_PTR));
my_free((char*)pack_data, MYF(MY_ALLOW_ZERO_PTR));
}
m_table_info= tab_info;
}
......
......@@ -884,7 +884,8 @@ static void __cdecl kill_server(int sig_ptr)
RETURN_FROM_KILL_SERVER;
kill_in_progress=TRUE;
abort_loop=1; // This should be set
my_sigset(sig,SIG_IGN);
if (sig != 0) // 0 is not a valid signal number
my_sigset(sig,SIG_IGN);
if (sig == MYSQL_KILL_SIGNAL || sig == 0)
sql_print_information(ER(ER_NORMAL_SHUTDOWN),my_progname);
else
......
......@@ -238,6 +238,7 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-$PATH}\" \
--enable-local-infile \
--with-mysqld-user=%{mysqld_user} \
--with-unix-socket-path=/var/lib/mysql/mysql.sock \
--with-pic \
--prefix=/ \
--exec-prefix=%{_exec_prefix} \
--libexecdir=%{_sbindir} \
......@@ -644,6 +645,7 @@ fi
%attr(755, root, root) %{_bindir}/ndb_desc
%attr(755, root, root) %{_bindir}/ndb_show_tables
%attr(755, root, root) %{_bindir}/ndb_test_platform
%attr(755, root, root) %{_bindir}/ndb_config
%files ndb-extra
%defattr(-,root,root,0755)
......@@ -709,6 +711,10 @@ fi
# itself - note that they must be ordered by date (important when
# merging BK trees)
%changelog
* Sat May 20 2006 Kent Boortz <kent@mysql.com>
- Always compile for PIC, position independent code.
* Wed May 10 2006 Kent Boortz <kent@mysql.com>
- Use character set "all" for the "max", to make Cluster nodes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment