List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:February 8 2011 5:52pm
Subject:bzr push into mysql-trunk branch (Georgi.Kodinov:3619)
View as plain text  
 3619 Georgi Kodinov	2011-02-08 [merge]
      merge from trunk to trunk-stage

    modified:
      mysql-test/include/icp_tests.inc
      mysql-test/r/innodb_icp.result
      mysql-test/r/innodb_icp_none.result
      mysql-test/r/myisam_icp.result
      mysql-test/r/myisam_icp_none.result
      mysql-test/valgrind.supp
      storage/innobase/btr/btr0btr.c
      storage/innobase/btr/btr0cur.c
      storage/innobase/btr/btr0sea.c
      storage/innobase/buf/buf0buddy.c
      storage/innobase/buf/buf0buf.c
      storage/innobase/buf/buf0lru.c
      storage/innobase/dict/dict0dict.c
      storage/innobase/dict/dict0load.c
      storage/innobase/dict/dict0stats.c
      storage/innobase/fsp/fsp0fsp.c
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/handler0alter.cc
      storage/innobase/handler/i_s.cc
      storage/innobase/ibuf/ibuf0ibuf.c
      storage/innobase/include/btr0cur.h
      storage/innobase/include/buf0buf.h
      storage/innobase/include/buf0lru.h
      storage/innobase/include/dict0types.h
      storage/innobase/include/os0sync.h
      storage/innobase/include/os0sync.ic
      storage/innobase/include/rem0cmp.h
      storage/innobase/include/rem0cmp.ic
      storage/innobase/include/row0upd.h
      storage/innobase/include/srv0srv.h
      storage/innobase/include/trx0trx.h
      storage/innobase/include/trx0trx.ic
      storage/innobase/include/univ.i
      storage/innobase/lock/lock0lock.c
      storage/innobase/lock/lock0wait.c
      storage/innobase/mem/mem0mem.c
      storage/innobase/page/page0zip.c
      storage/innobase/que/que0que.c
      storage/innobase/rem/rem0cmp.c
      storage/innobase/row/row0ins.c
      storage/innobase/row/row0merge.c
      storage/innobase/row/row0mysql.c
      storage/innobase/row/row0purge.c
      storage/innobase/row/row0sel.c
      storage/innobase/row/row0umod.c
      storage/innobase/row/row0upd.c
      storage/innobase/srv/srv0start.c
      storage/innobase/sync/sync0sync.c
      storage/innobase/trx/trx0purge.c
      storage/innobase/trx/trx0roll.c
      storage/innobase/trx/trx0trx.c
=== modified file 'include/mysql/plugin.h'
--- a/include/mysql/plugin.h	2010-10-21 09:49:16 +0000
+++ b/include/mysql/plugin.h	2011-01-21 14:03:58 +0000
@@ -48,6 +48,8 @@ class Item;
 #define MYSQL_THD void*
 #endif
 
+typedef void * MYSQL_PLUGIN;
+
 #include <mysql/services.h>
 
 #define MYSQL_XIDDATASIZE 128
@@ -409,8 +411,8 @@ struct st_mysql_plugin
   const char *author;   /* plugin author (for I_S.PLUGINS)              */
   const char *descr;    /* general descriptive text (for I_S.PLUGINS)   */
   int license;          /* the plugin license (PLUGIN_LICENSE_XXX)      */
-  int (*init)(void *);  /* the function to invoke when plugin is loaded */
-  int (*deinit)(void *);/* the function to invoke when plugin is unloaded */
+  int (*init)(MYSQL_PLUGIN);  /* the function to invoke when plugin is loaded */
+  int (*deinit)(MYSQL_PLUGIN);/* the function to invoke when plugin is unloaded */
   unsigned int version; /* plugin version (for I_S.PLUGINS)             */
   struct st_mysql_show_var *status_vars;
   struct st_mysql_sys_var **system_vars;

=== modified file 'include/mysql/plugin_audit.h.pp'
--- a/include/mysql/plugin_audit.h.pp	2010-12-14 14:34:23 +0000
+++ b/include/mysql/plugin_audit.h.pp	2011-02-08 17:48:20 +0000
@@ -1,4 +1,5 @@
 #include "plugin.h"
