I'm in the process of reworking the per-DB binlogging that I mentioned
a few days ago. Because my project is now focusing on creating one
binary log per database (rather than for all databases owned by a
user), I've tried several syntaxes and have come up with the following
possibilities. I would appreciate any feedback, especially if these
are in conflict with any SQL conventions, taboos, etc. I have modified
sql/sql_yacc.yy to work with them:
1. START BINLOG FOR DATABASE dbname;
(Is BINLOG appropriate? Should it be BINLOGGING?)
This is the command that starts writing a binlog for the specified database.
2. FLUSH TABLES WITH READ LOCK FOR DATABASE dbname;
(I just added an optional 'FOR DATABASE dbname' to the already
existing command--which still works, BTW. Is this a misuse of the word
This is the command that locks the tables before someone (some
program) dumps/copies the tables that will be moved to another server.
It flushes and locks only one database. (Should it support more than
3. SHOW DATABASE BINLOG STATUS;
This will show each database for which binlogging is turned on, giving
the current binlog coordinates (file name and position.
I patterned it somewhat after the userstatv2 modifications. You can
add "like 'pattern' at the end to show a subset of the databases
currently being binlogged.
4. UNLOCK DATABASE dbname FOR BINLOG;
(This is analogous to the UNLOCK TABLES command used for global
binlogging. This one unlocks a single database's tables. I can think
of several other possibilities, but this is the most conversational)
This undoes step 2 above.
5. STOP BINLOG FOR DATABASE dbname;
This undoes step 1 and is issued after the database has been
successfully migrated to the destination server.
I'm open to suggestions for modifying the above. Have I forgotten any
None of the above add any new lex symbols.
Thanks in advance!