Closed Bug 784031 Opened 12 years ago Closed 11 years ago

Use facter to Audit MyISAM usage

Categories

(Data & BI Services Team :: DB: MySQL, task)

x86
macOS
task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: scabral, Assigned: rtucker)

References

Details

(Whiteboard: [2013q1])

MyISAM is usually not the appropriate storage engine for most Mozilla projects. Bad performance and replication breakages can be caused by this.

Let's audit the use of the MyISAM tables that exist, and work on converting the inappropriate databases.
Assignee: server-ops-database → scabral
Rob, would it be possible to generate a list of what machines have MyISAM tables and how many tables there are for each machine? This can be done with a MySQL query like:

"SELECT COUNT(*),TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES WHERE ENGINE='MyISAM' GROUP BY TABLE_SCHEMA";

and somehow saving the hostname too. Did we decide facter would work for this kind of thing?

If so, it would be very useful to get a similar list of:
 SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE DEFAULT_CHARACTER_SET_NAME!='utf8';
Whiteboard: [2013q1]
(for reference, by end of Q1 2013, generate a list of the MyISAM tables)
(In reply to Sheeri Cabral [:sheeri] from comment #2)
> (for reference, by end of Q1 2013, generate a list of the MyISAM tables)

I don't see why this wouldn't be possible with facter
Assignee: scabral → rtucker
To get the count of MyISAM tables this bash one liner works:

echo "SELECT COUNT(*),TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES WHERE ENGINE='MyISAM' GROUP BY TABLE_SCHEMA;" | mysql | tail -n 1 | awk '{print $1}'
To get the databases without the a default character set of utf8

echo "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE DEFAULT_CHARACTER_SET_NAME!='utf8';" | mysql | tail -n +2
I've got these 2 new facts staged and ready to push. Let me know when you're available for me to push and to test/confirm.
Ready when you are! awesome quick awesomeness.
Pushed to svn. 

Committed revision 55818.

Should take a while for these to start being available as facts.
update to the query in comment 4:

echo "SELECT COUNT(*),TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES WHERE ENGINE='MyISAM' AND TABLE_SCHEMA NOT IN ('mysql','performance_schema','percona') GROUP BY TABLE_SCHEMA;" | mysql | tail -n 1 | awk '{print $1}'
Updated the query and commited.
One more revision:

SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE ENGINE='MyISAM' AND TABLE_SCHEMA NOT IN ('mysql','information_schema','performance_schema','percona');

I added in "information_schema" in the list to ignore and took out the grouping, since facter is only getting in the last line anyway.
Fixed and Committed revision 55823.
Works!

[root@addons1.db.phx1 ~]#  facter -p  | grep -i mysql
mysql_databases => information_schema,addons_mozilla_org,mysql,percona
mysql_isam_table_count => 1
mysql_non_utf8_databases => addons_mozilla_org
mysql_server_version => 5.1.65
[root@addons1.db.phx1 ~]# 

[root@support1 ~]# facter -p | grep mysql
mysql_databases => information_schema,mysql,openfire_chat,percona,support_mozilla_com
mysql_isam_table_count => 74
mysql_non_utf8_databases => openfire_chat,percona,support_mozilla_com
mysql_server_version => 5.1.66

w00t!
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Summary: Audit MyISAM usage → Use facter to Audit MyISAM usage
Blocks: 828450
Product: mozilla.org → Data & BI Services Team
You need to log in before you can comment on or make changes to this bug.