Browse Source

Merge.

- PBXT fixes.
 - MBug#423035 fix.
 - Compiler warning fixes.
pull/843/head
unknown 16 years ago
parent
commit
fb820d2c8b
  1. 4
      client/mysqlbinlog.cc
  2. 6
      config/ac-macros/misc.m4
  3. 2
      extra/yassl/include/yassl_int.hpp
  4. 6
      extra/yassl/src/handshake.cpp
  5. 3
      extra/yassl/src/yassl_imp.cpp
  6. 2
      extra/yassl/src/yassl_int.cpp
  7. 3
      extra/yassl/taocrypt/include/modes.hpp
  8. 9
      extra/yassl/taocrypt/src/asn.cpp
  9. 15
      mysql-test/mysql-test-run.pl
  10. 6
      mysql-test/r/mysqld_option_err.result
  11. 47
      mysql-test/t/mysqld_option_err.test
  12. 5
      mysys/my_compress.c
  13. 5
      mysys/my_getopt.c
  14. 2
      sql/mysqld.cc
  15. 4
      storage/pbxt/ChangeLog
  16. 4
      storage/pbxt/src/Makefile.am
  17. 8
      storage/pbxt/src/datalog_xt.cc
  18. 6
      storage/pbxt/src/discover_xt.cc
  19. 5
      storage/pbxt/src/filesys_xt.cc
  20. 15
      storage/pbxt/src/ha_pbxt.cc
  21. 2
      storage/pbxt/src/memory_xt.cc
  22. 70
      storage/pbxt/src/myxt_xt.cc
  23. 1
      storage/pbxt/src/myxt_xt.h
  24. 91
      storage/pbxt/src/restart_xt.cc
  25. 3
      storage/pbxt/src/restart_xt.h
  26. 2
      storage/pbxt/src/strutil_xt.cc
  27. 3
      storage/pbxt/src/tabcache_xt.cc
  28. 9
      storage/pbxt/src/thread_xt.cc
  29. 6
      storage/pbxt/src/xaction_xt.cc
  30. 3
      storage/pbxt/src/xactlog_xt.cc
  31. 2
      storage/pbxt/src/xt_errno.h
  32. 4
      storage/xtradb/fil/fil0fil.c
  33. 1
      storage/xtradb/mtr/mtr0mtr.c
  34. 1
      storage/xtradb/srv/srv0srv.c
  35. 14
      storage/xtradb/srv/srv0start.c
  36. 6
      strings/decimal.c
  37. 104
      support-files/ccfilter
  38. 20
      support-files/compiler_warnings.supp

4
client/mysqlbinlog.cc

