List:Commits« Previous MessageNext Message »
From:Gleb Shchepa Date:November 14 2008 6:42pm
Subject:bzr commit into mysql-6.0 branch (gshchepa:2925)
View as plain text  
#At file:///work/bzr/mysql-6.0-bugteam/

 2925 Gleb Shchepa	2008-11-14 [merge]
      manual merge 5.1-bugteam --> 6.0-bugteam (bug 40021)
modified:
  sql/parse_file.cc
  sql/parse_file.h
  sql/sql_db.cc
  sql/sql_trigger.cc
  sql/sql_view.cc
  sql/table.h

=== modified file 'sql/parse_file.cc'
--- a/sql/parse_file.cc	2008-09-30 13:31:41 +0000
+++ b/sql/parse_file.cc	2008-11-14 17:41:51 +0000
@@ -90,7 +90,6 @@ write_escaped_string(IO_CACHE *file, LEX
   @param file          pointer to IO_CACHE structure for writing
   @param base          pointer to data structure
   @param parameter     pointer to parameter descriptor
-  @param old_version   for returning back old version number value
 
   @retval
     FALSE   OK
@@ -100,8 +99,7 @@ write_escaped_string(IO_CACHE *file, LEX
 
 
 static my_bool
-write_parameter(IO_CACHE *file, uchar* base, File_option *parameter,
-		ulonglong *old_version)
+write_parameter(IO_CACHE *file, uchar* base, File_option *parameter)
 {
   char num_buf[20];			// buffer for numeric operations
   // string for numeric operations
@@ -129,15 +127,6 @@ write_parameter(IO_CACHE *file, uchar* b
       DBUG_RETURN(TRUE);
     break;
   }
-  case FILE_OPTIONS_REV:
-  {
-    ulonglong *val_i= (ulonglong *)(base + parameter->offset);
-    *old_version= (*val_i)++;
-    num.set(*val_i, &my_charset_bin);
-    if (my_b_append(file, (const uchar *)num.ptr(), num.length()))
-      DBUG_RETURN(TRUE);
-    break;
-  }
   case FILE_OPTIONS_TIMESTAMP:
   {
     /* string have to be allocated already */
@@ -207,7 +196,6 @@ write_parameter(IO_CACHE *file, uchar* b
   @param base          base address for parameter reading (structure like
                        TABLE)
   @param parameters    parameters description
-  @param max_versions  number of versions to save
 
   @retval
     FALSE   OK
@@ -219,13 +207,11 @@ write_parameter(IO_CACHE *file, uchar* b
 my_bool
 sql_create_definition_file(const LEX_STRING *dir, const LEX_STRING *file_name,
 			   const LEX_STRING *type,
-			   uchar* base, File_option *parameters,
-			   uint max_versions)
+			   uchar* base, File_option *parameters)
 {
   File handler;
   IO_CACHE file;
   char path[FN_REFLEN+1];	// +1 to put temporary file name for sure
-  ulonglong old_version= ULONGLONG_MAX;
   int path_end;
   File_option *param;
   DBUG_ENTER("sql_create_definition_file");
@@ -272,7 +258,7 @@ sql_create_definition_file(const LEX_STR
     if (my_b_append(&file, (const uchar *)param->name.str,
                     param->name.length) ||
 	my_b_append(&file, (const uchar *)STRING_WITH_LEN("=")) ||
-	write_parameter(&file, base, param, &old_version) ||
+	write_parameter(&file, base, param) ||
 	my_b_append(&file, (const uchar *)STRING_WITH_LEN("\n")))
       goto err_w_cache;
   }
@@ -286,55 +272,6 @@ sql_create_definition_file(const LEX_STR
   }
 
   path[path_end]='\0';
-#ifdef FRM_ARCHIVE
-  // archive copies management: disabled unused feature (see bug #17823).
-  if (!access(path, F_OK))
-  {
-    if (old_version != ULONGLONG_MAX && max_versions != 0)
-    {
-      // save backup
-      char path_arc[FN_REFLEN];
-      // backup old version
-      char path_to[FN_REFLEN];
-
-      // check archive directory existence
-      fn_format(path_arc, "arc", dir->str, "", MY_UNPACK_FILENAME);
-      if (access(path_arc, F_OK))
-      {
-	if (my_mkdir(path_arc, 0777, MYF(MY_WME)))
-	{
-	  DBUG_RETURN(TRUE);
-	}
-      }
-
-      my_snprintf(path_to, FN_REFLEN, "%s/%s-%04lu",
-		  path_arc, file_name->str, (ulong) old_version);
-      if (my_rename(path, path_to, MYF(MY_WME)))
-      {
-	DBUG_RETURN(TRUE);
-      }
-
-      // remove very old version
-      if (old_version > max_versions)
-      {
-	my_snprintf(path_to, FN_REFLEN, "%s/%s-%04lu",
-		    path_arc, file_name->str,
-		    (ulong)(old_version - max_versions));
-	if (!access(path_arc, F_OK) && my_delete(path_to, MYF(MY_WME)))
-	{
-	  DBUG_RETURN(TRUE);
-	}
-      }
-    }
-    else
-    {
-      if (my_delete(path, MYF(MY_WME)))	// no backups
-      {
-	DBUG_RETURN(TRUE);
-      }
-    }
-  }
-#endif//FRM_ARCHIVE
 
   {
     // rename temporary file
@@ -361,8 +298,6 @@ err_w_file:
   @param schema            name of given schema
   @param old_name          original file name
   @param new_name          new file name
-  @param revision          revision number
-  @param num_view_backups  number of backups
 
   @retval
     0   OK
@@ -371,8 +306,7 @@ err_w_file:
 */
 my_bool rename_in_schema_file(THD *thd,
                               const char *schema, const char *old_name, 
-                              const char *new_name, ulonglong revision, 
-                              uint num_view_backups)
+                              const char *new_name)
 {
   char old_path[FN_REFLEN], new_path[FN_REFLEN], arc_path[FN_REFLEN];
 
@@ -387,28 +321,6 @@ my_bool rename_in_schema_file(THD *thd,
   /* check if arc_dir exists: disabled unused feature (see bug #17823). */
   build_table_filename(arc_path, sizeof(arc_path) - 1, schema, "arc", "", 0);
   
-#ifdef FRM_ARCHIVE
-  if (revision > 0 && !access(arc_path, F_OK))
-  {
-    char old_name_buf[FN_REFLEN], new_name_buf[FN_REFLEN];
-    ulonglong limit= ((revision > num_view_backups) ?
-                      revision - num_view_backups : 0);
-
-    (void) tablename_to_filename(old_name, old_name_buf, sizeof(old_name_buf));
-    (void) tablename_to_filename(new_name, new_name_buf, sizeof(new_name_buf));
-
-    for (; revision > limit ; revision--)
-    {
-      my_snprintf(old_path, FN_REFLEN, "%s/%s%s-%04lu",
-		  arc_path, old_name_buf, reg_ext, (ulong) revision);
-      (void) unpack_filename(old_path, old_path);
-      my_snprintf(new_path, FN_REFLEN, "%s/%s%s-%04lu",
-		  arc_path, new_name_buf, reg_ext, (ulong) revision);
-      (void) unpack_filename(new_path, new_path);
-      my_rename(old_path, new_path, MYF(0));
-    }
-  }
-#else//FRM_ARCHIVE
   { // remove obsolete 'arc' directory and files if any
     MY_DIR *new_dirp;
     if ((new_dirp = my_dir(arc_path, MYF(MY_DONT_SORT))))
@@ -417,7 +329,6 @@ my_bool rename_in_schema_file(THD *thd,
       (void) mysql_rm_arc_files(thd, new_dirp, arc_path);
     }
   }
-#endif//FRM_ARCHIVE
   return 0;
 }
 
@@ -846,7 +757,6 @@ File_parser::parse(uchar* base, MEM_ROOT
 	  break;
 	}
 	case FILE_OPTIONS_ULONGLONG:
-	case FILE_OPTIONS_REV:
 	  if (!(eol= strchr(ptr, '\n')))
 	  {
 	    my_error(ER_FPARSER_ERROR_IN_PARAMETER, MYF(0),

=== modified file 'sql/parse_file.h'
--- a/sql/parse_file.h	2008-09-30 13:16:11 +0000
+++ b/sql/parse_file.h	2008-11-14 17:37:27 +0000
@@ -23,7 +23,6 @@ enum file_opt_type {
   FILE_OPTIONS_STRING,		/**< String (LEX_STRING) */
   FILE_OPTIONS_ESTRING,		/**< Escaped string (LEX_STRING) */
   FILE_OPTIONS_ULONGLONG,	/**< ulonglong parameter (ulonglong) */
-  FILE_OPTIONS_REV,		/**< Revision version number (ulonglong) */
   FILE_OPTIONS_TIMESTAMP,	/**< timestamp (LEX_STRING have to be
 				   allocated with length 20 (19+1) */
   FILE_OPTIONS_STRLIST,         /**< list of escaped strings
@@ -81,11 +80,10 @@ File_parser *sql_parse_prepare(const LEX
 my_bool
 sql_create_definition_file(const LEX_STRING *dir, const  LEX_STRING *file_name,
 			   const LEX_STRING *type,
-			   uchar* base, File_option *parameters, uint versions);
+			   uchar* base, File_option *parameters);
 my_bool rename_in_schema_file(THD *thd,
                               const char *schema, const char *old_name,
-                              const char *new_name, ulonglong revision,
-                              uint num_view_backups);
+                              const char *new_name);
 
 class File_parser: public Sql_alloc
 {

=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc	2008-09-30 13:31:41 +0000
+++ b/sql/sql_db.cc	2008-11-14 17:41:51 +0000
@@ -1094,7 +1094,6 @@ static long mysql_rm_known_files(THD *th
       /* .frm archive:
         Those archives are obsolete, but following code should
         exist to remove existent "arc" directories.
-        See #ifdef FRM_ARCHIVE directives for obsolete code.
       */
       char newpath[FN_REFLEN];
       MY_DIR *new_dirp;
@@ -1268,7 +1267,6 @@ static my_bool rm_dir_w_symlink(const ch
   NOTE
     A support of "arc" directories is obsolete, however this
     function should exist to remove existent "arc" directories.
-    See #ifdef FRM_ARCHIVE directives for obsolete code.
 */
 long mysql_rm_arc_files(THD *thd, MY_DIR *dirp, const char *org_path)
 {

=== modified file 'sql/sql_trigger.cc'
--- a/sql/sql_trigger.cc	2008-07-15 16:29:51 +0000
+++ b/sql/sql_trigger.cc	2008-11-14 17:41:51 +0000
@@ -684,7 +684,7 @@ bool Table_triggers_list::create_trigger
   trigname.trigger_table.length= tables->table_name_length;
 
   if (sql_create_definition_file(NULL, &trigname_file, &trigname_file_type,
-                                 (uchar*)&trigname, trigname_file_parameters, 0))
+                                 (uchar*)&trigname, trigname_file_parameters))
     return 1;
 
   /*
@@ -802,7 +802,7 @@ bool Table_triggers_list::create_trigger
   /* Create trigger definition file. */
 
   if (!sql_create_definition_file(NULL, &file, &triggers_file_type,
-                                  (uchar*)this, triggers_file_parameters, 0))
+                                  (uchar*)this, triggers_file_parameters))
     return 0;
 
 err_with_cleanup:
@@ -878,8 +878,7 @@ static bool save_trigger_file(Table_trig
                                     TRG_EXT, 0);
   file.str= file_buff;
   return sql_create_definition_file(NULL, &file, &triggers_file_type,
-                                    (uchar*)triggers, triggers_file_parameters,
-                                    0);
+                                    (uchar*)triggers, triggers_file_parameters);
 }
 
 
@@ -1808,8 +1807,7 @@ Table_triggers_list::change_table_name_i
     trigname.trigger_table= *new_table_name;
 
     if (sql_create_definition_file(NULL, &trigname_file, &trigname_file_type,
-                                   (uchar*)&trigname, trigname_file_parameters,
-                                   0))
+                                   (uchar*)&trigname, trigname_file_parameters))
       return trigger;
   }
 

=== modified file 'sql/sql_view.cc'
--- a/sql/sql_view.cc	2008-11-06 18:39:27 +0000
+++ b/sql/sql_view.cc	2008-11-14 17:41:51 +0000
@@ -663,7 +663,7 @@ bool mysql_create_view(THD *thd, TABLE_L
   }
 
   pthread_mutex_unlock(&LOCK_open);
-  if (view->revision != 1)
+  if (mode != VIEW_CREATE_NEW)
     query_cache_invalidate3(thd, view, 0);
   start_waiting_global_read_lock(thd);
   if (res)
@@ -681,12 +681,8 @@ err:
 }
 
 
-/* index of revision number in following table */
-static const int revision_number_position= 8;
 /* number of required parameters for making view */
-static const int required_view_parameters= 16;
-/* number of backups */
-static const int num_view_backups= 3;
+static const int required_view_parameters= 14;
 
 /*
   table of VIEW .frm field descriptors
@@ -719,9 +715,6 @@ static File_option view_parameters[]=
  {{ C_STRING_WITH_LEN("with_check_option")},
   my_offsetof(TABLE_LIST, with_check),
   FILE_OPTIONS_ULONGLONG},
- {{ C_STRING_WITH_LEN("revision")},
-  my_offsetof(TABLE_LIST, revision),
-  FILE_OPTIONS_REV},
  {{ C_STRING_WITH_LEN("timestamp")},
   my_offsetof(TABLE_LIST, timestamp),
   FILE_OPTIONS_TIMESTAMP},
@@ -929,18 +922,9 @@ loop_out:
       }
 
       /*
-        read revision number
-
         TODO: read dependence list, too, to process cascade/restrict
         TODO: special cascade/restrict procedure for alter?
       */
-      if (parser->parse((uchar*)view, thd->mem_root,
-                        view_parameters + revision_number_position, 1,
-                        &file_parser_dummy_hook))
-      {
-        error= thd->is_error() ? -1 : 0;
-        goto err;
-      }
     }
     else
    {
@@ -1005,7 +989,7 @@ loop_out:
   }
 
   if (sql_create_definition_file(&dir, &file, view_file_type,
-				 (uchar*)view, view_parameters, num_view_backups))
+				 (uchar*)view, view_parameters))
   {
     error= thd->is_error() ? -1 : 1;
     goto err;
@@ -1986,8 +1970,7 @@ mysql_rename_view(THD *thd,
       goto err;
 
     /* rename view and it's backups */
-    if (rename_in_schema_file(thd, view->db, view->table_name, new_name, 
-                              view_def.revision - 1, num_view_backups))
+    if (rename_in_schema_file(thd, view->db, view->table_name, new_name))
       goto err;
 
     dir.str= dir_buff;
@@ -2002,12 +1985,10 @@ mysql_rename_view(THD *thd,
     file.length= pathstr.length - dir.length;
 
     if (sql_create_definition_file(&dir, &file, view_file_type,
-                                   (uchar*)&view_def, view_parameters,
-                                   num_view_backups)) 
+                                   (uchar*)&view_def, view_parameters))
     {
       /* restore renamed view in case of error */
-      rename_in_schema_file(thd, view->db, new_name, view->table_name, 
-                            view_def.revision - 1, num_view_backups);
+      rename_in_schema_file(thd, view->db, new_name, view->table_name);
       goto err;
     }
   } else

=== modified file 'sql/table.h'
--- a/sql/table.h	2008-10-20 19:13:22 +0000
+++ b/sql/table.h	2008-11-14 17:41:51 +0000
@@ -1228,7 +1228,6 @@ struct TABLE_LIST
   st_lex_user   definer;                /* definer of view */
   ulonglong	file_version;		/* version of file's field set */
   ulonglong     updatable_view;         /* VIEW can be updated */
-  ulonglong	revision;		/* revision control number */
   /** 
       @brief The declared algorithm, if this is a view.
       @details One of

Thread
bzr commit into mysql-6.0 branch (gshchepa:2925)Gleb Shchepa14 Nov