Commit e57307f7 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/data0/bk/mysql-5.1

into  bk-internal.mysql.com:/data0/bk/mysql-5.1-kt
parents 965ae0f7 08348339
......@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Error messages for MySQL clients */
/* (Error messages for the daemon are in share/language/errmsg.sys) */
/* (Error messages for the daemon are in sql/share/errmsg.txt) */
#ifdef __cplusplus
extern "C" {
......
......@@ -21,7 +21,7 @@
Plugin API. Common for all plugin types.
*/
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0001
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0002
/*
The allowable types of plugins
......@@ -31,10 +31,6 @@
#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */
#define MYSQL_MAX_PLUGIN_TYPE_NUM 3 /* The number of plugin types */
#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
#define __attribute__(A)
#endif
/*
Macros for beginning and ending plugin declarations. Between
mysql_declare_plugin and mysql_declare_plugin_end there should
......
......@@ -44,7 +44,7 @@ libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \
noinst_HEADERS = embedded_priv.h emb_qcache.h
sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
ha_innodb.cc ha_ndbcluster.cc \
ha_ndbcluster.cc \
ha_ndbcluster_binlog.cc ha_partition.cc \
handler.cc sql_handler.cc \
hostname.cc init.cc password.c \
......
......@@ -17,6 +17,10 @@
#include <ctype.h>
#include <mysql/plugin.h>
#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8)
#define __attribute__(A)
#endif
static long number_of_calls= 0; /* for SHOW STATUS, see below */
/*
......
......@@ -28,7 +28,7 @@ ADD_DEFINITIONS(-DHAVE_ROW_BASED_REPLICATION -DMYSQL_SERVER
ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc
discover.cc ../libmysql/errmsg.c field.cc field_conv.cc
filesort.cc gstream.cc
ha_innodb.cc ha_partition.cc
ha_partition.cc
handler.cc hash_filo.cc hash_filo.h
hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc
item_create.cc item_func.cc item_geofunc.cc item_row.cc
......
......@@ -50,7 +50,6 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
sql_map.h sql_string.h unireg.h \
sql_error.h field.h handler.h mysqld_suffix.h \
ha_partition.h \
ha_innodb.h \
ha_ndbcluster.h ha_ndbcluster_binlog.h \
ha_ndbcluster_tables.h \
opt_range.h protocol.h rpl_tblmap.h \
......@@ -87,7 +86,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
unireg.cc des_key_file.cc \
discover.cc time.cc opt_range.cc opt_sum.cc \
records.cc filesort.cc handler.cc \
ha_partition.cc ha_innodb.cc \
ha_partition.cc \
ha_ndbcluster.cc ha_ndbcluster_binlog.cc \
sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc \
sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \
......
......@@ -85,6 +85,8 @@ struct show_table_authors_st show_table_authors[]= {
{ "Matthias Leich", "Berlin, Germany", "Testing - Server" },
{ "Dmitri Lenev", "Moscow, Russia",
"Time zones support (4.1), Triggers (5.0)" },
{ "Arjen Lentz", "Brisbane, Australia",
"Documentation (2001-2004), Dutch error messages, LOG2()" },
{ "Marc Liyanage", "", "Created Mac OS X packages" },
{ "Zarko Mocnik", "", "Sorting for Slovenian language" },
{ "Per-Erik Martin", "Uppsala, Sweden", "Stored Procedures (5.0)" },
......
......@@ -255,7 +255,12 @@ enum legacy_db_type
DB_TYPE_BLACKHOLE_DB,
DB_TYPE_PARTITION_DB,
DB_TYPE_BINLOG,
DB_TYPE_FIRST_DYNAMIC=32,
DB_TYPE_SOLID,
DB_TYPE_PBXT,
DB_TYPE_TABLE_FUNCTION,
DB_TYPE_MEMCACHE,
DB_TYPE_FALCON,
DB_TYPE_FIRST_DYNAMIC=42,
DB_TYPE_DEFAULT=127 // Must be last
};
......
This diff is collapsed.
......@@ -35,12 +35,17 @@ plugin_type_init plugin_type_initialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
0,ha_initialize_handlerton,0
};
plugin_type_init plugin_type_deinitialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
0,ha_finalize_handlerton,0
};
static const char *plugin_interface_version_sym=
"_mysql_plugin_interface_version_";
static const char *sizeof_st_plugin_sym=
"_mysql_sizeof_struct_st_plugin_";
static const char *plugin_declarations_sym= "_mysql_plugin_declarations_";
static int min_plugin_interface_version= 0x0000;
static int min_plugin_interface_version= MYSQL_PLUGIN_INTERFACE_VERSION & ~0xFF;
/* Note that 'int version' must be the first field of every plugin
sub-structure (plugin->info).
*/
......@@ -469,50 +474,68 @@ static my_bool plugin_add(const LEX_STRING *name, const LEX_STRING *dl, int repo
}
void plugin_deinitializer(struct st_plugin_int *plugin)
void plugin_deinitialize(struct st_plugin_int *plugin)
{
if (plugin->plugin->status_vars)
{
SHOW_VAR array[2]= {
{plugin->plugin->name, (char*)plugin->plugin->status_vars, SHOW_ARRAY},
{0, 0, SHOW_UNDEF}
};
remove_status_vars(array);
}
if (plugin->state == PLUGIN_IS_READY)
if (plugin_type_deinitialize[plugin->plugin->type] &&
(*plugin_type_deinitialize[plugin->plugin->type])(plugin))
{
sql_print_error("Plugin '%s' of type %s failed deinitialization",
plugin->name.str, plugin_type_names[plugin->plugin->type]);
}
if (plugin->plugin->status_vars)
{
#ifdef FIX_LATER
/*
We have a problem right now where we can not prepend without
breaking backwards compatibility. We will fix this shortly so
that engines have "use names" and we wil use those for
CREATE TABLE, and use the plugin name then for adding automatic
variable names.
*/
SHOW_VAR array[2]= {
{plugin->plugin->name, (char*)plugin->plugin->status_vars, SHOW_ARRAY},
{0, 0, SHOW_UNDEF}
};
remove_status_vars(array);
#else
remove_status_vars(plugin->plugin->status_vars);
#endif /* FIX_LATER */
}
if (plugin->plugin->deinit)
{
DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
if (plugin->plugin->deinit())
{
if (plugin->plugin->deinit)
{
DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
if (plugin->plugin->deinit())
{
DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
plugin->name.str));
}
}
plugin->state= PLUGIN_IS_UNINITIALIZED;
DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
plugin->name.str));
}
}
plugin->state= PLUGIN_IS_UNINITIALIZED;
}
static void plugin_del(struct st_plugin_int *plugin)
{
DBUG_ENTER("plugin_del(plugin)");
hash_delete(&plugin_hash[plugin->plugin->type], (byte*)plugin);
plugin_dl_del(&plugin->plugin_dl->dl);
plugin->state= PLUGIN_IS_FREED;
plugin_array_version++;
DBUG_VOID_RETURN;
}
static void plugin_del(const LEX_STRING *name)
{
uint i;
struct st_plugin_int *plugin;
DBUG_ENTER("plugin_del");
DBUG_ENTER("plugin_del(name)");
if ((plugin= plugin_find_internal(name, MYSQL_ANY_PLUGIN)))
{
plugin_deinitializer(plugin);
hash_delete(&plugin_hash[plugin->plugin->type], (byte*)plugin);
plugin_dl_del(&plugin->plugin_dl->dl);
plugin->state= PLUGIN_IS_FREED;
plugin_array_version++;
}
plugin_del(plugin);
DBUG_VOID_RETURN;
}
void plugin_unlock(struct st_plugin_int *plugin)
{
DBUG_ENTER("plugin_unlock");
......@@ -521,9 +544,8 @@ void plugin_unlock(struct st_plugin_int *plugin)
plugin->ref_count--;
if (plugin->state == PLUGIN_IS_DELETED && ! plugin->ref_count)
{
if (plugin->plugin->deinit)
plugin->plugin->deinit();
plugin_del(&plugin->name);
plugin_deinitialize(plugin);
plugin_del(plugin);
}
rw_unlock(&THR_LOCK_plugin);
DBUG_VOID_RETURN;
......@@ -537,15 +559,15 @@ static int plugin_initialize(struct st_plugin_int *plugin)
if (plugin->plugin->status_vars)
{
#ifdef FIX_LATER
/*
/*
We have a problem right now where we can not prepend without
breaking backwards compatibility. We will fix this shortly so
breaking backwards compatibility. We will fix this shortly so
that engines have "use names" and we wil use those for
CREATE TABLE, and use the plugin name then for adding automatic
variable names.
*/
SHOW_VAR array[2]= {
{plugin->name, (char*)plugin->status_vars, SHOW_ARRAY},
{plugin->plugin->name, (char*)plugin->plugin->status_vars, SHOW_ARRAY},
{0, 0, SHOW_UNDEF}
};
if (add_status_vars(array)) // add_status_vars makes a copy
......@@ -578,53 +600,6 @@ static int plugin_initialize(struct st_plugin_int *plugin)
DBUG_RETURN(1);
}
static int plugin_finalize(THD *thd, struct st_plugin_int *plugin)
{
int rc;
DBUG_ENTER("plugin_finalize");
if (plugin->ref_count)
{
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"Plugin is busy and will be uninstalled on shutdown");
goto err;
}
switch (plugin->plugin->type)
{
case MYSQL_STORAGE_ENGINE_PLUGIN:
if (ha_finalize_handlerton(plugin))
{
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"Storage engine shutdown failed. "
"It will be uninstalled on shutdown");
sql_print_warning("Storage engine '%s' shutdown failed. "
"It will be uninstalled on shutdown", plugin->name.str);
goto err;
}
break;
default:
break;
}
if (plugin->plugin->deinit)
{
if ((rc= plugin->plugin->deinit()))
{
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"Plugin deinit failed. "
"It will be uninstalled on shutdown");
sql_print_warning("Plugin '%s' deinit failed. "
"It will be uninstalled on shutdown", plugin->name.str);
goto err;
}
}
DBUG_RETURN(0);
err:
DBUG_RETURN(1);
}
static byte *get_hash_key(const byte *buff, uint *length,
my_bool not_used __attribute__((unused)))
{
......@@ -637,7 +612,7 @@ static byte *get_hash_key(const byte *buff, uint *length,
/*
The logic is that we first load and initialize all compiled in plugins.
From there we load up the dynamic types (assuming we have not been told to
skip this part).
skip this part).
Finally we inializie everything, aka the dynamic that have yet to initialize.
*/
......@@ -666,7 +641,7 @@ int plugin_init(int skip_dynamic_loading)
goto err;
}
/*
/*
First we register builtin plugins
*/
for (builtins= mysqld_builtins; *builtins; builtins++)
......@@ -702,7 +677,10 @@ int plugin_init(int skip_dynamic_loading)
if (tmp->state == PLUGIN_IS_UNINITIALIZED)
{
if (plugin_initialize(tmp))
plugin_del(&tmp->name);
{
plugin_deinitialize(tmp);
plugin_del(tmp);
}
}
}
......@@ -812,7 +790,7 @@ void plugin_shutdown(void)
{
struct st_plugin_int *tmp= dynamic_element(&plugin_array, i,
struct st_plugin_int *);
plugin_deinitializer(tmp);
plugin_deinitialize(tmp);
}
......@@ -862,7 +840,7 @@ my_bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING
{
my_error(ER_CANT_INITIALIZE_UDF, MYF(0), name->str,
"Plugin initialization function failed.");
goto err;
goto deinit;
}
table->use_all_columns();
......@@ -879,10 +857,9 @@ my_bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING
rw_unlock(&THR_LOCK_plugin);
DBUG_RETURN(FALSE);
deinit:
if (tmp->plugin->deinit)
tmp->plugin->deinit();
plugin_deinitialize(tmp);
err:
plugin_del(name);
plugin_del(tmp);
rw_unlock(&THR_LOCK_plugin);
DBUG_RETURN(TRUE);
}
......@@ -917,10 +894,17 @@ my_bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name)
goto err;
}
if (!plugin_finalize(thd, plugin))
plugin_del(name);
else
if (plugin->ref_count)
{
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"Plugin is busy and will be uninstalled on shutdown");
plugin->state= PLUGIN_IS_DELETED;
}
else
{
plugin_deinitialize(plugin);
plugin_del(plugin);
}
table->use_all_columns();
table->field[0]->store(name->str, name->length, system_charset_info);
......@@ -983,7 +967,6 @@ my_bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func,
for (idx= 0; idx < total; idx++)
{
plugin= plugins[idx];
if (unlikely(version != plugin_array_version))
{
rw_rdlock(&THR_LOCK_plugin);
......@@ -992,6 +975,7 @@ my_bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func,
plugins[i]=0;
rw_unlock(&THR_LOCK_plugin);
}
plugin= plugins[idx];
if (plugin && func(thd, plugin, arg))
goto err;
}
......
......@@ -125,7 +125,7 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd)
buffer[8] = 0 /*xflags*/;
buffer[9] = 0x03;
s->start = 10L;
my_write(s->file, buffer, s->start, MYF(0));
my_write(s->file, buffer, (uint)s->start, MYF(0));
/* We use 10L instead of ftell(s->file) to because ftell causes an
* fflush on some systems. This version of the library doesn't use
* start anyway in write mode, so this initialization is not
......@@ -503,7 +503,7 @@ int azrewind (s)
if (!s->transparent) (void)inflateReset(&s->stream);
s->in = 0;
s->out = 0;
return my_seek(s->file, s->start, MY_SEEK_SET, MYF(0));
return my_seek(s->file, (int)s->start, MY_SEEK_SET, MYF(0));
}
/* ===========================================================================
......
......@@ -1263,7 +1263,6 @@ bool ha_federated::create_where_from_key(String *to,
if (tmp.append(STRING_WITH_LEN(") ")))
goto err;
next_loop:
if (store_length >= length)
break;
DBUG_PRINT("info", ("remainder %d", remainder));
......@@ -2016,8 +2015,8 @@ int ha_federated::delete_row(const byte *buf)
{
DBUG_RETURN(stash_remote_error());
}
stats.deleted+= mysql->affected_rows;
stats.records-= mysql->affected_rows;
stats.deleted+= (ha_rows)mysql->affected_rows;
stats.records-= (ha_rows)mysql->affected_rows;
DBUG_PRINT("info",
("rows deleted %d rows deleted for all time %d",
int(mysql->affected_rows), stats.deleted));
......@@ -2373,7 +2372,6 @@ int ha_federated::rnd_next(byte *buf)
int ha_federated::read_next(byte *buf, MYSQL_RES *result)
{
int retval;
my_ulonglong num_rows;
MYSQL_ROW row;
DBUG_ENTER("ha_federated::read_next");
......@@ -2867,7 +2865,7 @@ int ha_federated::connection_autocommit(bool state)
{
const char *text;
DBUG_ENTER("ha_federated::connection_autocommit");
text= (state == true) ? "SET AUTOCOMMIT=1" : "SET AUTOCOMMIT=0";
text= (state == TRUE) ? "SET AUTOCOMMIT=1" : "SET AUTOCOMMIT=0";
DBUG_RETURN(execute_simple_query(text, 16));
}
......
......@@ -2,7 +2,12 @@
#SET(CMAKE_C_FLAGS_DEBUG "-DSAFEMALLOC -DSAFE_MUTEX")
ADD_DEFINITIONS(-DMYSQL_SERVER -D_WIN32 -DWIN32 -D_LIB)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include include)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib
include
handler
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/extra/yassl/include)
ADD_LIBRARY(innobase btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
buf/buf0buf.c buf/buf0flu.c buf/buf0lru.c buf/buf0rea.c
data/data0data.c data/data0type.c
......@@ -23,6 +28,7 @@ ADD_LIBRARY(innobase btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c
os/os0file.c os/os0proc.c os/os0sync.c os/os0thread.c
page/page0cur.c page/page0page.c
que/que0que.c
handler/ha_innodb.cc
read/read0read.c
rem/rem0cmp.c rem/rem0rec.c
row/row0ins.c row/row0mysql.c row/row0purge.c row/row0row.c row/row0sel.c row/row0uins.c
......
......@@ -34,6 +34,7 @@ noinst_HEADERS =
SUBDIRS = os ut btr buf data dict dyn eval fil fsp fut \
ha ibuf lock log mach mem mtr page \
handler \
pars que read rem row srv sync thr trx usr
EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr0cur.ic \
......@@ -86,6 +87,7 @@ EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr
include/univ.i include/usr0sess.h include/usr0sess.ic include/usr0types.h \
include/ut0byte.h include/ut0byte.ic include/ut0dbg.h include/ut0lst.h \
include/ut0mem.h include/ut0mem.ic include/ut0rnd.h include/ut0rnd.ic \
handler/ha_innodb.h \
include/ut0sort.h include/ut0ut.h include/ut0ut.ic include/ut0vec.h include/ut0vec.ic include/ha_prototypes.h \
include/ut0list.h include/ut0list.ic \
include/ut0wqueue.h \
......@@ -102,6 +104,7 @@ libinnobase_a_LIBADD = usr/libusr.a srv/libsrv.a dict/libdict.a \
page/libpage.a rem/librem.a thr/libthr.a \
sync/libsync.a data/libdata.a mach/libmach.a \
ha/libha.a dyn/libdyn.a mem/libmem.a \
handler/libhandler.a \
ut/libut.a os/libos.a ut/libut.a
libinnobase_a_SOURCES =
......
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
# & Innobase Oy
#
# 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; either version 2 of the License, or
# (at your option) any later version.
#
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
DEFS = -DMYSQL_SERVER @DEFS@
noinst_LIBRARIES = libhandler.a
libhandler_a_SOURCES = ha_innodb.cc
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -31,8 +31,7 @@ have disables the InnoDB inlining in this file. */
#pragma implementation // gcc: Class implementation
#endif
#include "mysql_priv.h"
#include "slave.h"
#include <mysql_priv.h>
#include <m_ctype.h>
#include <hash.h>
......@@ -1600,21 +1599,6 @@ innobase_init(void)
pthread_cond_init(&commit_cond, NULL);
innodb_inited= 1;
/* If this is a replication slave and we needed to do a crash recovery,
set the master binlog position to what InnoDB internally knew about
how far we got transactions durable inside InnoDB. There is a
problem here: if the user used also MyISAM tables, InnoDB might not
know the right position for them.
THIS DOES NOT WORK CURRENTLY because replication seems to initialize
glob_mi also after innobase_init. */
/* if (trx_sys_mysql_master_log_pos != -1) {
ut_memcpy(glob_mi.log_file_name, trx_sys_mysql_master_log_name,
1 + ut_strlen(trx_sys_mysql_master_log_name));
glob_mi.pos = trx_sys_mysql_master_log_pos;
}
*/
DBUG_RETURN(FALSE);
error:
have_innodb= SHOW_OPTION_DISABLED; // If we couldn't use handler
......@@ -1689,19 +1673,6 @@ innobase_commit_low(
return;
}
#ifdef HAVE_REPLICATION
THD *thd=current_thd;
if (thd && thd->slave_thread) {
/* Update the replication position info inside InnoDB */
trx->mysql_master_log_file_name
= active_mi->rli.group_master_log_name;
trx->mysql_master_log_pos = ((ib_longlong)
active_mi->rli.future_group_master_log_pos);
}
#endif /* HAVE_REPLICATION */
trx_commit_for_mysql(trx);
}
......
......@@ -65,6 +65,7 @@ MYSQL_PLUGIN_ACTIONS(innobase, [
storage/innobase/sync/Makefile
storage/innobase/thr/Makefile
storage/innobase/trx/Makefile
storage/innobase/handler/Makefile
storage/innobase/usr/Makefile)
])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment