← Back to team overview

maria-developers team mailing list archive

[Branch ~maria-captains/maria/5.1] Rev 2775: Merge

 

Merge authors:
  Antony T Curtis (atcurtis)
  hery.ramilison@xxxxxxx
  Igor Babaev (igorb-seattle)
  Michael Widenius (monty)
  Michael Widenius (monty)
Related merge proposals:
  https://code.launchpad.net/~atcurtis/maria/maria-5.1-federatedx/+merge/14409
  proposed by: Antony T Curtis (atcurtis)
  review: Needs Fixing - Michael Widenius (monty)
------------------------------------------------------------
revno: 2775 [merge]
committer: Michael Widenius <monty@xxxxxxxxxxxx>
branch nick: maria-5.1
timestamp: Thu 2009-12-03 13:34:11 +0200
message:
  Merge
modified:
  client/mysql.cc
  client/mysqlcheck.c
  client/mysqlslap.c
  client/mysqltest.cc
  mysql-test/lib/mtr_report.pm
  mysql-test/mysql-test-run.pl
  mysql-test/suite/federated/disabled.def
  mysql-test/suite/federated/federated_server.result
  mysql-test/suite/federated/federated_server.test
  storage/federatedx/ha_federatedx.cc
  unittest/mysys/Makefile.am


--
lp:maria
https://code.launchpad.net/~maria-captains/maria/5.1

Your team Maria developers is subscribed to branch lp:maria.
To unsubscribe from this branch go to https://code.launchpad.net/~maria-captains/maria/5.1/+edit-subscription.
=== modified file 'client/mysql.cc'
--- client/mysql.cc	2009-11-30 21:37:27 +0000
+++ client/mysql.cc	2009-12-03 11:34:11 +0000
@@ -1280,7 +1280,6 @@
   MYSQL *kill_mysql= NULL;
 
   /* terminate if no query being executed, or we already tried interrupting */
-  /* terminate if no query being executed, or we already tried interrupting */
   if (!executing_query || (interrupted_query == 2))
   {
     tee_fprintf(stdout, "Ctrl-C -- exit!\n");
@@ -1295,6 +1294,7 @@
     goto err;
   }
 
+  /* First time try to kill the query, second time the connection */
   interrupted_query++;
 
   /* mysqld < 5 does not understand KILL QUERY, skip to KILL CONNECTION */
@@ -1305,10 +1305,13 @@
   sprintf(kill_buffer, "KILL %s%lu",
           (interrupted_query == 1) ? "QUERY " : "",
           mysql_thread_id(&mysql));
-  tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n", kill_buffer);
+  if (verbose)
+    tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n",
+                kill_buffer);
   mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
   mysql_close(kill_mysql);
-  tee_fprintf(stdout, "Ctrl-C -- query aborted.\n");
+  tee_fprintf(stdout, "Ctrl-C -- query killed. Continuing normally.\n");
+  interrupted_query= 0;
 
   return;
 
@@ -1321,7 +1324,6 @@
    handler called mysql_end(). 
   */
   mysql_thread_end();
-  return;
 #else
   mysql_end(sig);
 #endif  
@@ -2881,13 +2883,8 @@
 	  return com_server_help(buffer,line,help_arg);
   }
 
-  put_info("\nFor information about MySQL products and services, visit:\n"
-           "   http://www.mysql.com/\n";
-           "For developer information, including the MySQL Reference Manual, "
-           "visit:\n"
-           "   http://dev.mysql.com/\n";
-           "To buy MySQL Enterprise support, training, or other products, visit:\n"
-           "   https://shop.mysql.com/\n";, INFO_INFO);
+  put_info("\nGeneral information about MariaDB can be found at\n"
+           "http://askmonty.org/wiki/index.php/Manual:Contents\n";, INFO_INFO);
   put_info("List of all MySQL commands:", INFO_INFO);
   if (!named_cmds)
     put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);

