Merge siva.hindu.god:/usr/home/tim/m/bk/g50

into  siva.hindu.god:/usr/home/tim/m/bk/50
This commit is contained in:
tsmith/tim@siva.hindu.god 2006-12-21 18:20:09 -07:00
commit f204db4dd1
44 changed files with 517 additions and 200 deletions

View File

@ -334,7 +334,8 @@ history_truncate_file (fname, lines)
file_size = (size_t)finfo.st_size; file_size = (size_t)finfo.st_size;
/* check for overflow on very large files */ /* check for overflow on very large files */
if (file_size != finfo.st_size || file_size + 1 < file_size) if ((long long) file_size != (long long) finfo.st_size ||
file_size + 1 < file_size)
{ {
close (file); close (file);
#if defined (EFBIG) #if defined (EFBIG)

View File

@ -7,7 +7,7 @@ AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
# remember to also change ndb version below and update version.c in ndb # remember to also change ndb version below and update version.c in ndb
AM_INIT_AUTOMAKE(mysql, 5.0.32) AM_INIT_AUTOMAKE(mysql, 5.0.34)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
@ -19,7 +19,7 @@ SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
# ndb version # ndb version
NDB_VERSION_MAJOR=5 NDB_VERSION_MAJOR=5
NDB_VERSION_MINOR=0 NDB_VERSION_MINOR=0
NDB_VERSION_BUILD=32 NDB_VERSION_BUILD=34
NDB_VERSION_STATUS="" NDB_VERSION_STATUS=""
# Set all version vars based on $VERSION. How do we do this more elegant ? # Set all version vars based on $VERSION. How do we do this more elegant ?

View File

@ -27,6 +27,9 @@ Created 1/8/1996 Heikki Tuuri
#include "que0que.h" #include "que0que.h"
#include "rem0cmp.h" #include "rem0cmp.h"
/* Implement isspace() in a locale-independent way. (Bug #24299) */
#define ib_isspace(c) strchr(" \v\f\t\r\n", c)
dict_sys_t* dict_sys = NULL; /* the dictionary system */ dict_sys_t* dict_sys = NULL; /* the dictionary system */
rw_lock_t dict_operation_lock; /* table create, drop, etc. reserve rw_lock_t dict_operation_lock; /* table create, drop, etc. reserve
@ -2406,7 +2409,7 @@ dict_accept(
*success = FALSE; *success = FALSE;
while (isspace(*ptr)) { while (ib_isspace(*ptr)) {
ptr++; ptr++;
} }
@ -2451,7 +2454,7 @@ dict_scan_id(
*id = NULL; *id = NULL;
while (isspace(*ptr)) { while (ib_isspace(*ptr)) {
ptr++; ptr++;
} }
@ -2482,7 +2485,7 @@ dict_scan_id(
len++; len++;
} }
} else { } else {
while (!isspace(*ptr) && *ptr != '(' && *ptr != ')' while (!ib_isspace(*ptr) && *ptr != '(' && *ptr != ')'
&& (accept_also_dot || *ptr != '.') && (accept_also_dot || *ptr != '.')
&& *ptr != ',' && *ptr != '\0') { && *ptr != ',' && *ptr != '\0') {
@ -2512,12 +2515,12 @@ dict_scan_id(
if (heap && !quote) { if (heap && !quote) {
/* EMS MySQL Manager sometimes adds characters 0xA0 (in /* EMS MySQL Manager sometimes adds characters 0xA0 (in
latin1, a 'non-breakable space') to the end of a table name. latin1, a 'non-breakable space') to the end of a table name.
But isspace(0xA0) is not true, which confuses our foreign key After the UTF-8 conversion in ha_innodb.cc, bytes 0xC2
parser. After the UTF-8 conversion in ha_innodb.cc, bytes 0xC2 and 0xA0 are at the end of the string, and ib_isspace()
and 0xA0 are at the end of the string. does not work for multi-byte UTF-8 characters.
TODO: we should lex the string using thd->charset_info, and In MySQL 5.1 we lex the string using thd->charset_info, and
my_isspace(). Only after that, convert id names to UTF-8. */ my_isspace(). This workaround is not needed there. */
b = (byte*)(*id); b = (byte*)(*id);
id_len = strlen((char*) b); id_len = strlen((char*) b);
@ -3006,11 +3009,11 @@ loop:
ut_a(success); ut_a(success);
if (!isspace(*ptr) && *ptr != '"' && *ptr != '`') { if (!ib_isspace(*ptr) && *ptr != '"' && *ptr != '`') {
goto loop; goto loop;
} }
while (isspace(*ptr)) { while (ib_isspace(*ptr)) {
ptr++; ptr++;
} }
@ -3052,7 +3055,7 @@ loop:
goto loop; goto loop;
} }
if (!isspace(*ptr)) { if (!ib_isspace(*ptr)) {
goto loop; goto loop;
} }
@ -3140,7 +3143,7 @@ col_loop1:
} }
ptr = dict_accept(ptr, "REFERENCES", &success); ptr = dict_accept(ptr, "REFERENCES", &success);
if (!success || !isspace(*ptr)) { if (!success || !ib_isspace(*ptr)) {
dict_foreign_report_syntax_err(name, start_of_latest_foreign, dict_foreign_report_syntax_err(name, start_of_latest_foreign,
ptr); ptr);
return(DB_CANNOT_ADD_CONSTRAINT); return(DB_CANNOT_ADD_CONSTRAINT);
@ -3527,7 +3530,7 @@ loop:
ptr = dict_accept(ptr, "DROP", &success); ptr = dict_accept(ptr, "DROP", &success);
if (!isspace(*ptr)) { if (!ib_isspace(*ptr)) {
goto loop; goto loop;
} }

View File

@ -19,6 +19,8 @@ Created 9/17/2000 Heikki Tuuri
#include "btr0pcur.h" #include "btr0pcur.h"
#include "trx0types.h" #include "trx0types.h"
extern ibool row_rollback_on_timeout;
typedef struct row_prebuilt_struct row_prebuilt_t; typedef struct row_prebuilt_struct row_prebuilt_t;
/*********************************************************************** /***********************************************************************

View File

@ -61,7 +61,11 @@ Creates, or rather, initializes an rw-lock object in a specified memory
location (which must be appropriately aligned). The rw-lock is initialized location (which must be appropriately aligned). The rw-lock is initialized
to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free
is necessary only if the memory block containing it is freed. */ is necessary only if the memory block containing it is freed. */
#define rw_lock_create(L) rw_lock_create_func((L), __FILE__, __LINE__, #L) #ifdef UNIV_DEBUG
# define rw_lock_create(L) rw_lock_create_func((L), #L, __FILE__, __LINE__)
#else /* UNIV_DEBUG */
# define rw_lock_create(L) rw_lock_create_func((L), __FILE__, __LINE__)
#endif /* UNIV_DEBUG */
/*=====================*/ /*=====================*/
/********************************************************************** /**********************************************************************
@ -74,9 +78,11 @@ void
rw_lock_create_func( rw_lock_create_func(
/*================*/ /*================*/
rw_lock_t* lock, /* in: pointer to memory */ rw_lock_t* lock, /* in: pointer to memory */
#ifdef UNIV_DEBUG
const char* cmutex_name, /* in: mutex name */
#endif /* UNIV_DEBUG */
const char* cfile_name, /* in: file name where created */ const char* cfile_name, /* in: file name where created */
ulint cline, /* in: file line where created */ ulint cline); /* in: file line where created */
const char* cmutex_name); /* in: mutex name */
/********************************************************************** /**********************************************************************
Calling this function is obligatory only if the memory buffer containing Calling this function is obligatory only if the memory buffer containing
the rw-lock is freed. Removes an rw-lock object from the global list. The the rw-lock is freed. Removes an rw-lock object from the global list. The

View File

@ -39,7 +39,11 @@ location (which must be appropriately aligned). The mutex is initialized
in the reset state. Explicit freeing of the mutex with mutex_free is in the reset state. Explicit freeing of the mutex with mutex_free is
necessary only if the memory block containing it is freed. */ necessary only if the memory block containing it is freed. */
#define mutex_create(M) mutex_create_func((M), __FILE__, __LINE__, #M) #ifdef UNIV_DEBUG
# define mutex_create(M) mutex_create_func((M), #M, __FILE__, __LINE__)
#else
# define mutex_create(M) mutex_create_func((M), __FILE__, __LINE__)
#endif
/*===================*/ /*===================*/
/********************************************************************** /**********************************************************************
Creates, or rather, initializes a mutex object in a specified memory Creates, or rather, initializes a mutex object in a specified memory
@ -51,9 +55,11 @@ void
mutex_create_func( mutex_create_func(
/*==============*/ /*==============*/
mutex_t* mutex, /* in: pointer to memory */ mutex_t* mutex, /* in: pointer to memory */
#ifdef UNIV_DEBUG
const char* cmutex_name, /* in: mutex name */
#endif /* UNIV_DEBUG */
const char* cfile_name, /* in: file name where created */ const char* cfile_name, /* in: file name where created */
ulint cline, /* in: file line where created */ ulint cline); /* in: file line where created */
const char* cmutex_name); /* in: mutex name */
/********************************************************************** /**********************************************************************
Calling this function is obligatory only if the memory buffer containing Calling this function is obligatory only if the memory buffer containing
the mutex is freed. Removes a mutex object from the mutex list. The mutex the mutex is freed. Removes a mutex object from the mutex list. The mutex
@ -479,15 +485,17 @@ struct mutex_struct {
ulint cline; /* Line where created */ ulint cline; /* Line where created */
ulint magic_n; ulint magic_n;
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
ulong count_os_wait; /* count of os_wait */
# ifdef UNIV_DEBUG
ulong count_using; /* count of times mutex used */ ulong count_using; /* count of times mutex used */
ulong count_spin_loop; /* count of spin loops */ ulong count_spin_loop; /* count of spin loops */
ulong count_spin_rounds; /* count of spin rounds */ ulong count_spin_rounds; /* count of spin rounds */
ulong count_os_wait; /* count of os_wait */
ulong count_os_yield; /* count of os_wait */ ulong count_os_yield; /* count of os_wait */
ulonglong lspent_time; /* mutex os_wait timer msec */ ulonglong lspent_time; /* mutex os_wait timer msec */
ulonglong lmax_spent_time; /* mutex os_wait timer msec */ ulonglong lmax_spent_time; /* mutex os_wait timer msec */
const char* cmutex_name;/* mutex name */ const char* cmutex_name;/* mutex name */
ulint mutex_type;/* 0 - usual mutex 1 - rw_lock mutex */ ulint mutex_type;/* 0 - usual mutex 1 - rw_lock mutex */
# endif /* UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
}; };

View File

@ -250,9 +250,9 @@ mutex_enter_func(
/* Note that we do not peek at the value of lock_word before trying /* Note that we do not peek at the value of lock_word before trying
the atomic test_and_set; we could peek, and possibly save time. */ the atomic test_and_set; we could peek, and possibly save time. */
#ifndef UNIV_HOTBACKUP #if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
mutex->count_using++; mutex->count_using++;
#endif /* UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
if (!mutex_test_and_set(mutex)) if (!mutex_test_and_set(mutex))
{ {

View File

@ -33,6 +33,7 @@ Created 9/20/1997 Heikki Tuuri
#include "btr0cur.h" #include "btr0cur.h"
#include "dict0boot.h" #include "dict0boot.h"
#include "fil0fil.h" #include "fil0fil.h"
#include "sync0sync.h"
#ifdef UNIV_HOTBACKUP #ifdef UNIV_HOTBACKUP
/* This is set to FALSE if the backup was originally taken with the /* This is set to FALSE if the backup was originally taken with the
@ -2969,6 +2970,15 @@ recv_recovery_from_checkpoint_finish(void)
#ifndef UNIV_LOG_DEBUG #ifndef UNIV_LOG_DEBUG
recv_sys_free(); recv_sys_free();
#endif #endif
#ifdef UNIV_SYNC_DEBUG
/* Wait for a while so that created threads have time to suspend
themselves before we switch the latching order checks on */
os_thread_sleep(1000000);
/* Switch latching order checks on in sync0sync.c */
sync_order_checks_on = TRUE;
#endif
if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) { if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) {
/* Rollback the uncommitted transactions which have no user /* Rollback the uncommitted transactions which have no user
session */ session */

View File

@ -35,6 +35,9 @@ Created 9/17/2000 Heikki Tuuri
/* A dummy variable used to fool the compiler */ /* A dummy variable used to fool the compiler */
ibool row_mysql_identically_false = FALSE; ibool row_mysql_identically_false = FALSE;
/* Provide optional 4.x backwards compatibility for 5.0 and above */
ibool row_rollback_on_timeout = FALSE;
/* List of tables we should drop in background. ALTER TABLE in MySQL requires /* List of tables we should drop in background. ALTER TABLE in MySQL requires
that the table handler can drop the table in background when there are no that the table handler can drop the table in background when there are no
queries to it any more. Protected by the kernel mutex. */ queries to it any more. Protected by the kernel mutex. */
@ -514,7 +517,9 @@ handle_new_error:
return(TRUE); return(TRUE);
} else if (err == DB_DEADLOCK } else if (err == DB_DEADLOCK
|| err == DB_LOCK_TABLE_FULL) { || err == DB_LOCK_TABLE_FULL
|| (err == DB_LOCK_WAIT_TIMEOUT
&& row_rollback_on_timeout)) {
/* Roll back the whole transaction; this resolution was added /* Roll back the whole transaction; this resolution was added
to version 3.23.43 */ to version 3.23.43 */
@ -522,6 +527,10 @@ handle_new_error:
} else if (err == DB_OUT_OF_FILE_SPACE } else if (err == DB_OUT_OF_FILE_SPACE
|| err == DB_LOCK_WAIT_TIMEOUT) { || err == DB_LOCK_WAIT_TIMEOUT) {
ut_ad(!(err == DB_LOCK_WAIT_TIMEOUT
&& row_rollback_on_timeout));
if (savept) { if (savept) {
/* Roll back the latest, possibly incomplete /* Roll back the latest, possibly incomplete
insertion or update */ insertion or update */

View File

@ -1554,17 +1554,6 @@ innobase_start_or_create_for_mysql(void)
srv_was_started = TRUE; srv_was_started = TRUE;
srv_is_being_started = FALSE; srv_is_being_started = FALSE;
#ifdef UNIV_DEBUG
/* Wait a while so that the created threads have time to suspend
themselves before we switch sync debugging on; otherwise a thread may
execute mutex_enter() before the checks are on, and mutex_exit() after
the checks are on, which will cause an assertion failure in sync
debug. */
os_thread_sleep(3000000);
#endif
sync_order_checks_on = TRUE;
if (trx_doublewrite == NULL) { if (trx_doublewrite == NULL) {
/* Create the doublewrite buffer to a new tablespace */ /* Create the doublewrite buffer to a new tablespace */

View File

@ -89,9 +89,11 @@ void
rw_lock_create_func( rw_lock_create_func(
/*================*/ /*================*/
rw_lock_t* lock, /* in: pointer to memory */ rw_lock_t* lock, /* in: pointer to memory */
#ifdef UNIV_DEBUG
const char* cmutex_name, /* in: mutex name */
#endif /* UNIV_DEBUG */
const char* cfile_name, /* in: file name where created */ const char* cfile_name, /* in: file name where created */
ulint cline, /* in: file line where created */ ulint cline) /* in: file line where created */
const char* cmutex_name) /* in: mutex name */
{ {
/* If this is the very first time a synchronization /* If this is the very first time a synchronization
object is created, then the following call initializes object is created, then the following call initializes
@ -102,10 +104,10 @@ rw_lock_create_func(
lock->mutex.cfile_name = cfile_name; lock->mutex.cfile_name = cfile_name;
lock->mutex.cline = cline; lock->mutex.cline = cline;
#ifndef UNIV_HOTBACKUP #if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
lock->mutex.cmutex_name = cmutex_name; lock->mutex.cmutex_name = cmutex_name;
lock->mutex.mutex_type = 1; lock->mutex.mutex_type = 1;
#endif /* !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
rw_lock_set_waiters(lock, 0); rw_lock_set_waiters(lock, 0);
rw_lock_set_writer(lock, RW_LOCK_NOT_LOCKED); rw_lock_set_writer(lock, RW_LOCK_NOT_LOCKED);

View File

@ -202,9 +202,11 @@ void
mutex_create_func( mutex_create_func(
/*==============*/ /*==============*/
mutex_t* mutex, /* in: pointer to memory */ mutex_t* mutex, /* in: pointer to memory */
#ifdef UNIV_DEBUG
const char* cmutex_name, /* in: mutex name */
#endif /* UNIV_DEBUG */
const char* cfile_name, /* in: file name where created */ const char* cfile_name, /* in: file name where created */
ulint cline, /* in: file line where created */ ulint cline) /* in: file line where created */
const char* cmutex_name) /* in: mutex name */
{ {
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER) #if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER)
mutex_reset_lock_word(mutex); mutex_reset_lock_word(mutex);
@ -223,6 +225,8 @@ mutex_create_func(
mutex->cfile_name = cfile_name; mutex->cfile_name = cfile_name;
mutex->cline = cline; mutex->cline = cline;
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
mutex->count_os_wait = 0;
# ifdef UNIV_DEBUG
mutex->cmutex_name= cmutex_name; mutex->cmutex_name= cmutex_name;
mutex->count_using= 0; mutex->count_using= 0;
mutex->mutex_type= 0; mutex->mutex_type= 0;
@ -230,8 +234,8 @@ mutex_create_func(
mutex->lmax_spent_time= 0; mutex->lmax_spent_time= 0;
mutex->count_spin_loop= 0; mutex->count_spin_loop= 0;
mutex->count_spin_rounds= 0; mutex->count_spin_rounds= 0;
mutex->count_os_wait= 0;
mutex->count_os_yield= 0; mutex->count_os_yield= 0;
# endif /* UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
/* Check that lock_word is aligned; this is important on Intel */ /* Check that lock_word is aligned; this is important on Intel */
@ -378,13 +382,13 @@ mutex_spin_wait(
{ {
ulint index; /* index of the reserved wait cell */ ulint index; /* index of the reserved wait cell */
ulint i; /* spin round count */ ulint i; /* spin round count */
#ifndef UNIV_HOTBACKUP #if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
ib_longlong lstart_time = 0, lfinish_time; /* for timing os_wait */ ib_longlong lstart_time = 0, lfinish_time; /* for timing os_wait */
ulint ltime_diff; ulint ltime_diff;
ulint sec; ulint sec;
ulint ms; ulint ms;
uint timer_started = 0; uint timer_started = 0;
#endif /* !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
ut_ad(mutex); ut_ad(mutex);
mutex_loop: mutex_loop:
@ -398,10 +402,10 @@ mutex_loop:
memory word. */ memory word. */
spin_loop: spin_loop:
#ifndef UNIV_HOTBACKUP #if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
mutex_spin_wait_count++; mutex_spin_wait_count++;
mutex->count_spin_loop++; mutex->count_spin_loop++;
#endif /* !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
while (mutex_get_lock_word(mutex) != 0 && i < SYNC_SPIN_ROUNDS) while (mutex_get_lock_word(mutex) != 0 && i < SYNC_SPIN_ROUNDS)
{ {
@ -415,7 +419,7 @@ spin_loop:
if (i == SYNC_SPIN_ROUNDS) if (i == SYNC_SPIN_ROUNDS)
{ {
#ifndef UNIV_HOTBACKUP #if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
mutex->count_os_yield++; mutex->count_os_yield++;
if (timed_mutexes == 1 && timer_started==0) if (timed_mutexes == 1 && timer_started==0)
{ {
@ -423,7 +427,7 @@ spin_loop:
lstart_time= (ib_longlong)sec * 1000000 + ms; lstart_time= (ib_longlong)sec * 1000000 + ms;
timer_started = 1; timer_started = 1;
} }
#endif /* !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
os_thread_yield(); os_thread_yield();
} }
@ -436,9 +440,9 @@ spin_loop:
mutex_spin_round_count += i; mutex_spin_round_count += i;
#ifndef UNIV_HOTBACKUP #if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
mutex->count_spin_rounds += i; mutex->count_spin_rounds += i;
#endif /* !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
if (mutex_test_and_set(mutex) == 0) if (mutex_test_and_set(mutex) == 0)
{ {
@ -522,6 +526,7 @@ Now there is no risk of infinite wait on the event. */
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
mutex->count_os_wait++; mutex->count_os_wait++;
# ifdef UNIV_DEBUG
/* /*
!!!!! Sometimes os_wait can be called without os_thread_yield !!!!! Sometimes os_wait can be called without os_thread_yield
*/ */
@ -532,13 +537,14 @@ Now there is no risk of infinite wait on the event. */
lstart_time= (ib_longlong)sec * 1000000 + ms; lstart_time= (ib_longlong)sec * 1000000 + ms;
timer_started = 1; timer_started = 1;
} }
# endif /* UNIV_DEBUG */
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
sync_array_wait_event(sync_primary_wait_array, index); sync_array_wait_event(sync_primary_wait_array, index);
goto mutex_loop; goto mutex_loop;
finish_timing: finish_timing:
#ifndef UNIV_HOTBACKUP #if defined UNIV_DEBUG && !defined UNIV_HOTBACKUP
if (timed_mutexes == 1 && timer_started==1) if (timed_mutexes == 1 && timer_started==1)
{ {
ut_usectime(&sec, &ms); ut_usectime(&sec, &ms);
@ -551,7 +557,7 @@ finish_timing:
mutex->lmax_spent_time= ltime_diff; mutex->lmax_spent_time= ltime_diff;
} }
} }
#endif /* !UNIV_HOTBACKUP */ #endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
return; return;
} }

View File

@ -130,6 +130,24 @@ trx_rollback_for_mysql(
trx->op_info = "rollback"; trx->op_info = "rollback";
/* If we are doing the XA recovery of prepared transactions, then
the transaction object does not have an InnoDB session object, and we
set a dummy session that we use for all MySQL transactions. */
mutex_enter(&kernel_mutex);
if (trx->sess == NULL) {
/* Open a dummy session */
if (!trx_dummy_sess) {
trx_dummy_sess = sess_open();
}
trx->sess = trx_dummy_sess;
}
mutex_exit(&kernel_mutex);
err = trx_general_rollback_for_mysql(trx, FALSE, NULL); err = trx_general_rollback_for_mysql(trx, FALSE, NULL);
trx->op_info = ""; trx->op_info = "";

View File

@ -1602,6 +1602,24 @@ trx_commit_for_mysql(
trx->op_info = "committing"; trx->op_info = "committing";
/* If we are doing the XA recovery of prepared transactions, then
the transaction object does not have an InnoDB session object, and we
set the dummy session that we use for all MySQL transactions. */
mutex_enter(&kernel_mutex);
if (trx->sess == NULL) {
/* Open a dummy session */
if (!trx_dummy_sess) {
trx_dummy_sess = sess_open();
}
trx->sess = trx_dummy_sess;
}
mutex_exit(&kernel_mutex);
trx_start_if_not_started(trx); trx_start_if_not_started(trx);
mutex_enter(&kernel_mutex); mutex_enter(&kernel_mutex);

View File

@ -0,0 +1,37 @@
#
# Bug #24200: Provide backwards compatibility mode for 4.x "rollback on
# transaction timeout"
#
show variables like 'innodb_rollback_on_timeout';
create table t1 (a int unsigned not null primary key) engine = innodb;
insert into t1 values (1);
commit;
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con2;
begin work;
insert into t1 values (2);
select * from t1;
connection con1;
begin work;
insert into t1 values (5);
select * from t1;
# Lock wait timeout set to 2 seconds in <THIS TEST>-master.opt; this
# statement will time out; in 5.0.13+, it will not roll back transaction.
--error ER_LOCK_WAIT_TIMEOUT
insert into t1 values (2);
# On 5.0.13+, this should give ==> 1, 5
select * from t1;
commit;
connection con2;
select * from t1;
commit;
connection default;
select * from t1;
drop table t1;
disconnect con1;
disconnect con2;

View File

@ -10,11 +10,17 @@ use Fcntl ':flock';
# Requested IDs are stored in a hash and released upon END. # Requested IDs are stored in a hash and released upon END.
# #
my %mtr_unique_assigned_ids = (); my %mtr_unique_assigned_ids = ();
my $mtr_unique_pid;
BEGIN {
$mtr_unique_pid = $$ unless defined $mtr_unique_pid;
}
END { END {
if($mtr_unique_pid == $$) {
while(my ($id,$file) = each(%mtr_unique_assigned_ids)) { while(my ($id,$file) = each(%mtr_unique_assigned_ids)) {
print "Autoreleasing $file:$id\n"; print "Autoreleasing $file:$id\n";
mtr_release_unique_id($file, $id); mtr_release_unique_id($file, $id);
} }
}
} }
# #

View File

@ -58,6 +58,7 @@ $Devel::Trace::TRACE= 0; # Don't trace boring init stuff
use File::Path; use File::Path;
use File::Basename; use File::Basename;
use File::Copy; use File::Copy;
use File::Temp qw / tempdir /;
use Cwd; use Cwd;
use Getopt::Long; use Getopt::Long;
use Sys::Hostname; use Sys::Hostname;
@ -1032,6 +1033,11 @@ sub command_line_setup () {
my $sockdir = $opt_tmpdir; my $sockdir = $opt_tmpdir;
$sockdir =~ s|/+$||; $sockdir =~ s|/+$||;
# On some operating systems, there is a limit to the length of a
# UNIX domain socket's path far below PATH_MAX, so try to avoid long
# socket path names.
$sockdir = tempdir(CLEANUP => 1) if ( length($sockdir) > 80 );
# Put this into a hash, will be a C struct # Put this into a hash, will be a C struct
$master->[0]= $master->[0]=

View File

@ -1916,4 +1916,16 @@ CHAR(0xff,0x8f USING utf8) IS NULL
Warnings: Warnings:
Error 1300 Invalid utf8 character string: 'FF8F' Error 1300 Invalid utf8 character string: 'FF8F'
SET SQL_MODE=@orig_sql_mode; SET SQL_MODE=@orig_sql_mode;
select substring('abc', cast(2 as unsigned int));
substring('abc', cast(2 as unsigned int))
bc
select repeat('a', cast(2 as unsigned int));
repeat('a', cast(2 as unsigned int))
aa
select rpad('abc', cast(5 as unsigned integer), 'x');
rpad('abc', cast(5 as unsigned integer), 'x')
abcxx
select lpad('abc', cast(5 as unsigned integer), 'x');
lpad('abc', cast(5 as unsigned integer), 'x')
xxabc
End of 5.0 tests End of 5.0 tests

View File

@ -673,6 +673,22 @@ POINT(10 10)
select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))); select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))));
(asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))) (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))))
POINT(10 10) POINT(10 10)
create table t1 (g GEOMETRY);
select * from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 g g 255 4294967295 0 Y 144 0 63
g
select asbinary(g) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def asbinary(g) 252 8192 0 Y 128 0 63
asbinary(g)
drop table t1;
create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b));
alter table t1 disable keys;
load data infile '../std_data_ln/bad_gis_data.dat' into table t1;
ERROR 22004: Column was set to data type implicit default; NULL supplied for NOT NULL column 'b' at row 1
alter table t1 enable keys;
drop table t1;
create table t1 (s1 geometry not null,s2 char(100)); create table t1 (s1 geometry not null,s2 char(100));
create trigger t1_bu before update on t1 for each row set new.s1 = null; create trigger t1_bu before update on t1 for each row set new.s1 = null;
insert into t1 values (null,null); insert into t1 values (null,null);
@ -696,16 +712,6 @@ alter table t1 add primary key pti(pt);
ERROR 42000: BLOB/TEXT column 'pt' used in key specification without a key length ERROR 42000: BLOB/TEXT column 'pt' used in key specification without a key length
alter table t1 add primary key pti(pt(20)); alter table t1 add primary key pti(pt(20));
drop table t1; drop table t1;
create table t1 (g GEOMETRY);
select * from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 g g 255 4294967295 0 Y 144 0 63
g
select asbinary(g) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def asbinary(g) 252 8192 0 Y 128 0 63
asbinary(g)
drop table t1;
create table t1 select GeomFromText('point(1 1)'); create table t1 select GeomFromText('point(1 1)');
desc t1; desc t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra

View File

@ -383,4 +383,40 @@ EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using filesort
DROP TABLE t1; DROP TABLE t1;
show variables like 'innodb_rollback_on_timeout';
Variable_name Value
innodb_rollback_on_timeout OFF
create table t1 (a int unsigned not null primary key) engine = innodb;
insert into t1 values (1);
commit;
begin work;
insert into t1 values (2);
select * from t1;
a
1
2
begin work;
insert into t1 values (5);
select * from t1;
a
1
5
insert into t1 values (2);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t1;
a
1
5
commit;
select * from t1;
a
1
2
commit;
select * from t1;
a
1
2
5
drop table t1;
End of 5.0 tests End of 5.0 tests

View File

@ -0,0 +1,35 @@
show variables like 'innodb_rollback_on_timeout';
Variable_name Value
innodb_rollback_on_timeout ON
create table t1 (a int unsigned not null primary key) engine = innodb;
insert into t1 values (1);
commit;
begin work;
insert into t1 values (2);
select * from t1;
a
1
2
begin work;
insert into t1 values (5);
select * from t1;
a
1
5
insert into t1 values (2);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
select * from t1;
a
1
commit;
select * from t1;
a
1
2
commit;
select * from t1;
a
1
2
drop table t1;
End of 5.0 tests

View File

@ -0,0 +1 @@
foo

View File

@ -10,6 +10,7 @@
# #
############################################################################## ##############################################################################
im_daemon_life_cycle : Bug#24415 see note: [19 Dec 23:17] Trudy Pelzer
ndb_load : Bug#17233 ndb_load : Bug#17233
user_limits : Bug#23921 random failure of user_limits.test user_limits : Bug#23921 random failure of user_limits.test
flush2 : Bug#24805 Pushbuild can't handle test with --disable-log-bin flush2 : Bug#24805 Pushbuild can't handle test with --disable-log-bin

View File

@ -991,5 +991,13 @@ SELECT CHAR(0xff,0x8f USING utf8) IS NULL;
SET SQL_MODE=@orig_sql_mode; SET SQL_MODE=@orig_sql_mode;
#
# Bug #24947: problem with some string function with unsigned int parameters
#
select substring('abc', cast(2 as unsigned int));
select repeat('a', cast(2 as unsigned int));
select rpad('abc', cast(5 as unsigned integer), 'x');
select lpad('abc', cast(5 as unsigned integer), 'x');
--echo End of 5.0 tests --echo End of 5.0 tests

View File

@ -375,6 +375,20 @@ drop table t1;
select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000)))); select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000))));
select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))); select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440))));
--enable_metadata
create table t1 (g GEOMETRY);
select * from t1;
select asbinary(g) from t1;
--disable_metadata
drop table t1;
create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b));
alter table t1 disable keys;
--error 1263
load data infile '../std_data_ln/bad_gis_data.dat' into table t1;
alter table t1 enable keys;
drop table t1;
# End of 4.1 tests # End of 4.1 tests
# #
@ -410,15 +424,7 @@ alter table t1 add primary key pti(pt);
alter table t1 add primary key pti(pt(20)); alter table t1 add primary key pti(pt(20));
drop table t1; drop table t1;
--enable_metadata
create table t1 (g GEOMETRY);
select * from t1;
select asbinary(g) from t1;
--disable_metadata
drop table t1;
create table t1 select GeomFromText('point(1 1)'); create table t1 select GeomFromText('point(1 1)');
desc t1; desc t1;
drop table t1; drop table t1;

View File

@ -0,0 +1 @@
--innodb-lock-wait-timeout=2

View File

@ -384,4 +384,6 @@ EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b;
DROP TABLE t1; DROP TABLE t1;
--source include/innodb_rollback_on_timeout.inc
--echo End of 5.0 tests --echo End of 5.0 tests

View File

@ -0,0 +1 @@
--innodb_lock_wait_timeout=2 --innodb_rollback_on_timeout

View File

@ -0,0 +1,5 @@
-- source include/have_innodb.inc
--source include/innodb_rollback_on_timeout.inc
--echo End of 5.0 tests

View File

@ -115,6 +115,7 @@ SUFFIXES = .sh
-e 's!@''pkglibdir''@!$(pkglibdir)!g' \ -e 's!@''pkglibdir''@!$(pkglibdir)!g' \
-e 's!@''pkgincludedir''@!$(pkgincludedir)!g' \ -e 's!@''pkgincludedir''@!$(pkgincludedir)!g' \
-e 's!@''pkgdatadir''@!$(pkgdatadir)!g' \ -e 's!@''pkgdatadir''@!$(pkgdatadir)!g' \
-e 's!@''sysconfdir''@!$(sysconfdir)!g' \
-e 's!@''CC''@!@CC@!'\ -e 's!@''CC''@!@CC@!'\
-e 's!@''CXX''@!@CXX@!'\ -e 's!@''CXX''@!@CXX@!'\
-e 's!@''GXX''@!@GXX@!'\ -e 's!@''GXX''@!@GXX@!'\

View File

@ -243,6 +243,7 @@ $CP mysql-test/include/*.inc $BASE/mysql-test/include
$CP mysql-test/include/*.test $BASE/mysql-test/include $CP mysql-test/include/*.test $BASE/mysql-test/include
$CP mysql-test/t/*.def $BASE/mysql-test/t $CP mysql-test/t/*.def $BASE/mysql-test/t
$CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \ $CP mysql-test/std_data/*.dat mysql-test/std_data/*.frm \
mysql-test/std_data/*.MYD mysql-test/std_data/*.MYI \
mysql-test/std_data/*.pem mysql-test/std_data/Moscow_leap \ mysql-test/std_data/*.pem mysql-test/std_data/Moscow_leap \
mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \ mysql-test/std_data/des_key_file mysql-test/std_data/*.*001 \
mysql-test/std_data/*.cnf mysql-test/std_data/*.MY* \ mysql-test/std_data/*.cnf mysql-test/std_data/*.MY* \

View File

@ -462,8 +462,8 @@ MySQLaccess::Report::Print_Header();
if (-f "./$script_conf") { if (-f "./$script_conf") {
require "./$script_conf"; require "./$script_conf";
} }
elsif (-f "/etc/$script_conf") { elsif (-f "@sysconfdir@/$script_conf") {
require "/etc/$script_conf"; require "@sysconfdir@/$script_conf";
} }
# **************************** # ****************************
@ -929,7 +929,7 @@ sub MergeConfigFile {
# ================================= # =================================
sub MergeConfigFiles { sub MergeConfigFiles {
my ($name,$pass,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = getpwuid $<; my ($name,$pass,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = getpwuid $<;
MergeConfigFile("/etc/my.cnf"); MergeConfigFile("@sysconfdir@/my.cnf");
MergeConfigFile("$dir/.my.cnf"); MergeConfigFile("$dir/.my.cnf");
} }

View File

@ -464,9 +464,9 @@ sub find_groups
} }
else else
{ {
if (-f "/etc/my.cnf" && -r "/etc/my.cnf") if (-f "@sysconfdir@/my.cnf" && -r "@sysconfdir@/my.cnf")
{ {
open(MY_CNF, "</etc/my.cnf") && (@tmp=<MY_CNF>) && close(MY_CNF); open(MY_CNF, "<@sysconfdir@/my.cnf") && (@tmp=<MY_CNF>) && close(MY_CNF);
} }
for ($i = 0; ($line = shift @tmp); $i++) for ($i = 0; ($line = shift @tmp); $i++)
{ {
@ -719,7 +719,7 @@ sub example
# (as per Linux/Unix standard). You may even replace the # (as per Linux/Unix standard). You may even replace the
# /etc/init.d/mysql.server script with it. # /etc/init.d/mysql.server script with it.
# #
# Before using, you must create a my.cnf file either in /etc/my.cnf # Before using, you must create a my.cnf file either in @sysconfdir@/my.cnf
# or /root/.my.cnf and add the [mysqld_multi] and [mysqld#] groups. # or /root/.my.cnf and add the [mysqld_multi] and [mysqld#] groups.
# #
# The script can be found from support-files/mysqld_multi.server.sh # The script can be found from support-files/mysqld_multi.server.sh

View File

@ -1569,10 +1569,11 @@ void Field_null::sql_type(String &res) const
This is an number stored as a pre-space (or pre-zero) string This is an number stored as a pre-space (or pre-zero) string
****************************************************************************/ ****************************************************************************/
void int
Field_decimal::reset(void) Field_decimal::reset(void)
{ {
Field_decimal::store(STRING_WITH_LEN("0"),&my_charset_bin); Field_decimal::store(STRING_WITH_LEN("0"),&my_charset_bin);
return 0;
} }
void Field_decimal::overflow(bool negative) void Field_decimal::overflow(bool negative)
@ -2217,9 +2218,10 @@ Field_new_decimal::Field_new_decimal(uint32 len_arg,
} }
void Field_new_decimal::reset(void) int Field_new_decimal::reset(void)
{ {
store_value(&decimal_zero); store_value(&decimal_zero);
return 0;
} }

View File

@ -150,7 +150,7 @@ public:
*/ */
virtual uint32 data_length(const char *from) { return pack_length(); } virtual uint32 data_length(const char *from) { return pack_length(); }
virtual uint32 sort_length() const { return pack_length(); } virtual uint32 sort_length() const { return pack_length(); }
virtual void reset(void) { bzero(ptr,pack_length()); } virtual int reset(void) { bzero(ptr,pack_length()); return 0; }
virtual void reset_fields() {} virtual void reset_fields() {}
virtual void set_default() virtual void set_default()
{ {
@ -450,7 +450,7 @@ public:
enum_field_types type() const { return FIELD_TYPE_DECIMAL;} enum_field_types type() const { return FIELD_TYPE_DECIMAL;}
enum ha_base_keytype key_type() const enum ha_base_keytype key_type() const
{ return zerofill ? HA_KEYTYPE_BINARY : HA_KEYTYPE_NUM; } { return zerofill ? HA_KEYTYPE_BINARY : HA_KEYTYPE_NUM; }
void reset(void); int reset(void);
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
@ -490,7 +490,7 @@ public:
enum_field_types type() const { return FIELD_TYPE_NEWDECIMAL;} enum_field_types type() const { return FIELD_TYPE_NEWDECIMAL;}
enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; } enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
Item_result result_type () const { return DECIMAL_RESULT; } Item_result result_type () const { return DECIMAL_RESULT; }
void reset(void); int reset(void);
bool store_value(const my_decimal *decimal_value); bool store_value(const my_decimal *decimal_value);
void set_value_on_overflow(my_decimal *decimal_value, bool sign); void set_value_on_overflow(my_decimal *decimal_value, bool sign);
int store(const char *to, uint length, CHARSET_INFO *charset); int store(const char *to, uint length, CHARSET_INFO *charset);
@ -530,7 +530,7 @@ public:
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
void reset(void) { ptr[0]=0; } int reset(void) { ptr[0]=0; return 0; }
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
String *val_str(String*,String *); String *val_str(String*,String *);
@ -566,7 +566,7 @@ public:
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
void reset(void) { ptr[0]=ptr[1]=0; } int reset(void) { ptr[0]=ptr[1]=0; return 0; }
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
String *val_str(String*,String *); String *val_str(String*,String *);
@ -597,7 +597,7 @@ public:
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
void reset(void) { ptr[0]=ptr[1]=ptr[2]=0; } int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
String *val_str(String*,String *); String *val_str(String*,String *);
@ -633,7 +633,7 @@ public:
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; } int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
bool send_binary(Protocol *protocol); bool send_binary(Protocol *protocol);
@ -671,7 +671,11 @@ public:
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0; } int reset(void)
{
ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0;
return 0;
}
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
String *val_str(String*,String *); String *val_str(String*,String *);
@ -707,7 +711,7 @@ public:
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
void reset(void) { bzero(ptr,sizeof(float)); } int reset(void) { bzero(ptr,sizeof(float)); return 0; }
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
String *val_str(String*,String *); String *val_str(String*,String *);
@ -741,7 +745,7 @@ public:
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
void reset(void) { bzero(ptr,sizeof(double)); } int reset(void) { bzero(ptr,sizeof(double)); return 0; }
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
String *val_str(String*,String *); String *val_str(String*,String *);
@ -771,7 +775,7 @@ public:
int store(double nr) { null[0]=1; return 0; } int store(double nr) { null[0]=1; return 0; }
int store(longlong nr, bool unsigned_val) { null[0]=1; return 0; } int store(longlong nr, bool unsigned_val) { null[0]=1; return 0; }
int store_decimal(const my_decimal *d) { null[0]=1; return 0; } int store_decimal(const my_decimal *d) { null[0]=1; return 0; }
void reset(void) {} int reset(void) { return 0; }
double val_real(void) { return 0.0;} double val_real(void) { return 0.0;}
longlong val_int(void) { return 0;} longlong val_int(void) { return 0;}
my_decimal *val_decimal(my_decimal *) { return 0; } my_decimal *val_decimal(my_decimal *) { return 0; }
@ -801,7 +805,7 @@ public:
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; } int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
String *val_str(String*,String *); String *val_str(String*,String *);
@ -880,7 +884,7 @@ public:
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; } int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
String *val_str(String*,String *); String *val_str(String*,String *);
@ -909,7 +913,7 @@ public:
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
int store_time(TIME *ltime, timestamp_type type); int store_time(TIME *ltime, timestamp_type type);
void reset(void) { ptr[0]=ptr[1]=ptr[2]=0; } int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
String *val_str(String*,String *); String *val_str(String*,String *);
@ -944,7 +948,7 @@ public:
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
void reset(void) { ptr[0]=ptr[1]=ptr[2]=0; } int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
String *val_str(String*,String *); String *val_str(String*,String *);
@ -982,7 +986,11 @@ public:
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
int store_time(TIME *ltime, timestamp_type type); int store_time(TIME *ltime, timestamp_type type);
void reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0; } int reset(void)
{
ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0;
return 0;
}
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
String *val_str(String*,String *); String *val_str(String*,String *);
@ -1025,7 +1033,11 @@ public:
enum ha_base_keytype key_type() const enum ha_base_keytype key_type() const
{ return binary() ? HA_KEYTYPE_BINARY : HA_KEYTYPE_TEXT; } { return binary() ? HA_KEYTYPE_BINARY : HA_KEYTYPE_TEXT; }
bool zero_pack() const { return 0; } bool zero_pack() const { return 0; }
void reset(void) { charset()->cset->fill(charset(),ptr,field_length,' '); } int reset(void)
{
charset()->cset->fill(charset(),ptr,field_length,' ');
return 0;
}
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
int store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */ int store(double nr) { return Field_str::store(nr); } /* QQ: To be deleted */
@ -1082,7 +1094,7 @@ public:
enum_field_types type() const { return MYSQL_TYPE_VARCHAR; } enum_field_types type() const { return MYSQL_TYPE_VARCHAR; }
enum ha_base_keytype key_type() const; enum ha_base_keytype key_type() const;
bool zero_pack() const { return 0; } bool zero_pack() const { return 0; }
void reset(void) { bzero(ptr,field_length+length_bytes); } int reset(void) { bzero(ptr,field_length+length_bytes); return 0; }
uint32 pack_length() const { return (uint32) field_length+length_bytes; } uint32 pack_length() const { return (uint32) field_length+length_bytes; }
uint32 key_length() const { return (uint32) field_length; } uint32 key_length() const { return (uint32) field_length; }
uint32 sort_length() const uint32 sort_length() const
@ -1183,7 +1195,7 @@ public:
{ {
return (uint32) (((ulonglong) 1 << (packlength*8)) -1); return (uint32) (((ulonglong) 1 << (packlength*8)) -1);
} }
void reset(void) { bzero(ptr, packlength+sizeof(char*)); } int reset(void) { bzero(ptr, packlength+sizeof(char*)); return 0; }
void reset_fields() { bzero((char*) &value,sizeof(value)); } void reset_fields() { bzero((char*) &value,sizeof(value)); }
void store_length(uint32 number); void store_length(uint32 number);
inline uint32 get_length(uint row_offset=0) inline uint32 get_length(uint row_offset=0)
@ -1264,6 +1276,7 @@ public:
int store_decimal(const my_decimal *); int store_decimal(const my_decimal *);
void get_key_image(char *buff,uint length,imagetype type); void get_key_image(char *buff,uint length,imagetype type);
uint size_of() const { return sizeof(*this); } uint size_of() const { return sizeof(*this); }
int reset(void) { return !maybe_null(); }
}; };
#endif /*HAVE_SPATIAL*/ #endif /*HAVE_SPATIAL*/
@ -1293,7 +1306,7 @@ public:
int store(const char *to,uint length,CHARSET_INFO *charset); int store(const char *to,uint length,CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);
void reset() { bzero(ptr,packlength); } int reset() { bzero(ptr,packlength); return 0; }
double val_real(void); double val_real(void);
longlong val_int(void); longlong val_int(void);
String *val_str(String*,String *); String *val_str(String*,String *);
@ -1354,7 +1367,7 @@ public:
uint32 max_length() { return field_length; } uint32 max_length() { return field_length; }
uint size_of() const { return sizeof(*this); } uint size_of() const { return sizeof(*this); }
Item_result result_type () const { return INT_RESULT; } Item_result result_type () const { return INT_RESULT; }
void reset(void) { bzero(ptr, bytes_in_rec); } int reset(void) { bzero(ptr, bytes_in_rec); return 0; }
int store(const char *to, uint length, CHARSET_INFO *charset); int store(const char *to, uint length, CHARSET_INFO *charset);
int store(double nr); int store(double nr);
int store(longlong nr, bool unsigned_val); int store(longlong nr, bool unsigned_val);

View File

@ -173,6 +173,7 @@ my_bool innobase_use_large_pages = FALSE;
my_bool innobase_use_native_aio = FALSE; my_bool innobase_use_native_aio = FALSE;
my_bool innobase_file_per_table = FALSE; my_bool innobase_file_per_table = FALSE;
my_bool innobase_locks_unsafe_for_binlog = FALSE; my_bool innobase_locks_unsafe_for_binlog = FALSE;
my_bool innobase_rollback_on_timeout = FALSE;
my_bool innobase_create_status_file = FALSE; my_bool innobase_create_status_file = FALSE;
static char *internal_innobase_data_file_path = NULL; static char *internal_innobase_data_file_path = NULL;
@ -467,6 +468,10 @@ convert_error_code_to_mysql(
latest SQL statement in a lock wait timeout. Previously, we latest SQL statement in a lock wait timeout. Previously, we
rolled back the whole transaction. */ rolled back the whole transaction. */
if (thd && row_rollback_on_timeout) {
ha_rollback(thd);
}
return(HA_ERR_LOCK_WAIT_TIMEOUT); return(HA_ERR_LOCK_WAIT_TIMEOUT);
} else if (error == (int) DB_NO_REFERENCED_ROW) { } else if (error == (int) DB_NO_REFERENCED_ROW) {
@ -1380,6 +1385,8 @@ innobase_init(void)
os_use_large_pages = (ibool) innobase_use_large_pages; os_use_large_pages = (ibool) innobase_use_large_pages;
os_large_page_size = (ulint) innobase_large_page_size; os_large_page_size = (ulint) innobase_large_page_size;
row_rollback_on_timeout = (ibool) innobase_rollback_on_timeout;
srv_file_per_table = (ibool) innobase_file_per_table; srv_file_per_table = (ibool) innobase_file_per_table;
srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog; srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog;
@ -5308,19 +5315,11 @@ ha_innobase::info(
prebuilt->trx->op_info = (char*) prebuilt->trx->op_info = (char*)
"returning various info to MySQL"; "returning various info to MySQL";
if (ib_table->space != 0) {
my_snprintf(path, sizeof(path), "%s/%s%s",
mysql_data_home, ib_table->name,
".ibd");
unpack_filename(path,path);
} else {
my_snprintf(path, sizeof(path), "%s/%s%s", my_snprintf(path, sizeof(path), "%s/%s%s",
mysql_data_home, ib_table->name, mysql_data_home, ib_table->name,
reg_ext); reg_ext);
unpack_filename(path,path); unpack_filename(path,path);
}
/* Note that we do not know the access time of the table, /* Note that we do not know the access time of the table,
nor the CHECK TABLE time, nor the UPDATE or INSERT time. */ nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
@ -6377,14 +6376,17 @@ innodb_mutex_show_status(
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
List<Item> field_list; List<Item> field_list;
mutex_t* mutex; mutex_t* mutex;
#ifdef UNIV_DEBUG
ulint rw_lock_count= 0; ulint rw_lock_count= 0;
ulint rw_lock_count_spin_loop= 0; ulint rw_lock_count_spin_loop= 0;
ulint rw_lock_count_spin_rounds= 0; ulint rw_lock_count_spin_rounds= 0;
ulint rw_lock_count_os_wait= 0; ulint rw_lock_count_os_wait= 0;
ulint rw_lock_count_os_yield= 0; ulint rw_lock_count_os_yield= 0;
ulonglong rw_lock_wait_time= 0; ulonglong rw_lock_wait_time= 0;
#endif /* UNIV_DEBUG */
DBUG_ENTER("innodb_mutex_show_status"); DBUG_ENTER("innodb_mutex_show_status");
#ifdef UNIV_DEBUG
field_list.push_back(new Item_empty_string("Mutex", FN_REFLEN)); field_list.push_back(new Item_empty_string("Mutex", FN_REFLEN));
field_list.push_back(new Item_empty_string("Module", FN_REFLEN)); field_list.push_back(new Item_empty_string("Module", FN_REFLEN));
field_list.push_back(new Item_uint("Count", 21)); field_list.push_back(new Item_uint("Count", 21));
@ -6393,19 +6395,23 @@ innodb_mutex_show_status(
field_list.push_back(new Item_uint("OS_waits", 21)); field_list.push_back(new Item_uint("OS_waits", 21));
field_list.push_back(new Item_uint("OS_yields", 21)); field_list.push_back(new Item_uint("OS_yields", 21));
field_list.push_back(new Item_uint("OS_waits_time", 21)); field_list.push_back(new Item_uint("OS_waits_time", 21));
#else /* UNIV_DEBUG */
field_list.push_back(new Item_empty_string("File", FN_REFLEN));
field_list.push_back(new Item_uint("Line", 21));
field_list.push_back(new Item_uint("OS_waits", 21));
#endif /* UNIV_DEBUG */
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
#ifdef MUTEX_PROTECT_TO_BE_ADDED_LATER mutex_enter_noninline(&mutex_list_mutex);
mutex_enter(&mutex_list_mutex);
#endif
mutex = UT_LIST_GET_FIRST(mutex_list); mutex = UT_LIST_GET_FIRST(mutex_list);
while ( mutex != NULL ) while ( mutex != NULL )
{ {
#ifdef UNIV_DEBUG
if (mutex->mutex_type != 1) if (mutex->mutex_type != 1)
{ {
if (mutex->count_using > 0) if (mutex->count_using > 0)
@ -6422,9 +6428,7 @@ innodb_mutex_show_status(
if (protocol->write()) if (protocol->write())
{ {
#ifdef MUTEX_PROTECT_TO_BE_ADDED_LATER mutex_exit_noninline(&mutex_list_mutex);
mutex_exit(&mutex_list_mutex);
#endif
DBUG_RETURN(1); DBUG_RETURN(1);
} }
} }
@ -6438,10 +6442,25 @@ innodb_mutex_show_status(
rw_lock_count_os_yield += mutex->count_os_yield; rw_lock_count_os_yield += mutex->count_os_yield;
rw_lock_wait_time += mutex->lspent_time; rw_lock_wait_time += mutex->lspent_time;
} }
#else /* UNIV_DEBUG */
protocol->prepare_for_resend();
protocol->store(mutex->cfile_name, system_charset_info);
protocol->store((ulonglong)mutex->cline);
protocol->store((ulonglong)mutex->count_os_wait);
if (protocol->write())
{
mutex_exit_noninline(&mutex_list_mutex);
DBUG_RETURN(1);
}
#endif /* UNIV_DEBUG */
mutex = UT_LIST_GET_NEXT(list, mutex); mutex = UT_LIST_GET_NEXT(list, mutex);
} }
mutex_exit_noninline(&mutex_list_mutex);
#ifdef UNIV_DEBUG
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store("rw_lock_mutexes", system_charset_info); protocol->store("rw_lock_mutexes", system_charset_info);
protocol->store("", system_charset_info); protocol->store("", system_charset_info);
@ -6456,10 +6475,8 @@ innodb_mutex_show_status(
{ {
DBUG_RETURN(1); DBUG_RETURN(1);
} }
#endif /* UNIV_DEBUG */
#ifdef MUTEX_PROTECT_TO_BE_ADDED_LATER
mutex_exit(&mutex_list_mutex);
#endif
send_eof(thd); send_eof(thd);
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
} }

View File

@ -216,6 +216,7 @@ extern my_bool innobase_log_archive,
innobase_use_large_pages, innobase_use_large_pages,
innobase_use_native_aio, innobase_use_native_aio,
innobase_file_per_table, innobase_locks_unsafe_for_binlog, innobase_file_per_table, innobase_locks_unsafe_for_binlog,
innobase_rollback_on_timeout,
innobase_create_status_file; innobase_create_status_file;
extern my_bool innobase_very_fast_shutdown; /* set this to 1 just before extern my_bool innobase_very_fast_shutdown; /* set this to 1 just before
calling innobase_end() if you want calling innobase_end() if you want

View File

@ -1166,7 +1166,8 @@ String *Item_func_substr::val_str(String *str)
/* if "unsigned_flag" is set, we have a *huge* positive number. */ /* if "unsigned_flag" is set, we have a *huge* positive number. */
/* Assumes that the maximum length of a String is < INT_MAX32. */ /* Assumes that the maximum length of a String is < INT_MAX32. */
if ((args[1]->unsigned_flag) || (start < INT_MIN32) || (start > INT_MAX32)) if ((!args[1]->unsigned_flag && (start < INT_MIN32 || start > INT_MAX32)) ||
(args[1]->unsigned_flag && ((ulonglong) start > INT_MAX32)))
return &my_empty_string; return &my_empty_string;
start= ((start < 0) ? res->numchars() + start : start - 1); start= ((start < 0) ? res->numchars() + start : start - 1);
@ -2227,25 +2228,23 @@ String *Item_func_repeat::val_str(String *str)
uint length,tot_length; uint length,tot_length;
char *to; char *to;
/* must be longlong to avoid truncation */ /* must be longlong to avoid truncation */
longlong tmp_count= args[1]->val_int(); longlong count= args[1]->val_int();
long count= (long) tmp_count;
String *res= args[0]->val_str(str); String *res= args[0]->val_str(str);
/* Assumes that the maximum length of a String is < INT_MAX32. */
/* Bounds check on count: If this is triggered, we will error. */
if ((tmp_count > INT_MAX32) || args[1]->unsigned_flag)
count= INT_MAX32;
if (args[0]->null_value || args[1]->null_value) if (args[0]->null_value || args[1]->null_value)
goto err; // string and/or delim are null goto err; // string and/or delim are null
null_value= 0; null_value= 0;
if ((tmp_count <= 0) && !args[1]->unsigned_flag) // For nicer SQL code if ((count <= 0) && !args[1]->unsigned_flag) // For nicer SQL code
return &my_empty_string; return &my_empty_string;
/* Assumes that the maximum length of a String is < INT_MAX32. */
/* Bounds check on count: If this is triggered, we will error. */
if ((ulonglong) count > INT_MAX32)
count= INT_MAX32;
if (count == 1) // To avoid reallocs if (count == 1) // To avoid reallocs
return res; return res;
length=res->length(); length=res->length();
// Safe length check // Safe length check
if (length > current_thd->variables.max_allowed_packet/count) if (length > current_thd->variables.max_allowed_packet / (uint) count)
{ {
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_ALLOWED_PACKET_OVERFLOWED, ER_WARN_ALLOWED_PACKET_OVERFLOWED,
@ -2319,15 +2318,14 @@ String *Item_func_rpad::val_str(String *str)
String *res= args[0]->val_str(str); String *res= args[0]->val_str(str);
String *rpad= args[2]->val_str(&rpad_str); String *rpad= args[2]->val_str(&rpad_str);
/* Assumes that the maximum length of a String is < INT_MAX32. */ if (!res || args[1]->null_value || !rpad ||
/* Set here so that rest of code sees out-of-bound value as such. */ ((count < 0) && !args[1]->unsigned_flag))
if ((count > INT_MAX32) || args[1]->unsigned_flag)
count= INT_MAX32;
if (!res || args[1]->null_value || !rpad || count < 0)
goto err; goto err;
null_value=0; null_value=0;
/* Assumes that the maximum length of a String is < INT_MAX32. */
/* Set here so that rest of code sees out-of-bound value as such. */
if ((ulonglong) count > INT_MAX32)
count= INT_MAX32;
if (count <= (res_char_length= res->numchars())) if (count <= (res_char_length= res->numchars()))
{ // String to pad is big enough { // String to pad is big enough
res->length(res->charpos((int) count)); // Shorten result if longer res->length(res->charpos((int) count)); // Shorten result if longer
@ -2421,14 +2419,15 @@ String *Item_func_lpad::val_str(String *str)
String *res= args[0]->val_str(&tmp_value); String *res= args[0]->val_str(&tmp_value);
String *pad= args[2]->val_str(&lpad_str); String *pad= args[2]->val_str(&lpad_str);
/* Assumes that the maximum length of a String is < INT_MAX32. */ if (!res || args[1]->null_value || !pad ||
/* Set here so that rest of code sees out-of-bound value as such. */ ((count < 0) && !args[1]->unsigned_flag))
if ((count > INT_MAX32) || args[1]->unsigned_flag)
count= INT_MAX32;
if (!res || args[1]->null_value || !pad || count < 0)
goto err; goto err;
null_value=0; null_value=0;
/* Assumes that the maximum length of a String is < INT_MAX32. */
/* Set here so that rest of code sees out-of-bound value as such. */
if ((ulonglong) count > INT_MAX32)
count= INT_MAX32;
res_char_length= res->numchars(); res_char_length= res->numchars();
if (count <= res_char_length) if (count <= res_char_length)

View File

@ -4692,7 +4692,8 @@ enum options_mysqld
OPT_LOG_SLOW_ADMIN_STATEMENTS, OPT_LOG_SLOW_ADMIN_STATEMENTS,
OPT_TABLE_LOCK_WAIT_TIMEOUT, OPT_TABLE_LOCK_WAIT_TIMEOUT,
OPT_PORT_OPEN_TIMEOUT, OPT_PORT_OPEN_TIMEOUT,
OPT_MERGE OPT_MERGE,
OPT_INNODB_ROLLBACK_ON_TIMEOUT
}; };
@ -4968,6 +4969,10 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
(gptr*) &srv_max_purge_lag, (gptr*) &srv_max_purge_lag,
(gptr*) &srv_max_purge_lag, 0, GET_LONG, REQUIRED_ARG, 0, 0, ~0L, (gptr*) &srv_max_purge_lag, 0, GET_LONG, REQUIRED_ARG, 0, 0, ~0L,
0, 1L, 0}, 0, 1L, 0},
{"innodb_rollback_on_timeout", OPT_INNODB_ROLLBACK_ON_TIMEOUT,
"Roll back the complete transaction on lock wait timeout, for 4.x compatibility (disabled by default)",
(gptr*) &innobase_rollback_on_timeout, (gptr*) &innobase_rollback_on_timeout,
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_status_file", OPT_INNODB_STATUS_FILE, {"innodb_status_file", OPT_INNODB_STATUS_FILE,
"Enable SHOW INNODB STATUS output in the innodb_status.<pid> file", "Enable SHOW INNODB STATUS output in the innodb_status.<pid> file",
(gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file,

View File

@ -904,6 +904,7 @@ struct show_var_st init_vars[]= {
{sys_innodb_max_purge_lag.name, (char*) &sys_innodb_max_purge_lag, SHOW_SYS}, {sys_innodb_max_purge_lag.name, (char*) &sys_innodb_max_purge_lag, SHOW_SYS},
{"innodb_mirrored_log_groups", (char*) &innobase_mirrored_log_groups, SHOW_LONG}, {"innodb_mirrored_log_groups", (char*) &innobase_mirrored_log_groups, SHOW_LONG},
{"innodb_open_files", (char*) &innobase_open_files, SHOW_LONG }, {"innodb_open_files", (char*) &innobase_open_files, SHOW_LONG },
{"innodb_rollback_on_timeout", (char*) &innobase_rollback_on_timeout, SHOW_MY_BOOL},
{sys_innodb_support_xa.name, (char*) &sys_innodb_support_xa, SHOW_SYS}, {sys_innodb_support_xa.name, (char*) &sys_innodb_support_xa, SHOW_SYS},
{sys_innodb_sync_spin_loops.name, (char*) &sys_innodb_sync_spin_loops, SHOW_SYS}, {sys_innodb_sync_spin_loops.name, (char*) &sys_innodb_sync_spin_loops, SHOW_SYS},
{sys_innodb_table_locks.name, (char*) &sys_innodb_table_locks, SHOW_SYS}, {sys_innodb_table_locks.name, (char*) &sys_innodb_table_locks, SHOW_SYS},

View File

@ -696,7 +696,12 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
if (item->type() == Item::FIELD_ITEM) if (item->type() == Item::FIELD_ITEM)
{ {
Field *field= ((Item_field *)item)->field; Field *field= ((Item_field *)item)->field;
field->reset(); if (field->reset())
{
my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0), field->field_name,
thd->row_count);
DBUG_RETURN(1);
}
field->set_null(); field->set_null();
if (field == table->next_number_field) if (field == table->next_number_field)
table->auto_increment_field_not_null= TRUE; table->auto_increment_field_not_null= TRUE;
@ -745,6 +750,13 @@ read_sep_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
{ {
if (item->type() == Item::FIELD_ITEM) if (item->type() == Item::FIELD_ITEM)
{ {
Field *field= ((Item_field *)item)->field;
if (field->reset())
{
my_error(ER_WARN_NULL_TO_NOTNULL, MYF(0),field->field_name,
thd->row_count);
DBUG_RETURN(1);
}
/* /*
QQ: We probably should not throw warning for each field. QQ: We probably should not throw warning for each field.
But how about intention to always have the same number But how about intention to always have the same number

View File

@ -1087,7 +1087,7 @@ my_bool is_const_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
strmov(message, "IS_CONST accepts only one argument"); strmov(message, "IS_CONST accepts only one argument");
return 1; return 1;
} }
initid->ptr= (char*)((args->args[0] != NULL) ? 1 : 0); initid->ptr= (char*)((args->args[0] != NULL) ? 1UL : 0);
return 0; return 0;
} }

View File

@ -138,6 +138,12 @@ static const dec1 frac_max[DIG_PER_DEC1-1]={
900000000, 990000000, 999000000, 900000000, 990000000, 999000000,
999900000, 999990000, 999999000, 999900000, 999990000, 999999000,
999999900, 999999990 }; 999999900, 999999990 };
static double scaler10[]= {
1.0, 1e10, 1e20, 1e30, 1e40, 1e50, 1e60, 1e70, 1e80, 1e90
};
static double scaler1[]= {
1.0, 10.0, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9
};
#ifdef HAVE_purify #ifdef HAVE_purify
#define sanity(d) DBUG_ASSERT((d)->len > 0) #define sanity(d) DBUG_ASSERT((d)->len > 0)
@ -946,15 +952,27 @@ fatal_error:
int decimal2double(decimal_t *from, double *to) int decimal2double(decimal_t *from, double *to)
{ {
double x=0, t=DIG_BASE; double result= 0.0;
int intg, frac; int i, exp= 0;
dec1 *buf=from->buf; dec1 *buf= from->buf;
for (i= from->intg; i > 0; i-= DIG_PER_DEC1)
result= result * DIG_BASE + *buf++;
for (i= from->frac; i > 0; i-= DIG_PER_DEC1) {
result= result * DIG_BASE + *buf++;
exp+= DIG_PER_DEC1;
}
DBUG_PRINT("info", ("interm.: %f %d %f", result, exp,
scaler10[exp / 10] * scaler1[exp % 10]));
result/= scaler10[exp / 10] * scaler1[exp % 10];
*to= from->sign ? -result : result;
DBUG_PRINT("info", ("result: %f (%lx)", *to, *(ulong *)to));
for (intg=from->intg; intg > 0; intg-=DIG_PER_DEC1)
x=x*DIG_BASE + *buf++;
for (frac=from->frac; frac > 0; frac-=DIG_PER_DEC1, t*=DIG_BASE)
x+=*buf++/t;
*to=from->sign ? -x : x;
return E_DEC_OK; return E_DEC_OK;
} }

View File

@ -575,6 +575,7 @@ fi
%doc %attr(644, root, root) %{_infodir}/mysql.info* %doc %attr(644, root, root) %{_infodir}/mysql.info*
%doc %attr(644, root, man) %{_mandir}/man1/my_print_defaults.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisam_ftdump.1* %doc %attr(644, root, man) %{_mandir}/man1/myisam_ftdump.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisamchk.1* %doc %attr(644, root, man) %{_mandir}/man1/myisamchk.1*
%doc %attr(644, root, man) %{_mandir}/man1/myisamlog.1* %doc %attr(644, root, man) %{_mandir}/man1/myisamlog.1*
@ -587,8 +588,9 @@ fi
%doc %attr(644, root, man) %{_mandir}/man1/mysql_upgrade.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_upgrade.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlhotcopy.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqlhotcopy.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlman.1* %doc %attr(644, root, man) %{_mandir}/man1/mysqlman.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysqlmanager.1* %doc %attr(644, root, man) %{_mandir}/man8/mysqlmanager.8*
%doc %attr(644, root, man) %{_mandir}/man1/mysql.server.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql.server.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_tzinfo_to_sql.1*
%doc %attr(644, root, man) %{_mandir}/man1/mysql_zap.1* %doc %attr(644, root, man) %{_mandir}/man1/mysql_zap.1*
%doc %attr(644, root, man) %{_mandir}/man1/perror.1* %doc %attr(644, root, man) %{_mandir}/man1/perror.1*
%doc %attr(644, root, man) %{_mandir}/man1/replace.1* %doc %attr(644, root, man) %{_mandir}/man1/replace.1*
@ -753,6 +755,16 @@ fi
# itself - note that they must be ordered by date (important when # itself - note that they must be ordered by date (important when
# merging BK trees) # merging BK trees)
%changelog %changelog
* Mon Dec 18 2006 Joerg Bruehe <joerg@mysql.com>
- Fix the move of "mysqlmanager" to section 8: Directory name was wrong.
* Thu Dec 14 2006 Joerg Bruehe <joerg@mysql.com>
- Include the new man pages for "my_print_defaults" and "mysql_tzinfo_to_sql"
in the server RPM.
- The "mysqlmanager" man page got moved from section 1 to 8.
* Thu Nov 16 2006 Joerg Bruehe <joerg@mysql.com> * Thu Nov 16 2006 Joerg Bruehe <joerg@mysql.com>
- Explicitly note that the "MySQL-shared" RPMs (as built by MySQL AB) - Explicitly note that the "MySQL-shared" RPMs (as built by MySQL AB)