diff --git a/Makefile.am b/Makefile.am index 3f46f059fc0..a68dbbcc2e6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,10 +17,20 @@ # Process this file with automake to create Makefile.in +MYSQLDATAdir = $(localstatedir) +MYSQLSHAREdir = $(pkgdatadir) +MYSQLBASEdir= $(prefix) +MYSQLLIBdir= $(pkglibdir) +INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ + -I$(top_srcdir)/regex \ + -I$(top_srcdir)/storage/innobase/include \ + -I$(top_srcdir)/sql \ + -I$(srcdir) + AUTOMAKE_OPTIONS = foreign TAR = gtar -noinst_HEADERS = ib_config.h +noinst_HEADERS = SUBDIRS = os ut btr buf data dict dyn eval fil fsp fut \ ha ibuf lock log mach mem mtr page \ @@ -77,7 +87,8 @@ EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr include/ut0byte.h include/ut0byte.ic include/ut0dbg.h include/ut0lst.h \ include/ut0mem.h include/ut0mem.ic include/ut0rnd.h include/ut0rnd.ic \ 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 \ + include/ut0list.h include/ut0list.ic \ + include/ut0wqueue.h \ CMakeLists.txt noinst_LIBRARIES = libinnobase.a diff --git a/compile-innodb b/compile-innodb index 31178c8aac0..027ff727af0 100755 --- a/compile-innodb +++ b/compile-innodb @@ -3,10 +3,7 @@ path=`dirname $0` . "$path/SETUP.sh" -extra_flags="$pentium_cflags $fast_cflags" -extra_configs="$pentium_configs" -strip=yes - -extra_configs="$extra_configs --with-innodb" +extra_flags="$pentium_cflags $fast_cflags -g" +extra_configs="$pentium_configs $static_link --with-plugins=innobase" . "$path/FINISH.sh" diff --git a/compile-innodb-debug b/compile-innodb-debug index 399cd40006f..d179c9453ce 100755 --- a/compile-innodb-debug +++ b/compile-innodb-debug @@ -4,10 +4,6 @@ path=`dirname $0` . "$path/SETUP.sh" $@ --with-debug=full extra_flags="$pentium_cflags $debug_cflags" -c_warnings="$c_warnings $debug_extra_warnings" -cxx_warnings="$cxx_warnings $debug_extra_warnings" -extra_configs="$pentium_configs $debug_configs " - -extra_configs="$extra_configs --with-innodb" +extra_configs="$pentium_configs $debug_configs --with-plugins=innobase" . "$path/FINISH.sh" diff --git a/configure.in b/configure.in deleted file mode 100644 index 4aaa28da89e..00000000000 --- a/configure.in +++ /dev/null @@ -1,156 +0,0 @@ -# Process this file with autoconf to produce a configure script -AC_INIT -AC_CANONICAL_SYSTEM -AM_MAINTAINER_MODE -AM_CONFIG_HEADER(ib_config.h) -AM_INIT_AUTOMAKE(ib, 0.90) - -# This is need before AC_PROG_CC -# - -if test "x${CFLAGS-}" = x ; then - cflags_is_set=no -else - cflags_is_set=yes -fi - -if test "x${CPPFLAGS-}" = x ; then - cppflags_is_set=no -else - cppflags_is_set=yes -fi - -if test "x${LDFLAGS-}" = x ; then - ldflags_is_set=no -else - ldflags_is_set=yes -fi - -# The following hack should ensure that configure doesn't add optimizing -# or debugging flags to CFLAGS or CXXFLAGS -CFLAGS="$CFLAGS " -CXXFLAGS="$CXXFLAGS " - -AC_PROG_CC -AC_PROG_RANLIB -AC_PROG_INSTALL -AC_PROG_LIBTOOL -AC_CHECK_HEADERS(aio.h sched.h) -AC_CHECK_SIZEOF(int, 4) -AC_CHECK_SIZEOF(long, 4) -AC_CHECK_SIZEOF(void*, 4) -AC_CHECK_FUNCS(sched_yield) -AC_CHECK_FUNCS(fdatasync) -AC_CHECK_FUNCS(localtime_r) -#AC_CHECK_FUNCS(readdir_r) MySQL checks that it has also the right args. -# Some versions of Unix only take 2 arguments. -#AC_C_INLINE Already checked in MySQL -AC_C_BIGENDIAN - -# Build optimized or debug version ? -# First check for gcc and g++ -if test "$ac_cv_prog_gcc" = "yes" -then - DEBUG_CFLAGS="-g" - DEBUG_OPTIMIZE_CC="-O" - OPTIMIZE_CFLAGS="$MAX_C_OPTIMIZE" -else - DEBUG_CFLAGS="-g" - DEBUG_OPTIMIZE_CC="" - OPTIMIZE_CFLAGS="-O" -fi -if test "$ac_cv_prog_cxx_g" = "yes" -then - DEBUG_CXXFLAGS="-g" - DEBUG_OPTIMIZE_CXX="-O" - OPTIMIZE_CXXFLAGS="-O3" -else - DEBUG_CXXFLAGS="-g" - DEBUG_OPTIMIZE_CXX="" - OPTIMIZE_CXXFLAGS="-O" -fi -AC_ARG_WITH(debug, - [ --without-debug Build a production version without debugging code], - [with_debug=$withval], - [with_debug=no]) -if test "$with_debug" = "yes" -then - # Medium debug. - CFLAGS="$DEBUG_CFLAGS $DEBUG_OPTIMIZE_CC -DDBUG_ON -DSAFE_MUTEX $CFLAGS" - CXXFLAGS="$DEBUG_CXXFLAGS $DEBUG_OPTIMIZE_CXX -DSAFE_MUTEX $CXXFLAGS" -elif test "$with_debug" = "full" -then - # Full debug. Very slow in some cases - CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS" - CXXFLAGS="$DEBUG_CXXFLAGS -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS" -else - # Optimized version. No debug - CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS -DDEBUG_OFF" - CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS -DDEBUG_OFF" -fi - -# NOTE: The flags below are disabled by default since we can't easily get -# rid of the "string over 509 characters in length" warnings, and thus can't -# add -Werror. But it's a good idea to enable these for a test compile -# before shipping a new snapshot to MySQL to catch errors that could make -# the compile fail on non-C99 compilers. - -# If using gcc, disallow usage of C99 features to avoid accidentally -# introducing problems on compilers that only implement C89. -#if test "$ac_cv_prog_gcc" = "yes" -#then -# CFLAGS="$CFLAGS -std=c89 -ansi -pedantic -Wno-long-long" -#fi - -# If using gcc, add some extra warning flags. -if test "$ac_cv_prog_gcc" = "yes" -then - CFLAGS="$CFLAGS -Werror-implicit-function-declaration -Wpointer-arith" -fi - -case "$target_os" in - lin*) - CFLAGS="$CFLAGS -DUNIV_LINUX";; - hpux10*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";; - hp*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";; - aix*) - CFLAGS="$CFLAGS -DUNIV_AIX";; - irix*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; - osf*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; - sysv5uw7*) - # Problem when linking on SCO - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; - openbsd*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; -esac - -case "$target" in - i[[4567]]86-*-*) - CFLAGS="$CFLAGS -DUNIV_INTEL_X86";; - # The compiler on Linux/S390 does not seem to have inlining - s390-*-*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; -esac - -# must go in pair with AR as set by MYSQL_CHECK_AR -if test -z "$ARFLAGS" -then - ARFLAGS="cru" -fi -AC_SUBST(ARFLAGS) - -AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile dnl - buf/Makefile data/Makefile dnl - dict/Makefile dyn/Makefile dnl - eval/Makefile fil/Makefile fsp/Makefile fut/Makefile dnl - ha/Makefile ibuf/Makefile dnl - lock/Makefile log/Makefile dnl - mach/Makefile mem/Makefile mtr/Makefile dnl - page/Makefile pars/Makefile que/Makefile dnl - read/Makefile rem/Makefile row/Makefile dnl - srv/Makefile sync/Makefile thr/Makefile trx/Makefile dnl - usr/Makefile) diff --git a/handler/ha_innodb.cc b/handler/ha_innodb.cc index 8d5774313e5..0513445b9a8 100644 --- a/handler/ha_innodb.cc +++ b/handler/ha_innodb.cc @@ -42,8 +42,6 @@ have disables the InnoDB inlining in this file. */ #define MAX_ULONG_BIT ((ulong) 1 << (sizeof(ulong)*8-1)) -#ifdef WITH_INNOBASE_STORAGE_ENGINE - #include "ha_innodb.h" pthread_mutex_t innobase_share_mutex, /* to protect innobase_open_files */ @@ -312,7 +310,8 @@ SHOW_VAR innodb_status_variables[]= { (char*) &export_vars.innodb_rows_read, SHOW_LONG}, {"rows_updated", (char*) &export_vars.innodb_rows_updated, SHOW_LONG}, - {NullS, NullS, SHOW_LONG}}; + {NullS, NullS, SHOW_LONG} +}; /* General functions */ @@ -6798,19 +6797,17 @@ ha_innobase::store_lock( row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; trx_t* trx; - /* Call update_thd() to update prebuilt->trx to point to the trx - object of thd! Failure to do this caused a serious memory - corruption bug in 5.1.11. */ + /* Note that trx in this function is NOT necessarily prebuilt->trx + because we call update_thd() later, in ::external_lock()! Failure to + understand this caused a serious memory corruption bug in 5.1.11. */ - update_thd(thd); + trx = check_trx_exists(thd); - trx = prebuilt->trx; - - /* NOTE: MySQL can call this function with lock 'type' TL_IGNORE! + /* NOTE: MySQL can call this function with lock 'type' TL_IGNORE! Be careful to ignore TL_IGNORE if we are going to do something with only 'real' locks! */ - /* If no MySQL tables is use we need to set isolation level + /* If no MySQL table is in use, we need to set the isolation level of the transaction. */ if (lock_type != TL_IGNORE @@ -6820,7 +6817,13 @@ ha_innobase::store_lock( thd->variables.tx_isolation); } - if ((lock_type == TL_READ && thd->in_lock_tables) || + if (thd->lex->sql_command == SQLCOM_DROP_TABLE) { + + /* MySQL calls this function in DROP TABLE though this table + handle may belong to another thd that is running a query. Let + us in that case skip any changes to the prebuilt struct. */ + + } else if ((lock_type == TL_READ && thd->in_lock_tables) || (lock_type == TL_READ_HIGH_PRIORITY && thd->in_lock_tables) || lock_type == TL_READ_WITH_SHARED_LOCKS || lock_type == TL_READ_NO_INSERT || @@ -7078,10 +7081,16 @@ ha_innobase::innobase_read_and_init_auto_inc( 'found_next_number_field' below because MySQL in SHOW TABLE STATUS does not seem to set 'next_number_field'. The comment in table.h says that 'next_number_field' is set when it is - 'active'. */ + 'active'. + Since 5.1 MySQL enforces that we announce fields which we will + read; as we only do a val_*() call, dbug_tmp_use_all_columns() + with read_set is sufficient. */ + my_bitmap_map *old_map; + old_map= dbug_tmp_use_all_columns(table, table->read_set); auto_inc = (longlong) table->found_next_number_field-> val_int_offset(table->s->rec_buff_length) + 1; + dbug_tmp_restore_column_map(table->read_set, old_map); } dict_table_autoinc_initialize(prebuilt->table, auto_inc); @@ -7619,6 +7628,19 @@ bool ha_innobase::check_if_incompatible_data( return COMPATIBLE_DATA_YES; } +static int show_innodb_vars(THD *thd, SHOW_VAR *var, char *buff) +{ + innodb_export_status(); + var->type= SHOW_ARRAY; + var->value= (char *) &innodb_status_variables; + return 0; +} + +SHOW_VAR innodb_status_variables_export[]= { + {"Innodb", (char*) &show_innodb_vars, SHOW_FUNC}, + {NullS, NullS, SHOW_LONG} +}; + struct st_mysql_storage_engine innobase_storage_engine= { MYSQL_HANDLERTON_INTERFACE_VERSION, &innobase_hton}; @@ -7632,9 +7654,7 @@ mysql_declare_plugin(innobase) innobase_init, /* Plugin Init */ NULL, /* Plugin Deinit */ 0x0100 /* 1.0 */, - 0 + innodb_status_variables_export } mysql_declare_plugin_end; -#endif - diff --git a/handler/ha_innodb.h b/handler/ha_innodb.h index ba8560f717f..4d5dc6b52d6 100644 --- a/handler/ha_innodb.h +++ b/handler/ha_innodb.h @@ -227,12 +227,6 @@ extern my_bool innobase_log_archive, innobase_use_native_aio, innobase_file_per_table, innobase_locks_unsafe_for_binlog, innobase_create_status_file; -extern my_bool innobase_very_fast_shutdown; /* set this to 1 just before - calling innobase_end() if - you want InnoDB to shut down - without flushing the buffer - pool: this is equivalent to - a 'crash' */ extern "C" { extern ulong srv_max_buf_pool_modified_pct; extern ulong srv_max_purge_lag; diff --git a/include/Makefile.i b/include/Makefile.i index 87952a7abc8..db436c702ff 100644 --- a/include/Makefile.i +++ b/include/Makefile.i @@ -1,6 +1,10 @@ # Makefile included in Makefile.am in every subdirectory -INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/../../include +INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ + -I$(top_srcdir)/regex \ + -I$(top_srcdir)/storage/innobase/include \ + -I$(top_srcdir)/sql \ + -I$(srcdir) # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/include/row0row.h b/include/row0row.h index fd934b3db18..bf6ac5975a5 100644 --- a/include/row0row.h +++ b/include/row0row.h @@ -71,10 +71,9 @@ dtuple_t* row_build( /*======*/ /* out, own: row built; see the NOTE below! */ - ulint type, /* in: ROW_COPY_POINTERS, ROW_COPY_DATA, or - ROW_COPY_ALSO_EXTERNALS, - the two last copy also the data fields to - heap as the first only places pointers to + ulint type, /* in: ROW_COPY_POINTERS or ROW_COPY_DATA; + the latter copies also the data fields to + heap while the first only places pointers to data fields on the index page, and thus is more efficient */ dict_index_t* index, /* in: clustered index */ @@ -226,7 +225,6 @@ row_search_index_entry( #define ROW_COPY_DATA 1 #define ROW_COPY_POINTERS 2 -#define ROW_COPY_ALSO_EXTERNALS 3 /* The allowed latching order of index records is the following: (1) a secondary index record -> diff --git a/include/univ.i b/include/univ.i index 41aece6bd43..9ee1f582846 100644 --- a/include/univ.i +++ b/include/univ.i @@ -41,7 +41,7 @@ if we are compiling on Windows. */ /* Include the header file generated by GNU autoconf */ #ifndef __WIN__ -#include "../ib_config.h" +#include "config.h" #endif #ifdef HAVE_SCHED_H @@ -98,8 +98,6 @@ memory is read outside the allocated blocks. */ #define UNIV_BTR_DEBUG #define UNIV_LIGHT_MEM_DEBUG -#define YYDEBUG 1 - #ifdef HAVE_purify /* The following sets all new allocated memory to zero before use: this can be used to eliminate unnecessary Purify warnings, but note that diff --git a/plug.in b/plug.in new file mode 100644 index 00000000000..fc1d758fd87 --- /dev/null +++ b/plug.in @@ -0,0 +1,70 @@ +MYSQL_STORAGE_ENGINE(innobase, innodb, [InnoDB Storage Engine], + [Transactional Tables using InnoDB], [max,max-no-ndb]) +MYSQL_PLUGIN_DIRECTORY(innobase, [storage/innobase]) +MYSQL_PLUGIN_STATIC(innobase, [libinnobase.a]) +MYSQL_PLUGIN_ACTIONS(innobase, [ + AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"]) + AC_SUBST(innodb_system_libs) + AC_PROG_CC + AC_PROG_RANLIB + AC_PROG_INSTALL + AC_PROG_LIBTOOL + AC_CHECK_HEADERS(aio.h sched.h) + AC_CHECK_SIZEOF(int, 4) + AC_CHECK_SIZEOF(long, 4) + AC_CHECK_SIZEOF(void*, 4) + AC_CHECK_FUNCS(sched_yield) + AC_CHECK_FUNCS(fdatasync) + AC_CHECK_FUNCS(localtime_r) + AC_C_BIGENDIAN + case "$target_os" in + lin*) + CFLAGS="$CFLAGS -DUNIV_LINUX";; + hpux10*) + CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX -DUNIV_HPUX10";; + hp*) + CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE -DUNIV_HPUX";; + aix*) + CFLAGS="$CFLAGS -DUNIV_AIX";; + irix*) + CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; + osf*) + CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; + sysv5uw7*) + # Problem when linking on SCO + CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; + openbsd*) + CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; + esac + AC_CONFIG_FILES( + storage/innobase/ut/Makefile + storage/innobase/btr/Makefile + storage/innobase/buf/Makefile + storage/innobase/data/Makefile + storage/innobase/dict/Makefile + storage/innobase/dyn/Makefile + storage/innobase/eval/Makefile + storage/innobase/fil/Makefile + storage/innobase/fsp/Makefile + storage/innobase/fut/Makefile + storage/innobase/ha/Makefile + storage/innobase/ibuf/Makefile + storage/innobase/lock/Makefile + storage/innobase/log/Makefile + storage/innobase/mach/Makefile + storage/innobase/mem/Makefile + storage/innobase/mtr/Makefile + storage/innobase/os/Makefile + storage/innobase/page/Makefile + storage/innobase/pars/Makefile + storage/innobase/que/Makefile + storage/innobase/read/Makefile + storage/innobase/rem/Makefile + storage/innobase/row/Makefile + storage/innobase/srv/Makefile + storage/innobase/sync/Makefile + storage/innobase/thr/Makefile + storage/innobase/trx/Makefile + storage/innobase/usr/Makefile) + ]) + diff --git a/row/row0row.c b/row/row0row.c index 39be772654e..b92b757c6e4 100644 --- a/row/row0row.c +++ b/row/row0row.c @@ -130,10 +130,9 @@ dtuple_t* row_build( /*======*/ /* out, own: row built; see the NOTE below! */ - ulint type, /* in: ROW_COPY_POINTERS, ROW_COPY_DATA, or - ROW_COPY_ALSO_EXTERNALS, - the two last copy also the data fields to - heap as the first only places pointers to + ulint type, /* in: ROW_COPY_POINTERS or ROW_COPY_DATA; + the latter copies also the data fields to + heap while the first only places pointers to data fields on the index page, and thus is more efficient */ dict_index_t* index, /* in: clustered index */ @@ -205,15 +204,6 @@ row_build( dict_col_get_no(col)); field = rec_get_nth_field(rec, offsets, i, &len); - if (type == ROW_COPY_ALSO_EXTERNALS - && rec_offs_nth_extern(offsets, i)) { - - field = btr_rec_copy_externally_stored_field - (rec, offsets, - dict_table_zip_size(table), - i, &len, heap); - } - dfield_set_data(dfield, field, len); } } diff --git a/setup.sh b/setup.sh index d95be2bd9e2..57ab3c68c90 100755 --- a/setup.sh +++ b/setup.sh @@ -12,8 +12,8 @@ TARGETDIR=../storage/innobase rm -fr "$TARGETDIR" mkdir "$TARGETDIR" -# copy the build scripts -cp compile-innodb* ../BUILD +# link the build scripts +ln -sf ../innodb/compile-innodb{,-debug} ../BUILD # create the directories for dir in */ @@ -35,7 +35,7 @@ do ln -s ../../../innodb/"$dir"* . cd .. done -for file in configure.in Makefile.am CMakeLists.txt +for file in plug.in Makefile.am CMakeLists.txt do ln -s ../../innodb/"$file" . done diff --git a/srv/srv0srv.c b/srv/srv0srv.c index 17d9946d97a..b781a601039 100644 --- a/srv/srv0srv.c +++ b/srv/srv0srv.c @@ -2587,6 +2587,10 @@ suspend_thread: mutex_exit(&kernel_mutex); + /* DO NOT CHANGE THIS STRING. innobase_start_or_create_for_mysql() + waits for database activity to die down when converting < 4.1.x + databases, and relies on this string being exactly as it is. InnoDB + manual also mentions this string in several places. */ srv_main_thread_op_info = "waiting for server activity"; os_event_wait(event); diff --git a/trx/trx0sys.c b/trx/trx0sys.c index 9d56e7fbd10..d8b5c33d65f 100644 --- a/trx/trx0sys.c +++ b/trx/trx0sys.c @@ -853,6 +853,12 @@ trx_sysf_create( mtr); ut_a(buf_frame_get_page_no(page) == TRX_SYS_PAGE_NO); + /* Reset the doublewrite buffer magic number to zero so that we + know that the doublewrite buffer has not yet been created (this + suppresses a Valgrind warning) */ + + mach_write_to_4(page + TRX_SYS_DOUBLEWRITE + TRX_SYS_DOUBLEWRITE_MAGIC, + 0); #ifdef UNIV_SYNC_DEBUG buf_page_dbg_add_level(page, SYNC_TRX_SYS_HEADER); #endif /* UNIV_SYNC_DEBUG */