-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug#32169848 THD_NDB TRANSACTION FUNCTIONALITY [#16]
Add counter for number of times table stats has been fetched from NDB. Remove usage of execute, scan and purge counter from the function that fetches table stats. Keep counting one execute when fetching table stats. Change-Id: I489babe9631e3c385ac8b49dfadc440cfe22fbaf
- Loading branch information
Showing
10 changed files
with
101 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
mysql-test/suite/ndbcluster/fetch_table_stats_count.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# | ||
# Showing the "ndb_fetch_table_stats" counter | ||
# | ||
# Since fetching table stats incurs one roundtrip to NDB it should not | ||
# be done more than strictly required, the "ndb_fetch_table_stats" | ||
# counter provides a means to check when table stats are fetched. | ||
CREATE TABLE t1 (a int primary key) ENGINE = NDB; | ||
INSERT INTO t1 VALUES (1); | ||
SELECT * FROM t1; | ||
a | ||
1 | ||
Table stats was fetched 1 time (expected 1) | ||
# Another query using an open handler instance should not cause | ||
# table stats to be fetched again | ||
SELECT * FROM t1; | ||
a | ||
1 | ||
Table stats was fetched 0 times (expected 0) | ||
# Closing handler, should really not need to fetch | ||
# table stats again, but they seem to be | ||
FLUSH TABLES t1; | ||
Table stats was fetched 1 times (oops! expected 0) | ||
# Running query again, should cause | ||
# table stats to be fetched once again | ||
SELECT * FROM t1; | ||
a | ||
1 | ||
Table stats was fetched 1 times (expected 1) | ||
DROP TABLE t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--source include/have_ndb.inc | ||
|
||
--echo # | ||
--echo # Showing the "ndb_fetch_table_stats" counter | ||
--echo # | ||
--echo # Since fetching table stats incurs one roundtrip to NDB it should not | ||
--echo # be done more than strictly required, the "ndb_fetch_table_stats" | ||
--echo # counter provides a means to check when table stats are fetched. | ||
|
||
CREATE TABLE t1 (a int primary key) ENGINE = NDB; | ||
|
||
let $count = | ||
`SELECT VARIABLE_VALUE | ||
FROM performance_schema.session_status | ||
WHERE variable_name = 'NDB_FETCH_TABLE_STATS'`; | ||
|
||
INSERT INTO t1 VALUES (1); | ||
SELECT * FROM t1; | ||
|
||
let $count = | ||
`SELECT VARIABLE_VALUE-$count | ||
FROM performance_schema.session_status | ||
WHERE variable_name = 'NDB_FETCH_TABLE_STATS'`; | ||
echo Table stats was fetched $count time (expected 1); | ||
|
||
--echo # Another query using an open handler instance should not cause | ||
--echo # table stats to be fetched again | ||
SELECT * FROM t1; | ||
|
||
let $count = | ||
`SELECT VARIABLE_VALUE-$count | ||
FROM performance_schema.session_status | ||
WHERE variable_name = 'NDB_FETCH_TABLE_STATS'`; | ||
echo Table stats was fetched $count times (expected 0); | ||
|
||
--echo # Closing handler, should really not need to fetch | ||
--echo # table stats again, but they seem to be | ||
FLUSH TABLES t1; | ||
|
||
let $count = | ||
`SELECT VARIABLE_VALUE-$count | ||
FROM performance_schema.session_status | ||
WHERE variable_name = 'NDB_FETCH_TABLE_STATS'`; | ||
echo Table stats was fetched $count times (oops! expected 0); | ||
|
||
--echo # Running query again, should cause | ||
--echo # table stats to be fetched once again | ||
SELECT * FROM t1; | ||
|
||
let $count = | ||
`SELECT VARIABLE_VALUE-$count | ||
FROM performance_schema.session_status | ||
WHERE variable_name = 'NDB_FETCH_TABLE_STATS'`; | ||
echo Table stats was fetched $count times (expected 1); | ||
|
||
DROP TABLE t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters