In the age of jetsetting and space travel and ORMs and such, MySQL DBAs are the least sophisticated ones nowadays, usually fighting terabytes or petabytes of data with army of shell scripts – as there’re no nice frameworks to explain what you want to do in MySQL administration. The nice thing about proper object frameworks is that they allow to concentrate on the work and logic done, allowing to think on the process done, rather on languages/APIs/etc.
For example, moving a slave to another master down a replication topology could be expressed this way (this is a working code, actually):
slave = mysql(options.slave) oldmaster = mysql(slave.get_master()) newmaster = mysql(options.newmaster) oldmaster.lock() oldpos = oldmaster.pos() newmaster.wait(oldpos) newmaster.lock() oldmaster.unlock() slave.wait(oldpos) slave.change_master(newmaster) newmaster.unlock()
I’m sure transaction group/global IDs would simplify the process a lot, but still, having building blocks one can write pretty much self-documenting narrow code, shuffle actions done without having to rethink whole programming logic too much. Implementation of methods like .sync(), .clone(), .promote() ends up environment-specific, but may save quite some time afterwards too.
As much as I’d like everyone around to get their data management actions written down into scripts, I’d like every DBA action I do to be written down in such code too :-) I’d love to have code, which detects resource shortages, orders servers, deploys software and re-shards data automatically… well, you know what I mean :)