Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e071d7aa
Commit
e071d7aa
authored
Feb 06, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/usr/home/ram/work/5.0.b16511
parents
c1cad51e
b948741b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
26 deletions
+104
-26
mysql-test/r/ndb_blob.result
mysql-test/r/ndb_blob.result
+7
-0
mysql-test/t/ndb_blob.test
mysql-test/t/ndb_blob.test
+5
-1
ndb/src/ndbapi/NdbBlob.cpp
ndb/src/ndbapi/NdbBlob.cpp
+2
-0
ndb/test/ndbapi/testBlobs.cpp
ndb/test/ndbapi/testBlobs.cpp
+64
-20
ndb/tools/delete_all.cpp
ndb/tools/delete_all.cpp
+26
-5
No files found.
mysql-test/r/ndb_blob.result
View file @
e071d7aa
...
...
@@ -428,6 +428,13 @@ delete from t1;
select * from t1;
a b
commit;
replace t1 set a=2, b='y';
select * from t1;
a b
2 y
delete from t1;
select * from t1;
a b
drop table t1;
set autocommit=0;
create table t1 (
...
...
mysql-test/t/ndb_blob.test
View file @
e071d7aa
...
...
@@ -338,7 +338,7 @@ select * from t1 order by a;
drop
table
t1
;
drop
database
test2
;
# -- bug-5252 tinytext crashes
plus no-commit result
--
# -- bug-5252 tinytext crashes
+ no-commit result + replace
--
set
autocommit
=
0
;
create
table
t1
(
...
...
@@ -352,6 +352,10 @@ select * from t1;
delete
from
t1
;
select
*
from
t1
;
commit
;
replace
t1
set
a
=
2
,
b
=
'y'
;
select
*
from
t1
;
delete
from
t1
;
select
*
from
t1
;
drop
table
t1
;
# -- bug-5013 insert empty string to text --
...
...
ndb/src/ndbapi/NdbBlob.cpp
View file @
e071d7aa
...
...
@@ -947,6 +947,8 @@ NdbBlob::deletePartsUnknown(Uint32 part)
{
DBUG_ENTER
(
"NdbBlob::deletePartsUnknown"
);
DBUG_PRINT
(
"info"
,
(
"part=%u count=all"
,
part
));
if
(
thePartSize
==
0
)
// tinyblob
DBUG_RETURN
(
0
);
static
const
unsigned
maxbat
=
256
;
static
const
unsigned
minbat
=
1
;
unsigned
bat
=
minbat
;
...
...
ndb/test/ndbapi/testBlobs.cpp
View file @
e071d7aa
...
...
@@ -839,9 +839,6 @@ insertPk(int style)
CHK
(
g_con
->
execute
(
NoCommit
)
==
0
);
CHK
(
writeBlobData
(
tup
)
==
0
);
}
// just another trap
if
(
urandom
(
10
)
==
0
)
CHK
(
g_con
->
execute
(
NoCommit
)
==
0
);
if
(
++
n
==
g_opt
.
m_batch
)
{
CHK
(
g_con
->
execute
(
Commit
)
==
0
);
g_ndb
->
closeTransaction
(
g_con
);
...
...
@@ -963,21 +960,31 @@ static int
deletePk
()
{
DBG
(
"--- deletePk ---"
);
unsigned
n
=
0
;
CHK
((
g_con
=
g_ndb
->
startTransaction
())
!=
0
);
for
(
unsigned
k
=
0
;
k
<
g_opt
.
m_rows
;
k
++
)
{
Tup
&
tup
=
g_tups
[
k
];
DBG
(
"deletePk pk1="
<<
hex
<<
tup
.
m_pk1
);
CHK
((
g_con
=
g_ndb
->
startTransaction
())
!=
0
);
CHK
((
g_opr
=
g_con
->
getNdbOperation
(
g_opt
.
m_tname
))
!=
0
);
CHK
(
g_opr
->
deleteTuple
()
==
0
);
CHK
(
g_opr
->
equal
(
"PK1"
,
tup
.
m_pk1
)
==
0
);
if
(
g_opt
.
m_pk2len
!=
0
)
CHK
(
g_opr
->
equal
(
"PK2"
,
tup
.
m_pk2
)
==
0
);
if
(
++
n
==
g_opt
.
m_batch
)
{
CHK
(
g_con
->
execute
(
Commit
)
==
0
);
g_ndb
->
closeTransaction
(
g_con
);
CHK
((
g_con
=
g_ndb
->
startTransaction
())
!=
0
);
n
=
0
;
}
g_opr
=
0
;
g_con
=
0
;
tup
.
m_exists
=
false
;
}
if
(
n
!=
0
)
{
CHK
(
g_con
->
execute
(
Commit
)
==
0
);
n
=
0
;
}
g_ndb
->
closeTransaction
(
g_con
);
g_con
=
0
;
return
0
;
}
...
...
@@ -1080,19 +1087,27 @@ static int
deleteIdx
()
{
DBG
(
"--- deleteIdx ---"
);
unsigned
n
=
0
;
CHK
((
g_con
=
g_ndb
->
startTransaction
())
!=
0
);
for
(
unsigned
k
=
0
;
k
<
g_opt
.
m_rows
;
k
++
)
{
Tup
&
tup
=
g_tups
[
k
];
DBG
(
"deleteIdx pk1="
<<
hex
<<
tup
.
m_pk1
);
CHK
((
g_con
=
g_ndb
->
startTransaction
())
!=
0
);
CHK
((
g_opx
=
g_con
->
getNdbIndexOperation
(
g_opt
.
m_x1name
,
g_opt
.
m_tname
))
!=
0
);
CHK
(
g_opx
->
deleteTuple
()
==
0
);
CHK
(
g_opx
->
equal
(
"PK2"
,
tup
.
m_pk2
)
==
0
);
if
(
++
n
==
g_opt
.
m_batch
)
{
CHK
(
g_con
->
execute
(
Commit
)
==
0
);
g_ndb
->
closeTransaction
(
g_con
);
CHK
((
g_con
=
g_ndb
->
startTransaction
())
!=
0
);
n
=
0
;
}
g_opx
=
0
;
g_con
=
0
;
tup
.
m_exists
=
false
;
}
if
(
n
!=
0
)
{
CHK
(
g_con
->
execute
(
Commit
)
==
0
);
n
=
0
;
}
return
0
;
}
...
...
@@ -1220,20 +1235,49 @@ deleteScan(bool idx)
CHK
(
g_ops
->
getValue
(
"PK2"
,
tup
.
m_pk2
)
!=
0
);
CHK
(
g_con
->
execute
(
NoCommit
)
==
0
);
unsigned
rows
=
0
;
unsigned
n
=
0
;
while
(
1
)
{
int
ret
;
tup
.
m_pk1
=
(
Uint32
)
-
1
;
memset
(
tup
.
m_pk2
,
'x'
,
g_opt
.
m_pk2len
);
CHK
((
ret
=
g_ops
->
nextResult
())
==
0
||
ret
==
1
);
CHK
((
ret
=
g_ops
->
nextResult
(
true
))
==
0
||
ret
==
1
);
if
(
ret
==
1
)
break
;
while
(
1
)
{
DBG
(
"deleteScan"
<<
(
idx
?
"Idx"
:
""
)
<<
" pk1="
<<
hex
<<
tup
.
m_pk1
);
CHK
(
g_ops
->
deleteCurrentTuple
()
==
0
);
CHK
(
g_con
->
execute
(
NoCommit
)
==
0
);
Uint32
k
=
tup
.
m_pk1
-
g_opt
.
m_pk1off
;
CHK
(
k
<
g_opt
.
m_rows
&&
g_tups
[
k
].
m_exists
);
g_tups
[
k
].
m_exists
=
false
;
CHK
(
g_ops
->
deleteCurrentTuple
()
==
0
);
rows
++
;
tup
.
m_pk1
=
(
Uint32
)
-
1
;
memset
(
tup
.
m_pk2
,
'x'
,
g_opt
.
m_pk2len
);
CHK
((
ret
=
g_ops
->
nextResult
(
false
))
==
0
||
ret
==
1
||
ret
==
2
);
if
(
++
n
==
g_opt
.
m_batch
||
ret
==
2
)
{
DBG
(
"execute batch: n="
<<
n
<<
" ret="
<<
ret
);
switch
(
0
)
{
case
0
:
// works normally
CHK
(
g_con
->
execute
(
NoCommit
)
==
0
);
CHK
(
true
||
g_con
->
restart
()
==
0
);
break
;
case
1
:
// nonsense - g_con is invalid for 2nd batch
CHK
(
g_con
->
execute
(
Commit
)
==
0
);
CHK
(
true
||
g_con
->
restart
()
==
0
);
break
;
case
2
:
// DBTC sendSignalErrorRefuseLab
CHK
(
g_con
->
execute
(
NoCommit
)
==
0
);
CHK
(
g_con
->
restart
()
==
0
);
break
;
case
3
:
// 266 time-out
CHK
(
g_con
->
execute
(
Commit
)
==
0
);
CHK
(
g_con
->
restart
()
==
0
);
break
;
}
n
=
0
;
}
if
(
ret
==
2
)
break
;
}
}
CHK
(
g_con
->
execute
(
Commit
)
==
0
);
g_ndb
->
closeTransaction
(
g_con
);
...
...
@@ -1256,7 +1300,7 @@ static int
testmain
()
{
g_ndb
=
new
Ndb
(
g_ncc
,
"TEST_DB"
);
CHK
(
g_ndb
->
init
()
==
0
);
CHK
(
g_ndb
->
init
(
20
)
==
0
);
CHK
(
g_ndb
->
waitUntilReady
()
==
0
);
g_dic
=
g_ndb
->
getDictionary
();
g_tups
=
new
Tup
[
g_opt
.
m_rows
];
...
...
ndb/tools/delete_all.cpp
View file @
e071d7aa
...
...
@@ -22,7 +22,8 @@
#include <NdbSleep.h>
#include <NDBT.hpp>
static
int
clear_table
(
Ndb
*
pNdb
,
const
NdbDictionary
::
Table
*
pTab
,
int
parallelism
=
240
);
static
int
clear_table
(
Ndb
*
pNdb
,
const
NdbDictionary
::
Table
*
pTab
,
bool
commit_across_open_cursor
,
int
parallelism
=
240
);
NDB_STD_OPTS_VARS
;
...
...
@@ -83,8 +84,18 @@ int main(int argc, char** argv){
ndbout
<<
" Table "
<<
argv
[
i
]
<<
" does not exist!"
<<
endl
;
return
NDBT_ProgramExit
(
NDBT_WRONGARGS
);
}
// Check if we have any blobs
bool
commit_across_open_cursor
=
true
;
for
(
int
j
=
0
;
j
<
pTab
->
getNoOfColumns
();
j
++
)
{
NdbDictionary
::
Column
::
Type
t
=
pTab
->
getColumn
(
j
)
->
getType
();
if
(
t
==
NdbDictionary
::
Column
::
Blob
||
t
==
NdbDictionary
::
Column
::
Text
)
{
commit_across_open_cursor
=
false
;
break
;
}
}
ndbout
<<
"Deleting all from "
<<
argv
[
i
]
<<
"..."
;
if
(
clear_table
(
&
MyNdb
,
pTab
)
==
NDBT_FAILED
){
if
(
clear_table
(
&
MyNdb
,
pTab
,
commit_across_open_cursor
)
==
NDBT_FAILED
){
res
=
NDBT_FAILED
;
ndbout
<<
"FAILED"
<<
endl
;
}
...
...
@@ -93,7 +104,8 @@ int main(int argc, char** argv){
}
int
clear_table
(
Ndb
*
pNdb
,
const
NdbDictionary
::
Table
*
pTab
,
int
parallelism
)
int
clear_table
(
Ndb
*
pNdb
,
const
NdbDictionary
::
Table
*
pTab
,
bool
commit_across_open_cursor
,
int
parallelism
)
{
// Scan all records exclusive and delete
// them one by one
...
...
@@ -154,8 +166,12 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism)
}
while
((
check
=
pOp
->
nextResult
(
false
))
==
0
);
if
(
check
!=
-
1
){
if
(
commit_across_open_cursor
)
{
check
=
pTrans
->
execute
(
NdbTransaction
::
Commit
);
pTrans
->
restart
();
pTrans
->
restart
();
// new tx id
}
else
{
check
=
pTrans
->
execute
(
NdbTransaction
::
NoCommit
);
}
}
err
=
pTrans
->
getNdbError
();
...
...
@@ -181,6 +197,11 @@ int clear_table(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism)
}
goto
failed
;
}
if
(
!
commit_across_open_cursor
&&
pTrans
->
execute
(
NdbTransaction
::
Commit
)
!=
0
)
{
err
=
pTrans
->
getNdbError
();
goto
failed
;
}
pNdb
->
closeTransaction
(
pTrans
);
return
NDBT_OK
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment