ServerInterface
TODO: Introduce the subject.
[edit] List of services that backup kernel needs from server to implement its functionality
[edit] Services we agree upon with runtime team
- List all databases present in the server - needed when user says "BACKUP DATABASE *". There is a debate whether that list should include server's internal databases.
- List objects belonging to a given database, for each object we need to know its name and type - to create backup catalogue.
- Get storage engine of a table - to see if a native backup engine can be used for storing table data.
- Get metadata of a given object (serialization string) - to store it in the metadata section of the backup image.
- Create an object from a given serialization string (also destructively, if requested) - to re-create objects upon restore.
- Get version numbers and string for a server - to store it in image's header.
- Lock/unlock given object(s) - to prevent access to objects which are being restored.
- Block/unblock commits of active transactions - needed for validity point synchronization.
- Create and write a separate backup/restore log - to provide more detailed info about these operations.
- Report errors and warnings to the server - to give feedback about ongoing operation.
[edit] Services we still are discussing about
- Check if a given object (database) exists - to verify list of databases given by user, to warn user if an object which exists is about to be overwritten. Alternative: report that object doesn't exist when asking for its metadata.
- Check if given database is an internal server database - to verify list of databases given by user (we don't backup internal databases such as INFORMATION_SCHEMA or MYSQL). Alternative: don't list internal databases.
- Get name and version of a storage engine - to store it in the header. Alternative: bakup kernel directly asks storage engine.
- Get native backup engine for a given storage engine if any. Alternative: directly ask storage engine.
- Get tablespace used by a given table if any - to add it to the catalogue. Alternative: directly ask table's storage engine.
- Get base views of a given view - to correctly sort view definitions in the metadata section. Shall we also return base tables? What about base objects which do not exist?
- Check that object in the server is identical to the one saved in the backup image (the same metadata) - to be able to skip creation of an object which already exists (we use this only for handling tablespaces). Shall this service be defined only for tablespaces?
- Get user privileges - to check if user can perform BACKUP/RESTORE operation. Alternative: all other services check user privileges themselves.
- Get server's default character set - to store it in the catalogue. Objection: is it really needed?
- Freeze/unfreeze server's metadata - to prevent metadata changes during backup. Objection: ?
- Get current server's binlog position - to store the binlog postion of validity point. Alternative: directly ask the binlogging module.
- Disable/enable foreign key constraint checking - needed for restoring tables. Objection: not needed because restore drivers should be able to restore data without triggering constraint checks.
- Write entries to server log - to leave trace of performed BACKUP/RESTORE operations in the server log. Alternative: use the exising logging support of the server (i.e. BACKUP and RESTORE commands are logged as any other SQL statement).