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
f835cc6a
Commit
f835cc6a
authored
Mar 22, 2006
by
jonas@perch.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb -
Add per partition info (optionally to ndb_desc)
parent
c0597ff6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
ndb/tools/desc.cpp
ndb/tools/desc.cpp
+77
-0
No files found.
ndb/tools/desc.cpp
View file @
f835cc6a
...
...
@@ -23,6 +23,7 @@ NDB_STD_OPTS_VARS;
static
const
char
*
_dbname
=
"TEST_DB"
;
static
int
_unqualified
=
0
;
static
int
_partinfo
=
0
;
static
struct
my_option
my_long_options
[]
=
{
NDB_STD_OPTS
(
"ndb_desc"
),
...
...
@@ -32,6 +33,9 @@ static struct my_option my_long_options[] =
{
"unqualified"
,
'u'
,
"Use unqualified table names"
,
(
gptr
*
)
&
_unqualified
,
(
gptr
*
)
&
_unqualified
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"extra-partition-info"
,
'p'
,
"Print more info per partition"
,
(
gptr
*
)
&
_partinfo
,
(
gptr
*
)
&
_partinfo
,
0
,
GET_BOOL
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
},
{
0
,
0
,
0
,
0
,
0
,
0
,
GET_NO_ARG
,
NO_ARG
,
0
,
0
,
0
,
0
,
0
,
0
}
};
static
void
usage
()
...
...
@@ -52,6 +56,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
"d:t:O,/tmp/ndb_desc.trace"
);
}
static
void
print_part_info
(
Ndb
*
pNdb
,
NDBT_Table
*
pTab
);
int
main
(
int
argc
,
char
**
argv
){
NDB_INIT
(
argv
[
0
]);
const
char
*
load_default_groups
[]
=
{
"mysql_cluster"
,
0
};
...
...
@@ -106,7 +112,11 @@ int main(int argc, char** argv){
ndbout
<<
(
*
pIdx
)
<<
endl
;
}
ndbout
<<
endl
;
if
(
_partinfo
)
print_part_info
(
pMyNdb
,
pTab
);
}
else
ndbout
<<
argv
[
i
]
<<
": "
<<
dict
->
getNdbError
()
<<
endl
;
...
...
@@ -115,3 +125,70 @@ int main(int argc, char** argv){
delete
pMyNdb
;
return
NDBT_ProgramExit
(
NDBT_OK
);
}
struct
InfoInfo
{
const
char
*
m_title
;
NdbRecAttr
*
m_rec_attr
;
const
NdbDictionary
::
Column
*
m_column
;
};
static
void
print_part_info
(
Ndb
*
pNdb
,
NDBT_Table
*
pTab
)
{
InfoInfo
g_part_info
[]
=
{
{
"Partition"
,
0
,
NdbDictionary
::
Column
::
FRAGMENT
},
{
"Row count"
,
0
,
NdbDictionary
::
Column
::
ROW_COUNT
},
{
"Commit count"
,
0
,
NdbDictionary
::
Column
::
COMMIT_COUNT
},
{
0
,
0
,
0
}
};
ndbout
<<
"-- Per partition info -- "
<<
endl
;
NdbConnection
*
pTrans
=
pNdb
->
startTransaction
();
if
(
pTrans
==
0
)
return
;
do
{
NdbScanOperation
*
pOp
=
pTrans
->
getNdbScanOperation
(
pTab
->
getName
());
if
(
pOp
==
NULL
)
break
;
NdbResultSet
*
rs
=
pOp
->
readTuples
(
NdbOperation
::
LM_CommittedRead
);
if
(
rs
==
0
)
break
;
if
(
pOp
->
interpret_exit_last_row
()
!=
0
)
break
;
Uint32
i
=
0
;
for
(
i
=
0
;
g_part_info
[
i
].
m_title
!=
0
;
i
++
)
{
if
((
g_part_info
[
i
].
m_rec_attr
=
pOp
->
getValue
(
g_part_info
[
i
].
m_column
))
==
0
)
break
;
}
if
(
g_part_info
[
i
].
m_title
!=
0
)
break
;
if
(
pTrans
->
execute
(
NoCommit
)
!=
0
)
break
;
for
(
i
=
0
;
g_part_info
[
i
].
m_title
!=
0
;
i
++
)
ndbout
<<
g_part_info
[
i
].
m_title
<<
"
\t
"
;
ndbout
<<
endl
;
while
(
rs
->
nextResult
()
==
0
)
{
for
(
i
=
0
;
g_part_info
[
i
].
m_title
!=
0
;
i
++
)
{
ndbout
<<
*
g_part_info
[
i
].
m_rec_attr
<<
"
\t
"
;
}
ndbout
<<
endl
;
}
}
while
(
0
);
pTrans
->
close
();
}
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