Merge mysql.com:/home/wax/mysql/mysql-4.1

into mysql.com:/home/wax/mysql/mysql-4.1test2
This commit is contained in:
wax@mysql.com 2005-02-02 19:55:39 +05:00
commit ca2f539273
15 changed files with 139 additions and 35 deletions

View File

@ -1677,8 +1677,8 @@ then
elif test "$with_debug" = "full"
then
# Full debug. Very slow in some cases
CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC -DUNIV_DEBUG $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC -DUNIV_DEBUG $CXXFLAGS"
CFLAGS="$DEBUG_CFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CFLAGS"
CXXFLAGS="$DEBUG_CXXFLAGS -DDBUG_ON -DSAFE_MUTEX -DSAFEMALLOC $CXXFLAGS"
else
# Optimized version. No debug
CFLAGS="$OPTIMIZE_CFLAGS -DDBUG_OFF $CFLAGS"

View File

@ -184,6 +184,7 @@ int main(int argc,char *argv[])
{
int error,code,found;
const char *msg;
char *unknown_error = 0;
MY_INIT(argv[0]);
if (get_options(&argc,&argv))
@ -212,7 +213,12 @@ int main(int argc,char *argv[])
string 'Unknown Error'. To avoid printing it we try to find the
error string by asking for an impossible big error message.
*/
const char *unknown_error= strerror(10000);
msg = strerror(10000);
/* allocate a buffer for unknown_error since strerror always returns the same pointer
on some platforms such as Windows */
unknown_error = malloc( strlen(msg)+1 );
strcpy( unknown_error, msg );
for ( ; argc-- > 0 ; argv++)
{
@ -262,6 +268,11 @@ int main(int argc,char *argv[])
}
}
}
/* if we allocated a buffer for unknown_error, free it now */
if (unknown_error)
free(unknown_error);
exit(error);
return error;
}

View File

@ -679,7 +679,9 @@ buf_read_recv_pages(
fprintf(stderr,
"InnoDB: Error: InnoDB has waited for 50 seconds for pending\n"
"InnoDB: reads to the buffer pool to be finished.\n"
"InnoDB: Number of pending reads %lu\n", (ulong) buf_pool->n_pend_reads);
"InnoDB: Number of pending reads %lu, pending pread calls %lu\n",
(ulong) buf_pool->n_pend_reads,
(ulong)os_file_n_pending_preads);
os_aio_print_debug = TRUE;
}

View File

