Thanks for following up my requests and many of many suggestions.
Rafal Somla wrote:
> #At file:///ext/mysql/bzr/backup/bug40303/
> 2738 Rafal Somla 2008-11-20
> BUG#40303 (Backup: Wrong error send to client if several errors reported)
> BUG#40304 (Backup: Errors reported during BACKUP show as warnings on the
> error stack)
> Before: Errors reported using backup::Logger class could be saved and in
> case several errors are reported, the last one was sent to client as an
> error reply from BACKUP/RESTORE command.
> After: Errors reported with backup::Logger are reported to the server
> using my_printf_error(..) function. This function pushes error on the
> error stack (unles told otherwise) and stores the first reported error
> so that it is send to the client.
> - Function log_error(..) is moved to the Logger class.
> - Code is changed to consistently use Logger::report/log_error() for error
> - Semantics of Backup_restore_ctx::fatal_error() has been changed to
> discourage its use as an error reporting facility. Now it is an internal helper
> method which moves the context object into error state. It is used only by the
> class methods and it is made private. The idea is that context object should
> move into error state only as a result of executing one of its methods (not
> - Improved error reporting in few places.
> per-file messages:
> Add SHOW WARNINGS to see what is pushed on the error stack in case of errors.
> Update the test, taking into account that after this patch failed BACKUP does not
> leave the unfinished backup image file around.
> Update the test taking into account that now RESTORE returns the first
> error reported.
> - Use m_log.report_error(...) for error reporting.
> - Use the m_thd member instead of refering to a context class instance.
> - Instead of storing a reference to a complete Backup_restore_ctx instance,
> store only what is needed: a Logger instance and a THD handle.
> - Make constructor private.
> - Move log_error(..) method to the Logger class.
> - Make fatal_error(...) private and change its semantics. Now it only moves
> object to an error state, but it does not report any errors - Logger methods
> be used for reporting them.
> - Use Logger instance for reporting errors.
> - Report few errors not logged previously (e.g. when (un)block_commits(..)
> - Remove cancel_backup() calls as this is done in Backup_restore_ctx::close()
> called from destructor.
> - Inside Backup_pump class: log errors only if logger is set.
> - Fix the shutdown logic in restore_table_data(..). Drivers need to be correctly
> de-initialized by a call to ->end() during normal operation or ->cacnel()
> in case
> of interruption.
> Introduced MAX_SNAP_COUNT symbolic constant.
> - Use explicit calls to report/log_error(..) for error logging - now
> does not log anything.
> - Simplified send_error(..) implementation - now it does not have to look for
> last error reported. The first reported error is automatically stored by the
> server and send to the client.
> - Move error reporting context preparations to Logger::init(..).
> - To clarify the code, calls to s->next_chunk() have been moved to wrapper
> functions read_header(..), read_catalog(..) and read_meta_data(..) where they
> really belong.
> - Remove code saving reported errors.
> - Use my_printf_error(..) instead of push_warning_printf(..) for
> reporting errors to the server core. This has the side effect of
> storing the first reported error so that it is sent to the client.
> - Add log_error(..) method moved here from Backup_restore_ctx.
> - Remove methods for saving reported errors - not needed any more because the
> first reported error is remembered by the server core.
> - Add error_reported() method.
> - Add error context cleanup (on server level) to init() method, instead of doing
> it inside Backup_restore_ctx class.
> - Only store what is needed: reference to Logger and THD handle.
> - Made constructor private.
> Add error message for reporting problems during validity point