=== modified file 'client/mysqlcheck.c'
--- client/mysqlcheck.c	2009-09-28 06:24:19 +0000
+++ client/mysqlcheck.c	2009-12-03 11:19:05 +0000
@@ -857,7 +857,8 @@
 
   if (!opt_write_binlog)
   {
-    if (disable_binlog()) {
+    if (disable_binlog())
+    {
       first_error= 1;
       goto end;
     }

=== modified file 'client/mysqlslap.c'
--- client/mysqlslap.c	2009-11-30 21:37:27 +0000
+++ client/mysqlslap.c	2009-12-03 11:34:11 +0000
@@ -472,11 +472,10 @@
     if (commit_rate)
       run_query(mysql, "SET AUTOCOMMIT=0", strlen("SET AUTOCOMMIT=0"));
 
-    if (pre_system)
-      if ((sysret= system(pre_system)) != 0)
-        fprintf(stderr,
-                "Warning: Execution of pre_system option returned %d.\n", 
-                sysret);
+    if (pre_system && (sysret= system(pre_system)) != 0)
+      fprintf(stderr,
+              "Warning: Execution of pre_system option returned %d.\n", 
+              sysret);
 
     /* 
       Pre statements are always run after all other logic so they can 
@@ -490,11 +489,10 @@
     if (post_statements)
       run_statements(mysql, post_statements);
 
-    if (post_system)
-      if ((sysret= system(post_system)) != 0)
-        fprintf(stderr,
-                "Warning: Execution of post_system option returned %d.\n", 
-                sysret);
+    if (post_system && (sysret= system(post_system)) != 0)
+      fprintf(stderr,
+              "Warning: Execution of post_system option returned %d.\n", 
+              sysret);
     /* We are finished with this run */
     if (auto_generate_sql_autoincrement || auto_generate_sql_guid_primary)
       drop_primary_key_list();

=== modified file 'client/mysqltest.cc'
--- client/mysqltest.cc	2009-11-16 20:49:51 +0000
+++ client/mysqltest.cc	2009-12-03 11:19:05 +0000
@@ -3497,9 +3497,10 @@
   if ((error= compare_files(ds_filename.str, ds_filename2.str)) &&
       match_expected_error(command, error, NULL) < 0)
   {
-    /* Compare of the two files failed, append them to output
-       so the failure can be analyzed, but only if it was not
-       expected to fail.
+    /*
+      Compare of the two files failed, append them to output
+      so the failure can be analyzed, but only if it was not
+      expected to fail.
     */
     show_diff(&ds_res, ds_filename.str, ds_filename2.str);
     log_file.write(&ds_res);
@@ -5013,7 +5014,8 @@
   con_options= ds_options.str;
   while (*con_options)
   {
-    char* end;
+    size_t length;
+    char *end;
     /* Step past any spaces in beginning of option*/
     while (*con_options && my_isspace(charset_info, *con_options))
      con_options++;
@@ -5021,13 +5023,14 @@
     end= con_options;
     while (*end && !my_isspace(charset_info, *end))
       end++;
-    if (!strncmp(con_options, "SSL", 3))
+    length= (size_t) (end - con_options);
+    if (length == 3 && !strncmp(con_options, "SSL", 3))
       con_ssl= 1;
-    else if (!strncmp(con_options, "COMPRESS", 8))
+    else if (length == 8 && !strncmp(con_options, "COMPRESS", 8))
       con_compress= 1;
-    else if (!strncmp(con_options, "PIPE", 4))
+    else if (length == 4 && !strncmp(con_options, "PIPE", 4))
       con_pipe= 1;
-    else if (!strncmp(con_options, "SHM", 3))
+    else if (length == 3 && !strncmp(con_options, "SHM", 3))
       con_shm= 1;
     else
       die("Illegal option to connect: %.*s", 
@@ -5096,14 +5099,13 @@
     mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME, ds_shm.str);
     mysql_options(&con_slot->mysql, MYSQL_OPT_PROTOCOL, &protocol);
   }
-  else if(shared_memory_base_name)
+  else if (shared_memory_base_name)
   {
     mysql_options(&con_slot->mysql, MYSQL_SHARED_MEMORY_BASE_NAME,
-      shared_memory_base_name);
+                  shared_memory_base_name);
   }
 #endif
 
-
   /* Use default db name */
   if (ds_database.length == 0)
     dynstr_set(&ds_database, opt_db);
@@ -6879,10 +6881,8 @@
   MYSQL_STMT *stmt;
   DYNAMIC_STRING ds_prepare_warnings;
   DYNAMIC_STRING ds_execute_warnings;
-  ulonglong affected_rows;
   DBUG_ENTER("run_query_stmt");
   DBUG_PRINT("query", ("'%-.60s'", query));
-  LINT_INIT(affected_rows);
 
   /*
     Init a new stmt if it's not already one created for this connection
@@ -6981,6 +6981,9 @@
   handle_no_error(command);
   if (!disable_result_log)
   {
+    ulonglong affected_rows;
+    LINT_INIT(affected_rows);
+
     /*
       Not all statements creates a result set. If there is one we can
       now create another normal result set that contains the meta
@@ -7026,39 +7029,33 @@
       Need to grab affected rows information before getting
       warnings here
     */
+    if (!disable_info)
+      affected_rows= mysql_affected_rows(mysql);
+
+    if (!disable_warnings)
     {
-      ulonglong affected_rows;
-      LINT_INIT(affected_rows);
-
-      if (!disable_info)
-	affected_rows= mysql_affected_rows(mysql);
-
-      if (!disable_warnings)
+      /* Get the warnings from execute */
+
+      /* Append warnings to ds - if there are any */
+      if (append_warnings(&ds_execute_warnings, mysql) ||
+          ds_execute_warnings.length ||
+          ds_prepare_warnings.length ||
+          ds_warnings->length)
       {
-	/* Get the warnings from execute */
-
-	/* Append warnings to ds - if there are any */
-	if (append_warnings(&ds_execute_warnings, mysql) ||
-	    ds_execute_warnings.length ||
-	    ds_prepare_warnings.length ||
-	    ds_warnings->length)
-	{
-	  dynstr_append_mem(ds, "Warnings:\n", 10);
-	  if (ds_warnings->length)
-	    dynstr_append_mem(ds, ds_warnings->str,
-			      ds_warnings->length);
-	  if (ds_prepare_warnings.length)
-	    dynstr_append_mem(ds, ds_prepare_warnings.str,
-			      ds_prepare_warnings.length);
-	  if (ds_execute_warnings.length)
-	    dynstr_append_mem(ds, ds_execute_warnings.str,
-			      ds_execute_warnings.length);
-	}
+        dynstr_append_mem(ds, "Warnings:\n", 10);
+        if (ds_warnings->length)
+          dynstr_append_mem(ds, ds_warnings->str,
+                            ds_warnings->length);
+        if (ds_prepare_warnings.length)
+          dynstr_append_mem(ds, ds_prepare_warnings.str,
+                            ds_prepare_warnings.length);
+        if (ds_execute_warnings.length)
+          dynstr_append_mem(ds, ds_execute_warnings.str,
+                            ds_execute_warnings.length);
       }
-
-      if (!disable_info)
-	append_info(ds, affected_rows, mysql_info(mysql));
     }
+    if (!disable_info)
+      append_info(ds, affected_rows, mysql_info(mysql));
   }
 
 end:
@@ -7235,7 +7232,6 @@
     }
 
     dynstr_free(&query_str);