+typedef void * MYSQL_PLUGIN;
 #include <mysql/services.h>
 #include <mysql/service_my_snprintf.h>
 extern struct my_snprintf_service_st {
@@ -52,6 +53,19 @@ extern struct my_thread_scheduler_servic
 } *my_thread_scheduler_service;
 int my_thread_scheduler_set(struct scheduler_functions *scheduler);
 int my_thread_scheduler_reset();
+#include <mysql/service_my_plugin_log.h>
+enum plugin_log_level
+{
+  MY_ERROR_LEVEL,
+  MY_WARNING_LEVEL,
+  MY_INFORMATION_LEVEL
+};
+extern struct my_plugin_log_service
+{
+  int (*my_plugin_log_message)(MYSQL_PLUGIN *, enum plugin_log_level, const char *, ...);
+} *my_plugin_log_service;
+int my_plugin_log_message(MYSQL_PLUGIN *plugin, enum plugin_log_level level,
+                          const char *format, ...);
 struct st_mysql_xid {
   long formatID;
   long gtrid_length;
@@ -88,8 +102,8 @@ struct st_mysql_plugin
   const char *author;
   const char *descr;
   int license;
-  int (*init)(void *);
-  int (*deinit)(void *);
+  int (*init)(MYSQL_PLUGIN);
+  int (*deinit)(MYSQL_PLUGIN);
   unsigned int version;
   struct st_mysql_show_var *status_vars;
   struct st_mysql_sys_var **system_vars;

=== modified file 'include/mysql/plugin_auth.h.pp'
--- a/include/mysql/plugin_auth.h.pp	2010-10-05 12:26:49 +0000
+++ b/include/mysql/plugin_auth.h.pp	2011-02-08 17:48:20 +0000
@@ -1,4 +1,5 @@
 #include <mysql/plugin.h>
+typedef void * MYSQL_PLUGIN;
 #include <mysql/services.h>
 #include <mysql/service_my_snprintf.h>
 extern struct my_snprintf_service_st {
@@ -52,6 +53,19 @@ extern struct my_thread_scheduler_servic
 } *my_thread_scheduler_service;
 int my_thread_scheduler_set(struct scheduler_functions *scheduler);
 int my_thread_scheduler_reset();
+#include <mysql/service_my_plugin_log.h>
+enum plugin_log_level
+{
+  MY_ERROR_LEVEL,
+  MY_WARNING_LEVEL,
+  MY_INFORMATION_LEVEL
+};
+extern struct my_plugin_log_service
+{
+  int (*my_plugin_log_message)(MYSQL_PLUGIN *, enum plugin_log_level, const char *, ...);
+} *my_plugin_log_service;
+int my_plugin_log_message(MYSQL_PLUGIN *plugin, enum plugin_log_level level,
+                          const char *format, ...);
 struct st_mysql_xid {
   long formatID;
   long gtrid_length;
@@ -88,8 +102,8 @@ struct st_mysql_plugin
   const char *author;
   const char *descr;
   int license;
-  int (*init)(void *);
-  int (*deinit)(void *);
+  int (*init)(MYSQL_PLUGIN);
+  int (*deinit)(MYSQL_PLUGIN);
   unsigned int version;
   struct st_mysql_show_var *status_vars;
   struct st_mysql_sys_var **system_vars;

=== modified file 'include/mysql/plugin_ftparser.h.pp'
--- a/include/mysql/plugin_ftparser.h.pp	2010-08-30 14:07:40 +0000
+++ b/include/mysql/plugin_ftparser.h.pp	2011-02-08 17:48:20 +0000
@@ -1,4 +1,5 @@
 #include "plugin.h"
+typedef void * MYSQL_PLUGIN;
 #include <mysql/services.h>
 #include <mysql/service_my_snprintf.h>
 extern struct my_snprintf_service_st {
@@ -52,6 +53,19 @@ extern struct my_thread_scheduler_servic
 } *my_thread_scheduler_service;
 int my_thread_scheduler_set(struct scheduler_functions *scheduler);
 int my_thread_scheduler_reset();
+#include <mysql/service_my_plugin_log.h>
+enum plugin_log_level
+{
+  MY_ERROR_LEVEL,
+  MY_WARNING_LEVEL,
+  MY_INFORMATION_LEVEL
+};
+extern struct my_plugin_log_service
+{
+  int (*my_plugin_log_message)(MYSQL_PLUGIN *, enum plugin_log_level, const char *, ...);
+} *my_plugin_log_service;
+int my_plugin_log_message(MYSQL_PLUGIN *plugin, enum plugin_log_level level,
+                          const char *format, ...);
 struct st_mysql_xid {
   long formatID;
   long gtrid_length;
@@ -88,8 +102,8 @@ struct st_mysql_plugin
   const char *author;
   const char *descr;
   int license;
-  int (*init)(void *);
-  int (*deinit)(void *);
+  int (*init)(MYSQL_PLUGIN);
+  int (*deinit)(MYSQL_PLUGIN);
   unsigned int version;
   struct st_mysql_show_var *status_vars;
   struct st_mysql_sys_var **system_vars;

=== added file 'include/mysql/service_my_plugin_log.h'
--- a/include/mysql/service_my_plugin_log.h	1970-01-01 00:00:00 +0000
+++ b/include/mysql/service_my_plugin_log.h	2011-02-08 17:48:20 +0000
@@ -0,0 +1,64 @@
+/*  Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+    
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License as
+    published by the Free Software Foundation; version 2 of the
+    License.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    GNU General Public License for more details.
+    
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+/**
+  @file
+  This service provides functions to report error conditions and log to 
+  mysql error log.
+*/
+
+#ifndef MYSQL_SERVICE_MY_PLUGIN_LOG_INCLUDED
+#define MYSQL_SERVICE_MY_PLUGIN_LOG_INCLUDED
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdarg.h>
+#endif
+
+/* keep in sync with the loglevel enum in my_sys.h */
+enum plugin_log_level
+{
+  MY_ERROR_LEVEL,
+  MY_WARNING_LEVEL,
+  MY_INFORMATION_LEVEL
+};  
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern struct my_plugin_log_service
+{
+  /** write a message to the log */
+  int (*my_plugin_log_message)(MYSQL_PLUGIN *, enum plugin_log_level, const char *, ...);
+} *my_plugin_log_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define my_plugin_log_message my_plugin_log_service->my_plugin_log_message
+
+#else
+
+int my_plugin_log_message(MYSQL_PLUGIN *plugin, enum plugin_log_level level,
+                          const char *format, ...);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

=== modified file 'include/mysql/services.h'
--- a/include/mysql/services.h	2010-06-07 14:01:39 +0000
+++ b/include/mysql/services.h	2011-02-08 17:48:20 +0000
@@ -22,6 +22,7 @@ extern "C" {
 #include <mysql/service_thd_alloc.h>
 #include <mysql/service_thd_wait.h>
 #include <mysql/service_thread_scheduler.h>
+#include <mysql/service_my_plugin_log.h>
 
 #ifdef __cplusplus
 }

=== modified file 'include/service_versions.h'
--- a/include/service_versions.h	2010-06-07 14:01:39 +0000
+++ b/include/service_versions.h	2011-02-08 17:48:20 +0000
@@ -23,3 +23,4 @@
 #define VERSION_thd_alloc       0x0100
 #define VERSION_thd_wait        0x0100
 #define VERSION_my_thread_scheduler 0x0100
+#define VERSION_my_plugin_log 0x0100

=== modified file 'libservices/CMakeLists.txt'
--- a/libservices/CMakeLists.txt	2010-11-13 22:16:52 +0000
+++ b/libservices/CMakeLists.txt	2011-02-08 17:48:20 +0000
@@ -19,6 +19,7 @@ SET(MYSQLSERVICES_SOURCES
   my_snprintf_service.c
   thd_alloc_service.c
   thd_wait_service.c
+  my_plugin_log_service.c
   my_thread_scheduler_service.c)
 
 ADD_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})

=== added file 'libservices/my_plugin_log_service.c'
--- a/libservices/my_plugin_log_service.c	1970-01-01 00:00:00 +0000
+++ b/libservices/my_plugin_log_service.c	2011-02-08 17:48:20 +0000
@@ -0,0 +1,18 @@
+/*  Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+    
+    This program is free software; you can redistribute it and/or
+    modify it under the terms of the GNU General Public License as
+    published by the Free Software Foundation; version 2 of the
+    License.
+    
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+    GNU General Public License for more details.
+    
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+
+#include <service_versions.h>
+SERVICE_VERSION *my_plugin_log_service= (void*)VERSION_my_plugin_log;

=== modified file 'mysql-test/r/plugin_auth.result'
--- a/mysql-test/r/plugin_auth.result	2011-02-08 15:49:51 +0000
+++ b/mysql-test/r/plugin_auth.result	2011-02-08 17:48:20 +0000
@@ -1,3 +1,4 @@
+CALL mtr.add_suppression("Plugin test_plugin_server reported: 'Wrong password supplied for plug_dest'");
 SELECT PLUGIN_STATUS, PLUGIN_TYPE, PLUGIN_DESCRIPTION
 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='test_plugin_server';
 PLUGIN_STATUS	ACTIVE

=== modified file 'mysql-test/r/plugin_auth_qa_1.result'
--- a/mysql-test/r/plugin_auth_qa_1.result	2010-10-20 14:56:09 +0000
+++ b/mysql-test/r/plugin_auth_qa_1.result	2011-02-08 17:48:20 +0000
@@ -1,3 +1,4 @@
+CALL mtr.add_suppression("Plugin test_plugin_server reported: 'Wrong password supplied for plug_dest'");
 CREATE DATABASE test_user_db;
 SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
 user	plugin	authentication_string

=== modified file 'mysql-test/t/plugin_auth.test'
--- a/mysql-test/t/plugin_auth.test	2011-01-31 15:55:58 +0000
+++ b/mysql-test/t/plugin_auth.test	2011-02-08 17:48:20 +0000
@@ -1,6 +1,7 @@
 --source include/have_plugin_auth.inc
 --source include/not_embedded.inc
 --source include/mysql_upgrade_preparation.inc
+CALL mtr.add_suppression("Plugin test_plugin_server reported: 'Wrong password supplied for plug_dest'");
 
 query_vertical SELECT PLUGIN_STATUS, PLUGIN_TYPE, PLUGIN_DESCRIPTION
   FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME='test_plugin_server';

=== modified file 'mysql-test/t/plugin_auth_qa_1.test'
--- a/mysql-test/t/plugin_auth_qa_1.test	2010-10-25 10:24:26 +0000
+++ b/mysql-test/t/plugin_auth_qa_1.test	2011-02-08 17:48:20 +0000
@@ -2,6 +2,7 @@
 
 --source include/have_plugin_auth.inc
 --source include/not_embedded.inc
+CALL mtr.add_suppression("Plugin test_plugin_server reported: 'Wrong password supplied for plug_dest'");
 
 CREATE DATABASE test_user_db;
 

=== modified file 'plugin/auth/test_plugin.c'
--- a/plugin/auth/test_plugin.c	2011-01-31 15:32:57 +0000
+++ b/plugin/auth/test_plugin.c	2011-02-08 17:48:20 +0000
@@ -45,6 +45,20 @@
 /********************* SERVER SIDE ****************************************/
 
 /**
+ Handle assigned when loading the plugin. 
+ Used with the error reporting functions. 
+*/
+static MYSQL_PLUGIN plugin_info_ptr; 
+
+static int
+test_plugin_init (MYSQL_PLUGIN plugin_info)
+{
+  plugin_info_ptr= plugin_info;
+  return 0;
+}
+
+
+/**
   dialog test plugin mimicking the ordinary auth mechanism. Used to test the auth plugin API
 */
 static int auth_test_plugin(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
@@ -64,7 +78,12 @@ static int auth_test_plugin(MYSQL_PLUGIN
 
   /* fail if the password is wrong */
   if (strcmp((const char *) pkt, info->auth_string))
+  {
+    my_plugin_log_message(plugin_info_ptr, MY_ERROR_LEVEL, 
+                          "Wrong password supplied for %s", 
+                          info->auth_string);
     return CR_ERROR;
+  }
 
   /* copy auth string as a destination name to check it */
   strcpy (info->authenticated_as, info->auth_string);
@@ -72,6 +91,8 @@ static int auth_test_plugin(MYSQL_PLUGIN
   /* copy something into the external user name */
   strcpy (info->external_user, info->auth_string);
 
+  my_plugin_log_message(plugin_info_ptr, MY_INFORMATION_LEVEL, 
+                        "successfully authenticated user %s", info->authenticated_as);
   return CR_OK;
 }
 
@@ -120,7 +141,7 @@ mysql_declare_plugin(test_plugin)
   "Georgi Kodinov",
   "plugin API test plugin",
   PLUGIN_LICENSE_GPL,
-  NULL,
+  test_plugin_init,
   NULL,
   0x0100,
   NULL,

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2011-02-08 15:54:12 +0000
+++ b/sql/log.cc	2011-02-08 17:48:20 +0000
@@ -34,6 +34,7 @@
 #include "tztime.h"             // my_tz_OFFSET0, struct Time_zone
 #include "sql_acl.h"            // SUPER_ACL
 #include "sql_audit.h"
+#include "mysql/service_my_plugin_log.h"
 
 #include <my_dir.h>
 #include <stdarg.h>
@@ -1879,7 +1880,6 @@ const char *MYSQL_LOG::generate_name(con
 }
 
 
-
 int error_log_print(enum loglevel level, const char *format,
                     va_list args)
 {
@@ -2199,6 +2199,35 @@ void sql_print_information(const char *f
 }
 
 
+extern "C"
+int my_plugin_log_message(MYSQL_PLUGIN *plugin_ptr, plugin_log_level level,
+                          const char *format, ...)
+{
+  char format2[MYSQL_ERRMSG_SIZE];
+  int ret;
+  loglevel lvl;
+  struct st_plugin_int *plugin = (st_plugin_int *) plugin_ptr;
+  va_list args;
+
+  DBUG_ASSERT(lvl >= ERROR_LEVEL || lvl <= INFORMATION_LEVEL);
+
+  switch (level)
+  {
+  case MY_ERROR_LEVEL:       lvl= ERROR_LEVEL; break;
+  case MY_WARNING_LEVEL:     lvl= WARNING_LEVEL; break;
+  case MY_INFORMATION_LEVEL: lvl= INFORMATION_LEVEL; break;
+  default:                   return 1;
+  }
+
+  va_start(args, format);
+  snprintf(format2, sizeof (format2) - 1, "Plugin %.*s reported: '%s'", 
+           (int) plugin->name.length, plugin->name.str, format);
+  ret= error_log_print(lvl, format2, args);
+  va_end(args);
+  return ret;
+}
+
+
 /********* transaction coordinator log for 2pc - mmap() based solution *******/
 
 /*

=== modified file 'sql/sql_plugin_services.h'
--- a/sql/sql_plugin_services.h	2010-09-01 13:05:01 +0000
+++ b/sql/sql_plugin_services.h	2011-02-08 17:48:20 +0000
@@ -46,6 +46,11 @@ static struct my_thread_scheduler_servic
   my_thread_scheduler_reset,
 };
 
+static struct my_plugin_log_service my_plugin_log_handler= {
+  my_plugin_log_message
+};
+
+
 
 static struct st_service_ref list_of_services[]=
 {
@@ -54,5 +59,6 @@ static struct st_service_ref list_of_ser
   { "thd_wait_service",    VERSION_thd_wait,    &thd_wait_handler },
   { "my_thread_scheduler_service",
     VERSION_my_thread_scheduler, &my_thread_scheduler_handler },
+  { "my_plugin_log_service", VERSION_my_plugin_log, &my_plugin_log_handler },
 };
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (Georgi.Kodinov:3619) Georgi Kodinov8 Feb