Below is the list of changes that have just been committed into a local
6.0 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-11-09 15:19:00-05:00, cbell@mysql_cab_desk. +3 -0
WL#3576 : Online Backup: Point in time recovery (Sync w/ binlog & rpl)
This patch saves the binlog information and datetime of the validation point.
sql/backup/archive.h@stripped, 2007-11-09 15:18:53-05:00, cbell@mysql_cab_desk. +14 -0
WL#3576 : Online Backup: Point in time recovery (Sync w/ binlog & rpl)
Adds new structure to archive info for saving the binlog information. Also adds
datetime of start and end of backup or restore.
sql/backup/data_backup.cc@stripped, 2007-11-09 15:18:54-05:00, cbell@mysql_cab_desk. +18 -0
WL#3576 : Online Backup: Point in time recovery (Sync w/ binlog & rpl)
Saves the binlog information during the synchronization phase after the calls
to lock() and before the first call to unlock() in the kernel.
sql/backup/sql_backup.cc@stripped, 2007-11-09 15:18:55-05:00, cbell@mysql_cab_desk. +14 -0
WL#3576 : Online Backup: Point in time recovery (Sync w/ binlog & rpl)
Saves the start and end of the backup and restore operation.
diff -Nrup a/sql/backup/archive.h b/sql/backup/archive.h
--- a/sql/backup/archive.h 2007-11-06 13:32:07 -05:00
+++ b/sql/backup/archive.h 2007-11-09 15:18:53 -05:00
@@ -35,6 +35,15 @@ class Image_info;
typedef Image_info* Img_list[MAX_IMAGES]; ///< List (vector) of image descriptions.
/**
+ Structure to hold information about binary log.
+*/
+struct st_binlog_info
+{
+ char binlog_file_name[FN_REFLEN]; ///< the file name
+ my_off_t position; ///< binlog position
+};
+
+/**
Describes contents of a backup archive.
This class stores a catalogue of a backup archive, that is, description of
@@ -69,6 +78,11 @@ class Archive_info
size_t header_size; ///< size of archive's header (after reading or writing an archive)
size_t meta_size; ///< size of archive's meta-data (after reading or writing an archive)
size_t data_size; ///< size of archive's table data images (after reading or writing an archive)
+
+ st_binlog_info binlog_information; ///< stores binlog information for PTR
+ struct tm start_time; ///< the start datetime of the backup
+ struct tm end_time; ///< the end datetime of the backup
+ struct tm vp_time; ///< time of validation point
// Classes representing various types of meta-data items.
diff -Nrup a/sql/backup/data_backup.cc b/sql/backup/data_backup.cc
--- a/sql/backup/data_backup.cc 2007-11-06 13:32:13 -05:00
+++ b/sql/backup/data_backup.cc 2007-11-09 15:18:54 -05:00
@@ -534,6 +534,24 @@ int write_table_data(THD*, Backup_info &
if (sch.lock())
goto error;
+ /*
+ Save binlog information for point in time recovery on restore.
+ */
+ if (mysql_bin_log.is_open())
+ {
+ LOG_INFO li;
+ mysql_bin_log.get_current_log(&li);
+ info.binlog_information.position= li.pos;
+ memcpy(info.binlog_information.binlog_file_name,
+ li.log_file_name, strlen(li.log_file_name));
+ }
+
+ /*
+ Save VP creation time.
+ */
+ time_t skr= my_time(0);
+ gmtime_r(&skr, &info.vp_time);
+
BACKUP_SYNC("data_unlock");
if (sch.unlock())
goto error;
diff -Nrup a/sql/backup/sql_backup.cc b/sql/backup/sql_backup.cc
--- a/sql/backup/sql_backup.cc 2007-11-08 09:02:38 -05:00
+++ b/sql/backup/sql_backup.cc 2007-11-09 15:18:55 -05:00
@@ -70,6 +70,8 @@ bool test_error_flag= FALSE;
int
execute_backup_command(THD *thd, LEX *lex)
{
+ time_t skr;
+
DBUG_ENTER("execute_backup_command");
DBUG_ASSERT(thd && lex);
@@ -184,6 +186,12 @@ execute_backup_command(THD *thd, LEX *le
// TODO: freeze all DDL operations here
+ /*
+ Save starting datetime of backup.
+ */
+ skr= my_time(0);
+ gmtime_r(&skr, &info.start_time);
+
info.save_errors();
if (lex->db_list.is_empty())
@@ -217,6 +225,12 @@ execute_backup_command(THD *thd, LEX *le
info.report_error(backup::log_level::INFO,ER_BACKUP_BACKUP_DONE);
send_summary(thd,info);
}
+
+ /*
+ Save ending datetime of backup.
+ */
+ skr= my_time(0);
+ gmtime_r(&skr, &info.end_time);
// TODO: unfreeze DDL here
} // if (!stream)
| Thread |
|---|
| • bk commit into 6.0 tree (cbell:1.2652) WL#3576 | cbell | 9 Nov |