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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
bcbbd47d
Commit
bcbbd47d
authored
Dec 10, 2004
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0-ndb
into poseidon.ndb.mysql.com:/home/tomas/mysql-5.0-ndb
parents
e5c17fb0
40c83506
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
132 additions
and
49 deletions
+132
-49
ndb/src/common/util/Bitmask.cpp
ndb/src/common/util/Bitmask.cpp
+32
-16
ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
+1
-1
ndb/src/ndbapi/NdbDictionaryImpl.cpp
ndb/src/ndbapi/NdbDictionaryImpl.cpp
+4
-0
ndb/test/include/HugoCalculator.hpp
ndb/test/include/HugoCalculator.hpp
+1
-1
ndb/test/ndbapi/testBitfield.cpp
ndb/test/ndbapi/testBitfield.cpp
+50
-1
ndb/test/src/HugoCalculator.cpp
ndb/test/src/HugoCalculator.cpp
+35
-26
ndb/test/src/HugoOperations.cpp
ndb/test/src/HugoOperations.cpp
+8
-3
ndb/test/tools/Makefile.am
ndb/test/tools/Makefile.am
+1
-1
No files found.
ndb/src/common/util/Bitmask.cpp
View file @
bcbbd47d
...
@@ -17,6 +17,7 @@ void print(const Uint32 src[], Uint32 len, Uint32 pos = 0)
...
@@ -17,6 +17,7 @@ void print(const Uint32 src[], Uint32 len, Uint32 pos = 0)
}
}
#ifndef __TEST_BITMASK__
#ifndef __TEST_BITMASK__
void
void
BitmaskImpl
::
getFieldImpl
(
const
Uint32
src
[],
BitmaskImpl
::
getFieldImpl
(
const
Uint32
src
[],
unsigned
shiftL
,
unsigned
len
,
Uint32
dst
[])
unsigned
shiftL
,
unsigned
len
,
Uint32
dst
[])
...
@@ -32,8 +33,15 @@ BitmaskImpl::getFieldImpl(const Uint32 src[],
...
@@ -32,8 +33,15 @@ BitmaskImpl::getFieldImpl(const Uint32 src[],
len
-=
32
;
len
-=
32
;
}
}
*
dst
++
|=
(
*
src
)
<<
shiftL
;
if
(
len
<
shiftR
)
*
dst
=
((
*
src
)
>>
shiftR
)
&
((
1
<<
len
)
-
1
)
&
undefined
;
{
*
dst
|=
((
*
src
)
&
((
1
<<
len
)
-
1
))
<<
shiftL
;
}
else
{
*
dst
++
|=
((
*
src
)
<<
shiftL
);
*
dst
=
((
*
src
)
>>
shiftR
)
&
((
1
<<
(
len
-
shiftR
))
-
1
)
&
undefined
;
}
}
}
void
void
...
@@ -57,10 +65,16 @@ BitmaskImpl::setFieldImpl(Uint32 dst[],
...
@@ -57,10 +65,16 @@ BitmaskImpl::setFieldImpl(Uint32 dst[],
Uint32
mask
=
((
1
<<
len
)
-
1
);
Uint32
mask
=
((
1
<<
len
)
-
1
);
*
dst
=
(
*
dst
&
~
mask
);
*
dst
=
(
*
dst
&
~
mask
);
*
dst
|=
((
*
src
++
)
>>
shiftL
)
&
mask
;
if
(
len
<
shiftR
)
*
dst
|=
((
*
src
)
<<
shiftR
)
&
mask
&
undefined
;
{
*
dst
|=
((
*
src
++
)
>>
shiftL
)
&
mask
;
}
else
{
*
dst
|=
((
*
src
++
)
>>
shiftL
);
*
dst
|=
((
*
src
)
&
((
1
<<
(
len
-
shiftR
))
-
1
))
<<
shiftR
;
}
}
}
#else
#else
#define DEBUG 0
#define DEBUG 0
...
@@ -121,7 +135,7 @@ static
...
@@ -121,7 +135,7 @@ static
void
rand
(
Uint32
dst
[],
Uint32
len
)
void
rand
(
Uint32
dst
[],
Uint32
len
)
{
{
for
(
int
i
=
0
;
i
<
len
;
i
++
)
for
(
int
i
=
0
;
i
<
len
;
i
++
)
BitmaskImpl
::
set
((
len
+
31
)
>>
5
,
dst
,
i
,
(
lrand
()
%
1000
)
>
500
);
BitmaskImpl
::
set
((
len
+
31
)
>>
5
,
dst
,
i
,
(
lrand
()
%
1000
)
>
500
);
}
}
static
static
...
@@ -135,9 +149,9 @@ void simple(int pos, int size)
...
@@ -135,9 +149,9 @@ void simple(int pos, int size)
const
Uint32
sz
=
4
*
sz32
;
const
Uint32
sz
=
4
*
sz32
;
Uint32
zero
=
0
;
Uint32
zero
=
0
;
_mask
.
fill
(
sz32
,
zero
);
_mask
.
fill
(
sz32
+
1
,
zero
);
_src
.
fill
(
sz32
,
zero
);
_src
.
fill
(
sz32
+
1
,
zero
);
_dst
.
fill
(
sz32
,
zero
);
_dst
.
fill
(
sz32
+
1
,
zero
);
Uint32
*
src
=
_src
.
getBase
();
Uint32
*
src
=
_src
.
getBase
();
Uint32
*
dst
=
_dst
.
getBase
();
Uint32
*
dst
=
_dst
.
getBase
();
...
@@ -149,18 +163,18 @@ void simple(int pos, int size)
...
@@ -149,18 +163,18 @@ void simple(int pos, int size)
rand
(
src
,
size
);
rand
(
src
,
size
);
BitmaskImpl
::
setField
(
sz32
,
mask
,
pos
,
size
,
src
);
BitmaskImpl
::
setField
(
sz32
,
mask
,
pos
,
size
,
src
);
BitmaskImpl
::
getField
(
sz32
,
mask
,
pos
,
size
,
dst
);
BitmaskImpl
::
getField
(
sz32
,
mask
,
pos
,
size
,
dst
);
printf
(
"src: "
);
print
(
src
,
size
);
printf
(
"
\n
"
);
printf
(
"src: "
);
print
(
src
,
size
+
31
);
printf
(
"
\n
"
);
printf
(
"msk: "
);
print
(
mask
,
sz32
<<
5
);
printf
(
"
\n
"
);
printf
(
"msk: "
);
print
(
mask
,
(
sz32
<<
5
)
+
31
);
printf
(
"
\n
"
);
printf
(
"dst: "
);
print
(
dst
,
size
);
printf
(
"
\n
"
);
printf
(
"dst: "
);
print
(
dst
,
size
+
31
);
printf
(
"
\n
"
);
require
(
cmp
(
src
,
dst
,
size
));
require
(
cmp
(
src
,
dst
,
size
+
31
));
};
};
static
void
static
void
do_test
(
int
bitmask_size
)
do_test
(
int
bitmask_size
)
{
{
#if
0
#if
1
simple
(
rand
()
%
33
,
(
rand
()
%
63
)
+
1
);
simple
(
rand
()
%
33
,
(
rand
()
%
63
)
+
1
);
#else
//
#else
Vector
<
Alloc
>
alloc_list
;
Vector
<
Alloc
>
alloc_list
;
bitmask_size
=
(
bitmask_size
+
31
)
&
~
31
;
bitmask_size
=
(
bitmask_size
+
31
)
&
~
31
;
Uint32
sz32
=
(
bitmask_size
>>
5
);
Uint32
sz32
=
(
bitmask_size
>>
5
);
...
@@ -235,8 +249,10 @@ do_test(int bitmask_size)
...
@@ -235,8 +249,10 @@ do_test(int bitmask_size)
!
BitmaskImpl
::
get
(
sz32
,
alloc_mask
.
getBase
(),
pos
+
free
))
!
BitmaskImpl
::
get
(
sz32
,
alloc_mask
.
getBase
(),
pos
+
free
))
free
++
;
free
++
;
Uint32
sz
=
(
lrand
()
%
free
);
Uint32
sz
=
(
free
<=
64
&&
((
lrand
()
%
100
)
>
80
))
?
free
:
(
lrand
()
%
free
);
sz
=
sz
?
sz
:
1
;
sz
=
sz
?
sz
:
1
;
sz
=
pos
+
sz
==
bitmask_size
?
sz
-
1
:
sz
;
Alloc
a
;
Alloc
a
;
a
.
pos
=
pos
;
a
.
pos
=
pos
;
a
.
size
=
sz
;
a
.
size
=
sz
;
...
...
ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
View file @
bcbbd47d
...
@@ -1149,7 +1149,7 @@ Dbtup::updateBitsNULLable(Uint32* inBuffer,
...
@@ -1149,7 +1149,7 @@ Dbtup::updateBitsNULLable(Uint32* inBuffer,
inBuffer
+
indexBuf
+
1
);
inBuffer
+
indexBuf
+
1
);
Uint32
newIndex
=
indexBuf
+
1
+
((
bitCount
+
31
)
>>
5
);
Uint32
newIndex
=
indexBuf
+
1
+
((
bitCount
+
31
)
>>
5
);
tInBuf
Len
=
newIndex
;
tInBuf
Index
=
newIndex
;
return
true
;
return
true
;
}
else
{
}
else
{
Uint32
newIndex
=
tInBufIndex
+
1
;
Uint32
newIndex
=
tInBufIndex
+
1
;
...
...
ndb/src/ndbapi/NdbDictionaryImpl.cpp
View file @
bcbbd47d
...
@@ -621,9 +621,11 @@ NdbDictionaryImpl::~NdbDictionaryImpl()
...
@@ -621,9 +621,11 @@ NdbDictionaryImpl::~NdbDictionaryImpl()
delete
NdbDictionary
::
Column
::
FRAGMENT
;
delete
NdbDictionary
::
Column
::
FRAGMENT
;
delete
NdbDictionary
::
Column
::
ROW_COUNT
;
delete
NdbDictionary
::
Column
::
ROW_COUNT
;
delete
NdbDictionary
::
Column
::
COMMIT_COUNT
;
delete
NdbDictionary
::
Column
::
COMMIT_COUNT
;
delete
NdbDictionary
::
Column
::
ROW_SIZE
;
NdbDictionary
::
Column
::
FRAGMENT
=
0
;
NdbDictionary
::
Column
::
FRAGMENT
=
0
;
NdbDictionary
::
Column
::
ROW_COUNT
=
0
;
NdbDictionary
::
Column
::
ROW_COUNT
=
0
;
NdbDictionary
::
Column
::
COMMIT_COUNT
=
0
;
NdbDictionary
::
Column
::
COMMIT_COUNT
=
0
;
NdbDictionary
::
Column
::
ROW_SIZE
=
0
;
}
}
m_globalHash
->
unlock
();
m_globalHash
->
unlock
();
}
else
{
}
else
{
...
@@ -690,6 +692,8 @@ NdbDictionaryImpl::setTransporter(class Ndb* ndb,
...
@@ -690,6 +692,8 @@ NdbDictionaryImpl::setTransporter(class Ndb* ndb,
NdbColumnImpl
::
create_psuedo
(
"NDB$ROW_COUNT"
);
NdbColumnImpl
::
create_psuedo
(
"NDB$ROW_COUNT"
);
NdbDictionary
::
Column
::
COMMIT_COUNT
=
NdbDictionary
::
Column
::
COMMIT_COUNT
=
NdbColumnImpl
::
create_psuedo
(
"NDB$COMMIT_COUNT"
);
NdbColumnImpl
::
create_psuedo
(
"NDB$COMMIT_COUNT"
);
NdbDictionary
::
Column
::
ROW_SIZE
=
NdbColumnImpl
::
create_psuedo
(
"NDB$ROW_SIZE"
);
}
}
m_globalHash
->
unlock
();
m_globalHash
->
unlock
();
return
true
;
return
true
;
...
...
ndb/test/include/HugoCalculator.hpp
View file @
bcbbd47d
...
@@ -38,7 +38,7 @@ public:
...
@@ -38,7 +38,7 @@ public:
float calcValue(int record, int attrib, int updates) const;
float calcValue(int record, int attrib, int updates) const;
double calcValue(int record, int attrib, int updates) const;
double calcValue(int record, int attrib, int updates) const;
#endif
#endif
const
char
*
calcValue
(
int
record
,
int
attrib
,
int
updates
,
char
*
buf
)
const
;
const
char
*
calcValue
(
int
record
,
int
attrib
,
int
updates
,
char
*
buf
,
int
len
)
const
;
int
verifyRowValues
(
NDBT_ResultRow
*
const
pRow
)
const
;
int
verifyRowValues
(
NDBT_ResultRow
*
const
pRow
)
const
;
int
getIdValue
(
NDBT_ResultRow
*
const
pRow
)
const
;
int
getIdValue
(
NDBT_ResultRow
*
const
pRow
)
const
;
...
...
ndb/test/ndbapi/testBitfield.cpp
View file @
bcbbd47d
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include <ndb_opts.h>
#include <ndb_opts.h>
#include <NDBT.hpp>
#include <NDBT.hpp>
#include <NdbApi.hpp>
#include <NdbApi.hpp>
#include <HugoTransactions.hpp>
static
const
char
*
opt_connect_str
=
0
;
static
const
char
*
opt_connect_str
=
0
;
static
const
char
*
_dbname
=
"TEST_DB"
;
static
const
char
*
_dbname
=
"TEST_DB"
;
...
@@ -129,13 +130,61 @@ static
...
@@ -129,13 +130,61 @@ static
const
NdbDictionary
::
Table
*
const
NdbDictionary
::
Table
*
create_random_table
(
Ndb
*
pNdb
)
create_random_table
(
Ndb
*
pNdb
)
{
{
NdbDictionary
::
Table
tab
;
Uint32
cols
=
1
+
(
rand
()
%
(
NDB_MAX_ATTRIBUTES_IN_TABLE
-
1
));
Uint32
keys
=
NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY
;
Uint32
length
=
4096
;
Uint32
key_size
=
NDB_MAX_KEYSIZE_IN_WORDS
;
BaseString
name
;
name
.
assfmt
(
"TAB_%d"
,
rand
()
&
65535
);
tab
.
setName
(
name
.
c_str
());
for
(
int
i
=
0
;
i
<
cols
&&
length
>
0
;
i
++
)
{
NdbDictionary
::
Column
col
;
name
.
assfmt
(
"COL_%d"
,
i
);
col
.
setName
(
name
.
c_str
());
if
(
i
==
0
||
i
==
1
)
{
col
.
setType
(
NdbDictionary
::
Column
::
Unsigned
);
col
.
setLength
(
1
);
col
.
setNullable
(
false
);
col
.
setPrimaryKey
(
i
==
0
);
tab
.
addColumn
(
col
);
continue
;
}
col
.
setType
(
NdbDictionary
::
Column
::
Bit
);
Uint32
len
=
1
+
(
rand
()
%
128
);
//(length - 1));
col
.
setLength
(
len
);
length
-=
len
;
col
.
setNullable
((
rand
()
>>
16
)
&
1
);
col
.
setPrimaryKey
(
false
);
tab
.
addColumn
(
col
);
}
ndbout
<<
(
NDBT_Table
&
)
tab
<<
endl
;
if
(
pNdb
->
getDictionary
()
->
createTable
(
tab
)
==
0
)
{
return
pNdb
->
getDictionary
()
->
getTable
(
tab
.
getName
());
}
return
0
;
return
0
;
}
}
static
static
int
int
transactions
(
Ndb
*
pNdb
,
const
NdbDictionary
::
Table
*
tab
)
transactions
(
Ndb
*
pNdb
,
const
NdbDictionary
::
Table
*
tab
)
{
{
return
0
;
int
i
=
0
;
HugoTransactions
trans
(
*
tab
);
i
|=
trans
.
loadTable
(
pNdb
,
1000
);
i
|=
trans
.
pkReadRecords
(
pNdb
,
1000
,
13
);
i
|=
trans
.
scanReadRecords
(
pNdb
,
1000
,
25
);
i
|=
trans
.
pkUpdateRecords
(
pNdb
,
1000
,
37
);
i
|=
trans
.
scanUpdateRecords
(
pNdb
,
1000
,
25
);
i
|=
trans
.
pkDelRecords
(
pNdb
,
500
,
23
);
i
|=
trans
.
clearTable
(
pNdb
);
return
i
;
}
}
static
static
...
...
ndb/test/src/HugoCalculator.cpp
View file @
bcbbd47d
...
@@ -85,17 +85,16 @@ const char*
...
@@ -85,17 +85,16 @@ const char*
HugoCalculator
::
calcValue
(
int
record
,
HugoCalculator
::
calcValue
(
int
record
,
int
attrib
,
int
attrib
,
int
updates
,
int
updates
,
char
*
buf
)
const
{
char
*
buf
,
int
len
)
const
{
const
char
a
[
26
]
=
{
"UAWBORCTDPEFQGNYHISJMKXLZ"
};
const
char
a
[
26
]
=
{
"UAWBORCTDPEFQGNYHISJMKXLZ"
};
const
NdbDictionary
::
Column
*
attr
=
m_tab
.
getColumn
(
attrib
);
const
NdbDictionary
::
Column
*
attr
=
m_tab
.
getColumn
(
attrib
);
int
val
=
calcValue
(
record
,
attrib
,
updates
);
int
val
=
calcValue
(
record
,
attrib
,
updates
);
int
len
;
if
(
attr
->
getPrimaryKey
()){
if
(
attr
->
getPrimaryKey
()){
// Create a string where val is printed as chars in the beginning
// Create a string where val is printed as chars in the beginning
// of the string, then fill with other chars
// of the string, then fill with other chars
// The string length is set to the same size as the attribute
// The string length is set to the same size as the attribute
len
=
attr
->
getLength
();
BaseString
::
snprintf
(
buf
,
len
,
"%d"
,
val
);
BaseString
::
snprintf
(
buf
,
len
,
"%d"
,
val
);
for
(
int
i
=
strlen
(
buf
);
i
<
len
;
i
++
)
for
(
int
i
=
strlen
(
buf
);
i
<
len
;
i
++
)
buf
[
i
]
=
a
[((
val
^
i
)
%
25
)];
buf
[
i
]
=
a
[((
val
^
i
)
%
25
)];
...
@@ -104,13 +103,19 @@ HugoCalculator::calcValue(int record,
...
@@ -104,13 +103,19 @@ HugoCalculator::calcValue(int record,
// Fill buf with some pattern so that we can detect
// Fill buf with some pattern so that we can detect
// anomalies in the area that we don't fill with chars
// anomalies in the area that we don't fill with chars
int
i
;
int
i
;
for
(
i
=
0
;
i
<
attr
->
getLength
()
;
i
++
)
for
(
i
=
0
;
i
<
len
;
i
++
)
buf
[
i
]
=
((
i
+
2
)
%
255
);
buf
[
i
]
=
((
i
+
2
)
%
255
);
// Calculate length of the string to create. We want the string
// Calculate length of the string to create. We want the string
// length to be varied between max and min of this attribute.
// length to be varied between max and min of this attribute.
Uint32
org
=
len
;
len
=
val
%
(
attr
->
getLength
()
+
1
);
if
(
attr
->
getType
()
==
NdbDictionary
::
Column
::
Varchar
)
len
=
val
%
(
len
+
1
);
else
if
((
val
%
(
len
+
1
))
==
0
)
len
=
0
;
// If len == 0 return NULL if this is a nullable attribute
// If len == 0 return NULL if this is a nullable attribute
if
(
len
==
0
){
if
(
len
==
0
){
if
(
attr
->
getNullable
()
==
true
)
if
(
attr
->
getNullable
()
==
true
)
...
@@ -121,6 +126,14 @@ HugoCalculator::calcValue(int record,
...
@@ -121,6 +126,14 @@ HugoCalculator::calcValue(int record,
for
(
i
=
0
;
i
<
len
;
i
++
)
for
(
i
=
0
;
i
<
len
;
i
++
)
buf
[
i
]
=
a
[((
val
^
i
)
%
25
)];
buf
[
i
]
=
a
[((
val
^
i
)
%
25
)];
buf
[
len
]
=
0
;
buf
[
len
]
=
0
;
if
(
attr
->
getType
()
==
NdbDictionary
::
Column
::
Bit
)
{
Uint32
bits
=
attr
->
getLength
();
Uint32
pos
=
bits
>>
5
;
Uint32
size
=
bits
&
31
;
((
Uint32
*
)
buf
)[
pos
]
&=
((
1
<<
size
)
-
1
);
}
}
}
return
buf
;
return
buf
;
};
};
...
@@ -131,7 +144,8 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
...
@@ -131,7 +144,8 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
id
=
pRow
->
attributeStore
(
m_idCol
)
->
u_32_value
();
id
=
pRow
->
attributeStore
(
m_idCol
)
->
u_32_value
();
updates
=
pRow
->
attributeStore
(
m_updatesCol
)
->
u_32_value
();
updates
=
pRow
->
attributeStore
(
m_updatesCol
)
->
u_32_value
();
int
result
=
0
;
// Check the values of each column
// Check the values of each column
for
(
int
i
=
0
;
i
<
m_tab
.
getNoOfColumns
();
i
++
){
for
(
int
i
=
0
;
i
<
m_tab
.
getNoOfColumns
();
i
++
){
if
(
i
!=
m_updatesCol
&&
id
!=
m_idCol
)
{
if
(
i
!=
m_updatesCol
&&
id
!=
m_idCol
)
{
...
@@ -145,9 +159,8 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
...
@@ -145,9 +159,8 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
case
NdbDictionary
:
:
Column
::
Varchar
:
case
NdbDictionary
:
:
Column
::
Varchar
:
case
NdbDictionary
:
:
Column
::
Binary
:
case
NdbDictionary
:
:
Column
::
Binary
:
case
NdbDictionary
:
:
Column
::
Varbinary
:
{
case
NdbDictionary
:
:
Column
::
Varbinary
:
{
int
result
=
0
;
char
*
buf
=
new
char
[
len
+
1
];
char
*
buf
=
new
char
[
len
+
1
];
const
char
*
res
=
calcValue
(
id
,
i
,
updates
,
buf
);
const
char
*
res
=
calcValue
(
id
,
i
,
updates
,
buf
,
len
);
if
(
res
==
NULL
){
if
(
res
==
NULL
){
if
(
!
pRow
->
attributeStore
(
i
)
->
isNULL
()){
if
(
!
pRow
->
attributeStore
(
i
)
->
isNULL
()){
g_err
<<
"|- NULL ERROR: expected a NULL but the column was not null"
<<
endl
;
g_err
<<
"|- NULL ERROR: expected a NULL but the column was not null"
<<
endl
;
...
@@ -155,16 +168,13 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
...
@@ -155,16 +168,13 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
result
=
-
1
;
result
=
-
1
;
}
}
}
else
{
}
else
{
if
(
memcmp
(
res
,
pRow
->
attributeStore
(
i
)
->
aRef
(),
pRow
->
attributeStore
(
i
)
->
arraySize
()
)
!=
0
){
if
(
memcmp
(
res
,
pRow
->
attributeStore
(
i
)
->
aRef
(),
len
)
!=
0
){
// if (memcmp(res, pRow->attributeStore(i)->aRef(), pRow->attributeStore(i)->getLength()) != 0){
// if (memcmp(res, pRow->attributeStore(i)->aRef(), pRow->attributeStore(i)->getLength()) != 0){
g_err
<<
"arraySize(): "
g_err
<<
"Column: "
<<
attr
->
getName
()
<<
endl
;
<<
pRow
->
attributeStore
(
i
)
->
arraySize
()
<<
", NdbDict::Column::getLength(): "
<<
attr
->
getLength
()
<<
endl
;
const
char
*
buf2
=
pRow
->
attributeStore
(
i
)
->
aRef
();
const
char
*
buf2
=
pRow
->
attributeStore
(
i
)
->
aRef
();
for
(
Uint32
j
=
0
;
j
<
pRow
->
attributeStore
(
i
)
->
arraySize
()
;
j
++
)
for
(
Uint32
j
=
0
;
j
<
len
;
j
++
)
{
{
g_err
<<
j
<<
":"
<<
buf
[
j
]
<<
"["
<<
buf2
[
j
]
<<
"]"
;
g_err
<<
j
<<
":"
<<
hex
<<
(
int
)
buf
[
j
]
<<
"["
<<
hex
<<
(
int
)
buf2
[
j
]
<<
"]"
;
if
(
buf
[
j
]
!=
buf2
[
j
])
if
(
buf
[
j
]
!=
buf2
[
j
])
{
{
g_err
<<
"==>Match failed!"
;
g_err
<<
"==>Match failed!"
;
...
@@ -173,7 +183,7 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
...
@@ -173,7 +183,7 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
}
}
g_err
<<
endl
;
g_err
<<
endl
;
g_err
<<
"|- Invalid data found in attribute "
<<
i
<<
":
\"
"
g_err
<<
"|- Invalid data found in attribute "
<<
i
<<
":
\"
"
<<
pRow
->
attributeStore
(
i
)
->
aRef
()
<<
pRow
->
attributeStore
(
i
)
->
aRef
()
<<
"
\"
!=
\"
"
<<
res
<<
"
\"
"
<<
endl
<<
"
\"
!=
\"
"
<<
res
<<
"
\"
"
<<
endl
<<
"Length of expected="
<<
(
unsigned
)
strlen
(
res
)
<<
endl
<<
"Length of expected="
<<
(
unsigned
)
strlen
(
res
)
<<
endl
<<
"Lenght of read="
<<
"Lenght of read="
...
@@ -183,7 +193,6 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
...
@@ -183,7 +193,6 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
}
}
}
}
delete
[]
buf
;
delete
[]
buf
;
return
result
;
}
}
break
;
break
;
case
NdbDictionary
:
:
Column
::
Int
:
case
NdbDictionary
:
:
Column
::
Int
:
...
@@ -194,9 +203,9 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
...
@@ -194,9 +203,9 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
g_err
<<
"|- Invalid data found:
\"
"
<<
val
<<
"
\"
!=
\"
"
g_err
<<
"|- Invalid data found:
\"
"
<<
val
<<
"
\"
!=
\"
"
<<
cval
<<
"
\"
"
<<
endl
;
<<
cval
<<
"
\"
"
<<
endl
;
g_err
<<
"|- The row:
\"
"
<<
(
*
pRow
)
<<
"
\"
"
<<
endl
;
g_err
<<
"|- The row:
\"
"
<<
(
*
pRow
)
<<
"
\"
"
<<
endl
;
re
turn
-
1
;
re
sult
=
-
1
;
}
}
return
0
;
break
;
}
}
case
NdbDictionary
:
:
Column
::
Bigint
:
case
NdbDictionary
:
:
Column
::
Bigint
:
case
NdbDictionary
:
:
Column
::
Bigunsigned
:
{
case
NdbDictionary
:
:
Column
::
Bigunsigned
:
{
...
@@ -207,9 +216,8 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
...
@@ -207,9 +216,8 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
<<
cval
<<
"
\"
"
<<
cval
<<
"
\"
"
<<
endl
;
<<
endl
;
g_err
<<
"|- The row:
\"
"
<<
(
*
pRow
)
<<
"
\"
"
<<
endl
;
g_err
<<
"|- The row:
\"
"
<<
(
*
pRow
)
<<
"
\"
"
<<
endl
;
re
turn
-
1
;
re
sult
=
-
1
;
}
}
return
0
;
}
}
break
;
break
;
case
NdbDictionary
:
:
Column
::
Float
:
{
case
NdbDictionary
:
:
Column
::
Float
:
{
...
@@ -217,20 +225,21 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
...
@@ -217,20 +225,21 @@ HugoCalculator::verifyRowValues(NDBT_ResultRow* const pRow) const{
float
val
=
pRow
->
attributeStore
(
i
)
->
float_value
();
float
val
=
pRow
->
attributeStore
(
i
)
->
float_value
();
if
(
val
!=
cval
){
if
(
val
!=
cval
){
g_err
<<
"|- Invalid data found:
\"
"
<<
val
<<
"
\"
!=
\"
"
g_err
<<
"|- Invalid data found:
\"
"
<<
val
<<
"
\"
!=
\"
"
<<
cval
<<
"
\"
"
<<
endl
;
<<
cval
<<
"
\"
"
<<
endl
;
g_err
<<
"|- The row:
\"
"
<<
(
*
pRow
)
<<
"
\"
"
<<
endl
;
g_err
<<
"|- The row:
\"
"
<<
(
*
pRow
)
<<
"
\"
"
<<
endl
;
re
turn
-
1
;
re
sult
=
-
1
;
}
}
return
0
;
}
}
break
;
break
;
case
NdbDictionary
:
:
Column
::
Undefined
:
case
NdbDictionary
:
:
Column
::
Undefined
:
default:
assert
(
0
);
result
=
-
1
;
break
;
break
;
}
}
}
}
}
}
assert
(
0
);
return
result
;
return
-
1
;
}
}
int
int
...
...
ndb/test/src/HugoOperations.cpp
View file @
bcbbd47d
...
@@ -414,15 +414,18 @@ int HugoOperations::equalForAttr(NdbOperation* pOp,
...
@@ -414,15 +414,18 @@ int HugoOperations::equalForAttr(NdbOperation* pOp,
return
NDBT_FAILED
;
return
NDBT_FAILED
;
}
}
int
len
=
attr
->
getLength
();
switch
(
attr
->
getType
()){
switch
(
attr
->
getType
()){
case
NdbDictionary
:
:
Column
::
Bit
:
case
NdbDictionary
:
:
Column
::
Bit
:
len
=
4
*
((
len
+
31
)
>>
5
);
case
NdbDictionary
:
:
Column
::
Char
:
case
NdbDictionary
:
:
Column
::
Char
:
case
NdbDictionary
:
:
Column
::
Varchar
:
case
NdbDictionary
:
:
Column
::
Varchar
:
case
NdbDictionary
:
:
Column
::
Binary
:
case
NdbDictionary
:
:
Column
::
Binary
:
case
NdbDictionary
:
:
Column
::
Varbinary
:
{
case
NdbDictionary
:
:
Column
::
Varbinary
:
{
char
buf
[
8000
];
char
buf
[
8000
];
memset
(
buf
,
0
,
sizeof
(
buf
));
memset
(
buf
,
0
,
sizeof
(
buf
));
check
=
pOp
->
equal
(
attr
->
getName
(),
calc
.
calcValue
(
rowId
,
attrId
,
0
,
buf
));
check
=
pOp
->
equal
(
attr
->
getName
(),
calc
.
calcValue
(
rowId
,
attrId
,
0
,
buf
,
len
));
break
;
break
;
}
}
case
NdbDictionary
:
:
Column
::
Int
:
case
NdbDictionary
:
:
Column
::
Int
:
...
@@ -451,16 +454,18 @@ int HugoOperations::setValueForAttr(NdbOperation* pOp,
...
@@ -451,16 +454,18 @@ int HugoOperations::setValueForAttr(NdbOperation* pOp,
int
updateId
){
int
updateId
){
int
check
=
-
1
;
int
check
=
-
1
;
const
NdbDictionary
::
Column
*
attr
=
tab
.
getColumn
(
attrId
);
const
NdbDictionary
::
Column
*
attr
=
tab
.
getColumn
(
attrId
);
int
len
=
attr
->
getLength
();
switch
(
attr
->
getType
()){
switch
(
attr
->
getType
()){
case
NdbDictionary
:
:
Column
::
Bit
:
case
NdbDictionary
:
:
Column
::
Bit
:
len
=
4
*
((
len
+
31
)
>>
5
);
case
NdbDictionary
:
:
Column
::
Char
:
case
NdbDictionary
:
:
Column
::
Char
:
case
NdbDictionary
:
:
Column
::
Varchar
:
case
NdbDictionary
:
:
Column
::
Varchar
:
case
NdbDictionary
:
:
Column
::
Binary
:
case
NdbDictionary
:
:
Column
::
Binary
:
case
NdbDictionary
:
:
Column
::
Varbinary
:
{
case
NdbDictionary
:
:
Column
::
Varbinary
:
{
char
buf
[
8000
];
char
buf
[
8000
];
check
=
pOp
->
setValue
(
attr
->
getName
(),
check
=
pOp
->
setValue
(
attr
->
getName
(),
calc
.
calcValue
(
rowId
,
attrId
,
updateId
,
buf
));
calc
.
calcValue
(
rowId
,
attrId
,
updateId
,
buf
,
len
));
break
;
break
;
}
}
case
NdbDictionary
:
:
Column
::
Int
:
{
case
NdbDictionary
:
:
Column
::
Int
:
{
...
...
ndb/test/tools/Makefile.am
View file @
bcbbd47d
ndbtest_PROGRAMS
=
hugo
Calculator hugo
Load hugoFill hugoLockRecords hugoPkDelete hugoPkRead hugoPkReadRecord hugoPkUpdate hugoScanRead hugoScanUpdate restart verify_index copy_tab create_index ndb_cpcc
ndbtest_PROGRAMS
=
hugoLoad hugoFill hugoLockRecords hugoPkDelete hugoPkRead hugoPkReadRecord hugoPkUpdate hugoScanRead hugoScanUpdate restart verify_index copy_tab create_index ndb_cpcc
# transproxy
# transproxy
...
...
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