Commit 063a1a65 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi

Portability fixes.

Patches required by Gemini
Fix to properly detect if there is an active transaction in InnoDB
Fix to not lock thread structure when doing automatic rollback when thread ends
Allow -O lower_case_names=0 on UNIX
parent 301af97d
......@@ -10714,6 +10714,10 @@ ld: fatal: library -ldl: not found
or
undefined reference to `dlopen'
or
cannot find -lrt
@end example
If too many processes try to connect very rapidly to @code{mysqld}, you will
......@@ -19875,8 +19879,8 @@ will be incremented. If you are using @code{--log-slow-queries}, the query
will be logged to the slow query logfile. @xref{Slow query log}.
@item @code{lower_case_table_names}
If set to 1 table names are stored in lowercase on disk. This will enable
you to access the table names case-insensitive also on Unix.
If set to 1 table names are stored in lowercase on disk and table
names will be case-insensitive.
@xref{Name case sensitivity}.
@item @code{max_allowed_packet}
......@@ -38431,6 +38435,8 @@ is to upgrade to MyODBC Version 2.50.33 and MySQL Version
You should also get and apply the Microsoft Jet 4.0 Service Pack 5 (SP5)
which can be found here
@uref{http://support.microsoft.com/support/kb/articles/Q 239/1/14.ASP}.
This will fix some cases where columns are marked as @code{#deleted#}
in Access.
Note that if you are using MySQL Version 3.22, you must to apply the
MDAC patch and use MyODBC 2.50.32 or 2.50.34 and above to go around
......@@ -43273,6 +43279,11 @@ expecting to store the full length of a @code{BLOB} into a table, you'll need
to start the server with the @code{--set-variable=max_allowed_packet=16M}
option.
You can also get strange problems with large packets if you are using
big blobs, but you haven't given @code{mysqld} access to enough memory
to handle the query. If you suspect this is the case, try adding
@code{ulimit -d 256000} to the beginning of the @code{safe_mysqld} script
and restart @code{mysqld}.
@node Communication errors, Full table, Packet too large, Common errors
@appendixsubsec Communication Errors / Aborted Connection
......@@ -43344,6 +43355,9 @@ Badly configured TCP/IP.
@item
Faulty Ethernets or hubs or switches, cables ... This can be diagnosed
properly only by replacing hardware.
@item
@code{max_allowed_packet} is too small or queries require more memory
than you have alloacated for @code{mysqld}. @xref{Packet too large}.
@end itemize
......@@ -45719,7 +45733,7 @@ By Steve Shreeve.
Perl program to convert Oracle databases to MySQL. Has same
output format as mysqldump. By Johan Andersson.
@item @uref{http://www.mysql.com/Downloads/Contrib/excel2mysql, excel2mysql}
@item @uref{http://www.mysql.com/Downloads/Contrib/excel2mysql.pl, excel2mysql.pl}
Perl program to import Excel spreadsheets into a MySQL database. By Stephen Hurd @email{shurd@@sk.sympatico.ca}
@item @uref{http://www.mysql.com/Downloads/Contrib/T2S_100.ZIP, T2S_100.ZIP}.
......@@ -46529,12 +46543,22 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.42
@itemize @bullet
@item
Fixed problem with InnoDB when one could get the error @code{Can't
execute the given command...} even when one didn't have an active
transaction.
@item
Applied some fixes for Gemini.
@item
Use real arithmetic operations even in integer context if not
all arguments are integers. (Fixes uncommon bug in some integer
context).
@item
Don't force everything to lower cases on windows. (To fix problem
with windows and @code{ALTER TABLE}).
with windows and @code{ALTER TABLE}). Now @code{--lower_case_names}
also works on Unix.
@item
Fixed that automatic rollback that is done when thread end doesn't lock
other threads.
@end itemize
@node News-3.23.41, News-3.23.40, News-3.23.42, News-3.23.x
......@@ -52045,9 +52069,19 @@ Start the @code{mysqld} server with a trace log in @file{/tmp/mysqld.trace}
@code{mysqld --debug}
On Windows you should also use the @code{--standalone} flag to not start
@code{mysqld} as a service.
Note that the trace file will get very @emph{BIG}!
@code{mysqld} as a service:
In a DOS window do:
@example
mysqld --debug --standalone
@end example
After this you can use the @code{mysql.exe} command line tool in a
second DOS window to reproduce the problem. You can take down the above
@code{mysqld} server with @code{mysqladmin shutdown}.
Note that the trace file will get very @emph{BIG}!
If you want to have a smaller trace file, you can use something like:
@code{mysqld --debug=d,info,error,query,general,where:O,/tmp/mysqld.trace}
......@@ -41,8 +41,6 @@ uint32 server_id = 0;
// needed by net_serv.c
ulong bytes_sent = 0L, bytes_received = 0L;
ulong mysqld_net_retry_count = 10L;
ulong net_read_timeout= NET_READ_TIMEOUT;
ulong net_write_timeout= NET_WRITE_TIMEOUT;
uint test_flags = 0;
FILE *result_file;
......
......@@ -1373,7 +1373,7 @@ AC_CHECK_FUNCS(alarm bmove \
getrusage getpwuid getcwd getrlimit getwd index stpcpy locking longjmp \
perror pread realpath readlink rename \
socket strnlen madvise mkstemp \
strtol strtoul strtoull snprintf tempnam thr_setconcurrency \
strtol strtoul strtoll strtoull snprintf tempnam thr_setconcurrency \
gethostbyaddr_r gethostbyname_r getpwnam \
bfill bzero bcmp strstr strpbrk strerror \
tell atod memcpy memmove \
......@@ -1485,7 +1485,7 @@ AC_TRY_COMPILE(
#include <netdb.h>],
[int skr;
skr = gethostbyname_r((const char *) 0, (struct hostent*) 0, (hostent_data*) 0);],
skr = gethostbyname_r((const char *) 0, (struct hostent*) 0, (struct hostent_data*) 0);],
mysql_cv_gethostname_arg=hostent_data, mysql_cv_gethostname_arg=char))
AC_LANG_RESTORE
CXXFLAGS="$ac_save_CXXFLAGS"
......
......@@ -161,6 +161,20 @@ delete from t1;
commit;
select * from t1;
drop table t1;
#
# Test of active transactions
#
create table t1 (a integer) type=innodb;
begin;
rename table t1 to t2;
create table t1 (b integer) type=innodb;
insert into t1 values (1);
rollback;
drop table t1;
rename table t2 to t1;
drop table t1;
set autocommit=1;
#
......
......@@ -4122,7 +4122,7 @@ ulonglong Field_blob::get_id(const char *from)
ulonglong id = 0;
ulong length=get_length(from);
if (length)
longlongget(id, from+packlength);
uint8korr(id, from+packlength);
return id;
}
......
......@@ -874,6 +874,14 @@ public:
uint max_length= ~(uint) 0);
ulonglong get_id(const char *from);
const char *unpack_id(char *to, const char *from, const char *bdata);
inline void get_ptr_from_key_image(char **str,char *key_str)
{
*str = key_str + sizeof(uint16);
}
inline uint get_length_from_key_image(char *key_str)
{
return uint2korr(key_str);
}
enum_field_types blobtype() { return (packlength == 1 ? FIELD_TYPE_TINY_BLOB : FIELD_TYPE_BLOB);}
#endif
char *pack_key(char *to, const char *from, uint max_length);
......
......@@ -388,6 +388,8 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
}
make_sortkey(param,sort_keys[idx++],ref_pos);
}
else
file->unlock_row();
}
(void) file->extra(HA_EXTRA_NO_CACHE); /* End cacheing of records */
file->rnd_end();
......
......@@ -472,7 +472,7 @@ int main(int argc,char **argv)
int error;
MY_INIT(argv[0]);
start_value=2663113L; best_t1=1175350L; best_t2=7404531L; best_type=4; /* mode=4327 add=3 type: 0 */
start_value=8214901L; best_t1=4099790L; best_t2=2406115L; best_type=4; /* mode=4799 add=2 type: 0 */
if (get_options(argc,(char **) argv))
exit(1);
......
......@@ -93,6 +93,7 @@ bool gemini_init(void)
DBUG_ENTER("gemini_init");
gemini_basedir=mysql_home;
/* If datadir isn't set, bail out */
if (*mysql_real_data_home == '\0')
{
......
......@@ -205,3 +205,4 @@ int gemini_set_option_long(int optid, long optval);
const int gemini_blocksize = BLKSIZE;
const int gemini_recbits = DEFAULT_RECBITS;
extern "C" void uttrace(void);
......@@ -2219,7 +2219,7 @@ ha_innobase::external_lock(
if (trx->n_mysql_tables_in_use == 0) {
trx_mark_sql_stat_end(trx);
}
thd->transaction.all.innodb_active_trans=1;
trx->n_mysql_tables_in_use++;
if (prebuilt->select_lock_type != LOCK_NONE) {
......
......@@ -286,6 +286,7 @@ int ha_commit_trans(THD *thd, THD_TRANS* trans)
my_error(ER_ERROR_DURING_COMMIT, MYF(0), error);
error=1;
}
trans->innodb_active_trans=0;
}
#endif
#ifdef HAVE_GEMINI_DB
......@@ -337,6 +338,7 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
my_error(ER_ERROR_DURING_ROLLBACK, MYF(0), error);
error=1;
}
trans->innodb_active_trans=0;
}
#endif
#ifdef HAVE_GEMINI_DB
......
......@@ -128,6 +128,7 @@ typedef struct st_thd_trans {
void *bdb_tid;
void *innobase_tid;
void *gemini_tid;
bool innodb_active_trans;
} THD_TRANS;
enum enum_tx_isolation { ISO_READ_UNCOMMITTED, ISO_READ_COMMITTED,
......@@ -267,6 +268,7 @@ public:
virtual int extra(enum ha_extra_function operation)=0;
virtual int reset()=0;
virtual int external_lock(THD *thd, int lock_type)=0;
virtual void unlock_row() {}
virtual int start_stmt(THD *thd) {return 0;}
virtual int delete_all_rows();
virtual longlong get_auto_increment();
......
......@@ -196,6 +196,7 @@ static SYMBOL symbols[] = {
{ "LOAD", SYM(LOAD),0,0},
{ "LOCAL", SYM(LOCAL_SYM),0,0},
{ "LOCK", SYM(LOCK_SYM),0,0},
{ "LOCKS", SYM(LOCKS_SYM),0,0},
{ "LOGS", SYM(LOGS_SYM),0,0},
{ "LONG", SYM(LONG_SYM),0,0},
{ "LONGBLOB", SYM(LONGBLOB),0,0},
......
......@@ -995,6 +995,7 @@ sig_handler end_thread_signal(int sig __attribute__((unused)))
void end_thread(THD *thd, bool put_in_cache)
{
DBUG_ENTER("end_thread");
thd->cleanup();
(void) pthread_mutex_lock(&LOCK_thread_count);
thread_count--;
delete thd;
......@@ -1189,8 +1190,13 @@ the thread stack. Please read http://www.mysql.com/doc/L/i/Linux.html\n\n",
#ifdef HAVE_STACKTRACE
if(!(test_flags & TEST_NO_STACKTRACE))
{
#ifdef HAVE_GEMINI_DB
utrace();
#endif
print_stacktrace(thd ? (gptr) thd->thread_stack : (gptr) 0,
thread_stack);
}
if (thd)
{
fprintf(stderr, "Trying to get some variables.\n\
......@@ -2054,6 +2060,7 @@ static int bootstrap(FILE *file)
(void) pthread_mutex_unlock(&LOCK_thread_count);
error= thd->fatal_error;
net_end(&thd->net);
thd->cleanup();
delete thd;
return error;
}
......
This diff is collapsed.
......@@ -101,7 +101,7 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
mysys_var=0;
net.vio=0;
ull=0;
system_thread=0;
system_thread=cleanup_done=0;
#ifdef __WIN__
real_id = 0;
#endif
......@@ -149,15 +149,11 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
#endif
}
THD::~THD()
/* Do operations that may take a long time */
void THD::cleanup(void)
{
DBUG_ENTER("~THD()");
/* Close connection */
if (net.vio)
{
vio_delete(net.vio);
net_end(&net);
}
DBUG_ENTER("THD::cleanup");
ha_rollback(this);
if (locked_tables)
{
......@@ -172,6 +168,21 @@ THD::~THD()
ha_close_connection(this);
}
#endif
cleanup_done=1;
DBUG_VOID_RETURN;
}
THD::~THD()
{
DBUG_ENTER("~THD()");
/* Close connection */
if (net.vio)
{
vio_delete(net.vio);
net_end(&net);
}
if (!cleanup_done)
cleanup();
if (global_read_lock)
{
pthread_mutex_lock(&LOCK_open);
......
......@@ -283,7 +283,7 @@ public:
bool no_errors, allow_sum_func, password, fatal_error;
bool query_start_used,last_insert_id_used,insert_id_used;
bool system_thread,in_lock_tables,global_read_lock;
bool query_error, bootstrap;
bool query_error, bootstrap, cleanup_done;
bool volatile killed;
LOG_INFO* current_linfo;
// if we do a purge of binary logs, log index info of the threads
......@@ -295,6 +295,7 @@ public:
THD();
~THD();
void cleanup(void);
bool store_globals();
#ifdef SIGNAL_WITH_VIO_CLOSE
inline void set_active_vio(Vio* vio)
......@@ -360,7 +361,7 @@ public:
{
#ifdef USING_TRANSACTIONS
return (transaction.all.bdb_tid != 0 ||
transaction.all.innobase_tid != 0 ||
transaction.all.innodb_active_trans != 0 ||
transaction.all.gemini_tid != 0);
#else
return 0;
......
......@@ -216,6 +216,8 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
break;
}
}
else
table->file->unlock_row(); // Row failed selection, release lock on it
}
thd->proc_info="end";
end_read_record(&info);
......
......@@ -2667,13 +2667,11 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
DBUG_RETURN(0);
}
#ifdef FN_NO_CASE_SENCE
if (!alias) /* Alias is case sensitive */
if (!(alias_str=sql_strmake(alias_str,table->table.length)))
DBUG_RETURN(0);
if (lower_case_table_names)
casedn_str(table->table.str);
#endif
if (!(ptr = (TABLE_LIST *) thd->calloc(sizeof(TABLE_LIST))))
DBUG_RETURN(0); /* purecov: inspected */
ptr->db= table->db.str;
......
......@@ -4130,6 +4130,8 @@ sub_select(JOIN *join,JOIN_TAB *join_tab,bool end_of_records)
if (not_used_in_distinct && found_records != join->found_records)
return 0;
}
else
info->file->unlock_row();
}
} while (!(error=info->read_record(info)));
if (error > 0) // Fatal error
......
......@@ -1125,16 +1125,12 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
strmov(new_name_buff,new_name);
fn_same(new_name_buff,table_name,3);
#ifdef FN_NO_CASE_SENCE
if (lower_case_table_names)
casedn_str(new_name);
if ((lower_case_table_names &&
!my_strcasecmp(new_name_buff,table_name)) ||
(!lower_case_table_names &&
!strcmp(new_name_buff,table_name)))
#else
if (!strcmp(new_name_buff,table_name)) // Check if name changed
#endif
new_name=table_name; // No. Make later check easier
else
{
......
......@@ -259,6 +259,8 @@ int mysql_update(THD *thd,TABLE_LIST *table_list,List<Item> &fields,
}
}
}
else
table->file->unlock_row();
}
end_read_record(&info);
thd->proc_info="end";
......
......@@ -121,6 +121,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token KILL_SYM
%token LOAD
%token LOCK_SYM
%token LOCKS_SYM
%token UNLOCK_SYM
%token ACTION
......@@ -2560,6 +2561,7 @@ keyword:
| INNOBASE_SYM {}
| LEVEL_SYM {}
| LOCAL_SYM {}
| LOCKS_SYM {}
| LOGS_SYM {}
| MAX_ROWS {}
| MASTER_SYM {}
......
......@@ -42,6 +42,10 @@
#include "my_sys.h" /* defines errno */
#include <errno.h>
#undef strtoull
#undef strtoll
#undef strtoul
#undef strtol
#ifdef USE_LONGLONG
#define UTYPE_MAX (~(ulonglong) 0)
#define TYPE_MIN LONGLONG_MIN
......
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