Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frmsearch #87

Open
abg opened this issue May 14, 2015 · 0 comments
Open

frmsearch #87

abg opened this issue May 14, 2015 · 0 comments

Comments

@abg
Copy link
Owner

abg commented May 14, 2015

I've been asked a few times to allow frmdump to search existing frms. Namely looking for things like certain column types (i.e. old DATE/TIME types) or no primary keys.

Frms are obviously being deprecated in 5.7, but older versions will be around a while and this has proven useful from time to time. I think it may be worth putting some effort in, since frmdump already exposes a lot of this information.

Here's a little proof of concept I wrote a while back that wraps the frmdump internal command to find tables without primary keys:

https://gist.github.com/abg/83af056a568f07b7b895

I think an frmsearch command should probably have a simpler output format (probably just database.table, but maybe allow a generic printf() feature similar to Percona Toolkit's pt-find script). I envision an initial set of filters along these lines:

frmsearch [options] <path-to-datadir>

Generic identifier matching options:
   --database=glob -> find tables whose parent directory matches X (with filename decoding)
   --table=glob -> find tables whose basename matches Y

Base table only options:
   --no-primary-key -> find tables without a primary key
   --engine=name -> find tables with the specified storage engine
   --type-code=MYSQL_TYPE_{name} -> find tables that have a column matching the given type code
   --index-type=<name> -> find tables that have a key with the given type (FULLTEXT, BTREE, etc.)
   --index-name=glob -> find tables that have an index name matching the pattern
   --version-before=<version string> -> frms created before <version>
   --version-after=<version string> -> frms created after <version>
   --version-matches=<version string> -> frms created with exactly <version>

View only options:
   --definer=X (only applies to views)
   --no-creation-context (i.e. no character set fields attached - a pre 5.1 view)

The database/table filters can be a fast filter that can skip parsing by just evaluating the filename path. The other filters require parsing the .frm contents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant