MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:dlenev Date:September 30 2005 1:30pm
Subject:bk commit into 5.0 tree (dlenev:1.2034) BUG#13451
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of dlenev. When dlenev 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
  1.2034 05/09/30 17:30:33 dlenev@stripped +1 -0
  Fix for bug #13629 "view test crashes for debug build" (also includes better
  fix for bug #13451 "view test produces warning about unfreed memory").

  sql/sql_view.cc
    1.69 05/09/30 17:30:27 dlenev@stripped +16 -13
    mysql_rename_view():
      Intead of doing full-blown opening of view and then doing extensive cleanup
      of its and main LEXes afterwards, let us just read and parse its .FRM file.

# 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:	dlenev
# Host:	brandersnatch.site
# Root:	/home/dlenev/src/mysql-5.0-bg13629

--- 1.68/sql/sql_view.cc	2005-09-29 14:29:50 +04:00
+++ 1.69/sql/sql_view.cc	2005-09-30 17:30:27 +04:00
@@ -482,8 +482,6 @@
 
 /* index of revision number in following table */
 static const int revision_number_position= 8;
-/* index of source */
-static const int source_number_position= 11;
 /* index of last required parameter for making view */
 static const int required_view_parameters= 10;
 /* number of backups */
@@ -1414,17 +1412,27 @@
   if ((parser= sql_parse_prepare(&pathstr, thd->mem_root, 1)) && 
        is_equal(&view_type, parser->type()))
   {
+    TABLE_LIST view_def;
     char dir_buff[FN_REFLEN], file_buff[FN_REFLEN];
 
+    /*
+      To be PS-friendly we should either to restore state of
+      TABLE_LIST object pointed by 'view' after using it for
+      view definition parsing or use temporary 'view_def'
+      object for it.
+    */
+    bzero(&view_def, sizeof(view_def));
+    view_def.timestamp.str= view_def.timestamp_buffer;
+    view_def.view_suid= TRUE;
+
     /* get view definition and source */
-    if (mysql_make_view(parser, view) ||
-        parser->parse((gptr)view, thd->mem_root,
-                      view_parameters + source_number_position, 1))
+    if (parser->parse((gptr)&view_def, thd->mem_root, view_parameters,
+                      sizeof(view_parameters)/sizeof(view_parameters[0])-1))
       goto err;
 
     /* rename view and it's backups */
     if (rename_in_schema_file(view->db, view->table_name, new_name, 
-                              view->revision - 1, num_view_backups))
+                              view_def.revision - 1, num_view_backups))
       goto err;
 
     strxnmov(dir_buff, FN_REFLEN, mysql_data_home, "/", view->db, "/", NullS);
@@ -1438,12 +1446,12 @@
                   - file_buff);
 
     if (sql_create_definition_file(&pathstr, &file, view_file_type,
-                                   (gptr)view, view_parameters, 
+                                   (gptr)&view_def, view_parameters,
                                    num_view_backups)) 
     {
       /* restore renamed view in case of error */
       rename_in_schema_file(view->db, new_name, view->table_name, 
-                             view->revision - 1, num_view_backups);
+                            view_def.revision - 1, num_view_backups);
       goto err;
     }
   } else
@@ -1455,10 +1463,5 @@
   error= FALSE;
 
 err:
-  /*
-   We have to explicitly call destructor for view's LEX since it won't
-   be called otherwise.
-  */
-  delete view->view;
   DBUG_RETURN(error);
 }
Thread
bk commit into 5.0 tree (dlenev:1.2034) BUG#13451dlenev30 Sep