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
9d902d4c
Commit
9d902d4c
authored
Jun 29, 2006
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
manual merge
parents
6fb6a105
6f318d16
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
45 deletions
+53
-45
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+53
-45
No files found.
sql/ha_ndbcluster.cc
View file @
9d902d4c
...
@@ -457,8 +457,8 @@ void ha_ndbcluster::records_update()
...
@@ -457,8 +457,8 @@ void ha_ndbcluster::records_update()
// if (info->records == ~(ha_rows)0)
// if (info->records == ~(ha_rows)0)
{
{
Ndb
*
ndb
=
get_ndb
();
Ndb
*
ndb
=
get_ndb
();
ndb
->
setDatabaseName
(
m_dbname
);
struct
Ndb_statistics
stat
;
struct
Ndb_statistics
stat
;
ndb
->
setDatabaseName
(
m_dbname
);
if
(
ndb_get_table_statistics
(
ndb
,
m_table
,
&
stat
)
==
0
)
if
(
ndb_get_table_statistics
(
ndb
,
m_table
,
&
stat
)
==
0
)
{
{
stats
.
mean_rec_length
=
stat
.
row_size
;
stats
.
mean_rec_length
=
stat
.
row_size
;
...
@@ -3594,6 +3594,7 @@ void ha_ndbcluster::info(uint flag)
...
@@ -3594,6 +3594,7 @@ void ha_ndbcluster::info(uint flag)
Ndb
*
ndb
=
get_ndb
();
Ndb
*
ndb
=
get_ndb
();
ndb
->
setDatabaseName
(
m_dbname
);
ndb
->
setDatabaseName
(
m_dbname
);
struct
Ndb_statistics
stat
;
struct
Ndb_statistics
stat
;
ndb
->
setDatabaseName
(
m_dbname
);
if
(
current_thd
->
variables
.
ndb_use_exact_count
&&
if
(
current_thd
->
variables
.
ndb_use_exact_count
&&
ndb_get_table_statistics
(
ndb
,
m_table
,
&
stat
)
==
0
)
ndb_get_table_statistics
(
ndb
,
m_table
,
&
stat
)
==
0
)
{
{
...
@@ -7403,6 +7404,7 @@ ndb_get_table_statistics(Ndb* ndb, const NDBTAB *ndbtab,
...
@@ -7403,6 +7404,7 @@ ndb_get_table_statistics(Ndb* ndb, const NDBTAB *ndbtab,
DBUG_ENTER
(
"ndb_get_table_statistics"
);
DBUG_ENTER
(
"ndb_get_table_statistics"
);
DBUG_PRINT
(
"enter"
,
(
"table: %s"
,
ndbtab
->
getName
()));
DBUG_PRINT
(
"enter"
,
(
"table: %s"
,
ndbtab
->
getName
()));
NdbTransaction
*
pTrans
;
NdbTransaction
*
pTrans
;
NdbError
error
;
int
retries
=
10
;
int
retries
=
10
;
int
retry_sleep
=
30
*
1000
;
/* 30 milliseconds */
int
retry_sleep
=
30
*
1000
;
/* 30 milliseconds */
...
@@ -7410,57 +7412,51 @@ ndb_get_table_statistics(Ndb* ndb, const NDBTAB *ndbtab,
...
@@ -7410,57 +7412,51 @@ ndb_get_table_statistics(Ndb* ndb, const NDBTAB *ndbtab,
do
do
{
{
pTrans
=
ndb
->
startTransaction
();
Uint64
rows
,
commits
,
mem
;
if
(
pTrans
==
NULL
)
Uint32
size
;
Uint64
sum_rows
=
0
;
Uint64
sum_commits
=
0
;
NdbScanOperation
*
pOp
;
NdbResultSet
*
rs
;
int
check
;
if
((
pTrans
=
ndb
->
startTransaction
())
==
NULL
)
{
{
if
(
ndb
->
getNdbError
().
status
==
NdbError
::
TemporaryError
&&
error
=
ndb
->
getNdbError
();
retries
--
)
goto
retry
;
{
}
my_sleep
(
retry_sleep
);
continue
;
if
((
pOp
=
pTrans
->
getNdbScanOperation
(
ndbtab
))
==
NULL
)
}
{
ERR_RETURN
(
ndb
->
getNdbError
());
error
=
pTrans
->
getNdbError
();
goto
retry
;
}
}
NdbScanOperation
*
pOp
=
pTrans
->
getNdbScanOperation
(
ndbtab
);
if
(
pOp
==
NULL
)
break
;
if
(
pOp
->
readTuples
(
NdbOperation
::
LM_CommittedRead
))
if
(
pOp
->
readTuples
(
NdbOperation
::
LM_CommittedRead
))
break
;
{
error
=
pOp
->
getNdbError
();
goto
retry
;
}
int
check
=
pOp
->
interpret_exit_last_row
();
if
(
pOp
->
interpret_exit_last_row
()
==
-
1
)
if
(
check
==
-
1
)
{
break
;
error
=
pOp
->
getNdbError
();
goto
retry
;
}
Uint64
rows
,
commits
,
mem
;
Uint32
size
;
pOp
->
getValue
(
NdbDictionary
::
Column
::
ROW_COUNT
,
(
char
*
)
&
rows
);
pOp
->
getValue
(
NdbDictionary
::
Column
::
ROW_COUNT
,
(
char
*
)
&
rows
);
pOp
->
getValue
(
NdbDictionary
::
Column
::
COMMIT_COUNT
,
(
char
*
)
&
commits
);
pOp
->
getValue
(
NdbDictionary
::
Column
::
COMMIT_COUNT
,
(
char
*
)
&
commits
);
pOp
->
getValue
(
NdbDictionary
::
Column
::
ROW_SIZE
,
(
char
*
)
&
size
);
pOp
->
getValue
(
NdbDictionary
::
Column
::
ROW_SIZE
,
(
char
*
)
&
size
);
pOp
->
getValue
(
NdbDictionary
::
Column
::
FRAGMENT_MEMORY
,
(
char
*
)
&
mem
);
pOp
->
getValue
(
NdbDictionary
::
Column
::
FRAGMENT_MEMORY
,
(
char
*
)
&
mem
);
check
=
pTrans
->
execute
(
NdbTransaction
::
NoCommit
,
if
(
pTrans
->
execute
(
NdbTransaction
::
NoCommit
,
NdbTransaction
::
AbortOnError
,
NdbTransaction
::
AbortOnError
,
TRUE
);
TRUE
)
==
-
1
)
if
(
check
==
-
1
)
{
{
if
(
pTrans
->
getNdbError
().
status
==
NdbError
::
TemporaryError
&&
error
=
pTrans
->
getNdbError
();
retries
--
)
goto
retry
;
{
ndb
->
closeTransaction
(
pTrans
);
pTrans
=
0
;
my_sleep
(
retry_sleep
);
continue
;
}
break
;
}
}
Uint32
count
=
0
;
Uint64
sum_rows
=
0
;
Uint64
sum_commits
=
0
;
Uint64
sum_row_size
=
0
;
Uint64
sum_mem
=
0
;
while
((
check
=
pOp
->
nextResult
(
TRUE
,
TRUE
))
==
0
)
while
((
check
=
pOp
->
nextResult
(
TRUE
,
TRUE
))
==
0
)
{
{
sum_rows
+=
rows
;
sum_rows
+=
rows
;
...
@@ -7472,7 +7468,10 @@ ndb_get_table_statistics(Ndb* ndb, const NDBTAB *ndbtab,
...
@@ -7472,7 +7468,10 @@ ndb_get_table_statistics(Ndb* ndb, const NDBTAB *ndbtab,
}
}
if
(
check
==
-
1
)
if
(
check
==
-
1
)
break
;
{
error
=
pOp
->
getNdbError
();
goto
retry
;
}
pOp
->
close
(
TRUE
);
pOp
->
close
(
TRUE
);
...
@@ -7489,12 +7488,21 @@ ndb_get_table_statistics(Ndb* ndb, const NDBTAB *ndbtab,
...
@@ -7489,12 +7488,21 @@ ndb_get_table_statistics(Ndb* ndb, const NDBTAB *ndbtab,
sum_mem
,
count
));
sum_mem
,
count
));
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
retry:
if
(
pTrans
)
{
ndb
->
closeTransaction
(
pTrans
);
pTrans
=
NULL
;
}
if
(
error
.
status
==
NdbError
::
TemporaryError
&&
retries
--
)
{
my_sleep
(
retry_sleep
);
continue
;
}
break
;
}
while
(
1
);
}
while
(
1
);
DBUG_PRINT
(
"exit"
,
(
"failed, error %u(%s)"
,
error
.
code
,
error
.
message
));
if
(
pTrans
)
ERR_RETURN
(
error
);
ndb
->
closeTransaction
(
pTrans
);
DBUG_PRINT
(
"exit"
,
(
"failed"
));
DBUG_RETURN
(
-
1
);
}
}
/*
/*
...
...
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