@ -3002,8 +3002,8 @@ fil_load_single_table_tablespaces(void)
/* printf(
" Looking at file %s\n", fileinfo.name); */
if (fileinfo.type == OS_FILE_TYPE_DIR
|| dbinfo.type == OS_FILE_TYPE_UNKNOWN) {
if (fileinfo.type == OS_FILE_TYPE_DIR) {
goto next_file_item;
}

View File

@ -700,12 +700,12 @@ http://www.mysql.com/doc/en/Windows_symbolic_links.html */
} else if (lpFindFileData->dwFileAttributes
& FILE_ATTRIBUTE_DIRECTORY) {
info->type = OS_FILE_TYPE_DIR;
} else if (lpFindFileData->dwFileAttributes
& FILE_ATTRIBUTE_NORMAL) {
/* TODO: are FILE_ATTRIBUTE_NORMAL files really all normal files? */
info->type = OS_FILE_TYPE_FILE;
} else {
info->type = OS_FILE_TYPE_UNKNOWN;
/* It is probably safest to assume that all other
file types are normal. Better to check them rather
than blindly skip them. */
info->type = OS_FILE_TYPE_FILE;
}
}
@ -823,7 +823,7 @@ os_file_create_directory(
rcode = CreateDirectory(pathname, NULL);
if (!(rcode != 0 ||
(GetLastError() == ERROR_FILE_EXISTS && !fail_if_exists))) {
(GetLastError() == ERROR_ALREADY_EXISTS && !fail_if_exists))) {
/* failure */
os_file_handle_error(pathname, "CreateDirectory");
@ -907,8 +907,9 @@ try_again:
file = CreateFile(name,
access,
FILE_SHARE_READ,/* file can be read also by other
processes */
FILE_SHARE_READ | FILE_SHARE_WRITE,
/* file can be read ansd written also
by other processes */
NULL, /* default security attributes */
create_flag,
attributes,
@ -1013,7 +1014,7 @@ os_file_create_simple_no_error_handling(
DWORD create_flag;
DWORD access;
DWORD attributes = 0;
DWORD share_mode = FILE_SHARE_READ;
DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE;
ut_a(name);
@ -1336,7 +1337,7 @@ loop:
return(TRUE);
}
if (GetLastError() == ERROR_PATH_NOT_FOUND) {
if (GetLastError() == ERROR_FILE_NOT_FOUND) {
/* the file does not exist, this not an error */
return(TRUE);
@ -1397,7 +1398,7 @@ loop:
return(TRUE);
}
if (GetLastError() == ERROR_PATH_NOT_FOUND) {
if (GetLastError() == ERROR_FILE_NOT_FOUND) {
/* If the file does not exist, we classify this as a 'mild'
error and return */

View File

@ -44,13 +44,13 @@ ut_get_high32(
/* out: a >> 32 */
ulint a) /* in: ulint */
{
#if SIZEOF_LONG == 4
UT_NOT_USED(a);
ib_longlong i;
return 0;
#else
return(a >> 32);
#endif
i = (ib_longlong)a;
i = i >> 32;
return((ulint)i);
}
/************************************************************

View File

@ -703,3 +703,26 @@ NULL
select trim('xyz' from null) as "must_be_null";
must_be_null
NULL
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
a bigint(20) unsigned default NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES
('0','16307858876001849059');
SELECT CONV('e251273eb74a8ee3', 16, 10);
CONV('e251273eb74a8ee3', 16, 10)
16307858876001849059
EXPLAIN
SELECT id
FROM t1
WHERE a = 16307858876001849059;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
EXPLAIN
SELECT id
FROM t1
WHERE a = CONV('e251273eb74a8ee3', 16, 10);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
DROP TABLE t1;

View File

@ -443,3 +443,30 @@ select quote(trim(concat(' ', 'a')));
#
select trim(null from 'kate') as "must_be_null";
select trim('xyz' from null) as "must_be_null";
#
# Bug #7751 - conversion for a bigint unsigned constant
#
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
a bigint(20) unsigned default NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM;
INSERT INTO t1 VALUES
('0','16307858876001849059');
SELECT CONV('e251273eb74a8ee3', 16, 10);
EXPLAIN
SELECT id
FROM t1
WHERE a = 16307858876001849059;
EXPLAIN
SELECT id
FROM t1
WHERE a = CONV('e251273eb74a8ee3', 16, 10);
DROP TABLE t1;

View File

@ -3201,7 +3201,7 @@ Backup::execSTART_BACKUP_REQ(Signal* signal)
return;
}//if
tabPtr.p->triggerAllocated[i] = true;
tabPtr.p->triggerAllocated[j] = true;
trigPtr.p->backupPtr = ptr.i;
trigPtr.p->tableId = tabPtr.p->tableId;
trigPtr.p->tab_ptr_i = tabPtr.i;

View File

@ -2171,6 +2171,7 @@ String *Item_func_conv::val_str(String *str)
return 0;
}
null_value=0;
unsigned_flag= !(from_base < 0);
if (from_base < 0)
dec= my_strntoll(res->charset(),res->ptr(),res->length(),-from_base,&endptr,&err);
else

View File

@ -4098,7 +4098,11 @@ enum options_mysqld
OPT_RANGE_ALLOC_BLOCK_SIZE,
OPT_QUERY_ALLOC_BLOCK_SIZE, OPT_QUERY_PREALLOC_SIZE,
OPT_TRANS_ALLOC_BLOCK_SIZE, OPT_TRANS_PREALLOC_SIZE,
OPT_SYNC_FRM, OPT_SYNC_BINLOG, OPT_BDB_NOSYNC,
OPT_SYNC_FRM, OPT_SYNC_BINLOG,
OPT_SYNC_REPLICATION,
OPT_SYNC_REPLICATION_SLAVE_ID,
OPT_SYNC_REPLICATION_TIMEOUT,
OPT_BDB_NOSYNC,
OPT_ENABLE_SHARED_MEMORY,
OPT_SHARED_MEMORY_BASE_NAME,
OPT_OLD_PASSWORDS,
@ -5211,6 +5215,23 @@ The minimum value for this variable is 4096.",
(gptr*) &sync_binlog_period,
(gptr*) &sync_binlog_period, 0, GET_ULONG, REQUIRED_ARG, 0, 0, ~0L, 0, 1,
0},
#ifdef DOES_NOTHING_YET
{"sync-replication", OPT_SYNC_REPLICATION,
"Enable synchronous replication",
(gptr*) &global_system_variables.sync_replication,
(gptr*) &global_system_variables.sync_replication,
0, GET_ULONG, REQUIRED_ARG, 0, 0, 1, 0, 1, 0},
{"sync-replication-slave-id", OPT_SYNC_REPLICATION_SLAVE_ID,
"Synchronous replication is wished for this slave",
(gptr*) &global_system_variables.sync_replication_slave_id,
(gptr*) &global_system_variables.sync_replication_slave_id,
0, GET_ULONG, REQUIRED_ARG, 0, 0, ~0L, 0, 1, 0},
{"sync-replication-timeout", OPT_SYNC_REPLICATION_TIMEOUT,
"Synchronous replication timeout",
(gptr*) &global_system_variables.sync_replication_timeout,
(gptr*) &global_system_variables.sync_replication_timeout,
0, GET_ULONG, REQUIRED_ARG, 10, 0, ~0L, 0, 1, 0},
#endif
{"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default",
(gptr*) &opt_sync_frm, (gptr*) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0,
0, 0, 0, 0},

View File

@ -333,6 +333,14 @@ sys_var_thd_storage_engine sys_storage_engine("storage_engine",
&SV::table_type);
#ifdef HAVE_REPLICATION
sys_var_sync_binlog_period sys_sync_binlog_period("sync_binlog", &sync_binlog_period);
sys_var_thd_ulong sys_sync_replication("sync_replication",
&SV::sync_replication);
sys_var_thd_ulong sys_sync_replication_slave_id(
"sync_replication_slave_id",
&SV::sync_replication_slave_id);
sys_var_thd_ulong sys_sync_replication_timeout(
"sync_replication_timeout",
&SV::sync_replication_timeout);
#endif
sys_var_bool_ptr sys_sync_frm("sync_frm", &opt_sync_frm);
sys_var_long_ptr sys_table_cache_size("table_cache",
@ -605,6 +613,9 @@ sys_var *sys_variables[]=
&sys_storage_engine,
#ifdef HAVE_REPLICATION
&sys_sync_binlog_period,
&sys_sync_replication,
&sys_sync_replication_slave_id,
&sys_sync_replication_timeout,
#endif
&sys_sync_frm,
&sys_table_cache_size,
@ -850,6 +861,9 @@ struct show_var_st init_vars[]= {
{sys_storage_engine.name, (char*) &sys_storage_engine, SHOW_SYS},
#ifdef HAVE_REPLICATION
{sys_sync_binlog_period.name,(char*) &sys_sync_binlog_period, SHOW_SYS},
{sys_sync_replication.name, (char*) &sys_sync_replication, SHOW_SYS},
{sys_sync_replication_slave_id.name, (char*) &sys_sync_replication_slave_id,SHOW_SYS},
{sys_sync_replication_timeout.name, (char*) &sys_sync_replication_timeout,SHOW_SYS},
#endif
{sys_sync_frm.name, (char*) &sys_sync_frm, SHOW_SYS},
#ifdef HAVE_TZNAME

View File

@ -397,6 +397,11 @@ struct system_variables
my_bool low_priority_updates;
my_bool new_mode;
my_bool query_cache_wlock_invalidate;
#ifdef HAVE_REPLICATION
ulong sync_replication;
ulong sync_replication_slave_id;
ulong sync_replication_timeout;
#endif /* HAVE_REPLICATION */
#ifdef HAVE_INNOBASE_DB
my_bool innodb_table_locks;
#endif /* HAVE_INNOBASE_DB */

View File

@ -2272,8 +2272,7 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
strxmov(src_path, (*tmp_table)->path, reg_ext, NullS);
else
{
strxmov(src_path, mysql_data_home, "/", src_db, "/", src_table,
reg_ext, NullS);
fn_format( src_path, src_table, src_db, reg_ext, MYF(MY_UNPACK_FILENAME));
if (access(src_path, F_OK))
{
my_error(ER_BAD_TABLE_ERROR, MYF(0), src_table);
@ -2300,8 +2299,7 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
}
else
{
strxmov(dst_path, mysql_data_home, "/", db, "/", table_name,
reg_ext, NullS);
fn_format( dst_path, table_name, db, reg_ext, MYF(MY_UNPACK_FILENAME));
if (!access(dst_path, F_OK))
goto table_exists;
}

View File

@ -57,11 +57,11 @@ int mysql_update(THD *thd,
enum enum_duplicates handle_duplicates,
bool ignore)
{
bool using_limit=limit != HA_POS_ERROR;
bool using_limit=limit != HA_POS_ERROR;
bool safe_update= thd->options & OPTION_SAFE_UPDATES;
bool used_key_is_modified, transactional_table, log_delayed;
int error=0;
uint used_index= MAX_KEY;
uint used_index;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint want_privilege;
#endif
@ -71,7 +71,7 @@ int mysql_update(THD *thd,
TABLE *table;
SQL_SELECT *select;
READ_RECORD info;
TABLE_LIST *update_table_list= ((TABLE_LIST*)
TABLE_LIST *update_table_list= ((TABLE_LIST*)
thd->lex->select_lex.table_list.first);
DBUG_ENTER("mysql_update");
@ -159,10 +159,11 @@ int mysql_update(THD *thd,
init_ftfuncs(thd, &thd->lex->select_lex, 1);
/* Check if we are modifying a key that we are used to search with */
if (select && select->quick)
{
used_index=select->quick->index;
used_key_is_modified= (!select->quick->unique_key_range() &&
check_if_key_used(table,
(used_index=select->quick->index),
fields));
check_if_key_used(table, used_index, fields));
}
else if ((used_index=table->file->key_used_on_scan) < MAX_KEY)
used_key_is_modified=check_if_key_used(table, used_index, fields);
else