List:Commits« Previous MessageNext Message »
From:Stewart Smith Date:June 30 2008 1:31am
Subject:bzr commit into mysql-6.0-backup branch (stewart:2653) WL#4271
View as plain text  
#At file:///home/stewart/mysql/stew-encrypted-backup-preview1/

 2653 stewart@stripped	2008-06-30
      [patch 09/10] WL4271 Encrypted online backup: pass restore options to backup kernel---
       mysql-test/r/backup_encrypted_syntax_basic.result |    2 -
       mysql-test/t/backup_encrypted_syntax_basic.test   |    2 -
       sql/backup/backup_kernel.h                        |    6 ++++
       sql/backup/kernel.cc                              |   27 +++++++++++++++++++---
       4 files changed, 31 insertions(+), 6 deletions(-)
      
      Index: stew-encrypted-backup/sql/backup/backup_kernel.h
      ===================================================================
modified:
  mysql-test/r/backup_encrypted_syntax_basic.result
  mysql-test/t/backup_encrypted_syntax_basic.test
  sql/backup/backup_kernel.h
  sql/backup/kernel.cc

=== modified file 'mysql-test/r/backup_encrypted_syntax_basic.result'
--- a/mysql-test/r/backup_encrypted_syntax_basic.result	2008-06-30 01:31:29 +0000
+++ b/mysql-test/r/backup_encrypted_syntax_basic.result	2008-06-30 01:31:45 +0000
@@ -14,4 +14,4 @@ BACKUP DATABASE test TO 'test5.ba' ENCRY
 ERROR 42000: This version of MySQL doesn't yet support 'Encryption with keyfile'
 use test;
 RESTORE FROM 'test4.ba' ENCRYPTION_ALGORITHM=aes PASSWORD='pants';
-ERROR HY000: Can't read backup location 'test4.ba'
+ERROR 42000: This version of MySQL doesn't yet support 'Encrypted Restore'

=== modified file 'mysql-test/t/backup_encrypted_syntax_basic.test'
--- a/mysql-test/t/backup_encrypted_syntax_basic.test	2008-06-30 01:31:29 +0000
+++ b/mysql-test/t/backup_encrypted_syntax_basic.test	2008-06-30 01:31:45 +0000
@@ -12,7 +12,7 @@ BACKUP DATABASE test TO 'test4.ba' ENCRY
 BACKUP DATABASE test TO 'test5.ba' ENCRYPTION_ALGORITHM=aes ENCRYPTION_KEYSIZE=128 ENCRYPTION_KEYFILE='foo.key';
 
 use test;
---error 1630
+--error 1235
 RESTORE FROM 'test4.ba' ENCRYPTION_ALGORITHM=aes PASSWORD='pants';
 
 --remove_file $MYSQLTEST_VARDIR/master-data/test.ba

=== modified file 'sql/backup/backup_kernel.h'
--- a/sql/backup/backup_kernel.h	2008-06-30 01:30:58 +0000
+++ b/sql/backup/backup_kernel.h	2008-06-30 01:31:45 +0000
@@ -72,7 +72,11 @@ class Backup_restore_ctx: public backup:
                                    LEX_STRING encryption_keyfile,
                                    LEX_STRING encryption_password);
 
-  Restore_info* prepare_for_restore(LEX_STRING location, const char*);  
+  Restore_info* prepare_for_restore(LEX_STRING location, const char*,
+                                    LEX_STRING encryption_algorithm,
+                                    ulong encryption_keysize,
+                                    LEX_STRING encryption_keyfile,
+                                    LEX_STRING encryption_password);
 
   int do_backup();
   int do_restore();

=== modified file 'sql/backup/kernel.cc'
--- a/sql/backup/kernel.cc	2008-06-30 01:31:21 +0000
+++ b/sql/backup/kernel.cc	2008-06-30 01:31:45 +0000
@@ -196,8 +196,12 @@ execute_backup_command(THD *thd, LEX *le
 
   case SQLCOM_RESTORE:
   {
-    Restore_info *info= context.prepare_for_restore(lex->backup_dir, thd->query);
-    
+    Restore_info *info= context.prepare_for_restore(lex->backup_dir, thd->query,
+                                                  lex->encryption_algorithm,
+                                                  lex->encryption_keysize,
+                                                  lex->encryption_keyfile,
+                                                  lex->encryption_password);
+
     if (!info || !info->is_valid())
       DBUG_RETURN(send_error(context, ER_BACKUP_RESTORE_PREPARE));
     
@@ -603,7 +607,11 @@ Backup_restore_ctx::prepare_for_backup(L
   @note This function reports errors.
  */ 
 Restore_info* 
-Backup_restore_ctx::prepare_for_restore(LEX_STRING location, const char *query)
+Backup_restore_ctx::prepare_for_restore(LEX_STRING location, const char *query,
+                                        LEX_STRING encryption_algorithm,
+                                        ulong encryption_keysize,
+                                        LEX_STRING encryption_keyfile,
+                                        LEX_STRING encryption_password)
 {
   using namespace backup;  
 
@@ -631,6 +639,19 @@ Backup_restore_ctx::prepare_for_restore(
    */
 
   backup::String path(location);
+  backup::String encryption_algorithm_str(encryption_algorithm);
+  backup::String encryption_keyfile_str(encryption_keyfile);
+  backup::String encryption_password_str(encryption_password);
+
+  if(encryption_algorithm_str.ptr()
+     || encryption_keyfile_str.ptr()
+     || encryption_password_str.ptr()
+     || encryption_keysize)
+  {
+    fatal_error(ER_NOT_SUPPORTED_YET, "Encrypted Restore");
+    return NULL;
+  }
+
   Input_stream *s= new Input_stream(*this, path);
   
   if (!s)

Thread
bzr commit into mysql-6.0-backup branch (stewart:2653) WL#4271Stewart Smith30 Jun