Bug #81040 "db.collections" shows collection after dropping via mysql client
Submitted: 12 Apr 2016 8:43 Modified: 9 Jun 2016 14:02
Reporter: Shahriyar Rzayev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Document Store: X Plugin Severity:S3 (Non-critical)
Version:5.7.12 OS:Any
Assigned to: CPU Architecture:Any

[12 Apr 2016 8:43] Shahriyar Rzayev
Description:
Easy to reproduce:

mysql> show tables;
Empty set (0,00 sec)

mysql-py>db.createCollection("flags")
<Collection:flags>

mysql> show tables;
+------------------+
| Tables_in_dbtest |
+------------------+
| flags            |
+------------------+
1 row in set (0,00 sec)

mysql-py>db.collections
{
    "flags": <Collection:flags>
}

mysql> drop table flags;
Query OK, 0 rows affected (0,00 sec)

mysql-py>db.collections
{
    "flags": <Collection:flags>
}

How to repeat:
See description

Suggested fix:
Do not show dropped "collection"
[12 Apr 2016 8:59] Shahriyar Rzayev
Also if you create new table it will be invisible on mysqlsh side:

mysql> create table t1(id int) engine=memory;
Query OK, 0 rows affected (0,00 sec)

mysql-py>db.tables;
{

}

Only after reconnect it will show:

mysql-py>db.tables
{
    "t1": <Table:t1>
}
[12 Apr 2016 13:03] MySQL Verification Team
Hello Shahriyar,

Thank you for the report.

Thanks,
Umesh
[9 Jun 2016 14:02] David Moss
Thanks for your feedback. This has been fixed in upcoming versions and the following was added to 1.0.4 release notes.
Functions depending on an internal cache, such as Schema.collections, Schema.tables, and Schema.views were not being updated correctly, which made statements such as DROP appear to not function correctly.