Commit afbda7c1 authored by jcole@tetra.spaceapes.com's avatar jcole@tetra.spaceapes.com

Merge jcole@work.mysql.com:/home/bk/mysql

into tetra.spaceapes.com:/usr/home/jcole/bk/mysql
parents 6cf720e6 c270903a
...@@ -7882,6 +7882,9 @@ able to mix @code{INSERT} and @code{SELECT}. Currently we use mutexes ...@@ -7882,6 +7882,9 @@ able to mix @code{INSERT} and @code{SELECT}. Currently we use mutexes
to emulate @code{pread()}/@code{pwrite()}. We will, in the long run, to emulate @code{pread()}/@code{pwrite()}. We will, in the long run,
replace the file level interface with a virtual interface so that we can replace the file level interface with a virtual interface so that we can
use the @code{readfile()}/@code{writefile()} interface on NT to get more speed. use the @code{readfile()}/@code{writefile()} interface on NT to get more speed.
The current implementation will however limit the number of open files
@strong{MySQL} can use to 1024, which means that you will not be able to
run as many concurrent threads on NT as on Unix.
@item Blocking read @item Blocking read
@strong{MySQL} uses a blocking read for each connection. @strong{MySQL} uses a blocking read for each connection.
...@@ -288,8 +288,7 @@ inline double ulonglong2double(ulonglong value) ...@@ -288,8 +288,7 @@ inline double ulonglong2double(ulonglong value)
#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */ #define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */
#define FN_NO_CASE_SENCE /* Files are not case-sensitive */ #define FN_NO_CASE_SENCE /* Files are not case-sensitive */
#define FN_LOWER_CASE TRUE /* Files are represented in lower case */ #define FN_LOWER_CASE TRUE /* Files are represented in lower case */
#define MY_NFILE 127 /* This is only used to save filenames */ #define MY_NFILE 1024
#define DO_NOT_REMOVE_THREAD_WRAPPERS #define DO_NOT_REMOVE_THREAD_WRAPPERS
#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
......
...@@ -22,7 +22,7 @@ extern "C" { ...@@ -22,7 +22,7 @@ extern "C" {
#endif #endif
#define GLOB 0 /* Error maps */ #define GLOB 0 /* Error maps */
#define GLOBERRS 23 /* Max number of error messages in map's */ #define GLOBERRS 24 /* Max number of error messages in map's */
#define EE(X) globerrs[ X ] /* Defines to add error to right map */ #define EE(X) globerrs[ X ] /* Defines to add error to right map */
extern const char * NEAR globerrs[]; /* my_error_messages is here */ extern const char * NEAR globerrs[]; /* my_error_messages is here */
......
...@@ -36,7 +36,7 @@ int mi_close(register MI_INFO *info) ...@@ -36,7 +36,7 @@ int mi_close(register MI_INFO *info)
if (info->lock_type == F_EXTRA_LCK) if (info->lock_type == F_EXTRA_LCK)
info->lock_type=F_UNLCK; /* HA_EXTRA_NO_USER_CHANGE */ info->lock_type=F_UNLCK; /* HA_EXTRA_NO_USER_CHANGE */
if (share->reopen == 1) if (share->reopen == 1 && share->kfile >= 0)
_mi_decrement_open_count(info); _mi_decrement_open_count(info);
if (info->lock_type != F_UNLCK) if (info->lock_type != F_UNLCK)
......
...@@ -241,6 +241,8 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function) ...@@ -241,6 +241,8 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function)
error=my_errno; error=my_errno;
info->lock_type = F_UNLCK; info->lock_type = F_UNLCK;
} }
if (share->kfile >= 0)
_mi_decrement_open_count(info);
if (share->kfile >= 0 && my_close(share->kfile,MYF(0))) if (share->kfile >= 0 && my_close(share->kfile,MYF(0)))
error=my_errno; error=my_errno;
{ {
......
...@@ -14,7 +14,10 @@ ...@@ -14,7 +14,10 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Logging of isamcommands and records on logfile */ /*
Logging of MyISAM commands and records on logfile for debugging
The log can be examined with help of the myisamlog command.
*/
#include "myisamdef.h" #include "myisamdef.h"
#if defined(MSDOS) || defined(__WIN__) #if defined(MSDOS) || defined(__WIN__)
...@@ -30,14 +33,15 @@ ...@@ -30,14 +33,15 @@
#undef GETPID /* For HPUX */ #undef GETPID /* For HPUX */
#ifdef THREAD #ifdef THREAD
#define GETPID() (log_type == 1 ? getpid() : (long) my_thread_id()); #define GETPID() (log_type == 1 ? myisam_pid : (long) my_thread_id());
#else #else
#define GETPID() getpid() #define GETPID() myisam_pid
#endif #endif
/* Activate logging if flag is 1 and reset logging if flag is 0 */ /* Activate logging if flag is 1 and reset logging if flag is 0 */
static int log_type=0; static int log_type=0;
ulong myisam_pid=0;
int mi_log(int activate_log) int mi_log(int activate_log)
{ {
...@@ -48,6 +52,8 @@ int mi_log(int activate_log) ...@@ -48,6 +52,8 @@ int mi_log(int activate_log)
log_type=activate_log; log_type=activate_log;
if (activate_log) if (activate_log)
{ {
if (!myisam_pid)
myisam_pid=(ulong) getpid();
if (myisam_log_file < 0) if (myisam_log_file < 0)
{ {
if ((myisam_log_file = my_create(fn_format(buff,myisam_log_filename, if ((myisam_log_file = my_create(fn_format(buff,myisam_log_filename,
......
...@@ -384,6 +384,7 @@ extern uchar NEAR myisam_file_magic[],NEAR myisam_pack_file_magic[]; ...@@ -384,6 +384,7 @@ extern uchar NEAR myisam_file_magic[],NEAR myisam_pack_file_magic[];
extern uint NEAR myisam_read_vec[],NEAR myisam_readnext_vec[]; extern uint NEAR myisam_read_vec[],NEAR myisam_readnext_vec[];
extern uint myisam_quick_table_bits; extern uint myisam_quick_table_bits;
extern File myisam_log_file; extern File myisam_log_file;
extern ulong myisam_pid;
/* This is used by _mi_calc_xxx_key_length och _mi_store_key */ /* This is used by _mi_calc_xxx_key_length och _mi_store_key */
......
...@@ -355,7 +355,7 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -355,7 +355,7 @@ static int examine_log(my_string file_name, char **table_names)
} }
command=(uint) head[0]; command=(uint) head[0];
if (command < sizeof(com_count)/sizeof(com_count[0][0])/3 && if (command < sizeof(com_count)/sizeof(com_count[0][0])/3 &&
(!curr_file_info || curr_file_info->used)) (!table_names[0] || (curr_file_info && curr_file_info->used)))
{ {
com_count[command][0]++; com_count[command][0]++;
if (result) if (result)
...@@ -363,9 +363,12 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -363,9 +363,12 @@ static int examine_log(my_string file_name, char **table_names)
} }
switch ((enum myisam_log_commands) command) { switch ((enum myisam_log_commands) command) {
case MI_LOG_OPEN: case MI_LOG_OPEN:
com_count[command][0]--; /* Must be counted explicite */ if (!table_names[0])
if (result) {
com_count[command][1]--; com_count[command][0]--; /* Must be counted explicite */
if (result)
com_count[command][1]--;
}
if (curr_file_info) if (curr_file_info)
printf("\nWarning: %s is opened twice with same process and filenumber\n", printf("\nWarning: %s is opened twice with same process and filenumber\n",
...@@ -502,6 +505,8 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -502,6 +505,8 @@ static int examine_log(my_string file_name, char **table_names)
{ {
if (!recover) if (!recover)
goto com_err; goto com_err;
if (verbose)
printf_log("error: Didn't find row to delete with mi_rrnd");
com_count[command][2]++; /* Mark error */ com_count[command][2]++; /* Mark error */
} }
mi_result=mi_delete(curr_file_info->isam,curr_file_info->record); mi_result=mi_delete(curr_file_info->isam,curr_file_info->record);
...@@ -512,6 +517,9 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -512,6 +517,9 @@ static int examine_log(my_string file_name, char **table_names)
goto com_err; goto com_err;
if (mi_result) if (mi_result)
com_count[command][2]++; /* Mark error */ com_count[command][2]++; /* Mark error */
if (verbose)
printf_log("error: Got result %d from mi_delete instead of %d",
mi_result, result);
} }
} }
break; break;
...@@ -550,6 +558,8 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -550,6 +558,8 @@ static int examine_log(my_string file_name, char **table_names)
result=0; result=0;
goto com_err; goto com_err;
} }
if (verbose)
printf_log("error: Didn't find row to update with mi_rrnd");
if (recover == 1 || result || if (recover == 1 || result ||
find_record_with_key(curr_file_info,buff)) find_record_with_key(curr_file_info,buff))
{ {
...@@ -564,6 +574,9 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -564,6 +574,9 @@ static int examine_log(my_string file_name, char **table_names)
{ {
if (!recover) if (!recover)
goto com_err; goto com_err;
if (verbose)
printf_log("error: Got result %d from mi_update instead of %d",
mi_result, result);
if (mi_result) if (mi_result)
com_count[command][2]++; /* Mark error */ com_count[command][2]++; /* Mark error */
} }
...@@ -576,15 +589,18 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -576,15 +589,18 @@ static int examine_log(my_string file_name, char **table_names)
{ {
if (!recover) if (!recover)
goto com_err; goto com_err;
if (verbose)
printf_log("error: Got result %d from mi_write instead of %d",
mi_result, result);
if (mi_result) if (mi_result)
com_count[command][2]++; /* Mark error */ com_count[command][2]++; /* Mark error */
} }
if (! recover && filepos != curr_file_info->isam->lastpos) if (!recover && filepos != curr_file_info->isam->lastpos)
{ {
printf("Warning: Wrote at position: %s, should have been %s", printf("error: Wrote at position: %s, should have been %s",
llstr(curr_file_info->isam->lastpos,llbuff), llstr(curr_file_info->isam->lastpos,llbuff),
llstr(filepos,llbuff2)); llstr(filepos,llbuff2));
goto com_err; goto end;
} }
} }
} }
......
...@@ -44,7 +44,7 @@ const char * NEAR globerrs[GLOBERRS]= ...@@ -44,7 +44,7 @@ const char * NEAR globerrs[GLOBERRS]=
"%d files and %d streams is left open\n", "%d files and %d streams is left open\n",
"Disk is full writing '%s'. Waiting for someone to free space...", "Disk is full writing '%s'. Waiting for someone to free space...",
"Can't create directory '%s' (Errcode: %d)", "Can't create directory '%s' (Errcode: %d)",
"Character set '%s' is not a compiled character set and is not specified in the '%s' file" "Character set '%s' is not a compiled character set and is not specified in the '%s' file",
"Out of resources when opening file '%s' (Errcode: %d)", "Out of resources when opening file '%s' (Errcode: %d)",
}; };
......
...@@ -59,6 +59,7 @@ do ...@@ -59,6 +59,7 @@ do
# This could easily be rewritten to gather [xxxxx]-specific entries, # This could easily be rewritten to gather [xxxxx]-specific entries,
# but for now it looks like only the mysqld ones are needed for # but for now it looks like only the mysqld ones are needed for
# server startup scripts # server startup scripts
thevar=""
eval `sed -n -e '/^$/d' -e '/^#/d' -e 's,[ ],,g' -e '/=/p' $c |\ eval `sed -n -e '/^$/d' -e '/^#/d' -e 's,[ ],,g' -e '/=/p' $c |\
awk -F= -v v=$v '{if ($1 == v) printf ("thevar=\"%s\"\n", $2)}'` awk -F= -v v=$v '{if ($1 == v) printf ("thevar=\"%s\"\n", $2)}'`
......
#This file is automaticly generated by crash-me 1.48 #This file is automaticly generated by crash-me 1.49
NEG=yes # update of column= -column NEG=yes # update of column= -column
Need_cast_for_null=no # Need to cast NULL for arithmetic Need_cast_for_null=no # Need to cast NULL for arithmetic
...@@ -36,7 +36,7 @@ constraint_check=no # Column constraints ...@@ -36,7 +36,7 @@ constraint_check=no # Column constraints
constraint_check_table=no # Table constraints constraint_check_table=no # Table constraints
constraint_null=yes # NULL constraint (SyBase style) constraint_null=yes # NULL constraint (SyBase style)
crash_me_safe=no # crash me safe crash_me_safe=no # crash me safe
crash_me_version=1.48 # crash me version crash_me_version=1.49 # crash me version
create_default=yes # default value for column create_default=yes # default value for column
create_default_func=no # default value function for column create_default_func=no # default value function for column
create_if_not_exists=yes # create table if not exists create_if_not_exists=yes # create table if not exists
...@@ -378,8 +378,9 @@ quote_ident_with_`=yes # ` as identifier quote ...@@ -378,8 +378,9 @@ quote_ident_with_`=yes # ` as identifier quote
quote_with_"=yes # Allows ' and " as string markers quote_with_"=yes # Allows ' and " as string markers
remember_end_space=no # Remembers end space in char() remember_end_space=no # Remembers end space in char()
remember_end_space_varchar=no # Remembers end space in varchar() remember_end_space_varchar=no # Remembers end space in varchar()
rename_table=yes # rename table
repeat_string_size=1048576 # return string size from function repeat_string_size=1048576 # return string size from function
right_outer_join=no # right outer join right_outer_join=yes # right outer join
rowid=auto_increment # Type for row id rowid=auto_increment # Type for row id
select_constants=yes # Select constants select_constants=yes # Select constants
select_limit=with LIMIT # LIMIT number of rows select_limit=with LIMIT # LIMIT number of rows
...@@ -387,7 +388,7 @@ select_limit2=yes # SELECT with LIMIT #,# ...@@ -387,7 +388,7 @@ select_limit2=yes # SELECT with LIMIT #,#
select_string_size=1048565 # constant string size in SELECT select_string_size=1048565 # constant string size in SELECT
select_table_update=no # Update with sub select select_table_update=no # Update with sub select
select_without_from=yes # SELECT without FROM select_without_from=yes # SELECT without FROM
server_version=MySQL 3.23.22 beta debug # server version server_version=MySQL 3.23.25 beta debug # server version
simple_joins=yes # ANSI SQL simple joins simple_joins=yes # ANSI SQL simple joins
storage_of_float=round # Storage of float values storage_of_float=round # Storage of float values
subqueries=no # subqueries subqueries=no # subqueries
......
#This file is automaticly generated by crash-me 1.48 #This file is automaticly generated by crash-me 1.49
NEG=yes # update of column= -column NEG=yes # update of column= -column
Need_cast_for_null=no # Need to cast NULL for arithmetic Need_cast_for_null=no # Need to cast NULL for arithmetic
...@@ -36,7 +36,7 @@ constraint_check=no # Column constraints ...@@ -36,7 +36,7 @@ constraint_check=no # Column constraints
constraint_check_table=no # Table constraints constraint_check_table=no # Table constraints
constraint_null=yes # NULL constraint (SyBase style) constraint_null=yes # NULL constraint (SyBase style)
crash_me_safe=no # crash me safe crash_me_safe=no # crash me safe
crash_me_version=1.48 # crash me version crash_me_version=1.49 # crash me version
create_default=yes # default value for column create_default=yes # default value for column
create_default_func=no # default value function for column create_default_func=no # default value function for column
create_if_not_exists=yes # create table if not exists create_if_not_exists=yes # create table if not exists
...@@ -378,8 +378,9 @@ quote_ident_with_`=yes # ` as identifier quote ...@@ -378,8 +378,9 @@ quote_ident_with_`=yes # ` as identifier quote
quote_with_"=yes # Allows ' and " as string markers quote_with_"=yes # Allows ' and " as string markers
remember_end_space=no # Remembers end space in char() remember_end_space=no # Remembers end space in char()
remember_end_space_varchar=no # Remembers end space in varchar() remember_end_space_varchar=no # Remembers end space in varchar()
rename_table=yes # rename table
repeat_string_size=1048576 # return string size from function repeat_string_size=1048576 # return string size from function
right_outer_join=no # right outer join right_outer_join=yes # right outer join
rowid=auto_increment # Type for row id rowid=auto_increment # Type for row id
select_constants=yes # Select constants select_constants=yes # Select constants
select_limit=with LIMIT # LIMIT number of rows select_limit=with LIMIT # LIMIT number of rows
...@@ -387,7 +388,7 @@ select_limit2=yes # SELECT with LIMIT #,# ...@@ -387,7 +388,7 @@ select_limit2=yes # SELECT with LIMIT #,#
select_string_size=1048565 # constant string size in SELECT select_string_size=1048565 # constant string size in SELECT
select_table_update=no # Update with sub select select_table_update=no # Update with sub select
select_without_from=yes # SELECT without FROM select_without_from=yes # SELECT without FROM
server_version=MySQL 3.23.22 beta debug # server version server_version=MySQL 3.23.25 beta debug # server version
simple_joins=yes # ANSI SQL simple joins simple_joins=yes # ANSI SQL simple joins
storage_of_float=round # Storage of float values storage_of_float=round # Storage of float values
subqueries=no # subqueries subqueries=no # subqueries
......
...@@ -859,10 +859,11 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list) ...@@ -859,10 +859,11 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1; key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1;
pthread_mutex_lock(&LOCK_open); pthread_mutex_lock(&LOCK_open);
if(open_unireg_entry(table, db, table_name, table_name) || if (open_unireg_entry(table, db, table_name, table_name) ||
!(table->table_cache_key =memdup_root(&table->mem_root,(char*) key, !(table->table_cache_key =memdup_root(&table->mem_root,(char*) key,
key_length))) key_length)))
{ {
closefrm(table);
pthread_mutex_unlock(&LOCK_open); pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -999,7 +1000,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name, ...@@ -999,7 +1000,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
MEM_ROOT* glob_alloc; MEM_ROOT* glob_alloc;
LINT_INIT(glob_alloc); LINT_INIT(glob_alloc);
if(errno == ENOENT && if (errno == ENOENT &&
(glob_alloc = my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC))) (glob_alloc = my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC)))
// Sasha: needed for replication // Sasha: needed for replication
// remember the name of the non-existent table // remember the name of the non-existent table
......
...@@ -448,14 +448,13 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, ...@@ -448,14 +448,13 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
keyinfo->key_length ? UNIQUE_KEY_FLAG : MULTIPLE_KEY_FLAG); keyinfo->key_length ? UNIQUE_KEY_FLAG : MULTIPLE_KEY_FLAG);
if (i == 0) if (i == 0)
field->key_start|= ((key_map) 1 << key); field->key_start|= ((key_map) 1 << key);
if (ha_option & HA_HAVE_KEY_READ_ONLY && if ((ha_option & HA_HAVE_KEY_READ_ONLY) &&
field->key_length() == key_part->length) field->key_length() == key_part->length &&
{ field->type() != FIELD_TYPE_BLOB &&
if (field->key_type() != HA_KEYTYPE_TEXT && (field->key_type() != HA_KEYTYPE_TEXT ||
!(ha_option & HA_KEY_READ_WRONG_STR) && (!(ha_option & HA_KEY_READ_WRONG_STR) &&
!(keyinfo->flags & HA_FULLTEXT)) !(keyinfo->flags & HA_FULLTEXT))))
field->part_of_key|= ((key_map) 1 << key); field->part_of_key|= ((key_map) 1 << key);
}
if (!(key_part->key_part_flag & HA_REVERSE_SORT) && if (!(key_part->key_part_flag & HA_REVERSE_SORT) &&
usable_parts == i) usable_parts == i)
usable_parts++; // For FILESORT usable_parts++; // For FILESORT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment