Skip to content

Commit d59c691

Browse files
author
Priyanka Sangam
committed
Bug#20617891: NDB : SUSPICIOUS HANDLING OF SIGNAL-WAIT TIMEOUT
IN NDBAPI In ndbapi, a signal timeout should be handled by setting the state to timed-out. A timed-out state can then be mapped to the error code 4008. However, the timed-out state is always overwritten to a success state. Modified the signal-timeout code so that the timed-out state is not overwritten.
1 parent 6faa082 commit d59c691

File tree

5 files changed

+41
-3
lines changed

5 files changed

+41
-3
lines changed

mysql-test/suite/ndb/r/ndb_err4012.result

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,14 @@ ERROR HY000: Got error 4012 'Request ndbd time-out, maybe due to high load or co
3333
SET SESSION debug=@save_debug;
3434
drop table t4;
3535
# bulk update ignore is not possible because 'ignore' disables bulk updates
36+
# mysqld gets timeout error 4008 on CREATE TABLE
37+
set @save_debug = @@session.debug;
38+
SET SESSION debug="+d,ndb_timeout_gettabinforeq";
39+
create table t4(id int primary key, val int)engine=ndb;
40+
ERROR HY000: Can't create table 'test.t4' (errno: 1625)
41+
show warnings;
42+
Level Code Message
43+
Warning 1296 Got error 4008 'Receive from NDB failed' from NDB
44+
Warning 1625 Bad schema for mysql.ndb_replication table. Message: Unable to retrieve mysql.ndb_replication, logging and conflict r
45+
Error 1005 Can't create table 'test.t4' (errno: 1625)
46+
SET SESSION debug=@save_debug;

mysql-test/suite/ndb/t/ndb_err4012.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,13 @@ SET SESSION debug=@save_debug;
4545
drop table t4;
4646

4747
--echo # bulk update ignore is not possible because 'ignore' disables bulk updates
48+
49+
--echo # mysqld gets timeout error 4008 on CREATE TABLE
50+
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "all error 6216" >> $NDB_TOOLS_OUTPUT
51+
set @save_debug = @@session.debug;
52+
SET SESSION debug="+d,ndb_timeout_gettabinforeq";
53+
--error 1005
54+
create table t4(id int primary key, val int)engine=ndb;
55+
show warnings;
56+
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "all error 0" >> $NDB_TOOLS_OUTPUT
57+
SET SESSION debug=@save_debug;

storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10185,6 +10185,15 @@ void Dbdict::execGET_TABINFOREQ(Signal* signal)
1018510185

1018610186
SectionHandle handle(this, signal);
1018710187

10188+
if(ERROR_INSERTED(6216))
10189+
{
10190+
ndbout_c("Delaying GSN_GET_TABINFOREQ\n");
10191+
sendSignalWithDelay(reference(), GSN_GET_TABINFOREQ, signal, 10000,
10192+
signal->length(),
10193+
&handle);
10194+
return;
10195+
}
10196+
1018810197
const bool useLongSig = (req->requestType & GetTabInfoReq::LongSignalConf);
1018910198
const bool byName = (req->requestType & GetTabInfoReq::RequestByName);
1019010199
const Uint32 transId = req->schemaTransId;

storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2544,10 +2544,18 @@ NdbDictInterface::getTable(class NdbApiSignal * signal,
25442544
Uint32 noOfSections, bool fullyQualifiedNames)
25452545
{
25462546
int errCodes[] = {GetTabInfoRef::Busy, 0 };
2547+
int timeout = DICT_WAITFOR_TIMEOUT;
2548+
DBUG_EXECUTE_IF("ndb_timeout_gettabinforeq", {
2549+
fprintf(stderr, "NdbDictInterface::getTable() times out in dictSignal WAIT_GET_TAB_INFO_REQ\n");
2550+
timeout = 1000;
2551+
});
2552+
25472553
int r = dictSignal(signal, ptr, noOfSections,
25482554
-1, // any node
25492555
WAIT_GET_TAB_INFO_REQ,
2550-
DICT_WAITFOR_TIMEOUT, 100, errCodes);
2556+
timeout, // parse stage
2557+
100,
2558+
errCodes);
25512559

25522560
if (r)
25532561
return 0;

storage/ndb/src/ndbapi/trp_client.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -198,6 +198,7 @@ int PollGuard::wait_for_input_in_loop(int wait_time, bool forceSend)
198198
else if (state == WAIT_NODE_FAILURE)
199199
{
200200
ret_val= -2;
201+
m_waiter->set_state(NO_WAIT);
201202
break;
202203
}
203204
if (wait_time == -1)
@@ -222,7 +223,6 @@ int PollGuard::wait_for_input_in_loop(int wait_time, bool forceSend)
222223
ndbout << "ERR: receiveResponse - theImpl->theWaiter.m_state = ";
223224
ndbout << m_waiter->get_state() << endl;
224225
#endif
225-
m_waiter->set_state(NO_WAIT);
226226
return ret_val;
227227
}
228228

0 commit comments

Comments
 (0)