• V S Murthy Sidagam's avatar
    Bug #16869534 QUERYING SUBSET OF COLUMNS DOESN'T USE TABLE CACHE; OPENED_TABLES I · aed8369e
    V S Murthy Sidagam authored
    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.
    aed8369e
information_schema.test 54.6 KB