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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
268e82a0
Commit
268e82a0
authored
Jun 05, 2002
by
monty@bitch.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
Merge hundin:/my/mysql-4.0 into bitch.mysql.fi:/my/mysql-4.0
parents
e0f60f35
9263b77e
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
941 additions
and
674 deletions
+941
-674
Docs/manual.texi
Docs/manual.texi
+20
-3
include/my_sys.h
include/my_sys.h
+67
-66
innobase/srv/srv0srv.c
innobase/srv/srv0srv.c
+7
-7
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+15
-5
mysql-test/r/multi_update.result
mysql-test/r/multi_update.result
+4
-0
mysql-test/t/multi_update.test
mysql-test/t/multi_update.test
+18
-0
mysys/mf_iocache.c
mysys/mf_iocache.c
+0
-2
sql/field.cc
sql/field.cc
+2
-1
sql/log.cc
sql/log.cc
+48
-29
sql/log_event.cc
sql/log_event.cc
+123
-124
sql/mysqld.cc
sql/mysqld.cc
+3
-3
sql/repl_failsafe.cc
sql/repl_failsafe.cc
+19
-11
sql/slave.cc
sql/slave.cc
+366
-307
sql/slave.h
sql/slave.h
+64
-71
sql/sql_class.h
sql/sql_class.h
+36
-31
sql/sql_delete.cc
sql/sql_delete.cc
+6
-0
sql/sql_insert.cc
sql/sql_insert.cc
+3
-1
sql/sql_parse.cc
sql/sql_parse.cc
+1
-5
sql/sql_repl.cc
sql/sql_repl.cc
+10
-8
sql/unireg.h
sql/unireg.h
+4
-0
tests/truncate.pl
tests/truncate.pl
+125
-0
No files found.
Docs/manual.texi
View file @
268e82a0
...
...
@@ -49343,6 +49343,13 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet
@item
Fixed mutex bug in replication when reading from master fails.
@item
Added missing mutex in @code{TRUNCATE TABLE}; This fixes some core
dump/hangup problems when using @code{TRUNCATE TABLE}.
@item
Fixed bug in multi-table @code{DELETE} when optimiser uses only indices
@item
Fixed that @code{ALTER TABLE table_name RENAME new_table_name} is as fast
as @code{RENAME TABLE}.
@item
...
...
@@ -49476,8 +49483,6 @@ specified with the @code{--sql-mode} option for @code{mysqld}. It disables
unsigned arithmetic rules when it comes to subtraction. (This will make
MySQL 4.0 behave more closely to 3.23 with @code{UNSIGNED} columns).
@item
Added @code{WITH MAX_QUERIES_PER_HOUR=#} to @code{GRANT} command.
@item
The result returned for all bit functions (@code{|}, @code{<<}, ...) is now of
type @code{unsigned integer}.
@item
...
...
@@ -49777,6 +49782,7 @@ users use this code as the rest of the code and because of this we are
not yet 100% confident in this code.
@menu
* News-3.23.52:: Changes in release 3.23.52
* News-3.23.51:: Changes in release 3.23.51
* News-3.23.50:: Changes in release 3.23.50 (21 Apr 2002)
* News-3.23.49:: Changes in release 3.23.49
...
...
@@ -49832,7 +49838,18 @@ not yet 100% confident in this code.
* News-3.23.0:: Changes in release 3.23.0 (Sep 1999: Alpha)
@end menu
@node News-3.23.51, News-3.23.50, News-3.23.x, News-3.23.x
@node News-3.23.52, News-3.23.51, News-3.23.x, News-3.23.x
@appendixsubsec Changes in release 3.23.52
@itemize @bullet
@item
Fixed possible problem in replication when doing @code{DROP DATABASE} on a
database with InnoDB tables.
@item
Fixed that @code{mysql_info()} returns 0 for 'Duplicates' when using
@code{INSERT DELAYED IGNORE}.
@end itemize
@node News-3.23.51, News-3.23.50, News-3.23.52, News-3.23.x
@appendixsubsec Changes in release 3.23.51
@itemize @bullet
include/my_sys.h
View file @
268e82a0
...
...
@@ -302,33 +302,41 @@ typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*);
typedef
struct
st_io_cache
/* Used when cacheing files */
{
/* pos_in_file is offset in file corresponding to the first byte of
byte* buffer. end_of_file is the offset of end of file for READ_CACHE
and WRITE_CACHE. For SEQ_READ_APPEND it the maximum of the actual
end of file and the position represented by read_end.
/* Offset in file corresponding to the first byte of byte* buffer. */
my_off_t
pos_in_file
;
/*
The offset of end of file for READ_CACHE and WRITE_CACHE.
For SEQ_READ_APPEND it the maximum of the actual end of file and
the position represented by read_end.
*/
my_off_t
pos_in_file
,
end_of_file
;
/* read_pos points to current read position in the buffer
read_end is the non-inclusive boundary in the buffer for the currently
valid read area
buffer is the read buffer
not sure about request_pos except that it is used in async_io
my_off_t
end_of_file
;
/* Points to current read position in the buffer */
byte
*
read_pos
;
/* the non-inclusive boundary in the buffer for the currently valid read */
byte
*
read_end
;
byte
*
buffer
;
/* The read buffer */
/* Used in ASYNC_IO */
byte
*
request_pos
;
/* Only used in WRITE caches and in SEQ_READ_APPEND to buffer writes */
byte
*
write_buffer
;
/*
Only used in SEQ_READ_APPEND, and points to the current read position
in the write buffer. Note that reads in SEQ_READ_APPEND caches can
happen from both read buffer (byte* buffer) and write buffer
(byte* write_buffer).
*/
byte
*
read_pos
,
*
read_end
,
*
buffer
,
*
request_pos
;
/* write_buffer is used only in WRITE caches and in SEQ_READ_APPEND to
buffer writes
append_read_pos is only used in SEQ_READ_APPEND, and points to the
current read position in the write buffer. Note that reads in
SEQ_READ_APPEND caches can happen from both read buffer (byte* buffer),
and write buffer (byte* write_buffer).
write_pos points to current write position in the write buffer and
write_end is the non-inclusive boundary of the valid write area
*/
byte
*
write_buffer
,
*
append_read_pos
,
*
write_pos
,
*
write_end
;
/* current_pos and current_end are convenience variables used by
my_b_tell() and other routines that need to know the current offset
current_pos points to &write_pos, and current_end to &write_end in a
WRITE_CACHE, and &read_pos and &read_end respectively otherwise
byte
*
append_read_pos
;
/* Points to current write position in the write buffer */
byte
*
write_pos
;
/* The non-inclusive boundary of the valid write area */
byte
*
write_end
;
/*
Current_pos and current_end are convenience variables used by
my_b_tell() and other routines that need to know the current offset
current_pos points to &write_pos, and current_end to &write_end in a
WRITE_CACHE, and &read_pos and &read_end respectively otherwise
*/
byte
**
current_pos
,
**
current_end
;
/* The lock is for append buffer used in SEQ_READ_APPEND cache */
...
...
@@ -336,70 +344,64 @@ typedef struct st_io_cache /* Used when cacheing files */
pthread_mutex_t
append_buffer_lock
;
/* need mutex copying from append buffer to read buffer */
#endif
/* a caller will use my_b_read() macro to read from the cache
if the data is already in cache, it will be simply copied with
memcpy() and internal variables will be accordinging updated with
no functions invoked. However, if the data is not fully in the cache,
my_b_read() will call read_function to fetch the data. read_function
must never be invoked directly
/*
A caller will use my_b_read() macro to read from the cache
if the data is already in cache, it will be simply copied with
memcpy() and internal variables will be accordinging updated with
no functions invoked. However, if the data is not fully in the cache,
my_b_read() will call read_function to fetch the data. read_function
must never be invoked directly.
*/
int
(
*
read_function
)(
struct
st_io_cache
*
,
byte
*
,
uint
);
/* same idea as in the case of read_function, except my_b_write() needs to
be replaced with my_b_append() for a SEQ_READ_APPEND cache
/*
Same idea as in the case of read_function, except my_b_write() needs to
be replaced with my_b_append() for a SEQ_READ_APPEND cache
*/
int
(
*
write_function
)(
struct
st_io_cache
*
,
const
byte
*
,
uint
);
/* specifies the type of the cache. Depending on the type of the cache
/*
Specifies the type of the cache. Depending on the type of the cache
certain operations might not be available and yield unpredicatable
results. Details to be documented later
*/
enum
cache_type
type
;
/* callbacks when the actual read I/O happens. These were added and
are currently used for binary logging of LOAD DATA INFILE - when a
block is read from the file, we create a block create/append event, and
when IO_CACHE is closed, we create an end event. These functions could,
of course be used for other things
/*
Callbacks when the actual read I/O happens. These were added and
are currently used for binary logging of LOAD DATA INFILE - when a
block is read from the file, we create a block create/append event, and
when IO_CACHE is closed, we create an end event. These functions could,
of course be used for other things
*/
IO_CACHE_CALLBACK
pre_read
;
IO_CACHE_CALLBACK
post_read
;
IO_CACHE_CALLBACK
pre_close
;
void
*
arg
;
/* for use by pre/post_read */
void
*
arg
;
/* for use by pre/post_read */
char
*
file_name
;
/* if used with 'open_cached_file' */
char
*
dir
,
*
prefix
;
File
file
;
/* file descriptor */
/* seek_not_done is set by my_b_seek() to inform the upcoming read/write
operation that a seek needs to be preformed prior to the actual I/O
error is 0 if the cache operation was successful, -1 if there was a
"hard" error, and the actual number of I/O-ed bytes if the read/write was
partial
/*
seek_not_done is set by my_b_seek() to inform the upcoming read/write
operation that a seek needs to be preformed prior to the actual I/O
error is 0 if the cache operation was successful, -1 if there was a
"hard" error, and the actual number of I/O-ed bytes if the read/write was
partial.
*/
int
seek_not_done
,
error
;
/* buffer_length is the size of memory allocated for buffer or write_buffer
read_length is the same as buffer_length except when we use async io
not sure why we need it
*/
uint
buffer_length
,
read_length
;
/* buffer_length is memory size allocated for buffer or write_buffer */
uint
buffer_length
;
/* read_length is the same as buffer_length except when we use async io */
uint
read_length
;
myf
myflags
;
/* Flags used to my_read/my_write */
/*
/*
alloced_buffer is 1 if the buffer was allocated by init_io_cache() and
0 if it was supplied by the user
0 if it was supplied by the user
.
Currently READ_NET is the only one that will use a buffer allocated
somewhere else
*/
my_bool
alloced_buffer
;
/* init_count is incremented every time we call init_io_cache()
It is not reset in end_io_cache(). This variable
was introduced for slave relay logs - RELAY_LOG_INFO stores a pointer
to IO_CACHE that could in some cases refer to the IO_CACHE of the
currently active relay log. The IO_CACHE then could be closed,
re-opened and start pointing to a different log file. In that case,
we could not know reliably if this happened without init_count
one must be careful with bzero() prior to the subsequent init_io_cache()
call
*/
int
init_count
;
#ifdef HAVE_AIOWAIT
/* as inidicated by ifdef, this is for async I/O, we will have
Sinisa comment this some time
/*
As inidicated by ifdef, this is for async I/O, which is not currently
used (because it's not reliable on all systems)
*/
uint
inited
;
my_off_t
aio_read_pos
;
...
...
@@ -428,7 +430,6 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *);
((info)->write_pos+=(Count)),0) : \
(*(info)->write_function)((info),(Buffer),(Count)))
#define my_b_get(info) \
((info)->read_pos != (info)->read_end ?\
((info)->read_pos++, (int) (uchar) (info)->read_pos[-1]) :\
...
...
innobase/srv/srv0srv.c
View file @
268e82a0
...
...
@@ -1631,6 +1631,7 @@ srv_init(void)
for
(
i
=
0
;
i
<
OS_THREAD_MAX_N
;
i
++
)
{
slot
=
srv_table_get_nth_slot
(
i
);
slot
->
in_use
=
FALSE
;
slot
->
type
=
0
;
/* Avoid purify errors */
slot
->
event
=
os_event_create
(
NULL
);
ut_a
(
slot
->
event
);
}
...
...
@@ -1899,7 +1900,6 @@ srv_conc_exit_innodb(
trx_t
*
trx
)
/* in: transaction object associated with the
thread */
{
srv_conc_slot_t
*
slot
=
NULL
;
if
(
srv_thread_concurrency
>=
500
)
{
...
...
@@ -2514,11 +2514,11 @@ srv_master_thread(
can drop tables lazily after there no longer are SELECT
queries to them. */
srv_main_thread_op_info
=
"doing background drop tables"
;
srv_main_thread_op_info
=
(
char
*
)
"doing background drop tables"
;
row_drop_tables_for_mysql_in_background
();
srv_main_thread_op_info
=
""
;
srv_main_thread_op_info
=
(
char
*
)
""
;
if
(
srv_force_recovery
>=
SRV_FORCE_NO_BACKGROUND
)
{
...
...
@@ -2630,19 +2630,19 @@ srv_master_thread(
/* In this loop we run background operations when the server
is quiet and we also come here about once in 10 seconds */
srv_main_thread_op_info
=
"doing background drop tables"
;
srv_main_thread_op_info
=
(
char
*
)
"doing background drop tables"
;
n_tables_to_drop
=
row_drop_tables_for_mysql_in_background
();
srv_main_thread_op_info
=
""
;
srv_main_thread_op_info
=
(
char
*
)
""
;
srv_main_thread_op_info
=
"flushing buffer pool pages"
;
srv_main_thread_op_info
=
(
char
*
)
"flushing buffer pool pages"
;
/* Flush a few oldest pages to make the checkpoint younger */
n_pages_flushed
=
buf_flush_batch
(
BUF_FLUSH_LIST
,
10
,
ut_dulint_max
);
srv_main_thread_op_info
=
"making checkpoint"
;
srv_main_thread_op_info
=
(
char
*
)
"making checkpoint"
;
/* Make a new checkpoint about once in 10 seconds */
...
...
mysql-test/mysql-test-run.sh
View file @
268e82a0
...
...
@@ -675,9 +675,9 @@ manager_launch()
ident
=
$1
shift
if
[
$USE_MANAGER
=
0
]
;
then
$@
>
$CUR_MYERR
2>&1 &
sleep
2
#hack
return
$@
>
$CUR_MYERR
2>&1 &
sleep
2
#hack
return
fi
$MYSQL_MANAGER_CLIENT
$MANAGER_QUIET_OPT
--user
=
$MYSQL_MANAGER_USER
\
--password
=
$MYSQL_MANAGER_PW
--port
=
$MYSQL_MANAGER_PORT
<<
EOF
...
...
@@ -687,7 +687,7 @@ set_exec_stderr $ident $CUR_MYERR
set_exec_con
$ident
root localhost
$CUR_MYSOCK
start_exec
$ident
$START_WAIT_TIMEOUT
EOF
abort_if_failed
"Could not execute manager command"
abort_if_failed
"Could not execute manager command"
}
manager_term
()
...
...
@@ -887,13 +887,23 @@ start_slave()
"gdb -x
$GDB_SLAVE_INIT
"
$SLAVE_MYSQLD
elif
[
x
$DO_GDB
=
x1
]
then
$ECHO
"set args
$slave_args
"
>
$GDB_SLAVE_INIT
if
[
x
$MANUAL_GDB
=
x1
]
then
$ECHO
"set args
$slave_args
"
>
$GDB_SLAVE_INIT
echo
"To start gdb for the slave, type in another window:"
echo
"cd
$CWD
; gdb -x
$GDB_SLAVE_INIT
$SLAVE_MYSQLD
"
wait_for_slave
=
1500
else
(
$ECHO
set
args
$slave_args
;
if
[
$USE_MANAGER
=
0
]
;
then
cat
<<
EOF
b mysql_parse
commands 1
disa 1
end
r
EOF
fi
)
>
$GDB_SLAVE_INIT
manager_launch
$slave_ident
$XTERM
-display
$DISPLAY
-title
"Slave"
-e
\
gdb
-x
$GDB_SLAVE_INIT
$SLAVE_MYSQLD
fi
...
...
mysql-test/r/multi_update.result
View file @
268e82a0
...
...
@@ -66,3 +66,7 @@ select count(*) from t3 where id3;
count(*)
0
drop table t1,t2,t3;
create table t1(id1 int not null auto_increment primary key, t varchar(100));
create table t2(id2 int not null, t varchar(100), index(id2));
delete t1, t2 from t2,t1 where t1.id1 = t2.id2 and t1.id1 > 100;
drop table t1,t2;
mysql-test/t/multi_update.test
View file @
268e82a0
...
...
@@ -62,3 +62,21 @@ select count(*) from t2 where id2;
select
count
(
*
)
from
t3
where
id3
;
drop
table
t1
,
t2
,
t3
;
create
table
t1
(
id1
int
not
null
auto_increment
primary
key
,
t
varchar
(
100
));
create
table
t2
(
id2
int
not
null
,
t
varchar
(
100
),
index
(
id2
));
disable_query_log
;
let
$
1
=
1000
;
while
(
$
1
)
{
let
$
2
=
5
;
eval
insert
into
t1
(
t
)
values
(
'aaaaaaaaaaaaaaaaaaaa'
);
while
(
$
2
)
{
eval
insert
into
t2
(
id2
,
t
)
values
(
$
1
,
'bbbbbbbbbbbbbbbbb'
);
dec
$
2
;
}
dec
$
1
;
}
enable_query_log
;
delete
t1
,
t2
from
t2
,
t1
where
t1
.
id1
=
t2
.
id2
and
t1
.
id1
>
100
;
drop
table
t1
,
t2
;
mysys/mf_iocache.c
View file @
268e82a0
...
...
@@ -122,8 +122,6 @@ int init_io_cache(IO_CACHE *info, File file, uint cachesize,
info
->
pos_in_file
=
seek_offset
;
info
->
pre_close
=
info
->
pre_read
=
info
->
post_read
=
0
;
info
->
arg
=
0
;
info
->
init_count
++
;
/* we assume the user had set it to 0 prior to
first call */
info
->
alloced_buffer
=
0
;
info
->
buffer
=
0
;
info
->
seek_not_done
=
test
(
file
>=
0
);
...
...
sql/field.cc
View file @
268e82a0
...
...
@@ -4628,7 +4628,7 @@ bool Field_num::eq_def(Field *field)
*****************************************************************************/
/*
**
Make a field from the .frm file info
Make a field from the .frm file info
*/
uint32
calc_pack_length
(
enum_field_types
type
,
uint32
length
)
...
...
@@ -4657,6 +4657,7 @@ uint32 calc_pack_length(enum_field_types type,uint32 length)
case
FIELD_TYPE_LONG_BLOB
:
return
4
+
portable_sizeof_char_ptr
;
case
FIELD_TYPE_SET
:
case
FIELD_TYPE_ENUM
:
abort
();
return
0
;
// This shouldn't happen
default:
return
0
;
}
return
0
;
// This shouldn't happen
}
...
...
sql/log.cc
View file @
268e82a0
...
...
@@ -80,10 +80,10 @@ static int find_uniq_filename(char *name)
DBUG_RETURN
(
0
);
}
MYSQL_LOG
::
MYSQL_LOG
()
:
last_time
(
0
),
query_start
(
0
),
index_file
(
-
1
),
name
(
0
),
log_type
(
LOG_CLOSED
),
write_error
(
0
),
inited
(
0
),
file_id
(
1
),
no_rotate
(
0
),
need_start_event
(
1
),
bytes_written
(
0
)
MYSQL_LOG
::
MYSQL_LOG
()
:
bytes_written
(
0
),
last_time
(
0
),
query_start
(
0
),
index_file
(
-
1
),
name
(
0
),
file_id
(
1
),
open_count
(
1
),
log_type
(
LOG_CLOSED
),
write_error
(
0
),
inited
(
0
),
no_rotate
(
0
),
need_start_event
(
1
)
{
/*
We don't want to intialize LOCK_Log here as the thread system may
...
...
@@ -173,8 +173,10 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
File
file
=
-
1
;
bool
do_magic
;
int
open_flags
=
O_CREAT
|
O_APPEND
|
O_BINARY
;
DBUG_ENTER
(
"MYSQL_LOG::open"
);
if
(
!
inited
&&
log_type_arg
==
LOG_BIN
&&
*
fn_ext
(
log_name
))
no_rotate
=
1
;
no_rotate
=
1
;
init
(
log_type_arg
,
io_cache_type_arg
,
no_auto_events_arg
);
if
(
!
(
name
=
my_strdup
(
log_name
,
MYF
(
MY_WME
))))
...
...
@@ -196,6 +198,7 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
do_magic
=
((
log_type
==
LOG_BIN
)
&&
!
my_stat
(
log_file_name
,
&
tmp_stat
,
MYF
(
0
)));
open_count
++
;
if
((
file
=
my_open
(
log_file_name
,
open_flags
,
MYF
(
MY_WME
|
ME_WAITTANG
)))
<
0
||
init_io_cache
(
&
log_file
,
file
,
IO_SIZE
,
io_cache_type
,
...
...
@@ -237,10 +240,10 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
bool
error
;
if
(
do_magic
)
{
if
(
my_b_write
(
&
log_file
,
(
byte
*
)
BINLOG_MAGIC
,
4
)
||
open_index
(
O_APPEND
|
O_RDWR
|
O_CREAT
))
if
(
my_b_write
(
&
log_file
,
(
byte
*
)
BINLOG_MAGIC
,
BIN_LOG_HEADER_SIZE
)
||
open_index
(
O_APPEND
|
O_RDWR
|
O_CREAT
))
goto
err
;
bytes_written
+=
4
;
bytes_written
+=
BIN_LOG_HEADER_SIZE
;
}
if
(
need_start_event
&&
!
no_auto_events
)
...
...
@@ -262,7 +265,7 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
goto
err
;
}
}
return
;
DBUG_VOID_RETURN
;
err:
sql_print_error
(
"Could not use %s for logging (error %d)"
,
log_name
,
errno
);
...
...
@@ -271,7 +274,7 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
end_io_cache
(
&
log_file
);
x_free
(
name
);
name
=
0
;
log_type
=
LOG_CLOSED
;
return
;
DBUG_VOID_RETURN
;
}
int
MYSQL_LOG
::
get_current_log
(
LOG_INFO
*
linfo
)
...
...
@@ -284,6 +287,7 @@ int MYSQL_LOG::get_current_log(LOG_INFO* linfo)
}
// if log_name is "" we stop at the first entry
int
MYSQL_LOG
::
find_first_log
(
LOG_INFO
*
linfo
,
const
char
*
log_name
,
bool
need_mutex
)
{
...
...
@@ -294,8 +298,10 @@ int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name,
uint
log_name_len
=
(
uint
)
strlen
(
log_name
);
IO_CACHE
io_cache
;
// mutex needed because we need to make sure the file pointer does not move
// from under our feet
/*
Mutex needed because we need to make sure the file pointer does not move
from under our feet
*/
if
(
need_mutex
)
pthread_mutex_lock
(
&
LOCK_index
);
if
(
init_io_cache
(
&
io_cache
,
index_file
,
IO_SIZE
,
READ_CACHE
,
(
my_off_t
)
0
,
...
...
@@ -304,7 +310,7 @@ int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name,
error
=
LOG_INFO_SEEK
;
goto
err
;
}
for
(;;)
for
(;;)
{
uint
length
;
if
(
!
(
length
=
my_b_gets
(
&
io_cache
,
fname
,
FN_REFLEN
-
1
)))
...
...
@@ -336,9 +342,12 @@ int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name,
int
MYSQL_LOG
::
find_next_log
(
LOG_INFO
*
linfo
,
bool
need_lock
)
{
// mutex needed because we need to make sure the file pointer does not move
// from under our feet
if
(
index_file
<
0
)
return
LOG_INFO_INVALID
;
/*
Mutex needed because we need to make sure the file pointer does not move
from under our feet
*/
if
(
index_file
<
0
)
return
LOG_INFO_INVALID
;
int
error
=
0
;
char
*
fname
=
linfo
->
log_file_name
;
IO_CACHE
io_cache
;
...
...
@@ -382,7 +391,7 @@ int MYSQL_LOG::reset_logs(THD* thd)
goto
err
;
}
for
(;;)
for
(;;)
{
my_delete
(
linfo
.
log_file_name
,
MYF
(
MY_WME
));
if
(
find_next_log
(
&
linfo
))
...
...
@@ -490,7 +499,7 @@ int MYSQL_LOG::purge_first_log(struct st_relay_log_info* rli)
rli
->
linfo
.
log_file_name
);
goto
err2
;
}
rli
->
relay_log_pos
=
4
;
rli
->
relay_log_pos
=
BIN_LOG_HEADER_SIZE
;
strnmov
(
rli
->
relay_log_name
,
rli
->
linfo
.
log_file_name
,
sizeof
(
rli
->
relay_log_name
));
flush_relay_log_info
(
rli
);
...
...
@@ -550,7 +559,7 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log)
my_off_t
init_purge_offset
=
my_b_tell
(
&
io_cache
);
if
(
!
(
fname_len
=
my_b_gets
(
&
io_cache
,
fname
,
FN_REFLEN
)))
{
if
(
!
io_cache
.
error
)
if
(
!
io_cache
.
error
)
break
;
error
=
LOG_INFO_IO
;
goto
err
;
...
...
@@ -993,8 +1002,13 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache)
if
(
is_open
())
{
/*
We come here when the queries to be logged could not fit into memory
and part of the queries are stored in a log file on disk.
*/
uint
length
;
/
/QQ: this looks like a bug - why READ_CACHE?
/
* Read from the file used to cache the queries .*/
if
(
reinit_io_cache
(
cache
,
READ_CACHE
,
0
,
0
,
0
))
{
sql_print_error
(
ER
(
ER_ERROR_ON_WRITE
),
cache
->
file_name
,
errno
);
...
...
@@ -1003,6 +1017,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache)
length
=
my_b_bytes_in_cache
(
cache
);
do
{
/* Write data to the binary log file */
if
(
my_b_write
(
&
log_file
,
cache
->
read_pos
,
length
))
{
if
(
!
write_error
)
...
...
@@ -1168,19 +1183,23 @@ void MYSQL_LOG:: wait_for_update(THD* thd)
const
char
*
old_msg
=
thd
->
enter_cond
(
&
update_cond
,
&
LOCK_log
,
"Slave: waiting for binlog update"
);
pthread_cond_wait
(
&
update_cond
,
&
LOCK_log
);
// this is not a bug - we unlock the mutex for the caller, and expect him
// to lock it and then not unlock it upon return. This is a rather odd
// way of doing things, but this is the cleanest way I could think of to
// solve the race deadlock caused by THD::awake() first acquiring mysys_var
// mutex and then the current mutex, while wait_for_update being called with
// the current mutex already aquired and THD::exit_cond() trying to acquire
// mysys_var mutex. We do need the mutex to be acquired prior to the
// invocation of wait_for_update in all cases, so mutex acquisition inside
// wait_for_update() is not an option
/*
This is not a bug:
We unlock the mutex for the caller, and expect him to lock it and
then not unlock it upon return. This is a rather odd way of doing
things, but this is the cleanest way I could think of to solve the
race deadlock caused by THD::awake() first acquiring mysys_var
mutex and then the current mutex, while wait_for_update being
called with the current mutex already aquired and THD::exit_cond()
trying to acquire mysys_var mutex. We do need the mutex to be
acquired prior to the invocation of wait_for_update in all cases,
so mutex acquisition inside wait_for_update() is not an option.
*/
pthread_mutex_unlock
(
&
LOCK_log
);
thd
->
exit_cond
(
old_msg
);
}
void
MYSQL_LOG
::
close
(
bool
exiting
)
{
// One can't set log_type here!
if
(
is_open
())
...
...
sql/log_event.cc
View file @
268e82a0
This diff is collapsed.
Click to expand it.
sql/mysqld.cc
View file @
268e82a0
...
...
@@ -3472,12 +3472,12 @@ static struct my_option my_long_options[] =
{
"query_cache_limit"
,
OPT_QUERY_CACHE_LIMIT
,
"Don't cache results that are bigger than this."
,
(
gptr
*
)
&
query_cache_limit
,
(
gptr
*
)
&
query_cache_limit
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
1024
*
1024L
,
0
,
ULONG_MAX
,
0
,
1
,
0
},
REQUIRED_ARG
,
1024
*
1024L
,
0
,
(
longlong
)
ULONG_MAX
,
0
,
1
,
0
},
#endif
/*HAVE_QUERY_CACHE*/
{
"query_cache_size"
,
OPT_QUERY_CACHE_SIZE
,
"The memory allocated to store results from old queries."
,
(
gptr
*
)
&
query_cache_size
,
(
gptr
*
)
&
query_cache_size
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
0
,
0
,
ULONG_MAX
,
0
,
1
,
0
},
REQUIRED_ARG
,
0
,
0
,
(
longlong
)
ULONG_MAX
,
0
,
1
,
0
},
#ifdef HAVE_QUERY_CACHE
{
"query_cache_startup_type"
,
OPT_QUERY_CACHE_STARTUP_TYPE
,
"0 = OFF = Don't cache or retrieve results. 1 = ON = Cache all results except SELECT SQL_NO_CACHE ... queries. 2 = DEMAND = Cache only SELECT SQL_CACHE ... queries."
,
...
...
@@ -3497,7 +3497,7 @@ static struct my_option my_long_options[] =
{
"relay_log_space_limit"
,
OPT_RELAY_LOG_SPACE_LIMIT
,
"Undocumented"
,
(
gptr
*
)
&
relay_log_space_limit
,
(
gptr
*
)
&
relay_log_space_limit
,
0
,
GET_ULONG
,
REQUIRED_ARG
,
0L
,
0L
,
ULONG_MAX
,
0
,
1
,
0
},
(
longlong
)
ULONG_MAX
,
0
,
1
,
0
},
{
"slave_net_timeout"
,
OPT_SLAVE_NET_TIMEOUT
,
"Number of seconds to wait for more data from a master/slave connection before aborting the read."
,
(
gptr
*
)
&
slave_net_timeout
,
(
gptr
*
)
&
slave_net_timeout
,
0
,
...
...
sql/repl_failsafe.cc
View file @
268e82a0
...
...
@@ -670,8 +670,10 @@ int load_master_data(THD* thd)
int
restart_thread_mask
;
mc_mysql_init
(
&
mysql
);
// we do not want anyone messing with the slave at all for the entire
// duration of the data load;
/*
We do not want anyone messing with the slave at all for the entire
duration of the data load.
*/
LOCK_ACTIVE_MI
;
lock_slave_threads
(
active_mi
);
init_thread_mask
(
&
restart_thread_mask
,
active_mi
,
0
/*not inverse*/
);
...
...
@@ -707,8 +709,10 @@ int load_master_data(THD* thd)
if
(
!
(
num_dbs
=
(
uint
)
mc_mysql_num_rows
(
db_res
)))
goto
err
;
// in theory, the master could have no databases at all
// and run with skip-grant
/*
In theory, the master could have no databases at all
and run with skip-grant
*/
if
(
!
(
table_res
=
(
MYSQL_RES
**
)
thd
->
alloc
(
num_dbs
*
sizeof
(
MYSQL_RES
*
))))
{
...
...
@@ -716,10 +720,12 @@ int load_master_data(THD* thd)
goto
err
;
}
// this is a temporary solution until we have online backup
// capabilities - to be replaced once online backup is working
// we wait to issue FLUSH TABLES WITH READ LOCK for as long as we
// can to minimize the lock time
/*
This is a temporary solution until we have online backup
capabilities - to be replaced once online backup is working
we wait to issue FLUSH TABLES WITH READ LOCK for as long as we
can to minimize the lock time.
*/
if
(
mc_mysql_query
(
&
mysql
,
"FLUSH TABLES WITH READ LOCK"
,
0
)
||
mc_mysql_query
(
&
mysql
,
"SHOW MASTER STATUS"
,
0
)
||
!
(
master_status_res
=
mc_mysql_store_result
(
&
mysql
)))
...
...
@@ -729,8 +735,10 @@ int load_master_data(THD* thd)
goto
err
;
}
// go through every table in every database, and if the replication
// rules allow replicating it, get it
/*
Go through every table in every database, and if the replication
rules allow replicating it, get it
*/
table_res_end
=
table_res
+
num_dbs
;
...
...
@@ -819,7 +827,7 @@ int load_master_data(THD* thd)
}
}
thd
->
proc_info
=
"purging old relay logs"
;
if
(
purge_relay_logs
(
&
active_mi
->
rli
,
0
/* not only reset, but also reinit*/
,
if
(
purge_relay_logs
(
&
active_mi
->
rli
,
0
/* not only reset, but also reinit
*/
,
&
errmsg
))
{
send_error
(
&
thd
->
net
,
0
,
"Failed purging old relay logs"
);
...
...
sql/slave.cc
View file @
268e82a0
This diff is collapsed.
Click to expand it.
sql/slave.h
View file @
268e82a0
...
...
@@ -84,18 +84,9 @@ typedef struct st_relay_log_info
volatile
my_off_t
master_log_pos
;
/*
current offset in the relay log.
pending - in some cases we do not increment offset immediately after
processing an event, because the following event needs to be processed
atomically together with this one ( so far, there is only one type of
such event - Intvar_event that sets auto_increment value). However, once
both events have been processed, we need to increment by the cumulative
offset. pending stored the extra offset to be added to the position.
Protected with internal locks.
Must get data_lock when resetting the logs.
*/
ulonglong
relay_log_pos
,
pending
;
// protected with internal locks
// must get data_lock when resetting the logs
MYSQL_LOG
relay_log
;
LOG_INFO
linfo
;
IO_CACHE
cache_buf
,
*
cur_log
;
...
...
@@ -125,9 +116,6 @@ typedef struct st_relay_log_info
*/
pthread_cond_t
start_cond
,
stop_cond
,
data_cond
;
// if not set, the value of other members of the structure are undefined
bool
inited
;
// parent master info structure
struct
st_master_info
*
mi
;
...
...
@@ -135,9 +123,19 @@ typedef struct st_relay_log_info
Needed to deal properly with cur_log getting closed and re-opened with
a different log under our feet
*/
int
cur_log_init
_count
;
uint32
cur_log_old_open
_count
;
volatile
bool
abort_slave
,
slave_running
;
/*
current offset in the relay log.
pending - in some cases we do not increment offset immediately after
processing an event, because the following event needs to be processed
atomically together with this one ( so far, there is only one type of
such event - Intvar_event that sets auto_increment value). However, once
both events have been processed, we need to increment by the cumulative
offset. pending stored the extra offset to be added to the position.
*/
ulonglong
relay_log_pos
,
pending
;
ulonglong
log_space_limit
,
log_space_total
;
/*
Needed for problems when slave stops and we want to restart it
...
...
@@ -145,45 +143,47 @@ typedef struct st_relay_log_info
errors, and have been manually applied by DBA already.
*/
volatile
uint32
slave_skip_counter
;
pthread_mutex_t
log_space_lock
;
pthread_cond_t
log_space_cond
;
THD
*
sql_thd
;
int
last_slave_errno
;
#ifndef DBUG_OFF
int
events_till_abort
;
#endif
int
last_slave_errno
;
char
last_slave_error
[
MAX_SLAVE_ERRMSG
];
THD
*
sql_thd
;
// if not set, the value of other members of the structure are undefined
bool
inited
;
volatile
bool
abort_slave
,
slave_running
;
bool
log_pos_current
;
bool
abort_pos_wait
;
bool
skip_log_purge
;
ulonglong
log_space_limit
,
log_space_total
;
pthread_mutex_t
log_space_lock
;
pthread_cond_t
log_space_cond
;
st_relay_log_info
()
:
info_fd
(
-
1
),
cur_log_fd
(
-
1
),
inited
(
0
),
cur_log_init_count
(
0
),
abort_slave
(
0
),
slave_running
(
0
),
log_pos_current
(
0
),
abort_pos_wait
(
0
),
skip_log_purge
(
0
)
{
relay_log_name
[
0
]
=
master_log_name
[
0
]
=
0
;
bzero
(
&
info_file
,
sizeof
(
info_file
));
pthread_mutex_init
(
&
run_lock
,
MY_MUTEX_INIT_FAST
);
pthread_mutex_init
(
&
data_lock
,
MY_MUTEX_INIT_FAST
);
pthread_mutex_init
(
&
log_space_lock
,
MY_MUTEX_INIT_FAST
);
pthread_cond_init
(
&
data_cond
,
NULL
);
pthread_cond_init
(
&
start_cond
,
NULL
);
pthread_cond_init
(
&
stop_cond
,
NULL
);
pthread_cond_init
(
&
log_space_cond
,
NULL
);
}
st_relay_log_info
()
:
info_fd
(
-
1
),
cur_log_fd
(
-
1
),
cur_log_old_open_count
(
0
),
inited
(
0
),
abort_slave
(
0
),
slave_running
(
0
),
log_pos_current
(
0
),
abort_pos_wait
(
0
),
skip_log_purge
(
0
)
{
relay_log_name
[
0
]
=
master_log_name
[
0
]
=
0
;
bzero
(
&
info_file
,
sizeof
(
info_file
));
pthread_mutex_init
(
&
run_lock
,
MY_MUTEX_INIT_FAST
);
pthread_mutex_init
(
&
data_lock
,
MY_MUTEX_INIT_FAST
);
pthread_mutex_init
(
&
log_space_lock
,
MY_MUTEX_INIT_FAST
);
pthread_cond_init
(
&
data_cond
,
NULL
);
pthread_cond_init
(
&
start_cond
,
NULL
);
pthread_cond_init
(
&
stop_cond
,
NULL
);
pthread_cond_init
(
&
log_space_cond
,
NULL
);
}
~
st_relay_log_info
()
{
pthread_mutex_destroy
(
&
run_lock
);
pthread_mutex_destroy
(
&
data_lock
);
pthread_mutex_destroy
(
&
log_space_lock
);
pthread_cond_destroy
(
&
data_cond
);
pthread_cond_destroy
(
&
start_cond
);
pthread_cond_destroy
(
&
stop_cond
);
pthread_cond_destroy
(
&
log_space_cond
);
}
{
pthread_mutex_destroy
(
&
run_lock
);
pthread_mutex_destroy
(
&
data_lock
);
pthread_mutex_destroy
(
&
log_space_lock
);
pthread_cond_destroy
(
&
data_cond
);
pthread_cond_destroy
(
&
start_cond
);
pthread_cond_destroy
(
&
stop_cond
);
pthread_cond_destroy
(
&
log_space_cond
);
}
inline
void
inc_pending
(
ulonglong
val
)
{
pending
+=
val
;
...
...
@@ -215,40 +215,33 @@ typedef struct st_relay_log_info
int
wait_for_pos
(
THD
*
thd
,
String
*
log_name
,
ulonglong
log_pos
);
}
RELAY_LOG_INFO
;
/*
repopen_relay_log() is called when we notice that the current "hot" log
got rotated under our feet
*/
IO_CACHE
*
reopen_relay_log
(
RELAY_LOG_INFO
*
rli
,
const
char
**
errmsg
);
Log_event
*
next_event
(
RELAY_LOG_INFO
*
rli
);
/*
st_master_info contains information about how to connect to a master,
current master log name, and current log offset, as well as misc
control variables
current master log name, and current log offset, as well as misc
control variables
st_master_info is initialized once from the master.info file if such
exists. Otherwise, data members corresponding to master.info fields are
initialized with defaults specified by master-* options. The initialization
is done through init_master_info() call.
st_master_info is initialized once from the master.info file if such
exists. Otherwise, data members corresponding to master.info fields
are initialized with defaults specified by master-* options. The
initialization
is done through init_master_info() call.
The format of master.info file:
The format of master.info file:
log_name
log_pos
master_host
master_user
master_pass
master_port
master_connect_retry
log_name
log_pos
master_host
master_user
master_pass
master_port
master_connect_retry
To write out the contents of master.info file to disk ( needed every
time we read and queue data from the master ), a call to
flush_master_info() is required.
To write out the contents of master.info file to disk ( needed every
time we read and queue data from the master ), a call to
flush_master_info() is required.
To clean up, call end_master_info()
To clean up, call end_master_info()
*/
...
...
sql/sql_class.h
View file @
268e82a0
...
...
@@ -60,48 +60,49 @@ class Log_event;
class
MYSQL_LOG
{
private:
pthread_mutex_t
LOCK_log
,
LOCK_index
;
pthread_cond_t
update_cond
;
ulonglong
bytes_written
;
time_t
last_time
,
query_start
;
IO_CACHE
log_file
;
File
index_file
;
char
*
name
;
volatile
enum_log_type
log_type
;
char
time_buff
[
20
],
db
[
NAME_LEN
+
1
];
char
log_file_name
[
FN_REFLEN
],
index_file_name
[
FN_REFLEN
];
bool
write_error
,
inited
;
uint
file_id
;
// current file sequence number for load data infile
// binary logging
bool
no_rotate
;
// for binlog - if log name can never change
// we should not try to rotate it or write any rotation events
// the user should use FLUSH MASTER instead of FLUSH LOGS for
// purging
// current file sequence number for load data infile binary logging
uint
file_id
;
uint
open_count
;
// For replication
/*
For binlog - if log name can never change we should not try to rotate it
or write any rotation events. The user should use FLUSH MASTER instead
of FLUSH LOGS for purging.
*/
volatile
enum_log_type
log_type
;
enum
cache_type
io_cache_type
;
bool
write_error
,
inited
;
bool
no_rotate
;
bool
need_start_event
;
pthread_cond_t
update_cond
;
bool
no_auto_events
;
// for relay binlog
ulonglong
bytes_written
;
friend
class
Log_event
;
public:
MYSQL_LOG
();
~
MYSQL_LOG
();
pthread_mutex_t
*
get_log_lock
()
{
return
&
LOCK_log
;
}
void
reset_bytes_written
()
{
bytes_written
=
0
;
}
{
bytes_written
=
0
;
}
void
harvest_bytes_written
(
ulonglong
*
counter
)
{
{
#ifndef DBUG_OFF
char
buf1
[
22
],
buf2
[
22
];
char
buf1
[
22
],
buf2
[
22
];
#endif
DBUG_ENTER
(
"harvest_bytes_written"
);
(
*
counter
)
+=
bytes_written
;
DBUG_PRINT
(
"info"
,(
"counter=%s,bytes_written=%s"
,
llstr
(
*
counter
,
buf1
),
llstr
(
bytes_written
,
buf2
)));
bytes_written
=
0
;
DBUG_VOID_RETURN
;
}
IO_CACHE
*
get_log_file
()
{
return
&
log_file
;
}
DBUG_ENTER
(
"harvest_bytes_written"
);
(
*
counter
)
+=
bytes_written
;
DBUG_PRINT
(
"info"
,(
"counter: %s bytes_written: %s"
,
llstr
(
*
counter
,
buf1
),
llstr
(
bytes_written
,
buf2
)));
bytes_written
=
0
;
DBUG_VOID_RETURN
;
}
void
signal_update
()
{
pthread_cond_broadcast
(
&
update_cond
);}
void
wait_for_update
(
THD
*
thd
);
void
set_need_start_event
()
{
need_start_event
=
1
;
}
...
...
@@ -135,8 +136,8 @@ class MYSQL_LOG {
int
purge_logs
(
THD
*
thd
,
const
char
*
to_log
);
int
purge_first_log
(
struct
st_relay_log_info
*
rli
);
int
reset_logs
(
THD
*
thd
);
void
close
(
bool
exiting
=
0
);
// if we are exiting, we also want to close th
e
// index file
// if we are exiting, we also want to close the index fil
e
void
close
(
bool
exiting
=
0
);
// iterating through the log index file
int
find_first_log
(
LOG_INFO
*
linfo
,
const
char
*
log_name
,
...
...
@@ -146,11 +147,15 @@ class MYSQL_LOG {
uint
next_file_id
();
inline
bool
is_open
()
{
return
log_type
!=
LOG_CLOSED
;
}
char
*
get_index_fname
()
{
return
index_file_name
;}
char
*
get_log_fname
()
{
return
log_file_name
;
}
void
lock_index
()
{
pthread_mutex_lock
(
&
LOCK_index
);}
void
unlock_index
()
{
pthread_mutex_unlock
(
&
LOCK_index
);}
File
get_index_file
()
{
return
index_file
;}
inline
char
*
get_index_fname
()
{
return
index_file_name
;}
inline
char
*
get_log_fname
()
{
return
log_file_name
;
}
inline
pthread_mutex_t
*
get_log_lock
()
{
return
&
LOCK_log
;
}
inline
IO_CACHE
*
get_log_file
()
{
return
&
log_file
;
}
inline
void
lock_index
()
{
pthread_mutex_lock
(
&
LOCK_index
);}
inline
void
unlock_index
()
{
pthread_mutex_unlock
(
&
LOCK_index
);}
inline
File
get_index_file
()
{
return
index_file
;}
inline
uint32
get_open_count
()
{
return
open_count
;
}
};
/* character conversion tables */
...
...
sql/sql_delete.cc
View file @
268e82a0
...
...
@@ -573,9 +573,15 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
}
send_ok
(
&
thd
->
net
);
// This should return record count
}
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
unlock_table_name
(
thd
,
table_list
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
}
else
if
(
error
)
{
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
unlock_table_name
(
thd
,
table_list
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
}
DBUG_RETURN
(
error
?
-
1
:
0
);
}
sql/sql_insert.cc
View file @
268e82a0
...
...
@@ -332,7 +332,9 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
{
char
buff
[
160
];
if
(
duplic
==
DUP_IGNORE
)
sprintf
(
buff
,
ER
(
ER_INSERT_INFO
),
info
.
records
,
info
.
records
-
info
.
copied
,
sprintf
(
buff
,
ER
(
ER_INSERT_INFO
),
info
.
records
,
(
lock_type
==
TL_WRITE_DELAYED
)
?
0
:
info
.
records
-
info
.
copied
,
thd
->
cuted_fields
);
else
sprintf
(
buff
,
ER
(
ER_INSERT_INFO
),
info
.
records
,
info
.
deleted
,
...
...
sql/sql_parse.cc
View file @
268e82a0
...
...
@@ -1963,11 +1963,6 @@ mysql_execute_command(void)
(
void
)
add_item_to_list
(
new
Item_field
(
auxi
->
db
,
auxi
->
real_name
,
"*"
));
}
tables
->
grant
.
want_privilege
=
(
SELECT_ACL
&
~
tables
->
grant
.
privilege
);
if
(
add_item_to_list
(
new
Item_null
()))
{
res
=
-
1
;
break
;
}
thd
->
proc_info
=
"init"
;
if
((
res
=
open_and_lock_tables
(
thd
,
tables
)))
break
;
...
...
@@ -2896,6 +2891,7 @@ bool add_field_to_list(char *field_name, enum_field_types type,
case
FIELD_TYPE_STRING
:
case
FIELD_TYPE_VAR_STRING
:
case
FIELD_TYPE_NULL
:
case
FIELD_TYPE_GEOMETRY
:
break
;
case
FIELD_TYPE_DECIMAL
:
if
(
!
length
)
...
...
sql/sql_repl.cc
View file @
268e82a0
...
...
@@ -154,6 +154,7 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
const
char
**
errmsg
)
{
File
file
;
DBUG_ENTER
(
"open_binlog"
);
if
((
file
=
my_open
(
log_file_name
,
O_RDONLY
|
O_BINARY
,
MYF
(
MY_WME
)))
<
0
||
init_io_cache
(
log
,
file
,
IO_SIZE
*
2
,
READ_CACHE
,
0
,
0
,
...
...
@@ -164,7 +165,7 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
}
if
(
check_binlog_magic
(
log
,
errmsg
))
goto
err
;
return
file
;
DBUG_RETURN
(
file
)
;
err:
if
(
file
>=
0
)
...
...
@@ -172,7 +173,7 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
my_close
(
file
,
MYF
(
0
));
end_io_cache
(
log
);
}
return
-
1
;
DBUG_RETURN
(
-
1
)
;
}
...
...
@@ -628,7 +629,8 @@ int reset_slave(MASTER_INFO* mi)
char
fname
[
FN_REFLEN
];
int
restart_thread_mask
=
0
,
error
=
0
;
const
char
*
errmsg
=
0
;
DBUG_ENTER
(
"reset_slave"
);
lock_slave_threads
(
mi
);
init_thread_mask
(
&
restart_thread_mask
,
mi
,
0
/* not inverse */
);
if
((
error
=
terminate_slave_threads
(
mi
,
restart_thread_mask
,
1
/*skip lock*/
))
...
...
@@ -649,14 +651,14 @@ int reset_slave(MASTER_INFO* mi)
goto
err
;
}
if
(
restart_thread_mask
)
error
=
start_slave_threads
(
0
/* mutex not needed
*/
,
1
/* wait for start*/
,
mi
,
master_info_file
,
relay_log_info_file
,
restart_thread_mask
);
error
=
start_slave_threads
(
0
/* mutex not needed
*/
,
1
/* wait for start*/
,
mi
,
master_info_file
,
relay_log_info_file
,
restart_thread_mask
);
// TODO: fix error messages so they get to the client
err:
unlock_slave_threads
(
mi
);
return
error
;
DBUG_RETURN
(
error
)
;
}
void
kill_zombie_dump_threads
(
uint32
slave_server_id
)
...
...
sql/unireg.h
View file @
268e82a0
...
...
@@ -129,6 +129,10 @@ bfill((A)->null_flags,(A)->null_bytes,255);\
*/
#define MIN_TURBOBM_PATTERN_LEN 3
/* Defines for binary logging */
#define BIN_LOG_HEADER_SIZE 4
/* Include prototypes for unireg */
#include "mysqld_error.h"
...
...
tests/truncate.pl
0 → 100755
View file @
268e82a0
#!/usr/bin/perl -w
#
# This is a test with uses many processes to test a MySQL server.
#
$opt_loop_count
=
10000
;
# Change this to make test harder/easier
##################### Standard benchmark inits ##############################
use
DBI
;
use
Getopt::
Long
;
use
Benchmark
;
package
main
;
$opt_skip_create
=
$opt_skip_in
=
$opt_verbose
=
$opt_fast_insert
=
$opt_lock_tables
=
$opt_debug
=
$opt_skip_delete
=
$opt_fast
=
$opt_force
=
0
;
$opt_threads
=
2
;
$opt_host
=
$opt_user
=
$opt_password
=
"";
$opt_db
=
"
test
";
GetOptions
("
host=s
","
db=s
","
user=s
","
password=s
","
loop-count=i
","
skip-create
","
skip-in
","
skip-delete
","
verbose
","
fast-insert
","
lock-tables
","
debug
","
fast
","
force
","
threads=i
")
||
die
"
Aborted
";
$opt_verbose
=
$opt_debug
=
$opt_lock_tables
=
$opt_fast_insert
=
$opt_fast
=
$opt_skip_in
=
$opt_force
=
undef
;
# Ignore warnings from these
print
"
Testing truncate from
$opt_threads
multiple connections
$opt_loop_count
times
\n
";
@testtables
=
(
["
bench_f31
",
"
type=heap
"]);
####
#### Start timeing and start test
####
$start_time
=
new
Benchmark
;
$dbh
=
DBI
->
connect
("
DBI:mysql:
$opt_db
:
$opt_host
",
$opt_user
,
$opt_password
,
{
PrintError
=>
0
})
||
die
$
DBI::
errstr
;
if
(
!
$opt_skip_create
)
{
my
$table_def
;
foreach
$table_def
(
@testtables
)
{
my
(
$table
,
$extra
)
=
(
$table_def
->
[
0
],
$table_def
->
[
1
]);
print
"
Creating table
$table
in database
$opt_db
\n
";
$dbh
->
do
("
drop table if exists
$table
");
$dbh
->
do
("
create table
$table
"
.
"
(id int(6) not null,
"
.
"
info varchar(32),
"
.
"
marker timestamp,
"
.
"
flag int not null,
"
.
"
primary key(id))
$extra
")
or
die
$
DBI::
errstr
;
}
}
$dbh
->
disconnect
;
$dbh
=
0
;
# Close handler
$|
=
1
;
# Autoflush
####
#### Start the tests
####
for
(
$i
=
0
;
$i
<
$opt_threads
;
$i
++
)
{
test_truncate
()
if
((
$pid
=
fork
())
==
0
);
$work
{
$pid
}
=
"
truncate
";
}
print
"
Started
$opt_threads
threads
\n
";
$errors
=
0
;
$running_insert_threads
=
$opt_threads
;
while
((
$pid
=
wait
())
!=
-
1
)
{
$ret
=
$?
/
256
;
print
"
thread '
"
.
$work
{
$pid
}
.
"
' finished with exit code
$ret
\n
";
--
$running_insert_threads
;
$errors
++
if
(
$ret
!=
0
);
}
#
# Cleanup
#
if
(
!
$opt_skip_delete
&&
!
$errors
)
{
my
$table_def
;
$dbh
=
DBI
->
connect
("
DBI:mysql:
$opt_db
:
$opt_host
",
$opt_user
,
$opt_password
,
{
PrintError
=>
0
})
||
die
$
DBI::
errstr
;
foreach
$table_def
(
@testtables
)
{
$dbh
->
do
("
drop table
"
.
$table_def
->
[
0
]);
}
$dbh
->
disconnect
;
$dbh
=
0
;
# Close handler
}
print
(
$errors
?
"
Test failed
\n
"
:"
Test ok
\n
");
$end_time
=
new
Benchmark
;
print
"
Total time:
"
.
timestr
(
timediff
(
$end_time
,
$start_time
),"
noc
")
.
"
\n
";
exit
(
0
);
#
# Insert records in the table
#
sub
test_truncate
{
my
(
$dbh
,
$i
,
$j
,
$count
,
$table_def
,
$table
);
$dbh
=
DBI
->
connect
("
DBI:mysql:
$opt_db
:
$opt_host
",
$opt_user
,
$opt_password
,
{
PrintError
=>
0
})
||
die
$
DBI::
errstr
;
for
(
$count
=
0
;
$count
<
$opt_loop_count
;
$count
++
)
{
my
(
$table
)
=
(
$testtables
[
0
]
->
[
0
]);
$dbh
->
do
("
truncate table
$table
")
||
die
"
Got error on truncate:
$DBI
::errstr
\n
";
}
$dbh
->
disconnect
;
$dbh
=
0
;
print
"
Test_truncate: Run
$count
times
\n
";
exit
(
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