diff options
Diffstat (limited to 'storage')
47 files changed, 487 insertions, 365 deletions
diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am index 254c95bf68b..1dbe101c2d6 100644 --- a/storage/archive/Makefile.am +++ b/storage/archive/Makefile.am @@ -33,7 +33,7 @@ DEFS = @DEFS@ noinst_HEADERS = ha_archive.h azlib.h noinst_PROGRAMS = archive_test archive_reader -EXTRA_LTLIBRARIES = ha_archive.la +EXTRA_LTLIBRARIES = libarchive.la ha_archive.la pkgplugin_LTLIBRARIES = @plugin_archive_shared_target@ ha_archive_la_LDFLAGS = -module -rpath $(pkgplugindir) ha_archive_la_CXXFLAGS= -shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN @@ -41,11 +41,10 @@ ha_archive_la_CFLAGS = -shared $(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 +noinst_LTLIBRARIES = @plugin_archive_static_target@ +libarchive_la_CXXFLAGS = $(AM_CXXFLAGS) +libarchive_la_CFLAGS = $(AM_CFLAGS) +libarchive_la_SOURCES = ha_archive.cc azio.c archive_test_SOURCES = archive_test.c azio.c diff --git a/storage/archive/plug.in b/storage/archive/plug.in index 52131b12e6b..d19c29414e3 100644 --- a/storage/archive/plug.in +++ b/storage/archive/plug.in @@ -1,4 +1,4 @@ MYSQL_STORAGE_ENGINE(archive,, [Archive Storage Engine], [Archive Storage Engine], [max,max-no-ndb]) -MYSQL_PLUGIN_STATIC(archive, [libarchive.a]) +MYSQL_PLUGIN_STATIC(archive, [libarchive.la]) MYSQL_PLUGIN_DYNAMIC(archive, [ha_archive.la]) diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am index 148746a9336..6665898cae7 100644 --- a/storage/blackhole/Makefile.am +++ b/storage/blackhole/Makefile.am @@ -32,17 +32,16 @@ DEFS = @DEFS@ noinst_HEADERS = ha_blackhole.h -EXTRA_LTLIBRARIES = ha_blackhole.la +EXTRA_LTLIBRARIES = libblackhole.la ha_blackhole.la pkgplugin_LTLIBRARIES = @plugin_blackhole_shared_target@ ha_blackhole_la_LDFLAGS=-module -rpath $(pkgplugindir) ha_blackhole_la_CXXFLAGS=-shared $(AM_CXXFLAGS) -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_SOURCES= ha_blackhole.cc +noinst_LTLIBRARIES = @plugin_blackhole_static_target@ +libblackhole_la_CXXFLAGS=$(AM_CXXFLAGS) +libblackhole_la_SOURCES= ha_blackhole.cc EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/blackhole/plug.in b/storage/blackhole/plug.in index 725db0facba..2f3b120fa5d 100644 --- a/storage/blackhole/plug.in +++ b/storage/blackhole/plug.in @@ -1,6 +1,6 @@ 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_STATIC(blackhole, [libblackhole.la]) MYSQL_PLUGIN_DYNAMIC(blackhole, [ha_blackhole.la]) diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am index 75ad9062984..c711e4020fc 100644 --- a/storage/csv/Makefile.am +++ b/storage/csv/Makefile.am @@ -29,16 +29,15 @@ LDADD = DEFS = @DEFS@ noinst_HEADERS = ha_tina.h transparent_file.h -EXTRA_LTLIBRARIES = ha_csv.la +EXTRA_LTLIBRARIES = libcsv.la ha_csv.la pkglib_LTLIBRARIES = @plugin_csv_shared_target@ ha_csv_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) ha_csv_la_CXXFLAGS = -shared $(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 +noinst_LTLIBRARIES = @plugin_csv_static_target@ +libcsv_la_CXXFLAGS = $(AM_CXXFLAGS) +libcsv_la_SOURCES = transparent_file.cc ha_tina.cc EXTRA_DIST = CMakeLists.txt plug.in # Don't update the files from bitkeeper diff --git a/storage/csv/plug.in b/storage/csv/plug.in index bbc69680fcd..4ff32959fa2 100644 --- a/storage/csv/plug.in +++ b/storage/csv/plug.in @@ -1,5 +1,5 @@ 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_STATIC(csv, [libcsv.la]) MYSQL_PLUGIN_MANDATORY(csv) dnl Used for logging diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am index dc499e2f9dd..807f2e39fd6 100644 --- a/storage/example/Makefile.am +++ b/storage/example/Makefile.am @@ -32,16 +32,16 @@ DEFS = @DEFS@ noinst_HEADERS = ha_example.h -EXTRA_LTLIBRARIES = ha_example.la +EXTRA_LTLIBRARIES = libexample.la 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= -shared $(AM_CXXFLAGS) -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_SOURCES= ha_example.cc + +noinst_LTLIBRARIES = @plugin_example_static_target@ +libexample_la_CXXFLAGS = $(AM_CXXFLAGS) +libexample_la_SOURCES= ha_example.cc EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/federated/Makefile.am b/storage/federated/Makefile.am index 7853ccedd21..6bea656d291 100644 --- a/storage/federated/Makefile.am +++ b/storage/federated/Makefile.am @@ -30,7 +30,7 @@ DEFS = @DEFS@ noinst_HEADERS = ha_federated.h -EXTRA_LTLIBRARIES = ha_federated.la +EXTRA_LTLIBRARIES = libfederated.la libfederated_embedded.la ha_federated.la pkgplugin_LTLIBRARIES = @plugin_federated_shared_target@ ha_federated_la_LDFLAGS = -module -rpath $(pkgplugindir) \ -L$(top_builddir)/libservices -lmysqlservices @@ -39,10 +39,13 @@ ha_federated_la_CFLAGS = -shared $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_federated_la_SOURCES = ha_federated.cc $(top_srcdir)/mysys/string.c -EXTRA_LIBRARIES = libfederated.a -noinst_LIBRARIES = @plugin_federated_static_target@ -libfederated_a_CXXFLAGS = $(AM_CXXFLAGS) -libfederated_a_SOURCES= ha_federated.cc +noinst_LTLIBRARIES = @plugin_federated_static_target@ @plugin_federated_embedded_static_target@ +libfederated_la_CXXFLAGS = $(AM_CXXFLAGS) +libfederated_la_SOURCES= ha_federated.cc + +libfederated_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ +libfederated_embedded_la_CFLAGS = $(AM_CFLAGS) @plugin_embedded_defs@ +libfederated_embedded_la_SOURCES= ha_federated.cc EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/federated/plug.in b/storage/federated/plug.in index 714888b2ebf..3db4a35de08 100644 --- a/storage/federated/plug.in +++ b/storage/federated/plug.in @@ -1,5 +1,4 @@ MYSQL_STORAGE_ENGINE(federated,,[Federated Storage Engine], [Connects to tables on remote MySQL servers], []) -MYSQL_PLUGIN_STATIC(federated, [libfederated.a]) +MYSQL_PLUGIN_STATIC(federated, [libfederated.la], [libfederated_embedded.la]) MYSQL_PLUGIN_DYNAMIC(federated, [ha_federated.la]) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(federated, [ha_federated.cc]) diff --git a/storage/federatedx/Makefile.am b/storage/federatedx/Makefile.am index 0e3249866ea..637ad642ce6 100644 --- a/storage/federatedx/Makefile.am +++ b/storage/federatedx/Makefile.am @@ -17,7 +17,7 @@ DEFS = @DEFS@ noinst_HEADERS = ha_federatedx.h federatedx_probes.h -EXTRA_LTLIBRARIES = ha_federatedx.la +EXTRA_LTLIBRARIES = libfederatedx.la libfederatedx_common.la libfederatedx_embedded.la ha_federatedx.la pkgplugin_LTLIBRARIES = @plugin_federatedx_shared_target@ ha_federatedx_la_LDFLAGS = -module -rpath $(pkgplugindir) \ -L$(top_builddir)/libservices -lmysqlservices @@ -25,13 +25,24 @@ ha_federatedx_la_CXXFLAGS= -shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_federatedx_la_CFLAGS = -shared $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -EXTRA_LIBRARIES = libfederatedx.a -noinst_LIBRARIES = @plugin_federatedx_static_target@ -libfederatedx_a_CXXFLAGS = $(AM_CXXFLAGS) -libfederatedx_a_SOURCES= ha_federatedx.cc federatedx_txn.cc \ +noinst_LTLIBRARIES = @plugin_federatedx_static_target@ @plugin_federatedx_embedded_static_target@ +libfederatedx_common_la_CXXFLAGS = $(AM_CXXFLAGS) +libfederatedx_common_la_CFLAGS = $(AM_CFLAGS) +libfederatedx_common_la_SOURCES= federatedx_txn.cc \ federatedx_io.cc federatedx_io_null.cc \ federatedx_io_mysql.cc +libfederatedx_la_CXXFLAGS = $(AM_CFLAGS) +libfederatedx_la_CFLAGS = $(AM_CFLAGS) +libfederatedx_la_LIBADD = libfederatedx_common.la +libfederatedx_la_SOURCES= ha_federatedx.cc + +libfederatedx_embedded_la_CXXFLAGS = $(AM_CFLAGS) @plugin_embedded_defs@ +libfederatedx_embedded_la_CFLAGS = $(AM_CFLAGS) @plugin_embedded_defs@ +libfederatedx_embedded_la_LDFLAGS = $(AM_LDFLAGS) +libfederatedx_embedded_la_LIBADD = libfederatedx_common.la +libfederatedx_embedded_la_SOURCES= ha_federatedx.cc + EXTRA_DIST = CMakeLists.txt plug.in ha_federatedx.h \ federatedx_probes.h diff --git a/storage/federatedx/plug.in b/storage/federatedx/plug.in index 95afe270f4c..4a8a88e7280 100644 --- a/storage/federatedx/plug.in +++ b/storage/federatedx/plug.in @@ -1,5 +1,4 @@ MYSQL_STORAGE_ENGINE(federatedx,,[FederatedX Storage Engine], [FederatedX Storage Engine], [max,max-no-ndb]) MYSQL_PLUGIN_DYNAMIC(federatedx, [ha_federatedx.la]) -MYSQL_PLUGIN_STATIC(federatedx, [libfederatedx.a]) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(federatedx, [ha_federatedx.cc]) +MYSQL_PLUGIN_STATIC(federatedx, [libfederatedx.la], [libfederatedx_embedded.la]) diff --git a/storage/heap/Makefile.am b/storage/heap/Makefile.am index ec1445dea67..c896442728a 100644 --- a/storage/heap/Makefile.am +++ b/storage/heap/Makefile.am @@ -27,8 +27,11 @@ LDADD = DEFS = @DEFS@ pkglib_LIBRARIES = libheap.a +noinst_LTLIBRARIES = libheap.la libheap_s.la \ + @plugin_heap_embedded_static_target@ +EXTRA_LTLIBRARIES = libheap_embedded.la + 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 \ @@ -40,14 +43,25 @@ hp_test2_LDADD = libheap.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 \ +libheap_la_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 +libheap_s_la_SOURCES = ha_heap.cc +libheap_s_la_CFLAGS = $(AM_CFLAGS) +libheap_s_la_CXXFLAGS = $(AM_CXXFLAGS) +libheap_s_la_LIBADD = libheap.la +libheap_embedded_la_SOURCES = ha_heap.cc +libheap_embedded_la_LIBADD = libheap.la +libheap_embedded_la_CXXFLAGS = @plugin_embedded_defs@ + +libheap_a_SOURCES= +libheap.a: libheap.la + $(CP) .libs/libheap.a $@ + EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/heap/plug.in b/storage/heap/plug.in index 50f31c60f2b..92ec01d3c88 100644 --- a/storage/heap/plug.in +++ b/storage/heap/plug.in @@ -1,7 +1,6 @@ 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_STATIC(heap, [libheap_s.la], [libheap_embedded.la]) 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 index 29ba83c0668..c2bbb98e73d 100644 --- a/storage/innobase/Makefile.am +++ b/storage/innobase/Makefile.am @@ -122,9 +122,8 @@ noinst_HEADERS= include/btr0btr.h include/btr0btr.ic \ include/ut0list.ic include/ut0wqueue.h \ include/ha_prototypes.h handler/ha_innodb.h -EXTRA_LIBRARIES= libinnobase.a -noinst_LIBRARIES= @plugin_innobase_static_target@ -libinnobase_a_SOURCES= btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ +noinst_LTLIBRARIES= @plugin_innobase_static_target@ +libinnobase_la_SOURCES= btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ btr/btr0sea.c buf/buf0buf.c buf/buf0flu.c \ buf/buf0lru.c buf/buf0rea.c data/data0data.c \ data/data0type.c dict/dict0boot.c \ @@ -156,10 +155,10 @@ libinnobase_a_SOURCES= btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c \ ut/ut0ut.c ut/ut0vec.c ut/ut0wqueue.c \ handler/ha_innodb.cc -libinnobase_a_CXXFLAGS= $(AM_CXXFLAGS) -libinnobase_a_CFLAGS= $(AM_CFLAGS) +libinnobase_la_CXXFLAGS= $(AM_CXXFLAGS) +libinnobase_la_CFLAGS= $(AM_CFLAGS) -EXTRA_LTLIBRARIES= ha_innodb.la +EXTRA_LTLIBRARIES= libinnobase.la ha_innodb.la pkgplugin_LTLIBRARIES= @plugin_innobase_shared_target@ ha_innodb_la_LDFLAGS= -module -rpath $(pkgplugindir) diff --git a/storage/innobase/plug.in.disabled b/storage/innobase/plug.in.disabled index de7302dd6cc..b18950b9c7a 100644 --- a/storage/innobase/plug.in.disabled +++ b/storage/innobase/plug.in.disabled @@ -1,7 +1,7 @@ MYSQL_STORAGE_ENGINE(innobase, innodb, [InnoDB Storage Engine], [Transactional Tables using InnoDB], [max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(innobase, [storage/innobase]) -MYSQL_PLUGIN_STATIC(innobase, [libinnobase.a]) +MYSQL_PLUGIN_STATIC(innobase, [libinnobase.la]) MYSQL_PLUGIN_DYNAMIC(innobase, [ha_innodb.la]) MYSQL_PLUGIN_ACTIONS(innobase, [ AC_CHECK_LIB(rt, aio_read, [innodb_system_libs="-lrt"]) diff --git a/storage/innodb_plugin/Makefile.am b/storage/innodb_plugin/Makefile.am index 1bed796f0d4..53b65c3d6ca 100644 --- a/storage/innodb_plugin/Makefile.am +++ b/storage/innodb_plugin/Makefile.am @@ -228,9 +228,8 @@ noinst_HEADERS= \ include/ut0wqueue.h \ mem/mem0dbg.c -EXTRA_LIBRARIES= libinnobase.a -noinst_LIBRARIES= @plugin_innodb_plugin_static_target@ -libinnobase_a_SOURCES= \ +noinst_LTLIBRARIES= @plugin_innodb_plugin_static_target@ +libinnobase_la_SOURCES= \ btr/btr0btr.c \ btr/btr0cur.c \ btr/btr0pcur.c \ @@ -325,16 +324,16 @@ libinnobase_a_SOURCES= \ ut/ut0vec.c \ ut/ut0wqueue.c -libinnobase_a_CXXFLAGS= $(AM_CXXFLAGS) -libinnobase_a_CFLAGS= $(AM_CFLAGS) +libinnobase_la_CXXFLAGS= $(AM_CXXFLAGS) +libinnobase_la_CFLAGS= $(AM_CFLAGS) -EXTRA_LTLIBRARIES= ha_innodb_plugin.la +EXTRA_LTLIBRARIES= libinnobase.la ha_innodb_plugin.la pkgplugin_LTLIBRARIES= @plugin_innodb_plugin_shared_target@ ha_innodb_plugin_la_LDFLAGS= -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices ha_innodb_plugin_la_CXXFLAGS= -shared $(AM_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_innodb_plugin_la_CFLAGS= -shared $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) -ha_innodb_plugin_la_SOURCES= $(libinnobase_a_SOURCES) +ha_innodb_plugin_la_SOURCES= $(libinnobase_la_SOURCES) EXTRA_DIST= CMakeLists.txt plug.in \ pars/make_bison.sh pars/make_flex.sh \ diff --git a/storage/maria/CMakeLists.txt b/storage/maria/CMakeLists.txt index 850c2dd40cd..969c05545cf 100644 --- a/storage/maria/CMakeLists.txt +++ b/storage/maria/CMakeLists.txt @@ -65,9 +65,8 @@ TARGET_LINK_LIBRARIES(aria_read_log aria myisam mysys dbug strings zlib wsock32) ADD_EXECUTABLE(aria_pack maria_pack.c) TARGET_LINK_LIBRARIES(aria_pack aria myisam mysys dbug strings zlib wsock32) -ADD_EXECUTABLE(aria_dump_log ma_loghandler.c unittest/ma_loghandler_examples.c) +ADD_EXECUTABLE(aria_dump_log maria_dump_log.c unittest/ma_loghandler_examples.c) TARGET_LINK_LIBRARIES(aria_dump_log aria myisam mysys dbug strings zlib wsock32) -SET_TARGET_PROPERTIES(aria_dump_log PROPERTIES COMPILE_FLAGS "-DMARIA_DUMP_LOG") ADD_EXECUTABLE(ma_test1 ma_test1.c) TARGET_LINK_LIBRARIES(ma_test1 aria myisam mysys dbug strings zlib wsock32) diff --git a/storage/maria/Makefile.am b/storage/maria/Makefile.am index a83063a0226..0569efa91b8 100644 --- a/storage/maria/Makefile.am +++ b/storage/maria/Makefile.am @@ -34,6 +34,9 @@ EXTRA_DIST = ma_test_all.sh ma_test_all.res ma_test_big.sh \ ma_ft_stem.c CMakeLists.txt plug.in ma_test_recovery pkgdata_DATA = pkglib_LIBRARIES = libaria.a +noinst_LTLIBRARIES = libaria.la libaria_s.la \ + @plugin_aria_embedded_static_target@ +EXTRA_LTLIBRARIES = libaria_embedded.la bin_PROGRAMS = aria_chk aria_pack aria_ftdump aria_read_log \ aria_dump_log aria_chk_DEPENDENCIES= $(LIBRARIES) @@ -66,8 +69,7 @@ aria_dump_log_LDADD= @CLIENT_EXTRA_LDFLAGS@ libaria.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -aria_dump_log_SOURCES= ma_loghandler.c unittest/ma_loghandler_examples.c -aria_dump_log_CPPFLAGS= -DMARIA_DUMP_LOG +aria_dump_log_SOURCES= maria_dump_log.c unittest/ma_loghandler_examples.c noinst_PROGRAMS = ma_test1 ma_test2 ma_test3 ma_rt_test ma_sp_test noinst_HEADERS = maria_def.h ma_rt_index.h ma_rt_key.h ma_rt_mbr.h \ ma_sp_defs.h ma_fulltext.h ma_ftdefs.h ma_ft_test1.h \ @@ -117,7 +119,7 @@ ma_sp_test_LDADD= @CLIENT_EXTRA_LDFLAGS@ libaria.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@ -libaria_a_SOURCES = ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c \ +libaria_la_SOURCES = ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c \ ma_rnext.c ma_rnext_same.c \ ma_search.c ma_page.c ma_key_recover.c ma_key.c \ ma_locking.c ma_state.c \ @@ -140,7 +142,20 @@ libaria_a_SOURCES = ma_init.c ma_open.c ma_extra.c ma_info.c ma_rkey.c \ ma_pagecache.c ma_pagecaches.c \ ma_checkpoint.c ma_recovery.c ma_commit.c \ ma_pagecrc.c ma_recovery_util.c \ - ha_maria.cc compat_aliases.cc ma_servicethread.c + compat_aliases.cc ma_servicethread.c + +libaria_s_la_SOURCES = ha_maria.cc +libaria_s_la_CXXFLAGS = $(AM_CXXFLAGS) +libaria_s_la_LIBADD = libaria.la +libaria_embedded_la_SOURCES = ha_maria.cc +libaria_embedded_la_LIBADD = libaria.la +libaria_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ + +libaria_a_SOURCES= +libaria.a: libaria.la + $(CP) .libs/libaria.a $@ + + CLEANFILES = test?.MA? FT?.MA? isam.log ma_test_all ma_rt_test.MA? sp_test.MA? aria_log_control aria_log.0000* SUFFIXES = .sh diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 67be01e2db9..306728edb64 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1354,6 +1354,7 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt) T_SILENT | T_FORCE_CREATE | T_CALC_CHECKSUM | (check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT)); param.sort_buffer_length= THDVAR(thd, sort_buffer_size); + param.backup_time= check_opt->start_time; start_records= file->state->records; while ((error= repair(thd, ¶m, 0)) && param.retry_repair) { diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c index c0763b0612d..7e68437de2b 100644 --- a/storage/maria/ma_bitmap.c +++ b/storage/maria/ma_bitmap.c @@ -492,7 +492,7 @@ static void _ma_bitmap_unpin_all(MARIA_SHARE *share) while (pinned_page-- != page_link) pagecache_unlock_by_link(share->pagecache, pinned_page->link, pinned_page->unlock, PAGECACHE_UNPIN, - LSN_IMPOSSIBLE, LSN_IMPOSSIBLE, TRUE, TRUE); + LSN_IMPOSSIBLE, LSN_IMPOSSIBLE, FALSE, TRUE); bitmap->pinned_pages.elements= 0; DBUG_VOID_RETURN; } diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index 307befab5c7..159569359f6 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -2743,7 +2743,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info, new_file= -1; change_data_file_descriptor(info, -1); if (maria_change_to_newfile(share->data_file_name.str, MARIA_NAME_DEXT, - DATA_TMP_EXT, + DATA_TMP_EXT, param->backup_time, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0)) | sync_dir) || @@ -3059,7 +3059,7 @@ int maria_sort_index(HA_CHECK *param, register MARIA_HA *info, char *name) pthread_mutex_unlock(&share->intern_lock); VOID(my_close(new_file,MYF(MY_WME))); if (maria_change_to_newfile(share->index_file_name.str, MARIA_NAME_IEXT, - INDEX_TMP_EXT, sync_dir) || + INDEX_TMP_EXT, 0, sync_dir) || _ma_open_keyfile(share)) goto err2; info->lock_type= F_UNLCK; /* Force maria_readinfo to lock */ @@ -3492,20 +3492,15 @@ int maria_zerofill(HA_CHECK *param, MARIA_HA *info, const char *name) */ int maria_change_to_newfile(const char * filename, const char * old_ext, - const char * new_ext, myf MyFlags) + const char * new_ext, time_t backup_time, + myf MyFlags) { char old_filename[FN_REFLEN],new_filename[FN_REFLEN]; -#ifdef USE_RAID - if (raid_chunks) - return my_raid_redel(fn_format(old_filename,filename,"",old_ext,2+4), - fn_format(new_filename,filename,"",new_ext,2+4), - raid_chunks, - MYF(MY_WME | MY_LINK_WARNING | MyFlags)); -#endif /* Get real path to filename */ (void) fn_format(old_filename,filename,"",old_ext,2+4+32); return my_redel(old_filename, fn_format(new_filename,old_filename,"",new_ext,2+4), + backup_time, MYF(MY_WME | MY_LINK_WARNING | MyFlags)); } /* maria_change_to_newfile */ @@ -3875,7 +3870,7 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info, } change_data_file_descriptor(info, -1); if (maria_change_to_newfile(share->data_file_name.str, MARIA_NAME_DEXT, - DATA_TMP_EXT, + DATA_TMP_EXT, param->backup_time, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0)) | sync_dir) || @@ -4500,7 +4495,7 @@ err: my_close(new_file,MYF(0)); info->dfile.file= new_file= -1; if (maria_change_to_newfile(share->data_file_name.str, MARIA_NAME_DEXT, - DATA_TMP_EXT, + DATA_TMP_EXT, param->backup_time, MYF((param->testflag & T_BACKUP_DATA ? MY_REDEL_MAKE_BACKUP : 0) | sync_dir)) || diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index dc99554a08d..ab186b6468d 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -1149,34 +1149,14 @@ static my_bool translog_max_lsn_to_header(File file, LSN lsn) /* - Information from transaction log file header -*/ - -typedef struct st_loghandler_file_info -{ - /* - LSN_IMPOSSIBLE for current file (not finished file). - Maximum LSN of the record which parts stored in the - file. - */ - LSN max_lsn; - ulonglong timestamp; /* Time stamp */ - ulong maria_version; /* Version of maria loghandler */ - ulong mysql_version; /* Version of mysql server */ - ulong server_id; /* Server ID */ - ulong page_size; /* Loghandler page size */ - ulong file_number; /* Number of the file (from the file header) */ -} LOGHANDLER_FILE_INFO; - -/* @brief Extract hander file information from loghandler file page @param desc header information descriptor to be filled with information @param page_buff buffer with the page content */ -static void translog_interpret_file_header(LOGHANDLER_FILE_INFO *desc, - uchar *page_buff) +void translog_interpret_file_header(LOGHANDLER_FILE_INFO *desc, + uchar *page_buff) { uchar *ptr; @@ -2571,10 +2551,7 @@ my_bool translog_prev_buffer_flush_wait(struct st_translog_buffer *buffer) pthread_cond_wait(&buffer->prev_sent_to_disk_cond, &buffer->mutex); if (buffer->file != file || buffer->offset != offset || buffer->ver != ver) - { - translog_buffer_unlock(buffer); DBUG_RETURN(1); /* some the thread flushed the buffer already */ - } } while(buffer->prev_buffer_offset != buffer->prev_sent_to_disk); } DBUG_RETURN(0); @@ -3520,7 +3497,7 @@ my_bool translog_walk_filenames(const char *directory, @brief Fills table of dependence length of page header from page flags */ -static void translog_fill_overhead_table() +void translog_fill_overhead_table() { uint i; for (i= 0; i < TRANSLOG_FLAGS_NUM; i++) @@ -8861,117 +8838,6 @@ void translog_soft_sync_end(void) } -#ifdef MARIA_DUMP_LOG -#include <my_getopt.h> -extern void translog_example_table_init(); -static const char *load_default_groups[]= { "aria_dump_log",0 }; -static void get_options(int *argc,char * * *argv); -#ifndef DBUG_OFF -#if defined(__WIN__) -const char *default_dbug_option= "d:t:i:O,\\aria_dump_log.trace"; -#else -const char *default_dbug_option= "d:t:i:o,/tmp/aria_dump_log.trace"; -#endif -#endif -static ulonglong opt_offset; -static ulong opt_pages; -static const char *opt_file= NULL; -static File handler= -1; -static my_bool opt_unit= 0; -static struct my_option my_long_options[] = -{ -#ifdef IMPLTMENTED - {"body", 'b', - "Print chunk body dump", - (uchar **) &opt_body, (uchar **) &opt_body, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif -#ifndef DBUG_OFF - {"debug", '#', "Output debug log. Often the argument is 'd:t:o,filename'.", - 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, -#endif - {"file", 'f', "Path to file which will be read", - (uchar**) &opt_file, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"help", '?', "Display this help and exit.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - { "offset", 'o', "Start reading log from this offset", - (uchar**) &opt_offset, (uchar**) &opt_offset, - 0, GET_ULL, REQUIRED_ARG, 0, 0, ~(longlong) 0, 0, 0, 0 }, - { "pages", 'n', "Number of pages to read", - (uchar**) &opt_pages, (uchar**) &opt_pages, 0, - GET_ULONG, REQUIRED_ARG, (long) ~(ulong) 0, - (long) 1, (long) ~(ulong) 0, (long) 0, - (long) 1, 0}, - {"unit-test", 'U', - "Use unit test record table (for logs created by unittests", - (uchar **) &opt_unit, (uchar **) &opt_unit, 0, - GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"version", 'V', "Print version and exit.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} -}; - - -static void print_version(void) -{ - VOID(printf("%s Ver 1.0 for %s on %s\n", - my_progname_short, SYSTEM_TYPE, MACHINE_TYPE)); - NETWARE_SET_SCREEN_MODE(1); -} - - -static void usage(void) -{ - print_version(); - puts("Copyright (C) 2008 MySQL AB"); - puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); - puts("and you are welcome to modify and redistribute it under the GPL license\n"); - - puts("Dump content of aria log pages."); - VOID(printf("\nUsage: %s -f file OPTIONS\n", my_progname_short)); - my_print_help(my_long_options); - print_defaults("my", load_default_groups); - my_print_variables(my_long_options); -} - - -static my_bool -get_one_option(int optid __attribute__((unused)), - const struct my_option *opt __attribute__((unused)), - char *argument __attribute__((unused))) -{ - switch (optid) { - case '?': - usage(); - exit(0); - case 'V': - print_version(); - exit(0); -#ifndef DBUG_OFF - case '#': - DBUG_SET_INITIAL(argument ? argument : default_dbug_option); - break; -#endif - } - return 0; -} - - -static void get_options(int *argc,char ***argv) -{ - int ho_error; - - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) - exit(ho_error); - - if (opt_file == NULL) - { - usage(); - exit(1); - } -} - - /** @brief Dump information about file header page. */ @@ -9157,7 +9023,7 @@ static uchar *dump_chunk(uchar *buffer, uchar *ptr) @brief Dump information about page with data. */ -static void dump_datapage(uchar *buffer) +static void dump_datapage(uchar *buffer, File handler) { uchar *ptr; ulong offset; @@ -9238,79 +9104,12 @@ static void dump_datapage(uchar *buffer) @brief Dump information about page. */ -static void dump_page(uchar *buffer) +void dump_page(uchar *buffer, File handler) { - printf("Page by offset %llu (0x%llx)\n", opt_offset, opt_offset); if (strncmp((char*)maria_trans_file_magic, (char*)buffer, sizeof(maria_trans_file_magic)) == 0) { dump_header_page(buffer); } - dump_datapage(buffer); + dump_datapage(buffer, handler); } - - -/** - @brief maria_dump_log main function. -*/ - -int main(int argc, char **argv) -{ - char **default_argv; - uchar buffer[TRANSLOG_PAGE_SIZE]; - MY_INIT(argv[0]); - - load_defaults("my", load_default_groups, &argc, &argv); - default_argv= argv; - get_options(&argc, &argv); - - if (opt_unit) - translog_example_table_init(); - else - translog_table_init(); - translog_fill_overhead_table(); - - maria_data_root= (char *)"."; - - if ((handler= my_open(opt_file, O_RDONLY, MYF(MY_WME))) < 0) - { - fprintf(stderr, "Can't open file: '%s' errno: %d\n", - opt_file, my_errno); - goto err; - } - if (my_seek(handler, opt_offset, SEEK_SET, MYF(MY_WME)) != - opt_offset) - { - fprintf(stderr, "Can't set position %lld file: '%s' errno: %d\n", - opt_offset, opt_file, my_errno); - goto err; - } - for (; - opt_pages; - opt_offset+= TRANSLOG_PAGE_SIZE, opt_pages--) - { - if (my_pread(handler, buffer, TRANSLOG_PAGE_SIZE, opt_offset, - MYF(MY_NABP))) - { - if (my_errno == HA_ERR_FILE_TOO_SHORT) - goto end; - fprintf(stderr, "Can't read page at position %lld file: '%s' " - "errno: %d\n", opt_offset, opt_file, my_errno); - goto err; - } - dump_page(buffer); - } - -end: - my_close(handler, MYF(0)); - free_defaults(default_argv); - exit(0); - return 0; /* No compiler warning */ - -err: - my_close(handler, MYF(0)); - fprintf(stderr, "%s: FAILED\n", my_progname_short); - free_defaults(default_argv); - exit(1); -} -#endif diff --git a/storage/maria/ma_loghandler.h b/storage/maria/ma_loghandler.h index 698a8ead7b6..f33e92e9771 100644 --- a/storage/maria/ma_loghandler.h +++ b/storage/maria/ma_loghandler.h @@ -360,6 +360,7 @@ translog_assign_id_to_share_from_recovery(struct st_maria_share *share, extern my_bool translog_walk_filenames(const char *directory, my_bool (*callback)(const char *, const char *)); +extern void dump_page(uchar *buffer, File handler); extern my_bool translog_log_debug_info(TRN *trn, enum translog_debug_info_type type, uchar *info, size_t length); @@ -386,8 +387,31 @@ void translog_set_group_commit_interval(uint32 interval); ma_loghandler_for_recovery.h ? */ +/* + Information from transaction log file header +*/ + +typedef struct st_loghandler_file_info +{ + /* + LSN_IMPOSSIBLE for current file (not finished file). + Maximum LSN of the record which parts stored in the + file. + */ + LSN max_lsn; + ulonglong timestamp; /* Time stamp */ + ulong maria_version; /* Version of maria loghandler */ + ulong mysql_version; /* Version of mysql server */ + ulong server_id; /* Server ID */ + ulong page_size; /* Loghandler page size */ + ulong file_number; /* Number of the file (from the file header) */ +} LOGHANDLER_FILE_INFO; + #define SHARE_ID_MAX 65535 /* array's size */ +extern void translog_fill_overhead_table(); +extern void translog_interpret_file_header(LOGHANDLER_FILE_INFO *desc, + uchar *page_buff); extern LSN translog_first_lsn_in_log(); extern LSN translog_first_theoretical_lsn(); extern LSN translog_next_LSN(TRANSLOG_ADDRESS addr, TRANSLOG_ADDRESS horizon); diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index 441310a60ea..1bb82ba92cd 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -2037,12 +2037,12 @@ restart: KEYCACHE_DBUG_PRINT("find_block", ("block is dirty")); - pagecache_pthread_mutex_unlock(&pagecache->cache_lock); /* The call is thread safe because only the current thread might change the block->hash_link value */ DBUG_ASSERT(block->pins == 0); + pagecache_pthread_mutex_unlock(&pagecache->cache_lock); error= pagecache_fwrite(pagecache, &block->hash_link->file, block->buffer, @@ -2255,14 +2255,17 @@ static my_bool pagecache_wait_lock(PAGECACHE *pagecache, #endif PCBLOCK_INFO(block); if ((block->status & (PCBLOCK_REASSIGNED | PCBLOCK_IN_SWITCH)) || + !block->hash_link || file.file != block->hash_link->file.file || pageno != block->hash_link->pageno) { DBUG_PRINT("info", ("the block 0x%lx changed => need retry " "status: %x files %d != %d or pages %lu != %lu", (ulong)block, block->status, - file.file, block->hash_link->file.file, - (ulong) pageno, (ulong) block->hash_link->pageno)); + file.file, + block->hash_link ? block->hash_link->file.file : -1, + (ulong) pageno, + (ulong) (block->hash_link ? block->hash_link->pageno : 0))); DBUG_RETURN(1); } DBUG_RETURN(0); @@ -2611,12 +2614,12 @@ static void read_block(PAGECACHE *pagecache, */ pagecache->global_cache_read++; - /* Page is not in buffer yet, is to be read from disk */ - pagecache_pthread_mutex_unlock(&pagecache->cache_lock); /* + Page is not in buffer yet, is to be read from disk Here other threads may step in and register as secondary readers. They will register in block->wqueue[COND_FOR_REQUESTED]. */ + pagecache_pthread_mutex_unlock(&pagecache->cache_lock); error= pagecache_fread(pagecache, &block->hash_link->file, block->buffer, block->hash_link->pageno, @@ -3450,6 +3453,14 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache, my_bool flush) { my_bool error= 0; + if (block->status & PCBLOCK_IN_FLUSH) + { + /* + this call is just 'hint' for the cache to free the page so we will + not interferes with flushing process but gust return success + */ + goto out; + } if (block->status & PCBLOCK_CHANGED) { if (flush) @@ -3458,12 +3469,12 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache, KEYCACHE_DBUG_PRINT("find_block", ("block is dirty")); - pagecache_pthread_mutex_unlock(&pagecache->cache_lock); /* The call is thread safe because only the current thread might change the block->hash_link value */ DBUG_ASSERT(block->pins == 1); + pagecache_pthread_mutex_unlock(&pagecache->cache_lock); error= pagecache_fwrite(pagecache, &block->hash_link->file, block->buffer, @@ -3478,7 +3489,26 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache, block->status|= PCBLOCK_ERROR; block->error= (int16) my_errno; my_debug_put_break_here(); - goto err; + goto out; + } + } + else + { + PAGECACHE_FILE *filedesc= &block->hash_link->file; + /* We are not going to write the page but have to call callbacks */ + DBUG_PRINT("info", ("flush_callback :0x%lx" + "write_callback: 0x%lx data: 0x%lx", + (ulong) filedesc->flush_log_callback, + (ulong) filedesc->write_callback, + (ulong) filedesc->callback_data)); + if ((*filedesc->flush_log_callback) + (block->buffer, block->hash_link->pageno, filedesc->callback_data) || + (*filedesc->write_callback) + (block->buffer, block->hash_link->pageno, filedesc->callback_data)) + { + DBUG_PRINT("error", ("flush or write callback problem")); + error= 1; + goto out; } } pagecache->blocks_changed--; @@ -3498,7 +3528,7 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache, /* See NOTE for pagecache_unlock about registering requests. */ free_block(pagecache, block); -err: +out: dec_counter_for_resize_op(pagecache); return error; } @@ -4087,6 +4117,7 @@ static void free_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block) ("block: %u hash_link 0x%lx", PCBLOCK_NUMBER(pagecache, block), (long) block->hash_link)); + safe_mutex_assert_owner(&pagecache->cache_lock); if (block->hash_link) { /* @@ -4114,6 +4145,8 @@ static void free_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block) KEYCACHE_DBUG_PRINT("free_block", ("block is freed")); unreg_request(pagecache, block, 0); + DBUG_ASSERT(block->requests == 0); + DBUG_ASSERT(block->next_used != 0); block->hash_link= NULL; /* Remove the free block from the LRU ring. */ @@ -4223,7 +4256,6 @@ static int flush_cached_blocks(PAGECACHE *pagecache, DBUG_PRINT("info", ("block: %u (0x%lx) to be flushed", PCBLOCK_NUMBER(pagecache, block), (ulong)block)); PCBLOCK_INFO(block); - pagecache_pthread_mutex_unlock(&pagecache->cache_lock); DBUG_PRINT("info", ("block: %u (0x%lx) pins: %u", PCBLOCK_NUMBER(pagecache, block), (ulong)block, block->pins)); @@ -4237,6 +4269,7 @@ static int flush_cached_blocks(PAGECACHE *pagecache, content (see StaleFilePointersInFlush in ma_checkpoint.c). @todo change argument of functions to be File. */ + pagecache_pthread_mutex_unlock(&pagecache->cache_lock); error= pagecache_fwrite(pagecache, &block->hash_link->file, block->buffer, block->hash_link->pageno, diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c index 4e19d5878ea..714b9511279 100644 --- a/storage/maria/maria_chk.c +++ b/storage/maria/maria_chk.c @@ -1211,7 +1211,7 @@ static int maria_chk(HA_CHECK *param, char *filename) { /* Change temp file to org file */ VOID(my_close(info->dfile.file, MYF(MY_WME))); /* Close new file */ error|=maria_change_to_newfile(filename,MARIA_NAME_DEXT,DATA_TMP_EXT, - MYF(0)); + 0, MYF(0)); if (_ma_open_datafile(info,info->s, NullS, -1)) error=1; param->out_flag&= ~O_NEW_DATA; /* We are using new datafile */ @@ -1349,11 +1349,9 @@ end2: { if (param->out_flag & O_NEW_DATA) error|=maria_change_to_newfile(filename,MARIA_NAME_DEXT,DATA_TMP_EXT, + param->backup_time, ((param->testflag & T_BACKUP_DATA) ? MYF(MY_REDEL_MAKE_BACKUP) : MYF(0))); - if (param->out_flag & O_NEW_INDEX) - error|=maria_change_to_newfile(filename,MARIA_NAME_IEXT,INDEX_TMP_EXT, - MYF(0)); } if (opt_transaction_logging && share->base.born_transactional && !error && @@ -1457,7 +1455,8 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name) printf("UUID: %s\n", buff); pos=buff; if (share->state.changed & STATE_CRASHED) - strmov(buff,"crashed"); + strmov(buff, share->state.changed & STATE_CRASHED_ON_REPAIR ? + "crashed on repair" : "crashed"); else { if (share->state.open_count) diff --git a/storage/maria/maria_dump_log.c b/storage/maria/maria_dump_log.c new file mode 100644 index 00000000000..f01eee1ad96 --- /dev/null +++ b/storage/maria/maria_dump_log.c @@ -0,0 +1,190 @@ +/* Copyright (C) 2007 MySQL AB & Sanja Belkin + + 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 */ + +#include "maria_def.h" +#include <my_getopt.h> +extern void translog_example_table_init(); +static const char *load_default_groups[]= { "aria_dump_log",0 }; +static void get_options(int *argc,char * * *argv); +#ifndef DBUG_OFF +#if defined(__WIN__) +const char *default_dbug_option= "d:t:i:O,\\aria_dump_log.trace"; +#else +const char *default_dbug_option= "d:t:i:o,/tmp/aria_dump_log.trace"; +#endif +#endif +static ulonglong opt_offset; +static ulong opt_pages; +static const char *opt_file= NULL; +static File handler= -1; +static my_bool opt_unit= 0; +static struct my_option my_long_options[] = +{ +#ifdef IMPLTMENTED + {"body", 'b', + "Print chunk body dump", + (uchar **) &opt_body, (uchar **) &opt_body, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, +#endif +#ifndef DBUG_OFF + {"debug", '#', "Output debug log. Often the argument is 'd:t:o,filename'.", + 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, +#endif + {"file", 'f', "Path to file which will be read", + (uchar**) &opt_file, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"help", '?', "Display this help and exit.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + { "offset", 'o', "Start reading log from this offset", + (uchar**) &opt_offset, (uchar**) &opt_offset, + 0, GET_ULL, REQUIRED_ARG, 0, 0, ~(longlong) 0, 0, 0, 0 }, + { "pages", 'n', "Number of pages to read", + (uchar**) &opt_pages, (uchar**) &opt_pages, 0, + GET_ULONG, REQUIRED_ARG, (long) ~(ulong) 0, + (long) 1, (long) ~(ulong) 0, (long) 0, + (long) 1, 0}, + {"unit-test", 'U', + "Use unit test record table (for logs created by unittests", + (uchar **) &opt_unit, (uchar **) &opt_unit, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"version", 'V', "Print version and exit.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} +}; + + +static void print_version(void) +{ + VOID(printf("%s Ver 1.0 for %s on %s\n", + my_progname_short, SYSTEM_TYPE, MACHINE_TYPE)); + NETWARE_SET_SCREEN_MODE(1); +} + + +static void usage(void) +{ + print_version(); + puts("Copyright (C) 2008 MySQL AB"); + puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,"); + puts("and you are welcome to modify and redistribute it under the GPL license\n"); + + puts("Dump content of aria log pages."); + VOID(printf("\nUsage: %s -f file OPTIONS\n", my_progname_short)); + my_print_help(my_long_options); + print_defaults("my", load_default_groups); + my_print_variables(my_long_options); +} + + +static my_bool +get_one_option(int optid __attribute__((unused)), + const struct my_option *opt __attribute__((unused)), + char *argument __attribute__((unused))) +{ + switch (optid) { + case '?': + usage(); + exit(0); + case 'V': + print_version(); + exit(0); +#ifndef DBUG_OFF + case '#': + DBUG_SET_INITIAL(argument ? argument : default_dbug_option); + break; +#endif + } + return 0; +} + + +static void get_options(int *argc,char ***argv) +{ + int ho_error; + + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + exit(ho_error); + + if (opt_file == NULL) + { + usage(); + exit(1); + } +} + + +/** + @brief maria_dump_log main function. +*/ + +int main(int argc, char **argv) +{ + char **default_argv; + uchar buffer[TRANSLOG_PAGE_SIZE]; + MY_INIT(argv[0]); + + load_defaults("my", load_default_groups, &argc, &argv); + default_argv= argv; + get_options(&argc, &argv); + + if (opt_unit) + translog_example_table_init(); + else + translog_table_init(); + translog_fill_overhead_table(); + + maria_data_root= (char *)"."; + + if ((handler= my_open(opt_file, O_RDONLY, MYF(MY_WME))) < 0) + { + fprintf(stderr, "Can't open file: '%s' errno: %d\n", + opt_file, my_errno); + goto err; + } + if (my_seek(handler, opt_offset, SEEK_SET, MYF(MY_WME)) != + opt_offset) + { + fprintf(stderr, "Can't set position %lld file: '%s' errno: %d\n", + opt_offset, opt_file, my_errno); + goto err; + } + for (; + opt_pages; + opt_offset+= TRANSLOG_PAGE_SIZE, opt_pages--) + { + if (my_pread(handler, buffer, TRANSLOG_PAGE_SIZE, opt_offset, + MYF(MY_NABP))) + { + if (my_errno == HA_ERR_FILE_TOO_SHORT) + goto end; + fprintf(stderr, "Can't read page at position %lld file: '%s' " + "errno: %d\n", opt_offset, opt_file, my_errno); + goto err; + } + printf("Page by offset %llu (0x%llx)\n", opt_offset, opt_offset); + dump_page(buffer, handler); + } + +end: + my_close(handler, MYF(0)); + free_defaults(default_argv); + exit(0); + return 0; /* No compiler warning */ + +err: + my_close(handler, MYF(0)); + fprintf(stderr, "%s: FAILED\n", my_progname_short); + free_defaults(default_argv); + exit(1); +} diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c index 29f8bedff44..5b1ec916248 100644 --- a/storage/maria/maria_pack.c +++ b/storage/maria/maria_pack.c @@ -736,7 +736,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) VOID(my_delete(new_name,MYF(MY_WME))); } else - error=my_redel(org_name,new_name,MYF(MY_WME | MY_COPYTIME)); + error=my_redel(org_name, new_name, 0, MYF(MY_WME | MY_COPYTIME)); } if (! error) error=save_state(isam_file,mrg,new_length,glob_crc); diff --git a/storage/maria/plug.in b/storage/maria/plug.in index 008d82250c8..c48928be44f 100644 --- a/storage/maria/plug.in +++ b/storage/maria/plug.in @@ -1,8 +1,7 @@ MYSQL_STORAGE_ENGINE(aria,, [Aria Storage Engine], [Crash-safe tables with MyISAM heritage], [default,max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(aria, [storage/maria]) -MYSQL_PLUGIN_STATIC(aria, [libaria.a]) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(aria, [ha_maria.cc]) +MYSQL_PLUGIN_STATIC(aria, [libaria_s.la], [libaria_embedded.la]) MYSQL_PLUGIN_ACTIONS(aria, [ # AC_CONFIG_FILES(storage/maria/unittest/Makefile) diff --git a/storage/myisam/Makefile.am b/storage/myisam/Makefile.am index ea942672856..8f3d51c4886 100644 --- a/storage/myisam/Makefile.am +++ b/storage/myisam/Makefile.am @@ -31,6 +31,10 @@ EXTRA_DIST = mi_test_all.sh mi_test_all.res ft_stem.c CMakeLists.txt plug.in pkgdata_DATA = pkglib_LIBRARIES = libmyisam.a +noinst_LTLIBRARIES = libmyisam.la libmyisam_s.la \ + @plugin_myisam_embedded_static_target@ +EXTRA_LTLIBRARIES = libmyisam_embedded.la + bin_PROGRAMS = myisamchk myisamlog myisampack myisam_ftdump myisamchk_DEPENDENCIES= $(LIBRARIES) myisamchk_LDADD= @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \ @@ -83,7 +87,8 @@ 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 \ + +libmyisam_la_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 \ @@ -98,8 +103,19 @@ libmyisam_a_SOURCES = mi_open.c mi_extra.c mi_info.c mi_rkey.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 ft_myisam.c \ + sort.c ft_myisam.c \ rt_index.c rt_key.c rt_mbr.c rt_split.c sp_key.c +libmyisam_s_la_SOURCES = ha_myisam.cc +libmyisam_s_la_CXXFLAGS = $(AM_CXXFLAGS) +libmyisam_s_la_LIBADD = libmyisam.la +libmyisam_embedded_la_SOURCES = ha_myisam.cc +libmyisam_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ +libmyisam_embedded_la_LIBADD = libmyisam.la + +libmyisam_a_SOURCES= +libmyisam.a: libmyisam.la + $(CP) .libs/libmyisam.a $@ + CLEANFILES = test?.MY? FT?.MY? isam.log mi_test_all rt_test.MY? sp_test.MY? # Move to automake rules ? diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 39791ff254c..d3d073d2fbe 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -33,7 +33,7 @@ ulong myisam_recover_options= HA_RECOVER_NONE; /* bits in myisam_recover_options */ const char *myisam_recover_names[] = -{ "DEFAULT", "BACKUP", "FORCE", "QUICK", NullS}; +{ "DEFAULT", "BACKUP", "FORCE", "QUICK", "BACKUP_ALL", NullS}; TYPELIB myisam_recover_typelib= {array_elements(myisam_recover_names)-1,"", myisam_recover_names, NULL}; @@ -1055,6 +1055,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) T_SILENT | T_FORCE_CREATE | T_CALC_CHECKSUM | (check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT)); param.sort_buffer_length= thd->variables.myisam_sort_buff_size; + param.backup_time= check_opt->start_time; start_records=file->state->records; while ((error=repair(thd,param,0)) && param.retry_repair) { @@ -1659,8 +1660,18 @@ bool ha_myisam::check_and_repair(THD *thd) if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt)) { sql_print_warning("Recovering table: '%s'",table->s->path.str); + if (myisam_recover_options & (HA_RECOVER_FULL_BACKUP | HA_RECOVER_BACKUP)) + { + char buff[MY_BACKUP_NAME_EXTRA_LENGTH+1]; + my_create_backup_name(buff, "", check_opt.start_time); + sql_print_information("Making backup of data with extension '%s'", buff); + } + if (myisam_recover_options & HA_RECOVER_FULL_BACKUP) + mi_make_backup_of_index(file, check_opt.start_time, + MYF(MY_WME | ME_JUST_WARNING)); check_opt.flags= - ((myisam_recover_options & HA_RECOVER_BACKUP ? T_BACKUP_DATA : 0) | + (((myisam_recover_options & + (HA_RECOVER_BACKUP | HA_RECOVER_FULL_BACKUP)) ? T_BACKUP_DATA : 0) | (marked_crashed ? 0 : T_QUICK) | (myisam_recover_options & HA_RECOVER_FORCE ? 0 : T_SAFE_REPAIR) | T_AUTO_REPAIR); diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index 9d8791c7eff..0cb89b64c3c 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -29,6 +29,7 @@ #define HA_RECOVER_BACKUP 2 /* Make a backupfile on recover */ #define HA_RECOVER_FORCE 4 /* Recover even if we loose rows */ #define HA_RECOVER_QUICK 8 /* Don't check rows in data file */ +#define HA_RECOVER_FULL_BACKUP 16 /* Make a copy of index file too */ extern ulong myisam_sort_buffer_size; extern TYPELIB myisam_recover_typelib; diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index d24dba3d6b3..e92c9879e57 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -1736,7 +1736,9 @@ err: my_close(new_file,MYF(0)); info->dfile=new_file= -1; if (change_to_newfile(share->data_file_name,MI_NAME_DEXT, - DATA_TMP_EXT, share->base.raid_chunks, + DATA_TMP_EXT, + param->backup_time, + share->base.raid_chunks, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) || mi_open_datafile(info,share,name,-1)) @@ -1997,8 +1999,8 @@ int mi_sort_index(HA_CHECK *param, register MI_INFO *info, char * name) VOID(my_close(share->kfile,MYF(MY_WME))); share->kfile = -1; VOID(my_close(new_file,MYF(MY_WME))); - if (change_to_newfile(share->index_file_name,MI_NAME_IEXT,INDEX_TMP_EXT,0, - MYF(0)) || + if (change_to_newfile(share->index_file_name,MI_NAME_IEXT,INDEX_TMP_EXT, + 0, 0, MYF(0)) || mi_open_keyfile(share)) goto err2; info->lock_type= F_UNLCK; /* Force mi_readinfo to lock */ @@ -2127,6 +2129,7 @@ err: int change_to_newfile(const char * filename, const char * old_ext, const char * new_ext, + time_t backup_time, uint raid_chunks __attribute__((unused)), myf MyFlags) { @@ -2142,7 +2145,7 @@ int change_to_newfile(const char * filename, const char * old_ext, (void) fn_format(old_filename,filename,"",old_ext,2+4+32); return my_redel(old_filename, fn_format(new_filename,old_filename,"",new_ext,2+4), - MYF(MY_WME | MY_LINK_WARNING | MyFlags)); + backup_time, MYF(MY_WME | MY_LINK_WARNING | MyFlags)); } /* change_to_newfile */ @@ -2551,7 +2554,8 @@ err: my_close(new_file,MYF(0)); info->dfile=new_file= -1; if (change_to_newfile(share->data_file_name,MI_NAME_DEXT, - DATA_TMP_EXT, share->base.raid_chunks, + DATA_TMP_EXT, param->backup_time, + share->base.raid_chunks, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) || mi_open_datafile(info,share,name,-1)) @@ -3089,7 +3093,8 @@ err: my_close(new_file,MYF(0)); info->dfile=new_file= -1; if (change_to_newfile(share->data_file_name,MI_NAME_DEXT, - DATA_TMP_EXT, share->base.raid_chunks, + DATA_TMP_EXT, param->backup_time, + share->base.raid_chunks, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0))) || mi_open_datafile(info,share,name,-1)) @@ -4751,3 +4756,10 @@ set_data_file_type(MI_SORT_INFO *sort_info, MYISAM_SHARE *share) share->delete_record=tmp.delete_record; } } + +int mi_make_backup_of_index(MI_INFO *info, time_t backup_time, myf flags) +{ + char backup_name[FN_REFLEN + MY_BACKUP_NAME_EXTRA_LENGTH]; + my_create_backup_name(backup_name, info->s->index_file_name, backup_time); + return my_copy(info->s->index_file_name, backup_name, flags); +} diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 592426a3690..8c54d7f0411 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -1032,7 +1032,7 @@ static int myisamchk(HA_CHECK *param, char * filename) { /* Change temp file to org file */ VOID(my_close(info->dfile,MYF(MY_WME))); /* Close new file */ error|=change_to_newfile(filename,MI_NAME_DEXT,DATA_TMP_EXT, - raid_chunks, + 0, raid_chunks, MYF(0)); if (mi_open_datafile(info,info->s, NULL, -1)) error=1; @@ -1165,12 +1165,9 @@ end2: { if (param->out_flag & O_NEW_DATA) error|=change_to_newfile(filename,MI_NAME_DEXT,DATA_TMP_EXT, - raid_chunks, + param->backup_time, raid_chunks, ((param->testflag & T_BACKUP_DATA) ? MYF(MY_REDEL_MAKE_BACKUP) : MYF(0))); - if (param->out_flag & O_NEW_INDEX) - error|=change_to_newfile(filename,MI_NAME_IEXT,INDEX_TMP_EXT,0, - MYF(0)); } VOID(fflush(stdout)); VOID(fflush(stderr)); if (param->error_printed) @@ -1242,7 +1239,8 @@ static void descript(HA_CHECK *param, register MI_INFO *info, char * name) } pos=buff; if (share->state.changed & STATE_CRASHED) - strmov(buff,"crashed"); + strmov(buff, share->state.changed & STATE_CRASHED_ON_REPAIR ? + "crashed on repair" : "crashed"); else { if (share->state.open_count) diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index f2b28a008fc..ba3ff3cdf0d 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -720,7 +720,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) VOID(my_delete(new_name,MYF(MY_WME))); } else - error=my_redel(org_name,new_name,MYF(MY_WME | MY_COPYTIME)); + error=my_redel(org_name, new_name, 0, MYF(MY_WME | MY_COPYTIME)); } if (! error) error=save_state(isam_file,mrg,new_length,glob_crc); diff --git a/storage/myisam/plug.in b/storage/myisam/plug.in index e92b5e56d7f..95b29336493 100644 --- a/storage/myisam/plug.in +++ b/storage/myisam/plug.in @@ -1,7 +1,6 @@ dnl MYSQL_STORAGE_ENGINE(myisam,no, [MyISAM Storage Engine], dnl [Traditional non-transactional MySQL tables]) dnl MYSQL_PLUGIN_DIRECTORY(myisam, [storage/myisam]) -dnl MYSQL_PLUGIN_STATIC(myisam, [libmyisam.a]) +dnl MYSQL_PLUGIN_STATIC(myisam, [libmyisam_s.la], [libmyisam_embedded.la]) dnl MYSQL_PLUGIN_MANDATORY(myisam) dnl Default -dnl MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(myisam, [ha_myisam.cc]) diff --git a/storage/myisammrg/Makefile.am b/storage/myisammrg/Makefile.am index 1ca51bc9d03..66fd2402646 100644 --- a/storage/myisammrg/Makefile.am +++ b/storage/myisammrg/Makefile.am @@ -27,16 +27,26 @@ LDADD = DEFS = @DEFS@ pkglib_LIBRARIES = libmyisammrg.a +noinst_LTLIBRARIES = libmyisammrg.la libmyisammrg_s.la \ + @plugin_myisammrg_embedded_static_target@ +EXTRA_LTLIBRARIES = libmyisammrg_embedded.la 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 \ +libmyisammrg_la_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 +libmyisammrg_s_la_SOURCES = ha_myisammrg.cc +libmyisammrg_s_la_CXXFLAGS = $(AM_CXXFLAGS) +libmyisammrg_s_la_LIBADD = libmyisammrg.la +libmyisammrg_embedded_la_SOURCES = ha_myisammrg.cc +libmyisammrg_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ +libmyisammrg_embedded_la_LIBADD = libmyisammrg.la +libmyisammrg_a_SOURCES= +libmyisammrg.a: libmyisammrg.la + $(CP) .libs/libmyisammrg.a $@ EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/myisammrg/plug.in b/storage/myisammrg/plug.in index 1f94e07d881..a2654373fba 100644 --- a/storage/myisammrg/plug.in +++ b/storage/myisammrg/plug.in @@ -1,6 +1,5 @@ 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_STATIC(myisammrg, [libmyisammrg_s.la], [libmyisammrg_embedded.la]) MYSQL_PLUGIN_MANDATORY(myisammrg) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(myisammrg, [ha_myisammrg.cc]) diff --git a/storage/oqgraph/plug.in b/storage/oqgraph/plug.in index 38c8310a915..d5ebe2e232a 100644 --- a/storage/oqgraph/plug.in +++ b/storage/oqgraph/plug.in @@ -1,7 +1,6 @@ MYSQL_STORAGE_ENGINE(oqgraph,,[Graph Storage Engine], [Open Query Graph Computation Engine], []) MYSQL_PLUGIN_DYNAMIC(oqgraph, [ha_oqgraph.la]) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(oqgraph, [ha_oqgraph.cc]) MYSQL_PLUGIN_ACTIONS(oqgraph,[ AC_LANG_PUSH([C++]) AC_MSG_CHECKING([whether compiler supports -fvisibility-inlines-hidden]) diff --git a/storage/pbxt/plug.in b/storage/pbxt/plug.in index 02c5d8adcbe..c0dc06d9702 100644 --- a/storage/pbxt/plug.in +++ b/storage/pbxt/plug.in @@ -1,8 +1,7 @@ MYSQL_STORAGE_ENGINE(pbxt,no, [PBXT Storage Engine], [MVCC-based transactional engine], [max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(pbxt, [storage/pbxt]) -MYSQL_PLUGIN_STATIC(pbxt, [src/libpbxt.a]) +MYSQL_PLUGIN_STATIC(pbxt, [src/libpbxt_s.la], [src/libpbxt_s_embedded.la]) MYSQL_PLUGIN_ACTIONS(pbxt, [ # AC_CONFIG_FILES(storage/pbxt/src/Makefile) ]) -MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(pbxt, [[src/ha_pbxt.cc],[src/myxt_xt.cc],[src/discover_xt.cc]]) diff --git a/storage/pbxt/src/Makefile.am b/storage/pbxt/src/Makefile.am index fc4c4ef8f1e..4c5467d24d0 100644 --- a/storage/pbxt/src/Makefile.am +++ b/storage/pbxt/src/Makefile.am @@ -26,25 +26,31 @@ noinst_HEADERS = bsearch_xt.h cache_xt.h ccutils_xt.h database_xt.h \ pbms.h xt_config.h xt_defs.h xt_errno.h locklist_xt.h EXTRA_LTLIBRARIES = libpbxt.la -libpbxt_la_SOURCES = bsearch_xt.cc cache_xt.cc ccutils_xt.cc database_xt.cc \ +non_mysql_internal_sources = bsearch_xt.cc cache_xt.cc ccutils_xt.cc database_xt.cc \ datadic_xt.cc datalog_xt.cc filesys_xt.cc hashtab_xt.cc \ - ha_pbxt.cc heap_xt.cc index_xt.cc linklist_xt.cc \ - memory_xt.cc myxt_xt.cc pthread_xt.cc restart_xt.cc \ + heap_xt.cc index_xt.cc linklist_xt.cc \ + memory_xt.cc pthread_xt.cc restart_xt.cc \ sortedlist_xt.cc strutil_xt.cc \ tabcache_xt.cc table_xt.cc trace_xt.cc thread_xt.cc \ - systab_xt.cc ha_xtsys.cc discover_xt.cc backup_xt.cc \ + systab_xt.cc ha_xtsys.cc backup_xt.cc \ util_xt.cc xaction_xt.cc xactlog_xt.cc lock_xt.cc locklist_xt.cc - -libpbxt_la_LDFLAGS = -module +mysql_internal_sources = ha_pbxt.cc myxt_xt.cc discover_xt.cc +libpbxt_la_SOURCES = $(non_mysql_internal_sources) $(mysql_internal_sources) # These are the warning Drizzle uses: # DRIZZLE_WARNINGS = -W -Wall -Wextra -pedantic -Wundef -Wredundant-decls -Wno-strict-aliasing -Wno-long-long -Wno-unused-parameter -libpbxt_la_CXXFLAGS = $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN -libpbxt_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -std=c99 +libpbxt_la_CXXFLAGS = -shared $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN +libpbxt_la_CFLAGS = -shared $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -std=c99 +libpbxt_la_LDFLAGS = -module + +noinst_LTLIBRARIES = libpbxt_s.la libpbxt_s_embedded.la libpbxt_s_common.la -EXTRA_LIBRARIES = libpbxt.a -noinst_LIBRARIES = libpbxt.a -libpbxt_a_SOURCES = $(libpbxt_la_SOURCES) +libpbxt_s_common_la_SOURCES = $(non_mysql_internal_sources) +libpbxt_s_la_SOURCES = $(mysql_internal_sources) +libpbxt_s_la_LIBADD = libpbxt_s_common.la +libpbxt_s_embedded_la_SOURCES = $(mysql_internal_sources) +libpbxt_s_embedded_la_CXXFLAGS = $(AM_CXXFLAGS) @plugin_embedded_defs@ +libpbxt_s_embedded_la_LIBADD = libpbxt_s_common.la EXTRA_DIST = pbms_enabled.cc win_inttypes.h diff --git a/storage/sphinx/Makefile.am b/storage/sphinx/Makefile.am index 5f58d673547..6f9c7bc1ae2 100644 --- a/storage/sphinx/Makefile.am +++ b/storage/sphinx/Makefile.am @@ -30,7 +30,7 @@ DEFS= @DEFS@ -D_REENTRANT -D_PTHREADS -DMYSQL_SERVER noinst_HEADERS = ha_sphinx.h -EXTRA_LTLIBRARIES = ha_sphinx.la +EXTRA_LTLIBRARIES = libsphinx.la ha_sphinx.la pkgplugin_LTLIBRARIES = @plugin_sphinx_shared_target@ sphinx.la ha_sphinx_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) \ @@ -44,11 +44,10 @@ sphinx_la_CXXFLAGS = $(AM_CFLAGS) sphinx_la_CFLAGS = $(AM_CFLAGS) sphinx_la_SOURCES = snippets_udf.cc -EXTRA_LIBRARIES = libsphinx.a -noinst_LIBRARIES = @plugin_sphinx_static_target@ -libsphinx_a_CXXFLAGS = $(AM_CFLAGS) -libsphinx_a_CFLAGS = $(AM_CFLAGS) -libsphinx_a_SOURCES= ha_sphinx.cc +noinst_LTLIBRARIES = @plugin_sphinx_static_target@ +libsphinx_la_CXXFLAGS = $(AM_CFLAGS) +libsphinx_la_CFLAGS = $(AM_CFLAGS) +libsphinx_la_SOURCES= ha_sphinx.cc EXTRA_DIST = CMakeLists.txt # Don't update the files from bitkeeper diff --git a/storage/sphinx/plug.in b/storage/sphinx/plug.in index 6c96e41ae52..2c07584465e 100644 --- a/storage/sphinx/plug.in +++ b/storage/sphinx/plug.in @@ -1,6 +1,6 @@ MYSQL_STORAGE_ENGINE(sphinx,,[Sphinx Storage Engine], [SE client for Sphinx search daemon], []) MYSQL_PLUGIN_DIRECTORY(sphinx, [storage/sphinx]) -MYSQL_PLUGIN_STATIC(sphinx, [libsphinx.a]) +MYSQL_PLUGIN_STATIC(sphinx, [libsphinx.la]) MYSQL_PLUGIN_DYNAMIC(sphinx, [ha_sphinx.la]) diff --git a/storage/xtradb/Makefile.am b/storage/xtradb/Makefile.am index 0a6d7ddefb6..cb1e20436f4 100644 --- a/storage/xtradb/Makefile.am +++ b/storage/xtradb/Makefile.am @@ -229,9 +229,8 @@ noinst_HEADERS= \ handler/innodb_patch_info.h \ mem/mem0dbg.c -EXTRA_LIBRARIES= libxtradb.a -noinst_LIBRARIES= @plugin_xtradb_static_target@ -libxtradb_a_SOURCES= \ +noinst_LTLIBRARIES= @plugin_xtradb_static_target@ +libxtradb_la_SOURCES= \ btr/btr0btr.c \ btr/btr0cur.c \ btr/btr0pcur.c \ @@ -326,16 +325,16 @@ libxtradb_a_SOURCES= \ ut/ut0vec.c \ ut/ut0wqueue.c -libxtradb_a_CXXFLAGS= $(AM_CXXFLAGS) -libxtradb_a_CFLAGS= $(AM_CFLAGS) +libxtradb_la_CXXFLAGS= $(AM_CXXFLAGS) +libxtradb_la_CFLAGS= $(AM_CFLAGS) -EXTRA_LTLIBRARIES= ha_xtradb.la +EXTRA_LTLIBRARIES= libxtradb.la ha_xtradb.la pkgplugin_LTLIBRARIES= @plugin_xtradb_shared_target@ ha_xtradb_la_LDFLAGS= -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices ha_xtradb_la_CXXFLAGS= -shared $(AM_CXXFLAGS) $(INNODB_DYNAMIC_CFLAGS) ha_xtradb_la_CFLAGS= -shared $(AM_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) -ha_xtradb_la_SOURCES= $(libxtradb_a_SOURCES) +ha_xtradb_la_SOURCES= $(libxtradb_la_SOURCES) EXTRA_DIST= CMakeLists.txt plug.in \ pars/make_bison.sh pars/make_flex.sh \ diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h index 8c64d5cee71..f4c9704741c 100644 --- a/storage/xtradb/include/srv0srv.h +++ b/storage/xtradb/include/srv0srv.h @@ -57,8 +57,8 @@ extern const char srv_mysql50_table_name_prefix[9]; thread starts running */ extern os_event_t srv_lock_timeout_thread_event; -/* This event is set to tell the purge thread to shut down */ -extern os_event_t srv_purge_thread_event; +/* This event is set at shutdown to wakeup threads from sleep */ +extern os_event_t srv_shutdown_event; /* If the last data file is auto-extended, we add this many pages to it at a time */ diff --git a/storage/xtradb/log/log0log.c b/storage/xtradb/log/log0log.c index b9f19aeff31..3f14d84ac72 100644 --- a/storage/xtradb/log/log0log.c +++ b/storage/xtradb/log/log0log.c @@ -3102,7 +3102,7 @@ logs_empty_and_mark_files_at_shutdown(void) algorithm only works if the server is idle at shutdown */ srv_shutdown_state = SRV_SHUTDOWN_CLEANUP; - os_event_set(srv_purge_thread_event); + os_event_set(srv_shutdown_event); loop: os_thread_sleep(100000); diff --git a/storage/xtradb/plug.in b/storage/xtradb/plug.in index 37c895fb520..67f25755762 100644 --- a/storage/xtradb/plug.in +++ b/storage/xtradb/plug.in @@ -17,7 +17,7 @@ MYSQL_STORAGE_ENGINE(xtradb, xtradb, [XtraDB Storage Engine], [XtraDB - a drop-in replacement for InnoDB], [max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(xtradb, [storage/xtradb]) -MYSQL_PLUGIN_STATIC(xtradb, [libxtradb.a]) +MYSQL_PLUGIN_STATIC(xtradb, [libxtradb.la]) MYSQL_PLUGIN_DYNAMIC(xtradb, [ha_xtradb.la]) MYSQL_PLUGIN_ACTIONS(xtradb, [ with_plugin_innobase=$with_plugin_xtradb # for legacy code in configure.in diff --git a/storage/xtradb/srv/srv0srv.c b/storage/xtradb/srv/srv0srv.c index 43799aab196..35745072445 100644 --- a/storage/xtradb/srv/srv0srv.c +++ b/storage/xtradb/srv/srv0srv.c @@ -704,7 +704,7 @@ UNIV_INTERN srv_slot_t* srv_mysql_table = NULL; UNIV_INTERN os_event_t srv_lock_timeout_thread_event; -UNIV_INTERN os_event_t srv_purge_thread_event; +UNIV_INTERN os_event_t srv_shutdown_event; UNIV_INTERN srv_sys_t* srv_sys = NULL; @@ -1011,7 +1011,7 @@ srv_init(void) } srv_lock_timeout_thread_event = os_event_create(NULL); - srv_purge_thread_event = os_event_create(NULL); + srv_shutdown_event = os_event_create(NULL); for (i = 0; i < SRV_MASTER + 1; i++) { srv_n_threads_active[i] = 0; @@ -2239,7 +2239,7 @@ loop: /* Wake up every 5 seconds to see if we need to print monitor information. */ - os_thread_sleep(5000000); + os_event_wait_time(srv_shutdown_event, 5000000); current_time = time(NULL); @@ -2381,7 +2381,7 @@ loop: /* When someone is waiting for a lock, we wake up every second and check if a timeout has passed for a lock wait */ - os_thread_sleep(1000000); + os_event_wait_time(srv_shutdown_event, 1000000); srv_lock_timeout_active = TRUE; @@ -2546,7 +2546,7 @@ loop: fflush(stderr); - os_thread_sleep(1000000); + os_event_wait_time(srv_shutdown_event, 1000000); if (srv_shutdown_state < SRV_SHUTDOWN_CLEANUP) { @@ -2590,7 +2590,7 @@ srv_LRU_dump_restore_thread( last_dump_time = time(NULL); loop: - os_thread_sleep(5000000); + os_event_wait_time(srv_shutdown_event, 5000000); if (srv_shutdown_state >= SRV_SHUTDOWN_CLEANUP) { goto exit_func; @@ -2754,7 +2754,7 @@ loop: if (!skip_sleep) { - os_thread_sleep(1000000); + os_event_wait_time(srv_shutdown_event, 1000000); srv_main_sleeps++; /* @@ -3340,10 +3340,10 @@ loop: mutex_exit(&kernel_mutex); sleep_ms = 10; - os_event_reset(srv_purge_thread_event); + os_event_reset(srv_shutdown_event); } - os_event_wait_time(srv_purge_thread_event, sleep_ms * 1000); + os_event_wait_time(srv_shutdown_event, sleep_ms * 1000); history_len = trx_sys->rseg_history_len; if (history_len > 1000) |