-
   }
 
   if (sp_protocol_enabled &&
@@ -7662,6 +7658,7 @@
   my_bool q_send_flag= 0, abort_flag= 0;
   uint command_executed= 0, last_command_executed= 0;
   char save_file[FN_REFLEN];
+  bool empty_result= FALSE;
   MY_INIT(argv[0]);
 
   save_file[0]= 0;
@@ -7819,6 +7816,7 @@
   verbose_msg("Start processing test commands from '%s' ...", cur_file->file_name);
   while (!read_command(&command) && !abort_flag)
   {
+    my_bool ok_to_do;
     int current_line_inc = 1, processed = 0;
     if (command->type == Q_UNKNOWN || command->type == Q_COMMENT_WITH_COMMAND)
       get_command_type(command);
@@ -7831,7 +7829,7 @@
       command->type= Q_COMMENT;
     }
 
-    my_bool ok_to_do= cur_block->ok;
+    ok_to_do= cur_block->ok;
     /*
       Some commands need to be "done" the first time if they may get
       re-iterated over in a true context. This can only happen if there's 
@@ -8167,8 +8165,6 @@
   if (parsing_disabled)
     die("Test ended with parsing disabled");
 
-  my_bool empty_result= FALSE;
-  
   /*
     The whole test has been executed _sucessfully_.
     Time to compare result or save it to record file.

=== modified file 'mysql-test/lib/mtr_report.pm'
--- mysql-test/lib/mtr_report.pm	2009-11-16 20:49:51 +0000
+++ mysql-test/lib/mtr_report.pm	2009-12-03 11:19:05 +0000
@@ -388,7 +388,7 @@
   }
   elsif (@$extra_warnings)
   {
-    mtr_error("There were errors/warnings in server logs after running test cases.");
+    mtr_error("There where errors/warnings in server logs after running test cases.");
   }
   elsif ($fail)
   {

=== modified file 'mysql-test/mysql-test-run.pl'
--- mysql-test/mysql-test-run.pl	2009-11-30 21:37:27 +0000
+++ mysql-test/mysql-test-run.pl	2009-12-03 11:34:11 +0000
@@ -201,10 +201,10 @@
 
 my $opt_sleep;
 
-my $opt_testcase_timeout=    15; # minutes
-my $opt_suite_timeout   =   300; # minutes
-my $opt_shutdown_timeout=    10; # seconds
-my $opt_start_timeout   =   180; # seconds
+my $opt_testcase_timeout=     15; # 15 minutes
+my $opt_suite_timeout   =    360; # 6 hours
+my $opt_shutdown_timeout=     10; # 10 seconds
+my $opt_start_timeout   =    180; # 180 seconds
 
 sub testcase_timeout { return $opt_testcase_timeout * 60; };
 sub suite_timeout { return $opt_suite_timeout * 60; };
@@ -1319,6 +1319,8 @@
   {
     # Indicate that we are using debugger
     $glob_debugger= 1;
+    $opt_testcase_timeout= 60*60*24;  # Don't abort debugging with timeout
+    $opt_suite_timeout= $opt_testcase_timeout;
     $opt_retry= 1;
     $opt_retry_failure= 1;
 
@@ -2151,7 +2153,6 @@
   # Create an environment variable to make it possible
   # to detect that valgrind is being used from test cases
   $ENV{'VALGRIND_TEST'}= $opt_valgrind;
-
 }
 
 
@@ -2908,8 +2909,8 @@
   my $bootstrap_sql_file= "$opt_vardir/tmp/bootstrap.sql";
 
   my $path_sql= my_find_file($install_basedir,
-			     ["mysql", "sql/share", "share/mysql",
-			      "share/mariadb", "share", "scripts"],
+			     ["mysql", "sql/share", "share/mariadb",
+			      "share/mysql", "share", "scripts"],
 			     "mysql_system_tables.sql",
 			     NOT_REQUIRED);
 
@@ -3861,7 +3862,7 @@
   my ($error_log, $tname) = @_;
 
   # Open the servers .err log file and read all lines
-  # belonging to current tets into @lines
+  # belonging to current test into @lines
   my $Ferr = IO::File->new($error_log)
     or mtr_error("Could not open file '$error_log' for reading: $!");
 

=== modified file 'mysql-test/suite/federated/disabled.def'
--- mysql-test/suite/federated/disabled.def	2009-10-30 18:50:56 +0000
+++ mysql-test/suite/federated/disabled.def	2009-11-14 19:33:59 +0000
@@ -9,5 +9,4 @@
 #  Do not use any TAB characters for whitespace.
 #
 ##############################################################################
-federated_server : needs fixup
 

=== modified file 'mysql-test/suite/federated/federated_server.result'
--- mysql-test/suite/federated/federated_server.result	2009-10-30 18:50:56 +0000
+++ mysql-test/suite/federated/federated_server.result	2009-11-14 19:33:59 +0000
@@ -175,6 +175,8 @@
     )
 ;
 INSERT INTO db_bogus.t1 VALUES ('2','this is bogus');
+create user test_fed@localhost identified by 'foo';
+grant all on db_legitimate.* to test_fed@localhost;
 create server 's1' foreign data wrapper 'mysql' options
 (HOST '127.0.0.1',
 DATABASE 'db_legitimate',
@@ -211,15 +213,14 @@
 alter server s1 options (database 'db_bogus');
 flush tables;
 select * from federated.t1;
-id	name
-2	this is bogus
+ERROR HY000: There was a problem processing the query on the foreign data source. Data source error: : 1044 : Access denied for user 'test_fed'@'localhost' to databa
 drop server if exists 's1';
 ERROR 42000: Access denied; you need the SUPER privilege for this operation
 create server 's1' foreign data wrapper 'mysql' options
 (HOST '127.0.0.1',
 DATABASE 'db_legitimate',
-USER 'root',
-PASSWORD '',
+USER 'test_fed',
+PASSWORD 'foo',
 PORT SLAVE_PORT,
 SOCKET '',
 OWNER 'root');
@@ -228,8 +229,8 @@
 create server 's1' foreign data wrapper 'mysql' options
 (HOST '127.0.0.1',
 DATABASE 'db_legitimate',
-USER 'root',
-PASSWORD '',
+USER 'test_fed',
+PASSWORD 'foo',
 PORT SLAVE_PORT,
 SOCKET '',
 OWNER 'root');
@@ -237,6 +238,7 @@
 select * from federated.t1;
 id	name
 1	this is legitimate
+drop user test_fed@localhost;
 drop database db_legitimate;
 drop database db_bogus;
 drop user guest_super@localhost;
@@ -275,6 +277,6 @@
 drop procedure p1;
 drop server if exists s;
 DROP TABLE IF EXISTS federated.t1;
-DROP DATABASE federated;
+DROP DATABASE IF EXISTS federated;
 DROP TABLE IF EXISTS federated.t1;
-DROP DATABASE federated;
+DROP DATABASE IF EXISTS federated;

=== modified file 'mysql-test/suite/federated/federated_server.test'
--- mysql-test/suite/federated/federated_server.test	2009-10-30 18:50:56 +0000
+++ mysql-test/suite/federated/federated_server.test	2009-11-14 19:33:59 +0000
@@ -239,6 +239,7 @@
 
 connection master;
 flush tables;
+--error ER_QUERY_ON_FOREIGN_DATA_SOURCE
 select * from federated.t1;
 
 connection conn_select;
@@ -249,8 +250,8 @@
 eval create server 's1' foreign data wrapper 'mysql' options
   (HOST '127.0.0.1',
   DATABASE 'db_legitimate',
-  USER 'root',
-  PASSWORD '',
+  USER 'test_fed',
+  PASSWORD 'foo',
   PORT $SLAVE_MYPORT,
   SOCKET '',
   OWNER 'root');
@@ -261,8 +262,8 @@
 eval create server 's1' foreign data wrapper 'mysql' options
   (HOST '127.0.0.1',
   DATABASE 'db_legitimate',
-  USER 'root',
-  PASSWORD '',
+  USER 'test_fed',
+  PASSWORD 'foo',
   PORT $SLAVE_MYPORT,
   SOCKET '',
   OWNER 'root');
@@ -273,6 +274,7 @@
 
 # clean up test
 connection slave;
+drop user test_fed@localhost;
 drop database db_legitimate;
 drop database db_bogus;
 

=== modified file 'storage/federatedx/ha_federatedx.cc'
--- storage/federatedx/ha_federatedx.cc	2009-11-30 21:37:27 +0000
+++ storage/federatedx/ha_federatedx.cc	2009-12-03 11:34:11 +0000
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2008, Patrick Galbraith 
+Copyright (c) 2008-2009, Patrick Galbraith & Antony Curtis
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -308,7 +308,7 @@
 */
 
 
-#define MYSQL_SERVER 1q
+#define MYSQL_SERVER 1
 #include "mysql_priv.h"
 #include <mysql/plugin.h>
 
@@ -1627,7 +1627,13 @@
   {
     MEM_ROOT mem_root;
 
-    txn->close(server);
+    if (!txn)
+    {
+      federatedx_txn tmp_txn;
+      tmp_txn.close(server);
+    }
+    else
+      txn->close(server);
 
     DBUG_ASSERT(server->io_count == 0);
 
@@ -1785,21 +1791,25 @@
   if (stored_result)
     retval= free_result();
 
-  /* Disconnect from mysql. thd may be null during refresh */
-  txn= thd ? get_txn(thd, true) : new federatedx_txn();
-
-  if (txn)
+  /* Disconnect from mysql */
+  if (!thd || !(txn= get_txn(thd, true)))
+  {
+    federatedx_txn tmp_txn;
+
+    tmp_txn.release(&io);
+
+    DBUG_ASSERT(io == NULL);
+    
+    if ((error= free_share(&tmp_txn, share)))
+      retval= error;
+  }
+  else
   {
     txn->release(&io);
-    
     DBUG_ASSERT(io == NULL);
 
     if ((error= free_share(txn, share)))
       retval= error;
-
-    if (!thd)
-      delete txn;
-
   }
   DBUG_RETURN(retval);
 }
@@ -2793,14 +2803,16 @@
 int ha_federatedx::free_result()
 {
   int error;
+  federatedx_io *tmp_io= 0, **iop;
   DBUG_ASSERT(stored_result);
-  if ((error= txn->acquire(share, FALSE, &io)))
+  if (!*(iop= &io) && (error= txn->acquire(share, TRUE, (iop= &tmp_io))))
   {
     DBUG_ASSERT(0);                             // Fail when testing
     return error;
   }
-  io->free_result(stored_result);
+  (*iop)->free_result(stored_result);
   stored_result= 0;
+  txn->release(&tmp_io);
   return 0;
 }
 
@@ -2985,7 +2997,7 @@
 {
   char error_buffer[FEDERATEDX_QUERY_BUFFER_SIZE];
   uint error_code;
-  federatedx_io *tmp_io= 0;
+  federatedx_io *tmp_io= 0, **iop= 0;
   DBUG_ENTER("ha_federatedx::info");
 
   error_code= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
@@ -2993,7 +3005,7 @@
   /* we want not to show table status if not needed to do so */
   if (flag & (HA_STATUS_VARIABLE | HA_STATUS_CONST | HA_STATUS_AUTO))
   {
-    if ((error_code= txn->acquire(share, TRUE, &tmp_io)))
+    if (!*(iop= &io) && (error_code= txn->acquire(share, TRUE, (iop= &tmp_io))))
       goto fail;
   }
 
@@ -3006,13 +3018,13 @@
     if (flag & HA_STATUS_CONST)
       stats.block_size= 4096;
 
-    if (tmp_io->table_metadata(&stats, share->table_name,
+    if ((*iop)->table_metadata(&stats, share->table_name,
                                share->table_name_length, flag))
       goto error;
   }
 
   if (flag & HA_STATUS_AUTO)
-    stats.auto_increment_value= tmp_io->last_insert_id();
+    stats.auto_increment_value= (*iop)->last_insert_id();
 
   /*
     If ::info created it's own transaction, close it. This happens in case
@@ -3023,10 +3035,10 @@
   DBUG_RETURN(0);
 
 error:
-  if (tmp_io)
+  if (iop && *iop)
   {
     my_sprintf(error_buffer, (error_buffer, ": %d : %s",
-                              tmp_io->error_code(), tmp_io->error_str()));
+                              (*iop)->error_code(), (*iop)->error_str()));
     my_error(error_code, MYF(0), error_buffer);
   }
   else

=== modified file 'unittest/mysys/Makefile.am'
--- unittest/mysys/Makefile.am	2009-11-26 08:44:38 +0000
+++ unittest/mysys/Makefile.am	2009-12-03 11:19:05 +0000
@@ -24,7 +24,7 @@
 		  $(top_builddir)/strings/libmystrings.a
 
 EXTRA_DIST       = CMakeLists.txt 
-noinst_PROGRAMS  = bitmap-t base64-t lf-t waiting_threads-t
+noinst_PROGRAMS  = bitmap-t base64-t my_atomic-t lf-t waiting_threads-t
 
 if NEED_THREAD
 # my_atomic-t is used to check thread functions, so it is safe to