Chuck,
Good to push. Consider using BACKUP_SLEEP inside default backup driver (I think
you use there a different mechanism for the same effect).
Rafal
cbell@stripped wrote:
> Below is the list of changes that have just been committed into a local
> 5.2 repository of cbell. When cbell does a push these changes will
> be propagated to the main repository and, within 24 hours after the
> push, to the public repository.
> For information on how to access the public repository
> see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
>
> ChangeSet@stripped, 2007-06-27 21:43:49-04:00, cbell@mysql_cab_desk. +4 -0
> WL#3327 : Online Backup - debugging enhancements
>
> This patch introduces the BACKUP_SLEEP macro that has a compile-time
> guard. The guard turns off the code if compiled as a release build.
>
> sql/backup/data_backup.cc@stripped, 2007-06-27 21:43:44-04:00, cbell@mysql_cab_desk. +4
> -0
> WL#3327 : Online Backup - debugging enhancements
>
> This patch changes the backup_sleep call to the macro defined in
> debug.h.
>
> sql/backup/debug.h@stripped, 2007-06-27 21:43:44-04:00, cbell@mysql_cab_desk. +16 -0
> WL#3327 : Online Backup - debugging enhancements
>
> This patch adds a macro with compile time guard to allow the code to
> sleep for a specified time. The guard turns off the code if compiled
> as a release build.
>
> sql/mysqld.cc@stripped, 2007-06-27 21:43:42-04:00, cbell@mysql_cab_desk. +8 -0
> WL#3327 : Online Backup - debugging enhancements
>
> This patch adds the backup_sleep global variable.
>
> sql/set_var.cc@stripped, 2007-06-27 21:43:43-04:00, cbell@mysql_cab_desk. +8 -0
> WL#3327 : Online Backup - debugging enhancements
>
> This patch adds a macro the definition of the backup_sleep global
> variable.
>
> # This is a BitKeeper patch. What follows are the unified diffs for the
> # set of deltas contained in the patch. The rest of the patch, the part
> # that BitKeeper cares about, is below these diffs.
> # User: cbell
> # Host: mysql_cab_desk.
> # Root: C:/source/c++/mysql-5.2_OB_DBUG
>
> --- 1.648/sql/mysqld.cc 2007-06-27 21:43:57 -04:00
> +++ 1.649/sql/mysqld.cc 2007-06-27 21:43:57 -04:00
> @@ -437,6 +437,14 @@
> uint volatile thread_count, thread_running;
> ulonglong thd_startup_options;
> ulong back_log, connect_timeout, concurrency, server_id;
> +
> +/*
> + Add variable for controlling backup under debug.
> +*/
> +#ifndef DBUG_OFF
> +ulong backup_sleep= 0;
> +#endif
> +
> ulong table_cache_size, table_def_size;
> ulong thread_stack, what_to_log;
> ulong query_buff_size, slow_launch_time, slave_open_temp_tables;
>
> --- 1.240/sql/set_var.cc 2007-06-27 21:43:57 -04:00
> +++ 1.241/sql/set_var.cc 2007-06-27 21:43:57 -04:00
> @@ -151,6 +151,14 @@
> static sys_var_bool_ptr sys_automatic_sp_privileges(&vars,
> "automatic_sp_privileges",
> &sp_automatic_privileges);
>
> +/*
> + Add variable for controlling backup under debug.
> +*/
> +#ifndef DBUG_OFF
> +extern ulong backup_sleep;
> +static sys_var_long_ptr sys_backup_sleep(&vars, "backup_sleep",
> &backup_sleep);
> +#endif
> +
> static sys_var_const_str sys_basedir(&vars, "basedir", mysql_home);
> static sys_var_long_ptr sys_binlog_cache_size(&vars, "binlog_cache_size",
> &binlog_cache_size);
>
> --- 1.6/sql/backup/data_backup.cc 2007-06-27 21:43:57 -04:00
> +++ 1.7/sql/backup/data_backup.cc 2007-06-27 21:43:57 -04:00
> @@ -1062,6 +1062,8 @@
>
> DBUG_ASSERT(m_buf_head);
>
> + BACKUP_SLEEP;
> +
> result_t res= m_drv->get_data(m_buf);
>
> switch (res) {
> @@ -1335,6 +1337,8 @@
> we have next data block and drvr at its restore driver.
> */
> DBUG_ASSERT(img && drvr);
> +
> + BACKUP_SLEEP;
>
> switch( drvr->send_data(buf) ) {
>
>
> --- 1.2/sql/backup/debug.h 2007-06-27 21:43:57 -04:00
> +++ 1.3/sql/backup/debug.h 2007-06-27 21:43:57 -04:00
> @@ -12,6 +12,22 @@
> # define DBUG_BACKUP
> #endif
>
> +/*
> + Macro for controlling the backup process by causing the code to sleep.
> + The macro is only used in debug mode and can be set by:
> + SET GLOBAL backup_sleep=N;
> + Where N is the number of milliseconds to sleep.
> +*/
> +#ifndef DBUG_OFF
> +extern ulong backup_sleep;
> +#endif
> +
> +#if defined(DBUG_BACKUP) && !defined(DBUG_OFF)
> + #define BACKUP_SLEEP do { if (backup_sleep) my_sleep(backup_sleep * 1000); } while
> (0)
> +#else
> + #define BACKUP_SLEEP do { } while(0)
> +#endif
> +
> #ifdef DBUG_BACKUP
>
> /*
>
>