Commit cf98f660 authored by marko's avatar marko

branches/zip: Allow the symbols in the dynamic InnoDB plugin to be

redefined so that the dynamic plugin can replace the builtin InnoDB
in MySQL 5.1.

ha_innodb.cc, handler0alter.cc: #include "univ.i" before any other InnoDB
header files or before defining any symbols

innodb_redefine.h: New file, to contain a mapping of symbols.  The idea
is that this file will be replaced in the build process; because this
is a large file that can be generated automatically, it does not make sense
to keep it under version control.

univ.i: #include "innodb_redefine.h" and #define ha_innobase ha_innodb

Makefile.am (ha_innodb_la_CXXFLAGS): Remove -Dha_innobase=ha_innodb

NOTE: there are still some issues in the source code.  One known issue is
the #undef mutex_free in sync0sync.h, which will cause the plugin to call the
function mutex_free in the builtin InnoDB.  The preprocessor symbols defined
in innodb_redefine.h must not be undefined or redefined anywhere in the code.
parent 418d050f
......@@ -182,8 +182,7 @@ pkglib_LTLIBRARIES = @plugin_innobase_shared_target@
# we must rename class ha_innobase to something else. Also global symbols
# will have to be redefined, but that can be done by objcopy --redefine-syms.
ha_innodb_la_LDFLAGS = -module -rpath $(MYSQLLIBdir)
ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) \
-DMYSQL_DYNAMIC_PLUGIN -Dha_innobase=ha_innodb
ha_innodb_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_innodb_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
ha_innodb_la_SOURCES = $(libinnobase_a_SOURCES)
......
......@@ -33,9 +33,41 @@
#include <myisampack.h>
#include <mysys_err.h>
#include <my_sys.h>
#include <mysql/plugin.h>
/* Include necessary InnoDB headers */
extern "C" {
#include "../storage/innobase/include/univ.i"
#include "../storage/innobase/include/btr0sea.h"
#include "../storage/innobase/include/os0file.h"
#include "../storage/innobase/include/os0thread.h"
#include "../storage/innobase/include/srv0start.h"
#include "../storage/innobase/include/srv0srv.h"
#include "../storage/innobase/include/trx0roll.h"
#include "../storage/innobase/include/trx0trx.h"
#include "../storage/innobase/include/trx0sys.h"
#include "../storage/innobase/include/mtr0mtr.h"
#include "../storage/innobase/include/row0ins.h"
#include "../storage/innobase/include/row0mysql.h"
#include "../storage/innobase/include/row0sel.h"
#include "../storage/innobase/include/row0upd.h"
#include "../storage/innobase/include/log0log.h"
#include "../storage/innobase/include/lock0lock.h"
#include "../storage/innobase/include/dict0crea.h"
#include "../storage/innobase/include/btr0cur.h"
#include "../storage/innobase/include/btr0btr.h"
#include "../storage/innobase/include/fsp0fsp.h"
#include "../storage/innobase/include/sync0sync.h"
#include "../storage/innobase/include/fil0fil.h"
#include "../storage/innobase/include/trx0xa.h"
#include "../storage/innobase/include/row0merge.h"
#include "../storage/innobase/include/thr0loc.h"
#include "../storage/innobase/include/dict0boot.h"
#include "../storage/innobase/include/ha_prototypes.h"
}
#include "ha_innodb.h"
#include "i_s.h"
#include <mysql/plugin.h>
#ifndef MYSQL_SERVER
/* This is needed because of Bug #3596. Let us hope that pthread_mutex_t
......@@ -70,37 +102,6 @@ innodb_plugin_init(void);
struct handlerton* innodb_hton_ptr = NULL;
#endif /* MYSQL_DYNAMIC_PLUGIN */
/* Include necessary InnoDB headers */
extern "C" {
#include "../storage/innobase/include/univ.i"
#include "../storage/innobase/include/btr0sea.h"
#include "../storage/innobase/include/os0file.h"
#include "../storage/innobase/include/os0thread.h"
#include "../storage/innobase/include/srv0start.h"
#include "../storage/innobase/include/srv0srv.h"
#include "../storage/innobase/include/trx0roll.h"
#include "../storage/innobase/include/trx0trx.h"
#include "../storage/innobase/include/trx0sys.h"
#include "../storage/innobase/include/mtr0mtr.h"
#include "../storage/innobase/include/row0ins.h"
#include "../storage/innobase/include/row0mysql.h"
#include "../storage/innobase/include/row0sel.h"
#include "../storage/innobase/include/row0upd.h"
#include "../storage/innobase/include/log0log.h"
#include "../storage/innobase/include/lock0lock.h"
#include "../storage/innobase/include/dict0crea.h"
#include "../storage/innobase/include/btr0cur.h"
#include "../storage/innobase/include/btr0btr.h"
#include "../storage/innobase/include/fsp0fsp.h"
#include "../storage/innobase/include/sync0sync.h"
#include "../storage/innobase/include/fil0fil.h"
#include "../storage/innobase/include/trx0xa.h"
#include "../storage/innobase/include/row0merge.h"
#include "../storage/innobase/include/thr0loc.h"
#include "../storage/innobase/include/dict0boot.h"
#include "../storage/innobase/include/ha_prototypes.h"
}
static const long AUTOINC_OLD_STYLE_LOCKING = 0;
static const long AUTOINC_NEW_STYLE_LOCKING = 1;
static const long AUTOINC_NO_LOCKING = 2;
......
......@@ -7,8 +7,6 @@ Smart ALTER TABLE
#include <mysql_priv.h>
#include <mysqld_error.h>
#include "ha_innodb.h"
extern "C" {
#include "log0log.h"
#include "row0merge.h"
......@@ -19,6 +17,8 @@ extern "C" {
#include "handler0alter.h"
}
#include "ha_innodb.h"
/*****************************************************************
Copies an InnoDB column to a MySQL field. This function is
adapted from row_sel_field_store_in_mysql_format(). */
......
/* This file is needed for building a dynamic InnoDB plugin that
can replace the builtin InnoDB plugin in MySQL.
It must be generated as follows:
* compile the InnoDB plugin
* overwrite include/innodb_redefine.h with the following command
* compile the final InnoDB plugin
nm .libs/ha_innodb.so.0.0.0|
sed -ne 's/^[^ ]* . \([a-zA-Z][a-zA-Z0-9_]*\)$/#define \1 ibd_\1/p'|
grep -v 'innodb_hton_ptr\|builtin_innobase_plugin' > include/innodb_redefine.h
*/
......@@ -9,6 +9,23 @@ Created 1/20/1994 Heikki Tuuri
#ifndef univ_i
#define univ_i
#ifdef MYSQL_DYNAMIC_PLUGIN
/* In the dynamic plugin, redefine all symbols not to conflict with
the symbols of a builtin InnoDB. The build process works as follows:
* compile the InnoDB plugin using an empty include/innodb_redefine.h
* overwrite include/innodb_redefine.h with the following command
* compile the final InnoDB plugin
nm .libs/ha_innodb.so.0.0.0|
sed -ne 's/^[^ ]* . \([a-zA-Z][a-zA-Z0-9_]*\)$/#define \1 ibd_\1/p'|
grep -v 'innodb_hton_ptr\|builtin_innobase_plugin' > include/innodb_redefine.h
*/
# include "innodb_redefine.h"
/* Redefine all C++ classes here. */
# define ha_innobase ha_innodb
#endif /* MYSQL_DYNAMIC_PLUGIN */
#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__)
# undef __WIN__
# define __WIN__
......
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