Merge mysql.com:/home/jonas/src/mysql-5.0

into mysql.com:/home/jonas/src/mysql-5.0-ndb
This commit is contained in:
joreland@mysql.com 2005-06-08 17:12:08 +02:00
commit dc191d5b17
44 changed files with 551 additions and 120 deletions

View file

@ -102,6 +102,7 @@ Makefile.in
Makefile.in'
PENDING/*
TAGS
VC++Files/client/mysql_amd64.dsp
ac_available_languages_fragment
acinclude.m4
aclocal.m4
@ -274,6 +275,8 @@ client/mysqlmanager-pwgen
client/mysqlmanagerc
client/mysqlshow
client/mysqltest
client/mysqltestmanager-pwgen
client/mysqltestmanagerc
client/mysys_priv.h
client/select_test
client/ssl_test
@ -284,10 +287,12 @@ cmd-line-utils/libedit/common.h
cmd-line-utils/libedit/makelist
comon.h
config.cache
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
configure.lineno
core
@ -355,6 +360,7 @@ innobase/ib_config.h.in
innobase/stamp-h1
insert_test
install
install-sh
isam/isamchk
isam/isamlog
isam/pack_isam
@ -519,7 +525,9 @@ linked_libmysqldex_sources
linked_server_sources
linked_tools_sources
locked
ltmain.sh
man/*.1
missing
mit-pthreads/config.flags
mit-pthreads/include/bits
mit-pthreads/include/pthread/machdep.h
@ -936,6 +944,7 @@ scripts/mysqld_multi
scripts/mysqld_safe
scripts/mysqldumpslow
scripts/mysqlhotcopy
scripts/mysqlhotcopy.sh.rej
scripts/safe_mysqld
select_test
server-tools/instance-manager/client.c
@ -1100,18 +1109,10 @@ tmp/*
tools/my_vsnprintf.c
tools/mysqlmanager
tools/mysqlmngd
tools/mysqltestmanager
tools/mysys_priv.h
vi.h
vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
VC++Files/client/mysql_amd64.dsp
client/mysqltestmanager-pwgen
client/mysqltestmanagerc
tools/mysqltestmanager
config.guess
config.sub
install-sh
ltmain.sh
missing

View file

@ -52,6 +52,7 @@ dlenev@build.mysql.com
dlenev@jabberwock.localdomain
dlenev@mysql.com
ejonore@mc03.ndb.mysql.com
elliot@mysql.com
evgen@moonbone.(none)
evgen@moonbone.local
gbichot@bk-internal.mysql.com

View file

@ -6,7 +6,7 @@ AC_PREREQ(2.50)dnl Minimum Autoconf version required.
AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM
# Don't forget to also update the NDB lines below.
AM_INIT_AUTOMAKE(mysql, 5.0.7-beta)
AM_INIT_AUTOMAKE(mysql, 5.0.8-beta)
AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10
@ -17,7 +17,7 @@ SHARED_LIB_VERSION=14:0:0
# ndb version
NDB_VERSION_MAJOR=5
NDB_VERSION_MINOR=0
NDB_VERSION_BUILD=7
NDB_VERSION_BUILD=8
NDB_VERSION_STATUS="beta"
# Set all version vars based on $VERSION. How do we do this more elegant ?

View file

@ -107,7 +107,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
}
if (keyseg->flag & HA_SPACE_PACK)
{
end=pos+length;
end= pos + length;
if (type != HA_KEYTYPE_NUM)
{
while (end > pos && end[-1] == ' ')

View file

@ -68,7 +68,7 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
info->lastkey_length,SEARCH_BIGGER,
info->s->state.key_root[inx])))
break;
if (ha_key_cmp(keyinfo->seg,info->lastkey2,info->lastkey,
if (ha_key_cmp(keyinfo->seg, info->lastkey, info->lastkey2,
info->last_rkey_length, SEARCH_FIND, &not_used))
{
error=1;

View file

@ -70,6 +70,7 @@ install-data-local:
$(DESTDIR)$(testdir)/lib
$(INSTALL_DATA) $(srcdir)/README $(DESTDIR)$(testdir)
$(INSTALL_DATA) $(srcdir)/t/*.test $(DESTDIR)$(testdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.sql $(DESTDIR)$(testdir)/t
-$(INSTALL_DATA) $(srcdir)/t/*.disabled $(DESTDIR)$(testdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.opt $(DESTDIR)$(testdir)/t
$(INSTALL_DATA) $(srcdir)/t/*.sh $(DESTDIR)$(testdir)/t

View file

@ -891,3 +891,17 @@ string
create table t1 (a varchar(255)) default character set utf8;
insert into t1 values (1.0);
drop table t1;
create table t1 (
id int not null,
city varchar(20) not null,
key (city(7),id)
) character set=utf8;
insert into t1 values (1,'Durban North');
insert into t1 values (2,'Durban');
select * from t1 where city = 'Durban';
id city
2 Durban
select * from t1 where city = 'Durban ';
id city
2 Durban
drop table t1;

View file

@ -130,3 +130,16 @@ Warnings:
Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
select rand(rand);
ERROR 42S22: Unknown column 'rand' in 'field list'
create table t1 (col1 int, col2 decimal(60,30));
insert into t1 values(1,1234567890.12345);
select format(col2,7) from t1;
format(col2,7)
1,234,567,890.1234500
select format(col2,8) from t1;
format(col2,8)
1,234,567,890.12345000
insert into t1 values(7,1234567890123456.12345);
select format(col2,6) from t1 where col1=7;
format(col2,6)
1,234,567,890,123,456.123450
drop table t1;

View file

@ -471,13 +471,13 @@ execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32929 0 63
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 14 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
@ -487,13 +487,13 @@ execute stmt1 using @arg00;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 5 N 1 31 8
def table 253 64 2 Y 0 31 8
def type 253 10 5 Y 0 31 8
def possible_keys 253 4096 7 Y 0 31 8
def key 253 64 7 Y 0 31 8
def key_len 253 4096 1 Y 128 31 63
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32929 0 63
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 27 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort

View file

@ -1152,13 +1152,13 @@ execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32929 0 63
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2

View file

@ -1152,13 +1152,13 @@ execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32929 0 63
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2

View file

@ -1153,13 +1153,13 @@ execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32929 0 63
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2

View file

@ -1195,13 +1195,13 @@ execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32929 0 63
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
@ -4207,13 +4207,13 @@ execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32929 0 63
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2

View file

@ -1152,13 +1152,13 @@ execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32929 0 63
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 3

View file

@ -1,4 +1,6 @@
use test; drop table if exists t1, t9 ; create table t1
use test;
drop table if exists t1, t9 ;
create table t1
(
a int, b varchar(30),
primary key(a)
@ -442,9 +444,10 @@ limit 1 ';
execute stmt1 ;
a b
1 one
prepare stmt1 from ' select a,b from t1
limit ? ';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2
prepare stmt1 from ' select a,b from t1 limit ? ';
execute stmt1 using @arg00;
a b
3 three
set @arg00='b' ;
set @arg01=0 ;
set @arg02=2 ;
@ -1149,13 +1152,13 @@ execute stmt1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def table 253 64 2 Y 0 31 8
def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 128 31 63
def ref 253 1024 0 Y 0 31 8
def rows 8 10 1 N 32929 0 63
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2

View file

@ -414,8 +414,8 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2
Warning 1264 Out of range value adjusted for column 'a' at row 7
select * from t1;
a
9999999999
9999999999
0
0
1
1
1
@ -430,8 +430,8 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2
Warning 1264 Out of range value adjusted for column 'a' at row 7
select * from t1;
a
9999999999
9999999999
0000000000
0000000000
0000000001
0000000001
0000000001
@ -446,8 +446,8 @@ Warning 1264 Out of range value adjusted for column 'a' at row 2
Warning 1264 Out of range value adjusted for column 'a' at row 7
select * from t1;
a
9999999999
9999999999
0000000000
0000000000
0000000001
0000000001
0000000001

View file

@ -119,7 +119,7 @@ a
99.99
99.99
99.99
99.99
0.00
0.00
0.00
0.00
@ -891,3 +891,21 @@ NULL
select abs(NULL);
abs(NULL)
NULL
set @@sql_mode='traditional';
create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (22) unsigned);
insert into t1 values(1,-1,-1);
ERROR 22003: Out of range value adjusted for column 'd2' at row 1
drop table t1;
set @@div_precision_increment=15;
create table t1 (col1 int, col2 decimal(30,25), col3 numeric(30,25));
insert into t1 values (1,0.0123456789012345678912345,0.0123456789012345678912345);
select col2/9999999999 from t1 where col1=1;
col2/9999999999
0.000000000001234567890246913578
select 9999999999/col2 from t1 where col1=1;
9999999999/col2
810000007209.000065537105051
select 77777777/7777777;
77777777/7777777
10.000000900000090
drop table t1;

View file

@ -731,3 +731,18 @@ select ifnull(NULL, _utf8'string');
create table t1 (a varchar(255)) default character set utf8;
insert into t1 values (1.0);
drop table t1;
#
# Bug#10253 compound index length and utf8 char set
# produces invalid query results
#
create table t1 (
id int not null,
city varchar(20) not null,
key (city(7),id)
) character set=utf8;
insert into t1 values (1,'Durban North');
insert into t1 values (2,'Durban');
select * from t1 where city = 'Durban';
select * from t1 where city = 'Durban ';
drop table t1;

View file

@ -67,3 +67,15 @@ explain extended select degrees(pi()),radians(360);
--error 1054
select rand(rand);
#
# Bug #8459 (FORMAT returns incorrect result)
#
create table t1 (col1 int, col2 decimal(60,30));
insert into t1 values(1,1234567890.12345);
select format(col2,7) from t1;
select format(col2,8) from t1;
insert into t1 values(7,1234567890123456.12345);
select format(col2,6) from t1 where col1=7;
drop table t1;

View file

@ -3267,12 +3267,6 @@ drop procedure bug8762|
#
# BUG#5240: Stored procedure crash if function has cursor declaration
#
# The following test case fails in --ps-protocol mode due to some bugs
# in algorithm which calculates list of tables to be locked for queries
# using Stored Functions. It is disabled until Dmitri fixes this.
#
--disable_ps_protocol
--disable_warnings
drop function if exists bug5240|
--enable_warnings
@ -3292,8 +3286,6 @@ insert into t1 values ("answer", 42)|
select id, bug5240() from t1|
drop function bug5240|
--enable_ps_protocol
#
# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
#

View file

@ -925,3 +925,24 @@ DROP TABLE t1;
select abs(10/0);
select abs(NULL);
#
# Bug #9894 (negative to unsigned column)
#
set @@sql_mode='traditional';
create table t1( d1 decimal(18) unsigned, d2 decimal(20) unsigned, d3 decimal (22) unsigned);
--error 1264
insert into t1 values(1,-1,-1);
drop table t1;
#
# Bug #8425 (insufficient precision of the division)
#
set @@div_precision_increment=15;
create table t1 (col1 int, col2 decimal(30,25), col3 numeric(30,25));
insert into t1 values (1,0.0123456789012345678912345,0.0123456789012345678912345);
select col2/9999999999 from t1 where col1=1;
select 9999999999/col2 from t1 where col1=1;
select 77777777/7777777;
drop table t1;

View file

@ -188,7 +188,7 @@ IPCConfig::configureTransporters(Uint32 nodeId,
if(iter.get(CFG_NODE_HOST, &hostname)) continue;
if( strlen(hostname) == 0 ) continue;
if(iter.get(CFG_MGM_PORT, &port)) continue;
connect_string.appfmt("%s%s:port",separator,hostname,port);
connect_string.appfmt("%s%s:%u",separator,hostname,port);
separator= ",";
}
NdbMgmHandle h= ndb_mgm_create_handle();

View file

@ -1676,13 +1676,30 @@ Backup::execWAIT_GCP_CONF(Signal* signal){
ptr.p->masterData.sendCounter= 0;
ptr.p->masterData.gsn = GSN_BACKUP_FRAGMENT_REQ;
nextFragment(signal, ptr);
return;
} else {
jam();
if(gcp >= ptr.p->startGCP + 3)
{
CRASH_INSERTION((10009));
ptr.p->stopGCP = gcp;
sendDropTrig(signal, ptr); // regular dropping of triggers
return;
}//if
/**
* Make sure that we got entire stopGCP
*/
WaitGCPReq * req = (WaitGCPReq*)signal->getDataPtrSend();
req->senderRef = reference();
req->senderData = ptr.i;
req->requestType = WaitGCPReq::CompleteForceStart;
sendSignal(DBDIH_REF, GSN_WAIT_GCP_REQ, signal,
WaitGCPReq::SignalLength,JBB);
return;
}
}
/*****************************************************************************
*
* Master functionallity - Backup fragment

View file

@ -1668,7 +1668,7 @@ void Dbacc::initOpRec(Signal* signal)
void Dbacc::sendAcckeyconf(Signal* signal)
{
signal->theData[0] = operationRecPtr.p->userptr;
signal->theData[1] = operationRecPtr.p->insertIsDone;
signal->theData[1] = operationRecPtr.p->operation;
signal->theData[2] = operationRecPtr.p->fid;
signal->theData[3] = operationRecPtr.p->localdata[0];
signal->theData[4] = operationRecPtr.p->localdata[1];
@ -1754,6 +1754,11 @@ void Dbacc::execACCKEYREQ(Signal* signal)
case ZWRITE:
case ZSCAN_OP:
if (!tgeLocked){
if(operationRecPtr.p->operation == ZWRITE)
{
jam();
operationRecPtr.p->operation = ZUPDATE;
}
sendAcckeyconf(signal);
if (operationRecPtr.p->dirtyRead == ZFALSE) {
/*---------------------------------------------------------------*/
@ -2279,6 +2284,12 @@ Uint32 Dbacc::placeWriteInLockQueue(Signal* signal)
return ZWRITE_ERROR;
}//if
if(operationRecPtr.p->operation == ZWRITE)
{
operationRecPtr.p->operation =
(mlpqOperPtr.p->operation == ZDELETE) ? ZINSERT : ZUPDATE;
}
operationRecPtr.p->localdata[0] = queOperPtr.p->localdata[0];
operationRecPtr.p->localdata[1] = queOperPtr.p->localdata[1];
operationRecPtr.p->prevParallelQue = mlpqOperPtr.i;

View file

@ -3905,20 +3905,21 @@ void Dblqh::execACCKEYCONF(Signal* signal)
* EITHER TO THE TC BLOCK OR DIRECTLY TO THE APPLICATION. THE SCHEMA VERSION
* IS NEEDED SINCE TWO SCHEMA VERSIONS CAN BE ACTIVE SIMULTANEOUSLY ON A
* TABLE.
* ------------------------------------------------------------------------ */
if (regTcPtr->operation == ZWRITE) {
if (signal->theData[1] > 0) {
/* --------------------------------------------------------------------
* ACC did perform an insert and thus we should indicate that the WRITE
* is an INSERT otherwise it is an UPDATE.
* -------------------------------------------------------------------- */
jam();
regTcPtr->operation = ZINSERT;
} else {
jam();
tcConnectptr.p->operation = ZUPDATE;
}//if
* ----------------------------------------------------------------------- */
if (regTcPtr->operation == ZWRITE)
{
Uint32 op= signal->theData[1];
if(likely(op == ZINSERT || op == ZUPDATE))
{
regTcPtr->operation = op;
}
else
{
warningEvent("Convering %d to ZUPDATE", op);
regTcPtr->operation = ZUPDATE;
}
}//if
ndbrequire(localKeyFlag == 1);
localKey2 = localKey1 & MAX_TUPLES_PER_PAGE;
localKey1 = localKey1 >> MAX_TUPLES_BITS;

View file

@ -1037,6 +1037,239 @@ int runCheckGetNdbErrorOperation(NDBT_Context* ctx, NDBT_Step* step){
return result;
}
int runBug_11133(NDBT_Context* ctx, NDBT_Step* step){
int result = NDBT_OK;
const NdbDictionary::Table* pTab = ctx->getTab();
HugoOperations hugoOps(*pTab);
Ndb* pNdb = GETNDB(step);
Uint32 lm;
NdbConnection* pCon = pNdb->startTransaction();
if (pCon == NULL){
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
NdbOperation* pOp = pCon->getNdbOperation(pTab->getName());
if (pOp == NULL){
ERR(pCon->getNdbError());
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
if (pOp->readTuple(NdbOperation::LM_Exclusive) != 0){
pNdb->closeTransaction(pCon);
ERR(pOp->getNdbError());
return NDBT_FAILED;
}
for(int a = 0; a<pTab->getNoOfColumns(); a++){
if (pTab->getColumn(a)->getPrimaryKey() == true){
if(hugoOps.equalForAttr(pOp, a, 1) != 0){
ERR(pCon->getNdbError());
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
}
}
for(int a = 0; a<pTab->getNoOfColumns(); a++){
if (pTab->getColumn(a)->getPrimaryKey() != true){
if (pOp->getValue(pTab->getColumn(a)->getName()) == NULL) {
ERR(pCon->getNdbError());
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
}
}
int check = pCon->execute(NoCommit);
if (check == 0){
ndbout << "execute worked" << endl;
} else {
ERR(pCon->getNdbError());
result = NDBT_FAILED;
}
pOp = pCon->getNdbOperation(pTab->getName());
if (pOp == NULL){
ERR(pCon->getNdbError());
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
if (pOp->deleteTuple() != 0){
pNdb->closeTransaction(pCon);
ERR(pOp->getNdbError());
return NDBT_FAILED;
}
for(int a = 0; a<pTab->getNoOfColumns(); a++){
if (pTab->getColumn(a)->getPrimaryKey() == true){
if(hugoOps.equalForAttr(pOp, a, 1) != 0){
ERR(pCon->getNdbError());
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
}
}
check = pCon->execute(NoCommit);
if (check == 0){
ndbout << "execute worked" << endl;
} else {
ERR(pCon->getNdbError());
result = NDBT_FAILED;
}
pOp = pCon->getNdbOperation(pTab->getName());
if (pOp == NULL){
ERR(pCon->getNdbError());
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
if (pOp->writeTuple() != 0){
pNdb->closeTransaction(pCon);
ERR(pOp->getNdbError());
return NDBT_FAILED;
}
for(int a = 0; a<pTab->getNoOfColumns(); a++){
if (pTab->getColumn(a)->getPrimaryKey() == true){
if(hugoOps.equalForAttr(pOp, a, 1) != 0){
ERR(pCon->getNdbError());
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
}
}
for(int a = 0; a<pTab->getNoOfColumns(); a++){
if (pTab->getColumn(a)->getPrimaryKey() != true){
if(hugoOps.setValueForAttr(pOp, a, 1, 1) != 0)
{
ERR(pCon->getNdbError());
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
}
}
check = pCon->execute(NoCommit);
if (check == 0){
ndbout << "execute worked" << endl;
} else {
ERR(pCon->getNdbError());
result = NDBT_FAILED;
}
pOp = pCon->getNdbOperation(pTab->getName());
if (pOp == NULL){
ERR(pCon->getNdbError());
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
if (pOp->writeTuple() != 0){
pNdb->closeTransaction(pCon);
ERR(pOp->getNdbError());
return NDBT_FAILED;
}
for(int a = 0; a<pTab->getNoOfColumns(); a++){
if (pTab->getColumn(a)->getPrimaryKey() == true){
if(hugoOps.equalForAttr(pOp, a, 1) != 0){
ERR(pCon->getNdbError());
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
}
}
for(int a = 0; a<pTab->getNoOfColumns(); a++){
if (pTab->getColumn(a)->getPrimaryKey() != true){
if(hugoOps.setValueForAttr(pOp, a, 1, 1) != 0)
{
ERR(pCon->getNdbError());
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
}
}
check = pCon->execute(NoCommit);
if (check == 0){
ndbout << "execute worked" << endl;
} else {
ERR(pCon->getNdbError());
result = NDBT_FAILED;
}
check = pCon->execute(Rollback);
if (check == 0){
ndbout << "execute worked" << endl;
} else {
ERR(pCon->getNdbError());
result = NDBT_FAILED;
}
pCon->close();
pCon = pNdb->startTransaction();
if (pCon == NULL){
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
pOp = pCon->getNdbOperation(pTab->getName());
if (pOp == NULL){
ERR(pCon->getNdbError());
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
if (pOp->writeTuple() != 0){
pNdb->closeTransaction(pCon);
ERR(pOp->getNdbError());
return NDBT_FAILED;
}
for(int a = 0; a<pTab->getNoOfColumns(); a++){
if (pTab->getColumn(a)->getPrimaryKey() == true){
if(hugoOps.equalForAttr(pOp, a, 1) != 0){
ERR(pCon->getNdbError());
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
}
}
for(int a = 0; a<pTab->getNoOfColumns(); a++){
if (pTab->getColumn(a)->getPrimaryKey() != true){
if(hugoOps.setValueForAttr(pOp, a, 1, 1) != 0)
{
ERR(pCon->getNdbError());
pNdb->closeTransaction(pCon);
return NDBT_FAILED;
}
}
}
check = pCon->execute(Commit);
if (check == 0){
ndbout << "execute worked" << endl;
} else {
ERR(pCon->getNdbError());
result = NDBT_FAILED;
}
return result;
}
NDBT_TESTSUITE(testNdbApi);
TESTCASE("MaxNdb",
@ -1112,6 +1345,12 @@ TESTCASE("ReadWithoutGetValue",
INITIALIZER(runReadWithoutGetValue);
FINALIZER(runClearTable);
}
TESTCASE("Bug_11133",
"Test ReadEx-Delete-Write\n"){
INITIALIZER(runLoadTable);
INITIALIZER(runBug_11133);
FINALIZER(runClearTable);
}
NDBT_TESTSUITE_END(testNdbApi);
int main(int argc, const char** argv){

View file

@ -516,6 +516,10 @@ max-time: 500
cmd: testNdbApi
args: -n ReadWithoutGetValue
max-time: 500
cmd: testNdbApi
args: -n Bug_11133 T1
#max-time: 500
#cmd: testInterpreter
#args: T1

View file

@ -765,6 +765,7 @@ RestoreLogIterator::RestoreLogIterator(const RestoreMetaData & md)
setLogFile(md, 0);
m_count = 0;
m_last_gci = 0;
}
const LogEntry *
@ -772,7 +773,6 @@ RestoreLogIterator::getNextLogEntry(int & res) {
// Read record length
typedef BackupFormat::LogFile::LogEntry LogE;
Uint32 gcp= 0;
LogE * logE= 0;
Uint32 len= ~0;
const Uint32 stopGCP = m_metaData.getStopGCP();
@ -802,9 +802,9 @@ RestoreLogIterator::getNextLogEntry(int & res) {
if(hasGcp){
len--;
gcp = ntohl(logE->Data[len-2]);
m_last_gci = ntohl(logE->Data[len-2]);
}
} while(gcp > stopGCP + 1);
} while(m_last_gci > stopGCP + 1);
m_logEntry.m_table = m_metaData.getTable(logE->TableId);
switch(logE->TriggerEvent){

View file

@ -361,6 +361,7 @@ private:
const RestoreMetaData & m_metaData;
Uint32 m_count;
Uint32 m_last_gci;
LogEntry m_logEntry;
public:
RestoreLogIterator(const RestoreMetaData &);

View file

@ -527,6 +527,13 @@ BackupRestore::logEntry(const LogEntry & tup)
exit(-1);
}
if (check != 0)
{
err << "Error defining op: " << trans->getNdbError() << endl;
exit(-1);
} // if
Bitmask<4096> keys;
for (Uint32 i= 0; i < tup.size(); i++)
{
const AttributeS * attr = tup[i];
@ -539,9 +546,21 @@ BackupRestore::logEntry(const LogEntry & tup)
const Uint32 length = (size / 8) * arraySize;
if (attr->Desc->m_column->getPrimaryKey())
op->equal(attr->Desc->attrId, dataPtr, length);
{
if(!keys.get(attr->Desc->attrId))
{
keys.set(attr->Desc->attrId);
check= op->equal(attr->Desc->attrId, dataPtr, length);
}
}
else
op->setValue(attr->Desc->attrId, dataPtr, length);
check= op->setValue(attr->Desc->attrId, dataPtr, length);
if (check != 0)
{
err << "Error defining op: " << trans->getNdbError() << endl;
exit(-1);
} // if
}
const int ret = trans->execute(NdbTransaction::Commit);
@ -550,18 +569,25 @@ BackupRestore::logEntry(const LogEntry & tup)
// Both insert update and delete can fail during log running
// and it's ok
// TODO: check that the error is either tuple exists or tuple does not exist?
bool ok= false;
NdbError errobj= trans->getNdbError();
switch(tup.m_type)
{
case LogEntry::LE_INSERT:
if(errobj.status == NdbError::PermanentError &&
errobj.classification == NdbError::ConstraintViolation)
ok= true;
break;
case LogEntry::LE_UPDATE:
break;
case LogEntry::LE_DELETE:
if(errobj.status == NdbError::PermanentError &&
errobj.classification == NdbError::NoDataFound)
ok= true;
break;
}
if (false)
if (!ok)
{
err << "execute failed: " << trans->getNdbError() << endl;
err << "execute failed: " << errobj << endl;
exit(-1);
}
}

View file

@ -226,7 +226,7 @@ $CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \
mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \
$BASE/mysql-test/std_data
$CP mysql-test/t/*.test mysql-test/t/*.disabled mysql-test/t/*.opt \
mysql-test/t/*.slave-mi mysql-test/t/*.sh $BASE/mysql-test/t
mysql-test/t/*.slave-mi mysql-test/t/*.sh mysql-test/t/*.sql $BASE/mysql-test/t
$CP mysql-test/r/*.result mysql-test/r/*.require \
$BASE/mysql-test/r

View file

@ -746,9 +746,15 @@ sub record_log_pos {
my ($file,$position) = get_row( $dbh, "show master status" );
die "master status is undefined" if !defined $file || !defined $position;
my ($master_host, undef, undef, undef, $log_file, $log_pos )
= get_row( $dbh, "show slave status" );
my $row_hash = get_row_hash( $dbh, "show slave status" );
my ($master_host, $log_file, $log_pos );
if ( $dbh->{mysql_serverinfo} =~ /^3\.23/ ) {
($master_host, $log_file, $log_pos )
= @{$row_hash}{ qw / Master_Host Log_File Pos / };
} else {
($master_host, $log_file, $log_pos )
= @{$row_hash}{ qw / Master_Host Master_Log_File Read_Master_Log_Pos / };
}
my $hostname = hostname();
$dbh->do( qq{ replace into $table_name
@ -773,6 +779,14 @@ sub get_row {
return $sth->fetchrow_array();
}
sub get_row_hash {
my ( $dbh, $sql ) = @_;
my $sth = $dbh->prepare($sql);
$sth->execute;
return $sth->fetchrow_hashref();
}
sub scan_raid_dir {
my ( $r_db_files, $data_dir, @raid_dir ) = @_;

View file

@ -2446,7 +2446,7 @@ int Field_new_decimal::store(longlong nr)
int err;
if ((err= int2my_decimal(E_DEC_FATAL_ERROR & ~E_DEC_OVERFLOW,
nr, unsigned_flag, &decimal_value)))
nr, false, &decimal_value)))
{
if (check_overflow(err))
set_value_on_overflow(&decimal_value, decimal_value.sign());

View file

@ -52,7 +52,7 @@ Item_buff::~Item_buff() {}
*/
Item_str_buff::Item_str_buff(THD *thd, Item *arg)
:item(arg), value(min(arg->max_length, thd->variables. max_sort_length))
:item(arg), value(min(arg->max_length, thd->variables.max_sort_length))
{}
bool Item_str_buff::cmp(void)

View file

@ -1668,14 +1668,28 @@ Item_func_format::Item_func_format(Item *org,int dec) :Item_str_func(org)
String *Item_func_format::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
double nr= args[0]->val_real();
uint32 length,str_length,dec;
uint32 length, str_length ,dec;
int diff;
DBUG_ASSERT(fixed == 1);
dec= decimals ? decimals+1 : 0;
if (args[0]->result_type() == DECIMAL_RESULT ||
args[0]->result_type() == INT_RESULT)
{
my_decimal dec_val, rnd_dec, *res;
res= args[0]->val_decimal(&dec_val);
my_decimal_round(E_DEC_FATAL_ERROR, res, decimals, false, &rnd_dec);
my_decimal2string(E_DEC_FATAL_ERROR, &rnd_dec, 0, 0, 0, str);
str_length= str->length();
if (rnd_dec.sign())
str_length--;
}
else
{
double nr= args[0]->val_real();
if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */
nr= my_double_round(nr, decimals, FALSE);
dec= decimals ? decimals+1 : 0;
/* Here default_charset() is right as this is not an automatic conversion */
str->set(nr,decimals, default_charset());
if (isnan(nr))
@ -1683,7 +1697,7 @@ String *Item_func_format::val_str(String *str)
str_length=str->length();
if (nr < 0)
str_length--; // Don't count sign
}
/* We need this test to handle 'nan' values */
if (str_length >= dec+4)
{

View file

@ -601,7 +601,7 @@ void Item_exists_subselect::fix_length_and_dec()
max_length= 1;
max_columns= engine->cols();
/* We need only 1 row to determine existence */
unit->global_parameters->select_limit= new Item_int(1);
unit->global_parameters->select_limit= new Item_int((int32) 1);
}
double Item_exists_subselect::val_real()

View file

@ -336,6 +336,8 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define UNCACHEABLE_SIDEEFFECT 4
// forcing to save JOIN for explain
#define UNCACHEABLE_EXPLAIN 8
/* Don't evaluate subqueries in prepare even if they're not correlated */
#define UNCACHEABLE_PREPARE 16
#ifdef EXTRA_DEBUG
/*

View file

@ -5374,7 +5374,7 @@ The minimum value for this variable is 4096.",
(gptr*) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG,
6, 2, 8, 0, 1, 0},
{"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
"Depricated option",
"Deprecated option",
(gptr*) &global_system_variables.myisam_max_extra_sort_file_size,
(gptr*) &max_system_variables.myisam_max_extra_sort_file_size,
0, GET_ULL, REQUIRED_ARG, (ulonglong) MI_MAX_TEMP_LENGTH,

View file

@ -714,8 +714,10 @@ int THD::send_explain_fields(select_result *result)
CHARSET_INFO *cs= system_charset_info;
field_list.push_back(new Item_return_int("id",3, MYSQL_TYPE_LONGLONG));
field_list.push_back(new Item_empty_string("select_type", 19, cs));
field_list.push_back(new Item_empty_string("table", NAME_LEN, cs));
field_list.push_back(new Item_empty_string("type", 10, cs));
field_list.push_back(item= new Item_empty_string("table", NAME_LEN, cs));
item->maybe_null= 1;
field_list.push_back(item= new Item_empty_string("type", 10, cs));
item->maybe_null= 1;
field_list.push_back(item=new Item_empty_string("possible_keys",
NAME_LEN*MAX_KEY, cs));
item->maybe_null=1;
@ -727,7 +729,9 @@ int THD::send_explain_fields(select_result *result)
field_list.push_back(item=new Item_empty_string("ref",
NAME_LEN*MAX_REF_PARTS, cs));
item->maybe_null=1;
field_list.push_back(new Item_return_int("rows", 10, MYSQL_TYPE_LONGLONG));
field_list.push_back(item= new Item_return_int("rows", 10,
MYSQL_TYPE_LONGLONG));
item->maybe_null= 1;
field_list.push_back(new Item_empty_string("Extra", 255, cs));
return (result->send_fields(field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF));

View file

@ -1757,6 +1757,7 @@ void st_select_lex_unit::set_limit(SELECT_LEX *sl)
{
ulonglong select_limit_val;
DBUG_ASSERT(! thd->current_arena->is_stmt_prepare());
select_limit_val= sl->select_limit ? sl->select_limit->val_uint() :
HA_POS_ERROR;
offset_limit_cnt= sl->offset_limit ? sl->offset_limit->val_uint() : ULL(0);

View file

@ -303,6 +303,7 @@ public:
UNCACHEABLE_RAND
UNCACHEABLE_SIDEEFFECT
UNCACHEABLE_EXPLAIN
UNCACHEABLE_PREPARE
*/
uint8 uncacheable;
enum sub_select_type linkage;

View file

@ -5169,26 +5169,28 @@ bool
mysql_new_select(LEX *lex, bool move_down)
{
SELECT_LEX *select_lex;
THD *thd;
THD *thd= lex->thd;
DBUG_ENTER("mysql_new_select");
if (!(select_lex= new(lex->thd->mem_root) SELECT_LEX()))
if (!(select_lex= new (thd->mem_root) SELECT_LEX()))
DBUG_RETURN(1);
select_lex->select_number= ++lex->thd->select_number;
select_lex->select_number= ++thd->select_number;
select_lex->init_query();
select_lex->init_select();
select_lex->parent_lex= lex;
if (thd->current_arena->is_stmt_prepare())
select_lex->uncacheable|= UNCACHEABLE_PREPARE;
if (move_down)
{
SELECT_LEX_UNIT *unit;
lex->subqueries= TRUE;
/* first select_lex of subselect or derived table */
if (!(unit= new(lex->thd->mem_root) SELECT_LEX_UNIT()))
if (!(unit= new (thd->mem_root) SELECT_LEX_UNIT()))
DBUG_RETURN(1);
unit->init_query();
unit->init_select();
unit->thd= lex->thd;
unit->thd= thd;
unit->include_down(lex->current_select);
unit->link_next= 0;
unit->link_prev= 0;
@ -5212,7 +5214,7 @@ mysql_new_select(LEX *lex, bool move_down)
as far as we included SELECT_LEX for UNION unit should have
fake SELECT_LEX for UNION processing
*/
if (!(fake= unit->fake_select_lex= new(lex->thd->mem_root) SELECT_LEX()))
if (!(fake= unit->fake_select_lex= new (thd->mem_root) SELECT_LEX()))
DBUG_RETURN(1);
fake->include_standalone(unit,
(SELECT_LEX_NODE**)&unit->fake_select_lex);

View file

@ -1838,7 +1838,10 @@ void init_stmt_after_parse(THD *thd, LEX *lex)
optimisation.
*/
for (; sl; sl= sl->next_select_in_list())
{
sl->prep_where= sl->where;
sl->uncacheable&= ~UNCACHEABLE_PREPARE;
}
for (TABLE_LIST *table= lex->query_tables; table; table= table->next_global)
table->prep_on_expr= table->on_expr;

View file

@ -5607,7 +5607,7 @@ limit_option:
| ULONGLONG_NUM { $$= new Item_uint($1.str, $1.length); }
| LONG_NUM { $$= new Item_uint($1.str, $1.length); }
| NUM { $$= new Item_uint($1.str, $1.length); }
;
delete_limit_clause:
/* empty */
@ -7985,7 +7985,7 @@ handler:
LEX *lex=Lex;
lex->sql_command = SQLCOM_HA_READ;
lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */
lex->current_select->select_limit= new Item_int(1);
lex->current_select->select_limit= new Item_int((int32) 1);
lex->current_select->offset_limit= 0;
if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0))
YYABORT;