diff options
author | Jon Olav Hauglid <jon.hauglid@oracle.com> | 2010-07-19 10:27:53 +0200 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@oracle.com> | 2010-07-19 10:27:53 +0200 |
commit | 52b1e11ee148d03a6391ab52fc89037f962b8552 (patch) | |
tree | 6eedcafada6964accf0bd5b2e271a260a8d9db15 /storage | |
parent | cf93bc718151480ec42f0d34ebc3862567ffb8ef (diff) | |
parent | 83c154dc34095f8fea8221d56ffc55c002df8694 (diff) | |
download | mariadb-git-52b1e11ee148d03a6391ab52fc89037f962b8552.tar.gz |
merge from mysql-trunk-bugfixing
Diffstat (limited to 'storage')
111 files changed, 847 insertions, 804 deletions
diff --git a/storage/archive/Makefile.am b/storage/archive/Makefile.am index adc11358df6..8b08105cef3 100644 --- a/storage/archive/Makefile.am +++ b/storage/archive/Makefile.am @@ -37,14 +37,14 @@ 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_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +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_CFLAGS) +libarchive_a_CXXFLAGS = $(AM_CXXFLAGS) libarchive_a_CFLAGS = $(AM_CFLAGS) libarchive_a_SOURCES = ha_archive.cc azio.c diff --git a/storage/blackhole/Makefile.am b/storage/blackhole/Makefile.am index f3bdbdbd070..38c2f354844 100644 --- a/storage/blackhole/Makefile.am +++ b/storage/blackhole/Makefile.am @@ -35,14 +35,14 @@ 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_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +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_CFLAGS) +libblackhole_a_CXXFLAGS=$(AM_CXXFLAGS) libblackhole_a_CFLAGS = $(AM_CFLAGS) libblackhole_a_SOURCES= ha_blackhole.cc diff --git a/storage/csv/Makefile.am b/storage/csv/Makefile.am index 36d6b464fcc..5e3587c893f 100644 --- a/storage/csv/Makefile.am +++ b/storage/csv/Makefile.am @@ -32,12 +32,12 @@ 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_CFLAGS) -DMYSQL_PLUGIN +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_CFLAGS) +libcsv_a_CXXFLAGS = $(AM_CXXFLAGS) libcsv_a_SOURCES = transparent_file.cc ha_tina.cc EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am index 47d95d4663c..c79fbe97cc3 100644 --- a/storage/example/Makefile.am +++ b/storage/example/Makefile.am @@ -35,14 +35,14 @@ 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_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +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_CFLAGS) +libexample_a_CXXFLAGS = $(AM_CXXFLAGS) libexample_a_CFLAGS = $(AM_CFLAGS) libexample_a_SOURCES= ha_example.cc diff --git a/storage/federated/Makefile.am b/storage/federated/Makefile.am index f4cd634567d..e07b0d95b97 100644 --- a/storage/federated/Makefile.am +++ b/storage/federated/Makefile.am @@ -36,14 +36,14 @@ 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_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +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_CFLAGS) +libfederated_a_CXXFLAGS = $(AM_CXXFLAGS) libfederated_a_CFLAGS = $(AM_CFLAGS) libfederated_a_SOURCES= ha_federated.cc diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 5534c520604..d17b56bd4b1 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -594,7 +594,6 @@ static int parse_url_error(FEDERATED_SHARE *share, TABLE *table, int error_num) int get_connection(MEM_ROOT *mem_root, FEDERATED_SHARE *share) { int error_num= ER_FOREIGN_SERVER_DOESNT_EXIST; - char error_buffer[FEDERATED_QUERY_BUFFER_SIZE]; FOREIGN_SERVER *server, server_buffer; DBUG_ENTER("ha_federated::get_connection"); @@ -646,10 +645,8 @@ int get_connection(MEM_ROOT *mem_root, FEDERATED_SHARE *share) DBUG_RETURN(0); error: - my_sprintf(error_buffer, - (error_buffer, "server name: '%s' doesn't exist!", - share->connection_string)); - my_error(error_num, MYF(0), error_buffer); + my_printf_error(error_num, "server name: '%s' doesn't exist!", + MYF(0), share->connection_string); DBUG_RETURN(error_num); } @@ -2443,8 +2440,8 @@ int ha_federated::index_read_idx_with_result_set(uchar *buf, uint index, if (real_query(sql_query.ptr(), sql_query.length())) { - my_sprintf(error_buffer, (error_buffer, "error: %d '%s'", - mysql_errno(mysql), mysql_error(mysql))); + sprintf(error_buffer, "error: %d '%s'", + mysql_errno(mysql), mysql_error(mysql)); retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE; goto error; } @@ -2841,7 +2838,6 @@ int ha_federated::rnd_pos(uchar *buf, uchar *pos) int ha_federated::info(uint flag) { - char error_buffer[FEDERATED_QUERY_BUFFER_SIZE]; char status_buf[FEDERATED_QUERY_BUFFER_SIZE]; int error; uint error_code; @@ -2925,9 +2921,8 @@ error: mysql_free_result(result); if (mysql) { - my_sprintf(error_buffer, (error_buffer, ": %d : %s", - mysql_errno(mysql), mysql_error(mysql))); - my_error(error_code, MYF(0), error_buffer); + my_printf_error(error_code, ": %d : %s", MYF(0), + mysql_errno(mysql), mysql_error(mysql)); } else if (remote_error_number != -1 /* error already reported */) diff --git a/storage/heap/CMakeLists.txt b/storage/heap/CMakeLists.txt index 2c0b65b0cc4..2c0b65b0cc4 100755..100644 --- a/storage/heap/CMakeLists.txt +++ b/storage/heap/CMakeLists.txt diff --git a/storage/heap/hp_hash.c b/storage/heap/hp_hash.c index aaaa0fe833f..f56df42aab3 100644 --- a/storage/heap/hp_hash.c +++ b/storage/heap/hp_hash.c @@ -577,7 +577,7 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const uchar *rec1, const uchar *rec2, } else { - if (bcmp(rec1+seg->start,rec2+seg->start,seg->length)) + if (memcmp(rec1+seg->start,rec2+seg->start,seg->length)) return 1; } } @@ -660,7 +660,7 @@ int hp_key_cmp(HP_KEYDEF *keydef, const uchar *rec, const uchar *key) } else { - if (bcmp(rec+seg->start,key,seg->length)) + if (memcmp(rec+seg->start,key,seg->length)) return 1; } } diff --git a/storage/heap/hp_open.c b/storage/heap/hp_open.c index ef2ce15f9b3..12d9bfe1ed3 100644 --- a/storage/heap/hp_open.c +++ b/storage/heap/hp_open.c @@ -16,10 +16,6 @@ /* open a heap-database */ #include "heapdef.h" -#ifdef VMS -#include "hp_static.c" /* Stupid vms-linker */ -#endif - #include "my_sys.h" /* diff --git a/storage/heap/hp_test2.c b/storage/heap/hp_test2.c index 5b0c8d8685d..1571fc98402 100644 --- a/storage/heap/hp_test2.c +++ b/storage/heap/hp_test2.c @@ -401,7 +401,7 @@ int main(int argc, char *argv[]) bmove(record2,record,reclength); if (heap_rsame(file,record,-1) || heap_rsame(file,record2,2)) goto err; - if (bcmp(record2,record,reclength)) + if (memcmp(record2,record,reclength)) { puts("heap_rsame didn't find right record"); goto end; @@ -410,7 +410,7 @@ int main(int argc, char *argv[]) puts("- Test of read through position"); if (heap_rrnd(file,record,position)) goto err; - if (bcmp(record3,record,reclength)) + if (memcmp(record3,record,reclength)) { puts("heap_frnd didn't find right record"); goto end; diff --git a/storage/ibmdb2i/Makefile.am b/storage/ibmdb2i/Makefile.am index 041bdc270e4..a9977de895d 100644 --- a/storage/ibmdb2i/Makefile.am +++ b/storage/ibmdb2i/Makefile.am @@ -34,7 +34,7 @@ EXTRA_LTLIBRARIES = ha_ibmdb2i.la pkgplugin_LTLIBRARIES = @plugin_ibmdb2i_shared_target@ ha_ibmdb2i_la_LIBADD = -liconv ha_ibmdb2i_la_LDFLAGS = -module -rpath $(MYSQLLIBdir) -ha_ibmdb2i_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +ha_ibmdb2i_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_ibmdb2i_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc \ db2i_blobCollection.cc db2i_file.cc db2i_charsetSupport.cc \ @@ -44,7 +44,7 @@ ha_ibmdb2i_la_SOURCES = ha_ibmdb2i.cc db2i_ileBridge.cc db2i_conversion.cc \ EXTRA_LIBRARIES = libibmdb2i.a noinst_LIBRARIES = @plugin_ibmdb2i_static_target@ -libibmdb2i_a_CXXFLAGS = $(AM_CFLAGS) +libibmdb2i_a_CXXFLAGS = $(AM_CXXFLAGS) libibmdb2i_a_CFLAGS = $(AM_CFLAGS) libibmdb2i_a_SOURCES= $(ha_ibmdb2i_la_SOURCES) diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 90246aaa99d..b6399dcc478 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -95,7 +95,7 @@ IF(NOT CMAKE_CROSSCOMPILING) #include <pthread.h> #include <string.h> - int main(int argc, char** argv) { + int main() { pthread_t x1; pthread_t x2; pthread_t x3; diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am index c15c46abaf0..7a6103d9e79 100644 --- a/storage/innobase/Makefile.am +++ b/storage/innobase/Makefile.am @@ -323,14 +323,14 @@ libinnobase_a_SOURCES= \ ut/ut0vec.c \ ut/ut0wqueue.c -libinnobase_a_CXXFLAGS= $(AM_CFLAGS) +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_CFLAGS) $(INNODB_DYNAMIC_CFLAGS) +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) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 6b0d68241ea..f5227add6f1 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -187,10 +187,6 @@ static ulong innobase_active_counter = 0; static hash_table_t* innobase_open_tables; -#ifdef __NETWARE__ /* some special cleanup for NetWare */ -bool nw_panic = FALSE; -#endif - /** Allowed values of innodb_change_buffering */ static const char* innobase_change_buffering_values[IBUF_USE_COUNT] = { "none", /* IBUF_USE_NONE */ @@ -2469,11 +2465,6 @@ innobase_end( DBUG_ENTER("innobase_end"); DBUG_ASSERT(hton == innodb_hton_ptr); -#ifdef __NETWARE__ /* some special cleanup for NetWare */ - if (nw_panic) { - set_panic_flag_for_netware(); - } -#endif if (innodb_inited) { srv_fast_shutdown = (ulint) innobase_fast_shutdown; @@ -10794,14 +10785,8 @@ static MYSQL_SYSVAR_ULONG(purge_threads, srv_n_purge_threads, static MYSQL_SYSVAR_ULONG(fast_shutdown, innobase_fast_shutdown, PLUGIN_VAR_OPCMDARG, "Speeds up the shutdown process of the InnoDB storage engine. Possible " - "values are 0, 1 (faster)" - /* - NetWare can't close unclosed files, can't automatically kill remaining - threads, etc, so on this OS we disable the crash-like InnoDB shutdown. - */ - IF_NETWARE("", " or 2 (fastest - crash-like)") - ".", - NULL, NULL, 1, 0, IF_NETWARE(1,2), 0); + "values are 0, 1 (faster) or 2 (fastest - crash-like).", + NULL, NULL, 1, 0, 2, 0); static MYSQL_SYSVAR_BOOL(file_per_table, srv_file_per_table, PLUGIN_VAR_NOCMDARG, diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index a112cb06697..197e361b2b1 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -194,12 +194,12 @@ various file I/O operations with performance schema. used to register file creation, opening, closing and renaming. 2) register_pfs_file_io_begin() and register_pfs_file_io_end() are used to register actual file read, write and flush */ -# define register_pfs_file_open_begin(locker, key, op, name, \ +# define register_pfs_file_open_begin(state, locker, key, op, name, \ src_file, src_line) \ do { \ if (PSI_server) { \ locker = PSI_server->get_thread_file_name_locker( \ - key, op, name, &locker); \ + state, key, op, name, &locker); \ if (locker) { \ PSI_server->start_file_open_wait( \ locker, src_file, src_line); \ @@ -215,12 +215,12 @@ do { \ } \ } while (0) -# define register_pfs_file_io_begin(locker, file, count, op, \ +# define register_pfs_file_io_begin(state, locker, file, count, op, \ src_file, src_line) \ do { \ if (PSI_server) { \ locker = PSI_server->get_thread_file_descriptor_locker( \ - file, op); \ + state, file, op); \ if (locker) { \ PSI_server->start_file_wait( \ locker, count, src_file, src_line); \ @@ -383,8 +383,6 @@ os_io_init_simple(void); /***********************************************************************//** Creates a temporary file. This function is like tmpfile(3), but the temporary file is created in the MySQL temporary directory. -On Netware, this function is like tmpfile(3), because the C run-time -library of Netware does not expose the delete-on-close flag. @return temporary file handle, or NULL on error */ FILE* @@ -1166,7 +1164,7 @@ os_file_get_status( os_file_stat_t* stat_info); /*!< information of a file in a directory */ -#if !defined(UNIV_HOTBACKUP) && !defined(__NETWARE__) +#if !defined(UNIV_HOTBACKUP) /*********************************************************************//** Creates a temporary file that will be deleted on close. This function is defined in ha_innodb.cc. @@ -1175,7 +1173,7 @@ UNIV_INTERN int innobase_mysql_tmpfile(void); /*========================*/ -#endif /* !UNIV_HOTBACKUP && !__NETWARE__ */ +#endif /* !UNIV_HOTBACKUP */ #if defined(LINUX_NATIVE_AIO) diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic index 32f0e7cf666..648070c6909 100644 --- a/storage/innobase/include/os0file.ic +++ b/storage/innobase/include/os0file.ic @@ -55,9 +55,10 @@ pfs_os_file_create_simple_func( { os_file_t file; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin(locker, key, + register_pfs_file_open_begin(&state, locker, key, ((create_mode == OS_FILE_CREATE) ? PSI_FILE_CREATE : PSI_FILE_OPEN), @@ -101,9 +102,10 @@ pfs_os_file_create_simple_no_error_handling_func( { os_file_t file; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin(locker, key, + register_pfs_file_open_begin(&state, locker, key, ((create_mode == OS_FILE_CREATE) ? PSI_FILE_CREATE : PSI_FILE_OPEN), @@ -153,9 +155,10 @@ pfs_os_file_create_func( { os_file_t file; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register a file open or creation depending on "create_mode" */ - register_pfs_file_open_begin(locker, key, + register_pfs_file_open_begin(&state, locker, key, ((create_mode == OS_FILE_CREATE) ? PSI_FILE_CREATE : PSI_FILE_OPEN), @@ -183,9 +186,10 @@ pfs_os_file_close_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* register the file close */ - register_pfs_file_io_begin(locker, file, 0, PSI_FILE_CLOSE, + register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_CLOSE, src_file, src_line); result = os_file_close_func(file); @@ -230,9 +234,10 @@ pfs_os_aio_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; /* Register the read or write I/O depending on "type" */ - register_pfs_file_io_begin(locker, file, n, + register_pfs_file_io_begin(&state, locker, file, n, (type == OS_FILE_WRITE) ? PSI_FILE_WRITE : PSI_FILE_READ, @@ -268,8 +273,9 @@ pfs_os_file_read_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, n, PSI_FILE_READ, + register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ, src_file, src_line); result = os_file_read_func(file, buf, offset, offset_high, n); @@ -303,8 +309,9 @@ pfs_os_file_read_no_error_handling_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, n, PSI_FILE_READ, + register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ, src_file, src_line); result = os_file_read_no_error_handling_func(file, buf, offset, @@ -339,8 +346,9 @@ pfs_os_file_write_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, n, PSI_FILE_WRITE, + register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_WRITE, src_file, src_line); result = os_file_write_func(name, file, buf, offset, offset_high, n); @@ -366,8 +374,9 @@ pfs_os_file_flush_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_io_begin(locker, file, 0, PSI_FILE_SYNC, + register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_SYNC, src_file, src_line); result = os_file_flush_func(file); @@ -395,8 +404,9 @@ pfs_os_file_rename_func( { ibool result; struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; - register_pfs_file_open_begin(locker, key, PSI_FILE_RENAME, newpath, + register_pfs_file_open_begin(&state, locker, key, PSI_FILE_RENAME, newpath, src_file, src_line); result = os_file_rename_func(oldpath, newpath); diff --git a/storage/innobase/include/srv0start.h b/storage/innobase/include/srv0start.h index 8abf15da9c1..796d2cade3b 100644 --- a/storage/innobase/include/srv0start.h +++ b/storage/innobase/include/srv0start.h @@ -91,10 +91,6 @@ extern ib_uint64_t srv_shutdown_lsn; /** Log sequence number immediately after startup */ extern ib_uint64_t srv_start_lsn; -#ifdef __NETWARE__ -void set_panic_flag_for_netware(void); -#endif - #ifdef HAVE_DARWIN_THREADS /** TRUE if the F_FULLFSYNC option is available */ extern ibool srv_have_fullfsync; diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic index 73405759bce..2ffd9fdafb5 100644 --- a/storage/innobase/include/sync0rw.ic +++ b/storage/innobase/include/sync0rw.ic @@ -675,12 +675,13 @@ pfs_rw_lock_x_lock_func( const char* file_name,/*!< in: file name where lock requested */ ulint line) /*!< in: line where requested */ { - struct PSI_rwlock_locker* locker = NULL; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; /* Record the entry of rw x lock request in performance schema */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_WRITELOCK); + &state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK); if (locker) { PSI_server->start_rwlock_wrwait(locker, @@ -709,13 +710,14 @@ pfs_rw_lock_x_lock_func_nowait( requested */ ulint line) /*!< in: line where requested */ { - struct PSI_rwlock_locker* locker = NULL; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; ibool ret; /* Record the entry of rw x lock request in performance schema */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_WRITELOCK); + &state, lock->pfs_psi, PSI_RWLOCK_WRITELOCK); if (locker) { PSI_server->start_rwlock_wrwait(locker, @@ -764,12 +766,13 @@ pfs_rw_lock_s_lock_func( requested */ ulint line) /*!< in: line where requested */ { - struct PSI_rwlock_locker* locker = NULL; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; /* Instrumented to inform we are aquiring a shared rwlock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_READLOCK); + &state, lock->pfs_psi, PSI_RWLOCK_READLOCK); if (locker) { PSI_server->start_rwlock_rdwait(locker, file_name, line); @@ -798,14 +801,14 @@ pfs_rw_lock_s_lock_low( const char* file_name, /*!< in: file name where lock requested */ ulint line) /*!< in: line where requested */ { - - struct PSI_rwlock_locker* locker = NULL; + struct PSI_rwlock_locker* locker = NULL; + PSI_rwlock_locker_state state; ibool ret; /* Instrumented to inform we are aquiring a shared rwlock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { locker = PSI_server->get_thread_rwlock_locker( - lock->pfs_psi, PSI_RWLOCK_READLOCK); + &state, lock->pfs_psi, PSI_RWLOCK_READLOCK); if (locker) { PSI_server->start_rwlock_rdwait(locker, file_name, line); @@ -838,11 +841,7 @@ pfs_rw_lock_x_unlock_func( { /* Inform performance schema we are unlocking the lock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { - struct PSI_thread* thread; - thread = PSI_server->get_thread(); - if (thread) { - PSI_server->unlock_rwlock(thread, lock->pfs_psi); - } + PSI_server->unlock_rwlock(lock->pfs_psi); } rw_lock_x_unlock_func( @@ -869,11 +868,7 @@ pfs_rw_lock_s_unlock_func( { /* Inform performance schema we are unlocking the lock */ if (UNIV_LIKELY(PSI_server && lock->pfs_psi)) { - struct PSI_thread* thread; - thread = PSI_server->get_thread(); - if (thread) { - PSI_server->unlock_rwlock(thread, lock->pfs_psi); - } + PSI_server->unlock_rwlock(lock->pfs_psi); } rw_lock_s_unlock_func( diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic index cf080e2e3ce..2977f71154a 100644 --- a/storage/innobase/include/sync0sync.ic +++ b/storage/innobase/include/sync0sync.ic @@ -237,11 +237,12 @@ pfs_mutex_enter_func( ulint line) /*!< in: line where locked */ { struct PSI_mutex_locker* locker = NULL; + PSI_mutex_locker_state state; int result = 0; if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) { locker = PSI_server->get_thread_mutex_locker( - mutex->pfs_psi, PSI_MUTEX_LOCK); + &state, mutex->pfs_psi, PSI_MUTEX_LOCK); if (locker) { PSI_server->start_mutex_wait(locker, file_name, line); } @@ -270,11 +271,12 @@ pfs_mutex_enter_nowait_func( { ulint ret; struct PSI_mutex_locker* locker = NULL; + PSI_mutex_locker_state state; int result = 0; if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) { locker = PSI_server->get_thread_mutex_locker( - mutex->pfs_psi, PSI_MUTEX_LOCK); + &state, mutex->pfs_psi, PSI_MUTEX_LOCK); if (locker) { PSI_server->start_mutex_wait(locker, file_name, line); } @@ -300,12 +302,7 @@ pfs_mutex_exit_func( mutex_t* mutex) /*!< in: pointer to mutex */ { if (UNIV_LIKELY(PSI_server && mutex->pfs_psi)) { - struct PSI_thread* thread; - thread = PSI_server->get_thread(); - - if (thread) { - PSI_server->unlock_mutex(thread, mutex->pfs_psi); - } + PSI_server->unlock_mutex(mutex->pfs_psi); } mutex_exit_func(mutex); diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 11cec113fc8..ea213486445 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -115,7 +115,7 @@ if we are compiling on Windows. */ /* Include <sys/stat.h> to get S_I... macros defined for os0file.c */ # include <sys/stat.h> -# if !defined(__NETWARE__) && !defined(__WIN__) +# if !defined(__WIN__) # include <sys/mman.h> /* mmap() for os0proc.c */ # endif diff --git a/storage/innobase/include/ut0dbg.h b/storage/innobase/include/ut0dbg.h index 78b525c38ab..d7ec90db0fb 100644 --- a/storage/innobase/include/ut0dbg.h +++ b/storage/innobase/include/ut0dbg.h @@ -54,29 +54,18 @@ ut_dbg_assertion_failed( const char* file, /*!< in: source file containing the assertion */ ulint line); /*!< in: line number of the assertion */ -#ifdef __NETWARE__ -/** Flag for ignoring further assertion failures. This is set to TRUE -when on NetWare there happens an InnoDB assertion failure or other -fatal error condition that requires an immediate shutdown. */ -extern ibool panic_shutdown; -/* Abort the execution. */ -void ut_dbg_panic(void); -# define UT_DBG_PANIC ut_dbg_panic() -/* Stop threads in ut_a(). */ -# define UT_DBG_STOP do {} while (0) /* We do not do this on NetWare */ -#else /* __NETWARE__ */ -# if defined(__WIN__) || defined(__INTEL_COMPILER) -# undef UT_DBG_USE_ABORT -# elif defined(__GNUC__) && (__GNUC__ > 2) -# define UT_DBG_USE_ABORT -# endif - -# ifndef UT_DBG_USE_ABORT +#if defined(__WIN__) || defined(__INTEL_COMPILER) +# undef UT_DBG_USE_ABORT +#elif defined(__GNUC__) && (__GNUC__ > 2) +# define UT_DBG_USE_ABORT +#endif + +#ifndef UT_DBG_USE_ABORT /** A null pointer that will be dereferenced to trigger a memory trap */ extern ulint* ut_dbg_null_ptr; -# endif +#endif -# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) +#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) /** If this is set to TRUE by ut_dbg_assertion_failed(), all threads will stop at the next ut_a() or ut_ad(). */ extern ibool ut_dbg_stop_threads; @@ -89,24 +78,23 @@ ut_dbg_stop_thread( /*===============*/ const char* file, ulint line); -# endif +#endif -# ifdef UT_DBG_USE_ABORT +#ifdef UT_DBG_USE_ABORT /** Abort the execution. */ -# define UT_DBG_PANIC abort() +# define UT_DBG_PANIC abort() /** Stop threads (null operation) */ -# define UT_DBG_STOP do {} while (0) -# else /* UT_DBG_USE_ABORT */ +# define UT_DBG_STOP do {} while (0) +#else /* UT_DBG_USE_ABORT */ /** Abort the execution. */ -# define UT_DBG_PANIC \ +# define UT_DBG_PANIC \ if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL /** Stop threads in ut_a(). */ -# define UT_DBG_STOP do \ +# define UT_DBG_STOP do \ if (UNIV_UNLIKELY(ut_dbg_stop_threads)) { \ ut_dbg_stop_thread(__FILE__, (ulint) __LINE__); \ } while (0) -# endif /* UT_DBG_USE_ABORT */ -#endif /* __NETWARE__ */ +#endif /* UT_DBG_USE_ABORT */ /** Abort execution if EXPR does not evaluate to nonzero. @param EXPR assertion expression that should hold */ diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index c07f8f4bf95..7c502d616d3 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -623,7 +623,7 @@ os_file_handle_error_no_exit( #undef USE_FILE_LOCK #define USE_FILE_LOCK -#if defined(UNIV_HOTBACKUP) || defined(__WIN__) || defined(__NETWARE__) +#if defined(UNIV_HOTBACKUP) || defined(__WIN__) /* InnoDB Hot Backup does not lock the data files. * On Windows, mandatory locking is used. */ @@ -683,35 +683,27 @@ os_io_init_simple(void) /***********************************************************************//** Creates a temporary file. This function is like tmpfile(3), but the temporary file is created in the MySQL temporary directory. -On Netware, this function is like tmpfile(3), because the C run-time -library of Netware does not expose the delete-on-close flag. @return temporary file handle, or NULL on error */ UNIV_INTERN FILE* os_file_create_tmpfile(void) /*========================*/ { -#ifdef __NETWARE__ - FILE* file = tmpfile(); -#else /* __NETWARE__ */ FILE* file = NULL; int fd = innobase_mysql_tmpfile(); if (fd >= 0) { file = fdopen(fd, "w+b"); } -#endif /* __NETWARE__ */ if (!file) { ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Error: unable to create temporary file;" " errno: %d\n", errno); -#ifndef __NETWARE__ if (fd >= 0) { close(fd); } -#endif /* !__NETWARE__ */ } return(file); diff --git a/storage/innobase/os/os0proc.c b/storage/innobase/os/os0proc.c index 48922886f23..0f56a608f38 100644 --- a/storage/innobase/os/os0proc.c +++ b/storage/innobase/os/os0proc.c @@ -145,7 +145,7 @@ skip: os_fast_mutex_unlock(&ut_list_mutex); UNIV_MEM_ALLOC(ptr, size); } -#elif defined __NETWARE__ || !defined OS_MAP_ANON +#elif !defined OS_MAP_ANON size = *n; ptr = ut_malloc_low(size, TRUE, FALSE); #else @@ -213,7 +213,7 @@ os_mem_free_large( os_fast_mutex_unlock(&ut_list_mutex); UNIV_MEM_FREE(ptr, size); } -#elif defined __NETWARE__ || !defined OS_MAP_ANON +#elif !defined OS_MAP_ANON ut_free(ptr); #else if (munmap(ptr, size)) { diff --git a/storage/innobase/os/os0thread.c b/storage/innobase/os/os0thread.c index 78df66d7834..632199b56bc 100644 --- a/storage/innobase/os/os0thread.c +++ b/storage/innobase/os/os0thread.c @@ -163,16 +163,6 @@ os_thread_create( exit(1); } #endif -#ifdef __NETWARE__ - ret = pthread_attr_setstacksize(&attr, - (size_t) NW_THD_STACKSIZE); - if (ret) { - fprintf(stderr, - "InnoDB: Error: pthread_attr_setstacksize" - " returned %d\n", ret); - exit(1); - } -#endif os_mutex_enter(os_sync_mutex); os_thread_count++; os_mutex_exit(os_sync_mutex); @@ -275,8 +265,6 @@ os_thread_sleep( { #ifdef __WIN__ Sleep((DWORD) tm / 1000); -#elif defined(__NETWARE__) - delay(tm / 1000); #else struct timeval t; diff --git a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c index d9084bb4ffd..eac2f9fb377 100644 --- a/storage/innobase/row/row0merge.c +++ b/storage/innobase/row/row0merge.c @@ -2164,8 +2164,9 @@ row_merge_file_create( /* This temp file open does not go through normal file APIs, add instrumentation to register with performance schema */ - struct PSI_file_locker* locker = NULL; - register_pfs_file_open_begin(locker, innodb_file_temp_key, + struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; + register_pfs_file_open_begin(&state, locker, innodb_file_temp_key, PSI_FILE_OPEN, "Innodb Merge Temp File", __FILE__, __LINE__); @@ -2187,8 +2188,9 @@ row_merge_file_destroy( merge_file_t* merge_file) /*!< out: merge file structure */ { #ifdef UNIV_PFS_IO - struct PSI_file_locker* locker = NULL; - register_pfs_file_io_begin(locker, merge_file->fd, 0, PSI_FILE_CLOSE, + struct PSI_file_locker* locker = NULL; + PSI_file_locker_state state; + register_pfs_file_io_begin(&state, locker, merge_file->fd, 0, PSI_FILE_CLOSE, __FILE__, __LINE__); #endif if (merge_file->fd != -1) { diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index 4a0ecc5154f..686ee6a4198 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -1231,14 +1231,6 @@ innobase_start_or_create_for_mysql(void) maximum number of threads that can wait in the 'srv_conc array' for their time to enter InnoDB. */ -#if defined(__NETWARE__) - - /* Create less event semaphores because Win 98/ME had - difficulty creating 40000 event semaphores. Comment from - Novell, Inc.: also, these just take a lot of memory on - NetWare. */ - srv_max_n_threads = 1000; -#else if (srv_buf_pool_size >= 1000 * 1024 * 1024) { /* If buffer pool is less than 1000 MB, assume fewer threads. Also use only one @@ -1255,7 +1247,7 @@ innobase_start_or_create_for_mysql(void) especially in 64-bit computers */ } -#endif + err = srv_boot(); if (err != DB_SUCCESS) { @@ -1932,9 +1924,6 @@ innobase_shutdown_for_mysql(void) /*=============================*/ { ulint i; -#ifdef __NETWARE__ - extern ibool panic_shutdown; -#endif if (!srv_was_started) { if (srv_is_being_started) { ut_print_timestamp(stderr); @@ -1963,10 +1952,7 @@ innobase_shutdown_for_mysql(void) "InnoDB will do a crash recovery!\n"); } -#ifdef __NETWARE__ - if (!panic_shutdown) -#endif - logs_empty_and_mark_files_at_shutdown(); + logs_empty_and_mark_files_at_shutdown(); if (srv_conc_n_threads != 0) { fprintf(stderr, @@ -2133,12 +2119,4 @@ innobase_shutdown_for_mysql(void) return((int) DB_SUCCESS); } - -#ifdef __NETWARE__ -void set_panic_flag_for_netware() -{ - extern ibool panic_shutdown; - panic_shutdown = TRUE; -} -#endif /* __NETWARE__ */ #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innobase/ut/ut0dbg.c b/storage/innobase/ut/ut0dbg.c index 4484e6c36de..e79217d5b86 100644 --- a/storage/innobase/ut/ut0dbg.c +++ b/storage/innobase/ut/ut0dbg.c @@ -37,12 +37,7 @@ UNIV_INTERN ulint ut_dbg_zero = 0; will stop at the next ut_a() or ut_ad(). */ UNIV_INTERN ibool ut_dbg_stop_threads = FALSE; #endif -#ifdef __NETWARE__ -/** Flag for ignoring further assertion failures. This is set to TRUE -when on NetWare there happens an InnoDB assertion failure or other -fatal error condition that requires an immediate shutdown. */ -UNIV_INTERN ibool panic_shutdown = FALSE; -#elif !defined(UT_DBG_USE_ABORT) +#ifndef UT_DBG_USE_ABORT /** A null pointer that will be dereferenced to trigger a memory trap */ UNIV_INTERN ulint* ut_dbg_null_ptr = NULL; #endif @@ -86,22 +81,7 @@ ut_dbg_assertion_failed( #endif } -#ifdef __NETWARE__ -/*************************************************************//** -Shut down MySQL/InnoDB after assertion failure. */ -UNIV_INTERN -void -ut_dbg_panic(void) -/*==============*/ -{ - if (!panic_shutdown) { - panic_shutdown = TRUE; - innobase_shutdown_for_mysql(); - } - exit(1); -} -#else /* __NETWARE__ */ -# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) +#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT) /*************************************************************//** Stop a thread after assertion failure. */ UNIV_INTERN @@ -117,8 +97,7 @@ ut_dbg_stop_thread( os_thread_sleep(1000000000); #endif /* !UNIV_HOTBACKUP */ } -# endif -#endif /* __NETWARE__ */ +#endif #ifdef UNIV_COMPILE_TEST_FUNCS diff --git a/storage/innobase/ut/ut0mem.c b/storage/innobase/ut/ut0mem.c index f2baab67f09..53f15029e1b 100644 --- a/storage/innobase/ut/ut0mem.c +++ b/storage/innobase/ut/ut0mem.c @@ -179,9 +179,6 @@ retry: /* Make an intentional seg fault so that we get a stack trace */ - /* Intentional segfault on NetWare causes an abend. Avoid this - by graceful exit handling in ut_a(). */ -#if (!defined __NETWARE__) if (assert_on_error) { ut_print_timestamp(stderr); @@ -194,9 +191,6 @@ retry: } else { return(NULL); } -#else - ut_a(0); -#endif } if (set_to_zero) { diff --git a/storage/myisam/CMakeLists.txt b/storage/myisam/CMakeLists.txt index b057a62a6dd..b057a62a6dd 100755..100644 --- a/storage/myisam/CMakeLists.txt +++ b/storage/myisam/CMakeLists.txt diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index c415264cd98..4a91c2d939b 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -19,12 +19,8 @@ #include "sp_defs.h" #include <my_bit.h> -#if defined(MSDOS) || defined(__WIN__) #ifdef __WIN__ #include <fcntl.h> -#else -#include <process.h> /* Prototype for getpid */ -#endif #endif #include <m_ctype.h> diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c index 54498393f15..f6bbaab1f87 100644 --- a/storage/myisam/mi_log.c +++ b/storage/myisam/mi_log.c @@ -19,14 +19,8 @@ */ #include "myisamdef.h" -#if defined(MSDOS) || defined(__WIN__) +#ifdef __WIN__ #include <fcntl.h> -#ifndef __WIN__ -#include <process.h> -#endif -#endif -#ifdef VMS -#include <processes.h> #endif #undef GETPID /* For HPUX */ diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 014cf1c5a2c..5b3da9841b8 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -20,15 +20,8 @@ #include "rt_index.h" #include <m_ctype.h> -#if defined(MSDOS) || defined(__WIN__) #ifdef __WIN__ #include <fcntl.h> -#else -#include <process.h> /* Prototype for getpid */ -#endif -#endif -#ifdef VMS -#include "static.c" #endif static void setup_key_functions(MI_KEYDEF *keyinfo); diff --git a/storage/myisam/mi_search.c b/storage/myisam/mi_search.c index c7ebf9ae220..24456e3d8fa 100644 --- a/storage/myisam/mi_search.c +++ b/storage/myisam/mi_search.c @@ -84,7 +84,7 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo, if (!(buff=_mi_fetch_keypage(info,keyinfo,pos,DFLT_INIT_HITS,info->buff, test(!(nextflag & SEARCH_SAVE_BUFF))))) goto err; - DBUG_DUMP("page",(uchar*) buff,mi_getint(buff)); + DBUG_DUMP("page", buff, mi_getint(buff)); flag=(*keyinfo->bin_search)(info,keyinfo,buff,key,key_len,nextflag, &keypos,lastkey, &last_key); @@ -819,7 +819,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, DBUG_PRINT("error", ("Found too long null packed key: %u of %u at 0x%lx", length, keyseg->length, (long) *page_pos)); - DBUG_DUMP("key",(uchar*) *page_pos,16); + DBUG_DUMP("key", *page_pos, 16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; return 0; @@ -876,7 +876,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, { DBUG_PRINT("error",("Found too long packed key: %u of %u at 0x%lx", length, keyseg->length, (long) *page_pos)); - DBUG_DUMP("key",(uchar*) *page_pos,16); + DBUG_DUMP("key", *page_pos, 16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; return 0; /* Error */ @@ -948,7 +948,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag, DBUG_PRINT("error", ("Found too long binary packed key: %u of %u at 0x%lx", length, keyinfo->maxlength, (long) *page_pos)); - DBUG_DUMP("key",(uchar*) *page_pos,16); + DBUG_DUMP("key", *page_pos, 16); mi_print_error(keyinfo->share, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; DBUG_RETURN(0); /* Wrong key */ diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c index 81d063a58fd..baa01a507eb 100644 --- a/storage/myisam/mi_static.c +++ b/storage/myisam/mi_static.c @@ -23,9 +23,9 @@ #endif LIST *myisam_open_list=0; -uchar NEAR myisam_file_magic[]= +uchar myisam_file_magic[]= { (uchar) 254, (uchar) 254,'\007', '\001', }; -uchar NEAR myisam_pack_file_magic[]= +uchar myisam_pack_file_magic[]= { (uchar) 254, (uchar) 254,'\010', '\002', }; char * myisam_log_filename=(char*) "myisam.log"; File myisam_log_file= -1; @@ -55,7 +55,7 @@ int (*myisam_test_invalid_symlink)(const char *filename)= always_valid; Position is , == , >= , <= , > , < */ -uint NEAR myisam_read_vec[]= +uint myisam_read_vec[]= { SEARCH_FIND, SEARCH_FIND | SEARCH_BIGGER, SEARCH_FIND | SEARCH_SMALLER, SEARCH_NO_FIND | SEARCH_BIGGER, SEARCH_NO_FIND | SEARCH_SMALLER, @@ -63,7 +63,7 @@ uint NEAR myisam_read_vec[]= MBR_CONTAIN, MBR_INTERSECT, MBR_WITHIN, MBR_DISJOINT, MBR_EQUAL }; -uint NEAR myisam_readnext_vec[]= +uint myisam_readnext_vec[]= { SEARCH_BIGGER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c index 60b16d5549e..513b390ee68 100644 --- a/storage/myisam/mi_test2.c +++ b/storage/myisam/mi_test2.c @@ -28,7 +28,7 @@ #define STANDARD_LENGTH 37 #define MYISAM_KEYS 6 #define MAX_PARTS 4 -#if !defined(MSDOS) && !defined(labs) +#if !defined(labs) #define labs(a) abs(a) #endif @@ -412,7 +412,7 @@ int main(int argc, char *argv[]) } ant=0; while (mi_rprev(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys) { printf("prev: Found: %d records of %d\n",ant,dupp_keys); @@ -450,7 +450,7 @@ int main(int argc, char *argv[]) goto end; } if (mi_rlast(file,read_record2,0) || - bcmp(read_record2,read_record3,reclength)) + memcmp(read_record2,read_record3,reclength)) { printf("Can't find last record\n"); DBUG_DUMP("record2",(uchar*) read_record2,reclength); @@ -465,7 +465,7 @@ int main(int argc, char *argv[]) printf("prev: I found: %d records of %d\n",ant,write_count); goto end; } - if (bcmp(read_record,read_record3,reclength)) + if (memcmp(read_record,read_record3,reclength)) { printf("Can't find first record\n"); goto end; @@ -480,7 +480,7 @@ int main(int argc, char *argv[]) mi_rprev(file,read_record3,0) == 0 || mi_rnext(file,read_record3,0)) goto err; - if (bcmp(read_record,read_record3,reclength) != 0) + if (memcmp(read_record,read_record3,reclength) != 0) printf("Can't find first record\n"); if (!silent) @@ -492,7 +492,7 @@ int main(int argc, char *argv[]) mi_rnext(file,read_record3,0) == 0 || mi_rprev(file,read_record3,0)) goto err; - if (bcmp(read_record2,read_record3,reclength)) + if (memcmp(read_record2,read_record3,reclength)) printf("Can't find last record\n"); #ifdef NOT_ANYMORE if (!silent) @@ -506,7 +506,7 @@ int main(int argc, char *argv[]) bzero((char*) file->lastkey,file->s->base.max_key_length*2); if (mi_rkey(file,read_record,0,key2,(uint) i,HA_READ_PREFIX)) goto err; - if (bcmp(read_record+start,key,(uint) i)) + if (memcmp(read_record+start,key,(uint) i)) { puts("Didn't find right record"); goto end; @@ -525,7 +525,7 @@ int main(int argc, char *argv[]) opt_delete++; ant=1; while (mi_rnext(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-1) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-1); @@ -543,7 +543,7 @@ int main(int argc, char *argv[]) opt_delete++; ant=1; while (mi_rprev(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-2) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-2); @@ -563,7 +563,7 @@ int main(int argc, char *argv[]) if (mi_rnext(file,read_record,0)) goto err; /* Skall finnas poster */ while (mi_rnext(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-3) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-3); @@ -578,7 +578,7 @@ int main(int argc, char *argv[]) opt_delete++; ant=0; while (mi_rprev(file,read_record3,0) == 0 && - bcmp(read_record3+start,key,length) == 0) ant++; + memcmp(read_record3+start,key,length) == 0) ant++; if (ant != dupp_keys-4) { printf("next: I can only find: %d keys of %d\n",ant,dupp_keys-4); @@ -601,7 +601,7 @@ int main(int argc, char *argv[]) for (i=min(2,keys) ; i-- > 0 ;) { if (mi_rsame(file,read_record2,(int) i)) goto err; - if (bcmp(read_record,read_record2,reclength) != 0) + if (memcmp(read_record,read_record2,reclength) != 0) { printf("is_rsame didn't find same record\n"); goto end; diff --git a/storage/myisam/mi_test3.c b/storage/myisam/mi_test3.c index 7b16d6c05d6..bf36d8df7f4 100644 --- a/storage/myisam/mi_test3.c +++ b/storage/myisam/mi_test3.c @@ -15,8 +15,6 @@ /* Test av locking */ -#ifndef __NETWARE__ - #include "myisam.h" #include <sys/types.h> #ifdef HAVE_SYS_WAIT_H @@ -489,15 +487,3 @@ int test_update(MI_INFO *file,int id,int lock_type) } #include "mi_extrafunc.h" - -#else /* __NETWARE__ */ - -#include <stdio.h> - -main() -{ - fprintf(stderr,"this test has not been ported to NetWare\n"); - return 0; -} - -#endif /* __NETWARE__ */ diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c index 02fcd9289dd..fdba84a2e67 100644 --- a/storage/myisam/mi_unique.c +++ b/storage/myisam/mi_unique.c @@ -56,7 +56,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, uchar *record, if (_mi_search_next(info,info->s->keyinfo+def->key, info->lastkey, MI_UNIQUE_HASH_LENGTH, SEARCH_BIGGER, info->s->state.key_root[def->key]) || - bcmp((char*) info->lastkey, (char*) key_buff, MI_UNIQUE_HASH_LENGTH)) + memcmp(info->lastkey, key_buff, MI_UNIQUE_HASH_LENGTH)) { info->page_changed=1; /* Can't optimize read next */ info->lastpos=lastpos; diff --git a/storage/myisam/myisam_ftdump.c b/storage/myisam/myisam_ftdump.c index 74fa506a5b5..4718abc3481 100644 --- a/storage/myisam/myisam_ftdump.c +++ b/storage/myisam/myisam_ftdump.c @@ -253,18 +253,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), return 0; } -#include <help_start.h> static void usage() { printf("Use: myisam_ftdump <table_name> <index_num>\n"); my_print_help(my_long_options); my_print_variables(my_long_options); - NETWARE_SET_SCREEN_MODE(1); exit(1); } -#include <help_end.h> static void complain(int val) /* Kinda assert :-) */ { diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 0e32dc59d89..e1cedf6bc31 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -148,7 +148,7 @@ enum options_mc { OPT_READ_BUFFER_SIZE, OPT_WRITE_BUFFER_SIZE, OPT_SORT_BUFFER_SIZE, OPT_SORT_KEY_BLOCKS, OPT_DECODE_BITS, OPT_FT_MIN_WORD_LEN, OPT_FT_MAX_WORD_LEN, OPT_FT_STOPWORD_FILE, - OPT_MAX_RECORD_LENGTH, OPT_AUTO_CLOSE, OPT_STATS_METHOD + OPT_MAX_RECORD_LENGTH, OPT_STATS_METHOD }; static struct my_option my_long_options[] = @@ -156,10 +156,6 @@ static struct my_option my_long_options[] = {"analyze", 'a', "Analyze distribution of keys. Will make some joins in MySQL faster. You can check the calculated distribution.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"block-search", 'b', "No help available.", 0, 0, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -336,13 +332,10 @@ static struct my_option my_long_options[] = }; -#include <help_start.h> - static void print_version(void) { printf("%s Ver 2.7 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -364,7 +357,7 @@ static void usage(void) -?, --help Display this help and exit.\n\ -t, --tmpdir=path Path for temporary files. Multiple paths can be\n\ specified, separated by "); -#if defined( __WIN__) || defined(__NETWARE__) +#if defined( __WIN__) printf("semicolon (;)"); #else printf("colon (:)"); @@ -460,7 +453,6 @@ static void usage(void) my_print_variables(my_long_options); } -#include <help_end.h> const char *myisam_stats_method_names[] = {"nulls_unequal", "nulls_equal", "nulls_ignored", NullS}; @@ -476,11 +468,6 @@ get_one_option(int optid, char *argument) { switch (optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'a': if (argument == disabled_my_option) check_param.testflag&= ~T_STATISTICS; diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index d88ebdf5f12..130a96bc9e0 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -347,11 +347,11 @@ typedef struct st_mi_sort_param int (*key_read)(struct st_mi_sort_param *,void *); int (*key_write)(struct st_mi_sort_param *, const void *); void (*lock_in_memory)(MI_CHECK *); - NEAR int (*write_keys)(struct st_mi_sort_param *, register uchar **, - uint , struct st_buffpek *, IO_CACHE *); - NEAR uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint); - NEAR int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *, - uint, uint); + int (*write_keys)(struct st_mi_sort_param *, register uchar **, + uint , struct st_buffpek *, IO_CACHE *); + uint (*read_to_buffer)(IO_CACHE *,struct st_buffpek *, uint); + int (*write_key)(struct st_mi_sort_param *, IO_CACHE *,uchar *, + uint, uint); } MI_SORT_PARAM; /* Some defines used by isam-funktions */ @@ -475,8 +475,8 @@ extern mysql_mutex_t THR_LOCK_myisam; /* Some extern variables */ extern LIST *myisam_open_list; -extern uchar NEAR myisam_file_magic[],NEAR myisam_pack_file_magic[]; -extern uint NEAR myisam_read_vec[],NEAR myisam_readnext_vec[]; +extern uchar myisam_file_magic[], myisam_pack_file_magic[]; +extern uint myisam_read_vec[], myisam_readnext_vec[]; extern uint myisam_quick_table_bits; extern File myisam_log_file; extern ulong myisam_pid; @@ -774,9 +774,9 @@ void _mi_report_crashed(MI_INFO *file, const char *message, /* Functions needed by mi_check */ volatile int *killed_ptr(MI_CHECK *param); -void mi_check_print_error _VARARGS((MI_CHECK *param, const char *fmt,...)); -void mi_check_print_warning _VARARGS((MI_CHECK *param, const char *fmt,...)); -void mi_check_print_info _VARARGS((MI_CHECK *param, const char *fmt,...)); +void mi_check_print_error(MI_CHECK *param, const char *fmt,...); +void mi_check_print_warning(MI_CHECK *param, const char *fmt,...); +void mi_check_print_info(MI_CHECK *param, const char *fmt,...); int flush_pending_blocks(MI_SORT_PARAM *param); int sort_ft_buf_flush(MI_SORT_PARAM *sort_param); int thr_write_keys(MI_SORT_PARAM *sort_param); diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c index 1733d7140cd..d3da0eab22c 100644 --- a/storage/myisam/myisamlog.c +++ b/storage/myisam/myisamlog.c @@ -248,7 +248,6 @@ static void get_options(register int *argc, register char ***argv) /* Fall through */ case 'I': case '?': -#include <help_start.h> printf("%s Ver 1.4 for %s at %s\n",my_progname,SYSTEM_TYPE, MACHINE_TYPE); puts("By Monty, for your professional use\n"); @@ -270,7 +269,6 @@ static void get_options(register int *argc, register char ***argv) puts("If a recover is done all writes and all possibly updates and deletes is done\nand errors are only counted."); puts("If one gives table names as arguments only these tables will be updated\n"); help=1; -#include <help_end.h> break; default: printf("illegal option: \"-%c\"\n",*pos); diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c index d4997a2bcbb..4cd305fdc69 100644 --- a/storage/myisam/myisampack.c +++ b/storage/myisam/myisampack.c @@ -23,9 +23,6 @@ #include <queues.h> #include <my_tree.h> #include "mysys_err.h" -#ifdef MSDOS -#include <io.h> -#endif #ifndef __GNU_LIBRARY__ #define __GNU_LIBRARY__ /* Skip warnings in getopt.h */ #endif @@ -256,14 +253,10 @@ int main(int argc, char **argv) #endif } -enum options_mp {OPT_CHARSETS_DIR_MP=256, OPT_AUTO_CLOSE}; +enum options_mp {OPT_CHARSETS_DIR_MP=256}; static struct my_option my_long_options[] = { -#ifdef __NETWARE__ - {"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"backup", 'b', "Make a backup of the table as table_name.OLD.", &backup, &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR_MP, @@ -295,13 +288,11 @@ static struct my_option my_long_options[] = { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; -#include <help_start.h> static void print_version(void) { printf("%s Ver 1.23 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); - NETWARE_SET_SCREEN_MODE(1); } @@ -323,7 +314,6 @@ static void usage(void) my_print_variables(my_long_options); } -#include <help_end.h> static my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), @@ -332,11 +322,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), uint length; switch(optid) { -#ifdef __NETWARE__ - case OPT_AUTO_CLOSE: - setscreenmode(SCR_AUTOCLOSE_ON_EXIT); - break; -#endif case 'f': force_pack= 1; tmpfile_createflag= O_RDWR | O_TRUNC; diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index a824de8c9fb..9532b9f0474 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -19,7 +19,7 @@ */ #include "fulltext.h" -#if defined(MSDOS) || defined(__WIN__) +#if defined(__WIN__) #include <fcntl.h> #else #include <stddef.h> @@ -41,46 +41,46 @@ Pointers of functions for store and read keys from temp file */ -extern void print_error _VARARGS((const char *fmt,...)); +extern void print_error(const char *fmt,...); /* Functions defined in this file */ -static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info,uint keys, - uchar **sort_keys, - DYNAMIC_ARRAY *buffpek,int *maxbuffer, - IO_CACHE *tempfile, - IO_CACHE *tempfile_for_exceptions); -static int NEAR_F write_keys(MI_SORT_PARAM *info,uchar **sort_keys, - uint count, BUFFPEK *buffpek,IO_CACHE *tempfile); -static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, - IO_CACHE *tempfile); -static int NEAR_F write_index(MI_SORT_PARAM *info,uchar * *sort_keys, - uint count); -static int NEAR_F merge_many_buff(MI_SORT_PARAM *info,uint keys, - uchar * *sort_keys, - BUFFPEK *buffpek,int *maxbuffer, - IO_CACHE *t_file); -static uint NEAR_F read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek, - uint sort_length); -static int NEAR_F merge_buffers(MI_SORT_PARAM *info,uint keys, - IO_CACHE *from_file, IO_CACHE *to_file, - uchar * *sort_keys, BUFFPEK *lastbuff, - BUFFPEK *Fb, BUFFPEK *Tb); -static int NEAR_F merge_index(MI_SORT_PARAM *,uint,uchar **,BUFFPEK *, int, - IO_CACHE *); +static ha_rows find_all_keys(MI_SORT_PARAM *info,uint keys, + uchar **sort_keys, + DYNAMIC_ARRAY *buffpek,int *maxbuffer, + IO_CACHE *tempfile, + IO_CACHE *tempfile_for_exceptions); +static int write_keys(MI_SORT_PARAM *info,uchar **sort_keys, + uint count, BUFFPEK *buffpek,IO_CACHE *tempfile); +static int write_key(MI_SORT_PARAM *info, uchar *key, + IO_CACHE *tempfile); +static int write_index(MI_SORT_PARAM *info,uchar * *sort_keys, + uint count); +static int merge_many_buff(MI_SORT_PARAM *info,uint keys, + uchar * *sort_keys, + BUFFPEK *buffpek,int *maxbuffer, + IO_CACHE *t_file); +static uint read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek, + uint sort_length); +static int merge_buffers(MI_SORT_PARAM *info,uint keys, + IO_CACHE *from_file, IO_CACHE *to_file, + uchar * *sort_keys, BUFFPEK *lastbuff, + BUFFPEK *Fb, BUFFPEK *Tb); +static int merge_index(MI_SORT_PARAM *,uint,uchar **,BUFFPEK *, int, + IO_CACHE *); static int flush_ft_buf(MI_SORT_PARAM *info); -static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,uchar **sort_keys, - uint count, BUFFPEK *buffpek, - IO_CACHE *tempfile); -static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek, - uint sort_length); -static int NEAR_F write_merge_key(MI_SORT_PARAM *info, IO_CACHE *to_file, - uchar *key, uint sort_length, uint count); -static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, - IO_CACHE *to_file, - uchar* key, uint sort_length, - uint count); +static int write_keys_varlen(MI_SORT_PARAM *info,uchar **sort_keys, + uint count, BUFFPEK *buffpek, + IO_CACHE *tempfile); +static uint read_to_buffer_varlen(IO_CACHE *fromfile,BUFFPEK *buffpek, + uint sort_length); +static int write_merge_key(MI_SORT_PARAM *info, IO_CACHE *to_file, + uchar *key, uint sort_length, uint count); +static int write_merge_key_varlen(MI_SORT_PARAM *info, + IO_CACHE *to_file, + uchar* key, uint sort_length, + uint count); static inline int my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs); @@ -253,10 +253,10 @@ err: /* Search after all keys and place them in a temp. file */ -static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, uint keys, - uchar **sort_keys, DYNAMIC_ARRAY *buffpek, - int *maxbuffer, IO_CACHE *tempfile, - IO_CACHE *tempfile_for_exceptions) +static ha_rows find_all_keys(MI_SORT_PARAM *info, uint keys, + uchar **sort_keys, DYNAMIC_ARRAY *buffpek, + int *maxbuffer, IO_CACHE *tempfile, + IO_CACHE *tempfile_for_exceptions) { int error; uint idx; @@ -641,8 +641,8 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) /* Write all keys in memory to file for later merge */ -static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, - uint count, BUFFPEK *buffpek, IO_CACHE *tempfile) +static int write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, + uint count, BUFFPEK *buffpek, IO_CACHE *tempfile) { uchar **end; uint sort_length=info->key_length; @@ -682,10 +682,10 @@ my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, uchar *bufs) } -static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, - register uchar **sort_keys, - uint count, BUFFPEK *buffpek, - IO_CACHE *tempfile) +static int write_keys_varlen(MI_SORT_PARAM *info, + register uchar **sort_keys, + uint count, BUFFPEK *buffpek, + IO_CACHE *tempfile) { uchar **end; int err; @@ -709,8 +709,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, } /* write_keys_varlen */ -static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, - IO_CACHE *tempfile) +static int write_key(MI_SORT_PARAM *info, uchar *key, IO_CACHE *tempfile) { uint key_length=info->real_key_length; DBUG_ENTER("write_key"); @@ -729,8 +728,8 @@ static int NEAR_F write_key(MI_SORT_PARAM *info, uchar *key, /* Write index */ -static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys, - register uint count) +static int write_index(MI_SORT_PARAM *info, register uchar **sort_keys, + register uint count) { DBUG_ENTER("write_index"); @@ -747,9 +746,9 @@ static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys, /* Merge buffers to make < MERGEBUFF2 buffers */ -static int NEAR_F merge_many_buff(MI_SORT_PARAM *info, uint keys, - uchar **sort_keys, BUFFPEK *buffpek, - int *maxbuffer, IO_CACHE *t_file) +static int merge_many_buff(MI_SORT_PARAM *info, uint keys, + uchar **sort_keys, BUFFPEK *buffpek, + int *maxbuffer, IO_CACHE *t_file) { register int i; IO_CACHE t_file2, *from_file, *to_file, *temp; @@ -810,8 +809,8 @@ cleanup: -1 Error */ -static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, - uint sort_length) +static uint read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, + uint sort_length) { register uint count; uint length; @@ -830,8 +829,8 @@ static uint NEAR_F read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, return (count*sort_length); } /* read_to_buffer */ -static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek, - uint sort_length) +static uint read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek, + uint sort_length) { register uint count; uint16 length_of_key = 0; @@ -862,9 +861,9 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek, } /* read_to_buffer_varlen */ -static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, - IO_CACHE *to_file, uchar* key, - uint sort_length, uint count) +static int write_merge_key_varlen(MI_SORT_PARAM *info, + IO_CACHE *to_file, uchar* key, + uint sort_length, uint count) { uint idx; uchar *bufs = key; @@ -880,9 +879,9 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info, } -static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), - IO_CACHE *to_file, uchar *key, - uint sort_length, uint count) +static int write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), + IO_CACHE *to_file, uchar *key, + uint sort_length, uint count) { return my_b_write(to_file, key, (size_t) sort_length*count); } @@ -892,7 +891,7 @@ static int NEAR_F write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), If to_file == 0 then use info->key_write */ -static int NEAR_F +static int merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file, IO_CACHE *to_file, uchar **sort_keys, BUFFPEK *lastbuff, BUFFPEK *Fb, BUFFPEK *Tb) @@ -1035,7 +1034,7 @@ err: /* Do a merge to output-file (save only positions) */ -static int NEAR_F +static int merge_index(MI_SORT_PARAM *info, uint keys, uchar **sort_keys, BUFFPEK *buffpek, int maxbuffer, IO_CACHE *tempfile) { diff --git a/storage/myisammrg/CMakeLists.txt b/storage/myisammrg/CMakeLists.txt index 739bcd565bc..739bcd565bc 100755..100644 --- a/storage/myisammrg/CMakeLists.txt +++ b/storage/myisammrg/CMakeLists.txt diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 6e3047afb34..f41629ff882 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -299,9 +299,8 @@ extern "C" int myisammrg_parent_open_callback(void *callback_param, if (! db || ! table_name) DBUG_RETURN(1); - DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", db_length, db, - table_name_length, table_name)); - + DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", (int) db_length, db, + (int) table_name_length, table_name)); /* Convert to lowercase if required. */ if (lower_case_table_names && table_name_length) diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c index e4793ffe672..c9e19d32e96 100644 --- a/storage/myisammrg/myrg_open.c +++ b/storage/myisammrg/myrg_open.c @@ -18,9 +18,6 @@ #include "myrg_def.h" #include <stddef.h> #include <errno.h> -#ifdef VMS -#include "mrg_static.c" -#endif /* open a MyISAM MERGE table diff --git a/storage/ndb/src/common/portlib/NdbMutex.c b/storage/ndb/src/common/portlib/NdbMutex.c index c9184e5d1f2..5595baba7c4 100644 --- a/storage/ndb/src/common/portlib/NdbMutex.c +++ b/storage/ndb/src/common/portlib/NdbMutex.c @@ -24,36 +24,31 @@ NdbMutex* NdbMutex_Create(void) { NdbMutex* pNdbMutex; int result; - DBUG_ENTER("NdbMutex_Create"); - + pNdbMutex = (NdbMutex*)NdbMem_Allocate(sizeof(NdbMutex)); - DBUG_PRINT("info",("NdbMem_Allocate 0x%lx", (long) pNdbMutex)); - + if (pNdbMutex == NULL) - DBUG_RETURN(NULL); - + return NULL; + result = pthread_mutex_init(pNdbMutex, NULL); assert(result == 0); - - DBUG_RETURN(pNdbMutex); + + return pNdbMutex; } int NdbMutex_Destroy(NdbMutex* p_mutex) { int result; - DBUG_ENTER("NdbMutex_Destroy"); if (p_mutex == NULL) - DBUG_RETURN(-1); + return -1; result = pthread_mutex_destroy(p_mutex); - DBUG_PRINT("info",("NdbMem_Free 0x%lx", (long) p_mutex)); NdbMem_Free(p_mutex); - - DBUG_RETURN(result); + return result; } diff --git a/storage/ndb/src/mgmclient/main.cpp b/storage/ndb/src/mgmclient/main.cpp index fbd81c71700..980530953ad 100644 --- a/storage/ndb/src/mgmclient/main.cpp +++ b/storage/ndb/src/mgmclient/main.cpp @@ -20,7 +20,7 @@ extern "C" { #if defined( __WIN__) #include <conio.h> -#elif !defined(__NETWARE__) +#else #include <readline/readline.h> extern "C" int add_history(const char *command); /* From readline directory */ extern "C" int read_history(const char *command); diff --git a/storage/ndb/src/mgmsrv/main.cpp b/storage/ndb/src/mgmsrv/main.cpp index 16c560868ef..26198a44a23 100644 --- a/storage/ndb/src/mgmsrv/main.cpp +++ b/storage/ndb/src/mgmsrv/main.cpp @@ -48,7 +48,7 @@ const char *load_default_groups[]= { "mysql_cluster","ndb_mgmd",0 }; extern "C" { #if defined( __WIN__) #include <conio.h> -#elif !defined(__NETWARE__) +#else #include <readline/readline.h> extern "C" int add_history(const char *command); /* From readline directory */ #define HAVE_READLINE diff --git a/storage/ndb/src/ndbapi/DictCache.cpp b/storage/ndb/src/ndbapi/DictCache.cpp index 04be3711847..9c66b2be9d2 100644 --- a/storage/ndb/src/ndbapi/DictCache.cpp +++ b/storage/ndb/src/ndbapi/DictCache.cpp @@ -20,8 +20,10 @@ #include <NdbCondition.h> #include <NdbSleep.h> -static NdbTableImpl f_invalid_table; -static NdbTableImpl f_altered_table; +static NdbTableImpl * f_invalid_table = 0; +static NdbTableImpl * f_altered_table = 0; + +static int ndb_dict_cache_count = 0; Ndb_local_table_info * Ndb_local_table_info::create(NdbTableImpl *table_impl, Uint32 sz) @@ -93,11 +95,29 @@ GlobalDictCache::GlobalDictCache(){ DBUG_ENTER("GlobalDictCache::GlobalDictCache"); m_tableHash.createHashTable(); m_waitForTableCondition = NdbCondition_Create(); + if (f_invalid_table == NULL) + f_invalid_table = new NdbTableImpl(); + if (f_altered_table == NULL) + f_altered_table = new NdbTableImpl(); + ndb_dict_cache_count++; DBUG_VOID_RETURN; } GlobalDictCache::~GlobalDictCache(){ DBUG_ENTER("GlobalDictCache::~GlobalDictCache"); + if (--ndb_dict_cache_count == 0) + { + if (f_invalid_table) + { + delete f_invalid_table; + f_invalid_table = 0; + } + if (f_altered_table) + { + delete f_altered_table; + f_altered_table = 0; + } + } NdbElement_t<Vector<TableVersion> > * curr = m_tableHash.getNext(0); while(curr != 0){ Vector<TableVersion> * vers = curr->theData; @@ -254,7 +274,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab) TableVersion & ver = vers->back(); if(ver.m_status != RETREIVING || !(ver.m_impl == 0 || - ver.m_impl == &f_invalid_table || ver.m_impl == &f_altered_table) || + ver.m_impl == f_invalid_table || ver.m_impl == f_altered_table) || ver.m_version != 0 || ver.m_refCount == 0){ abort(); @@ -271,7 +291,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab) ver.m_version = tab->m_version; ver.m_status = OK; } - else if (ver.m_impl == &f_invalid_table) + else if (ver.m_impl == f_invalid_table) { DBUG_PRINT("info", ("Table DROPPED invalid")); ver.m_impl = tab; @@ -279,7 +299,7 @@ GlobalDictCache::put(const char * name, NdbTableImpl * tab) ver.m_status = DROPPED; ver.m_impl->m_status = NdbDictionary::Object::Invalid; } - else if(ver.m_impl == &f_altered_table) + else if(ver.m_impl == f_altered_table) { DBUG_PRINT("info", ("Table DROPPED altered")); ver.m_impl = tab; @@ -440,7 +460,7 @@ GlobalDictCache::alter_table_rep(const char * name, if(i == sz - 1 && ver.m_status == RETREIVING) { - ver.m_impl = altered ? &f_altered_table : &f_invalid_table; + ver.m_impl = altered ? f_altered_table : f_invalid_table; DBUG_VOID_RETURN; } } diff --git a/storage/perfschema/CMakeLists.txt b/storage/perfschema/CMakeLists.txt index 6c7731f2d07..5cd651a35bd 100644 --- a/storage/perfschema/CMakeLists.txt +++ b/storage/perfschema/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc. +# Copyright (c) 2009, 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 @@ -10,9 +10,8 @@ # 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 - +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include diff --git a/storage/perfschema/Makefile.am b/storage/perfschema/Makefile.am index 8c30c812bc6..374415cfdfd 100644 --- a/storage/perfschema/Makefile.am +++ b/storage/perfschema/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2009 Sun Microsystems, Inc +# 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 @@ -10,8 +10,8 @@ # 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 +# 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 diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc index 588ba5edec1..0fac734f7a0 100644 --- a/storage/perfschema/ha_perfschema.cc +++ b/storage/perfschema/ha_perfschema.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,18 +10,19 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/ha_perfschema.cc Performance schema storage engine (implementation). */ -#include "sql_priv.h" -#include "unireg.h" -#include "ha_perfschema.h" +#include "my_global.h" +#include "my_pthread.h" +#include "sql_plugin.h" #include "mysql/plugin.h" +#include "ha_perfschema.h" #include "pfs_engine_table.h" #include "pfs_column_values.h" #include "pfs_instr_class.h" @@ -145,7 +146,7 @@ mysql_declare_plugin(perfschema) MYSQL_STORAGE_ENGINE_PLUGIN, &pfs_storage_engine, pfs_engine_name, - "Marc Alff, Sun Microsystems", + "Marc Alff, Oracle", /* Formerly Sun Microsystems, formerly MySQL */ "Performance Schema", PLUGIN_LICENSE_GPL, pfs_init_func, /* Plugin Init */ diff --git a/storage/perfschema/ha_perfschema.h b/storage/perfschema/ha_perfschema.h index 92cc0476e73..2c7b45fbbf7 100644 --- a/storage/perfschema/ha_perfschema.h +++ b/storage/perfschema/ha_perfschema.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef HA_PERFSCHEMA_H #define HA_PERFSCHEMA_H diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc index 3cd637ffa66..93c9cf14e9d 100644 --- a/storage/perfschema/pfs.cc +++ b/storage/perfschema/pfs.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs.cc @@ -1093,7 +1093,8 @@ static void delete_thread_v1(PSI_thread *thread) } static PSI_mutex_locker* -get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op) +get_thread_mutex_locker_v1(PSI_mutex_locker_state *state, + PSI_mutex *mutex, PSI_mutex_operation op) { PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex); DBUG_ASSERT((int) op >= 0); @@ -1138,7 +1139,8 @@ get_thread_mutex_locker_v1(PSI_mutex *mutex, PSI_mutex_operation op) } static PSI_rwlock_locker* -get_thread_rwlock_locker_v1(PSI_rwlock *rwlock, PSI_rwlock_operation op) +get_thread_rwlock_locker_v1(PSI_rwlock_locker_state *state, + PSI_rwlock *rwlock, PSI_rwlock_operation op) { PFS_rwlock *pfs_rwlock= reinterpret_cast<PFS_rwlock*> (rwlock); DBUG_ASSERT(static_cast<int> (op) >= 0); @@ -1184,7 +1186,8 @@ get_thread_rwlock_locker_v1(PSI_rwlock *rwlock, PSI_rwlock_operation op) } static PSI_cond_locker* -get_thread_cond_locker_v1(PSI_cond *cond, PSI_mutex * /* unused: mutex */, +get_thread_cond_locker_v1(PSI_cond_locker_state *state, + PSI_cond *cond, PSI_mutex * /* unused: mutex */, PSI_cond_operation op) { /* @@ -1242,7 +1245,8 @@ get_thread_cond_locker_v1(PSI_cond *cond, PSI_mutex * /* unused: mutex */, } static PSI_table_locker* -get_thread_table_locker_v1(PSI_table *table) +get_thread_table_locker_v1(PSI_table_locker_state *state, + PSI_table *table) { PFS_table *pfs_table= reinterpret_cast<PFS_table*> (table); DBUG_ASSERT(pfs_table != NULL); @@ -1284,7 +1288,8 @@ get_thread_table_locker_v1(PSI_table *table) } static PSI_file_locker* -get_thread_file_name_locker_v1(PSI_file_key key, +get_thread_file_name_locker_v1(PSI_file_locker_state *state, + PSI_file_key key, PSI_file_operation op, const char *name, const void *identity) { @@ -1341,7 +1346,8 @@ get_thread_file_name_locker_v1(PSI_file_key key, } static PSI_file_locker* -get_thread_file_stream_locker_v1(PSI_file *file, PSI_file_operation op) +get_thread_file_stream_locker_v1(PSI_file_locker_state *state, + PSI_file *file, PSI_file_operation op) { PFS_file *pfs_file= reinterpret_cast<PFS_file*> (file); @@ -1392,7 +1398,8 @@ get_thread_file_stream_locker_v1(PSI_file *file, PSI_file_operation op) } static PSI_file_locker* -get_thread_file_descriptor_locker_v1(File file, PSI_file_operation op) +get_thread_file_descriptor_locker_v1(PSI_file_locker_state *state, + File file, PSI_file_operation op) { int index= static_cast<int> (file); @@ -1462,7 +1469,7 @@ get_thread_file_descriptor_locker_v1(File file, PSI_file_operation op) return NULL; } -static void unlock_mutex_v1(PSI_thread * thread, PSI_mutex *mutex) +static void unlock_mutex_v1(PSI_mutex *mutex) { PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex); DBUG_ASSERT(pfs_mutex != NULL); @@ -1501,7 +1508,7 @@ static void unlock_mutex_v1(PSI_thread * thread, PSI_mutex *mutex) #endif } -static void unlock_rwlock_v1(PSI_thread *thread, PSI_rwlock *rwlock) +static void unlock_rwlock_v1(PSI_rwlock *rwlock) { PFS_rwlock *pfs_rwlock= reinterpret_cast<PFS_rwlock*> (rwlock); DBUG_ASSERT(pfs_rwlock != NULL); @@ -1577,7 +1584,7 @@ static void unlock_rwlock_v1(PSI_thread *thread, PSI_rwlock *rwlock) #endif } -static void signal_cond_v1(PSI_thread *thread, PSI_cond* cond) +static void signal_cond_v1(PSI_cond* cond) { PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond); DBUG_ASSERT(pfs_cond != NULL); @@ -1585,7 +1592,7 @@ static void signal_cond_v1(PSI_thread *thread, PSI_cond* cond) pfs_cond->m_cond_stat.m_signal_count++; } -static void broadcast_cond_v1(PSI_thread *thread, PSI_cond* cond) +static void broadcast_cond_v1(PSI_cond* cond) { PFS_cond *pfs_cond= reinterpret_cast<PFS_cond*> (cond); DBUG_ASSERT(pfs_cond != NULL); diff --git a/storage/perfschema/pfs.h b/storage/perfschema/pfs.h index f529d09a05c..4e11736b1b9 100644 --- a/storage/perfschema/pfs.h +++ b/storage/perfschema/pfs.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_H #define PFS_H @@ -23,9 +23,8 @@ #define HAVE_PSI_1 -#include <sql_priv.h> #include <my_global.h> -#include <unireg.h> +#include <my_pthread.h> #include <mysql/psi/psi.h> extern struct PSI_bootstrap PFS_bootstrap; diff --git a/storage/perfschema/pfs_atomic.cc b/storage/perfschema/pfs_atomic.cc index c33bb251767..06090accdc6 100644 --- a/storage/perfschema/pfs_atomic.cc +++ b/storage/perfschema/pfs_atomic.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* Copyright (c) 2009, 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_atomic.cc diff --git a/storage/perfschema/pfs_atomic.h b/storage/perfschema/pfs_atomic.h index 7833c5f1c7a..b0070f7b8d0 100644 --- a/storage/perfschema/pfs_atomic.h +++ b/storage/perfschema/pfs_atomic.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* Copyright (c) 2009, 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_ATOMIC_H #define PFS_ATOMIC_H diff --git a/storage/perfschema/pfs_check.cc b/storage/perfschema/pfs_check.cc index 4ef4b8bdbc6..c52be6f0da2 100644 --- a/storage/perfschema/pfs_check.cc +++ b/storage/perfschema/pfs_check.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* Copyright (c) 2009, 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_check.cc @@ -23,7 +23,6 @@ */ #include "my_global.h" -#include "sql_priv.h" #include "pfs_server.h" #include "pfs_engine_table.h" diff --git a/storage/perfschema/pfs_column_types.h b/storage/perfschema/pfs_column_types.h index c6f652d57a0..96b33636ff9 100644 --- a/storage/perfschema/pfs_column_types.h +++ b/storage/perfschema/pfs_column_types.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_COLUMN_TYPES_H #define PFS_COLUMN_TYPES_H diff --git a/storage/perfschema/pfs_column_values.cc b/storage/perfschema/pfs_column_values.cc index 6da1e04e63a..ea65441b8c6 100644 --- a/storage/perfschema/pfs_column_values.cc +++ b/storage/perfschema/pfs_column_values.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_column_values.cc @@ -19,7 +19,6 @@ schema tables (implementation). */ -#include "sql_priv.h" #include "pfs_column_values.h" LEX_STRING PERFORMANCE_SCHEMA_str= diff --git a/storage/perfschema/pfs_column_values.h b/storage/perfschema/pfs_column_values.h index 0172ddd1d18..f9e7f90dbc9 100644 --- a/storage/perfschema/pfs_column_values.h +++ b/storage/perfschema/pfs_column_values.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_COLUMN_VALUES_H #define PFS_COLUMN_VALUES_H diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index 857b8a66de7..7b6fd055729 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,15 +10,14 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_engine_table.cc Performance schema tables (implementation). */ -#include "sql_priv.h" #include "pfs_engine_table.h" #include "table_events_waits.h" @@ -36,6 +35,7 @@ /* For show status */ #include "pfs_column_values.h" #include "pfs_instr.h" +#include "pfs_global.h" #include "sql_base.h" // close_thread_tables #include "lock.h" // MYSQL_LOCK_IGNORE_TIMEOUT @@ -108,7 +108,12 @@ void PFS_check_intact::report_error(uint code, const char *fmt, ...) my_vsnprintf(buff, sizeof(buff), fmt, args); va_end(args); - my_message(code, buff, MYF(0)); + /* + This is an install/upgrade issue: + - do not report it in the user connection, there is none in main(), + - report it in the server error log. + */ + sql_print_error("%s", buff); } /** @@ -139,6 +144,9 @@ void PFS_engine_table_share::check_one_table(THD *thd) m_checked= true; close_thread_tables(thd); } + else + sql_print_error(ER(ER_WRONG_NATIVE_TABLE_STRUCTURE), + PERFORMANCE_SCHEMA_str.str, m_name.str); lex_end(&dummy_lex); thd->lex= old_lex; @@ -327,10 +335,10 @@ ulonglong PFS_engine_table::get_field_enum(Field *f) return f2->val_int(); } -int PFS_readonly_table::update_row_values(TABLE *, - const unsigned char *, - unsigned char *, - Field **) +int PFS_engine_table::update_row_values(TABLE *, + const unsigned char *, + unsigned char *, + Field **) { my_error(ER_WRONG_PERFSCHEMA_USAGE, MYF(0)); return HA_ERR_WRONG_COMMAND; @@ -466,7 +474,22 @@ PFS_unknown_acl pfs_unknown_acl; ACL_internal_access_result PFS_unknown_acl::check(ulong want_access, ulong *save_priv) const { - return ACL_INTERNAL_ACCESS_DENIED; + const ulong always_forbidden= INSERT_ACL | UPDATE_ACL | DELETE_ACL + | CREATE_ACL | REFERENCES_ACL | INDEX_ACL | ALTER_ACL + | CREATE_VIEW_ACL | TRIGGER_ACL | LOCK_TABLES_ACL; + + if (unlikely(want_access & always_forbidden)) + return ACL_INTERNAL_ACCESS_DENIED; + + /* + There is no point in hidding (by enforcing ACCESS_DENIED for SELECT_ACL + on performance_schema.*) tables that do not exist anyway. + When SELECT_ACL is granted on performance_schema.* or *.*, + SELECT * from performance_schema.wrong_table + will fail with a more understandable ER_NO_SUCH_TABLE error, + instead of ER_TABLEACCESS_DENIED_ERROR. + */ + return ACL_INTERNAL_ACCESS_CHECK_GRANT; } /** @@ -678,6 +701,7 @@ bool pfs_show_status(handlerton *hton, THD *thd, case 40: name= "(PFS_FILE_HANDLE).MEMORY"; size= file_handle_max * sizeof(PFS_file*); + total_memory+= size; break; case 41: name= "EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME.ROW_SIZE"; @@ -692,13 +716,41 @@ bool pfs_show_status(handlerton *hton, THD *thd, size= thread_max * instr_class_per_thread * sizeof(PFS_single_stat_chain); total_memory+= size; break; + case 44: + name= "(PFS_TABLE_SHARE).ROW_SIZE"; + size= sizeof(PFS_table_share); + break; + case 45: + name= "(PFS_TABLE_SHARE).ROW_COUNT"; + size= table_share_max; + break; + case 46: + name= "(PFS_TABLE_SHARE).MEMORY"; + size= table_share_max * sizeof(PFS_table_share); + total_memory+= size; + break; + case 47: + name= "(PFS_TABLE).ROW_SIZE"; + size= sizeof(PFS_table); + break; + case 48: + name= "(PFS_TABLE).ROW_COUNT"; + size= table_max; + break; + case 49: + name= "(PFS_TABLE).MEMORY"; + size= table_max * sizeof(PFS_table); + total_memory+= size; + break; /* This case must be last, for aggregation in total_memory. */ - case 44: + case 50: name= "PERFORMANCE_SCHEMA.MEMORY"; size= total_memory; + /* This will fail if something is not advertised here */ + DBUG_ASSERT(size == pfs_allocated_memory); break; default: goto end; diff --git a/storage/perfschema/pfs_engine_table.h b/storage/perfschema/pfs_engine_table.h index b4c7a4ee866..ec73c5a3688 100644 --- a/storage/perfschema/pfs_engine_table.h +++ b/storage/perfschema/pfs_engine_table.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_ENGINE_TABLE_H #define PFS_ENGINE_TABLE_H @@ -81,7 +81,7 @@ protected: @param fields Table fields */ virtual int update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, Field **fields)= 0; + unsigned char *new_buf, Field **fields); /** Constructor. @@ -151,27 +151,6 @@ struct PFS_engine_table_share bool m_checked; }; -/** Adapter for read only PERFORMANCE_SCHEMA tables. */ -class PFS_readonly_table : public PFS_engine_table -{ -protected: - /** - Constructor. - @param share table share - @param pos address of the m_pos position member - */ - PFS_readonly_table(const PFS_engine_table_share *share, void *pos) - : PFS_engine_table(share, pos) - {} - - ~PFS_readonly_table() - {} - - virtual int update_row_values(TABLE *table, const unsigned char *old_buf, - unsigned char *new_buf, Field **fields); - -}; - class PFS_readonly_acl : public ACL_internal_table_access { public: diff --git a/storage/perfschema/pfs_events_waits.cc b/storage/perfschema/pfs_events_waits.cc index 22448af7c5f..aae8f9dc8c1 100644 --- a/storage/perfschema/pfs_events_waits.cc +++ b/storage/perfschema/pfs_events_waits.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_events_waits.cc diff --git a/storage/perfschema/pfs_events_waits.h b/storage/perfschema/pfs_events_waits.h index c677e83ad34..9a5ed8644f3 100644 --- a/storage/perfschema/pfs_events_waits.h +++ b/storage/perfschema/pfs_events_waits.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_EVENTS_WAITS_H #define PFS_EVENTS_WAITS_H diff --git a/storage/perfschema/pfs_global.cc b/storage/perfschema/pfs_global.cc index cac7d0b06e7..fa57f335325 100644 --- a/storage/perfschema/pfs_global.cc +++ b/storage/perfschema/pfs_global.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_global.cc @@ -26,6 +26,7 @@ #include <string.h> bool pfs_initialized= false; +ulonglong pfs_allocated_memory= 0; /** Memory allocation for the performance schema. @@ -38,7 +39,9 @@ void *pfs_malloc(size_t size, myf flags) DBUG_ASSERT(size > 0); void *ptr= malloc(size); - if (ptr && (flags & MY_ZEROFILL)) + if (likely(ptr != NULL)) + pfs_allocated_memory+= size; + if (likely((ptr != NULL) && (flags & MY_ZEROFILL))) memset(ptr, 0, size); return ptr; } diff --git a/storage/perfschema/pfs_global.h b/storage/perfschema/pfs_global.h index 37809f8cc2e..6050612e24c 100644 --- a/storage/perfschema/pfs_global.h +++ b/storage/perfschema/pfs_global.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_GLOBAL_H #define PFS_GLOBAL_H @@ -22,6 +22,7 @@ */ extern bool pfs_initialized; +extern ulonglong pfs_allocated_memory; void *pfs_malloc(size_t size, myf flags); #define PFS_MALLOC_ARRAY(n, T, f) \ @@ -30,27 +31,50 @@ void pfs_free(void *ptr); inline uint randomized_index(const void *ptr, uint max_size) { + static uint seed1= 0; + static uint seed2= 0; + uint result; + register intptr value; + if (unlikely(max_size == 0)) return 0; /* - ptr is typically an aligned structure, - so the last bits are not really random, but this has no effect. - Apply a factor A*x to spread - close values of ptr further apart (which helps with arrays), - and to spread values way beyond a typical max_size. - Then, apply a modulo to end within [0, max_size - 1]. - A is big prime numbers, to avoid resonating with max_size, - to have a uniform distribution in [0, max_size - 1]. - The value of A is chosen so that index(ptr) and index(ptr + N) (for arrays) - are likely to be not similar for typical values of max_size - (50, 100, 1000, etc). - In other words, (sizeof(T)*A % max_size) should not be a small number, - to avoid that with 'T array[max_size]', index(array[i]) - and index(array[i + 1]) end up pointing in the same area in [0, max_size - 1]. + ptr is typically an aligned structure, and can be in an array. + - The last bits are not random because of alignment, + so we divide by 8. + - The high bits are mostly constant, especially with 64 bits architectures, + but we keep most of them anyway, by doing computation in intptr. + The high bits are significant depending on where the data is + stored (the data segment, the stack, the heap, ...). + - To spread consecutive cells in an array further, we multiply by + a factor A. This factor should not be too high, which would cause + an overflow and cause loss of randomness (droping the top high bits). + The factor is a prime number, to help spread the distribution. + - To add more noise, and to be more robust if the calling code is + passing a constant value instead of a random identity, + we add the previous results, for hysteresys, with a degree 2 polynom, + X^2 + X + 1. + - Last, a modulo is applied to be within the [0, max_size - 1] range. + Note that seed1 and seed2 are static, and are *not* thread safe, + which is even better. + Effect with arrays: T array[N] + - ptr(i) = & array[i] = & array[0] + i * sizeof(T) + - ptr(i+1) = ptr(i) + sizeof(T). + What we want here, is to have index(i) and index(i+1) fall into + very different areas in [0, max_size - 1], to avoid locality. */ - return static_cast<uint> - (((reinterpret_cast<intptr> (ptr)) * 2166179) % max_size); + value= (reinterpret_cast<intptr> (ptr)) >> 3; + value*= 1789; + value+= seed2 + seed1 + 1; + + result= (static_cast<uint> (value)) % max_size; + + seed2= seed1*seed1; + seed1= result; + + DBUG_ASSERT(result < max_size); + return result; } void pfs_print_error(const char *format, ...); diff --git a/storage/perfschema/pfs_instr.cc b/storage/perfschema/pfs_instr.cc index 9507e2d2582..0c7b25a03de 100644 --- a/storage/perfschema/pfs_instr.cc +++ b/storage/perfschema/pfs_instr.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_instr.cc @@ -21,8 +21,8 @@ #include <string.h> #include "my_global.h" -#include "sql_priv.h" #include "my_sys.h" +#include "pfs.h" #include "pfs_stat.h" #include "pfs_instr.h" #include "pfs_global.h" @@ -411,6 +411,8 @@ void cleanup_instruments(void) thread_instr_class_waits_array= NULL; } +extern "C" +{ static uchar *filename_hash_get_key(const uchar *entry, size_t *length, my_bool) { @@ -425,6 +427,7 @@ static uchar *filename_hash_get_key(const uchar *entry, size_t *length, result= file->m_filename; return const_cast<uchar*> (reinterpret_cast<const uchar*> (result)); } +} /** Initialize the file name hash. @@ -451,6 +454,75 @@ void cleanup_file_hash(void) } } +void PFS_scan::init(uint random, uint max_size) +{ + m_pass= 0; + + if (max_size == 0) + { + /* Degenerated case, no buffer */ + m_pass_max= 0; + return; + } + + DBUG_ASSERT(random < max_size); + + if (PFS_MAX_ALLOC_RETRY < max_size) + { + /* + The buffer is big compared to PFS_MAX_ALLOC_RETRY, + scan it only partially. + */ + if (random + PFS_MAX_ALLOC_RETRY < max_size) + { + /* + Pass 1: [random, random + PFS_MAX_ALLOC_RETRY - 1] + Pass 2: not used. + */ + m_pass_max= 1; + m_first[0]= random; + m_last[0]= random + PFS_MAX_ALLOC_RETRY; + m_first[1]= 0; + m_last[1]= 0; + } + else + { + /* + Pass 1: [random, max_size - 1] + Pass 2: [0, ...] + The combined length of pass 1 and 2 is PFS_MAX_ALLOC_RETRY. + */ + m_pass_max= 2; + m_first[0]= random; + m_last[0]= max_size; + m_first[1]= 0; + m_last[1]= PFS_MAX_ALLOC_RETRY - (max_size - random); + } + } + else + { + /* + The buffer is small compared to PFS_MAX_ALLOC_RETRY, + scan it in full in two passes. + Pass 1: [random, max_size - 1] + Pass 2: [0, random - 1] + */ + m_pass_max= 2; + m_first[0]= random; + m_last[0]= max_size; + m_first[1]= 0; + m_last[1]= random; + } + + DBUG_ASSERT(m_first[0] < max_size); + DBUG_ASSERT(m_first[1] < max_size); + DBUG_ASSERT(m_last[1] <= max_size); + DBUG_ASSERT(m_last[1] <= max_size); + /* The combined length of all passes should not exceed PFS_MAX_ALLOC_RETRY. */ + DBUG_ASSERT((m_last[0] - m_first[0]) + + (m_last[1] - m_first[1]) <= PFS_MAX_ALLOC_RETRY); +} + /** Create instrumentation for a mutex instance. @param klass the mutex class @@ -459,17 +531,15 @@ void cleanup_file_hash(void) */ PFS_mutex* create_mutex(PFS_mutex_class *klass, const void *identity) { - int pass; - uint i= randomized_index(identity, mutex_max); + PFS_scan scan; + uint random= randomized_index(identity, mutex_max); - /* - Pass 1: [random, mutex_max - 1] - Pass 2: [0, mutex_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, mutex_max); + scan.has_pass(); + scan.next_pass()) { - PFS_mutex *pfs= mutex_array + i; - PFS_mutex *pfs_last= mutex_array + mutex_max; + PFS_mutex *pfs= mutex_array + scan.first(); + PFS_mutex *pfs_last= mutex_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -517,17 +587,15 @@ void destroy_mutex(PFS_mutex *pfs) */ PFS_rwlock* create_rwlock(PFS_rwlock_class *klass, const void *identity) { - int pass; - uint i= randomized_index(identity, rwlock_max); + PFS_scan scan; + uint random= randomized_index(identity, rwlock_max); - /* - Pass 1: [random, rwlock_max - 1] - Pass 2: [0, rwlock_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, rwlock_max); + scan.has_pass(); + scan.next_pass()) { - PFS_rwlock *pfs= rwlock_array + i; - PFS_rwlock *pfs_last= rwlock_array + rwlock_max; + PFS_rwlock *pfs= rwlock_array + scan.first(); + PFS_rwlock *pfs_last= rwlock_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -581,17 +649,15 @@ void destroy_rwlock(PFS_rwlock *pfs) */ PFS_cond* create_cond(PFS_cond_class *klass, const void *identity) { - int pass; - uint i= randomized_index(identity, cond_max); + PFS_scan scan; + uint random= randomized_index(identity, cond_max); - /* - Pass 1: [random, cond_max - 1] - Pass 2: [0, cond_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, cond_max); + scan.has_pass(); + scan.next_pass()) { - PFS_cond *pfs= cond_array + i; - PFS_cond *pfs_last= cond_array + cond_max; + PFS_cond *pfs= cond_array + scan.first(); + PFS_cond *pfs_last= cond_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -639,17 +705,15 @@ void destroy_cond(PFS_cond *pfs) PFS_thread* create_thread(PFS_thread_class *klass, const void *identity, ulong thread_id) { - int pass; - uint i= randomized_index(identity, thread_max); + PFS_scan scan; + uint random= randomized_index(identity, thread_max); - /* - Pass 1: [random, thread_max - 1] - Pass 2: [0, thread_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, thread_max); + scan.has_pass(); + scan.next_pass()) { - PFS_thread *pfs= thread_array + i; - PFS_thread *pfs_last= thread_array + thread_max; + PFS_thread *pfs= thread_array + scan.first(); + PFS_thread *pfs_last= thread_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -733,7 +797,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass, const char *filename, uint len) { PFS_file *pfs; - int pass; + PFS_scan scan; if (! filename_hash_inited) { @@ -765,7 +829,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass, - it fits into pfs->m_filename - it is safe to use mysys apis to normalize the file name. */ - memcpy(safe_buffer, filename, FN_REFLEN - 2); + memcpy(safe_buffer, filename, FN_REFLEN - 1); safe_buffer[FN_REFLEN - 1]= 0; safe_filename= safe_buffer; } @@ -776,16 +840,58 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass, Normalize the file name to avoid duplicates when using aliases: - absolute or relative paths - symbolic links + Names are resolved as follows: + - /real/path/to/real_file ==> same + - /path/with/link/to/real_file ==> /real/path/to/real_file + - real_file ==> /real/path/to/real_file + - ./real_file ==> /real/path/to/real_file + - /real/path/to/sym_link ==> same + - /path/with/link/to/sym_link ==> /real/path/to/sym_link + - sym_link ==> /real/path/to/sym_link + - ./sym_link ==> /real/path/to/sym_link + When the last component of a file is a symbolic link, + the last component is *not* resolved, so that all file io + operations on a link (create, read, write, delete) are counted + against the link itself, not the target file. + Resolving the name would lead to create counted against the link, + and read/write/delete counted against the target, leading to + incoherent results and instrumentation leaks. + Also note that, when creating files, this name resolution + works properly for files that do not exist (yet) on the file system. */ char buffer[FN_REFLEN]; + char dirbuffer[FN_REFLEN]; + size_t dirlen; const char *normalized_filename; int normalized_length; - /* - Ignore errors, the file may not exist. - my_realpath always provide a best effort result in buffer. - */ - (void) my_realpath(buffer, safe_filename, MYF(0)); + dirlen= dirname_length(safe_filename); + if (dirlen == 0) + { + dirbuffer[0]= FN_CURLIB; + dirbuffer[1]= FN_LIBCHAR; + dirbuffer[2]= '\0'; + } + else + { + memcpy(dirbuffer, safe_filename, dirlen); + dirbuffer[dirlen]= '\0'; + } + + if (my_realpath(buffer, dirbuffer, MYF(0)) != 0) + { + file_lost++; + return NULL; + } + + /* Append the unresolved file name to the resolved path */ + char *ptr= buffer + strlen(buffer); + char *buf_end= &buffer[sizeof(buffer)-1]; + if (buf_end > ptr) + *ptr++= FN_LIBCHAR; + if (buf_end > ptr) + strncpy(ptr, safe_filename + dirlen, buf_end - ptr); + *buf_end= '\0'; normalized_filename= buffer; normalized_length= strlen(normalized_filename); @@ -806,17 +912,14 @@ search: } /* filename is not constant, just using it for noise on create */ - uint i= randomized_index(filename, file_max); + uint random= randomized_index(filename, file_max); - /* - Pass 1: [random, file_max - 1] - Pass 2: [0, file_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, file_max); + scan.has_pass(); + scan.next_pass()) { - pfs= file_array + i; - PFS_file *pfs_last= file_array + file_max; - + pfs= file_array + scan.first(); + PFS_file *pfs_last= file_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) @@ -901,17 +1004,15 @@ void destroy_file(PFS_thread *thread, PFS_file *pfs) */ PFS_table* create_table(PFS_table_share *share, const void *identity) { - int pass; - uint i= randomized_index(identity, table_max); + PFS_scan scan; + uint random= randomized_index(identity, table_max); - /* - Pass 1: [random, table_max - 1] - Pass 2: [0, table_max - 1] - */ - for (pass= 1; pass <= 2; i=0, pass++) + for (scan.init(random, table_max); + scan.has_pass(); + scan.next_pass()) { - PFS_table *pfs= table_array + i; - PFS_table *pfs_last= table_array + table_max; + PFS_table *pfs= table_array + scan.first(); + PFS_table *pfs_last= table_array + scan.last(); for ( ; pfs < pfs_last; pfs++) { if (pfs->m_lock.is_free()) diff --git a/storage/perfschema/pfs_instr.h b/storage/perfschema/pfs_instr.h index a509d054d69..791e2cd1f8d 100644 --- a/storage/perfschema/pfs_instr.h +++ b/storage/perfschema/pfs_instr.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_INSTR_H #define PFS_INSTR_H @@ -21,7 +21,6 @@ Performance schema instruments (declarations). */ -#include <sql_priv.h> #include "pfs_lock.h" #include "pfs_instr_class.h" #include "pfs_events_waits.h" @@ -136,6 +135,48 @@ struct PFS_table : public PFS_instr */ #define LOCKER_STACK_SIZE 3 +/** + @def PFS_MAX_ALLOC_RETRY + Maximum number of times the code attempts to allocate an item + from internal buffers, before giving up. +*/ +#define PFS_MAX_ALLOC_RETRY 1000 + +#define PFS_MAX_SCAN_PASS 2 + +/** + Helper to scan circular buffers. + Given a buffer of size [0, max_size - 1], + and a random starting point in the buffer, + this helper returns up to two [first, last -1] intervals that: + - fit into the [0, max_size - 1] range, + - have a maximum combined length of at most PFS_MAX_ALLOC_RETRY. +*/ +struct PFS_scan +{ +public: + void init(uint random, uint max_size); + + bool has_pass() const + { return (m_pass < m_pass_max); } + + void next_pass() + { m_pass++; } + + uint first() const + { return m_first[m_pass]; } + + uint last() const + { return m_last[m_pass]; } + +private: + uint m_pass; + uint m_pass_max; + uint m_first[PFS_MAX_SCAN_PASS]; + uint m_last[PFS_MAX_SCAN_PASS]; +}; + + /** Instrumented thread implementation. @see PSI_thread. */ struct PFS_thread { diff --git a/storage/perfschema/pfs_instr_class.cc b/storage/perfschema/pfs_instr_class.cc index d1535aa851b..48547f73628 100644 --- a/storage/perfschema/pfs_instr_class.cc +++ b/storage/perfschema/pfs_instr_class.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_instr_class.cc diff --git a/storage/perfschema/pfs_instr_class.h b/storage/perfschema/pfs_instr_class.h index fa82bceb0c1..bd6560dbb55 100644 --- a/storage/perfschema/pfs_instr_class.h +++ b/storage/perfschema/pfs_instr_class.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_INSTR_CLASS_H #define PFS_INSTR_CLASS_H @@ -38,7 +38,6 @@ */ #define PFS_MAX_FULL_PREFIX_NAME_LENGTH 32 -#include <sql_priv.h> #include <my_global.h> #include <mysql/psi/psi.h> #include "pfs_lock.h" diff --git a/storage/perfschema/pfs_lock.h b/storage/perfschema/pfs_lock.h index 46d7d33617b..5c74d3944ba 100644 --- a/storage/perfschema/pfs_lock.h +++ b/storage/perfschema/pfs_lock.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* Copyright (c) 2009, 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_LOCK_H #define PFS_LOCK_H diff --git a/storage/perfschema/pfs_server.cc b/storage/perfschema/pfs_server.cc index f852a9fe732..0f322a9cb76 100644 --- a/storage/perfschema/pfs_server.cc +++ b/storage/perfschema/pfs_server.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_server.cc @@ -21,7 +21,6 @@ #include "my_global.h" #include "my_sys.h" #include "mysys_err.h" -#include "sql_priv.h" #include "pfs_server.h" #include "pfs.h" #include "pfs_global.h" diff --git a/storage/perfschema/pfs_server.h b/storage/perfschema/pfs_server.h index acf483e1f86..a7af27c1038 100644 --- a/storage/perfschema/pfs_server.h +++ b/storage/perfschema/pfs_server.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_SERVER_H #define PFS_SERVER_H diff --git a/storage/perfschema/pfs_stat.h b/storage/perfschema/pfs_stat.h index 654f292d82c..c78d5c83039 100644 --- a/storage/perfschema/pfs_stat.h +++ b/storage/perfschema/pfs_stat.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_STAT_H #define PFS_STAT_H diff --git a/storage/perfschema/pfs_timer.cc b/storage/perfschema/pfs_timer.cc index 65883b62c32..f30a9f8e865 100644 --- a/storage/perfschema/pfs_timer.cc +++ b/storage/perfschema/pfs_timer.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/pfs_timer.cc diff --git a/storage/perfschema/pfs_timer.h b/storage/perfschema/pfs_timer.h index beba263f45a..cd2a8df9be3 100644 --- a/storage/perfschema/pfs_timer.h +++ b/storage/perfschema/pfs_timer.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef PFS_TIMER_H #define PFS_TIMER_H diff --git a/storage/perfschema/plug.in b/storage/perfschema/plug.in index e6539dc1260..36a1c1e8bda 100644 --- a/storage/perfschema/plug.in +++ b/storage/perfschema/plug.in @@ -1,6 +1,6 @@ dnl -*- ksh -*- -# Copyright (C) 2008-2009 Sun Microsystems, Inc +# 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 @@ -12,8 +12,8 @@ dnl -*- ksh -*- # 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 +# 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. diff --git a/storage/perfschema/table_all_instr.cc b/storage/perfschema/table_all_instr.cc index ffbe31bbadd..f29a006107a 100644 --- a/storage/perfschema/table_all_instr.cc +++ b/storage/perfschema/table_all_instr.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,22 +10,21 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_all_instr.cc Abstract tables for all instruments (implementation). */ -#include "sql_priv.h" #include "my_global.h" #include "my_pthread.h" #include "table_all_instr.h" #include "pfs_global.h" table_all_instr::table_all_instr(const PFS_engine_table_share *share) - : PFS_readonly_table(share, &m_pos), + : PFS_engine_table(share, &m_pos), m_pos(), m_next_pos() {} @@ -154,7 +153,7 @@ int table_all_instr::rnd_pos(const void *pos) table_all_instr_class::table_all_instr_class (const PFS_engine_table_share *share) - : PFS_readonly_table(share, &m_pos), + : PFS_engine_table(share, &m_pos), m_pos(), m_next_pos() {} diff --git a/storage/perfschema/table_all_instr.h b/storage/perfschema/table_all_instr.h index a8767695602..6e404659030 100644 --- a/storage/perfschema/table_all_instr.h +++ b/storage/perfschema/table_all_instr.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_ALL_INSTR_H #define TABLE_ALL_INSTR_H @@ -63,7 +63,7 @@ struct pos_all_instr_class : public PFS_double_index, - a view on all cond classes, - a view on all file classes */ -class table_all_instr_class : public PFS_readonly_table +class table_all_instr_class : public PFS_engine_table { public: virtual int rnd_next(); @@ -122,7 +122,7 @@ struct pos_all_instr : public PFS_double_index, - a view on all cond instances, - a view on all file instances */ -class table_all_instr : public PFS_readonly_table +class table_all_instr : public PFS_engine_table { public: virtual int rnd_next(); diff --git a/storage/perfschema/table_events_waits.cc b/storage/perfschema/table_events_waits.cc index cb565373bd8..a09d7f1ba30 100644 --- a/storage/perfschema/table_events_waits.cc +++ b/storage/perfschema/table_events_waits.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,15 +10,16 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_events_waits.cc Table EVENTS_WAITS_xxx (implementation). */ -#include "sql_priv.h" +#include "my_global.h" +#include "my_pthread.h" #include "table_events_waits.h" #include "pfs_instr_class.h" #include "pfs_instr.h" @@ -165,7 +166,7 @@ table_events_waits_history_long::m_share= table_events_waits_common::table_events_waits_common (const PFS_engine_table_share *share, void *pos) - : PFS_readonly_table(share, pos), + : PFS_engine_table(share, pos), m_row_exists(false) {} diff --git a/storage/perfschema/table_events_waits.h b/storage/perfschema/table_events_waits.h index 5aa16cc0cab..2aa88b54be4 100644 --- a/storage/perfschema/table_events_waits.h +++ b/storage/perfschema/table_events_waits.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_EVENTS_WAITS_H #define TABLE_EVENTS_WAITS_H @@ -121,7 +121,7 @@ struct pos_events_waits_history : public PFS_double_index Adapter, for table sharing the structure of PERFORMANCE_SCHEMA.EVENTS_WAITS_CURRENT. */ -class table_events_waits_common : public PFS_readonly_table +class table_events_waits_common : public PFS_engine_table { protected: virtual int read_row_values(TABLE *table, diff --git a/storage/perfschema/table_events_waits_summary.cc b/storage/perfschema/table_events_waits_summary.cc index 0eca9f6722e..9d0d6fe0f67 100644 --- a/storage/perfschema/table_events_waits_summary.cc +++ b/storage/perfschema/table_events_waits_summary.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,16 +10,16 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_events_waits_summary.cc Table EVENTS_WAITS_SUMMARY_BY_xxx (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr_class.h" #include "pfs_column_types.h" #include "pfs_column_values.h" @@ -101,7 +101,7 @@ table_events_waits_summary_by_thread_by_event_name::delete_all_rows(void) table_events_waits_summary_by_thread_by_event_name ::table_events_waits_summary_by_thread_by_event_name() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(), m_next_pos() {} diff --git a/storage/perfschema/table_events_waits_summary.h b/storage/perfschema/table_events_waits_summary.h index 28c820e5c81..47ec9523d68 100644 --- a/storage/perfschema/table_events_waits_summary.h +++ b/storage/perfschema/table_events_waits_summary.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_EVENTS_WAITS_SUMMARY_H #define TABLE_EVENTS_WAITS_SUMMARY_H @@ -96,7 +96,7 @@ struct pos_events_waits_summary_by_thread_by_event_name /** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME. */ class table_events_waits_summary_by_thread_by_event_name - : public PFS_readonly_table + : public PFS_engine_table { public: /** Table share */ diff --git a/storage/perfschema/table_file_instances.cc b/storage/perfschema/table_file_instances.cc index 3de5cbe4b47..f1676421616 100644 --- a/storage/perfschema/table_file_instances.cc +++ b/storage/perfschema/table_file_instances.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,16 +10,16 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_file_instances.cc Table FILE_INSTANCES (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr.h" #include "pfs_column_types.h" #include "pfs_column_values.h" @@ -72,7 +72,7 @@ PFS_engine_table* table_file_instances::create(void) } table_file_instances::table_file_instances() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} diff --git a/storage/perfschema/table_file_instances.h b/storage/perfschema/table_file_instances.h index fb5298f37b3..7365000b21f 100644 --- a/storage/perfschema/table_file_instances.h +++ b/storage/perfschema/table_file_instances.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_FILE_INSTANCES_H #define TABLE_FILE_INSTANCES_H @@ -45,7 +45,7 @@ struct row_file_instances }; /** Table PERFORMANCE_SCHEMA.FILE_INSTANCES. */ -class table_file_instances : public PFS_readonly_table +class table_file_instances : public PFS_engine_table { public: /** Table share */ diff --git a/storage/perfschema/table_file_summary.cc b/storage/perfschema/table_file_summary.cc index 16942e73916..f8b9e66118b 100644 --- a/storage/perfschema/table_file_summary.cc +++ b/storage/perfschema/table_file_summary.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,16 +10,16 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_file_summary.cc Table FILE_SUMMARY_BY_xxx (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr_class.h" #include "pfs_column_types.h" #include "pfs_column_values.h" @@ -88,7 +88,7 @@ int table_file_summary_by_event_name::delete_all_rows(void) } table_file_summary_by_event_name::table_file_summary_by_event_name() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_pos(1), m_next_pos(1) {} @@ -251,7 +251,7 @@ int table_file_summary_by_instance::delete_all_rows(void) } table_file_summary_by_instance::table_file_summary_by_instance() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} diff --git a/storage/perfschema/table_file_summary.h b/storage/perfschema/table_file_summary.h index e962292a725..92837189f1f 100644 --- a/storage/perfschema/table_file_summary.h +++ b/storage/perfschema/table_file_summary.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_FILE_SUMMARY_H #define TABLE_FILE_SUMMARY_H @@ -46,7 +46,7 @@ struct row_file_summary_by_event_name }; /** Table PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME. */ -class table_file_summary_by_event_name : public PFS_readonly_table +class table_file_summary_by_event_name : public PFS_engine_table { public: /** Table share */ @@ -105,7 +105,7 @@ struct row_file_summary_by_instance }; /** Table PERFORMANCE_SCHEMA.FILE_UMMARY_BY_INSTANCE. */ -class table_file_summary_by_instance : public PFS_readonly_table +class table_file_summary_by_instance : public PFS_engine_table { public: /** Table share */ diff --git a/storage/perfschema/table_performance_timers.cc b/storage/perfschema/table_performance_timers.cc index 7a20e7e18e0..f400e37366c 100644 --- a/storage/perfschema/table_performance_timers.cc +++ b/storage/perfschema/table_performance_timers.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,16 +10,16 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_performance_timers.cc Table PERFORMANCE_TIMERS (implementation). */ -#include "sql_priv.h" #include "my_global.h" +#include "my_pthread.h" #include "table_performance_timers.h" #include "pfs_timer.h" #include "pfs_global.h" @@ -76,7 +76,7 @@ PFS_engine_table* table_performance_timers::create(void) } table_performance_timers::table_performance_timers() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row(NULL), m_pos(0), m_next_pos(0) { int index; diff --git a/storage/perfschema/table_performance_timers.h b/storage/perfschema/table_performance_timers.h index 0818a0af2fe..dbd47665ff6 100644 --- a/storage/perfschema/table_performance_timers.h +++ b/storage/perfschema/table_performance_timers.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_PERFORMANCE_TIMERS_H #define TABLE_PERFORMANCE_TIMERS_H @@ -43,7 +43,7 @@ struct row_performance_timers }; /** Table PERFORMANCE_SCHEMA.PERFORMANCE_TIMERS. */ -class table_performance_timers : public PFS_readonly_table +class table_performance_timers : public PFS_engine_table { public: /** Table share. */ diff --git a/storage/perfschema/table_processlist.cc b/storage/perfschema/table_processlist.cc index 7518882ccea..06c628c5f80 100644 --- a/storage/perfschema/table_processlist.cc +++ b/storage/perfschema/table_processlist.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,15 +10,16 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_processlist.cc Table PROCESSLIST (implementation). */ -#include "sql_priv.h" +#include "my_global.h" +#include "my_pthread.h" #include "table_processlist.h" #include "pfs_instr_class.h" #include "pfs_instr.h" @@ -69,7 +70,7 @@ PFS_engine_table* table_processlist::create(void) } table_processlist::table_processlist() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} diff --git a/storage/perfschema/table_processlist.h b/storage/perfschema/table_processlist.h index 2c6d5160f41..d4fe5e4af1a 100644 --- a/storage/perfschema/table_processlist.h +++ b/storage/perfschema/table_processlist.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_PROCESSIST_H #define TABLE_PROCESSIST_H @@ -45,7 +45,7 @@ struct row_processlist }; /** Table PERFORMANCE_SCHEMA.PROCESSLIST. */ -class table_processlist : public PFS_readonly_table +class table_processlist : public PFS_engine_table { public: /** Table share. */ diff --git a/storage/perfschema/table_setup_consumers.cc b/storage/perfschema/table_setup_consumers.cc index ff74e7d3f28..3cc6a1441c1 100644 --- a/storage/perfschema/table_setup_consumers.cc +++ b/storage/perfschema/table_setup_consumers.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,15 +10,16 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_setup_consumers.cc Table SETUP_CONSUMERS (implementation). */ -#include "sql_priv.h" +#include "my_global.h" +#include "my_pthread.h" #include "table_setup_consumers.h" #include "pfs_instr.h" #include "pfs_events_waits.h" diff --git a/storage/perfschema/table_setup_consumers.h b/storage/perfschema/table_setup_consumers.h index f54f69fcef5..4d007645db2 100644 --- a/storage/perfschema/table_setup_consumers.h +++ b/storage/perfschema/table_setup_consumers.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_SETUP_CONSUMERS_H #define TABLE_SETUP_CONSUMERS_H diff --git a/storage/perfschema/table_setup_instruments.cc b/storage/perfschema/table_setup_instruments.cc index 095299c4b69..259ccee3c84 100644 --- a/storage/perfschema/table_setup_instruments.cc +++ b/storage/perfschema/table_setup_instruments.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,16 +10,16 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_setup_instruments.cc Table SETUP_INSTRUMENTS (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr_class.h" #include "pfs_column_types.h" #include "pfs_column_values.h" diff --git a/storage/perfschema/table_setup_instruments.h b/storage/perfschema/table_setup_instruments.h index 549fe4fa5f9..b9df2dd3e0b 100644 --- a/storage/perfschema/table_setup_instruments.h +++ b/storage/perfschema/table_setup_instruments.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_SETUP_INSTRUMENTS_H #define TABLE_SETUP_INSTRUMENTS_H diff --git a/storage/perfschema/table_setup_timers.cc b/storage/perfschema/table_setup_timers.cc index 98e27808e0a..8ca218913bb 100644 --- a/storage/perfschema/table_setup_timers.cc +++ b/storage/perfschema/table_setup_timers.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,15 +10,16 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_setup_timers.cc Table SETUP_TIMERS (implementation). */ -#include "sql_priv.h" +#include "my_global.h" +#include "my_pthread.h" #include "table_setup_timers.h" #include "pfs_column_values.h" #include "pfs_timer.h" diff --git a/storage/perfschema/table_setup_timers.h b/storage/perfschema/table_setup_timers.h index 96af76ae05c..a81e6fefaaf 100644 --- a/storage/perfschema/table_setup_timers.h +++ b/storage/perfschema/table_setup_timers.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_SETUP_TIMERS_H #define TABLE_SETUP_TIMERS_H diff --git a/storage/perfschema/table_sync_instances.cc b/storage/perfschema/table_sync_instances.cc index c76c62cc9fd..82587ce493d 100644 --- a/storage/perfschema/table_sync_instances.cc +++ b/storage/perfschema/table_sync_instances.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ /** @file storage/perfschema/table_sync_instances.cc @@ -19,8 +19,8 @@ and COND_INSTANCES (implementation). */ -#include "sql_priv.h" -#include "unireg.h" +#include "my_global.h" +#include "my_pthread.h" #include "pfs_instr.h" #include "pfs_column_types.h" #include "pfs_column_values.h" @@ -73,7 +73,7 @@ PFS_engine_table* table_mutex_instances::create(void) } table_mutex_instances::table_mutex_instances() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} @@ -241,7 +241,7 @@ PFS_engine_table* table_rwlock_instances::create(void) } table_rwlock_instances::table_rwlock_instances() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} @@ -406,7 +406,7 @@ PFS_engine_table* table_cond_instances::create(void) } table_cond_instances::table_cond_instances() - : PFS_readonly_table(&m_share, &m_pos), + : PFS_engine_table(&m_share, &m_pos), m_row_exists(false), m_pos(0), m_next_pos(0) {} diff --git a/storage/perfschema/table_sync_instances.h b/storage/perfschema/table_sync_instances.h index a8a9cdaa071..3c359852338 100644 --- a/storage/perfschema/table_sync_instances.h +++ b/storage/perfschema/table_sync_instances.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #ifndef TABLE_SYNC_INSTANCE_H #define TABLE_SYNC_INSTANCE_H @@ -49,7 +49,7 @@ struct row_mutex_instances }; /** Table PERFORMANCE_SCHEMA.MUTEX_INSTANCES. */ -class table_mutex_instances : public PFS_readonly_table +class table_mutex_instances : public PFS_engine_table { public: /** Table share. */ @@ -108,7 +108,7 @@ struct row_rwlock_instances }; /** Table PERFORMANCE_SCHEMA.RWLOCK_INSTANCES. */ -class table_rwlock_instances : public PFS_readonly_table +class table_rwlock_instances : public PFS_engine_table { public: /** Table share */ @@ -161,7 +161,7 @@ struct row_cond_instances }; /** Table PERFORMANCE_SCHEMA.COND_INSTANCES. */ -class table_cond_instances : public PFS_readonly_table +class table_cond_instances : public PFS_engine_table { public: /** Table share. */ diff --git a/storage/perfschema/unittest/CMakeLists.txt b/storage/perfschema/unittest/CMakeLists.txt index 8a72b25b5b7..501cf82d23a 100644 --- a/storage/perfschema/unittest/CMakeLists.txt +++ b/storage/perfschema/unittest/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 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 @@ -10,8 +10,8 @@ # 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 +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/include/mysql diff --git a/storage/perfschema/unittest/conf.txt b/storage/perfschema/unittest/conf.txt index a3bee9c3be5..8afd0b4dca7 100644 --- a/storage/perfschema/unittest/conf.txt +++ b/storage/perfschema/unittest/conf.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2009 Sun Microsystems, Inc +# Copyright (c) 2009, 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 @@ -10,8 +10,8 @@ # 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 +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA Performance schema test configurations. (Used internally for performance testing) diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc index 2f3fb2792fc..c51f358c4d8 100644 --- a/storage/perfschema/unittest/pfs-t.cc +++ b/storage/perfschema/unittest/pfs-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2009 Sun Microsystems, Inc +/* 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 @@ -10,12 +10,11 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include <my_pthread.h> -#include <sql_priv.h> #include <my_global.h> +#include <my_pthread.h> #include <pfs_server.h> #include <pfs_instr_class.h> #include <pfs_instr.h> @@ -941,9 +940,13 @@ void test_locker_disabled() ok(file_A1 != NULL, "instrumented"); PSI_mutex_locker *mutex_locker; + PSI_mutex_locker_state mutex_state; PSI_rwlock_locker *rwlock_locker; + PSI_rwlock_locker_state rwlock_state; PSI_cond_locker *cond_locker; + PSI_cond_locker_state cond_state; PSI_file_locker *file_locker; + PSI_file_locker_state file_state; /* Pretend thread T-1 is disabled */ /* ------------------------------ */ @@ -955,17 +958,17 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); /* Pretend the consumer is disabled */ @@ -978,17 +981,17 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); /* Pretend the instrument is disabled */ @@ -1001,17 +1004,17 @@ void test_locker_disabled() cond_class_A->m_enabled= false; file_class_A->m_enabled= false; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); /* Pretend everything is enabled */ @@ -1024,27 +1027,27 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker != NULL, "locker"); psi->start_mutex_wait(mutex_locker, __FILE__, __LINE__); psi->end_mutex_wait(mutex_locker, 0); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker != NULL, "locker"); psi->start_rwlock_rdwait(rwlock_locker, __FILE__, __LINE__); psi->end_rwlock_rdwait(rwlock_locker, 0); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker != NULL, "locker"); psi->start_cond_wait(cond_locker, __FILE__, __LINE__); psi->end_cond_wait(cond_locker, 0); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker != NULL, "locker"); psi->start_file_open_wait(file_locker, __FILE__, __LINE__); psi->end_file_open_wait(file_locker); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 10, __FILE__, __LINE__); psi->end_file_wait(file_locker, 10); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 10, __FILE__, __LINE__); psi->end_file_wait(file_locker, 10); @@ -1059,17 +1062,17 @@ void test_locker_disabled() cond_class_A->m_enabled= true; file_class_A->m_enabled= true; - mutex_locker= psi->get_thread_mutex_locker(mutex_A1, PSI_MUTEX_LOCK); + mutex_locker= psi->get_thread_mutex_locker(&mutex_state, mutex_A1, PSI_MUTEX_LOCK); ok(mutex_locker == NULL, "no locker"); - rwlock_locker= psi->get_thread_rwlock_locker(rwlock_A1, PSI_RWLOCK_READLOCK); + rwlock_locker= psi->get_thread_rwlock_locker(&rwlock_state, rwlock_A1, PSI_RWLOCK_READLOCK); ok(rwlock_locker == NULL, "no locker"); - cond_locker= psi->get_thread_cond_locker(cond_A1, mutex_A1, PSI_COND_WAIT); + cond_locker= psi->get_thread_cond_locker(&cond_state, cond_A1, mutex_A1, PSI_COND_WAIT); ok(cond_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "xxx", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "xxx", NULL); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_stream_locker(file_A1, PSI_FILE_READ); + file_locker= psi->get_thread_file_stream_locker(&file_state, file_A1, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker == NULL, "no locker"); shutdown_performance_schema(); @@ -1102,6 +1105,7 @@ void test_file_instrumentation_leak() PFS_file_class *file_class_A; PFS_file_class *file_class_B; + PSI_file_locker_state file_state; PSI_thread *thread_1; /* Preparation */ @@ -1130,24 +1134,24 @@ void test_file_instrumentation_leak() /* Simulate OPEN + READ of 100 bytes + CLOSE on descriptor 12 */ - file_locker= psi->get_thread_file_name_locker(file_key_A, PSI_FILE_OPEN, "AAA", NULL); + file_locker= psi->get_thread_file_name_locker(&file_state, file_key_A, PSI_FILE_OPEN, "AAA", NULL); ok(file_locker != NULL, "locker"); psi->start_file_open_wait(file_locker, __FILE__, __LINE__); psi->end_file_open_wait_and_bind_to_descriptor(file_locker, 12); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_READ); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_READ); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 100, __FILE__, __LINE__); psi->end_file_wait(file_locker, 100); - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_CLOSE); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_CLOSE); ok(file_locker != NULL, "locker"); psi->start_file_wait(file_locker, 0, __FILE__, __LINE__); psi->end_file_wait(file_locker, 0); /* Simulate uninstrumented-OPEN + WRITE on descriptor 24 */ - file_locker= psi->get_thread_file_descriptor_locker((File) 24, PSI_FILE_WRITE); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 24, PSI_FILE_WRITE); ok(file_locker == NULL, "no locker, since the open was not instrumented"); /* @@ -1155,7 +1159,7 @@ void test_file_instrumentation_leak() the instrumentation should not leak (don't charge the file io on unknown B to "AAA") */ - file_locker= psi->get_thread_file_descriptor_locker((File) 12, PSI_FILE_WRITE); + file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_WRITE); ok(file_locker == NULL, "no locker, no leak"); shutdown_performance_schema(); diff --git a/storage/perfschema/unittest/pfs_instr-oom-t.cc b/storage/perfschema/unittest/pfs_instr-oom-t.cc index 7b3df877133..9a3b179aa56 100644 --- a/storage/perfschema/unittest/pfs_instr-oom-t.cc +++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,12 +10,11 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include <my_pthread.h> -#include <sql_priv.h> #include <my_global.h> +#include <my_pthread.h> #include <pfs_instr.h> #include <pfs_stat.h> #include <pfs_global.h> diff --git a/storage/perfschema/unittest/pfs_instr-t.cc b/storage/perfschema/unittest/pfs_instr-t.cc index 157031cb234..7dcc8cec7f8 100644 --- a/storage/perfschema/unittest/pfs_instr-t.cc +++ b/storage/perfschema/unittest/pfs_instr-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,12 +10,11 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include <my_pthread.h> -#include <sql_priv.h> #include <my_global.h> +#include <my_pthread.h> #include <pfs_instr.h> #include <pfs_stat.h> #include <pfs_global.h> diff --git a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc index 064c8c062a4..20fa0f3e6ff 100644 --- a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc +++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,12 +10,11 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include <my_pthread.h> -#include <sql_priv.h> #include <my_global.h> +#include <my_pthread.h> #include <pfs_instr_class.h> #include <pfs_global.h> #include <tap.h> diff --git a/storage/perfschema/unittest/pfs_instr_class-t.cc b/storage/perfschema/unittest/pfs_instr_class-t.cc index c8dce2fd7fb..c5a199727d5 100644 --- a/storage/perfschema/unittest/pfs_instr_class-t.cc +++ b/storage/perfschema/unittest/pfs_instr_class-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,13 +10,11 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include <my_pthread.h> #include <my_global.h> -#include <sql_priv.h> - +#include <my_pthread.h> #include <string.h> // strncpy #include <pfs_instr_class.h> #include <pfs_instr.h> diff --git a/storage/perfschema/unittest/pfs_timer-t.cc b/storage/perfschema/unittest/pfs_timer-t.cc index 46efe3fd7b1..d8663c5ccda 100644 --- a/storage/perfschema/unittest/pfs_timer-t.cc +++ b/storage/perfschema/unittest/pfs_timer-t.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,11 +10,11 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ -#include <sql_priv.h> #include <my_global.h> +#include <my_pthread.h> #include <pfs_timer.h> #include "my_sys.h" #include <tap.h> diff --git a/storage/perfschema/unittest/stub_pfs_global.h b/storage/perfschema/unittest/stub_pfs_global.h index 85088061d3f..300d3cb6fa0 100644 --- a/storage/perfschema/unittest/stub_pfs_global.h +++ b/storage/perfschema/unittest/stub_pfs_global.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #include <my_global.h> #include <my_sys.h> diff --git a/storage/perfschema/unittest/stub_print_error.h b/storage/perfschema/unittest/stub_print_error.h index 12dabb46ceb..caad24e5257 100644 --- a/storage/perfschema/unittest/stub_print_error.h +++ b/storage/perfschema/unittest/stub_print_error.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2008-2009 Sun Microsystems, Inc +/* 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 @@ -10,8 +10,8 @@ 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 */ + along with this program; if not, write to the Free Software Foundation, + 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ #include <my_global.h> #include <my_sys.h> |