@ -689,8 +689,8 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
Format events are not concerned by --offset and such, we always need to
read them to be able to process the wanted events.
*/
if ((rec_count >= offset) &&
((my_time_t)(ev->when) >= start_datetime) ||
if (((rec_count >= offset) &&
((my_time_t)(ev->when) >= start_datetime)) ||
(ev_type == FORMAT_DESCRIPTION_EVENT))
{
if (ev_type != FORMAT_DESCRIPTION_EVENT)

6
config/ac-macros/misc.m4

@ -594,15 +594,15 @@ dnl ---------------------------------------------------------------------------
dnl MYSQL_NEEDS_MYSYS_NEW
AC_DEFUN([MYSQL_NEEDS_MYSYS_NEW],
[AC_CACHE_CHECK([needs mysys_new helpers], mysql_use_mysys_new,
[AC_CACHE_CHECK([needs mysys_new helpers], mysql_cv_use_mysys_new,
[
AC_LANG_PUSH(C++)
AC_TRY_LINK([], [
class A { public: int b; }; A *a=new A; a->b=10; delete a;
], mysql_use_mysys_new=no, mysql_use_mysys_new=yes)
], mysql_cv_use_mysys_new=no, mysql_cv_use_mysys_new=yes)
AC_LANG_POP(C++)
])
if test "$mysql_use_mysys_new" = "yes"
if test "$mysql_cv_use_mysys_new" = "yes"
then
AC_DEFINE([USE_MYSYS_NEW], [1], [Needs to use mysys_new helpers])
fi

2
extra/yassl/include/yassl_int.hpp

@ -441,7 +441,7 @@ public:
const Ciphers& GetCiphers() const;
const DH_Parms& GetDH_Parms() const;
const Stats& GetStats() const;
const VerifyCallback getVerifyCallback() const;
VerifyCallback getVerifyCallback() const;
pem_password_cb GetPasswordCb() const;
void* GetUserData() const;
bool GetSessionCacheOff() const;

6
extra/yassl/src/handshake.cpp

@ -789,7 +789,7 @@ void processReply(SSL& ssl)
{
if (ssl.GetError()) return;
if (DoProcessReply(ssl))
if (DoProcessReply(ssl)) {
// didn't complete process
if (!ssl.getSocket().IsNonBlocking()) {
// keep trying now, blocking ok
@ -799,6 +799,7 @@ void processReply(SSL& ssl)
else
// user will have try again later, non blocking
ssl.SetError(YasslError(SSL_ERROR_WANT_READ));
}
}
@ -872,11 +873,12 @@ void sendServerKeyExchange(SSL& ssl, BufferOutput buffer)
// send change cipher
void sendChangeCipher(SSL& ssl, BufferOutput buffer)
{
if (ssl.getSecurity().get_parms().entity_ == server_end)
if (ssl.getSecurity().get_parms().entity_ == server_end) {
if (ssl.getSecurity().get_resuming())
ssl.verifyState(clientKeyExchangeComplete);
else
ssl.verifyState(clientFinishedComplete);
}
if (ssl.GetError()) return;
ChangeCipherSpec ccs;

3
extra/yassl/src/yassl_imp.cpp

@ -1304,7 +1304,7 @@ void ServerHello::Process(input_buffer&, SSL& ssl)
else
ssl.useSecurity().use_connection().sessionID_Set_ = false;
if (ssl.getSecurity().get_resuming())
if (ssl.getSecurity().get_resuming()) {
if (memcmp(session_id_, ssl.getSecurity().get_resume().GetID(),
ID_LEN) == 0) {
ssl.set_masterSecret(ssl.getSecurity().get_resume().GetSecret());
@ -1319,6 +1319,7 @@ void ServerHello::Process(input_buffer&, SSL& ssl)
ssl.useSecurity().set_resuming(false);
ssl.useLog().Trace("server denied resumption");
}
}
if (ssl.CompressionOn() && !compression_method_)
ssl.UnSetCompression(); // server isn't supporting yaSSL zlib request

2
extra/yassl/src/yassl_int.cpp

@ -1833,7 +1833,7 @@ SSL_CTX::GetCA_List() const
}
const VerifyCallback SSL_CTX::getVerifyCallback() const
VerifyCallback SSL_CTX::getVerifyCallback() const
{
return verifyCallback_;
}

3
extra/yassl/taocrypt/include/modes.hpp

@ -95,11 +95,12 @@ inline void Mode_BASE::Process(byte* out, const byte* in, word32 sz)
{
if (mode_ == ECB)
ECB_Process(out, in, sz);
else if (mode_ == CBC)
else if (mode_ == CBC) {
if (dir_ == ENCRYPTION)
CBC_Encrypt(out, in, sz);
else
CBC_Decrypt(out, in, sz);
}
}

9
extra/yassl/taocrypt/src/asn.cpp

@ -780,11 +780,12 @@ void CertDecoder::GetDate(DateType dt)
memcpy(date, source_.get_current(), length);
source_.advance(length);
if (!ValidateDate(date, b, dt) && verify_)
if (!ValidateDate(date, b, dt) && verify_) {
if (dt == BEFORE)
source_.SetError(BEFORE_DATE_E);
else
source_.SetError(AFTER_DATE_E);
}
// save for later use
if (dt == BEFORE) {
@ -1061,7 +1062,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
return 0;
}
word32 rLen = GetLength(source);
if (rLen != 20)
if (rLen != 20) {
if (rLen == 21) { // zero at front, eat
source.next();
--rLen;
@ -1074,6 +1075,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
source.SetError(DSA_SZ_E);
return 0;
}
}
memcpy(decoded, source.get_buffer() + source.get_index(), rLen);
source.advance(rLen);
@ -1083,7 +1085,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
return 0;
}
word32 sLen = GetLength(source);
if (sLen != 20)
if (sLen != 20) {
if (sLen == 21) {
source.next(); // zero at front, eat
--sLen;
@ -1096,6 +1098,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
source.SetError(DSA_SZ_E);
return 0;
}
}
memcpy(decoded + rLen, source.get_buffer() + source.get_index(), sLen);
source.advance(sLen);

15
mysql-test/mysql-test-run.pl

@ -1773,6 +1773,20 @@ sub tool_arguments ($$) {
return mtr_args2str($exe, @$args);
}
# This is not used to actually start a mysqld server, just to allow test
# scripts to run the mysqld binary to test invalid server startup options.
sub mysqld_client_arguments () {
my $default_mysqld= default_mysqld();
my $exe = find_mysqld($basedir);
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--no-defaults");
mtr_add_arg($args, "--basedir=%s", $basedir);
mtr_add_arg($args, "--character-sets-dir=%s", $default_mysqld->value("character-sets-dir"));
mtr_add_arg($args, "--language=%s", $default_mysqld->value("language"));
return mtr_args2str($exe, @$args);
}
sub have_maria_support () {
my $maria_var= $mysqld_variables{'maria'};
@ -1970,6 +1984,7 @@ sub environment_setup {
$ENV{'MYSQLADMIN'}= native_path($exe_mysqladmin);
$ENV{'MYSQL_CLIENT_TEST'}= mysql_client_test_arguments();
$ENV{'MYSQL_FIX_SYSTEM_TABLES'}= mysql_fix_arguments();
$ENV{'MYSQLD'}= mysqld_client_arguments();
$ENV{'EXE_MYSQL'}= $exe_mysql;
# ----------------------------------------------------

6
mysql-test/r/mysqld_option_err.result

@ -0,0 +1,6 @@
Test that unknown option is not silently ignored.
Test bad binlog format.
Test bad default storage engine.
Test non-numeric value passed to number option.
Test that bad value for plugin enum option is rejected correctly.
Done.

47
mysql-test/t/mysqld_option_err.test

@ -0,0 +1,47 @@
#
# Test error checks on mysqld command line option parsing.
#
# Call mysqld with different invalid options, and check that it fails in each case.
#
# This means that a test failure results in mysqld starting up, which is only
# caught when the test case times out. This is not ideal, but I did not find an
# easy way to have the server shut down after a successful startup.
#
--source include/not_embedded.inc
# We have not run (and do not need) bootstrap of the server. We just
# give it a dummy data directory (for log files etc).
mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err;
--echo Test that unknown option is not silently ignored.
--error 2
--exec $MYSQLD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --nonexistentoption >$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
--echo Test bad binlog format.
--error 1
--exec $MYSQLD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --log-bin --binlog-format=badformat >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
--echo Test bad default storage engine.
--error 1
--exec $MYSQLD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --default-storage-engine=nonexistentengine >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
--echo Test non-numeric value passed to number option.
--error 1
--exec $MYSQLD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --min-examined-row-limit=notanumber >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
# Test for MBug#423035: error in parsing enum value for plugin
# variable in mysqld command-line option.
# See also Bug#32034.
--echo Test that bad value for plugin enum option is rejected correctly.
--error 7
--exec $MYSQLD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables $EXAMPLE_PLUGIN_OPT --plugin-load=EXAMPLE=ha_example.so --plugin-example-enum-var=noexist >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1
--echo Done.

5
mysys/my_compress.c

@ -81,12 +81,13 @@ my_bool my_compress(uchar *packet, size_t *len, size_t *complen)
This fix is safe, since such memory is only used internally by zlib, so we
will not hide any bugs in mysql this way.
*/
void *my_az_allocator(void *dummy, unsigned int items, unsigned int size)
void *my_az_allocator(void *dummy __attribute__((unused)), unsigned int items,
unsigned int size)
{
return my_malloc((size_t)items*(size_t)size, IF_VALGRIND(MY_ZEROFILL, MYF(0)));
}
void my_az_free(void *dummy, void *address)
void my_az_free(void *dummy __attribute__((unused)), void *address)
{
my_free(address, MYF(MY_ALLOW_ZERO_PTR));
}

5
mysys/my_getopt.c

@ -603,6 +603,7 @@ static int setval(const struct my_option *opts, uchar* *value, char *argument,
my_bool set_maximum_value)
{
int err= 0;
int pos;
if (value && argument)
{
@ -647,7 +648,9 @@ static int setval(const struct my_option *opts, uchar* *value, char *argument,
return EXIT_OUT_OF_MEMORY;
break;
case GET_ENUM:
if (((*(ulong *)result_pos)= find_type(argument, opts->typelib, 2) - 1) < 0)
pos= find_type(argument, opts->typelib, 2) - 1;
(*(ulong *)result_pos)= pos;
if (pos < 0)
return EXIT_ARGUMENT_INVALID;
break;
case GET_SET:

2
sql/mysqld.cc

@ -1016,6 +1016,7 @@ static void close_connections(void)
}
#ifdef HAVE_CLOSE_SERVER_SOCK
static void close_socket(my_socket sock, const char *info)
{
DBUG_ENTER("close_socket");
@ -1035,6 +1036,7 @@ static void close_socket(my_socket sock, const char *info)
}
DBUG_VOID_RETURN;
}
#endif
static void close_server_sock()

4
storage/pbxt/ChangeLog

@ -1,6 +1,10 @@
PBXT Release Notes
==================
------- 1.0.08d RC2 - 2009-09-02
RN267: Fixed a bug that caused MySQL to crash on shutdown, after an incorrect command line parameter was given. The crash occurred because the background recovery task was not cleaned up before the PBXT engine was de-initialized.
------- 1.0.08c RC2 - 2009-08-18
RN266: Updated BLOB streaming glue, used with the PBMS engine. The glue code is now identical to the version of "1.0.08-rc-pbms" version of PBXT available from http://blobstreaming.org/download.

4
storage/pbxt/src/Makefile.am

@ -30,7 +30,7 @@ libpbxt_la_SOURCES = bsearch_xt.cc cache_xt.cc ccutils_xt.cc database_xt.cc \
datadic_xt.cc datalog_xt.cc filesys_xt.cc hashtab_xt.cc \
ha_pbxt.cc heap_xt.cc index_xt.cc linklist_xt.cc \
memory_xt.cc myxt_xt.cc pthread_xt.cc restart_xt.cc \
pbms_enabled.cc sortedlist_xt.cc strutil_xt.cc \
sortedlist_xt.cc strutil_xt.cc \
tabcache_xt.cc table_xt.cc trace_xt.cc thread_xt.cc \
systab_xt.cc ha_xtsys.cc discover_xt.cc \
util_xt.cc xaction_xt.cc xactlog_xt.cc lock_xt.cc locklist_xt.cc
@ -49,4 +49,4 @@ libpbxt_a_SOURCES = $(libpbxt_la_SOURCES)
libpbxt_a_CXXFLAGS = $(AM_CXXFLAGS)
libpbxt_a_CFLAGS = $(AM_CFLAGS) -std=c99
EXTRA_DIST = CMakeLists.txt
EXTRA_DIST = CMakeLists.txt pbms_enabled.cc

8
storage/pbxt/src/datalog_xt.cc

@ -410,7 +410,7 @@ static void dl_recover_log(XTThreadPtr self, XTDatabaseHPtr db, XTDataLogFilePtr
ASSERT_NS(seq_read.sl_log_eof == seq_read.sl_rec_log_offset);
data_log->dlf_log_eof = seq_read.sl_rec_log_offset;
if (data_log->dlf_log_eof < sizeof(XTXactLogHeaderDRec)) {
if ((size_t) data_log->dlf_log_eof < sizeof(XTXactLogHeaderDRec)) {
data_log->dlf_log_eof = sizeof(XTXactLogHeaderDRec);
if (!dl_create_log_header(data_log, seq_read.sl_log_file, self))
xt_throw(self);
@ -2015,7 +2015,8 @@ static void *dl_run_co_thread(XTThreadPtr self)
int count;
void *mysql_thread;
mysql_thread = myxt_create_thread();
if (!(mysql_thread = myxt_create_thread()))
xt_throw(self);
while (!self->t_quit) {
try_(a) {
@ -2068,7 +2069,10 @@ static void *dl_run_co_thread(XTThreadPtr self)
}
}
/*
* {MYSQL-THREAD-KILL}
myxt_destroy_thread(mysql_thread, TRUE);
*/
return NULL;
}

6
storage/pbxt/src/discover_xt.cc

@ -493,8 +493,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
}
/* Don't pack rows in old tables if the user has requested this */
if ((sql_field->flags & BLOB_FLAG) ||
sql_field->sql_type == MYSQL_TYPE_VARCHAR &&
create_info->row_type != ROW_TYPE_FIXED)
(sql_field->sql_type == MYSQL_TYPE_VARCHAR &&
create_info->row_type != ROW_TYPE_FIXED))
(*db_options)|= HA_OPTION_PACK_RECORD;
it2.rewind();
}
@ -963,7 +963,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->sql_type == MYSQL_TYPE_VARCHAR ||
sql_field->pack_flag & FIELDFLAG_BLOB)))
{
if (column_nr == 0 && (sql_field->pack_flag & FIELDFLAG_BLOB) ||
if ((column_nr == 0 && (sql_field->pack_flag & FIELDFLAG_BLOB)) ||
sql_field->sql_type == MYSQL_TYPE_VARCHAR)
key_info->flags|= HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY;
else

5
storage/pbxt/src/filesys_xt.cc

@ -55,6 +55,7 @@
//#define DEBUG_TRACE_MAP_IO
//#define DEBUG_TRACE_FILES
//#define INJECT_WRITE_REMAP_ERROR
/* This is required to make testing on the Mac faster: */
#endif
#ifdef DEBUG_TRACE_FILES
@ -62,6 +63,10 @@
#define PRINTF xt_trace
#endif
#if defined(XT_MAC) && defined(F_FULLFSYNC)
#undef F_FULLFSYNC
#endif
#ifdef INJECT_WRITE_REMAP_ERROR
#define INJECT_REMAP_FILE_SIZE 1000000
#define INJECT_REMAP_FILE_TYPE "xtd"

15
storage/pbxt/src/ha_pbxt.cc

@ -71,6 +71,7 @@ extern "C" char **session_query(Session *session);
#include "tabcache_xt.h"
#include "systab_xt.h"
#include "xaction_xt.h"
#include "restart_xt.h"
#ifdef DEBUG
//#define XT_USE_SYS_PAR_DEBUG_SIZES
@ -105,8 +106,6 @@ static void ha_aquire_exclusive_use(XTThreadPtr self, XTSharePtr share, ha_pbxt
static void ha_release_exclusive_use(XTThreadPtr self, XTSharePtr share);
static void ha_close_open_tables(XTThreadPtr self, XTSharePtr share, ha_pbxt *mine);
extern void xt_xres_start_database_recovery(XTThreadPtr self);
#ifdef TRACE_STATEMENTS
#ifdef PRINT_STATEMENTS
@ -463,8 +462,14 @@ xtPublic void xt_ha_open_database_of_table(XTThreadPtr self, XTPathStrPtr XT_UNU
if (!self->st_database) {
if (!pbxt_database) {
xt_open_database(self, mysql_real_data_home, TRUE);
pbxt_database = self->st_database;
xt_heap_reference(self, pbxt_database);
/* {GLOBAL-DB}
* This can be done at the same time as the recovery thread,
* strictly speaking I need a lock.
*/
if (!pbxt_database) {
pbxt_database = self->st_database;
xt_heap_reference(self, pbxt_database);
}
}
else
xt_use_database(self, pbxt_database, XT_FOR_USER);
@ -963,6 +968,8 @@ static void pbxt_call_exit(XTThreadPtr self)
*/
static void ha_exit(XTThreadPtr self)
{
xt_xres_wait_for_recovery(self);
/* Wrap things up... */
xt_unuse_database(self, self); /* Just in case the main thread has a database in use (for testing)? */
/* This may cause the streaming engine to cleanup connections and

2
storage/pbxt/src/memory_xt.cc

@ -34,7 +34,7 @@
#include "trace_xt.h"
#ifdef DEBUG
#define RECORD_MM
//#define RECORD_MM
#endif
#ifdef DEBUG

70
storage/pbxt/src/myxt_xt.cc

@ -1957,7 +1957,7 @@ static TABLE *my_open_table(XTThreadPtr self, XTDatabaseHPtr XT_UNUSED(db), XTPa
xt_free(self, table);
lex_end(&new_lex);
thd->lex = old_lex;
xt_throw_ulxterr(XT_CONTEXT, XT_ERR_LOADING_MYSQL_DIC, (u_long) error);
xt_throw_sulxterr(XT_CONTEXT, XT_ERR_LOADING_MYSQL_DIC, tab_path->ps_path, (u_long) error);
return NULL;
}
#else
@ -1975,11 +1975,23 @@ static TABLE *my_open_table(XTThreadPtr self, XTDatabaseHPtr XT_UNUSED(db), XTPa
#endif
#endif
/* If MySQL shutsdown while we are just starting up, they
* they kill the plugin sub-system before calling
* shutdown for the engine!
*/
if (!ha_resolve_by_legacy_type(thd, DB_TYPE_PBXT)) {
xt_free(self, table);
lex_end(&new_lex);
thd->lex = old_lex;
xt_throw_xterr(XT_CONTEXT, XT_ERR_MYSQL_SHUTDOWN);
return NULL;
}
if ((error = open_table_def(thd, share, 0))) {
xt_free(self, table);
lex_end(&new_lex);
thd->lex = old_lex;
xt_throw_ulxterr(XT_CONTEXT, XT_ERR_LOADING_MYSQL_DIC, (u_long) error);
xt_throw_sulxterr(XT_CONTEXT, XT_ERR_LOADING_MYSQL_DIC, tab_path->ps_path, (u_long) error);
return NULL;
}
@ -1992,7 +2004,7 @@ static TABLE *my_open_table(XTThreadPtr self, XTDatabaseHPtr XT_UNUSED(db), XTPa
xt_free(self, table);
lex_end(&new_lex);
thd->lex = old_lex;
xt_throw_ulxterr(XT_CONTEXT, XT_ERR_LOADING_MYSQL_DIC, (u_long) error);
xt_throw_sulxterr(XT_CONTEXT, XT_ERR_LOADING_MYSQL_DIC, tab_path->ps_path, (u_long) error);
return NULL;
}
#endif
@ -2959,6 +2971,46 @@ xtPublic void *myxt_create_thread()
return NULL;
}
/*
* Unfortunately, if PBXT is the default engine, and we are shutting down
* then global_system_variables.table_plugin may be NULL. Which will cause
* a crash if we try to create a thread!
*
* The following call in plugin_shutdown() sets the global reference
* to NULL:
*
* unlock_variables(NULL, &global_system_variables);
*
* Later plugin_deinitialize() is called.
*
* The following stack is an example crash which occurs when I call
* myxt_create_thread() in ha_exit(), to force the error.
*
* if (pi->state & (PLUGIN_IS_READY | PLUGIN_IS_UNINITIALIZED))
* pi is NULL!
* #0 0x002ff684 in intern_plugin_lock at sql_plugin.cc:617
* #1 0x0030296d in plugin_thdvar_init at sql_plugin.cc:2432
* #2 0x000db4a4 in THD::init at sql_class.cc:756
* #3 0x000e02ed in THD::THD at sql_class.cc:638
* #4 0x00e2678d in myxt_create_thread at myxt_xt.cc:2990
* #5 0x00e05d43 in ha_exit at ha_pbxt.cc:1011
* #6 0x00e065c2 in pbxt_end at ha_pbxt.cc:1330
* #7 0x00e065df in pbxt_panic at ha_pbxt.cc:1343
* #8 0x0023e57d in ha_finalize_handlerton at handler.cc:392
* #9 0x002ffc8b in plugin_deinitialize at sql_plugin.cc:816
* #10 0x003037d9 in plugin_shutdown at sql_plugin.cc:1572
* #11 0x000f7b2b in clean_up at mysqld.cc:1266
* #12 0x000f7fca in unireg_end at mysqld.cc:1192
* #13 0x000fa021 in kill_server at mysqld.cc:1134
* #14 0x000fa6df in kill_server_thread at mysqld.cc:1155
* #15 0x91fdb155 in _pthread_start
* #16 0x91fdb012 in thread_start
*/
if (!global_system_variables.table_plugin) {
xt_register_xterr(XT_REG_CONTEXT, XT_ERR_MYSQL_NO_THREAD);
return NULL;
}
if (!(new_thd = new THD())) {
my_thread_end();
xt_register_error(XT_REG_CONTEXT, XT_ERR_MYSQL_ERROR, 0, "Unable to create MySQL thread (THD)");
@ -2977,6 +3029,10 @@ xtPublic void *myxt_create_thread()
xtPublic void myxt_destroy_thread(void *, xtBool)
{
}
xtPublic void myxt_delete_remaining_thread()
{
}
#else
xtPublic void myxt_destroy_thread(void *thread, xtBool end_threads)
{
@ -3004,6 +3060,14 @@ xtPublic void myxt_destroy_thread(void *thread, xtBool end_threads)
if (end_threads)
my_thread_end();
}
xtPublic void myxt_delete_remaining_thread()
{
THD *thd;
if ((thd = current_thd))
myxt_destroy_thread((void *) thd, TRUE);
}
#endif
xtPublic XTThreadPtr myxt_get_self()

1
storage/pbxt/src/myxt_xt.h

@ -81,6 +81,7 @@ struct charset_info_st *myxt_getcharset(bool convert);
void *myxt_create_thread();
void myxt_destroy_thread(void *thread, xtBool end_threads);
void myxt_delete_remaining_thread();
XTThreadPtr myxt_get_self();
int myxt_statistics_fill_table(XTThreadPtr self, void *th, void *ta, void *co, MX_CONST void *ch);

91
storage/pbxt/src/restart_xt.cc

@ -2551,7 +2551,8 @@ static void *xres_cp_run_thread(XTThreadPtr self)
int count;
void *mysql_thread;
mysql_thread = myxt_create_thread();
if (!(mysql_thread = myxt_create_thread()))
xt_throw(self);
while (!self->t_quit) {
try_(a) {
@ -2588,7 +2589,10 @@ static void *xres_cp_run_thread(XTThreadPtr self)
}
}
/*
* {MYSQL-THREAD-KILL}
myxt_destroy_thread(mysql_thread, TRUE);
*/
return NULL;
}
@ -3179,22 +3183,74 @@ xtPublic void xt_dump_xlogs(XTDatabaseHPtr db, xtLogID start_log)
* D A T A B A S E R E C O V E R Y T H R E A D
*/
extern XTDatabaseHPtr pbxt_database;
extern XTDatabaseHPtr pbxt_database;
static XTThreadPtr xres_recovery_thread;
static void *xn_xres_run_recovery_thread(XTThreadPtr self)
{
THD *mysql_thread;
mysql_thread = (THD *)myxt_create_thread();
if (!(mysql_thread = (THD *) myxt_create_thread()))
xt_throw(self);
while(!ha_resolve_by_legacy_type(mysql_thread, DB_TYPE_PBXT))
while (!xres_recovery_thread->t_quit && !ha_resolve_by_legacy_type(mysql_thread, DB_TYPE_PBXT))
xt_sleep_milli_second(1);
xt_open_database(self, mysql_real_data_home, TRUE);
pbxt_database = self->st_database;
xt_heap_reference(self, pbxt_database);
if (!xres_recovery_thread->t_quit) {
/* {GLOBAL-DB}
* It can happen that something will just get in before this
* thread and open/recover the database!
*/
if (!pbxt_database) {
try_(a) {
xt_open_database(self, mysql_real_data_home, TRUE);
/* This can be done at the same time by a foreground thread,
* strictly speaking I need a lock.
*/
if (!pbxt_database) {
pbxt_database = self->st_database;
xt_heap_reference(self, pbxt_database);
}
}
catch_(a) {
xt_log_and_clear_exception(self);
}
cont_(a);
}
}
/*
* {MYSQL-THREAD-KILL}
* Here is the problem with destroying the thread at this
* point. If we had an error started, then it can lead
* to a callback into pbxt: pbxt_panic().
*
* This will shutdown things, making it impossible quite the
* thread and do a cleanup. Solution:
*
* Move the MySQL thread descruction to a later point!
*
* sql/mysqld --no-defaults --basedir=~/maria/trunk
* --character-sets-dir=~/maria/trunk/sql/share/charsets
* --language=~/maria/trunk/sql/share/english
* --skip-networking --datadir=/tmp/x --skip-grant-tables --nonexistentoption
*
* #0 0x003893f9 in xt_exit_databases at database_xt.cc:304
* #1 0x0039dc7e in pbxt_end at ha_pbxt.cc:947
* #2 0x0039dd27 in pbxt_panic at ha_pbxt.cc:1289
* #3 0x001d619e in ha_finalize_handlerton at handler.cc:391
* #4 0x00279d22 in plugin_deinitialize at sql_plugin.cc:816
* #5 0x0027bcf5 in reap_plugins at sql_plugin.cc:904
* #6 0x0027c38c in plugin_thdvar_cleanup at sql_plugin.cc:2513
* #7 0x000c0db2 in THD::~THD at sql_class.cc:934
* #8 0x003b025b in myxt_destroy_thread at myxt_xt.cc:2999
* #9 0x003b66b5 in xn_xres_run_recovery_thread at restart_xt.cc:3196
* #10 0x003cbfbb in thr_main at thread_xt.cc:1020
*
myxt_destroy_thread(mysql_thread, TRUE);
*/
xres_recovery_thread = NULL;
return NULL;
}
@ -3204,6 +3260,23 @@ xtPublic void xt_xres_start_database_recovery(XTThreadPtr self)
sprintf(name, "DB-RECOVERY-%s", xt_last_directory_of_path(mysql_real_data_home));
xt_remove_dir_char(name);
XTThreadPtr thread = xt_create_daemon(self, name);
xt_run_thread(self, thread, xn_xres_run_recovery_thread);
xres_recovery_thread = xt_create_daemon(self, name);
xt_run_thread(self, xres_recovery_thread, xn_xres_run_recovery_thread);
}
xtPublic void xt_xres_wait_for_recovery(XTThreadPtr self)
{
XTThreadPtr thr_rec;
/* {MYSQL-THREAD-KILL}
* Stack above shows that his is possible!
*/
if ((thr_rec = xres_recovery_thread) && (self != xres_recovery_thread)) {
xtThreadID tid = thr_rec->t_id;
xt_terminate_thread(self, thr_rec);
xt_wait_for_thread(tid, TRUE);
}
}

3
storage/pbxt/src/restart_xt.h

@ -131,6 +131,7 @@ xtWord8 xt_bytes_since_last_checkpoint(struct XTDatabase *db, xtLogID curr_log_i
void xt_print_log_record(xtLogID log, off_t offset, XTXactLogBufferDPtr record);
void xt_dump_xlogs(struct XTDatabase *db, xtLogID start_log);
xtPublic void xt_xres_start_database_recovery(XTThreadPtr self, const char *path);
void xt_xres_start_database_recovery(XTThreadPtr self);
void xt_xres_wait_for_recovery(XTThreadPtr self);
#endif

2
storage/pbxt/src/strutil_xt.cc

@ -368,7 +368,7 @@ xtPublic void xt_int8_to_byte_size(xtInt8 value, char *string)
/* Version number must also be set in configure.in! */
xtPublic c_char *xt_get_version(void)
{
return "1.0.08c RC";
return "1.0.08d RC";
}
/* Copy and URL decode! */

3
storage/pbxt/src/tabcache_xt.cc

@ -1178,7 +1178,10 @@ static void *tabc_fr_run_thread(XTThreadPtr self)
}
}
/*
* {MYSQL-THREAD-KILL}
myxt_destroy_thread(mysql_thread, TRUE);
*/
return NULL;
}

9
storage/pbxt/src/thread_xt.cc

@ -625,7 +625,7 @@ static c_char *thr_get_err_string(int xt_err)
case XT_ERR_NO_REFERENCED_ROW: str = "Constraint: `%s`"; break; // "Foreign key '%s', referenced row does not exist"
case XT_ERR_ROW_IS_REFERENCED: str = "Constraint: `%s`"; break; // "Foreign key '%s', has a referencing row"
case XT_ERR_BAD_DICTIONARY: str = "Internal dictionary does not match MySQL dictionary"; break;
case XT_ERR_LOADING_MYSQL_DIC: str = "Error %s loading MySQL .frm file"; break;
case XT_ERR_LOADING_MYSQL_DIC: str = "Error loading %s.frm file, MySQL error: %s"; break;
case XT_ERR_COLUMN_IS_NOT_NULL: str = "Column `%s` is NOT NULL"; break;
case XT_ERR_INCORRECT_NO_OF_COLS: str = "Incorrect number of columns near %s"; break;
case XT_ERR_FK_ON_TEMP_TABLE: str = "Cannot create foreign key on temporary table"; break;
@ -656,6 +656,8 @@ static c_char *thr_get_err_string(int xt_err)
case XT_ERR_NEW_TYPE_OF_XLOG: str = "Transaction log %s, is using a newer format, upgrade required"; break;
case XT_ERR_NO_BEFORE_IMAGE: str = "Internal error: no before image"; break;
case XT_ERR_FK_REF_TEMP_TABLE: str = "Foreign key may not reference temporary table"; break;
case XT_ERR_MYSQL_SHUTDOWN: str = "Cannot open table, MySQL has shutdown"; break;
case XT_ERR_MYSQL_NO_THREAD: str = "Cannot create thread, MySQL has shutdown"; break;
default: str = "Unknown XT error"; break;
}
return str;
@ -1026,6 +1028,11 @@ extern "C" void *thr_main(void *data)
outer_();
xt_free_thread(self);
/* {MYSQL-THREAD-KILL}
* Clean up any remaining MySQL thread!
*/
myxt_delete_remaining_thread();
return return_data;
}

6
storage/pbxt/src/xaction_xt.cc

@ -2529,7 +2529,8 @@ static void *xn_sw_run_thread(XTThreadPtr self)
int count;
void *mysql_thread;
mysql_thread = myxt_create_thread();
if (!(mysql_thread = myxt_create_thread()))
xt_throw(self);
while (!self->t_quit) {
try_(a) {
@ -2586,7 +2587,10 @@ static void *xn_sw_run_thread(XTThreadPtr self)
db->db_sw_idle = XT_THREAD_BUSY;
}
/*
* {MYSQL-THREAD-KILL}
myxt_destroy_thread(mysql_thread, TRUE);
*/
return NULL;
}

3
storage/pbxt/src/xactlog_xt.cc

@ -2610,7 +2610,10 @@ static void *xlog_wr_run_thread(XTThreadPtr self)
db->db_wr_idle = XT_THREAD_BUSY;
}
/*
* {MYSQL-THREAD-KILL}
myxt_destroy_thread(mysql_thread, TRUE);
*/
return NULL;
}

2
storage/pbxt/src/xt_errno.h

@ -117,6 +117,8 @@
#define XT_ERR_NEW_TYPE_OF_XLOG -93
#define XT_ERR_NO_BEFORE_IMAGE -94
#define XT_ERR_FK_REF_TEMP_TABLE -95
#define XT_ERR_MYSQL_SHUTDOWN -98
#define XT_ERR_MYSQL_NO_THREAD -99
#ifdef XT_WIN
#define XT_ENOMEM ERROR_NOT_ENOUGH_MEMORY

4
storage/xtradb/fil/fil0fil.c

@ -45,7 +45,9 @@ Created 10/25/1995 Heikki Tuuri
#include "trx0trx.h"
#include "trx0sys.h"
#include "pars0pars.h"
#include "row0row.h"
#include "row0mysql.h"
#include "que0que.h"
/*
@ -3137,7 +3139,7 @@ skip_info:
rec_offs_init(offsets_);
fprintf(stderr, "InnoDB: Progress in %:");
fprintf(stderr, "%s", "InnoDB: Progress in %:");
for (offset = 0; offset < size_bytes; offset += UNIV_PAGE_SIZE) {
success = os_file_read(file, page,

1
storage/xtradb/mtr/mtr0mtr.c

@ -32,6 +32,7 @@ Created 11/26/1995 Heikki Tuuri
#include "page0types.h"
#include "mtr0log.h"
#include "log0log.h"
#include "buf0flu.h"
/*********************************************************************
Releases the item in the slot given. */

1
storage/xtradb/srv/srv0srv.c

@ -1815,7 +1815,6 @@ srv_printf_innodb_monitor(
ulint btr_search_sys_subtotal;
ulint lock_sys_subtotal;
ulint recv_sys_subtotal;
ulint io_counter_subtotal;
ulint i;
trx_t* trx;

14
storage/xtradb/srv/srv0start.c

@ -122,20 +122,6 @@ static char* srv_monitor_file_name;
#define SRV_MAX_N_PENDING_SYNC_IOS 100
/* Avoid warnings when using purify */
#ifdef HAVE_valgrind
static int inno_bcmp(register const char *s1, register const char *s2,
register uint len)
{
while ((len-- != 0) && (*s1++ == *s2++))
;
return(len + 1);
}
#define memcmp(A,B,C) inno_bcmp((A),(B),(C))
#endif
static
char*
srv_parse_megabytes(

6
strings/decimal.c

@ -306,7 +306,7 @@ int decimal_actual_fraction(decimal_t *from)
{
for (i= DIG_PER_DEC1 - ((frac - 1) % DIG_PER_DEC1);
*buf0 % powers10[i++] == 0;
frac--);
frac--) {}
}
return frac;
}
@ -500,7 +500,7 @@ static void digits_bounds(decimal_t *from, int *start_result, int *end_result)
stop= (int) ((buf_end - from->buf + 1) * DIG_PER_DEC1);
i= 1;
}
for (; *buf_end % powers10[i++] == 0; stop--);
for (; *buf_end % powers10[i++] == 0; stop--) {}
*end_result= stop; /* index of position after last decimal digit (from 0) */
}
@ -1011,7 +1011,7 @@ static int ull2dec(ulonglong from, decimal_t *to)
sanity(to);
for (intg1=1; from >= DIG_BASE; intg1++, from/=DIG_BASE);
for (intg1=1; from >= DIG_BASE; intg1++, from/=DIG_BASE) {}
if (unlikely(intg1 > to->len))
{
intg1=to->len;

104
support-files/ccfilter

@ -0,0 +1,104 @@
#! /usr/bin/perl
# Post-processor for compiler output to filter out warnings matched in
# support-files/compiler_warnings.supp. This makes it easier to check
# that no new warnings are introduced without needing to submit a build
# for Buildbot.
#
# Use by setting CC="ccfilter gcc" CXX="ccfilter gcc" before ./configure.
#
# By default, just filters the output for suppressed warnings. If the
# FAILONWARNING environment variable is set, then instead will fail the
# compile on encountering a non-suppressed warnings.
use strict;
use warnings;
my $suppressions;
open STDOUT_COPY, ">&STDOUT"
or die "Failed to dup stdout: $!]n";
my $pid= open(PIPE, '-|');
if (!defined($pid)) {
die "Error: Cannot fork(): $!\n";
} elsif (!$pid) {
# Child.
# actually want to send the STDERR to the parent, not the STDOUT.
# So shuffle things around a bit.
open STDERR, ">&STDOUT"
or die "Child: Failed to dup pipe to parent: $!\n";
open STDOUT, ">&STDOUT_COPY"
or die "Child: Failed to dup parent stdout: $!\n";
close STDOUT_COPY;
exec { $ARGV[0] } @ARGV;
die "Child: exec() failed: $!\n";
} else {
# Parent.
close STDOUT_COPY;
my $cwd= qx(pwd);
chomp($cwd);
while (<PIPE>) {
my $line= $_;
if (/^(.*?):([0-9]+): [Ww]arning: (.*)$/) {
my ($file, $lineno, $msg)= ($1, $2, $3);
$file= "$cwd/$file";
next
if check_if_suppressed($file, $lineno, $msg);
die "$line\nGot warning, terminating.\n"
if $ENV{FAILONWARNING};
print STDERR $line;
next;
}
print STDERR $line;
}
close(PIPE);
}
exit 0;
sub check_if_suppressed {
my ($file, $lineno, $msg)= @_;
load_suppressions() unless defined($suppressions);
for my $s (@$suppressions) {
my ($file_re, $msg_re, $start, $end)= @$s;
if ($file =~ /$file_re/ &&
$msg =~ /$msg_re/ &&
(!defined($start) || $start <= $lineno) &&
(!defined($end) || $end >= $lineno)) {
return 1;
}
}
return undef;
}
sub load_suppressions {
# First find the suppressions file, might be we need to move up to
# the base directory.
my $path = "support-files/compiler_warnings.supp";
my $exists;
for (1..10) {
$exists= -f $path;
last if $exists;
$path= '../'. $path;
}
die "Error: Could not find suppression file (out of source dir?).\n"
unless $exists;
$suppressions= [];
open "F", "<", $path
or die "Error: Could not read suppression file '$path': $!\n";
while (<F>) {
# Skip comment and empty lines.
next if /^\s*(\#.*)?$/;
die "Invalid syntax in suppression file '$path', line $.:\n$_"
unless /^\s*(.+?)\s*:\s*(.+?)\s*(?:[:]\s*([0-9]+)(?:-([0-9]+))?\s*)?$/;
my ($file_re, $line_re, $start, $end)= ($1, $2, $3, $4);
$end = $start
if defined($start) && !defined($end);
push @$suppressions, [$file_re, $line_re, $start, $end];
}
}

20
support-files/compiler_warnings.supp

@ -25,6 +25,9 @@ sql_yacc.cc : .*switch statement contains 'default' but no 'case' labels.*
pars0grm.tab.c: .*'yyerrorlab' : unreferenced label.*
_flex_tmp.c: .*not enough actual parameters for macro 'yywrap'.*
pars0lex.l: .*conversion from 'ulint' to 'int', possible loss of data.*
btr/btr0cur\.c: .*value computed is not used.*: 3175-3375
include/buf0buf\.ic: unused parameter ‘mtr’
fil/fil0fil\.c: comparison between signed and unsigned : 3100-3199
#
# bdb is not critical to keep up to date
@ -40,6 +43,12 @@ db_vrfy.c : .*comparison is always false due to limited range of data type.*
#
.*/cmd-line-utils/readline/.* : .*
#
# Ignore some warnings in libevent, which is not maintained by us.
#
.*/extra/libevent/.* : .*unused parameter.*
.*/extra/libevent/select\.c : .*comparison between signed and unsigned.* : 270-280
#
# Ignore all conversion warnings on windows 64
# (Is safe as we are not yet supporting strings >= 2G)
@ -74,6 +83,17 @@ db_vrfy.c : .*comparison is always false due to limited range of data type.*
#
storage/maria/ma_pagecache.c: .*'info_check_pin' defined but not used
#
# I think these are due to mix of C and C++.
#
storage/pbxt/ : typedef.*was ignored in this declaration
#
# Groff warnings on OpenSUSE.
#
.*/dbug/.*(groff|<standard input>) : .*
#
# Unexplanable (?) stuff
#

Loading…
Cancel
Save