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
a3b74b30
Commit
a3b74b30
authored
Dec 16, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wl2240 - ndb - more testing
parent
9cc5abd2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
9 deletions
+43
-9
ndb/test/ndbapi/testPartitioning.cpp
ndb/test/ndbapi/testPartitioning.cpp
+41
-8
ndb/test/src/HugoCalculator.cpp
ndb/test/src/HugoCalculator.cpp
+2
-1
No files found.
ndb/test/ndbapi/testPartitioning.cpp
View file @
a3b74b30
...
@@ -60,20 +60,53 @@ add_distribution_key(Ndb*, NdbDictionary::Table& tab, int when)
...
@@ -60,20 +60,53 @@ add_distribution_key(Ndb*, NdbDictionary::Table& tab, int when)
int
keys
=
tab
.
getNoOfPrimaryKeys
();
int
keys
=
tab
.
getNoOfPrimaryKeys
();
int
dks
=
(
2
*
keys
+
2
)
/
3
;
dks
=
(
dks
>
max_dks
?
max_dks
:
dks
);
int
dks
=
(
2
*
keys
+
2
)
/
3
;
dks
=
(
dks
>
max_dks
?
max_dks
:
dks
);
int
cnt
=
0
;
int
cnt
=
0
;
ndbout_c
(
"%s pks: %d dks: %d"
,
tab
.
getName
(),
keys
,
dks
);
for
(
unsigned
i
=
0
;
i
<
tab
.
getNoOfColumns
();
i
++
)
for
(
unsigned
i
=
0
;
i
<
tab
.
getNoOfColumns
();
i
++
)
if
(
tab
.
getColumn
(
i
)
->
getPrimaryKey
()
&&
tab
.
getColumn
(
i
)
->
getCharset
()
!=
0
)
keys
--
;
Uint32
max
=
NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY
-
tab
.
getNoOfPrimaryKeys
();
if
(
max_dks
<
max
)
max
=
max_dks
;
if
(
keys
<=
1
&&
max
>
0
)
{
dks
=
1
+
(
rand
()
%
max
);
ndbout_c
(
"%s pks: %d dks: %d"
,
tab
.
getName
(),
keys
,
dks
);
while
(
dks
--
)
{
NdbDictionary
::
Column
col
;
BaseString
name
;
name
.
assfmt
(
"PK_DK_%d"
,
dks
);
col
.
setName
(
name
.
c_str
());
col
.
setType
(
NdbDictionary
::
Column
::
Unsigned
);
col
.
setLength
(
1
);
col
.
setNullable
(
false
);
col
.
setPrimaryKey
(
1
);
col
.
setDistributionKey
(
true
);
tab
.
addColumn
(
col
);
}
}
else
{
{
NdbDictionary
::
Column
*
col
=
tab
.
getColumn
(
i
);
for
(
unsigned
i
=
0
;
i
<
tab
.
getNoOfColumns
();
i
++
)
if
(
col
->
getPrimaryKey
())
{
{
if
(
dks
>=
keys
||
(
rand
()
%
100
)
>
50
)
NdbDictionary
::
Column
*
col
=
tab
.
getColumn
(
i
);
if
(
col
->
getPrimaryKey
()
&&
col
->
getCharset
()
==
0
)
{
{
col
->
setDistributionKey
(
true
);
if
(
dks
>=
keys
||
(
rand
()
%
100
)
>
50
)
dks
--
;
{
col
->
setDistributionKey
(
true
);
dks
--
;
}
keys
--
;
}
}
keys
--
;
}
}
}
}
ndbout
<<
(
NDBT_Table
&
)
tab
<<
endl
;
return
0
;
return
0
;
}
}
...
@@ -81,7 +114,7 @@ static int
...
@@ -81,7 +114,7 @@ static int
run_create_table
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
)
run_create_table
(
NDBT_Context
*
ctx
,
NDBT_Step
*
step
)
{
{
max_dks
=
ctx
->
getProperty
(
"distributionkey"
,
(
unsigned
)
0
);
max_dks
=
ctx
->
getProperty
(
"distributionkey"
,
(
unsigned
)
0
);
if
(
NDBT_Tables
::
createTable
(
GETNDB
(
step
),
if
(
NDBT_Tables
::
createTable
(
GETNDB
(
step
),
ctx
->
getTab
()
->
getName
(),
ctx
->
getTab
()
->
getName
(),
false
,
false
,
false
,
false
,
...
...
ndb/test/src/HugoCalculator.cpp
View file @
a3b74b30
...
@@ -40,7 +40,8 @@ HugoCalculator::HugoCalculator(const NdbDictionary::Table& tab) : m_tab(tab) {
...
@@ -40,7 +40,8 @@ HugoCalculator::HugoCalculator(const NdbDictionary::Table& tab) : m_tab(tab) {
// The "number of updates" column for this table is found in the last column
// The "number of updates" column for this table is found in the last column
for
(
i
=
m_tab
.
getNoOfColumns
()
-
1
;
i
>=
0
;
i
--
){
for
(
i
=
m_tab
.
getNoOfColumns
()
-
1
;
i
>=
0
;
i
--
){
const
NdbDictionary
::
Column
*
attr
=
m_tab
.
getColumn
(
i
);
const
NdbDictionary
::
Column
*
attr
=
m_tab
.
getColumn
(
i
);
if
(
attr
->
getType
()
==
NdbDictionary
::
Column
::
Unsigned
){
if
(
attr
->
getType
()
==
NdbDictionary
::
Column
::
Unsigned
&&
!
attr
->
getPrimaryKey
()){
m_updatesCol
=
i
;
m_updatesCol
=
i
;
break
;
break
;
}
}
...
...
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