Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
4dbd9e06
Commit
4dbd9e06
authored
Dec 17, 2001
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lots of portability fixes.
Fixed shutdown on HPUX. Fixed bug in query cache.
parent
fc3e066f
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
189 additions
and
106 deletions
+189
-106
Docs/manual.texi
Docs/manual.texi
+2
-0
configure.in
configure.in
+4
-4
include/m_string.h
include/m_string.h
+1
-1
include/my_pthread.h
include/my_pthread.h
+5
-0
include/raid.h
include/raid.h
+1
-8
innobase/include/univ.i
innobase/include/univ.i
+1
-0
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+28
-7
mysql-test/r/rpl_log.result
mysql-test/r/rpl_log.result
+0
-13
mysql-test/t/rpl_log.test
mysql-test/t/rpl_log.test
+5
-0
mysys/my_pthread.c
mysys/my_pthread.c
+22
-0
mysys/raid.cc
mysys/raid.cc
+0
-8
mysys/thr_mutex.c
mysys/thr_mutex.c
+5
-5
scripts/mysql_install_db.sh
scripts/mysql_install_db.sh
+2
-2
sql-bench/test-alter-table.sh
sql-bench/test-alter-table.sh
+2
-2
sql/ha_innobase.cc
sql/ha_innobase.cc
+3
-3
sql/log_event.cc
sql/log_event.cc
+1
-1
sql/mysqld.cc
sql/mysqld.cc
+46
-28
sql/slave.cc
sql/slave.cc
+2
-6
sql/sql_cache.cc
sql/sql_cache.cc
+48
-11
sql/sql_cache.h
sql/sql_cache.h
+4
-0
sql/sql_parse.cc
sql/sql_parse.cc
+3
-2
tools/mysqlmanager.c
tools/mysqlmanager.c
+4
-5
No files found.
Docs/manual.texi
View file @
4dbd9e06
...
...
@@ -47795,6 +47795,8 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet
@item
Fixed shutdown problem on HPUX.
@item
Added functions @code{des_encrypt()} and @code{des_decrypt()}.
@item
Added statement FLUSH DES_KEY_FILE.
configure.in
View file @
4dbd9e06
...
...
@@ -819,8 +819,8 @@ case $SYSTEM_TYPE in
;;
*
hpux10.20
*
)
echo
"Enabling snprintf workaround for hpux 10.20"
CFLAGS
=
"
$CFLAGS
-DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ"
CXXFLAGS
=
"
$CXXFLAGS
-DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ"
CFLAGS
=
"
$CFLAGS
-DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ
-DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX
"
CXXFLAGS
=
"
$CXXFLAGS
-DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ
-DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX
"
if
test
"
$with_named_thread
"
=
"no"
then
echo
"Using --with-named-thread=-lpthread"
...
...
@@ -829,8 +829,8 @@ case $SYSTEM_TYPE in
;;
*
hpux11.
*
)
echo
"Enabling pread/pwrite workaround for hpux 11"
CFLAGS
=
"
$CFLAGS
-DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK"
CXXFLAGS
=
"
$CXXFLAGS
-DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK"
CFLAGS
=
"
$CFLAGS
-DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS -DNO_FCNTL_NONBLOCK
-DDO_NOT_REMOVE_THREAD_WRAPPERS
"
CXXFLAGS
=
"
$CXXFLAGS
-DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG -DNO_FCNTL_NONBLOCK
-DDO_NOT_REMOVE_THREAD_WRAPPERS
"
if
test
"
$with_named_thread
"
=
"no"
then
echo
"Using --with-named-thread=-lpthread"
...
...
include/m_string.h
View file @
4dbd9e06
...
...
@@ -131,11 +131,11 @@ extern void bzero(gptr dst,uint len);
#if !defined(bcmp) && !defined(HAVE_BCMP)
extern
int
bcmp
(
const
char
*
s1
,
const
char
*
s2
,
uint
len
);
#endif
#ifdef HAVE_purify
extern
int
my_bcmp
(
const
char
*
s1
,
const
char
*
s2
,
uint
len
);
#define bcmp(A,B,C) my_bcmp((A),(B),(C))
#endif
#endif
#ifndef bmove512
extern
void
bmove512
(
gptr
dst
,
const
gptr
src
,
uint
len
);
...
...
include/my_pthread.h
View file @
4dbd9e06
...
...
@@ -446,6 +446,10 @@ struct hostent *my_gethostbyname_r(const char *name,
#endif
/* defined(__WIN__) */
#if defined(HPUX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
#define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c))
#endif
/* safe_mutex adds checking to mutex for easier debugging */
typedef
struct
st_safe_mutex_t
...
...
@@ -476,6 +480,7 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#undef pthread_mutex_t
#undef pthread_cond_wait
#undef pthread_cond_timedwait
#undef pthread_mutex_trylock
#define pthread_mutex_init(A,B) safe_mutex_init((A),(B))
#define pthread_mutex_lock(A) safe_mutex_lock((A),__FILE__,__LINE__)
#define pthread_mutex_unlock(A) safe_mutex_unlock((A),__FILE__,__LINE__)
...
...
include/raid.h
View file @
4dbd9e06
...
...
@@ -23,14 +23,7 @@
#define RAID_DEFAULT_CHUNKSIZE 256*1024
/* 256kB */
extern
const
char
*
raid_type_string
[];
#ifdef __cplusplus
extern
"C"
{
#endif
const
char
*
my_raid_type
(
int
raid_type
);
#ifdef __cplusplus
}
#endif
#define my_raid_type(raid_type) raid_type_string[(int)(raid_type)]
#if defined(USE_RAID) && !defined(DONT_USE_RAID)
...
...
innobase/include/univ.i
View file @
4dbd9e06
...
...
@@ -30,6 +30,7 @@ be defined:
/* Most C compilers other than gcc do not know 'extern inline' */
#
if
!
defined
(
__GNUC__
)
&
&
!defined(__WIN__)
#
undef
UNIV_MUST_NOT_INLINE
#
define
UNIV_MUST_NOT_INLINE
#
endif
...
...
mysql-test/mysql-test-run.sh
View file @
4dbd9e06
...
...
@@ -170,6 +170,7 @@ EXTRA_MYSQL_TEST_OPT=""
USE_RUNNING_SERVER
=
1
DO_GCOV
=
""
DO_GDB
=
""
MANUAL_GDB
=
""
DO_DDD
=
""
DO_CLIENT_GDB
=
""
SLEEP_TIME_FOR_DELETE
=
10
...
...
@@ -272,6 +273,11 @@ while test $# -gt 0; do
fi
DO_CLIENT_GDB
=
1
;;
--manual-gdb
)
DO_GDB
=
1
MANUAL_GDB
=
1
USE_RUNNING_SERVER
=
""
;;
--ddd
)
if
[
x
$BINARY_DIST
=
x1
]
;
then
$ECHO
"Note: you will get more meaningful output on a source distribution compiled with debugging option when running tests with --ddd option"
...
...
@@ -743,8 +749,15 @@ start_master()
"gdb -x
$GDB_MASTER_INIT
"
$MYSQLD
elif
[
x
$DO_GDB
=
x1
]
then
(
echo set
args
$master_args
;
if
[
$USE_MANAGER
=
0
]
;
then
if
[
x
$MANUAL_GDB
=
x1
]
then
$ECHO
"set args
$master_args
"
>
$GDB_MASTER_INIT
$ECHO
"To start gdb for the master , type in another window:"
$ECHO
"cd
$CWD
; gdb -x
$GDB_MASTER_INIT
$MYSQLD
"
wait_for_master
=
1500
else
(
$ECHO
set
args
$master_args
;
if
[
$USE_MANAGER
=
0
]
;
then
cat
<<
EOF
b mysql_parse
commands 1
...
...
@@ -752,9 +765,10 @@ disa 1
end
r
EOF
fi
)
>
$GDB_MASTER_INIT
manager_launch master
$XTERM
-display
$DISPLAY
\
-title
"Master"
-e
gdb
-x
$GDB_MASTER_INIT
$MYSQLD
fi
)
>
$GDB_MASTER_INIT
manager_launch master
$XTERM
-display
$DISPLAY
\
-title
"Master"
-e
gdb
-x
$GDB_MASTER_INIT
$MYSQLD
fi
else
manager_launch master
$MYSQLD
$master_args
fi
...
...
@@ -845,8 +859,15 @@ start_slave()
elif
[
x
$DO_GDB
=
x1
]
then
$ECHO
"set args
$slave_args
"
>
$GDB_SLAVE_INIT
manager_launch
$slave_ident
$XTERM
-display
$DISPLAY
-title
"Slave"
-e
\
gdb
-x
$GDB_SLAVE_INIT
$SLAVE_MYSQLD
if
[
x
$MANUAL_GDB
=
x1
]
then
echo
"To start gdb for the slave, type in another window:"
echo
"cd
$CWD
; gdb -x
$GDB_SLAVE_INIT
$MYSQLD
"
wait_for_slave
=
1500
else
manager_launch
$slave_ident
$XTERM
-display
$DISPLAY
-title
"Slave"
-e
\
gdb
-x
$GDB_SLAVE_INIT
$SLAVE_MYSQLD
fi
else
manager_launch
$slave_ident
$SLAVE_MYSQLD
$slave_args
fi
...
...
mysql-test/r/rpl_log.result
View file @
4dbd9e06
...
...
@@ -67,19 +67,6 @@ Log_name
slave-bin.001
slave-bin.002
show binlog events in 'slave-bin.001' from 4;
Log_name Pos Event_type Server_id Log_seq Info
slave-bin.001 4 Start 2 1 Server ver: VERSION, Binlog ver: 2
slave-bin.001 79 Slave 2 3 host=127.0.0.1,port=MASTER_PORT,log=master-bin.001,pos=4
slave-bin.001 132 Query 1 2 use test; create table t1(n int not null auto_increment primary key)
slave-bin.001 225 Intvar 1 3 INSERT_ID=1
slave-bin.001 253 Query 1 4 use test; insert into t1 values (NULL)
slave-bin.001 316 Query 1 5 use test; drop table t1
slave-bin.001 364 Query 1 6 use test; create table t1 (word char(20) not null)
slave-bin.001 439 Create_file 1 7 db=test;table=t1;file_id=1;block_len=81
slave-bin.001 618 Exec_load 1 8 ;file_id=1
slave-bin.001 641 Query 1 9 use test; drop table t1
slave-bin.001 689 Rotate 1 4 slave-bin.002;pos=4; forced by master
slave-bin.001 729 Stop 2 5
show binlog events in 'slave-bin.002' from 4;
Log_name Pos Event_type Server_id Log_seq Info
slave-bin.002 4 Slave 2 10 host=127.0.0.1,port=MASTER_PORT,log=master-bin.002,pos=4
...
...
mysql-test/t/rpl_log.test
View file @
4dbd9e06
...
...
@@ -35,8 +35,13 @@ slave start;
sync_with_master
;
show
master
logs
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
$VERSION
VERSION
# We can't compare binlog from slave as the result differ between
# machines based on where the LOAD DATA file is stored.
disable_result_log
;
show
binlog
events
in
'slave-bin.001'
from
4
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
$VERSION
VERSION
enable_result_log
;
show
binlog
events
in
'slave-bin.002'
from
4
;
--
replace_result
3306
MASTER_PORT
9306
MASTER_PORT
3334
MASTER_PORT
3336
MASTER_PORT
show
slave
status
;
...
...
mysys/my_pthread.c
View file @
4dbd9e06
...
...
@@ -16,6 +16,7 @@
/* Functions to get threads more portable */
#define DONT_REMAP_PTHREAD_FUNCTIONS
#include "mysys_priv.h"
#ifdef THREAD
#include <signal.h>
...
...
@@ -460,6 +461,27 @@ struct hostent *my_gethostbyname_r(const char *name,
#endif
/* GLIBC2_STYLE_GETHOSTBYNAME_R */
#endif
/*****************************************************************************
Patches for HPUX
We need these because the pthread_mutex.. code returns -1 on error,
instead of the error code.
Note that currently we only remap pthread_ functions used by MySQL.
If we are depending on the value for some other pthread_xxx functions,
this has to be added here.
*****************************************************************************/
int
my_pthread_cond_timedwait
(
pthread_cond_t
*
cond
,
pthread_mutex_t
*
mutex
,
struct
timespec
*
abstime
)
{
int
error
=
pthread_cond_timedwait
(
cond
,
mutex
,
abstime
);
if
(
error
==
-
1
)
/* Safety if the lib is fixed */
error
=
errno
;
if
(
error
==
EAGAIN
)
/* Correct errno to Posix */
error
=
ETIMEDOUT
;
return
error
;
}
/* Some help functions */
...
...
mysys/raid.cc
View file @
4dbd9e06
...
...
@@ -81,14 +81,6 @@
const
char
*
raid_type_string
[]
=
{
"none"
,
"striped"
};
extern
"C"
{
const
char
*
my_raid_type
(
int
raid_type
)
{
return
raid_type_string
[
raid_type
];
}
}
#if defined(USE_RAID) && !defined(MYSQL_CLIENT)
#define RAID_SEEK_DONE ~(off_t) 0
...
...
mysys/thr_mutex.c
View file @
4dbd9e06
...
...
@@ -107,7 +107,7 @@ int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line)
error
=
pthread_mutex_unlock
(
&
mp
->
mutex
);
if
(
error
)
{
fprintf
(
stderr
,
"safe_mutex: Got error: %d
when trying to unlock mutex at %s, line %d
\n
"
,
error
,
file
,
line
);
fprintf
(
stderr
,
"safe_mutex: Got error: %d
(%d) when trying to unlock mutex at %s, line %d
\n
"
,
error
,
errno
,
file
,
line
);
fflush
(
stderr
);
abort
();
}
...
...
@@ -148,7 +148,7 @@ int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file,
pthread_mutex_lock
(
&
mp
->
global
);
if
(
error
)
{
fprintf
(
stderr
,
"safe_mutex: Got error: %d
when doing a safe_mutex_wait at %s, line %d
\n
"
,
error
,
file
,
line
);
fprintf
(
stderr
,
"safe_mutex: Got error: %d
(%d) when doing a safe_mutex_wait at %s, line %d
\n
"
,
error
,
errno
,
file
,
line
);
fflush
(
stderr
);
abort
();
}
...
...
@@ -186,15 +186,15 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#ifdef EXTRA_DEBUG
if
(
error
&&
(
error
!=
EINTR
&&
error
!=
ETIMEDOUT
))
{
fprintf
(
stderr
,
"safe_mutex: Got error: %d
when doing a safe_mutex_timedwait at %s, line %d
\n
"
,
error
,
file
,
line
);
fprintf
(
stderr
,
"safe_mutex: Got error: %d
(%d) when doing a safe_mutex_timedwait at %s, line %d
\n
"
,
error
,
errno
,
file
,
line
);
}
#endif
pthread_mutex_lock
(
&
mp
->
global
);
if
(
mp
->
count
++
)
{
fprintf
(
stderr
,
"safe_mutex: Count was %d in thread %lx when locking mutex at %s, line %d (error: %d)
\n
"
,
mp
->
count
-
1
,
my_thread_id
(),
file
,
line
,
error
);
"safe_mutex: Count was %d in thread %lx when locking mutex at %s, line %d (error: %d
(%d)
)
\n
"
,
mp
->
count
-
1
,
my_thread_id
(),
file
,
line
,
error
,
error
);
fflush
(
stderr
);
abort
();
}
...
...
scripts/mysql_install_db.sh
View file @
4dbd9e06
...
...
@@ -321,8 +321,8 @@ then
fi
echo
"PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !"
echo
"This is done with:"
echo
"
$bindir
/mysqladmin -u root
-p
password 'new-password'"
echo
"
$bindir
/mysqladmin -u root -h
$hostname
-p
password 'new-password'"
echo
"
$bindir
/mysqladmin -u root password 'new-password'"
echo
"
$bindir
/mysqladmin -u root -h
$hostname
password 'new-password'"
echo
"See the manual for more instructions."
#
# Print message about upgrading unless we have created a new db table.
...
...
sql-bench/test-alter-table.sh
View file @
4dbd9e06
...
...
@@ -75,7 +75,7 @@ print "Insert data into the table\n";
$loop_time
=
new Benchmark
;
if
(
$opt_fast
&&
defined
(
$server
->
{
transactions
})
)
if
(
$opt_fast
&&
$server
->
{
transactions
}
)
{
$dbh
->
{
AutoCommit
}
=
0
;
print
"Transactions enabled
\n
"
if
(
$opt_debug
)
;
...
...
@@ -87,7 +87,7 @@ for ($i=0 ; $i < $opt_row_count ; $i++)
$dbh
->do
(
$query
)
or die
$DBI
::errstr
;
}
if
(
$opt_fast
&&
defined
(
$server
->
{
transactions
})
)
if
(
$opt_fast
&&
$server
->
{
transactions
}
)
{
$dbh
->commit
;
$dbh
->
{
AutoCommit
}
=
1
;
...
...
sql/ha_innobase.cc
View file @
4dbd9e06
...
...
@@ -536,7 +536,7 @@ innobase_init(void)
{
int
err
;
bool
ret
;
char
current_lib
[
2
],
*
default_path
;
char
current_lib
[
3
],
*
default_path
;
DBUG_ENTER
(
"innobase_init"
);
...
...
@@ -2044,7 +2044,7 @@ ha_innobase::change_active_index(
else
prebuilt
->
index
=
dict_table_get_first_index_noninline
(
prebuilt
->
table
);
assert
(
prebuilt
->
search_tuple
);
assert
(
prebuilt
->
search_tuple
!=
0
);
dtuple_set_n_fields
(
prebuilt
->
search_tuple
,
prebuilt
->
index
->
n_fields
);
...
...
@@ -2762,7 +2762,7 @@ ha_innobase::create(
innobase_table
=
dict_table_get
(
norm_name
,
NULL
);
assert
(
innobase_table
);
assert
(
innobase_table
!=
0
);
/* Tell the InnoDB server that there might be work for
utility threads: */
...
...
sql/log_event.cc
View file @
4dbd9e06
...
...
@@ -140,7 +140,7 @@ static void cleanup_load_tmpdir()
for
(
i
=
0
;
i
<
(
uint
)
dirp
->
number_off_files
;
i
++
)
{
file
=
dirp
->
dir_entry
+
i
;
if
(
!
mem
cmp
(
file
->
name
,
"SQL_LOAD-"
,
9
))
if
(
!
b
cmp
(
file
->
name
,
"SQL_LOAD-"
,
9
))
my_delete
(
file
->
name
,
MYF
(
MY_WME
));
}
...
...
sql/mysqld.cc
View file @
4dbd9e06
...
...
@@ -114,8 +114,13 @@ typedef fp_except fp_except_t;
inline
void
reset_floating_point_exceptions
()
{
/* Don't fall for overflow, underflow,divide-by-zero or loss of precision */
fpsetmask
(
~
(
FP_X_INV
|
FP_X_DNML
|
FP_X_OFL
|
FP_X_UFL
|
FP_X_DZ
|
FP_X_IMP
));
#if defined(__i386__)
fpsetmask
(
~
(
FP_X_INV
|
FP_X_DNML
|
FP_X_OFL
|
FP_X_UFL
|
FP_X_DZ
|
FP_X_IMP
));
else
fpsetmask
(
~
(
FP_X_INV
|
FP_X_OFL
|
FP_X_UFL
|
FP_X_DZ
|
FP_X_IMP
));
#endif
}
#else
#define reset_floating_point_exceptions()
...
...
@@ -390,6 +395,7 @@ static void get_options(int argc,char **argv);
static
char
*
get_relative_path
(
const
char
*
path
);
static
void
fix_paths
(
void
);
static
pthread_handler_decl
(
handle_connections_sockets
,
arg
);
static
pthread_handler_decl
(
kill_server_thread
,
arg
);
static
int
bootstrap
(
FILE
*
file
);
static
void
close_server_sock
();
static
bool
read_init_file
(
char
*
file_name
);
...
...
@@ -625,19 +631,26 @@ void kill_mysql(void)
#elif defined(OS2)
pthread_cond_signal
(
&
eventShutdown
);
// post semaphore
#elif defined(HAVE_PTHREAD_KILL)
if
(
pthread_kill
(
signal_thread
,
SIGTERM
))
/* End everything nicely */
{
DBUG_PRINT
(
"error"
,(
"Got error %d from pthread_kill"
,
errno
));
/* purecov: inspected */
}
#el
se
kill
(
current_pid
,
SIGTERM
);
if
(
pthread_kill
(
signal_thread
,
SIGTERM
))
/* End everything nicely */
{
DBUG_PRINT
(
"error"
,(
"Got error %d from pthread_kill"
,
errno
));
/* purecov: inspected */
}
#el
if !defined(SIGNALS_DONT_BREAK_READ)
kill
(
current_pid
,
SIGTERM
);
#endif
DBUG_PRINT
(
"quit"
,(
"After pthread_kill"
));
shutdown_in_progress
=
1
;
// Safety if kill didn't work
#ifdef SIGNALS_DONT_BREAK_READ
DBUG_PRINT
(
"quit"
,(
"After pthread_kill"
));
shutdown_in_progress
=
1
;
// Safety if kill didn't work
#ifdef SIGNALS_DONT_BREAK_READ
if
(
!
abort_loop
)
{
pthread_t
tmp
;
abort_loop
=
1
;
if
(
pthread_create
(
&
tmp
,
&
connection_attrib
,
kill_server_thread
,
(
void
*
)
0
))
sql_print_error
(
"Error: Can't create thread to kill server"
);
}
#endif
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
...
...
@@ -682,7 +695,7 @@ static void __cdecl kill_server(int sig_ptr)
#ifdef USE_ONE_SIGNAL_HAND
pthread_handler_decl
(
kill_server_thread
,
arg
__attribute__
((
unused
)))
static
pthread_handler_decl
(
kill_server_thread
,
arg
__attribute__
((
unused
)))
{
my_thread_init
();
// Initialize new thread
kill_server
(
0
);
...
...
@@ -1474,7 +1487,7 @@ static void *signal_hand(void *arg __attribute__((unused)))
(
void
*
)
sig
))
sql_print_error
(
"Error: Can't create thread to kill server"
);
#else
kill_server
((
void
*
)
sig
);
// MIT THREAD has a alarm thread
kill_server
((
void
*
)
sig
);
// MIT THREAD has a alarm thread
#endif
}
break
;
...
...
@@ -2452,18 +2465,21 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
fromhost
(
&
req
);
if
(
!
hosts_access
(
&
req
))
{
// This may be stupid but refuse() includes an exit(0)
// which we surely don't want...
// clean_exit() - same stupid thing ...
/*
This may be stupid but refuse() includes an exit(0)
which we surely don't want...
clean_exit() - same stupid thing ...
*/
syslog
(
deny_severity
,
"refused connect from %s"
,
eval_client
(
&
req
));
if
(
req
.
sink
)
((
void
(
*
)(
int
))
req
.
sink
)(
req
.
fd
);
// C++ sucks (the gibberish in front just translates the supplied
// sink function pointer in the req structure from a void (*sink)();
// to a void(*sink)(int) if you omit the cast, the C++ compiler
// will cry...
/*
C++ sucks (the gibberish in front just translates the supplied
sink function pointer in the req structure from a void (*sink)();
to a void(*sink)(int) if you omit the cast, the C++ compiler
will cry...
*/
(
void
)
shutdown
(
new_sock
,
2
);
// This looks fine to me...
(
void
)
closesocket
(
new_sock
);
continue
;
...
...
@@ -2491,7 +2507,8 @@ pthread_handler_decl(handle_connections_sockets,arg __attribute__((unused)))
if
(
!
(
thd
=
new
THD
))
{
(
void
)
shutdown
(
new_sock
,
2
);
VOID
(
closesocket
(
new_sock
));
(
void
)
shutdown
(
new_sock
,
2
);
VOID
(
closesocket
(
new_sock
));
continue
;
}
if
(
!
(
vio_tmp
=
vio_new
(
new_sock
,
...
...
@@ -3158,7 +3175,7 @@ struct show_var_st status_vars[]= {
{
"Com_drop_table"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_DROP_TABLE
),
SHOW_LONG
},
{
"Com_flush"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_FLUSH
),
SHOW_LONG
},
{
"Com_grant"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_GRANT
),
SHOW_LONG
},
{
"Com_ha_close"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_HA_
OPEN
),
SHOW_LONG
},
{
"Com_ha_close"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_HA_
CLOSE
),
SHOW_LONG
},
{
"Com_ha_open"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_HA_OPEN
),
SHOW_LONG
},
{
"Com_ha_read"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_HA_READ
),
SHOW_LONG
},
{
"Com_insert"
,
(
char
*
)
(
com_stat
+
(
uint
)
SQLCOM_INSERT
),
SHOW_LONG
},
...
...
@@ -4283,16 +4300,17 @@ static uint set_maximum_open_files(uint max_file_limit)
rlimit
.
rlim_cur
=
rlimit
.
rlim_max
=
max_file_limit
;
if
(
setrlimit
(
RLIMIT_NOFILE
,
&
rlimit
))
{
sql_print_error
(
"Warning: setrlimit couldn't increase number of open files to more than %l
d
"
,
old_cur
);
/* purecov: inspected */
sql_print_error
(
"Warning: setrlimit couldn't increase number of open files to more than %l
u (request: %u)
"
,
old_cur
,
max_file_limit
);
/* purecov: inspected */
max_file_limit
=
old_cur
;
}
else
{
(
void
)
getrlimit
(
RLIMIT_NOFILE
,
&
rlimit
);
if
((
uint
)
rlimit
.
rlim_cur
!=
max_file_limit
)
sql_print_error
(
"Warning: setrlimit returned ok, but didn't change limits. Max open files is %ld"
,
(
ulong
)
rlimit
.
rlim_cur
);
/* purecov: inspected */
sql_print_error
(
"Warning: setrlimit returned ok, but didn't change limits. Max open files is %ld (request: %u)"
,
(
ulong
)
rlimit
.
rlim_cur
,
max_file_limit
);
/* purecov: inspected */
max_file_limit
=
rlimit
.
rlim_cur
;
}
}
...
...
sql/slave.cc
View file @
4dbd9e06
...
...
@@ -766,9 +766,7 @@ int show_master_info(THD* thd)
net_store_data
(
packet
,
(
longlong
)
glob_mi
.
pos
);
last_log_seq
=
glob_mi
.
last_log_seq
;
pthread_mutex_unlock
(
&
glob_mi
.
lock
);
pthread_mutex_lock
(
&
LOCK_slave
);
// QQ; This is not needed
net_store_data
(
packet
,
slave_running
?
"Yes"
:
"No"
);
pthread_mutex_unlock
(
&
LOCK_slave
);
// QQ; This is not needed
net_store_data
(
packet
,
&
replicate_do_db
);
net_store_data
(
packet
,
&
replicate_ignore_db
);
net_store_data
(
packet
,
(
uint32
)
last_slave_errno
);
...
...
@@ -1099,6 +1097,8 @@ slave_begin:
THD
*
thd
;
// needs to be first for thread_stack
MYSQL
*
mysql
=
NULL
;
char
llbuff
[
22
];
bool
retried_once
=
0
;
ulonglong
last_failed_pos
=
0
;
pthread_mutex_lock
(
&
LOCK_slave
);
if
(
!
server_id
)
...
...
@@ -1123,10 +1123,6 @@ slave_begin:
pthread_cond_broadcast
(
&
COND_slave_start
);
pthread_mutex_unlock
(
&
LOCK_slave
);
// int error = 1;
bool
retried_once
=
0
;
ulonglong
last_failed_pos
=
0
;
// needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
my_thread_init
();
slave_thd
=
thd
=
new
THD
;
// note that contructor of THD uses DBUG_ !
...
...
sql/sql_cache.cc
View file @
4dbd9e06
...
...
@@ -1951,11 +1951,35 @@ Query_cache::get_free_block(ulong len, my_bool not_less, ulong min)
if
(
bins
[
start
].
number
!=
0
)
{
Query_cache_block
*
list
=
bins
[
start
].
free_blocks
;
first
=
list
;
while
(
first
->
next
!=
list
&&
first
->
length
<
len
)
first
=
first
->
next
;
if
(
first
->
length
>=
len
)
block
=
first
;
ulong
max_len
=
list
->
prev
->
length
;
if
(
list
->
prev
->
length
>=
len
)
// check block with max size
{
first
=
list
;
uint
n
=
0
;
while
(
n
<
QUERY_CACHE_MEM_BIN_TRY
&&
first
->
length
<
len
)
//we don't need irst->next != list
{
first
=
first
->
next
;
n
++
;
}
if
(
first
->
length
>=
len
)
block
=
first
;
else
// we don't need if (first->next != list)
{
n
=
0
;
block
=
list
->
prev
;
while
(
n
<
QUERY_CACHE_MEM_BIN_TRY
&&
block
->
length
>
len
)
{
block
=
block
->
prev
;
n
++
;
}
if
(
block
->
length
<
len
)
block
=
block
->
next
;
}
}
else
first
=
list
->
prev
;
}
if
(
block
==
0
&&
start
>
0
)
{
...
...
@@ -2117,18 +2141,28 @@ void Query_cache::insert_into_free_memory_list(Query_cache_block *free_block)
uint
Query_cache
::
find_bin
(
ulong
size
)
{
int
i
;
DBUG_ENTER
(
"Query_cache::find_bin"
);
// Begin small blocks to big (small blocks frequently asked)
for
(
i
=
mem_bin_steps
-
1
;
i
>
0
&&
steps
[
i
-
1
].
size
<
size
;
i
--
)
;
if
(
i
==
0
)
// Binary search
int
left
=
0
,
right
=
mem_bin_steps
;
do
{
int
middle
=
(
left
+
right
)
/
2
;
if
(
steps
[
middle
].
size
>
size
)
left
=
middle
+
1
;
else
right
=
middle
;
}
while
(
left
<
right
);
if
(
left
==
0
)
{
// first bin not subordinate of common rules
DBUG_PRINT
(
"qcache"
,
(
"first bin (# 0), size %lu"
,
size
));
DBUG_RETURN
(
0
);
}
uint
bin
=
steps
[
i
].
idx
-
(
uint
)((
size
-
steps
[
i
].
size
)
/
steps
[
i
].
increment
);
DBUG_PRINT
(
"qcache"
,
(
"bin %u step %u, size %lu"
,
bin
,
i
,
size
));
uint
bin
=
steps
[
left
].
idx
-
(
uint
)((
size
-
steps
[
left
].
size
)
/
steps
[
left
].
increment
);
bins_dump
();
DBUG_PRINT
(
"qcache"
,
(
"bin %u step %u, size %lu step size %lu"
,
bin
,
left
,
size
,
steps
[
left
].
size
));
DBUG_RETURN
(
bin
);
}
...
...
@@ -2480,6 +2514,9 @@ my_bool Query_cache::move_by_type(byte **border,
result_block
=
result_block
->
next
;
}
while
(
result_block
!=
first_result_block
);
}
Query_cache_query
*
new_query
=
((
Query_cache_query
*
)
new_block
->
data
());
pthread_cond_init
(
&
new_query
->
lock
,
NULL
);
pthread_mutex_init
(
&
new_query
->
clients_guard
,
MY_MUTEX_INIT_FAST
);
NET
*
net
=
new_block
->
query
()
->
writer
();
if
(
net
!=
0
)
{
...
...
sql/sql_cache.h
View file @
4dbd9e06
...
...
@@ -41,6 +41,10 @@
#define QUERY_CACHE_MEM_BIN_PARTS_MUL 1.2
#define QUERY_CACHE_MEM_BIN_SPC_LIM_PWR2 3
/* how many free blocks check when finding most suitable before other 'end'
of list of free blocks */
#define QUERY_CACHE_MEM_BIN_TRY 5
/* query flags masks */
#define QUERY_CACHE_CLIENT_LONG_FLAG_MASK 0x80
#define QUERY_CACHE_CHARSET_CONVERT_MASK 0x7F
...
...
sql/sql_parse.cc
View file @
4dbd9e06
...
...
@@ -875,8 +875,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
thd
->
free_list
=
0
;
table_list
.
name
=
table_list
.
real_name
=
thd
->
strdup
(
packet
);
thd
->
query
=
fields
=
thd
->
strdup
(
strend
(
packet
)
+
1
);
thd
->
query_length
=
strlen
(
thd
->
query
);
packet
=
strend
(
packet
)
+
1
;
if
(
!
(
thd
->
query
=
fields
=
thd
->
memdup
(
packet
,
thd
->
query_length
+
1
)))
break
;
mysql_log
.
write
(
thd
,
command
,
"%s %s"
,
table_list
.
real_name
,
fields
);
remove_escape
(
table_list
.
real_name
);
// This can't have wildcards
...
...
tools/mysqlmanager.c
View file @
4dbd9e06
...
...
@@ -653,14 +653,14 @@ HANDLE_DECL(handle_stop_exec)
e
->
th
=
pthread_self
();
if
(
!
e
->
pid
)
{
e
->
th
=
0
;
/* e->th=0; */
/* th may be a struct */
pthread_mutex_unlock
(
&
e
->
lock
);
error
=
"Process not running"
;
goto
err
;
}
if
(
mysql_shutdown
(
&
e
->
mysql
))
{
e
->
th
=
0
;
/* e->th=0; */
/* th may be a struct */
pthread_mutex_unlock
(
&
e
->
lock
);
error
=
"Could not send shutdown command"
;
goto
err
;
...
...
@@ -669,7 +669,7 @@ HANDLE_DECL(handle_stop_exec)
pthread_cond_timedwait
(
&
e
->
cond
,
&
e
->
lock
,
&
abstime
);
if
(
e
->
pid
)
error
=
"Process failed to terminate within alotted time"
;
e
->
th
=
0
;
/* e->th=0; */
/* th may be a struct */
pthread_mutex_unlock
(
&
e
->
lock
);
if
(
!
error
)
{
...
...
@@ -1378,7 +1378,6 @@ static int run_server_loop()
pthread_t
th
;
struct
manager_thd
*
thd
;
int
client_sock
;
uint
len
;
Vio
*
vio
;
pthread_attr_t
thr_attr
;
(
void
)
pthread_attr_init
(
&
thr_attr
);
...
...
@@ -1389,7 +1388,7 @@ static int run_server_loop()
for
(;
!
shutdown_requested
;)
{
len
=
sizeof
(
struct
sockaddr_in
);
size_socket
len
=
sizeof
(
struct
sockaddr_in
);
if
((
client_sock
=
accept
(
manager_sock
,(
struct
sockaddr
*
)
&
manager_addr
,
&
len
))
<
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment