MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:February 25 2008 10:48am
Subject:bk commit into 5.1 tree (davi:1.2578) BUG#28386
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of davi.  When davi 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, 2008-02-25 07:48:02-03:00, davi@stripped +3 -0
  Bug#28386 the general log is incomplete
  
  The problem is that the commands COM_STMT_CLOSE, COM_STMT_RESET,
  COM_STMT_SEND_LONG_DATA weren't being logged to the general log.
  
  The solution is to log the general log the aforementioned commands.

  mysql-test/t/mysql_client_test-master.opt@stripped, 2008-02-25 07:47:59-03:00, davi@stripped +1 -1
    Also log to table.

  sql/sql_prepare.cc@stripped, 2008-02-25 07:47:59-03:00, davi@stripped +6 -0
    Log COM_STMT_CLOSE, COM_STMT_RESET and COM_STMT_SEND_LONG_DATA.

  tests/mysql_client_test.c@stripped, 2008-02-25 07:48:00-03:00, davi@stripped +60 -0
    Add test case for Bug#28386

diff -Nrup a/mysql-test/t/mysql_client_test-master.opt b/mysql-test/t/mysql_client_test-master.opt
--- a/mysql-test/t/mysql_client_test-master.opt	2006-11-28 16:12:57 -02:00
+++ b/mysql-test/t/mysql_client_test-master.opt	2008-02-25 07:47:59 -03:00
@@ -1 +1 @@
---log=$MYSQLTEST_VARDIR/log/master.log --log-output=FILE 
+--log=$MYSQLTEST_VARDIR/log/master.log --log-output=FILE,TABLE
diff -Nrup a/sql/sql_prepare.cc b/sql/sql_prepare.cc
--- a/sql/sql_prepare.cc	2008-02-21 22:21:51 -03:00
+++ b/sql/sql_prepare.cc	2008-02-25 07:47:59 -03:00
@@ -2533,6 +2533,8 @@ void mysql_stmt_reset(THD *thd, char *pa
 
   stmt->state= Query_arena::PREPARED;
 
+  general_log_print(thd, thd->command, NullS);
+
   my_ok(thd);
 
   DBUG_VOID_RETURN;
@@ -2562,6 +2564,7 @@ void mysql_stmt_close(THD *thd, char *pa
   */
   DBUG_ASSERT(! (stmt->flags & (uint) Prepared_statement::IS_IN_USE));
   (void) stmt->deallocate();
+  general_log_print(thd, thd->command, NullS);
 
   thd->main_da.disable_status();
 
@@ -2669,6 +2672,9 @@ void mysql_stmt_get_longdata(THD *thd, c
     stmt->last_errno= ER_OUTOFMEMORY;
     sprintf(stmt->last_error, ER(ER_OUTOFMEMORY), 0);
   }
+
+  general_log_print(thd, thd->command, NullS);
+
   DBUG_VOID_RETURN;
 }
 
diff -Nrup a/tests/mysql_client_test.c b/tests/mysql_client_test.c
--- a/tests/mysql_client_test.c	2008-02-22 14:45:43 -03:00
+++ b/tests/mysql_client_test.c	2008-02-25 07:48:00 -03:00
@@ -17313,6 +17313,65 @@ static void test_bug31669()
   DBUG_VOID_RETURN;
 }
 
+
+/**
+  Bug#28386 the general log is incomplete
+*/
+
+static void test_bug28386()
+{
+  int rc;
+  MYSQL_STMT *stmt;
+  MYSQL_RES *result;
+  MYSQL_BIND bind;
+  const char hello[]= "hello world!";
+
+  DBUG_ENTER("test_bug28386");
+  myheader("test_bug28386");
+
+  rc= mysql_query(mysql, "truncate mysql.general_log");
+  myquery(rc);
+
+  stmt= mysql_simple_prepare(mysql, "SELECT ?");
+  check_stmt(stmt);
+
+  memset(&bind, 0, sizeof(bind));
+
+  bind.buffer_type= MYSQL_TYPE_STRING;
+  bind.buffer= (void *) hello;
+  bind.buffer_length= sizeof(hello);
+
+  mysql_stmt_bind_param(stmt, &bind);
+  mysql_stmt_send_long_data(stmt, 0, hello, sizeof(hello));
+
+  rc= mysql_stmt_execute(stmt);
+  check_execute(stmt, rc);
+
+  rc= my_process_stmt_result(stmt);
+  DIE_UNLESS(rc == 1);
+
+  rc= mysql_stmt_reset(stmt);
+  check_execute(stmt, rc);
+
+  rc= mysql_stmt_close(stmt);
+  DIE_UNLESS(!rc);
+
+  rc= mysql_query(mysql, "select * from mysql.general_log where "
+                         "command_type='Close stmt' or "
+                         "command_type='Reset stmt' or "
+                         "command_type='Long Data'");
+  myquery(rc);
+
+  result= mysql_store_result(mysql);
+  mytest(result);
+
+  DIE_UNLESS(mysql_num_rows(result) == 3);
+
+  mysql_free_result(result);
+
+  DBUG_VOID_RETURN;
+}
+
 /*
   Read and parse arguments and MySQL options from my.cnf
 */
@@ -17618,6 +17677,7 @@ static struct my_tests_st my_tests[]= {
   { "test_bug20023", test_bug20023 },
   { "test_bug31418", test_bug31418 },
   { "test_bug31669", test_bug31669 },
+  { "test_bug28386", test_bug28386 },
   { 0, 0 }
 };
 
Thread
bk commit into 5.1 tree (davi:1.2578) BUG#28386Davi Arnaut25 Feb
  • Re: bk commit into 5.1 tree (davi:1.2578) BUG#28386Konstantin Osipov26 Feb