List:Commits« Previous MessageNext Message »
From:rsomla Date:April 4 2007 9:51am
Subject:bk commit into 5.1 tree (rafal:1.2507)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of rafal. When rafal 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-04-04 09:51:46+02:00, rafal@quant.(none) +10 -0
  WL#3327: Final patch for phase 2 of the prototype (add TO <path>, 
  FROM <path> clauses to BACKUP/RESTORE queries).

  mysql-test/r/backup.result@stripped, 2007-04-04 09:51:41+02:00, rafal@quant.(none) +2 -2
    Use new syntax in the test.

  mysql-test/t/backup.test@stripped, 2007-04-04 09:51:41+02:00, rafal@quant.(none) +2 -2
    Result update.

  sql/backup/meta_backup.cc@stripped, 2007-04-04 09:51:42+02:00, rafal@quant.(none) +2 -2
    Change debug messages.

  sql/mysqld.cc@stripped, 2007-04-04 09:51:41+02:00, rafal@quant.(none) +2 -2
    Rename 
      SQLCOM_BACKUP_TABLE -> SQLCOM_BACKUP
      SQLCOM_RESTORE_TABLE -> SQLCOM_RESTORE

  sql/sp_head.cc@stripped, 2007-04-04 09:51:42+02:00, rafal@quant.(none) +3 -3
    Rename 
      SQLCOM_BACKUP_TABLE -> SQLCOM_BACKUP
      SQLCOM_RESTORE_TABLE -> SQLCOM_RESTORE

  sql/sql_lex.h@stripped, 2007-04-04 09:51:42+02:00, rafal@quant.(none) +2 -2
    - Rename 
      SQLCOM_BACKUP_TABLE -> SQLCOM_BACKUP
      SQLCOM_RESTORE_TABLE -> SQLCOM_RESTORE
    
    - Change type of Lex::backup_dir to LEX_STRING

  sql/sql_parse.cc@stripped, 2007-04-04 09:51:42+02:00, rafal@quant.(none) +11 -24
    - Rename 
      SQLCOM_BACKUP_TABLE -> SQLCOM_BACKUP
      SQLCOM_RESTORE_TABLE -> SQLCOM_RESTORE
    
    - Pass file path argument to do_{backup,restore}() functions.
    
    - Avoid code repetition.

  sql/sql_table.cc@stripped, 2007-04-04 09:51:42+02:00, rafal@quant.(none) +1 -1
    Change type of Lex::backup_dir to LEX_STRING.

  sql/sql_yacc.yy@stripped, 2007-04-04 09:51:42+02:00, rafal@quant.(none) +8 -22
    - Add TO <path> clause to BACKUP query.
    - Add FROM <path> clause to RESTORE query.

  storage/myisam/ha_myisam.cc@stripped, 2007-04-04 09:51:42+02:00, rafal@quant.(none) +2 -2
    Change type of Lex::backup_dir to LEX_STRING.

# 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:	rafal
# Host:	quant.(none)
# Root:	/ext/mysql/bk/backup/prototype

--- 1.210/storage/myisam/ha_myisam.cc	2007-04-04 09:51:54 +02:00
+++ 1.211/storage/myisam/ha_myisam.cc	2007-04-04 09:51:54 +02:00
@@ -798,7 +798,7 @@
 int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
 {
   HA_CHECK_OPT tmp_check_opt;
-  char *backup_dir= thd->lex->backup_dir;
+  char *backup_dir= thd->lex->backup_dir.str;
   char src_path[FN_REFLEN], dst_path[FN_REFLEN];
   char table_name[FN_REFLEN];
   int error;
@@ -841,7 +841,7 @@
 
 int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
 {
-  char *backup_dir= thd->lex->backup_dir;
+  char *backup_dir= thd->lex->backup_dir.str;
   char src_path[FN_REFLEN], dst_path[FN_REFLEN];
   char table_name[FN_REFLEN];
   int error;

--- 1.611/sql/mysqld.cc	2007-04-04 09:51:54 +02:00
+++ 1.612/sql/mysqld.cc	2007-04-04 09:51:54 +02:00
@@ -6764,7 +6764,7 @@
   {"Com_alter_event",	       (char*) offsetof(STATUS_VAR, com_stat[(uint)
SQLCOM_ALTER_EVENT]), SHOW_LONG_STATUS},
   {"Com_alter_table",	       (char*) offsetof(STATUS_VAR, com_stat[(uint)
SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS},
   {"Com_analyze",	       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ANALYZE]),
SHOW_LONG_STATUS},
-  {"Com_backup_table",	       (char*) offsetof(STATUS_VAR, com_stat[(uint)
SQLCOM_BACKUP_TABLE]), SHOW_LONG_STATUS},
+  {"Com_backup",	       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BACKUP]),
SHOW_LONG_STATUS},
   {"Com_begin",		       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BEGIN]),
SHOW_LONG_STATUS},
   {"Com_change_db",	       (char*) offsetof(STATUS_VAR, com_stat[(uint)
SQLCOM_CHANGE_DB]), SHOW_LONG_STATUS},
   {"Com_change_master",	       (char*) offsetof(STATUS_VAR, com_stat[(uint)
SQLCOM_CHANGE_MASTER]), SHOW_LONG_STATUS},
@@ -6811,7 +6811,7 @@
   {"Com_replace",	       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPLACE]),
SHOW_LONG_STATUS},
   {"Com_replace_select",       (char*) offsetof(STATUS_VAR, com_stat[(uint)
SQLCOM_REPLACE_SELECT]), SHOW_LONG_STATUS},
   {"Com_reset",		       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RESET]),
SHOW_LONG_STATUS},
-  {"Com_restore_table",	       (char*) offsetof(STATUS_VAR, com_stat[(uint)
SQLCOM_RESTORE_TABLE]), SHOW_LONG_STATUS},
+  {"Com_restore",	       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RESTORE]),
SHOW_LONG_STATUS},
   {"Com_revoke",	       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REVOKE]),
SHOW_LONG_STATUS},
   {"Com_revoke_all",	       (char*) offsetof(STATUS_VAR, com_stat[(uint)
SQLCOM_REVOKE_ALL]), SHOW_LONG_STATUS},
   {"Com_rollback",	       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ROLLBACK]),
SHOW_LONG_STATUS},

--- 1.263/sql/sql_lex.h	2007-04-04 09:51:54 +02:00
+++ 1.264/sql/sql_lex.h	2007-04-04 09:51:54 +02:00
@@ -85,7 +85,7 @@
   SQLCOM_COMMIT, SQLCOM_SAVEPOINT, SQLCOM_RELEASE_SAVEPOINT,
   SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP,
   SQLCOM_BEGIN, SQLCOM_LOAD_MASTER_TABLE, SQLCOM_CHANGE_MASTER,
-  SQLCOM_RENAME_TABLE, SQLCOM_BACKUP_TABLE, SQLCOM_RESTORE_TABLE,
+  SQLCOM_RENAME_TABLE, SQLCOM_BACKUP, SQLCOM_RESTORE,
   SQLCOM_RESET, SQLCOM_PURGE, SQLCOM_PURGE_BEFORE, SQLCOM_SHOW_BINLOGS,
   SQLCOM_SHOW_OPEN_TABLES, SQLCOM_LOAD_MASTER_DATA,
   SQLCOM_HA_OPEN, SQLCOM_HA_CLOSE, SQLCOM_HA_READ,
@@ -945,7 +945,7 @@
   LEX_STRING name;
   Table_ident *like_name;
   char *help_arg;
-  char *backup_dir;				/* For RESTORE/BACKUP */
+  LEX_STRING backup_dir;				/* For RESTORE/BACKUP */
   char* to_log;                                 /* For PURGE MASTER LOGS TO */
   char* x509_subject,*x509_issuer,*ssl_cipher;
   char* found_semicolon;                        /* For multi queries - next query */

--- 1.633/sql/sql_parse.cc	2007-04-04 09:51:54 +02:00
+++ 1.634/sql/sql_parse.cc	2007-04-04 09:51:54 +02:00
@@ -208,8 +208,8 @@
   sql_command_flags[SQLCOM_CREATE_DB]=      CF_CHANGES_DATA;
   sql_command_flags[SQLCOM_DROP_DB]=        CF_CHANGES_DATA;
   sql_command_flags[SQLCOM_RENAME_TABLE]=   CF_CHANGES_DATA;
-  sql_command_flags[SQLCOM_BACKUP_TABLE]=   CF_CHANGES_DATA;
-  sql_command_flags[SQLCOM_RESTORE_TABLE]=  CF_CHANGES_DATA;
+  sql_command_flags[SQLCOM_BACKUP]=   CF_CHANGES_DATA;
+  sql_command_flags[SQLCOM_RESTORE]=  CF_CHANGES_DATA;
   sql_command_flags[SQLCOM_DROP_INDEX]=     CF_CHANGES_DATA;
   sql_command_flags[SQLCOM_CREATE_VIEW]=    CF_CHANGES_DATA;
   sql_command_flags[SQLCOM_DROP_VIEW]=      CF_CHANGES_DATA;
@@ -1857,20 +1857,23 @@
   }
 #endif
 
-  case SQLCOM_BACKUP_TABLE:
+  case SQLCOM_BACKUP:
+  case SQLCOM_RESTORE:
   {
 #ifndef EMBEDDED_LIBRARY
      
-     // TODO: take the 'where' string from the parsed statement 
-     // (somewhere in thd->lex?)
+     // TODO: make sanity checks on parameters.
      
-     LEX_STRING where = {STRING_WITH_LEN("test.ba")};
+     LEX_STRING where = lex->backup_dir; 
      backup::Location *loc= backup::Location::find(where);
      
      if (!loc)
        goto error;  // TODO: report something meaningfull  
-     
-     backup::do_backup(thd,*loc);
+
+     if (lex->sql_command==SQLCOM_BACKUP)      
+        backup::do_backup(thd,*loc);
+     else
+        backup::do_restore(thd,*loc);
      loc->free();
      
 #endif
@@ -1884,22 +1887,6 @@
     select_lex->table_list.first= (byte*) first_table;
     lex->query_tables=all_tables;
 */    
-    break;
-  }
-  case SQLCOM_RESTORE_TABLE:
-  {
-#ifndef EMBEDDED_LIBRARY
-
-     LEX_STRING where = {STRING_WITH_LEN("test.ba")};
-     backup::Location *loc= backup::Location::find(where);
-     
-     if (!loc)
-       goto error;  // TODO: report something meaningfull  
-     
-     backup::do_restore(thd,*loc);
-     loc->free();
-
-#endif
 /*    DBUG_ASSERT(first_table == all_tables && first_table != 0);
     if (check_table_access(thd, INSERT_ACL, all_tables, 0) ||
 	check_global_access(thd, FILE_ACL))

--- 1.394/sql/sql_table.cc	2007-04-04 09:51:54 +02:00
+++ 1.395/sql/sql_table.cc	2007-04-04 09:51:54 +02:00
@@ -3821,7 +3821,7 @@
   }
   else
   {
-    char* backup_dir= thd->lex->backup_dir;
+    char* backup_dir= thd->lex->backup_dir.str;
     char src_path[FN_REFLEN], dst_path[FN_REFLEN], uname[FN_REFLEN];
     char* table_name= table->table_name;
     char* db= table->db;

--- 1.545/sql/sql_yacc.yy	2007-04-04 09:51:54 +02:00
+++ 1.546/sql/sql_yacc.yy	2007-04-04 09:51:54 +02:00
@@ -5582,32 +5582,18 @@
 
 
 restore:
-	RESTORE_SYM /* table_or_tables */
+	RESTORE_SYM /* table_or_tables */ FROM TEXT_STRING_sys
 	{
-	   Lex->sql_command = SQLCOM_RESTORE_TABLE;
-/*           WARN_DEPRECATED(yythd, "5.2", "RESTORE TABLE",
-                           "MySQL Administrator (mysqldump, mysql)");
-*/	};
-/*
-	table_list FROM TEXT_STRING_sys
-        {
-	  Lex->backup_dir = $6.str;
-        };
-*/
+	   Lex->sql_command= SQLCOM_RESTORE;
+	   Lex->backup_dir= $3;
+	};
 
 backup:
-	BACKUP_SYM /* table_or_tables */
+	BACKUP_SYM /* table_or_tables */ TO_SYM TEXT_STRING_sys 
 	{
-	   Lex->sql_command = SQLCOM_BACKUP_TABLE;
-/*           WARN_DEPRECATED(yythd, "5.2", "BACKUP TABLE",
-                           "MySQL Administrator (mysqldump, mysql)");
-*/	};
-	/* 
-	table_list TO_SYM TEXT_STRING_sys
-        {
-	  Lex->backup_dir = $6.str;
-        }; 
-	*/
+	   Lex->sql_command = SQLCOM_BACKUP;
+	   Lex->backup_dir= $3;
+	};
 
 checksum:
         CHECKSUM_SYM table_or_tables

--- 1.255/sql/sp_head.cc	2007-04-04 09:51:54 +02:00
+++ 1.256/sql/sp_head.cc	2007-04-04 09:51:54 +02:00
@@ -159,7 +159,7 @@
     }
     /* fallthrough */
   case SQLCOM_ANALYZE:
-  case SQLCOM_BACKUP_TABLE:
+  case SQLCOM_BACKUP:
   case SQLCOM_OPTIMIZE:
   case SQLCOM_PRELOAD_KEYS:
   case SQLCOM_ASSIGN_TO_KEYCACHE:
@@ -204,8 +204,8 @@
   case SQLCOM_SHOW_VARIABLES:
   case SQLCOM_SHOW_WARNS:
   case SQLCOM_REPAIR:
-  case SQLCOM_RESTORE_TABLE:
-    flags= sp_head::MULTI_RESULTS;
+  case SQLCOM_RESTORE:
+    flags= sp_head::MULTI_RESULTS; // TODO: what is that?
     break;
   /*
     EXECUTE statement may return a result set, but doesn't have to.

--- 1.6/sql/backup/meta_backup.cc	2007-04-04 09:51:54 +02:00
+++ 1.7/sql/backup/meta_backup.cc	2007-04-04 09:51:54 +02:00
@@ -220,9 +220,8 @@
 
     // remove tables which exist
 
-    DBUG_PRINT("restore",("  dropping tables"));
     err= mysql_rm_table_part2_with_lock(thd, tl, TRUE, FALSE, TRUE); // = DROP TABLE IF
EXISTS
-    DBUG_PRINT("restore",("  result= %d",err));
+    DBUG_PRINT("restore",("  drop tables result= %d",err));
 
     DBUG_ASSERT( err == 0 );
 
@@ -236,6 +235,7 @@
       // execute the statement
 
       bool res= silent_exec_query(thd,create_statement);
+      DBUG_PRINT("restore",("  res=%d after executing %s",res,create_statement.c_ptr()));
 
       if (!res)
         DBUG_RETURN(res);

--- 1.29/mysql-test/r/backup.result	2007-04-04 09:51:54 +02:00
+++ 1.30/mysql-test/r/backup.result	2007-04-04 09:51:54 +02:00
@@ -52,7 +52,7 @@
 directorate
 staff
 tasking
-BACKUP;
+BACKUP TO 'test.ba';
 Backup Summary
 Backed-up 4 tables.
 Wrote 3182 bytes of backup archive.
@@ -62,7 +62,7 @@
 DROP DATABASE test;
 CREATE DATABASE test;
 USE mysql;
-RESTORE;
+RESTORE FROM 'test.ba';
 Restore Summary
 Restored 4 tables.
 Read 3182 bytes of backup archive.

--- 1.29/mysql-test/t/backup.test	2007-04-04 09:51:54 +02:00
+++ 1.30/mysql-test/t/backup.test	2007-04-04 09:51:54 +02:00
@@ -89,7 +89,7 @@
 
 SHOW TABLES;
 
-BACKUP;
+BACKUP TO 'test.ba';
 
 DROP DATABASE test;
 
@@ -107,7 +107,7 @@
 
 USE mysql;
 
-RESTORE;
+RESTORE FROM 'test.ba';
 
 USE test;
 
Thread
bk commit into 5.1 tree (rafal:1.2507)rsomla4 Apr