List:Commits« Previous MessageNext Message »
From:kent Date:June 2 2006 7:42pm
Subject:bk commit into 5.0 tree (kent:1.2168)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of mysqldev. When mysqldev 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.2168 06/06/02 21:41:57 kent@stripped +3 -0
  Merge bk-internal:/home/bk/mysql-5.0
  into  mysql.com:/data0/mysqldev/my/mysql-5.0

  sql/sql_parse.cc
    1.548 06/06/02 21:41:48 kent@stripped +0 -0
    Auto merged

  sql/sql_lex.cc
    1.185 06/06/02 21:41:47 kent@stripped +0 -0
    Auto merged

  configure.in
    1.392 06/06/02 21:41:47 kent@stripped +0 -0
    Auto merged

# 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:	kent
# Host:	production.mysql.com
# Root:	/data0/mysqldev/my/mysql-5.0/RESYNC

--- 1.184/sql/sql_lex.cc	2006-05-26 18:37:11 +02:00
+++ 1.185/sql/sql_lex.cc	2006-06-02 21:41:47 +02:00
@@ -151,8 +151,7 @@
   lex->found_semicolon= 0;
   lex->safe_to_cache_query= 1;
   lex->time_zone_tables_used= 0;
-  lex->leaf_tables_insert= lex->query_tables= 0;
-  lex->query_tables_last= &lex->query_tables;
+  lex->leaf_tables_insert= 0;
   lex->variables_used= 0;
   lex->empty_field_list_on_rset= 0;
   lex->select_lex.select_number= 1;
@@ -175,14 +174,9 @@
   lex->sphead= NULL;
   lex->spcont= NULL;
   lex->proc_list.first= 0;
-  lex->query_tables_own_last= 0;
   lex->escape_used= FALSE;
+  lex->reset_query_tables_list(FALSE);
 
-  if (lex->sroutines.records)
-    my_hash_reset(&lex->sroutines);
-  lex->sroutines_list.empty();
-  lex->sroutines_list_own_last= lex->sroutines_list.next;
-  lex->sroutines_list_own_elements= 0;
   lex->nest_level=0 ;
   lex->allow_sum_func= 0;
   lex->in_sum_func= NULL;
@@ -1594,6 +1588,52 @@
 
 
 /*
+  Initialize (or reset) Query_tables_list object.
+
+  SYNOPSIS
+    reset_query_tables_list()
+      init  TRUE  - we should perform full initialization of object with
+                    allocating needed memory
+            FALSE - object is already initialized so we should only reset
+                    its state so it can be used for parsing/processing
+                    of new statement
+
+  DESCRIPTION
+    This method initializes Query_tables_list so it can be used as part
+    of LEX object for parsing/processing of statement. One can also use
+    this method to reset state of already initialized Query_tables_list
+    so it can be used for processing of new statement.
+*/
+
+void Query_tables_list::reset_query_tables_list(bool init)
+{
+  query_tables= 0;
+  query_tables_last= &query_tables;
+  query_tables_own_last= 0;
+  if (init)
+    hash_init(&sroutines, system_charset_info, 0, 0, 0, sp_sroutine_key, 0, 0);
+  else if (sroutines.records)
+    my_hash_reset(&sroutines);
+  sroutines_list.empty();
+  sroutines_list_own_last= sroutines_list.next;
+  sroutines_list_own_elements= 0;
+}
+
+
+/*
+  Destroy Query_tables_list object with freeing all resources used by it.
+
+  SYNOPSIS
+    destroy_query_tables_list()
+*/
+
+void Query_tables_list::destroy_query_tables_list()
+{
+  hash_free(&sroutines);
+}
+
+
+/*
   Initialize LEX object.
 
   SYNOPSIS
@@ -1609,12 +1649,9 @@
 
 st_lex::st_lex()
   :result(0), yacc_yyss(0), yacc_yyvs(0),
-   sql_command(SQLCOM_END), query_tables_own_last(0)
+   sql_command(SQLCOM_END)
 {
-  hash_init(&sroutines, system_charset_info, 0, 0, 0, sp_sroutine_key, 0, 0);
-  sroutines_list.empty();
-  sroutines_list_own_last= sroutines_list.next;
-  sroutines_list_own_elements= 0;
+  reset_query_tables_list(TRUE);
 }
 
 
@@ -1998,6 +2035,11 @@
 
   SYNOPSIS
     st_lex::cleanup_after_one_table_open()
+
+  NOTE
+    This method is mostly responsible for cleaning up of selects lists and
+    derived tables state. To rollback changes in Query_tables_list one has
+    to call Query_tables_list::reset_query_tables_list(FALSE).
 */
 
 void st_lex::cleanup_after_one_table_open()
@@ -2024,11 +2066,41 @@
     select_lex.cut_subtree();
   }
   time_zone_tables_used= 0;
-  if (sroutines.records)
-    my_hash_reset(&sroutines);
-  sroutines_list.empty();
-  sroutines_list_own_last= sroutines_list.next;
-  sroutines_list_own_elements= 0;
+}
+
+
+/*
+  Save current state of Query_tables_list for this LEX, and prepare it
+  for processing of new statemnt.
+
+  SYNOPSIS
+    reset_n_backup_query_tables_list()
+      backup  Pointer to Query_tables_list instance to be used for backup
+*/
+
+void st_lex::reset_n_backup_query_tables_list(Query_tables_list *backup)
+{
+  backup->set_query_tables_list(this);
+  /*
+    We have to perform full initialization here since otherwise we
+    will damage backed up state.
+  */
+  this->reset_query_tables_list(TRUE);
+}
+
+
+/*
+  Restore state of Query_tables_list for this LEX from backup.
+
+  SYNOPSIS
+    restore_backup_query_tables_list()
+      backup  Pointer to Query_tables_list instance used for backup
+*/
+
+void st_lex::restore_backup_query_tables_list(Query_tables_list *backup)
+{
+  this->destroy_query_tables_list();
+  this->set_query_tables_list(backup);
 }
 
 

--- 1.547/sql/sql_parse.cc	2006-05-26 18:37:12 +02:00
+++ 1.548/sql/sql_parse.cc	2006-06-02 21:41:48 +02:00
@@ -1992,13 +1992,17 @@
 #else
     char *buff= thd->net.last_error;
 #endif
+
+    STATUS_VAR current_global_status_var;
+    calc_sum_of_all_status(&current_global_status_var);
+
     ulong uptime = (ulong) (thd->start_time - start_time);
     sprintf((char*) buff,
 	    "Uptime: %lu  Threads: %d  Questions: %lu  Slow queries: %lu  Opens: %lu  Flush tables: %lu  Open tables: %u  Queries per second avg: %.3f",
 	    uptime,
 	    (int) thread_count, (ulong) thd->query_id,
-            (ulong) thd->status_var.long_query_count,
-	    thd->status_var.opened_tables, refresh_version, cached_tables(),
+	    current_global_status_var.long_query_count,
+	    current_global_status_var.opened_tables, refresh_version, cached_tables(),
 	    (uptime ? (ulonglong2double(thd->query_id) / (double) uptime) :
 	     (double) 0));
 #ifdef SAFEMALLOC
Thread
bk commit into 5.0 tree (kent:1.2168)kent2 Jun