diff options
author | Marc Alff <marc.alff@oracle.com> | 2010-11-21 14:32:48 +0100 |
---|---|---|
committer | Marc Alff <marc.alff@oracle.com> | 2010-11-21 14:32:48 +0100 |
commit | 9d9699209d9ca66648db8aff46f6b66a4c1c18de (patch) | |
tree | 6f388bd43f36d4b3086f63dbcf97467ca95c61ff /storage | |
parent | ce89012c8bfdecded7b7e96b7ea0fb91b199155b (diff) | |
parent | 8664de2230300967537d75a9ec51d15c400ca36d (diff) | |
download | mariadb-git-9d9699209d9ca66648db8aff46f6b66a4c1c18de.tar.gz |
local merge
Diffstat (limited to 'storage')
51 files changed, 610 insertions, 1901 deletions
diff --git a/storage/Makefile.am b/storage/Makefile.am deleted file mode 100644 index a188d8967be..00000000000 --- a/storage/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (C) 2005-2006 MySQL AB -# -# 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 - -# Process this file with automake to create Makefile.in - -AUTOMAKE_OPTIONS = foreign - -# These are built from source in the Docs directory -SUBDIRS = @mysql_se_dirs@ -DIST_SUBDIRS = @mysql_se_distdirs@ diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am deleted file mode 100644 index 8b08105cef3..00000000000 --- a/storage/archive/Makefile.am +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright (C) 2005-2006 MySQL AB -# Copyright (C) 2009 SUN Microsystems -# -# 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 - -#called from the top level Makefile - -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -pkgplugindir = $(pkglibdir)/plugin -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ - -I$(top_srcdir)/regex \ - -I$(top_srcdir)/sql \ - -I$(srcdir) @ZLIB_INCLUDES@ -WRAPLIBS= - -LDADD = - -DEFS = @DEFS@ - -noinst_HEADERS = ha_archive.h azlib.h -noinst_PROGRAMS = archive_test archive_reader - -EXTRA_LTLIBRARIES = ha_archive.la -pkgplugin_LTLIBRARIES = @plugin_archive_shared_target@ -ha_archive_la_LDFLAGS = -module -rpath $(pkgplugindir) -ha_archive_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ha_archive_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ha_archive_la_SOURCES = ha_archive.cc azio.c - - -EXTRA_LIBRARIES = libarchive.a -noinst_LIBRARIES = @plugin_archive_static_target@ -libarchive_a_CXXFLAGS = $(AM_CXXFLAGS) -libarchive_a_CFLAGS = $(AM_CFLAGS) -libarchive_a_SOURCES = ha_archive.cc azio.c - - -archive_test_SOURCES = archive_test.c azio.c -archive_test_CFLAGS = $(AM_CFLAGS) -archive_test_LDADD = $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a \ - @ZLIB_LIBS@ -archive_test_LDFLAGS = @NOINST_LDFLAGS@ - -archive_reader_SOURCES = archive_reader.c azio.c -archive_reader_CFLAGS = $(AM_CFLAGS) -archive_reader_LDADD = $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a \ - @ZLIB_LIBS@ -archive_reader_LDFLAGS = @NOINST_LDFLAGS@ - - -EXTRA_DIST = CMakeLists.txt plug.in - -if HAVE_DTRACE_DASH_G -# The object for static and dynamic linking of archive differ -# For static linkage of archive to mysqld - -libarchive_a_LIBADD = probes_mysql.o -libarchive_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers -# For archive as shared library -ha_archive_la_LIBADD = probes_sh_mysql.o -# Hack: We "depend" on ".libs/" but have no rule for it, -# but it is created as a byproduct of the ".lo" -DTRACESHAREDDEPS = ha_archive_la-ha_archive.lo -DTRACESHAREDFILES = ha_archive_la-ha_archive.o -DTRACEPROVIDER = probes_mysql.d -ha_archive_la_DEPENDENCIES = probes_sh_mysql.o $(DTRACESHAREDDEPS) dtrace_providers - -CLEANFILES = $(DTRACEPROVIDER) dtrace_files dtrace_providers $(DTRACESHAREDFILES) -DTRACEFILES = libarchive_a-ha_archive.o - -dtrace_files: - echo $(DTRACEFILES) > $@ -dtrace_providers: probes_mysql.d - echo $(DTRACEPROVIDER) > $@ -probes_mysql.d: - -$(RM) -f probes_mysql.d - $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d - echo timestamp > dtrace_sources - -probes_sh_mysql.o: $(DTRACEPROVIDER) $(DTRACESHAREDDEPS) - $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACESHAREDFILES) -o $@ - $(CP) $(DTRACESHAREDFILES) .libs -probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES) - $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@ - -endif diff --git a/storage/archive/plug.in b/storage/archive/plug.in deleted file mode 100644 index 52131b12e6b..00000000000 --- a/storage/archive/plug.in +++ /dev/null @@ -1,4 +0,0 @@ -MYSQL_STORAGE_ENGINE(archive,, [Archive Storage Engine], - [Archive Storage Engine], [max,max-no-ndb]) -MYSQL_PLUGIN_STATIC(archive, [libarchive.a]) -MYSQL_PLUGIN_DYNAMIC(archive, [ha_archive.la]) diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am deleted file mode 100644 index 38c2f354844..00000000000 --- a/storage/blackhole/Makefile.am +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright (C) 2005-2006 MySQL AB, 2009 Sun Microsystems, Inc. -# 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 - -#called from the top level Makefile - -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -pkgplugindir = $(pkglibdir)/plugin -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ - -I$(top_srcdir)/regex \ - -I$(top_srcdir)/sql \ - -I$(srcdir) -WRAPLIBS= - -LDADD = - -DEFS = @DEFS@ - -noinst_HEADERS = ha_blackhole.h - -EXTRA_LTLIBRARIES = ha_blackhole.la -pkgplugin_LTLIBRARIES = @plugin_blackhole_shared_target@ -ha_blackhole_la_LDFLAGS=-module -rpath $(pkgplugindir) -ha_blackhole_la_CXXFLAGS=$(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ha_blackhole_la_CFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ha_blackhole_la_SOURCES=ha_blackhole.cc - - -EXTRA_LIBRARIES = libblackhole.a -noinst_LIBRARIES = @plugin_blackhole_static_target@ -libblackhole_a_CXXFLAGS=$(AM_CXXFLAGS) -libblackhole_a_CFLAGS = $(AM_CFLAGS) -libblackhole_a_SOURCES= ha_blackhole.cc - - -EXTRA_DIST = CMakeLists.txt plug.in - -if HAVE_DTRACE_DASH_G -# The object for static and dynamic linking of blackhole differ -# For static linkage of blackhole to mysqld - -libblackhole_a_LIBADD = probes_mysql.o -libblackhole_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers -# For blackhole as shared library -ha_blackhole_la_LIBADD = probes_sh_mysql.o -# Hack: We "depend" on ".libs/" but have no rule for it, -# but it is created as a byproduct of the ".lo" -DTRACESHAREDDEPS = ha_blackhole_la-ha_blackhole.lo -DTRACESHAREDFILES = ha_blackhole_la-ha_blackhole.o -DTRACEPROVIDER = probes_mysql.d -ha_blackhole_la_DEPENDENCIES = probes_sh_mysql.o $(DTRACESHAREDDEPS) dtrace_providers - -CLEANFILES = $(DTRACEPROVIDERS) dtrace_files dtrace_providers $(DTRACESHAREDDEPS) -DTRACEFILES = libblackhole_a-ha_blackhole.o - -dtrace_files: - echo $(DTRACEFILES) > $@ -dtrace_providers: probes_mysql.d - echo $(DTRACEPROVIDER) > $@ -probes_mysql.d: - -$(RM) -f probes_mysql.d - $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d - echo timestamp > dtrace_sources - -probes_sh_mysql.o: $(DTRACEPROVIDER) $(DTRACESHAREDDEPS) - $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACESHAREDFILES) -o $@ - $(CP) $(DTRACESHAREDFILES) .libs -probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES) - $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@ - -endif diff --git a/storage/blackhole/plug.in b/storage/blackhole/plug.in deleted file mode 100644 index 725db0facba..00000000000 --- a/storage/blackhole/plug.in +++ /dev/null @@ -1,6 +0,0 @@ -MYSQL_STORAGE_ENGINE(blackhole,,[Blackhole Storage Engine], - [Basic Write-only Read-never tables], [max,max-no-ndb]) -MYSQL_PLUGIN_DIRECTORY(blackhole, [storage/blackhole]) -MYSQL_PLUGIN_STATIC(blackhole, [libblackhole.a]) -MYSQL_PLUGIN_DYNAMIC(blackhole, [ha_blackhole.la]) - diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am deleted file mode 100644 index 5e3587c893f..00000000000 --- a/storage/csv/Makefile.am +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright (C) 2005-2006 MySQL AB -# -# 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 - -#called from the top level Makefile - -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -INCLUDES = -I$(top_builddir)/include \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/regex \ - -I$(top_srcdir)/sql \ - -I$(srcdir) -LDADD = - -DEFS = @DEFS@ -noinst_HEADERS = ha_tina.h transparent_file.h - -EXTRA_LTLIBRARIES = ha_csv.la -pkglib_LTLIBRARIES = @plugin_csv_shared_target@ -ha_csv_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) -ha_csv_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_PLUGIN -ha_csv_la_SOURCES = transparent_file.cc ha_tina.cc - -EXTRA_LIBRARIES = libcsv.a -noinst_LIBRARIES = @plugin_csv_static_target@ -libcsv_a_CXXFLAGS = $(AM_CXXFLAGS) -libcsv_a_SOURCES = transparent_file.cc ha_tina.cc - -EXTRA_DIST = CMakeLists.txt plug.in - -if HAVE_DTRACE_DASH_G -libcsv_a_LIBADD = probes_mysql.o -libcsv_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers -CLEANFILES = probes_mysql.o dtrace_files dtrace_providers -DTRACEFILES = libcsv_a-ha_tina.o -DTRACEPROVIDER = probes_mysql.d -CLEANFILES += $(DTRACEPROVIDER) dtrace_sources - -dtrace_files: - echo $(DTRACEFILES) > $@ -dtrace_providers: probes_mysql.d - echo $(DTRACEPROVIDER) > $@ -probes_mysql.d: - -$(RM) -f probes_mysql.d - $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d - echo timestamp > dtrace_sources - -probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES) - $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@ -endif diff --git a/storage/csv/plug.in b/storage/csv/plug.in deleted file mode 100644 index bbc69680fcd..00000000000 --- a/storage/csv/plug.in +++ /dev/null @@ -1,5 +0,0 @@ -MYSQL_STORAGE_ENGINE(csv,, [CSV Storage Engine], - [Stores tables in text CSV format]) -MYSQL_PLUGIN_DIRECTORY(csv, [storage/csv]) -MYSQL_PLUGIN_STATIC(csv, [libcsv.a]) -MYSQL_PLUGIN_MANDATORY(csv) dnl Used for logging diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am deleted file mode 100644 index c79fbe97cc3..00000000000 --- a/storage/example/Makefile.am +++ /dev/null @@ -1,85 +0,0 @@ -# Copyright (C) 2005-2006 MySQL AB, 2009 Sun Microsystems, Inc. -# 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 - -#called from the top level Makefile - -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -pkgplugindir = $(pkglibdir)/plugin -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ - -I$(top_srcdir)/regex \ - -I$(top_srcdir)/sql \ - -I$(srcdir) -WRAPLIBS= - -LDADD = - -DEFS = @DEFS@ - -noinst_HEADERS = ha_example.h - -EXTRA_LTLIBRARIES = ha_example.la -pkgplugin_LTLIBRARIES = @plugin_example_shared_target@ -ha_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices -ha_example_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ha_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ha_example_la_SOURCES = ha_example.cc - - -EXTRA_LIBRARIES = libexample.a -noinst_LIBRARIES = @plugin_example_static_target@ -libexample_a_CXXFLAGS = $(AM_CXXFLAGS) -libexample_a_CFLAGS = $(AM_CFLAGS) -libexample_a_SOURCES= ha_example.cc - - -EXTRA_DIST = CMakeLists.txt plug.in - -if HAVE_DTRACE_DASH_G -# The object for static and dynamic linking of example differ -# For static linkage of example to mysqld -# That's actually not needed as example is only dynamic loadable, but for completion -libexample_a_LIBADD = probes_mysql.o -libexample_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers -# For example as shared library -ha_example_la_LIBADD = probes_sh_mysql.o -# Hack: We "depend" on ".libs/" but have no rule for it, -# but it is created as a byproduct of the ".lo" -DTRACESHAREDDEPS = ha_example_la-ha_example.lo -DTRACESHAREDFILES = ha_example_la-ha_example.o -DTRACEPROVIDER = probes_mysql.d -ha_example_la_DEPENDENCIES = probes_sh_mysql.o $(DTRACESHAREDDEPS) dtrace_providers - -CLEANFILES = $(DTRACEPROVIDER) dtrace_files dtrace_providers $(DTRACESHAREDFILES) -DTRACEFILES = libexample_a-ha_example.o - -dtrace_files: - echo $(DTRACEFILES) > $@ -dtrace_providers: probes_mysql.d - echo $(DTRACEPROVIDER) > $@ -probes_mysql.d: - -$(RM) -f probes_mysql.d - $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d - echo timestamp > dtrace_sources - -probes_sh_mysql.o: $(DTRACEPROVIDER) $(DTRACESHAREDDEPS) - $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACESHAREDFILES) -o $@ - $(CP) $(DTRACESHAREDFILES) .libs -probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES) - $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@ - -endif diff --git a/storage/example/plug.in b/storage/example/plug.in deleted file mode 100644 index ee6beaac64f..00000000000 --- a/storage/example/plug.in +++ /dev/null @@ -1,3 +0,0 @@ -MYSQL_STORAGE_ENGINE(example,, [Example Storage Engine], - [Example for Storage Engines for developers], [max,max-no-ndb]) -MYSQL_PLUGIN_DYNAMIC(example, [ha_example.la]) diff --git a/storage/federated/Makefile.am b/storage/federated/Makefile.am deleted file mode 100644 index e07b0d95b97..00000000000 --- a/storage/federated/Makefile.am +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright (C) 2005-2006 MySQL AB, 2009 Sun Microsystems, Inc. -# 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 - -#called from the top level Makefile - -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -pkgplugindir = $(pkglibdir)/plugin -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ - -I$(top_srcdir)/regex \ - -I$(top_srcdir)/sql \ - -I$(srcdir) - -WRAPLIBS= - -LDADD = - -DEFS = @DEFS@ - -noinst_HEADERS = ha_federated.h - -EXTRA_LTLIBRARIES = ha_federated.la -pkgplugin_LTLIBRARIES = @plugin_federated_shared_target@ -ha_federated_la_LDFLAGS = -module -rpath $(pkgplugindir) -ha_federated_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ha_federated_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -ha_federated_la_SOURCES = ha_federated.cc - - -EXTRA_LIBRARIES = libfederated.a -noinst_LIBRARIES = @plugin_federated_static_target@ -libfederated_a_CXXFLAGS = $(AM_CXXFLAGS) -libfederated_a_CFLAGS = $(AM_CFLAGS) -libfederated_a_SOURCES= ha_federated.cc - - -EXTRA_DIST = CMakeLists.txt plug.in - -if HAVE_DTRACE_DASH_G -# The object for static and dynamic linking of federated differ -# For static linkage of federated to mysqld - -libfederated_a_LIBADD = probes_mysql.o -libfederated_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers -# For federated as shared library -ha_federated_la_LIBADD = probes_sh_mysql.o -# Hack: We "depend" on ".libs/" but have no rule for it, -# but it is created as a byproduct of the ".lo" -DTRACESHAREDDEPS = ha_federated_la-ha_federated.lo -DTRACESHAREDFILES = ha_federated_la-ha_federated.o -DTRACEPROVIDER = probes_mysql.d -ha_federated_la_DEPENDENCIES = probes_sh_mysql.o $(DTRACESHAREDDEPS) dtrace_providers - -CLEANFILES = $(DTRACEPROVIDER) dtrace_files dtrace_providers $(DTRACESHAREDFILES) -DTRACEFILES = libfederated_a-ha_federated.o - -dtrace_files: - echo $(DTRACEFILES) > $@ -dtrace_providers: probes_mysql.d - echo $(DTRACEPROVIDER) > $@ -probes_mysql.d: - -$(RM) -f probes_mysql.d - $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d - echo timestamp > dtrace_sources - -probes_sh_mysql.o: $(DTRACEPROVIDER) $(DTRACESHAREDDEPS) - $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACESHAREDFILES) -o $@ - $(CP) $(DTRACESHAREDFILES) .libs -probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES) - $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@ - -endif diff --git a/storage/federated/plug.in b/storage/federated/plug.in deleted file mode 100644 index 23b607d699b..00000000000 --- a/storage/federated/plug.in +++ /dev/null @@ -1,5 +0,0 @@ -MYSQL_STORAGE_ENGINE(federated,,[Federated Storage Engine], - [Connects to tables on remote MySQL servers], [max,max-no-ndb]) -MYSQL_PLUGIN_STATIC(federated, [libfederated.a]) -MYSQL_PLUGIN_DYNAMIC(federated, [ha_federated.la]) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(federated, [ha_federated.cc]) diff --git a/storage/heap/Makefile.am b/storage/heap/Makefile.am deleted file mode 100644 index 677b2d60269..00000000000 --- a/storage/heap/Makefile.am +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (C) 2000-2002, 2005-2006 MySQL AB -# -# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ - -I$(top_srcdir)/regex \ - -I$(top_srcdir)/sql \ - -I$(srcdir) -WRAPLIBS= - -LDADD = - -DEFS = @DEFS@ -pkglib_LIBRARIES = libheap.a -noinst_PROGRAMS = hp_test1 hp_test2 -noinst_LIBRARIES = libheap.a -hp_test1_LDFLAGS = @NOINST_LDFLAGS@ -hp_test1_LDADD = libheap.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a -hp_test2_LDFLAGS = @NOINST_LDFLAGS@ -hp_test2_LDADD = libheap.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a -noinst_HEADERS = heapdef.h ha_heap.h -libheap_a_SOURCES = hp_open.c hp_extra.c hp_close.c hp_panic.c hp_info.c \ - hp_rrnd.c hp_scan.c hp_update.c hp_write.c hp_delete.c \ - hp_rsame.c hp_create.c hp_rename.c hp_rfirst.c \ - hp_rnext.c hp_rlast.c hp_rprev.c hp_clear.c \ - hp_rkey.c hp_block.c \ - ha_heap.cc \ - hp_hash.c _check.c _rectest.c hp_static.c - - -EXTRA_DIST = CMakeLists.txt plug.in - -if HAVE_DTRACE_DASH_G -libheap_a_LIBADD = probes_mysql.o -libheap_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers -CLEANFILES = probes_mysql.o dtrace_files dtrace_providers -DTRACEFILES = ha_heap.o -DTRACEPROVIDER = probes_mysql.d -CLEANFILES += $(DTRACEPROVIDER) dtrace_sources - -dtrace_files: - echo $(DTRACEFILES) > $@ -dtrace_providers: probes_mysql.d - echo $(DTRACEPROVIDER) > $@ -probes_mysql.d: - -$(RM) -f probes_mysql.d - $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d - echo timestamp > dtrace_sources - -probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES) - $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@ -endif diff --git a/storage/heap/plug.in b/storage/heap/plug.in deleted file mode 100644 index 50f31c60f2b..00000000000 --- a/storage/heap/plug.in +++ /dev/null @@ -1,7 +0,0 @@ -MYSQL_STORAGE_ENGINE(heap,no, [Memory Storage Engine], - [Volatile memory based tables]) -MYSQL_PLUGIN_DIRECTORY(heap, [storage/heap]) -MYSQL_PLUGIN_STATIC(heap, [libheap.a]) -MYSQL_PLUGIN_MANDATORY(heap) dnl Memory tables -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(heap, [ha_heap.cc]) - diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am deleted file mode 100644 index 8e8e3300d35..00000000000 --- a/storage/innobase/Makefile.am +++ /dev/null @@ -1,336 +0,0 @@ -# Copyright (C) 2001, 2004, 2006 MySQL 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; 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -# Process this file with automake to create Makefile.in - -MYSQLDATAdir= $(localstatedir) -MYSQLSHAREdir= $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -pkgplugindir= $(pkglibdir)/plugin -INCLUDES= -I$(top_srcdir)/include -I$(top_builddir)/include \ - -I$(top_srcdir)/regex \ - -I$(srcdir)/include \ - -I$(top_srcdir)/sql \ - -I$(srcdir) @ZLIB_INCLUDES@ - -DEFS= @DEFS@ - -noinst_HEADERS= \ - handler/ha_innodb.h \ - handler/i_s.h \ - include/btr0btr.h \ - include/btr0btr.ic \ - include/btr0cur.h \ - include/btr0cur.ic \ - include/btr0pcur.h \ - include/btr0pcur.ic \ - include/btr0sea.h \ - include/btr0sea.ic \ - include/btr0types.h \ - include/buf0buddy.h \ - include/buf0buddy.ic \ - include/buf0buf.h \ - include/buf0buf.ic \ - include/buf0flu.h \ - include/buf0flu.ic \ - include/buf0lru.h \ - include/buf0lru.ic \ - include/buf0rea.h \ - include/buf0types.h \ - include/data0data.h \ - include/data0data.ic \ - include/data0type.h \ - include/data0type.ic \ - include/data0types.h \ - include/db0err.h \ - include/dict0boot.h \ - include/dict0boot.ic \ - include/dict0crea.h \ - include/dict0crea.ic \ - include/dict0dict.h \ - include/dict0dict.ic \ - include/dict0load.h \ - include/dict0load.ic \ - include/dict0mem.h \ - include/dict0mem.ic \ - include/dict0types.h \ - include/dyn0dyn.h \ - include/dyn0dyn.ic \ - include/eval0eval.h \ - include/eval0eval.ic \ - include/eval0proc.h \ - include/eval0proc.ic \ - include/fil0fil.h \ - include/fsp0fsp.h \ - include/fsp0fsp.ic \ - include/fsp0types.h \ - include/fut0fut.h \ - include/fut0fut.ic \ - include/fut0lst.h \ - include/fut0lst.ic \ - include/ha0ha.h \ - include/ha0ha.ic \ - include/ha0storage.h \ - include/ha0storage.ic \ - include/ha_prototypes.h \ - include/handler0alter.h \ - include/hash0hash.h \ - include/hash0hash.ic \ - include/ibuf0ibuf.h \ - include/ibuf0ibuf.ic \ - include/ibuf0types.h \ - include/lock0iter.h \ - include/lock0lock.h \ - include/lock0lock.ic \ - include/lock0priv.h \ - include/lock0priv.ic \ - include/lock0types.h \ - include/log0log.h \ - include/log0log.ic \ - include/log0recv.h \ - include/log0recv.ic \ - include/mach0data.h \ - include/mach0data.ic \ - include/mem0dbg.h \ - include/mem0dbg.ic \ - include/mem0mem.h \ - include/mem0mem.ic \ - include/mem0pool.h \ - include/mem0pool.ic \ - include/mtr0log.h \ - include/mtr0log.ic \ - include/mtr0mtr.h \ - include/mtr0mtr.ic \ - include/mtr0types.h \ - include/os0file.h \ - include/os0file.ic \ - include/os0proc.h \ - include/os0proc.ic \ - include/os0sync.h \ - include/os0sync.ic \ - include/os0thread.h \ - include/os0thread.ic \ - include/page0cur.h \ - include/page0cur.ic \ - include/page0page.h \ - include/page0page.ic \ - include/page0types.h \ - include/page0zip.h \ - include/page0zip.ic \ - include/pars0grm.h \ - include/pars0opt.h \ - include/pars0opt.ic \ - include/pars0pars.h \ - include/pars0pars.ic \ - include/pars0sym.h \ - include/pars0sym.ic \ - include/pars0types.h \ - include/que0que.h \ - include/que0que.ic \ - include/que0types.h \ - include/read0read.h \ - include/read0read.ic \ - include/read0types.h \ - include/rem0cmp.h \ - include/rem0cmp.ic \ - include/rem0rec.h \ - include/rem0rec.ic \ - include/rem0types.h \ - include/row0ext.h \ - include/row0ext.ic \ - include/row0ins.h \ - include/row0ins.ic \ - include/row0merge.h \ - include/row0mysql.h \ - include/row0mysql.ic \ - include/row0purge.h \ - include/row0purge.ic \ - include/row0row.h \ - include/row0row.ic \ - include/row0sel.h \ - include/row0sel.ic \ - include/row0types.h \ - include/row0uins.h \ - include/row0uins.ic \ - include/row0umod.h \ - include/row0umod.ic \ - include/row0undo.h \ - include/row0undo.ic \ - include/row0upd.h \ - include/row0upd.ic \ - include/row0vers.h \ - include/row0vers.ic \ - include/srv0srv.h \ - include/srv0srv.ic \ - include/srv0start.h \ - include/sync0arr.h \ - include/sync0arr.ic \ - include/sync0rw.h \ - include/sync0rw.ic \ - include/sync0sync.h \ - include/sync0sync.ic \ - include/sync0types.h \ - include/thr0loc.h \ - include/thr0loc.ic \ - include/trx0i_s.h \ - include/trx0purge.h \ - include/trx0purge.ic \ - include/trx0rec.h \ - include/trx0rec.ic \ - include/trx0roll.h \ - include/trx0roll.ic \ - include/trx0rseg.h \ - include/trx0rseg.ic \ - include/trx0sys.h \ - include/trx0sys.ic \ - include/trx0trx.h \ - include/trx0trx.ic \ - include/trx0types.h \ - include/trx0undo.h \ - include/trx0undo.ic \ - include/trx0xa.h \ - include/univ.i \ - include/usr0sess.h \ - include/usr0sess.ic \ - include/usr0types.h \ - include/ut0byte.h \ - include/ut0byte.ic \ - include/ut0dbg.h \ - include/ut0list.h \ - include/ut0list.ic \ - include/ut0lst.h \ - include/ut0mem.h \ - include/ut0mem.ic \ - include/ut0rbt.h \ - include/ut0rnd.h \ - include/ut0rnd.ic \ - include/ut0sort.h \ - include/ut0ut.h \ - include/ut0ut.ic \ - include/ut0vec.h \ - include/ut0vec.ic \ - include/ut0wqueue.h \ - mem/mem0dbg.c - -EXTRA_LIBRARIES= libinnobase.a -noinst_LIBRARIES= @plugin_innobase_static_target@ -libinnobase_a_SOURCES= \ - btr/btr0btr.c \ - btr/btr0cur.c \ - btr/btr0pcur.c \ - btr/btr0sea.c \ - buf/buf0buddy.c \ - buf/buf0buf.c \ - buf/buf0flu.c \ - buf/buf0lru.c \ - buf/buf0rea.c \ - data/data0data.c \ - data/data0type.c \ - dict/dict0boot.c \ - dict/dict0crea.c \ - dict/dict0dict.c \ - dict/dict0load.c \ - dict/dict0mem.c \ - dyn/dyn0dyn.c \ - eval/eval0eval.c \ - eval/eval0proc.c \ - fil/fil0fil.c \ - fsp/fsp0fsp.c \ - fut/fut0fut.c \ - fut/fut0lst.c \ - ha/ha0ha.c \ - ha/ha0storage.c \ - ha/hash0hash.c \ - handler/ha_innodb.cc \ - handler/handler0alter.cc \ - handler/i_s.cc \ - ibuf/ibuf0ibuf.c \ - lock/lock0iter.c \ - lock/lock0lock.c \ - log/log0log.c \ - log/log0recv.c \ - mach/mach0data.c \ - mem/mem0mem.c \ - mem/mem0pool.c \ - mtr/mtr0log.c \ - mtr/mtr0mtr.c \ - os/os0file.c \ - os/os0proc.c \ - os/os0sync.c \ - os/os0thread.c \ - page/page0cur.c \ - page/page0page.c \ - page/page0zip.c \ - pars/lexyy.c \ - pars/pars0grm.c \ - pars/pars0opt.c \ - pars/pars0pars.c \ - pars/pars0sym.c \ - que/que0que.c \ - read/read0read.c \ - rem/rem0cmp.c \ - rem/rem0rec.c \ - row/row0ext.c \ - row/row0ins.c \ - row/row0merge.c \ - row/row0mysql.c \ - row/row0purge.c \ - row/row0row.c \ - row/row0sel.c \ - row/row0uins.c \ - row/row0umod.c \ - row/row0undo.c \ - row/row0upd.c \ - row/row0vers.c \ - srv/srv0srv.c \ - srv/srv0start.c \ - sync/sync0arr.c \ - sync/sync0rw.c \ - sync/sync0sync.c \ - thr/thr0loc.c \ - trx/trx0i_s.c \ - trx/trx0purge.c \ - trx/trx0rec.c \ - trx/trx0roll.c \ - trx/trx0rseg.c \ - trx/trx0sys.c \ - trx/trx0trx.c \ - trx/trx0undo.c \ - usr/usr0sess.c \ - ut/ut0byte.c \ - ut/ut0dbg.c \ - ut/ut0list.c \ - ut/ut0mem.c \ - ut/ut0rbt.c \ - ut/ut0rnd.c \ - ut/ut0ut.c \ - ut/ut0vec.c \ - ut/ut0wqueue.c - -libinnobase_a_CXXFLAGS= $(AM_CXXFLAGS) -libinnobase_a_CFLAGS= $(AM_CFLAGS) - -EXTRA_LTLIBRARIES= ha_innodb.la -pkgplugin_LTLIBRARIES= @plugin_innobase_shared_target@ - -ha_innodb_la_LDFLAGS= -module -rpath $(pkgplugindir) -ha_innodb_la_CXXFLAGS= $(AM_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS) -ha_innodb_la_CFLAGS= $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) -ha_innodb_la_SOURCES= $(libinnobase_a_SOURCES) - -EXTRA_DIST= CMakeLists.txt plug.in \ - pars/make_bison.sh pars/make_flex.sh \ - pars/pars0grm.y pars/pars0lex.l diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c index 73d27a787f4..50489ae4cc6 100644 --- a/storage/innobase/btr/btr0cur.c +++ b/storage/innobase/btr/btr0cur.c @@ -1071,7 +1071,7 @@ btr_cur_ins_lock_and_undo( not zero, the parameters index and thr should be specified */ btr_cur_t* cursor, /*!< in: cursor on page after which to insert */ - const dtuple_t* entry, /*!< in: entry to insert */ + dtuple_t* entry, /*!< in/out: entry to insert */ que_thr_t* thr, /*!< in: query thread or NULL */ mtr_t* mtr, /*!< in/out: mini-transaction */ ibool* inherit)/*!< out: TRUE if the inserted new record maybe @@ -3248,7 +3248,7 @@ btr_estimate_n_rows_in_range_on_level( performance with this code which is just an estimation. If we read this many pages before reaching slot2->page_no then we estimate the average from the pages scanned so far */ - #define N_PAGES_READ_LIMIT 10 +# define N_PAGES_READ_LIMIT 10 page_no = slot1->page_no; level = slot1->page_level; @@ -3277,6 +3277,7 @@ btr_estimate_n_rows_in_range_on_level( || btr_page_get_level_low(page) != level) { /* The page got reused for something else */ + mtr_commit(&mtr); goto inexact; } @@ -3632,8 +3633,6 @@ btr_estimate_number_of_different_key_vals( also the pages used for external storage of fields (those pages are included in index->stat_n_leaf_pages) */ - dict_index_stat_mutex_enter(index); - for (j = 0; j <= n_cols; j++) { index->stat_n_diff_key_vals[j] = ((n_diff[j] @@ -3663,8 +3662,6 @@ btr_estimate_number_of_different_key_vals( index->stat_n_diff_key_vals[j] += add_on; } - dict_index_stat_mutex_exit(index); - mem_free(n_diff); if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); @@ -4072,7 +4069,7 @@ Stores the fields in big_rec_vec to the tablespace and puts pointers to them in rec. The extern flags in rec will have to be set beforehand. The fields are stored on pages allocated from leaf node file segment of the index tree. -@return DB_SUCCESS or error */ +@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ UNIV_INTERN ulint btr_store_big_rec_extern_fields( diff --git a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea.c index 1a332ea9329..d0344e72703 100644 --- a/storage/innobase/dict/dict0crea.c +++ b/storage/innobase/dict/dict0crea.c @@ -828,7 +828,7 @@ dict_truncate_index_tree( appropriate field in the SYS_INDEXES record: this mini-transaction marks the B-tree totally truncated */ - btr_page_get(space, zip_size, root_page_no, RW_X_LATCH, mtr); + btr_block_get(space, zip_size, root_page_no, RW_X_LATCH, mtr); btr_free_root(space, zip_size, root_page_no, mtr); create: diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index 2512f199875..0d15ad8b716 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -91,9 +91,18 @@ UNIV_INTERN mysql_pfs_key_t dict_foreign_err_mutex_key; /** Identifies generated InnoDB foreign key names */ static char dict_ibfk[] = "_ibfk_"; -/** array of mutexes protecting dict_index_t::stat_n_diff_key_vals[] */ -#define DICT_INDEX_STAT_MUTEX_SIZE 32 -mutex_t dict_index_stat_mutex[DICT_INDEX_STAT_MUTEX_SIZE]; +/** array of rw locks protecting +dict_table_t::stat_initialized +dict_table_t::stat_n_rows (*) +dict_table_t::stat_clustered_index_size +dict_table_t::stat_sum_of_other_index_sizes +dict_table_t::stat_modified_counter (*) +dict_table_t::indexes*::stat_n_diff_key_vals[] +dict_table_t::indexes*::stat_index_size +dict_table_t::indexes*::stat_n_leaf_pages +(*) those are not always protected for performance reasons */ +#define DICT_TABLE_STATS_LATCHES_SIZE 64 +static rw_lock_t dict_table_stats_latches[DICT_TABLE_STATS_LATCHES_SIZE]; /*******************************************************************//** Tries to find column names for the index and sets the col field of the @@ -254,43 +263,65 @@ dict_mutex_exit_for_mysql(void) mutex_exit(&(dict_sys->mutex)); } -/** Get the mutex that protects index->stat_n_diff_key_vals[] */ -#define GET_INDEX_STAT_MUTEX(index) \ - (&dict_index_stat_mutex[ut_fold_ull(index->id) \ - % DICT_INDEX_STAT_MUTEX_SIZE]) +/** Get the latch that protects the stats of a given table */ +#define GET_TABLE_STATS_LATCH(table) \ + (&dict_table_stats_latches[ut_fold_ull(table->id) \ + % DICT_TABLE_STATS_LATCHES_SIZE]) /**********************************************************************//** -Lock the appropriate mutex to protect index->stat_n_diff_key_vals[]. -index->id is used to pick the right mutex and it should not change -before dict_index_stat_mutex_exit() is called on this index. */ +Lock the appropriate latch to protect a given table's statistics. +table->id is used to pick the corresponding latch from a global array of +latches. */ UNIV_INTERN void -dict_index_stat_mutex_enter( -/*========================*/ - const dict_index_t* index) /*!< in: index */ +dict_table_stats_lock( +/*==================*/ + const dict_table_t* table, /*!< in: table */ + ulint latch_mode) /*!< in: RW_S_LATCH or + RW_X_LATCH */ { - ut_ad(index != NULL); - ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); - ut_ad(index->cached); - ut_ad(!index->to_be_dropped); + ut_ad(table != NULL); + ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - mutex_enter(GET_INDEX_STAT_MUTEX(index)); + switch (latch_mode) { + case RW_S_LATCH: + rw_lock_s_lock(GET_TABLE_STATS_LATCH(table)); + break; + case RW_X_LATCH: + rw_lock_x_lock(GET_TABLE_STATS_LATCH(table)); + break; + case RW_NO_LATCH: + /* fall through */ + default: + ut_error; + } } /**********************************************************************//** -Unlock the appropriate mutex that protects index->stat_n_diff_key_vals[]. */ +Unlock the latch that has been locked by dict_table_stats_lock() */ UNIV_INTERN void -dict_index_stat_mutex_exit( -/*=======================*/ - const dict_index_t* index) /*!< in: index */ +dict_table_stats_unlock( +/*====================*/ + const dict_table_t* table, /*!< in: table */ + ulint latch_mode) /*!< in: RW_S_LATCH or + RW_X_LATCH */ { - ut_ad(index != NULL); - ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); - ut_ad(index->cached); - ut_ad(!index->to_be_dropped); + ut_ad(table != NULL); + ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); - mutex_exit(GET_INDEX_STAT_MUTEX(index)); + switch (latch_mode) { + case RW_S_LATCH: + rw_lock_s_unlock(GET_TABLE_STATS_LATCH(table)); + break; + case RW_X_LATCH: + rw_lock_x_unlock(GET_TABLE_STATS_LATCH(table)); + break; + case RW_NO_LATCH: + /* fall through */ + default: + ut_error; + } } /********************************************************************//** @@ -682,9 +713,9 @@ dict_init(void) mutex_create(dict_foreign_err_mutex_key, &dict_foreign_err_mutex, SYNC_ANY_LATCH); - for (i = 0; i < DICT_INDEX_STAT_MUTEX_SIZE; i++) { - mutex_create(PFS_NOT_INSTRUMENTED, - &dict_index_stat_mutex[i], SYNC_INDEX_TREE); + for (i = 0; i < DICT_TABLE_STATS_LATCHES_SIZE; i++) { + rw_lock_create(PFS_NOT_INSTRUMENTED, + &dict_table_stats_latches[i], SYNC_INDEX_TREE); } } @@ -715,12 +746,11 @@ dict_table_get( mutex_exit(&(dict_sys->mutex)); if (table != NULL) { - if (!table->stat_initialized) { - /* If table->ibd_file_missing == TRUE, this will - print an error message and return without doing - anything. */ - dict_update_statistics(table); - } + /* If table->ibd_file_missing == TRUE, this will + print an error message and return without doing + anything. */ + dict_update_statistics(table, TRUE /* only update stats + if they have not been initialized */); } return(table); @@ -3453,7 +3483,7 @@ col_loop1: start_of_latest_foreign); mutex_exit(&dict_foreign_err_mutex); - return(DB_CANNOT_ADD_CONSTRAINT); + return(DB_CHILD_NO_INDEX); } ptr = dict_accept(cs, ptr, "REFERENCES", &success); @@ -3734,7 +3764,7 @@ try_find_index: start_of_latest_foreign); mutex_exit(&dict_foreign_err_mutex); - return(DB_CANNOT_ADD_CONSTRAINT); + return(DB_PARENT_NO_INDEX); } } else { ut_a(trx->check_foreigns == FALSE); @@ -4198,12 +4228,13 @@ Calculates new estimates for table and index statistics. The statistics are used in query optimization. */ UNIV_INTERN void -dict_update_statistics_low( -/*=======================*/ +dict_update_statistics( +/*===================*/ dict_table_t* table, /*!< in/out: table */ - ibool has_dict_mutex __attribute__((unused))) - /*!< in: TRUE if the caller has the - dictionary mutex */ + ibool only_calc_if_missing_stats)/*!< in: only + update/recalc the stats if they have + not been initialized yet, otherwise + do nothing */ { dict_index_t* index; ulint sum_of_index_sizes = 0; @@ -4231,6 +4262,12 @@ dict_update_statistics_low( return; } + dict_table_stats_lock(table, RW_X_LATCH); + + if (only_calc_if_missing_stats && table->stat_initialized) { + dict_table_stats_unlock(table, RW_X_LATCH); + return; + } do { if (UNIV_LIKELY @@ -4276,13 +4313,9 @@ dict_update_statistics_low( index = dict_table_get_first_index(table); - dict_index_stat_mutex_enter(index); - table->stat_n_rows = index->stat_n_diff_key_vals[ dict_index_get_n_unique(index)]; - dict_index_stat_mutex_exit(index); - table->stat_clustered_index_size = index->stat_index_size; table->stat_sum_of_other_index_sizes = sum_of_index_sizes @@ -4291,18 +4324,8 @@ dict_update_statistics_low( table->stat_initialized = TRUE; table->stat_modified_counter = 0; -} -/*********************************************************************//** -Calculates new estimates for table and index statistics. The statistics -are used in query optimization. */ -UNIV_INTERN -void -dict_update_statistics( -/*===================*/ - dict_table_t* table) /*!< in/out: table */ -{ - dict_update_statistics_low(table, FALSE); + dict_table_stats_unlock(table, RW_X_LATCH); } /**********************************************************************//** @@ -4382,7 +4405,9 @@ dict_table_print_low( ut_ad(mutex_own(&(dict_sys->mutex))); - dict_update_statistics_low(table, TRUE); + dict_update_statistics(table, FALSE /* update even if initialized */); + + dict_table_stats_lock(table, RW_S_LATCH); fprintf(stderr, "--------------------------------------\n" @@ -4410,6 +4435,8 @@ dict_table_print_low( index = UT_LIST_GET_NEXT(indexes, index); } + dict_table_stats_unlock(table, RW_S_LATCH); + foreign = UT_LIST_GET_FIRST(table->foreign_list); while (foreign != NULL) { @@ -4458,8 +4485,6 @@ dict_index_print_low( ut_ad(mutex_own(&(dict_sys->mutex))); - dict_index_stat_mutex_enter(index); - if (index->n_user_defined_cols > 0) { n_vals = index->stat_n_diff_key_vals[ index->n_user_defined_cols]; @@ -4467,8 +4492,6 @@ dict_index_print_low( n_vals = index->stat_n_diff_key_vals[1]; } - dict_index_stat_mutex_exit(index); - fprintf(stderr, " INDEX: name %s, id %llu, fields %lu/%lu," " uniq %lu, type %lu\n" @@ -4811,7 +4834,8 @@ void dict_table_replace_index_in_foreign_list( /*=====================================*/ dict_table_t* table, /*!< in/out: table */ - dict_index_t* index) /*!< in: index to be replaced */ + dict_index_t* index, /*!< in: index to be replaced */ + const trx_t* trx) /*!< in: transaction handle */ { dict_foreign_t* foreign; @@ -4822,7 +4846,13 @@ dict_table_replace_index_in_foreign_list( if (foreign->foreign_index == index) { dict_index_t* new_index = dict_foreign_find_equiv_index(foreign); - ut_a(new_index); + + /* There must exist an alternative index if + check_foreigns (FOREIGN_KEY_CHECKS) is on, + since ha_innobase::prepare_drop_index had done + the check before we reach here. */ + + ut_a(new_index || !trx->check_foreigns); foreign->foreign_index = new_index; } @@ -4955,8 +4985,8 @@ dict_close(void) mem_free(dict_sys); dict_sys = NULL; - for (i = 0; i < DICT_INDEX_STAT_MUTEX_SIZE; i++) { - mutex_free(&dict_index_stat_mutex[i]); + for (i = 0; i < DICT_TABLE_STATS_LATCHES_SIZE; i++) { + rw_lock_free(&dict_table_stats_latches[i]); } } #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c index 9c6fa086d58..5b01669af29 100644 --- a/storage/innobase/dict/dict0load.c +++ b/storage/innobase/dict/dict0load.c @@ -346,7 +346,8 @@ dict_process_sys_tables_rec( /* Update statistics if DICT_TABLE_UPDATE_STATS is set */ - dict_update_statistics_low(*table, TRUE); + dict_update_statistics(*table, FALSE /* update even if + initialized */); } return(NULL); diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c index 710f0ac8603..cb4ccc005b5 100644 --- a/storage/innobase/fil/fil0fil.c +++ b/storage/innobase/fil/fil0fil.c @@ -339,14 +339,15 @@ fil_get_space_id_for_table( /*******************************************************************//** Frees a space object from the tablespace memory cache. Closes the files in the chain but does not delete them. There must not be any pending i/o's or -flushes on the files. */ +flushes on the files. +@return TRUE on success */ static ibool fil_space_free( /*===========*/ - /* out: TRUE if success */ - ulint id, /* in: space id */ - ibool own_mutex);/* in: TRUE if own system->mutex */ + ulint id, /* in: space id */ + ibool x_latched); /* in: TRUE if caller has space->latch + in X mode */ /********************************************************************//** Reads data from a space to a buffer. Remember that the possible incomplete blocks at the end of file are ignored: they are not taken into account when @@ -1140,6 +1141,7 @@ try_again: space = fil_space_get_by_name(name); if (UNIV_LIKELY_NULL(space)) { + ibool success; ulint namesake_id; ut_print_timestamp(stderr); @@ -1178,9 +1180,10 @@ try_again: namesake_id = space->id; - mutex_exit(&fil_system->mutex); + success = fil_space_free(namesake_id, FALSE); + ut_a(success); - fil_space_free(namesake_id, FALSE); + mutex_exit(&fil_system->mutex); goto try_again; } @@ -1331,15 +1334,14 @@ fil_space_free( /*===========*/ /* out: TRUE if success */ ulint id, /* in: space id */ - ibool own_mutex) /* in: TRUE if own system->mutex */ + ibool x_latched) /* in: TRUE if caller has space->latch + in X mode */ { fil_space_t* space; fil_space_t* namespace; fil_node_t* fil_node; - if (!own_mutex) { - mutex_enter(&fil_system->mutex); - } + ut_ad(mutex_own(&fil_system->mutex)); space = fil_space_get_by_id(id); @@ -1350,8 +1352,6 @@ fil_space_free( " from the cache but\n" "InnoDB: it is not there.\n", (ulong) id); - mutex_exit(&fil_system->mutex); - return(FALSE); } @@ -1386,8 +1386,8 @@ fil_space_free( ut_a(0 == UT_LIST_GET_LEN(space->chain)); - if (!own_mutex) { - mutex_exit(&fil_system->mutex); + if (x_latched) { + rw_lock_x_unlock(&space->latch); } rw_lock_free(&(space->latch)); @@ -1633,25 +1633,27 @@ fil_close_all_files(void) /*=====================*/ { fil_space_t* space; - fil_node_t* node; mutex_enter(&fil_system->mutex); space = UT_LIST_GET_FIRST(fil_system->space_list); while (space != NULL) { + fil_node_t* node; fil_space_t* prev_space = space; - node = UT_LIST_GET_FIRST(space->chain); + for (node = UT_LIST_GET_FIRST(space->chain); + node != NULL; + node = UT_LIST_GET_NEXT(chain, node)) { - while (node != NULL) { if (node->open) { fil_node_close_file(node, fil_system); } - node = UT_LIST_GET_NEXT(chain, node); } + space = UT_LIST_GET_NEXT(space_list, space); - fil_space_free(prev_space->id, TRUE); + + fil_space_free(prev_space->id, FALSE); } mutex_exit(&fil_system->mutex); @@ -2271,6 +2273,19 @@ try_again: path = mem_strdup(space->name); mutex_exit(&fil_system->mutex); + + /* Important: We rely on the data dictionary mutex to ensure + that a race is not possible here. It should serialize the tablespace + drop/free. We acquire an X latch only to avoid a race condition + when accessing the tablespace instance via: + + fsp_get_available_space_in_free_extents(). + + There our main motivation is to reduce the contention on the + dictionary mutex. */ + + rw_lock_x_lock(&space->latch); + #ifndef UNIV_HOTBACKUP /* Invalidate in the buffer pool all pages belonging to the tablespace. Since we have set space->is_being_deleted = TRUE, readahead @@ -2283,7 +2298,11 @@ try_again: #endif /* printf("Deleting tablespace %s id %lu\n", space->name, id); */ - success = fil_space_free(id, FALSE); + mutex_enter(&fil_system->mutex); + + success = fil_space_free(id, TRUE); + + mutex_exit(&fil_system->mutex); if (success) { success = os_file_delete(path); @@ -2291,6 +2310,8 @@ try_again: if (!success) { success = os_file_delete_if_exists(path); } + } else { + rw_lock_x_unlock(&space->latch); } if (success) { @@ -2318,6 +2339,31 @@ try_again: return(FALSE); } +/*******************************************************************//** +Returns TRUE if a single-table tablespace is being deleted. +@return TRUE if being deleted */ +UNIV_INTERN +ibool +fil_tablespace_is_being_deleted( +/*============================*/ + ulint id) /*!< in: space id */ +{ + fil_space_t* space; + ibool is_being_deleted; + + mutex_enter(&fil_system->mutex); + + space = fil_space_get_by_id(id); + + ut_a(space != NULL); + + is_being_deleted = space->is_being_deleted; + + mutex_exit(&fil_system->mutex); + + return(is_being_deleted); +} + #ifndef UNIV_HOTBACKUP /*******************************************************************//** Discards a single-table tablespace. The tablespace must be cached in the @@ -4788,7 +4834,7 @@ fil_page_get_type( return(mach_read_from_2(page + FIL_PAGE_TYPE)); } -/******************************************************************** +/****************************************************************//** Initializes the tablespace memory cache. */ UNIV_INTERN void diff --git a/storage/innobase/fsp/fsp0fsp.c b/storage/innobase/fsp/fsp0fsp.c index 3efe147b998..ffe2b21b80c 100644 --- a/storage/innobase/fsp/fsp0fsp.c +++ b/storage/innobase/fsp/fsp0fsp.c @@ -3097,13 +3097,63 @@ fsp_get_available_space_in_free_extents( ut_ad(!mutex_own(&kernel_mutex)); + /* The convoluted mutex acquire is to overcome latching order + issues: The problem is that the fil_mutex is at a lower level + than the tablespace latch and the buffer pool mutex. We have to + first prevent any operations on the file system by acquiring the + dictionary mutex. Then acquire the tablespace latch to obey the + latching order and then release the dictionary mutex. That way we + ensure that the tablespace instance can't be freed while we are + examining its contents (see fil_space_free()). + + However, there is one further complication, we release the fil_mutex + when we need to invalidate the the pages in the buffer pool and we + reacquire the fil_mutex when deleting and freeing the tablespace + instance in fil0fil.c. Here we need to account for that situation + too. */ + + mutex_enter(&dict_sys->mutex); + + /* At this stage there is no guarantee that the tablespace even + exists in the cache. */ + + if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) { + + mutex_exit(&dict_sys->mutex); + + return(ULLINT_UNDEFINED); + } + mtr_start(&mtr); latch = fil_space_get_latch(space, &flags); + + /* This should ensure that the tablespace instance can't be freed + by another thread. However, the tablespace pages can still be freed + from the buffer pool. We need to check for that again. */ + zip_size = dict_table_flags_to_zip_size(flags); mtr_x_lock(latch, &mtr); + mutex_exit(&dict_sys->mutex); + + /* At this point it is possible for the tablespace to be deleted and + its pages removed from the buffer pool. We need to check for that + situation. However, the tablespace instance can't be deleted because + our latching above should ensure that. */ + + if (fil_tablespace_is_being_deleted(space)) { + + mtr_commit(&mtr); + + return(ULLINT_UNDEFINED); + } + + /* From here on even if the user has dropped the tablespace, the + pages _must_ still exist in the buffer pool and the tablespace + instance _must_ be in the file system hash table. */ + space_header = fsp_get_space_header(space, zip_size, &mtr); size = mtr_read_ulint(space_header + FSP_SIZE, MLOG_4BYTES, &mtr); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index c955f807a63..b0d620c060d 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -960,6 +960,8 @@ convert_error_code_to_mysql( return(HA_ERR_ROW_IS_REFERENCED); case DB_CANNOT_ADD_CONSTRAINT: + case DB_CHILD_NO_INDEX: + case DB_PARENT_NO_INDEX: return(HA_ERR_CANNOT_ADD_FOREIGN); case DB_CANNOT_DROP_CONSTRAINT: @@ -6494,6 +6496,33 @@ create_clustered_index_when_no_primary( } /*****************************************************************//** +Return a display name for the row format +@return row format name */ + +const char *get_row_format_name( +/*============================*/ +enum row_type row_format) /*!< in: Row Format */ +{ + switch (row_format) { + case ROW_TYPE_COMPACT: + return("COMPACT"); + case ROW_TYPE_COMPRESSED: + return("COMPRESSED"); + case ROW_TYPE_DYNAMIC: + return("DYNAMIC"); + case ROW_TYPE_REDUNDANT: + return("REDUNDANT"); + case ROW_TYPE_DEFAULT: + return("DEFAULT"); + case ROW_TYPE_FIXED: + return("FIXED"); + default: + break; + } + return("NOT USED"); +} + +/*****************************************************************//** Validates the create options. We may build on this function in future. For now, it checks two specifiers: KEY_BLOCK_SIZE and ROW_FORMAT @@ -6508,9 +6537,9 @@ create_options_are_valid( columns and indexes */ HA_CREATE_INFO* create_info) /*!< in: create info. */ { - ibool kbs_specified = FALSE; + ibool kbs_specified = FALSE; ibool ret = TRUE; - + enum row_type row_type = form->s->row_type; ut_ad(thd != NULL); @@ -6519,13 +6548,28 @@ create_options_are_valid( return(TRUE); } + /* Check for a valid Innodb ROW_FORMAT specifier. For example, + ROW_TYPE_FIXED can be sent to Innodb */ + switch (row_type) { + case ROW_TYPE_COMPACT: + case ROW_TYPE_COMPRESSED: + case ROW_TYPE_DYNAMIC: + case ROW_TYPE_REDUNDANT: + case ROW_TYPE_DEFAULT: + break; + default: + push_warning( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: invalid ROW_FORMAT specifier."); + ret = FALSE; + } + ut_ad(form != NULL); ut_ad(create_info != NULL); - /* First check if KEY_BLOCK_SIZE was specified. */ - if (create_info->key_block_size - || (create_info->used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)) { - + /* First check if a non-zero KEY_BLOCK_SIZE was specified. */ + if (create_info->key_block_size) { kbs_specified = TRUE; switch (create_info->key_block_size) { case 1: @@ -6536,13 +6580,12 @@ create_options_are_valid( /* Valid value. */ break; default: - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: invalid" - " KEY_BLOCK_SIZE = %lu." - " Valid values are" - " [1, 2, 4, 8, 16]", - create_info->key_block_size); + push_warning_printf( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: invalid KEY_BLOCK_SIZE = %lu." + " Valid values are [1, 2, 4, 8, 16]", + create_info->key_block_size); ret = FALSE; } } @@ -6550,109 +6593,67 @@ create_options_are_valid( /* If KEY_BLOCK_SIZE was specified, check for its dependencies. */ if (kbs_specified && !srv_file_per_table) { - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: KEY_BLOCK_SIZE" - " requires innodb_file_per_table."); + push_warning( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: KEY_BLOCK_SIZE requires" + " innodb_file_per_table."); ret = FALSE; } if (kbs_specified && srv_file_format < DICT_TF_FORMAT_ZIP) { - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: KEY_BLOCK_SIZE" - " requires innodb_file_format >" - " Antelope."); + push_warning( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: KEY_BLOCK_SIZE requires" + " innodb_file_format > Antelope."); ret = FALSE; } - /* Now check for ROW_FORMAT specifier. */ - if (create_info->used_fields & HA_CREATE_USED_ROW_FORMAT) { - switch (form->s->row_type) { - const char* row_format_name; - case ROW_TYPE_COMPRESSED: - case ROW_TYPE_DYNAMIC: - row_format_name - = form->s->row_type == ROW_TYPE_COMPRESSED - ? "COMPRESSED" - : "DYNAMIC"; - - /* These two ROW_FORMATs require srv_file_per_table - and srv_file_format > Antelope */ - if (!srv_file_per_table) { - push_warning_printf( - thd, - MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: ROW_FORMAT=%s" - " requires innodb_file_per_table.", - row_format_name); - ret = FALSE; - } - - if (srv_file_format < DICT_TF_FORMAT_ZIP) { - push_warning_printf( - thd, - MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: ROW_FORMAT=%s" - " requires innodb_file_format >" - " Antelope.", - row_format_name); - ret = FALSE; - } - - /* Cannot specify KEY_BLOCK_SIZE with - ROW_FORMAT = DYNAMIC. - However, we do allow COMPRESSED to be - specified with KEY_BLOCK_SIZE. */ - if (kbs_specified - && form->s->row_type == ROW_TYPE_DYNAMIC) { - push_warning_printf( - thd, - MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: cannot specify" - " ROW_FORMAT = DYNAMIC with" - " KEY_BLOCK_SIZE."); - ret = FALSE; - } - - break; - - case ROW_TYPE_REDUNDANT: - case ROW_TYPE_COMPACT: - case ROW_TYPE_DEFAULT: - /* Default is COMPACT. */ - row_format_name - = form->s->row_type == ROW_TYPE_REDUNDANT - ? "REDUNDANT" - : "COMPACT"; - - /* Cannot specify KEY_BLOCK_SIZE with these - format specifiers. */ - if (kbs_specified) { - push_warning_printf( - thd, - MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: cannot specify" - " ROW_FORMAT = %s with" - " KEY_BLOCK_SIZE.", - row_format_name); - ret = FALSE; - } - - break; + switch (row_type) { + case ROW_TYPE_COMPRESSED: + case ROW_TYPE_DYNAMIC: + /* These two ROW_FORMATs require srv_file_per_table + and srv_file_format > Antelope */ + if (!srv_file_per_table) { + push_warning_printf( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: ROW_FORMAT=%s requires" + " innodb_file_per_table.", + get_row_format_name(row_type)); + ret = FALSE; + } - default: - push_warning(thd, - MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: invalid ROW_FORMAT specifier."); - ret = FALSE; + if (srv_file_format < DICT_TF_FORMAT_ZIP) { + push_warning_printf( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: ROW_FORMAT=%s requires" + " innodb_file_format > Antelope.", + get_row_format_name(row_type)); + ret = FALSE; + } + default: + break; + } + switch (row_type) { + case ROW_TYPE_REDUNDANT: + case ROW_TYPE_COMPACT: + case ROW_TYPE_DYNAMIC: + /* KEY_BLOCK_SIZE is only allowed with Compressed or Default */ + if (kbs_specified) { + push_warning_printf( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: cannot specify ROW_FORMAT = %s" + " with KEY_BLOCK_SIZE.", + get_row_format_name(row_type)); + ret = FALSE; } + default: + break; } return(ret); @@ -6778,8 +6779,7 @@ ha_innobase::create( goto cleanup; } - if (create_info->key_block_size - || (create_info->used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE)) { + if (create_info->key_block_size) { /* Determine the page_zip.ssize corresponding to the requested page size (key_block_size) in kilobytes. */ @@ -6800,38 +6800,39 @@ ha_innobase::create( } if (!srv_file_per_table) { - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: KEY_BLOCK_SIZE" - " requires innodb_file_per_table."); + push_warning( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: KEY_BLOCK_SIZE requires" + " innodb_file_per_table."); flags = 0; } if (file_format < DICT_TF_FORMAT_ZIP) { - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: KEY_BLOCK_SIZE" - " requires innodb_file_format >" - " Antelope."); + push_warning( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: KEY_BLOCK_SIZE requires" + " innodb_file_format > Antelope."); flags = 0; } if (!flags) { - push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: ignoring" - " KEY_BLOCK_SIZE=%lu.", - create_info->key_block_size); + push_warning_printf( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: ignoring" + " KEY_BLOCK_SIZE=%lu.", + create_info->key_block_size); } } row_type = form->s->row_type; if (flags) { - /* if KEY_BLOCK_SIZE was specified on this statement and - ROW_FORMAT was not, automatically change ROW_FORMAT to COMPRESSED.*/ - if ( (create_info->used_fields & HA_CREATE_USED_KEY_BLOCK_SIZE) - && !(create_info->used_fields & HA_CREATE_USED_ROW_FORMAT)) { + /* if ROW_FORMAT is set to default, + automatically change it to COMPRESSED.*/ + if (row_type == ROW_TYPE_DEFAULT) { row_type = ROW_TYPE_COMPRESSED; } else if (row_type != ROW_TYPE_COMPRESSED) { /* ROW_FORMAT other than COMPRESSED @@ -6841,8 +6842,7 @@ ha_innobase::create( such combinations can be obtained with ALTER TABLE anyway. */ push_warning_printf( - thd, - MYSQL_ERROR::WARN_LEVEL_WARN, + thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_ILLEGAL_HA_CREATE_OPTION, "InnoDB: ignoring KEY_BLOCK_SIZE=%lu" " unless ROW_FORMAT=COMPRESSED.", @@ -6867,33 +6867,24 @@ ha_innobase::create( } switch (row_type) { - const char* row_format_name; case ROW_TYPE_REDUNDANT: break; case ROW_TYPE_COMPRESSED: case ROW_TYPE_DYNAMIC: - row_format_name - = row_type == ROW_TYPE_COMPRESSED - ? "COMPRESSED" - : "DYNAMIC"; - if (!srv_file_per_table) { push_warning_printf( - thd, - MYSQL_ERROR::WARN_LEVEL_WARN, + thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: ROW_FORMAT=%s" - " requires innodb_file_per_table.", - row_format_name); + "InnoDB: ROW_FORMAT=%s requires" + " innodb_file_per_table.", + get_row_format_name(row_type)); } else if (file_format < DICT_TF_FORMAT_ZIP) { push_warning_printf( - thd, - MYSQL_ERROR::WARN_LEVEL_WARN, + thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: ROW_FORMAT=%s" - " requires innodb_file_format >" - " Antelope.", - row_format_name); + "InnoDB: ROW_FORMAT=%s requires" + " innodb_file_format > Antelope.", + get_row_format_name(row_type)); } else { flags |= DICT_TF_COMPACT | (DICT_TF_FORMAT_ZIP @@ -6905,10 +6896,10 @@ ha_innobase::create( case ROW_TYPE_NOT_USED: case ROW_TYPE_FIXED: default: - push_warning(thd, - MYSQL_ERROR::WARN_LEVEL_WARN, - ER_ILLEGAL_HA_CREATE_OPTION, - "InnoDB: assuming ROW_FORMAT=COMPACT."); + push_warning( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_ILLEGAL_HA_CREATE_OPTION, + "InnoDB: assuming ROW_FORMAT=COMPACT."); case ROW_TYPE_DEFAULT: case ROW_TYPE_COMPACT: flags = DICT_TF_COMPACT; @@ -6988,6 +6979,29 @@ ha_innobase::create( trx, stmt, stmt_len, norm_name, create_info->options & HA_LEX_CREATE_TMP_TABLE); + switch (error) { + + case DB_PARENT_NO_INDEX: + push_warning_printf( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + HA_ERR_CANNOT_ADD_FOREIGN, + "Create table '%s' with foreign key constraint" + " failed. There is no index in the referenced" + " table where the referenced columns appear" + " as the first columns.\n", norm_name); + break; + + case DB_CHILD_NO_INDEX: + push_warning_printf( + thd, MYSQL_ERROR::WARN_LEVEL_WARN, + HA_ERR_CANNOT_ADD_FOREIGN, + "Create table '%s' with foreign key constraint" + " failed. There is no index in the referencing" + " table where referencing columns appear" + " as the first columns.\n", norm_name); + break; + } + error = convert_error_code_to_mysql(error, flags, NULL); if (error) { @@ -7534,6 +7548,7 @@ ha_innobase::estimate_rows_upper_bound(void) dict_index_t* index; ulonglong estimate; ulonglong local_data_file_length; + ulint stat_n_leaf_pages; DBUG_ENTER("estimate_rows_upper_bound"); @@ -7553,10 +7568,12 @@ ha_innobase::estimate_rows_upper_bound(void) index = dict_table_get_first_index(prebuilt->table); - ut_a(index->stat_n_leaf_pages > 0); + stat_n_leaf_pages = index->stat_n_leaf_pages; + + ut_a(stat_n_leaf_pages > 0); local_data_file_length = - ((ulonglong) index->stat_n_leaf_pages) * UNIV_PAGE_SIZE; + ((ulonglong) stat_n_leaf_pages) * UNIV_PAGE_SIZE; /* Calculate a minimum length for a clustered index record and from @@ -7752,7 +7769,9 @@ ha_innobase::info_low( prebuilt->trx->op_info = "updating table statistics"; - dict_update_statistics(ib_table); + dict_update_statistics(ib_table, + FALSE /* update even if stats + are initialized */); prebuilt->trx->op_info = "returning various info to MySQL"; } @@ -7771,6 +7790,9 @@ ha_innobase::info_low( } if (flag & HA_STATUS_VARIABLE) { + + dict_table_stats_lock(ib_table, RW_S_LATCH); + n_rows = ib_table->stat_n_rows; /* Because we do not protect stat_n_rows by any mutex in a @@ -7820,6 +7842,8 @@ ha_innobase::info_low( ib_table->stat_sum_of_other_index_sizes) * UNIV_PAGE_SIZE; + dict_table_stats_unlock(ib_table, RW_S_LATCH); + /* Since fsp_get_available_space_in_free_extents() is acquiring latches inside InnoDB, we do not call it if we are asked by MySQL to avoid locking. Another reason to @@ -7836,19 +7860,12 @@ ha_innobase::info_low( innodb_crash_recovery is set to a high value. */ stats.delete_length = 0; } else { - /* lock the data dictionary to avoid races with - ibd_file_missing and tablespace_discarded */ - row_mysql_lock_data_dictionary(prebuilt->trx); + ullint avail_space; - /* ib_table->space must be an existent tablespace */ - if (!ib_table->ibd_file_missing - && !ib_table->tablespace_discarded) { - - stats.delete_length = - fsp_get_available_space_in_free_extents( - ib_table->space) * 1024; - } else { + avail_space = fsp_get_available_space_in_free_extents( + ib_table->space); + if (avail_space == ULLINT_UNDEFINED) { THD* thd; thd = ha_thd(); @@ -7865,9 +7882,9 @@ ha_innobase::info_low( ib_table->name); stats.delete_length = 0; + } else { + stats.delete_length = avail_space * 1024; } - - row_mysql_unlock_data_dictionary(prebuilt->trx); } stats.check_time = 0; @@ -7896,6 +7913,8 @@ ha_innobase::info_low( table->s->keys); } + dict_table_stats_lock(ib_table, RW_S_LATCH); + for (i = 0; i < table->s->keys; i++) { ulong j; /* We could get index quickly through internal @@ -7933,8 +7952,6 @@ ha_innobase::info_low( break; } - dict_index_stat_mutex_enter(index); - if (index->stat_n_diff_key_vals[j + 1] == 0) { rec_per_key = stats.records; @@ -7943,8 +7960,6 @@ ha_innobase::info_low( index->stat_n_diff_key_vals[j + 1]); } - dict_index_stat_mutex_exit(index); - /* Since MySQL seems to favor table scans too much over index searches, we pretend index selectivity is 2 times better than @@ -7961,6 +7976,8 @@ ha_innobase::info_low( (ulong) rec_per_key; } } + + dict_table_stats_unlock(ib_table, RW_S_LATCH); } if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { @@ -8376,7 +8393,7 @@ get_foreign_key_info( /* Referenced (parent) table name */ ptr = dict_remove_db_name(foreign->referenced_table_name); - len = filename_to_tablename(ptr, name_buff, sizeof(name)); + len = filename_to_tablename(ptr, name_buff, sizeof(name_buff)); f_key_info.referenced_table = thd_make_lex_string(thd, 0, name_buff, len, 1); /* Dependent (child) database name */ @@ -8482,7 +8499,7 @@ ha_innobase::get_foreign_key_list( for (foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list); foreign != NULL; - foreign = UT_LIST_GET_NEXT(referenced_list, foreign)) { + foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) { pf_key_info = get_foreign_key_info(thd, foreign); if (pf_key_info) { f_key_list->push_back(pf_key_info); diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 3744d16570c..c0bd3121c9c 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -1016,12 +1016,13 @@ ha_innobase::prepare_drop_index( index->to_be_dropped = TRUE; } - /* If FOREIGN_KEY_CHECK = 1 you may not drop an index defined + /* If FOREIGN_KEY_CHECKS = 1 you may not drop an index defined for a foreign key constraint because InnoDB requires that both - tables contain indexes for the constraint. Note that CREATE - INDEX id ON table does a CREATE INDEX and DROP INDEX, and we - can ignore here foreign keys because a new index for the - foreign key has already been created. + tables contain indexes for the constraint. Such index can + be dropped only if FOREIGN_KEY_CHECKS is set to 0. + Note that CREATE INDEX id ON table does a CREATE INDEX and + DROP INDEX, and we can ignore here foreign keys because a + new index for the foreign key has already been created. We check for the foreign key constraints after marking the candidate indexes for deletion, because when we check for an diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index 3912f315f2a..e213c22937f 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -105,26 +105,35 @@ btr_root_get( Gets a buffer page and declares its latching order level. */ UNIV_INLINE buf_block_t* -btr_block_get( -/*==========*/ - ulint space, /*!< in: space id */ - ulint zip_size, /*!< in: compressed page size in bytes - or 0 for uncompressed pages */ - ulint page_no, /*!< in: page number */ - ulint mode, /*!< in: latch mode */ - mtr_t* mtr); /*!< in: mtr */ -/**************************************************************//** -Gets a buffer page and declares its latching order level. */ -UNIV_INLINE -page_t* -btr_page_get( -/*=========*/ - ulint space, /*!< in: space id */ - ulint zip_size, /*!< in: compressed page size in bytes - or 0 for uncompressed pages */ - ulint page_no, /*!< in: page number */ - ulint mode, /*!< in: latch mode */ - mtr_t* mtr); /*!< in: mtr */ +btr_block_get_func( +/*===============*/ + ulint space, /*!< in: space id */ + ulint zip_size, /*!< in: compressed page size in bytes + or 0 for uncompressed pages */ + ulint page_no, /*!< in: page number */ + ulint mode, /*!< in: latch mode */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ + mtr_t* mtr) /*!< in/out: mtr */ + __attribute__((nonnull)); +/** Gets a buffer page and declares its latching order level. +@param space tablespace identifier +@param zip_size compressed page size in bytes or 0 for uncompressed pages +@param page_no page number +@param mode latch mode +@param mtr mini-transaction handle +@return the block descriptor */ +# define btr_block_get(space,zip_size,page_no,mode,mtr) \ + btr_block_get_func(space,zip_size,page_no,mode,__FILE__,__LINE__,mtr) +/** Gets a buffer page and declares its latching order level. +@param space tablespace identifier +@param zip_size compressed page size in bytes or 0 for uncompressed pages +@param page_no page number +@param mode latch mode +@param mtr mini-transaction handle +@return the uncompressed page frame */ +# define btr_page_get(space,zip_size,page_no,mode,mtr) \ + buf_block_get_frame(btr_block_get(space,zip_size,page_no,mode,mtr)) #endif /* !UNIV_HOTBACKUP */ /**************************************************************//** Gets the index id field of a page. diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic index 6c580a0bd6e..ccf41904fd0 100644 --- a/storage/innobase/include/btr0btr.ic +++ b/storage/innobase/include/btr0btr.ic @@ -39,18 +39,21 @@ Created 6/2/1994 Heikki Tuuri Gets a buffer page and declares its latching order level. */ UNIV_INLINE buf_block_t* -btr_block_get( -/*==========*/ - ulint space, /*!< in: space id */ - ulint zip_size, /*!< in: compressed page size in bytes - or 0 for uncompressed pages */ - ulint page_no, /*!< in: page number */ - ulint mode, /*!< in: latch mode */ - mtr_t* mtr) /*!< in: mtr */ +btr_block_get_func( +/*===============*/ + ulint space, /*!< in: space id */ + ulint zip_size, /*!< in: compressed page size in bytes + or 0 for uncompressed pages */ + ulint page_no, /*!< in: page number */ + ulint mode, /*!< in: latch mode */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ + mtr_t* mtr) /*!< in/out: mtr */ { buf_block_t* block; - block = buf_page_get(space, zip_size, page_no, mode, mtr); + block = buf_page_get_gen(space, zip_size, page_no, mode, + NULL, BUF_GET, file, line, mtr); if (mode != RW_NO_LATCH) { @@ -61,23 +64,6 @@ btr_block_get( } /**************************************************************//** -Gets a buffer page and declares its latching order level. */ -UNIV_INLINE -page_t* -btr_page_get( -/*=========*/ - ulint space, /*!< in: space id */ - ulint zip_size, /*!< in: compressed page size in bytes - or 0 for uncompressed pages */ - ulint page_no, /*!< in: page number */ - ulint mode, /*!< in: latch mode */ - mtr_t* mtr) /*!< in: mtr */ -{ - return(buf_block_get_frame(btr_block_get(space, zip_size, page_no, - mode, mtr))); -} - -/**************************************************************//** Sets the index id field of a page. */ UNIV_INLINE void diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 5e29d4a1453..9865ebfbfc2 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -508,7 +508,7 @@ Stores the fields in big_rec_vec to the tablespace and puts pointers to them in rec. The extern flags in rec will have to be set beforehand. The fields are stored on pages allocated from leaf node file segment of the index tree. -@return DB_SUCCESS or error */ +@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ UNIV_INTERN ulint btr_store_big_rec_extern_fields( diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h index 01bb1b80754..8a71fa6511a 100644 --- a/storage/innobase/include/db0err.h +++ b/storage/innobase/include/db0err.h @@ -104,6 +104,12 @@ enum db_err { DB_FOREIGN_EXCEED_MAX_CASCADE, /* Foreign key constraint related cascading delete/update exceeds maximum allowed depth */ + DB_CHILD_NO_INDEX, /* the child (foreign) table does not + have an index that contains the + foreign keys as its prefix columns */ + DB_PARENT_NO_INDEX, /* the parent table does not + have an index that contains the + foreign keys as its prefix columns */ /* The following are partial failure codes */ DB_FAIL = 1000, diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 029cf408141..033c435bf16 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -345,7 +345,8 @@ void dict_table_replace_index_in_foreign_list( /*=====================================*/ dict_table_t* table, /*!< in/out: table */ - dict_index_t* index); /*!< in: index to be replaced */ + dict_index_t* index, /*!< in: index to be replaced */ + const trx_t* trx); /*!< in: transaction handle */ /*********************************************************************//** Checks if a index is defined for a foreign key constraint. Index is a part of a foreign key constraint if the index is referenced by foreign key @@ -1080,19 +1081,13 @@ Calculates new estimates for table and index statistics. The statistics are used in query optimization. */ UNIV_INTERN void -dict_update_statistics_low( -/*=======================*/ - dict_table_t* table, /*!< in/out: table */ - ibool has_dict_mutex);/*!< in: TRUE if the caller has the - dictionary mutex */ -/*********************************************************************//** -Calculates new estimates for table and index statistics. The statistics -are used in query optimization. */ -UNIV_INTERN -void dict_update_statistics( /*===================*/ - dict_table_t* table); /*!< in/out: table */ + dict_table_t* table, /*!< in/out: table */ + ibool only_calc_if_missing_stats);/*!< in: only + update/recalc the stats if they have + not been initialized yet, otherwise + do nothing */ /********************************************************************//** Reserves the dictionary system mutex for MySQL. */ UNIV_INTERN @@ -1106,21 +1101,25 @@ void dict_mutex_exit_for_mysql(void); /*===========================*/ /**********************************************************************//** -Lock the appropriate mutex to protect index->stat_n_diff_key_vals[]. -index->id is used to pick the right mutex and it should not change -before dict_index_stat_mutex_exit() is called on this index. */ +Lock the appropriate latch to protect a given table's statistics. +table->id is used to pick the corresponding latch from a global array of +latches. */ UNIV_INTERN void -dict_index_stat_mutex_enter( -/*========================*/ - const dict_index_t* index); /*!< in: index */ +dict_table_stats_lock( +/*==================*/ + const dict_table_t* table, /*!< in: table */ + ulint latch_mode); /*!< in: RW_S_LATCH or + RW_X_LATCH */ /**********************************************************************//** -Unlock the appropriate mutex that protects index->stat_n_diff_key_vals[]. */ +Unlock the latch that has been locked by dict_table_stats_lock() */ UNIV_INTERN void -dict_index_stat_mutex_exit( -/*=======================*/ - const dict_index_t* index); /*!< in: index */ +dict_table_stats_unlock( +/*====================*/ + const dict_table_t* table, /*!< in: table */ + ulint latch_mode); /*!< in: RW_S_LATCH or + RW_X_LATCH */ /********************************************************************//** Checks if the database name in two table names is the same. @return TRUE if same db name */ diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index d7d98787bcf..3a6336f1a01 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -717,6 +717,14 @@ fil_page_get_type( /*==============*/ const byte* page); /*!< in: file page */ +/*******************************************************************//** +Returns TRUE if a single-table tablespace is being deleted. +@return TRUE if being deleted */ +UNIV_INTERN +ibool +fil_tablespace_is_being_deleted( +/*============================*/ + ulint id); /*!< in: space id */ typedef struct fil_space_struct fil_space_t; diff --git a/storage/innobase/include/row0ins.h b/storage/innobase/include/row0ins.h index 9f93565ddb7..810973e61a7 100644 --- a/storage/innobase/include/row0ins.h +++ b/storage/innobase/include/row0ins.h @@ -84,9 +84,10 @@ ulint row_ins_index_entry( /*================*/ dict_index_t* index, /*!< in: index */ - dtuple_t* entry, /*!< in: index entry to insert */ + dtuple_t* entry, /*!< in/out: index entry to insert */ ulint n_ext, /*!< in: number of externally stored columns */ - ibool foreign,/*!< in: TRUE=check foreign key constraints */ + ibool foreign,/*!< in: TRUE=check foreign key constraints + (foreign=FALSE only during CREATE INDEX) */ que_thr_t* thr); /*!< in: query thread */ /***********************************************************//** Inserts a row to a table. This is a high-level function used in diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h index e7b3f6559e3..051beb09277 100644 --- a/storage/innobase/include/row0upd.h +++ b/storage/innobase/include/row0upd.h @@ -126,8 +126,8 @@ UNIV_INTERN void row_upd_index_entry_sys_field( /*==========================*/ - const dtuple_t* entry, /*!< in: index entry, where the memory buffers - for sys fields are already allocated: + dtuple_t* entry, /*!< in/out: index entry, where the memory + buffers for sys fields are already allocated: the function just copies the new values to them */ dict_index_t* index, /*!< in: clustered index */ diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 1e8e60fea52..9cf823c2ff3 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -46,7 +46,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 1 #define INNODB_VERSION_MINOR 1 -#define INNODB_VERSION_BUGFIX 3 +#define INNODB_VERSION_BUGFIX 4 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; @@ -374,6 +374,9 @@ typedef unsigned long long int ullint; /** The generic InnoDB system object identifier data type */ typedef ib_uint64_t ib_id_t; +/* The 'undefined' value for a ullint */ +#define ULLINT_UNDEFINED ((ullint)(-1)) + /* This 'ibool' type is used within Innobase. Remember that different included headers may define 'bool' differently. Do not assume that 'bool' is a ulint! */ #define ibool ulint diff --git a/storage/innobase/plug.in b/storage/innobase/plug.in deleted file mode 100644 index 5fa82e585a4..00000000000 --- a/storage/innobase/plug.in +++ /dev/null @@ -1,234 +0,0 @@ -# -# Copyright (c) 2006, 2010, Innobase Oy. 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., 59 Temple -# Place, Suite 330, Boston, MA 02111-1307 USA -# - -MYSQL_STORAGE_ENGINE(innobase, innodb, [InnoDB Storage Engine], - [Transactional Tables using InnoDB], [default,max,max-no-ndb]) -MYSQL_PLUGIN_DIRECTORY(innobase, [storage/innobase]) -MYSQL_PLUGIN_STATIC(innobase, [libinnobase.a]) -MYSQL_PLUGIN_DYNAMIC(innobase, [ha_innodb.la]) -MYSQL_PLUGIN_ACTIONS(innobase, [ - AC_CHECK_HEADERS(sched.h) - AC_CHECK_SIZEOF(int, 4) - AC_CHECK_SIZEOF(long, 4) - AC_CHECK_SIZEOF(void*, 4) - AC_CHECK_FUNCS(sched_yield fdatasync localtime_r) - AC_C_BIGENDIAN - case "$target_os" in - lin*) - AC_CHECK_HEADER(libaio.h, - AC_CHECK_LIB(aio, io_setup, - LIBS="$LIBS -laio" - AC_DEFINE(LINUX_NATIVE_AIO, [1], - [Linux native async I/O support]), - AC_MSG_WARN([No Linux native async I/O])), - AC_MSG_WARN([No Linux native async I/O])) - - 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*|osf*|sysv5uw7*|openbsd*) - CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";; - *solaris*|*SunOS*) - CFLAGS="$CFLAGS -DUNIV_SOLARIS";; - esac - - INNODB_DYNAMIC_CFLAGS="-DMYSQL_DYNAMIC_PLUGIN" - - case "$target_cpu" in - x86_64) - # The AMD64 ABI forbids absolute addresses in shared libraries - ;; - *86) - # Use absolute addresses on IA-32 - INNODB_DYNAMIC_CFLAGS="$INNODB_DYNAMIC_CFLAGS -prefer-non-pic" - ;; - esac - AC_SUBST(INNODB_DYNAMIC_CFLAGS) - - AC_MSG_CHECKING(whether GCC atomic builtins are available) - # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not - AC_TRY_RUN( - [ - int main() - { - long x; - long y; - long res; - char c; - - x = 10; - y = 123; - res = __sync_bool_compare_and_swap(&x, x, y); - if (!res || x != y) { - return(1); - } - - x = 10; - y = 123; - res = __sync_bool_compare_and_swap(&x, x + 1, y); - if (res || x != 10) { - return(1); - } - - x = 10; - y = 123; - res = __sync_add_and_fetch(&x, y); - if (res != 123 + 10 || x != 123 + 10) { - return(1); - } - - c = 10; - res = __sync_lock_test_and_set(&c, 123); - if (res != 10 || c != 123) { - return(1); - } - - return(0); - } - ], - [ - AC_DEFINE([HAVE_IB_GCC_ATOMIC_BUILTINS], [1], - [GCC atomic builtins are available]) - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_RESULT(no) - ] - ) - - AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins) - # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not - AC_TRY_RUN( - [ - #include <pthread.h> - #include <string.h> - - int main(int argc, char** argv) { - pthread_t x1; - pthread_t x2; - pthread_t x3; - - memset(&x1, 0x0, sizeof(x1)); - memset(&x2, 0x0, sizeof(x2)); - memset(&x3, 0x0, sizeof(x3)); - - __sync_bool_compare_and_swap(&x1, x2, x3); - - return(0); - } - ], - [ - AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1], - [pthread_t can be used by GCC atomic builtins]) - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_RESULT(no) - ] - ) - - AC_MSG_CHECKING(whether Solaris libc atomic functions are available) - # either define HAVE_IB_SOLARIS_ATOMICS or not - AC_CHECK_FUNCS(atomic_cas_ulong \ - atomic_cas_32 \ - atomic_cas_64 \ - atomic_add_long_nv \ - atomic_swap_uchar, - - AC_DEFINE([HAVE_IB_SOLARIS_ATOMICS], [1], - [Define to 1 if Solaris libc atomic functions \ - are available]) - ) - - AC_MSG_CHECKING(whether pthread_t can be used by Solaris libc atomic functions) - # either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not - AC_TRY_RUN( - [ - #include <pthread.h> - #include <string.h> - - int main(int argc, char** argv) { - pthread_t x1; - pthread_t x2; - pthread_t x3; - - memset(&x1, 0x0, sizeof(x1)); - memset(&x2, 0x0, sizeof(x2)); - memset(&x3, 0x0, sizeof(x3)); - - if (sizeof(pthread_t) == 4) { - - atomic_cas_32(&x1, x2, x3); - - } else if (sizeof(pthread_t) == 8) { - - atomic_cas_64(&x1, x2, x3); - - } else { - - return(1); - } - - return(0); - } - ], - [ - AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS], [1], - [pthread_t can be used by solaris atomics]) - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_RESULT(no) - ] - ) - - # this is needed to know which one of atomic_cas_32() or atomic_cas_64() - # to use in the source - AC_CHECK_SIZEOF([pthread_t], [], [#include <pthread.h>]) - - # Check for x86 PAUSE instruction - AC_MSG_CHECKING(for x86 PAUSE instruction) - # We have to actually try running the test program, because of a bug - # in Solaris on x86_64, where it wrongly reports that PAUSE is not - # supported when trying to run an application. See - # http://bugs.opensolaris.org/bugdatabase/printableBug.do?bug_id=6478684 - # We use ib_ prefix to avoid collisoins if this code is added to - # mysql's configure.in. - AC_TRY_RUN( - [ - int main() { - __asm__ __volatile__ ("pause"); - return(0); - } - ], - [ - AC_DEFINE([HAVE_IB_PAUSE_INSTRUCTION], [1], [Does x86 PAUSE instruction exist]) - AC_MSG_RESULT(yes) - ], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(no) - ] - ) - ]) - -# vim: set ft=config: diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c index 8fd8c4f8532..09ae80adff4 100644 --- a/storage/innobase/row/row0ins.c +++ b/storage/innobase/row/row0ins.c @@ -1768,7 +1768,7 @@ ulint row_ins_duplicate_error_in_clust( /*=============================*/ btr_cur_t* cursor, /*!< in: B-tree cursor */ - dtuple_t* entry, /*!< in: entry to insert */ + const dtuple_t* entry, /*!< in: entry to insert */ que_thr_t* thr, /*!< in: query thread */ mtr_t* mtr) /*!< in: mtr */ { @@ -1964,7 +1964,7 @@ row_ins_index_entry_low( depending on whether we wish optimistic or pessimistic descent down the index tree */ dict_index_t* index, /*!< in: index */ - dtuple_t* entry, /*!< in: index entry to insert */ + dtuple_t* entry, /*!< in/out: index entry to insert */ ulint n_ext, /*!< in: number of externally stored columns */ que_thr_t* thr) /*!< in: query thread */ { @@ -2150,9 +2150,10 @@ ulint row_ins_index_entry( /*================*/ dict_index_t* index, /*!< in: index */ - dtuple_t* entry, /*!< in: index entry to insert */ + dtuple_t* entry, /*!< in/out: index entry to insert */ ulint n_ext, /*!< in: number of externally stored columns */ - ibool foreign,/*!< in: TRUE=check foreign key constraints */ + ibool foreign,/*!< in: TRUE=check foreign key constraints + (foreign=FALSE only during CREATE INDEX) */ que_thr_t* thr) /*!< in: query thread */ { ulint err; diff --git a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c index 1b96ff50e66..0c68d6477a4 100644 --- a/storage/innobase/row/row0merge.c +++ b/storage/innobase/row/row0merge.c @@ -2042,7 +2042,7 @@ row_merge_drop_index( /* Replace this index with another equivalent index for all foreign key constraints on this table where this index is used */ - dict_table_replace_index_in_foreign_list(table, index); + dict_table_replace_index_in_foreign_list(table, index, trx); dict_index_remove_from_cache(table, index); trx->op_info = ""; diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index bd9143125f8..709750fc4e7 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -930,7 +930,8 @@ row_update_statistics_if_needed( if (counter > 2000000000 || ((ib_int64_t)counter > 16 + table->stat_n_rows / 16)) { - dict_update_statistics(table); + dict_update_statistics(table, FALSE /* update even if stats + are initialized */); } } @@ -3020,7 +3021,8 @@ next_rec: dict_table_autoinc_lock(table); dict_table_autoinc_initialize(table, 1); dict_table_autoinc_unlock(table); - dict_update_statistics(table); + dict_update_statistics(table, FALSE /* update even if stats are + initialized */); trx_commit_for_mysql(trx); diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 491db8849e3..14deff2d465 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -104,6 +104,18 @@ row_sel_sec_rec_is_for_blob( ulint len; byte buf[DICT_MAX_INDEX_COL_LEN]; + ut_a(clust_len >= BTR_EXTERN_FIELD_REF_SIZE); + + if (UNIV_UNLIKELY + (!memcmp(clust_field + clust_len - BTR_EXTERN_FIELD_REF_SIZE, + field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE))) { + /* The externally stored field was not written yet. + This record should only be seen by + recv_recovery_rollback_active() or any + TRX_ISO_READ_UNCOMMITTED transactions. */ + return(FALSE); + } + len = btr_copy_externally_stored_field_prefix(buf, sizeof buf, zip_size, clust_field, clust_len); diff --git a/storage/innobase/row/row0upd.c b/storage/innobase/row/row0upd.c index a564a2367c5..81750938f58 100644 --- a/storage/innobase/row/row0upd.c +++ b/storage/innobase/row/row0upd.c @@ -371,8 +371,8 @@ UNIV_INTERN void row_upd_index_entry_sys_field( /*==========================*/ - const dtuple_t* entry, /*!< in: index entry, where the memory buffers - for sys fields are already allocated: + dtuple_t* entry, /*!< in/out: index entry, where the memory + buffers for sys fields are already allocated: the function just copies the new values to them */ dict_index_t* index, /*!< in: clustered index */ @@ -1615,12 +1615,12 @@ static ulint row_upd_clust_rec_by_insert( /*========================*/ - upd_node_t* node, /*!< in: row update node */ + upd_node_t* node, /*!< in/out: row update node */ dict_index_t* index, /*!< in: clustered index of the record */ que_thr_t* thr, /*!< in: query thread */ ibool referenced,/*!< in: TRUE if index may be referenced in a foreign key constraint */ - mtr_t* mtr) /*!< in: mtr; gets committed here */ + mtr_t* mtr) /*!< in/out: mtr; gets committed here */ { mem_heap_t* heap = NULL; btr_pcur_t* pcur; diff --git a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c index 4dbaaa97bd9..783cff3bf82 100644 --- a/storage/innobase/sync/sync0rw.c +++ b/storage/innobase/sync/sync0rw.c @@ -1002,7 +1002,7 @@ rw_lock_debug_print( rwt = info->lock_type; - fprintf(stderr, "Locked: thread %ld file %s line %ld ", + fprintf(stderr, "Locked: thread %lu file %s line %lu ", (ulong) os_thread_pf(info->thread_id), info->file_name, (ulong) info->line); if (rwt == RW_LOCK_SHARED) { diff --git a/storage/innobase/thr/thr0loc.c b/storage/innobase/thr/thr0loc.c index 045ff3e9fb1..2bd3e4b1c43 100644 --- a/storage/innobase/thr/thr0loc.c +++ b/storage/innobase/thr/thr0loc.c @@ -76,6 +76,24 @@ struct thr_local_struct{ /** The value of thr_local_struct::magic_n */ #define THR_LOCAL_MAGIC_N 1231234 +#ifdef UNIV_DEBUG +/*******************************************************************//** +Validates thread local data. +@return TRUE if valid */ +static +ibool +thr_local_validate( +/*===============*/ + const thr_local_t* local) /*!< in: data to validate */ +{ + ut_ad(local->magic_n == THR_LOCAL_MAGIC_N); + ut_ad(local->slot_no == ULINT_UNDEFINED + || local->slot_no < OS_THREAD_MAX_N); + ut_ad(local->in_ibuf == FALSE || local->in_ibuf == TRUE); + return(TRUE); +} +#endif /* UNIV_DEBUG */ + /*******************************************************************//** Returns the local storage struct for a thread. @return local storage */ @@ -96,7 +114,8 @@ try_again: local = NULL; HASH_SEARCH(hash, thr_local_hash, os_thread_pf(id), - thr_local_t*, local,, os_thread_eq(local->id, id)); + thr_local_t*, local, ut_ad(thr_local_validate(local)), + os_thread_eq(local->id, id)); if (local == NULL) { mutex_exit(&thr_local_mutex); @@ -107,7 +126,7 @@ try_again: goto try_again; } - ut_ad(local->magic_n == THR_LOCAL_MAGIC_N); + ut_ad(thr_local_validate(local)); return(local); } @@ -193,7 +212,7 @@ thr_local_create(void) local->id = os_thread_get_curr_id(); local->handle = os_thread_get_curr(); local->magic_n = THR_LOCAL_MAGIC_N; - + local->slot_no = ULINT_UNDEFINED; local->in_ibuf = FALSE; mutex_enter(&thr_local_mutex); @@ -220,7 +239,8 @@ thr_local_free( /* Look for the local struct in the hash table */ HASH_SEARCH(hash, thr_local_hash, os_thread_pf(id), - thr_local_t*, local,, os_thread_eq(local->id, id)); + thr_local_t*, local, ut_ad(thr_local_validate(local)), + os_thread_eq(local->id, id)); if (local == NULL) { mutex_exit(&thr_local_mutex); @@ -233,6 +253,7 @@ thr_local_free( mutex_exit(&thr_local_mutex); ut_a(local->magic_n == THR_LOCAL_MAGIC_N); + ut_ad(thr_local_validate(local)); mem_free(local); } @@ -276,6 +297,7 @@ thr_local_close(void) local = HASH_GET_NEXT(hash, prev_local); ut_a(prev_local->magic_n == THR_LOCAL_MAGIC_N); + ut_ad(thr_local_validate(prev_local)); mem_free(prev_local); } } diff --git a/storage/innobase/trx/trx0i_s.c b/storage/innobase/trx/trx0i_s.c index ab10135c6c4..8b11e706180 100644 --- a/storage/innobase/trx/trx0i_s.c +++ b/storage/innobase/trx/trx0i_s.c @@ -415,6 +415,42 @@ table_cache_create_empty_row( return(row); } +#ifdef UNIV_DEBUG +/*******************************************************************//** +Validates a row in the locks cache. +@return TRUE if valid */ +static +ibool +i_s_locks_row_validate( +/*===================*/ + const i_s_locks_row_t* row) /*!< in: row to validate */ +{ + ut_ad(row->lock_trx_id != 0); + ut_ad(row->lock_mode != NULL); + ut_ad(row->lock_type != NULL); + ut_ad(row->lock_table != NULL); + ut_ad(row->lock_table_id != 0); + + if (row->lock_space == ULINT_UNDEFINED) { + /* table lock */ + ut_ad(!strcmp("TABLE", row->lock_type)); + ut_ad(row->lock_index == NULL); + ut_ad(row->lock_data == NULL); + ut_ad(row->lock_page == ULINT_UNDEFINED); + ut_ad(row->lock_rec == ULINT_UNDEFINED); + } else { + /* record lock */ + ut_ad(!strcmp("RECORD", row->lock_type)); + ut_ad(row->lock_index != NULL); + ut_ad(row->lock_data != NULL); + ut_ad(row->lock_page != ULINT_UNDEFINED); + ut_ad(row->lock_rec != ULINT_UNDEFINED); + } + + return(TRUE); +} +#endif /* UNIV_DEBUG */ + /*******************************************************************//** Fills i_s_trx_row_t object. If memory can not be allocated then FALSE is returned. @@ -445,18 +481,15 @@ fill_trx_row( row->trx_id = trx->id; row->trx_started = (ib_time_t) trx->start_time; row->trx_state = trx_get_que_state_str(trx); + row->requested_lock_row = requested_lock_row; + ut_ad(requested_lock_row == NULL + || i_s_locks_row_validate(requested_lock_row)); if (trx->wait_lock != NULL) { - ut_a(requested_lock_row != NULL); - - row->requested_lock_row = requested_lock_row; row->trx_wait_started = (ib_time_t) trx->wait_started; } else { - ut_a(requested_lock_row == NULL); - - row->requested_lock_row = NULL; row->trx_wait_started = 0; } @@ -812,6 +845,7 @@ fill_locks_row( row->lock_table_id = lock_get_table_id(lock); row->hash_chain.value = row; + ut_ad(i_s_locks_row_validate(row)); return(TRUE); } @@ -832,6 +866,9 @@ fill_lock_waits_row( relevant blocking lock row in innodb_locks */ { + ut_ad(i_s_locks_row_validate(requested_lock_row)); + ut_ad(i_s_locks_row_validate(blocking_lock_row)); + row->requested_lock_row = requested_lock_row; row->blocking_lock_row = blocking_lock_row; @@ -903,6 +940,7 @@ locks_row_eq_lock( or ULINT_UNDEFINED if the lock is a table lock */ { + ut_ad(i_s_locks_row_validate(row)); #ifdef TEST_NO_LOCKS_ROW_IS_EVER_EQUAL_TO_LOCK_T return(0); #else @@ -960,7 +998,7 @@ search_innodb_locks( /* auxiliary variable */ hash_chain, /* assertion on every traversed item */ - , + ut_ad(i_s_locks_row_validate(hash_chain->value)), /* this determines if we have found the lock */ locks_row_eq_lock(hash_chain->value, lock, heap_no)); @@ -1000,6 +1038,7 @@ add_lock_to_cache( dst_row = search_innodb_locks(cache, lock, heap_no); if (dst_row != NULL) { + ut_ad(i_s_locks_row_validate(dst_row)); return(dst_row); } #endif @@ -1037,6 +1076,7 @@ add_lock_to_cache( } /* for()-loop */ #endif + ut_ad(i_s_locks_row_validate(dst_row)); return(dst_row); } diff --git a/storage/innobase/ut/ut0ut.c b/storage/innobase/ut/ut0ut.c index 39c60d2bc2f..4f4dfc5eed8 100644 --- a/storage/innobase/ut/ut0ut.c +++ b/storage/innobase/ut/ut0ut.c @@ -715,6 +715,10 @@ ut_strerr( return("Zip overflow"); case DB_RECORD_NOT_FOUND: return("Record not found"); + case DB_CHILD_NO_INDEX: + return("No index on referencing keys in referencing table"); + case DB_PARENT_NO_INDEX: + return("No index on referenced keys in referenced table"); case DB_END_OF_INDEX: return("End of index"); /* do not add default: in order to produce a warning if new code diff --git a/storage/myisam/Makefile.am b/storage/myisam/Makefile.am deleted file mode 100644 index 5c3370ac6c5..00000000000 --- a/storage/myisam/Makefile.am +++ /dev/null @@ -1,169 +0,0 @@ -# Copyright (C) 2000-2006 MySQL AB -# -# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ - -I$(top_srcdir)/regex \ - -I$(top_srcdir)/sql \ - -I$(srcdir) -WRAPLIBS= - -LDADD = - -DEFS = @DEFS@ - -EXTRA_DIST = mi_test_all.sh mi_test_all.res CMakeLists.txt plug.in -pkgdata_DATA = mi_test_all mi_test_all.res - -pkglib_LIBRARIES = libmyisam.a -bin_PROGRAMS = myisamchk myisamlog myisampack myisam_ftdump -myisamchk_DEPENDENCIES= $(LIBRARIES) -myisamchk_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -myisamlog_DEPENDENCIES= $(LIBRARIES) -myisamlog_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -myisampack_DEPENDENCIES=$(LIBRARIES) -myisampack_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -noinst_PROGRAMS = mi_test1 mi_test2 mi_test3 rt_test sp_test -noinst_HEADERS = myisamdef.h rt_index.h rt_key.h rt_mbr.h sp_defs.h \ - fulltext.h ftdefs.h ha_myisam.h mi_extrafunc.h -mi_test1_DEPENDENCIES= $(LIBRARIES) -mi_test1_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -mi_test2_DEPENDENCIES= $(LIBRARIES) -mi_test2_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -mi_test3_DEPENDENCIES= $(LIBRARIES) -mi_test3_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -myisam_ftdump_DEPENDENCIES= $(LIBRARIES) -myisam_ftdump_LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -rt_test_DEPENDENCIES= $(LIBRARIES) -rt_test_LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -sp_test_DEPENDENCIES= $(LIBRARIES) -sp_test_LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -libmyisam_a_SOURCES = mi_open.c mi_extra.c mi_info.c mi_rkey.c \ - mi_rnext.c mi_rnext_same.c \ - mi_search.c mi_page.c mi_key.c mi_locking.c \ - mi_rrnd.c mi_scan.c mi_cache.c \ - mi_statrec.c mi_packrec.c mi_dynrec.c \ - mi_update.c mi_write.c mi_unique.c \ - mi_delete.c \ - mi_rprev.c mi_rfirst.c mi_rlast.c mi_rsame.c \ - mi_rsamepos.c mi_panic.c mi_close.c mi_create.c\ - mi_range.c mi_dbug.c mi_checksum.c mi_log.c \ - mi_changed.c mi_static.c mi_delete_all.c \ - mi_delete_table.c mi_rename.c mi_check.c \ - mi_keycache.c mi_preload.c \ - ft_parser.c ft_stopwords.c ft_static.c \ - ft_update.c ft_boolean_search.c ft_nlq_search.c sort.c \ - ha_myisam.cc \ - rt_index.c rt_key.c rt_mbr.c rt_split.c sp_key.c -CLEANFILES = test?.MY? FT?.MY? isam.log mi_test_all rt_test.MY? sp_test.MY? - -# Move to automake rules ? -prolint:; plparse -b -u -hF1 "-width(0,0)" "-format=%f:%l:\s%t:%n\s%m" \ - "-elib(????)" "+elib(?3??)" my.lnt $(nisam_SOURCES) - -SUFFIXES = .sh - -.sh: - @RM@ -f $@ $@-t - @SED@ \ - -e 's!@''bindir''@!$(bindir)!g' \ - -e 's!@''scriptdir''@!$(bindir)!g' \ - -e 's!@''prefix''@!$(prefix)!g' \ - -e 's!@''datadir''@!$(datadir)!g' \ - -e 's!@''localstatedir''@!$(localstatedir)!g' \ - -e 's!@''libexecdir''@!$(libexecdir)!g' \ - -e 's!@''CC''@!@CC@!'\ - -e 's!@''CXX''@!@CXX@!'\ - -e 's!@''GXX''@!@GXX@!'\ - -e 's!@''PERL''@!@PERL@!' \ - -e 's!@''CFLAGS''@!@SAVE_CFLAGS@!'\ - -e 's!@''CXXFLAGS''@!@SAVE_CXXFLAGS@!'\ - -e 's!@''LDFLAGS''@!@SAVE_LDFLAGS@!'\ - -e 's!@''VERSION''@!@VERSION@!' \ - -e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \ - -e 's!@''COMPILATION_COMMENT''@!@COMPILATION_COMMENT@!' \ - -e 's!@''MACHINE_TYPE''@!@MACHINE_TYPE@!' \ - -e 's!@''HOSTNAME''@!@HOSTNAME@!' \ - -e 's!@''SYSTEM_TYPE''@!@SYSTEM_TYPE@!' \ - -e 's!@''CHECK_PID''@!@CHECK_PID@!' \ - -e 's!@''FIND_PROC''@!@FIND_PROC@!' \ - -e 's!@''MYSQLD_DEFAULT_SWITCHES''@!@MYSQLD_DEFAULT_SWITCHES@!' \ - -e 's!@''MYSQL_UNIX_ADDR''@!@MYSQL_UNIX_ADDR@!' \ - -e 's!@''TARGET_LINUX''@!@TARGET_LINUX@!' \ - -e "s!@""CONF_COMMAND""@!@CONF_COMMAND@!" \ - -e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \ - -e 's!@''sysconfdir''@!@sysconfdir@!' \ - -e 's!@''SHORT_MYSQL_INTRO''@!@SHORT_MYSQL_INTRO@!' \ - -e 's!@''SHARED_LIB_VERSION''@!@SHARED_LIB_VERSION@!' \ - -e 's!@''MYSQL_BASE_VERSION''@!@MYSQL_BASE_VERSION@!' \ - -e 's!@''MYSQL_NO_DASH_VERSION''@!@MYSQL_NO_DASH_VERSION@!' \ - -e 's!@''MYSQL_TCP_PORT''@!@MYSQL_TCP_PORT@!' \ - -e 's!@''PERL_DBI_VERSION''@!@PERL_DBI_VERSION@!' \ - -e 's!@''PERL_DBD_VERSION''@!@PERL_DBD_VERSION@!' \ - -e 's!@''PERL_DATA_DUMPER''@!@PERL_DATA_DUMPER@!' \ - $< > $@-t - @CHMOD@ +x $@-t - @MV@ $@-t $@ - -if HAVE_DTRACE_DASH_G -libmyisam_a_LIBADD = probes_mysql.o -libmyisam_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers -CLEANFILES += probes_mysql.o dtrace_files dtrace_providers -DTRACEFILES = ha_myisam.o -DTRACEPROVIDER = probes_mysql.d -CLEANFILES += $(DTRACEPROVIDER) dtrace_sources - -dtrace_files: - echo $(DTRACEFILES) > $@ -dtrace_providers: probes_mysql.d - echo $(DTRACEPROVIDER) > $@ -probes_mysql.d: - -$(RM) -f probes_mysql.d - $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d - echo timestamp > dtrace_sources - -probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES) - $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@ -endif diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c index 937bb6ffe19..a2e29d90897 100644 --- a/storage/myisam/ft_nlq_search.c +++ b/storage/myisam/ft_nlq_search.c @@ -63,7 +63,7 @@ static int FT_SUPERDOC_cmp(void* cmp_arg __attribute__((unused)), static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) { - int subkeys, r; + int UNINIT_VAR(subkeys), r; uint keylen, doc_cnt; FT_SUPERDOC sdoc, *sptr; TREE_ELEMENT *selem; diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 2ba62d03c6b..c4bb6d7dbd4 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1499,8 +1499,6 @@ bool ha_myisam::check_and_repair(THD *thd) { int error=0; int marked_crashed; - char *old_query; - uint old_query_length; HA_CHECK_OPT check_opt; DBUG_ENTER("ha_myisam::check_and_repair"); @@ -1511,10 +1509,9 @@ bool ha_myisam::check_and_repair(THD *thd) check_opt.flags|=T_QUICK; sql_print_warning("Checking table: '%s'",table->s->path.str); - old_query= thd->query(); - old_query_length= thd->query_length(); + const CSET_STRING query_backup= thd->query_string; thd->set_query(table->s->table_name.str, - (uint) table->s->table_name.length); + (uint) table->s->table_name.length, system_charset_info); if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt)) { @@ -1527,7 +1524,7 @@ bool ha_myisam::check_and_repair(THD *thd) if (repair(thd, &check_opt)) error=1; } - thd->set_query(old_query, old_query_length); + thd->set_query(query_backup); DBUG_RETURN(error); } diff --git a/storage/myisam/plug.in b/storage/myisam/plug.in deleted file mode 100644 index 051ec2d54aa..00000000000 --- a/storage/myisam/plug.in +++ /dev/null @@ -1,7 +0,0 @@ -MYSQL_STORAGE_ENGINE(myisam,no, [MyISAM Storage Engine], - [Traditional non-transactional MySQL tables]) -MYSQL_PLUGIN_DIRECTORY(myisam, [storage/myisam]) -MYSQL_PLUGIN_STATIC(myisam, [libmyisam.a]) -MYSQL_PLUGIN_MANDATORY(myisam) dnl Default -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(myisam, [ha_myisam.cc]) - diff --git a/storage/myisammrg/Makefile.am b/storage/myisammrg/Makefile.am deleted file mode 100644 index 43dec3ae3d9..00000000000 --- a/storage/myisammrg/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (C) 2000-2002, 2005-2006 MySQL AB -# -# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ - -I$(top_srcdir)/regex \ - -I$(top_srcdir)/sql \ - -I$(srcdir) -WRAPLIBS= - -LDADD = - -DEFS = @DEFS@ -pkglib_LIBRARIES = libmyisammrg.a -noinst_HEADERS = myrg_def.h ha_myisammrg.h -noinst_LIBRARIES = libmyisammrg.a -libmyisammrg_a_SOURCES = myrg_open.c myrg_extra.c myrg_info.c myrg_locking.c \ - myrg_rrnd.c myrg_update.c myrg_delete.c myrg_rsame.c \ - myrg_panic.c myrg_close.c myrg_create.c myrg_static.c \ - myrg_rkey.c myrg_rfirst.c myrg_rlast.c myrg_rnext.c \ - myrg_rprev.c myrg_queue.c myrg_write.c myrg_range.c \ - ha_myisammrg.cc \ - myrg_rnext_same.c myrg_records.c - - -EXTRA_DIST = CMakeLists.txt plug.in - -if HAVE_DTRACE_DASH_G -libmyisammrg_a_LIBADD = probes_mysql.o -libmyisammrg_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers -CLEANFILES = probes_mysql.o dtrace_files dtrace_providers -DTRACEFILES = ha_myisammrg.o -DTRACEPROVIDER = probes_mysql.d -CLEANFILES += $(DTRACEPROVIDER) dtrace_sources - -dtrace_files: - echo $(DTRACEFILES) > $@ -dtrace_providers: probes_mysql.d - echo $(DTRACEPROVIDER) > $@ -probes_mysql.d: - -$(RM) -f probes_mysql.d - $(CP) $(top_srcdir)/include/probes_mysql.d.base probes_mysql.d - echo timestamp > dtrace_sources - -probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES) - $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@ -endif diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c index b8e86b89181..c545aff912f 100644 --- a/storage/myisammrg/myrg_open.c +++ b/storage/myisammrg/myrg_open.c @@ -220,7 +220,7 @@ MYRG_INFO *myrg_parent_open(const char *parent_name, int (*callback)(void*, const char*), void *callback_param) { - MYRG_INFO *m_info; + MYRG_INFO *UNINIT_VAR(m_info); int rc; int errpos; int save_errno; diff --git a/storage/myisammrg/plug.in b/storage/myisammrg/plug.in deleted file mode 100644 index 1f94e07d881..00000000000 --- a/storage/myisammrg/plug.in +++ /dev/null @@ -1,6 +0,0 @@ -MYSQL_STORAGE_ENGINE(myisammrg,no,[MyISAM MERGE Engine], - [Merge multiple MySQL tables into one]) -MYSQL_PLUGIN_DIRECTORY(myisammrg,[storage/myisammrg]) -MYSQL_PLUGIN_STATIC(myisammrg, [libmyisammrg.a]) -MYSQL_PLUGIN_MANDATORY(myisammrg) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(myisammrg, [ha_myisammrg.cc]) diff --git a/storage/perfschema/Makefile.am b/storage/perfschema/Makefile.am deleted file mode 100644 index 762f5b85790..00000000000 --- a/storage/perfschema/Makefile.am +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright (c) 2008, 2010, 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, -# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA - -#called from the top level Makefile - -SUBDIRS = . unittest - -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) -MYSQLLIBdir= $(pkglibdir) -pkgplugindir = $(pkglibdir)/plugin -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ - -I$(top_srcdir)/regex \ - -I$(top_srcdir)/sql \ - -I$(srcdir) -WRAPLIBS= - -LDADD = - -DEFS = -DMYSQL_SERVER @DEFS@ - - -noinst_HEADERS = ha_perfschema.h pfs_engine_table.h pfs.h pfs_server.h \ - pfs_global.h pfs_instr_class.h pfs_instr.h \ - pfs_column_types.h pfs_column_values.h \ - table_setup_instruments.h table_performance_timers.h \ - table_setup_timers.h \ - table_setup_consumers.h table_events_waits.h \ - pfs_events_waits.h pfs_timer.h table_threads.h \ - table_sync_instances.h \ - table_events_waits_summary.h pfs_stat.h \ - table_ews_global_by_event_name.h table_all_instr.h \ - table_file_instances.h table_file_summary.h \ - pfs_lock.h pfs_atomic.h - -PSE_SOURCES = ha_perfschema.cc pfs_engine_table.cc pfs.cc pfs_server.cc \ - pfs_global.cc pfs_instr_class.cc pfs_instr.cc \ - pfs_column_values.cc \ - table_setup_instruments.cc table_performance_timers.cc \ - table_setup_timers.cc \ - table_setup_consumers.cc table_events_waits.cc \ - pfs_events_waits.cc pfs_timer.cc table_threads.cc \ - table_sync_instances.cc \ - table_events_waits_summary.cc \ - table_ews_global_by_event_name.cc table_all_instr.cc \ - table_file_instances.cc table_file_summary.cc \ - pfs_atomic.cc pfs_check.cc - -EXTRA_LIBRARIES = libperfschema.a -noinst_LIBRARIES = @plugin_perfschema_static_target@ - -libperfschema_a_SOURCES= $(PSE_SOURCES) - -EXTRA_DIST = plug.in CMakeLists.txt - -unittests = unittest - -test: - perl $(top_srcdir)/unittest/unit.pl run $(unittests) - -test-verbose: - HARNESS_VERBOSE=1 perl $(top_srcdir)/unittest/unit.pl run $(unittests) - diff --git a/storage/perfschema/plug.in b/storage/perfschema/plug.in deleted file mode 100644 index 36a1c1e8bda..00000000000 --- a/storage/perfschema/plug.in +++ /dev/null @@ -1,26 +0,0 @@ -dnl -*- ksh -*- - -# Copyright (c) 2008, 2010, 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, -# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA - -dnl This file is part of the configure scripts used by autoconf. - -MYSQL_STORAGE_ENGINE(perfschema, - perfschema, - [Performance Schema], - [Performance Schema], - [default,max,max-no-ndb]) -MYSQL_PLUGIN_DIRECTORY(perfschema, [storage/perfschema]) -MYSQL_PLUGIN_STATIC(perfschema, [libperfschema.a]) diff --git a/storage/perfschema/unittest/Makefile.am b/storage/perfschema/unittest/Makefile.am deleted file mode 100644 index 7d82753c9e5..00000000000 --- a/storage/perfschema/unittest/Makefile.am +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (C) 2008-2009 Sun Microsystems, Inc. -# -# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -INCLUDES = -I$(top_builddir)/include \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/include/mysql \ - -I$(top_srcdir)/regex \ - -I$(top_srcdir)/unittest/mytap \ - -I$(top_srcdir)/sql \ - -I$(top_srcdir)/storage/perfschema - -DEFS = -DMYSQL_SERVER @DEFS@ - -TEST_CODE = $(top_builddir)/unittest/mytap/libmytap.a - -$(TEST_CODE) : - (cd $(top_builddir)/unittest/mytap; $(MAKE)) - -PROD_CODE = $(top_builddir)/storage/perfschema/libperfschema.a \ - $(top_builddir)/mysys/libmysys.a \ - $(top_builddir)/dbug/libdbug.a \ - $(top_builddir)/strings/libmystrings.a - -noinst_PROGRAMS = pfs_instr_class-t pfs_instr_class-oom-t \ - pfs_instr-t pfs_instr-oom-t pfs_timer-t pfs-t - -pfs_t_SOURCES = pfs-t.cc stub_print_error.h -pfs_t_LDADD = $(TEST_CODE) $(PROD_CODE) - -pfs_instr_class_t_SOURCES = pfs_instr_class-t.cc -pfs_instr_class_t_LDADD = $(TEST_CODE) $(PROD_CODE) - -pfs_instr_class_oom_t_SOURCES = pfs_instr_class-oom-t.cc stub_pfs_global.h -pfs_instr_class_oom_t_LDADD = $(TEST_CODE) $(PROD_CODE) - -pfs_instr_t_SOURCES = pfs_instr-t.cc -pfs_instr_t_LDADD = $(TEST_CODE) $(PROD_CODE) - -pfs_instr_oom_t_SOURCES = pfs_instr-oom-t.cc stub_pfs_global.h -pfs_instr_oom_t_LDADD = $(TEST_CODE) $(PROD_CODE) - -pfs_timer_t_SOURCES = pfs_timer-t.cc -pfs_timer_t_LDADD = $(TEST_CODE) $(PROD_CODE) - -EXTRA_DIST = conf.txt CMakeLists.txt - |