diff options
author | V S Murthy Sidagam <venkata.sidagam@oracle.com> | 2014-11-26 16:59:58 +0530 |
---|---|---|
committer | V S Murthy Sidagam <venkata.sidagam@oracle.com> | 2014-11-26 16:59:58 +0530 |
commit | aed8369e43c1ee4b929109ff9af1381d7fad1840 (patch) | |
tree | a071671ded186db9ecb8fd1a30d1e46e94d0993a /sql/table.cc | |
parent | 5a587b6d2897e786b515d05a09b37ef81695dab7 (diff) | |
download | mariadb-git-aed8369e43c1ee4b929109ff9af1381d7fad1840.tar.gz |
Bug #16869534 QUERYING SUBSET OF COLUMNS DOESN'T USE TABLE CACHE; OPENED_TABLES I
Description: When querying a subset of columns from the information_schema.TABLES
Analysis: When information about tables is collected for statements like
"SELECT ENGINE FROM I_S.TABLES" we do not perform full-blown table opens
in SE, instead we only use information from table shares from the Table
Definition Cache or .FRMs. Still in order to simplify I_S implementation
mock TABLE objects are created from TABLE_SHARE during this process.
This is done by calling open_table_from_share() function with special
arguments. Since this function always increments "Opened_tables" counter,
calls to it can be mistakingly interpreted as full-blown table opens in SE.
Note that claim that "'SELECT ENGINE FROM I_S.TABLES' statement doesn't
use Table Cache" is nevertheless factually correct. But it misses the
point, since such statements a) don't use full-blown TABLE objects and
therefore don't do table opens b) still use Table Definition Cache.
Fix: We are now incrementing the counter when db_stat(i.e open flags for ha_open(
we have considered an optimization which would use TABLE objects from
Table Cache when available instead of constructing mock TABLE objects,
but found it too intrusive for stable releases.
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/table.cc b/sql/table.cc index b24e03fbe1a..c17ee39fe9e 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2138,7 +2138,9 @@ partititon_err: outparam->no_replicate= outparam->file && test(outparam->file->ha_table_flags() & HA_HAS_OWN_BINLOGGING); - thd->status_var.opened_tables++; + /* Increment the opened_tables counter, only when open flags set. */ + if (db_stat) + thd->status_var.opened_tables++; DBUG_RETURN (0); |