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
7a543344
Commit
7a543344
authored
Jun 05, 2003
by
monty@narttu.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
Merge with 4.0.13
parents
dad06645
e6cdc816
Changes
27
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
565 additions
and
294 deletions
+565
-294
include/thr_alarm.h
include/thr_alarm.h
+1
-1
innobase/com/com0shm.c
innobase/com/com0shm.c
+6
-3
innobase/include/os0sync.h
innobase/include/os0sync.h
+33
-18
innobase/include/os0sync.ic
innobase/include/os0sync.ic
+0
-1
innobase/include/os0thread.h
innobase/include/os0thread.h
+3
-1
innobase/os/os0file.c
innobase/os/os0file.c
+42
-39
innobase/os/os0sync.c
innobase/os/os0sync.c
+104
-101
innobase/os/os0thread.c
innobase/os/os0thread.c
+4
-0
innobase/srv/srv0srv.c
innobase/srv/srv0srv.c
+43
-1
innobase/srv/srv0start.c
innobase/srv/srv0start.c
+26
-6
mysql-test/r/func_str.result
mysql-test/r/func_str.result
+1
-1
mysql-test/r/rpl_loaddata.result
mysql-test/r/rpl_loaddata.result
+6
-0
mysql-test/t/rpl_loaddata.test
mysql-test/t/rpl_loaddata.test
+17
-0
mysys/thr_alarm.c
mysys/thr_alarm.c
+20
-9
sql/ha_innodb.cc
sql/ha_innodb.cc
+146
-76
sql/handler.cc
sql/handler.cc
+6
-2
sql/item_strfunc.cc
sql/item_strfunc.cc
+4
-4
sql/log_event.cc
sql/log_event.cc
+32
-7
sql/mysqld.cc
sql/mysqld.cc
+12
-5
sql/net_serv.cc
sql/net_serv.cc
+9
-4
sql/slave.cc
sql/slave.cc
+8
-3
sql/sql_parse.cc
sql/sql_parse.cc
+8
-1
sql/sql_repl.cc
sql/sql_repl.cc
+1
-7
sql/sql_yacc.yy
sql/sql_yacc.yy
+14
-0
sql/unireg.h
sql/unireg.h
+6
-3
support-files/mysql.server.sh
support-files/mysql.server.sh
+1
-1
support-files/mysql.spec.sh
support-files/mysql.spec.sh
+12
-0
No files found.
include/thr_alarm.h
View file @
7a543344
...
@@ -100,7 +100,7 @@ typedef struct st_alarm {
...
@@ -100,7 +100,7 @@ typedef struct st_alarm {
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0)
#define thr_alarm_in_use(A) (*(A)!= 0)
void
init_thr_alarm
(
uint
max_alarm
);
void
init_thr_alarm
(
uint
max_alarm
);
bool
thr_alarm
(
thr_alarm_t
*
alarmed
,
uint
sec
,
ALARM
*
buff
);
my_
bool
thr_alarm
(
thr_alarm_t
*
alarmed
,
uint
sec
,
ALARM
*
buff
);
void
thr_alarm_kill
(
pthread_t
thread_id
);
void
thr_alarm_kill
(
pthread_t
thread_id
);
void
thr_end_alarm
(
thr_alarm_t
*
alarmed
);
void
thr_end_alarm
(
thr_alarm_t
*
alarmed
);
void
end_thr_alarm
(
my_bool
free_structures
);
void
end_thr_alarm
(
my_bool
free_structures
);
...
...
innobase/com/com0shm.c
View file @
7a543344
...
@@ -103,7 +103,8 @@ struct com_shm_endpoint_struct{
...
@@ -103,7 +103,8 @@ struct com_shm_endpoint_struct{
the area currently may contain a datagram;
the area currently may contain a datagram;
NOTE: automatic event */
NOTE: automatic event */
os_event_t
empty
;
/* this is in the signaled state if the area
os_event_t
empty
;
/* this is in the signaled state if the area
currently may be empty; NOTE: automatic event */
currently may be empty; NOTE: automatic
event */
ip_mutex_hdl_t
*
ip_mutex
;
/* handle to the interprocess mutex
ip_mutex_hdl_t
*
ip_mutex
;
/* handle to the interprocess mutex
protecting the shared memory */
protecting the shared memory */
UT_LIST_NODE_T
(
com_shm_endpoint_t
)
list
;
/* If the endpoint struct
UT_LIST_NODE_T
(
com_shm_endpoint_t
)
list
;
/* If the endpoint struct
...
@@ -793,16 +794,18 @@ com_shm_create_or_open(
...
@@ -793,16 +794,18 @@ com_shm_create_or_open(
ut_strcpy
(
buf
+
len
,
(
char
*
)
"_IBSHM_EV_NE"
),
ut_strcpy
(
buf
+
len
,
(
char
*
)
"_IBSHM_EV_NE"
),
event_ne
=
os_event_create
_auto
(
buf
);
event_ne
=
os_event_create
(
buf
);
ut_ad
(
event_ne
);
ut_ad
(
event_ne
);
ut_strcpy
(
buf
+
len
,
(
char
*
)
"_IBSHM_EV_EM"
),
ut_strcpy
(
buf
+
len
,
(
char
*
)
"_IBSHM_EV_EM"
),
event_em
=
os_event_create
_auto
(
buf
);
event_em
=
os_event_create
(
buf
);
ut_ad
(
event_em
);
ut_ad
(
event_em
);
ut_a
(
0
);
/* event_ne and event_em should be auto events! */
com_shm_endpoint_set_shm
(
ep
,
shm
);
com_shm_endpoint_set_shm
(
ep
,
shm
);
com_shm_endpoint_set_map
(
ep
,
map
);
com_shm_endpoint_set_map
(
ep
,
map
);
...
...
innobase/include/os0sync.h
View file @
7a543344
...
@@ -13,13 +13,26 @@ Created 9/6/1995 Heikki Tuuri
...
@@ -13,13 +13,26 @@ Created 9/6/1995 Heikki Tuuri
#include "ut0lst.h"
#include "ut0lst.h"
#ifdef __WIN__
#ifdef __WIN__
#define os_fast_mutex_t CRITICAL_SECTION
#define os_fast_mutex_t CRITICAL_SECTION
typedef
HANDLE
os_event_t
;
typedef
HANDLE
os_native_event_t
;
typedef
struct
os_event_struct
os_event_struct_t
;
typedef
os_event_struct_t
*
os_event_t
;
struct
os_event_struct
{
os_native_event_t
handle
;
/* Windows event */
UT_LIST_NODE_T
(
os_event_struct_t
)
os_event_list
;
/* list of all created events */
};
#else
#else
typedef
pthread_mutex_t
os_fast_mutex_t
;
typedef
pthread_mutex_t
os_fast_mutex_t
;
typedef
struct
os_event_struct
os_event_struct_t
;
typedef
struct
os_event_struct
os_event_struct_t
;
typedef
os_event_struct_t
*
os_event_t
;
typedef
os_event_struct_t
*
os_event_t
;
struct
os_event_struct
{
struct
os_event_struct
{
os_fast_mutex_t
os_mutex
;
/* this mutex protects the next
os_fast_mutex_t
os_mutex
;
/* this mutex protects the next
fields */
fields */
...
@@ -39,16 +52,16 @@ typedef os_mutex_str_t* os_mutex_t;
...
@@ -39,16 +52,16 @@ typedef os_mutex_str_t* os_mutex_t;
#define OS_SYNC_TIME_EXCEEDED 1
#define OS_SYNC_TIME_EXCEEDED 1
/* Mutex protecting
the thread count and
event and OS 'slow' mutex lists */
/* Mutex protecting
counts and the
event and OS 'slow' mutex lists */
extern
os_mutex_t
os_sync_mutex
;
extern
os_mutex_t
os_sync_mutex
;
/* This is incremented by 1 in os_thread_create and decremented by 1 in
/* This is incremented by 1 in os_thread_create and decremented by 1 in
os_thread_exit */
os_thread_exit */
extern
ulint
os_thread_count
;
extern
ulint
os_thread_count
;
/* The following are approximate counters for debugging in Unix */
extern
ulint
os_event_count
;
extern
ulint
os_event_count
;
extern
ulint
os_mutex_count
;
extern
ulint
os_mutex_count
;
extern
ulint
os_fast_mutex_count
;
/*************************************************************
/*************************************************************
Initializes global event and OS 'slow' mutex lists. */
Initializes global event and OS 'slow' mutex lists. */
...
@@ -57,15 +70,14 @@ void
...
@@ -57,15 +70,14 @@ void
os_sync_init
(
void
);
os_sync_init
(
void
);
/*==============*/
/*==============*/
/*************************************************************
/*************************************************************
Frees created events
(not in Windows)
and OS 'slow' mutexes. */
Frees created events and OS 'slow' mutexes. */
void
void
os_sync_free
(
void
);
os_sync_free
(
void
);
/*==============*/
/*==============*/
/*************************************************************
/*************************************************************
Creates an event semaphore, i.e., a semaphore which may
Creates an event semaphore, i.e., a semaphore which may just have two states:
just have two states: signaled and nonsignaled.
signaled and nonsignaled. The created event is manual reset: it must be reset
The created event is manual reset: it must be reset
explicitly by calling sync_os_reset_event. */
explicitly by calling sync_os_reset_event. */
os_event_t
os_event_t
...
@@ -74,10 +86,10 @@ os_event_create(
...
@@ -74,10 +86,10 @@ os_event_create(
/* out: the event handle */
/* out: the event handle */
char
*
name
);
/* in: the name of the event, if NULL
char
*
name
);
/* in: the name of the event, if NULL
the event is created without a name */
the event is created without a name */
#ifdef __WIN__
/*************************************************************
/*************************************************************
Creates an auto-reset event semaphore, i.e., an event
Creates an auto-reset event semaphore, i.e., an event which is automatically
which is automatically reset when a single thread is
reset when a single thread is released. Works only in Windows. */
released. */
os_event_t
os_event_t
os_event_create_auto
(
os_event_create_auto
(
...
@@ -85,6 +97,7 @@ os_event_create_auto(
...
@@ -85,6 +97,7 @@ os_event_create_auto(
/* out: the event handle */
/* out: the event handle */
char
*
name
);
/* in: the name of the event, if NULL
char
*
name
);
/* in: the name of the event, if NULL
the event is created without a name */
the event is created without a name */
#endif
/**************************************************************
/**************************************************************
Sets an event semaphore to the signaled state: lets waiting threads
Sets an event semaphore to the signaled state: lets waiting threads
proceed. */
proceed. */
...
@@ -120,7 +133,7 @@ os_event_wait(
...
@@ -120,7 +133,7 @@ os_event_wait(
os_event_t
event
);
/* in: event to wait */
os_event_t
event
);
/* in: event to wait */
/**************************************************************
/**************************************************************
Waits for an event object until it is in the signaled state or
Waits for an event object until it is in the signaled state or
a timeout is exceeded. */
a timeout is exceeded.
In Unix the timeout is always infinite.
*/
ulint
ulint
os_event_wait_time
(
os_event_wait_time
(
...
@@ -131,8 +144,9 @@ os_event_wait_time(
...
@@ -131,8 +144,9 @@ os_event_wait_time(
os_event_t
event
,
/* in: event to wait */
os_event_t
event
,
/* in: event to wait */
ulint
time
);
/* in: timeout in microseconds, or
ulint
time
);
/* in: timeout in microseconds, or
OS_SYNC_INFINITE_TIME */
OS_SYNC_INFINITE_TIME */
#ifdef __WIN__
/**************************************************************
/**************************************************************
Waits for any event in an event array. Returns if even a single
Waits for any event in an
OS native
event array. Returns if even a single
one is signaled or becomes signaled. */
one is signaled or becomes signaled. */
ulint
ulint
...
@@ -140,14 +154,15 @@ os_event_wait_multiple(
...
@@ -140,14 +154,15 @@ os_event_wait_multiple(
/*===================*/
/*===================*/
/* out: index of the event
/* out: index of the event
which was signaled */
which was signaled */
ulint
n
,
/* in: number of events in the
ulint
n
,
/* in: number of events in the
array */
array */
os_event_t
*
event_array
);
/* in: pointer to an array of event
os_native_event_t
*
native_event_array
);
/* in: pointer to an array of event
handles */
handles */
#endif
/*************************************************************
/*************************************************************
Creates an operating system mutex semaphore.
Creates an operating system mutex semaphore. Because these are slow, the
Because these are slow, the mutex semaphore of the database
mutex semaphore of InnoDB itself (mutex_t) should be used where possible. */
itself (sync_mutex_t) should be used where possible. */
os_mutex_t
os_mutex_t
os_mutex_create
(
os_mutex_create
(
...
...
innobase/include/os0sync.ic
View file @
7a543344
...
@@ -44,4 +44,3 @@ os_fast_mutex_trylock(
...
@@ -44,4 +44,3 @@ os_fast_mutex_trylock(
#endif
#endif
#endif
#endif
}
}
innobase/include/os0thread.h
View file @
7a543344
...
@@ -65,7 +65,9 @@ os_thread_pf(
...
@@ -65,7 +65,9 @@ os_thread_pf(
/********************************************************************
/********************************************************************
Creates a new thread of execution. The execution starts from
Creates a new thread of execution. The execution starts from
the function given. The start function takes a void* parameter
the function given. The start function takes a void* parameter
and returns a ulint. */
and returns a ulint.
NOTE: We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
os_thread_t
os_thread_t
os_thread_create
(
os_thread_create
(
...
...
innobase/os/os0file.c
View file @
7a543344
...
@@ -80,6 +80,8 @@ struct os_aio_slot_struct{
...
@@ -80,6 +80,8 @@ struct os_aio_slot_struct{
which pending aio operation was
which pending aio operation was
completed */
completed */
#ifdef WIN_ASYNC_IO
#ifdef WIN_ASYNC_IO
os_event_t
event
;
/* event object we need in the
OVERLAPPED struct */
OVERLAPPED
control
;
/* Windows control block for the
OVERLAPPED
control
;
/* Windows control block for the
aio request */
aio request */
#elif defined(POSIX_ASYNC_IO)
#elif defined(POSIX_ASYNC_IO)
...
@@ -107,11 +109,14 @@ struct os_aio_array_struct{
...
@@ -107,11 +109,14 @@ struct os_aio_array_struct{
ulint
n_reserved
;
/* Number of reserved slots in the
ulint
n_reserved
;
/* Number of reserved slots in the
aio array outside the ibuf segment */
aio array outside the ibuf segment */
os_aio_slot_t
*
slots
;
/* Pointer to the slots in the array */
os_aio_slot_t
*
slots
;
/* Pointer to the slots in the array */
os_event_t
*
events
;
/* Pointer to an array of event handles
#ifdef __WIN__
where we copied the handles from slots,
os_native_event_t
*
native_events
;
in the same order. This can be used in
/* Pointer to an array of OS native event
WaitForMultipleObjects; used only in
handles where we copied the handles from
slots, in the same order. This can be used
in WaitForMultipleObjects; used only in
Windows */
Windows */
#endif
};
};
/* Array of events used in simulated aio */
/* Array of events used in simulated aio */
...
@@ -296,7 +301,7 @@ os_file_handle_error(
...
@@ -296,7 +301,7 @@ os_file_handle_error(
operation */
operation */
os_file_t
file
,
/* in: file pointer */
os_file_t
file
,
/* in: file pointer */
char
*
name
,
/* in: name of a file or NULL */
char
*
name
,
/* in: name of a file or NULL */
const
char
*
operation
)
/* in: type of
operation */
const
char
*
operation
)
/* in:
operation */
{
{
ulint
err
;
ulint
err
;
...
@@ -338,8 +343,8 @@ os_file_handle_error(
...
@@ -338,8 +343,8 @@ os_file_handle_error(
if
(
name
)
{
if
(
name
)
{
fprintf
(
stderr
,
"InnoDB: File name %s
\n
"
,
name
);
fprintf
(
stderr
,
"InnoDB: File name %s
\n
"
,
name
);
}
}
fprintf
(
stderr
,
"InnoDB: system call %s
\n
"
,
operation
);
fprintf
(
stderr
,
"InnoDB: System call %s.
\n
"
,
operation
);
fprintf
(
stderr
,
"InnoDB: Cannot continue operation.
\n
"
);
fprintf
(
stderr
,
"InnoDB: Cannot continue operation.
\n
"
);
fflush
(
stderr
);
fflush
(
stderr
);
...
@@ -422,9 +427,8 @@ try_again:
...
@@ -422,9 +427,8 @@ try_again:
*
success
=
FALSE
;
*
success
=
FALSE
;
retry
=
os_file_handle_error
(
file
,
name
,
retry
=
os_file_handle_error
(
file
,
name
,
create_mode
==
OS_FILE_OPEN
?
create_mode
==
OS_FILE_OPEN
?
"open"
:
"create"
);
"open"
:
"create"
);
if
(
retry
)
{
if
(
retry
)
{
goto
try_again
;
goto
try_again
;
}
}
...
@@ -465,10 +469,8 @@ try_again:
...
@@ -465,10 +469,8 @@ try_again:
*
success
=
FALSE
;
*
success
=
FALSE
;
retry
=
os_file_handle_error
(
file
,
name
,
retry
=
os_file_handle_error
(
file
,
name
,
create_mode
==
OS_FILE_OPEN
?
create_mode
==
OS_FILE_OPEN
?
"open"
:
"create"
);
"open"
:
"create"
);
if
(
retry
)
{
if
(
retry
)
{
goto
try_again
;
goto
try_again
;
}
}
...
@@ -576,9 +578,8 @@ try_again:
...
@@ -576,9 +578,8 @@ try_again:
*
success
=
FALSE
;
*
success
=
FALSE
;
retry
=
os_file_handle_error
(
file
,
name
,
retry
=
os_file_handle_error
(
file
,
name
,
create_mode
==
OS_FILE_OPEN
?
create_mode
==
OS_FILE_OPEN
?
"open"
:
"create"
);
"open"
:
"create"
);
if
(
retry
)
{
if
(
retry
)
{
goto
try_again
;
goto
try_again
;
}
}
...
@@ -625,9 +626,8 @@ try_again:
...
@@ -625,9 +626,8 @@ try_again:
*
success
=
FALSE
;
*
success
=
FALSE
;
retry
=
os_file_handle_error
(
file
,
name
,
retry
=
os_file_handle_error
(
file
,
name
,
create_mode
==
OS_FILE_OPEN
?
create_mode
==
OS_FILE_OPEN
?
"open"
:
"create"
);
"open"
:
"create"
);
if
(
retry
)
{
if
(
retry
)
{
goto
try_again
;
goto
try_again
;
}
}
...
@@ -1319,19 +1319,22 @@ os_aio_array_create(
...
@@ -1319,19 +1319,22 @@ os_aio_array_create(
array
->
n_segments
=
n_segments
;
array
->
n_segments
=
n_segments
;
array
->
n_reserved
=
0
;
array
->
n_reserved
=
0
;
array
->
slots
=
ut_malloc
(
n
*
sizeof
(
os_aio_slot_t
));
array
->
slots
=
ut_malloc
(
n
*
sizeof
(
os_aio_slot_t
));
array
->
events
=
ut_malloc
(
n
*
sizeof
(
os_event_t
));
#ifdef __WIN__
array
->
native_events
=
ut_malloc
(
n
*
sizeof
(
os_native_event_t
));
#endif
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
slot
=
os_aio_array_get_nth_slot
(
array
,
i
);
slot
=
os_aio_array_get_nth_slot
(
array
,
i
);
slot
->
pos
=
i
;
slot
->
pos
=
i
;
slot
->
reserved
=
FALSE
;
slot
->
reserved
=
FALSE
;
#ifdef WIN_ASYNC_IO
#ifdef WIN_ASYNC_IO
slot
->
event
=
os_event_create
(
NULL
);
over
=
&
(
slot
->
control
);
over
=
&
(
slot
->
control
);
over
->
hEvent
=
os_event_create
(
NULL
)
;
over
->
hEvent
=
slot
->
event
->
handle
;
*
((
array
->
events
)
+
i
)
=
over
->
hEvent
;
*
((
array
->
native_
events
)
+
i
)
=
over
->
hEvent
;
#endif
#endif
}
}
...
@@ -1429,7 +1432,7 @@ os_aio_array_wake_win_aio_at_shutdown(
...
@@ -1429,7 +1432,7 @@ os_aio_array_wake_win_aio_at_shutdown(
for
(
i
=
0
;
i
<
array
->
n_slots
;
i
++
)
{
for
(
i
=
0
;
i
<
array
->
n_slots
;
i
++
)
{
os_event_set
(
*
(
array
->
events
+
i
)
);
os_event_set
(
(
array
->
slots
+
i
)
->
event
);
}
}
}
}
#endif
#endif
...
@@ -1689,7 +1692,7 @@ loop:
...
@@ -1689,7 +1692,7 @@ loop:
control
=
&
(
slot
->
control
);
control
=
&
(
slot
->
control
);
control
->
Offset
=
(
DWORD
)
offset
;
control
->
Offset
=
(
DWORD
)
offset
;
control
->
OffsetHigh
=
(
DWORD
)
offset_high
;
control
->
OffsetHigh
=
(
DWORD
)
offset_high
;
os_event_reset
(
control
->
hE
vent
);
os_event_reset
(
slot
->
e
vent
);
#elif defined(POSIX_ASYNC_IO)
#elif defined(POSIX_ASYNC_IO)
...
@@ -1747,7 +1750,7 @@ os_aio_array_free_slot(
...
@@ -1747,7 +1750,7 @@ os_aio_array_free_slot(
}
}
#ifdef WIN_ASYNC_IO
#ifdef WIN_ASYNC_IO
os_event_reset
(
slot
->
control
.
hE
vent
);
os_event_reset
(
slot
->
e
vent
);
#endif
#endif
os_mutex_exit
(
array
->
mutex
);
os_mutex_exit
(
array
->
mutex
);
}
}
...
@@ -1872,7 +1875,7 @@ os_aio(
...
@@ -1872,7 +1875,7 @@ os_aio(
offset where to read or write */
offset where to read or write */
ulint
offset_high
,
/* in: most significant 32 bits of
ulint
offset_high
,
/* in: most significant 32 bits of
offset */
offset */
ulint
n
,
/* in: number of bytes to read or write */
ulint
n
,
/* in: number of bytes to read or write */
void
*
message1
,
/* in: messages for the aio handler (these
void
*
message1
,
/* in: messages for the aio handler (these
can be used to identify a completed aio
can be used to identify a completed aio
operation); if mode is OS_AIO_SYNC, these
operation); if mode is OS_AIO_SYNC, these
...
@@ -1916,7 +1919,8 @@ os_aio(
...
@@ -1916,7 +1919,8 @@ os_aio(
wait in the Windows case. */
wait in the Windows case. */
if
(
type
==
OS_FILE_READ
)
{
if
(
type
==
OS_FILE_READ
)
{
return
(
os_file_read
(
file
,
buf
,
offset
,
offset_high
,
n
));
return
(
os_file_read
(
file
,
buf
,
offset
,
offset_high
,
n
));
}
}
ut_a
(
type
==
OS_FILE_WRITE
);
ut_a
(
type
==
OS_FILE_WRITE
);
...
@@ -1994,8 +1998,7 @@ try_again:
...
@@ -1994,8 +1998,7 @@ try_again:
#ifdef WIN_ASYNC_IO
#ifdef WIN_ASYNC_IO
if
(
os_aio_use_native_aio
)
{
if
(
os_aio_use_native_aio
)
{
if
((
ret
&&
len
==
n
)
if
((
ret
&&
len
==
n
)
||
(
!
ret
&&
GetLastError
()
==
ERROR_IO_PENDING
))
{
||
(
!
ret
&&
GetLastError
()
==
ERROR_IO_PENDING
))
{
/* aio was queued successfully! */
/* aio was queued successfully! */
if
(
mode
==
OS_AIO_SYNC
)
{
if
(
mode
==
OS_AIO_SYNC
)
{
...
@@ -2025,8 +2028,8 @@ try_again:
...
@@ -2025,8 +2028,8 @@ try_again:
os_aio_array_free_slot
(
array
,
slot
);
os_aio_array_free_slot
(
array
,
slot
);
retry
=
os_file_handle_error
(
file
,
name
,
"aio"
);
retry
=
os_file_handle_error
(
file
,
name
,
type
==
OS_FILE_READ
?
"aio read"
:
"aio write"
);
if
(
retry
)
{
if
(
retry
)
{
goto
try_again
;
goto
try_again
;
...
@@ -2091,15 +2094,15 @@ os_aio_windows_handle(
...
@@ -2091,15 +2094,15 @@ os_aio_windows_handle(
n
=
array
->
n_slots
/
array
->
n_segments
;
n
=
array
->
n_slots
/
array
->
n_segments
;
if
(
array
==
os_aio_sync_array
)
{
if
(
array
==
os_aio_sync_array
)
{
srv_io_thread_op_info
[
orig_seg
]
=
"wait Windows aio for 1 page"
;
srv_io_thread_op_info
[
orig_seg
]
=
"wait Windows aio for 1 page"
;
ut_ad
(
pos
<
array
->
n_slots
);
os_event_wait
(
os_aio_array_get_nth_slot
(
array
,
pos
)
->
event
);
os_event_wait
(
array
->
events
[
pos
]);
i
=
pos
;
i
=
pos
;
}
else
{
}
else
{
srv_io_thread_op_info
[
orig_seg
]
=
srv_io_thread_op_info
[
orig_seg
]
=
"wait Windows aio"
;
"wait Windows aio"
;
i
=
os_event_wait_multiple
(
n
,
(
array
->
events
)
+
segment
*
n
);
i
=
os_event_wait_multiple
(
n
,
(
array
->
native_events
)
+
segment
*
n
);
}
}
os_mutex_enter
(
array
->
mutex
);
os_mutex_enter
(
array
->
mutex
);
...
@@ -2124,7 +2127,7 @@ os_aio_windows_handle(
...
@@ -2124,7 +2127,7 @@ os_aio_windows_handle(
ut_a
(
TRUE
==
os_file_flush
(
slot
->
file
));
ut_a
(
TRUE
==
os_file_flush
(
slot
->
file
));
}
}
}
else
{
}
else
{
os_file_handle_error
(
slot
->
file
,
slot
->
name
,
"aio"
);
os_file_handle_error
(
slot
->
file
,
slot
->
name
,
"
Windows
aio"
);
ret_val
=
FALSE
;
ret_val
=
FALSE
;
}
}
...
...
innobase/os/os0sync.c
View file @
7a543344
This diff is collapsed.
Click to expand it.
innobase/os/os0thread.c
View file @
7a543344
...
@@ -186,6 +186,10 @@ os_thread_exit(
...
@@ -186,6 +186,10 @@ os_thread_exit(
void
*
exit_value
)
/* in: exit value; in Windows this void*
void
*
exit_value
)
/* in: exit value; in Windows this void*
is cast as a DWORD */
is cast as a DWORD */
{
{
#ifdef UNIV_DEBUG_THREAD_CREATION
printf
(
"A thread exits.
\n
"
);
printf
(
"Thread id %lu
\n
"
,
os_thread_pf
(
os_thread_get_curr_id
()));
#endif
os_mutex_enter
(
os_sync_mutex
);
os_mutex_enter
(
os_sync_mutex
);
os_thread_count
--
;
os_thread_count
--
;
os_mutex_exit
(
os_sync_mutex
);
os_mutex_exit
(
os_sync_mutex
);
...
...
innobase/srv/srv0srv.c
View file @
7a543344
...
@@ -868,6 +868,7 @@ srv_release_max_if_no_queries(void)
...
@@ -868,6 +868,7 @@ srv_release_max_if_no_queries(void)
mutex_exit
(
&
kernel_mutex
);
mutex_exit
(
&
kernel_mutex
);
}
}
#ifdef notdefined
/***********************************************************************
/***********************************************************************
Releases one utility thread if no queries are active and
Releases one utility thread if no queries are active and
the high-water mark 2 for the utility is exceeded. */
the high-water mark 2 for the utility is exceeded. */
...
@@ -902,7 +903,6 @@ srv_release_one_if_no_queries(void)
...
@@ -902,7 +903,6 @@ srv_release_one_if_no_queries(void)
mutex_exit
(
&
kernel_mutex
);
mutex_exit
(
&
kernel_mutex
);
}
}
#ifdef notdefined
/***********************************************************************
/***********************************************************************
Decrements the utility meter by the value given and suspends the calling
Decrements the utility meter by the value given and suspends the calling
thread, which must be an utility thread of the type given, if necessary. */
thread, which must be an utility thread of the type given, if necessary. */
...
@@ -1012,6 +1012,8 @@ srv_communication_init(
...
@@ -1012,6 +1012,8 @@ srv_communication_init(
ut_a
(
ret
==
0
);
ut_a
(
ret
==
0
);
}
}
#ifdef notdefined
/*************************************************************************
/*************************************************************************
Implements the recovery utility. */
Implements the recovery utility. */
...
@@ -1072,6 +1074,7 @@ srv_purge_thread(
...
@@ -1072,6 +1074,7 @@ srv_purge_thread(
return
(
0
);
return
(
0
);
}
}
#endif
/* notdefined */
/*************************************************************************
/*************************************************************************
Creates the utility threads. */
Creates the utility threads. */
...
@@ -1102,6 +1105,7 @@ srv_create_utility_threads(void)
...
@@ -1102,6 +1105,7 @@ srv_create_utility_threads(void)
ut_a(thread); */
ut_a(thread); */
}
}
#ifdef notdefined
/*************************************************************************
/*************************************************************************
Implements the communication threads. */
Implements the communication threads. */
static
static
...
@@ -1151,6 +1155,7 @@ srv_com_thread(
...
@@ -1151,6 +1155,7 @@ srv_com_thread(
return
(
0
);
return
(
0
);
}
}
#endif
/*************************************************************************
/*************************************************************************
Creates the communication threads. */
Creates the communication threads. */
...
@@ -1171,6 +1176,7 @@ srv_create_com_threads(void)
...
@@ -1171,6 +1176,7 @@ srv_create_com_threads(void)
}
}
}
}
#ifdef notdefined
/*************************************************************************
/*************************************************************************
Implements the worker threads. */
Implements the worker threads. */
static
static
...
@@ -1215,6 +1221,7 @@ srv_worker_thread(
...
@@ -1215,6 +1221,7 @@ srv_worker_thread(
return
(
0
);
return
(
0
);
}
}
#endif
/*************************************************************************
/*************************************************************************
Creates the worker threads. */
Creates the worker threads. */
...
@@ -2490,6 +2497,10 @@ srv_lock_timeout_and_monitor_thread(
...
@@ -2490,6 +2497,10 @@ srv_lock_timeout_and_monitor_thread(
char
*
buf
;
char
*
buf
;
ulint
i
;
ulint
i
;
#ifdef UNIV_DEBUG_THREAD_CREATION
printf
(
"Lock timeout thread starts
\n
"
);
printf
(
"Thread id %lu
\n
"
,
os_thread_pf
(
os_thread_get_curr_id
()));
#endif
UT_NOT_USED
(
arg
);
UT_NOT_USED
(
arg
);
srv_last_monitor_time
=
time
(
NULL
);
srv_last_monitor_time
=
time
(
NULL
);
last_table_monitor_time
=
time
(
NULL
);
last_table_monitor_time
=
time
(
NULL
);
...
@@ -2630,6 +2641,10 @@ loop:
...
@@ -2630,6 +2641,10 @@ loop:
exit_func:
exit_func:
srv_lock_timeout_and_monitor_active
=
FALSE
;
srv_lock_timeout_and_monitor_active
=
FALSE
;
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
os_thread_exit
(
NULL
);
#ifndef __WIN__
#ifndef __WIN__
return
(
NULL
);
return
(
NULL
);
#else
#else
...
@@ -2655,6 +2670,10 @@ srv_error_monitor_thread(
...
@@ -2655,6 +2670,10 @@ srv_error_monitor_thread(
ulint
cnt
=
0
;
ulint
cnt
=
0
;
UT_NOT_USED
(
arg
);
UT_NOT_USED
(
arg
);
#ifdef UNIV_DEBUG_THREAD_CREATION
printf
(
"Error monitor thread starts
\n
"
);
printf
(
"Thread id %lu
\n
"
,
os_thread_pf
(
os_thread_get_curr_id
()));
#endif
loop:
loop:
srv_error_monitor_active
=
TRUE
;
srv_error_monitor_active
=
TRUE
;
...
@@ -2691,6 +2710,9 @@ loop:
...
@@ -2691,6 +2710,9 @@ loop:
srv_error_monitor_active
=
FALSE
;
srv_error_monitor_active
=
FALSE
;
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
os_thread_exit
(
NULL
);
os_thread_exit
(
NULL
);
#ifndef __WIN__
#ifndef __WIN__
...
@@ -2771,6 +2793,10 @@ srv_master_thread(
...
@@ -2771,6 +2793,10 @@ srv_master_thread(
UT_NOT_USED
(
arg
);
UT_NOT_USED
(
arg
);
#ifdef UNIV_DEBUG_THREAD_CREATION
printf
(
"Master thread starts
\n
"
);
printf
(
"Thread id %lu
\n
"
,
os_thread_pf
(
os_thread_get_curr_id
()));
#endif
srv_main_thread_process_no
=
os_proc_get_number
();
srv_main_thread_process_no
=
os_proc_get_number
();
srv_main_thread_id
=
os_thread_pf
(
os_thread_get_curr_id
());
srv_main_thread_id
=
os_thread_pf
(
os_thread_get_curr_id
());
...
@@ -3006,6 +3032,15 @@ background_loop:
...
@@ -3006,6 +3032,15 @@ background_loop:
n_tables_to_drop
=
row_drop_tables_for_mysql_in_background
();
n_tables_to_drop
=
row_drop_tables_for_mysql_in_background
();
if
(
n_tables_to_drop
>
0
)
{
/* Do not monopolize the CPU even if there are tables waiting
in the background drop queue. (It is essentially a bug if
MySQL tries to drop a table while there are still open handles
to it and we had to put it to the background drop queue.) */
os_thread_sleep
(
100000
);
}
srv_main_thread_op_info
=
(
char
*
)
"purging"
;
srv_main_thread_op_info
=
(
char
*
)
"purging"
;
if
(
srv_fast_shutdown
&&
srv_shutdown_state
>
0
)
{
if
(
srv_fast_shutdown
&&
srv_shutdown_state
>
0
)
{
...
@@ -3144,6 +3179,13 @@ suspend_thread:
...
@@ -3144,6 +3179,13 @@ suspend_thread:
goto
loop
;
goto
loop
;
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit.
The thread actually never comes here because it is exited in an
os_event_wait(). */
os_thread_exit
(
NULL
);
#ifndef __WIN__
#ifndef __WIN__
return
(
NULL
);
return
(
NULL
);
#else
#else
...
...
innobase/srv/srv0start.c
View file @
7a543344
...
@@ -414,8 +414,10 @@ io_handler_thread(
...
@@ -414,8 +414,10 @@ io_handler_thread(
segment
=
*
((
ulint
*
)
arg
);
segment
=
*
((
ulint
*
)
arg
);
/* printf("Io handler thread %lu starts\n", segment); */
#ifdef UNIV_DEBUG_THREAD_CREATION
printf
(
"Io handler thread %lu starts
\n
"
,
segment
);
printf
(
"Thread id %lu
\n
"
,
os_thread_pf
(
os_thread_get_curr_id
()));
#endif
for
(
i
=
0
;;
i
++
)
{
for
(
i
=
0
;;
i
++
)
{
fil_aio_wait
(
segment
);
fil_aio_wait
(
segment
);
...
@@ -424,6 +426,13 @@ io_handler_thread(
...
@@ -424,6 +426,13 @@ io_handler_thread(
mutex_exit
(
&
ios_mutex
);
mutex_exit
(
&
ios_mutex
);
}
}
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit.
The thread actually never comes here because it is exited in an
os_event_wait(). */
os_thread_exit
(
NULL
);
#ifndef __WIN__
#ifndef __WIN__
return
(
NULL
);
return
(
NULL
);
#else
#else
...
@@ -1585,21 +1594,32 @@ innobase_shutdown_for_mysql(void)
...
@@ -1585,21 +1594,32 @@ innobase_shutdown_for_mysql(void)
os_thread_count
);
os_thread_count
);
}
}
/* 3. Free all InnoDB's own mutexes */
/* 3. Free all InnoDB's own mutexes and the os_fast_mutexes inside
them */
sync_close
();
sync_close
();
/* 4. Free all OS synchronization primitives (in Windows currently
/* 4. Free the os_conc_mutex and all os_events and os_mutexes */
events are not freed) */
srv_free
();
srv_free
();
os_sync_free
();
os_sync_free
();
/* 5. Free all allocated memory
(
and the os_fast_mutex created in
/* 5. Free all allocated memory and the os_fast_mutex created in
ut0mem.c */
ut0mem.c */
ut_free_all_mem
();
ut_free_all_mem
();
if
(
os_thread_count
!=
0
||
os_event_count
!=
0
||
os_mutex_count
!=
0
||
os_fast_mutex_count
!=
0
)
{
fprintf
(
stderr
,
"InnoDB: Warning: some resources were not cleaned up in shutdown:
\n
"
"InnoDB: threads %lu, events %lu, os_mutexes %lu, os_fast_mutexes %lu
\n
"
,
os_thread_count
,
os_event_count
,
os_mutex_count
,
os_fast_mutex_count
);
}
if
(
srv_print_verbose_log
)
{
if
(
srv_print_verbose_log
)
{
ut_print_timestamp
(
stderr
);
ut_print_timestamp
(
stderr
);
fprintf
(
stderr
,
" InnoDB: Shutdown completed
\n
"
);
fprintf
(
stderr
,
" InnoDB: Shutdown completed
\n
"
);
...
...
mysql-test/r/func_str.result
View file @
7a543344
...
@@ -64,7 +64,7 @@ concat_ws(NULL,'a') concat_ws(',',NULL,'')
...
@@ -64,7 +64,7 @@ concat_ws(NULL,'a') concat_ws(',',NULL,'')
NULL
NULL
select concat_ws(',','',NULL,'a');
select concat_ws(',','',NULL,'a');
concat_ws(',','',NULL,'a')
concat_ws(',','',NULL,'a')
a
,
a
SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"');
SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"');
CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"')
CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"')
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc";"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc";"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
...
...
mysql-test/r/rpl_loaddata.result
View file @
7a543344
...
@@ -22,3 +22,9 @@ day id category name
...
@@ -22,3 +22,9 @@ day id category name
drop table t1;
drop table t1;
drop table t2;
drop table t2;
drop table t3;
drop table t3;
create table t1(a int, b int, unique(b));
insert into t1 values(1,10);
load data infile '../../std_data/rpl_loaddata.dat' into table t1;
show status like 'slave_running';
Variable_name Value
Slave_running OFF
mysql-test/t/rpl_loaddata.test
View file @
7a543344
...
@@ -4,6 +4,9 @@
...
@@ -4,6 +4,9 @@
#
#
# check replication of load data for temporary tables with additional parameters
# check replication of load data for temporary tables with additional parameters
#
#
# check if duplicate entries trigger an error (they should unless IGNORE or
# REPLACE was used on the master) (bug 571).
source
include
/
master
-
slave
.
inc
;
source
include
/
master
-
slave
.
inc
;
create
table
t1
(
a
int
not
null
auto_increment
,
b
int
,
primary
key
(
a
)
);
create
table
t1
(
a
int
not
null
auto_increment
,
b
int
,
primary
key
(
a
)
);
...
@@ -27,7 +30,21 @@ connection master;
...
@@ -27,7 +30,21 @@ connection master;
drop
table
t1
;
drop
table
t1
;
drop
table
t2
;
drop
table
t2
;
drop
table
t3
;
drop
table
t3
;
create
table
t1
(
a
int
,
b
int
,
unique
(
b
));
save_master_pos
;
save_master_pos
;
connection
slave
;
connection
slave
;
sync_with_master
;
sync_with_master
;
insert
into
t1
values
(
1
,
10
);
connection
master
;
load
data
infile
'../../std_data/rpl_loaddata.dat'
into
table
t1
;
save_master_pos
;
connection
slave
;
# don't sync_with_master because the slave SQL thread should be stopped because
# of the error so MASTER_POS_WAIT() will not return; just sleep and hope the
# slave SQL thread will have had time to stop.
sleep
1
;
show
status
like
'slave_running'
;
mysys/thr_alarm.c
View file @
7a543344
...
@@ -122,12 +122,24 @@ void init_thr_alarm(uint max_alarms)
...
@@ -122,12 +122,24 @@ void init_thr_alarm(uint max_alarms)
/*
/*
Request alarm after sec seconds.
Request alarm after sec seconds.
A pointer is returned with points to a non-zero int when the alarm has been
given. This can't be called from the alarm-handling thread.
SYNOPSIS
Returns 0 if no more alarms are allowed (aborted by process)
thr_alarm()
alrm Pointer to alarm detection
alarm_data Structure to store in alarm queue
NOTES
This function can't be called from the alarm-handling thread.
RETURN VALUES
0 ok
1 If no more alarms are allowed (aborted by process)
Stores in first argument a pointer to a non-zero int which is set to 0
when the alarm has been given
*/
*/
bool
thr_alarm
(
thr_alarm_t
*
alrm
,
uint
sec
,
ALARM
*
alarm_data
)
my_
bool
thr_alarm
(
thr_alarm_t
*
alrm
,
uint
sec
,
ALARM
*
alarm_data
)
{
{
ulong
now
;
ulong
now
;
sigset_t
old_mask
;
sigset_t
old_mask
;
...
@@ -209,7 +221,7 @@ void thr_end_alarm(thr_alarm_t *alarmed)
...
@@ -209,7 +221,7 @@ void thr_end_alarm(thr_alarm_t *alarmed)
ALARM
*
alarm_data
;
ALARM
*
alarm_data
;
sigset_t
old_mask
;
sigset_t
old_mask
;
uint
i
;
uint
i
;
bool
found
=
0
;
my_
bool
found
=
0
;
DBUG_ENTER
(
"thr_end_alarm"
);
DBUG_ENTER
(
"thr_end_alarm"
);
pthread_sigmask
(
SIG_BLOCK
,
&
full_signal_set
,
&
old_mask
);
pthread_sigmask
(
SIG_BLOCK
,
&
full_signal_set
,
&
old_mask
);
...
@@ -230,10 +242,9 @@ void thr_end_alarm(thr_alarm_t *alarmed)
...
@@ -230,10 +242,9 @@ void thr_end_alarm(thr_alarm_t *alarmed)
DBUG_ASSERT
(
!*
alarmed
||
found
);
DBUG_ASSERT
(
!*
alarmed
||
found
);
if
(
!
found
)
if
(
!
found
)
{
{
#ifdef MAIN
if
(
*
alarmed
)
printf
(
"Warning: Didn't find alarm %lx in queue of %d alarms
\n
"
,
fprintf
(
stderr
,
"Warning: Didn't find alarm %lx in queue of %d alarms
\n
"
,
(
long
)
*
alarmed
,
alarm_queue
.
elements
);
(
long
)
*
alarmed
,
alarm_queue
.
elements
);
#endif
DBUG_PRINT
(
"warning"
,(
"Didn't find alarm %lx in queue
\n
"
,
DBUG_PRINT
(
"warning"
,(
"Didn't find alarm %lx in queue
\n
"
,
(
long
)
*
alarmed
));
(
long
)
*
alarmed
));
}
}
...
...
sql/ha_innodb.cc
View file @
7a543344
This diff is collapsed.
Click to expand it.
sql/handler.cc
View file @
7a543344
...
@@ -218,8 +218,12 @@ void ha_close_connection(THD* thd)
...
@@ -218,8 +218,12 @@ void ha_close_connection(THD* thd)
}
}
/*
/*
This is used to commit or rollback a single statement depending
This is used to commit or rollback a single statement depending on the value
on the value of error
of error. Note that if the autocommit is on, then the following call inside
InnoDB will commit or rollback the whole transaction (= the statement). The
autocommit mechanism built into InnoDB is based on counting locks, but if
the user has used LOCK TABLES then that mechanism does not know to do the
commit.
*/
*/
int
ha_autocommit_or_rollback
(
THD
*
thd
,
int
error
)
int
ha_autocommit_or_rollback
(
THD
*
thd
,
int
error
)
...
...
sql/item_strfunc.cc
View file @
7a543344
...
@@ -515,18 +515,18 @@ String *Item_func_concat_ws::val_str(String *str)
...
@@ -515,18 +515,18 @@ String *Item_func_concat_ws::val_str(String *str)
str
->
length
(
0
);
// QQ; Should be removed
str
->
length
(
0
);
// QQ; Should be removed
res
=
str
;
res
=
str
;
// Skip until non-null a
nd non-empty a
rgument is found.
// Skip until non-null argument is found.
// If not, return the empty string
// If not, return the empty string
for
(
i
=
0
;
i
<
arg_count
;
i
++
)
for
(
i
=
0
;
i
<
arg_count
;
i
++
)
if
((
res
=
args
[
i
]
->
val_str
(
str
))
&&
res
->
length
()
)
if
((
res
=
args
[
i
]
->
val_str
(
str
)))
break
;
break
;
if
(
i
==
arg_count
)
if
(
i
==
arg_count
)
return
&
empty_string
;
return
&
empty_string
;
for
(
i
++
;
i
<
arg_count
;
i
++
)
for
(
i
++
;
i
<
arg_count
;
i
++
)
{
{
if
(
!
(
res2
=
args
[
i
]
->
val_str
(
use_as_buff
))
||
!
res2
->
length
()
)
if
(
!
(
res2
=
args
[
i
]
->
val_str
(
use_as_buff
)))
continue
;
// Skip NULL
and empty string
continue
;
// Skip NULL
if
(
res
->
length
()
+
sep_str
->
length
()
+
res2
->
length
()
>
if
(
res
->
length
()
+
sep_str
->
length
()
+
res2
->
length
()
>
current_thd
->
variables
.
max_allowed_packet
)
current_thd
->
variables
.
max_allowed_packet
)
...
...
sql/log_event.cc
View file @
7a543344
...
@@ -1573,9 +1573,27 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
...
@@ -1573,9 +1573,27 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
else
else
{
{
char
llbuff
[
22
];
char
llbuff
[
22
];
enum
enum_duplicates
handle_dup
=
DUP_IGNORE
;
enum
enum_duplicates
handle_dup
;
if
(
sql_ex
.
opt_flags
&
REPLACE_FLAG
)
if
(
sql_ex
.
opt_flags
&
REPLACE_FLAG
)
handle_dup
=
DUP_REPLACE
;
handle_dup
=
DUP_REPLACE
;
else
if
(
sql_ex
.
opt_flags
&
IGNORE_FLAG
)
handle_dup
=
DUP_IGNORE
;
else
/*
Note that when replication is running fine, if it was DUP_ERROR on the
master then we could choose DUP_IGNORE here, because if DUP_ERROR
suceeded on master, and data is identical on the master and slave,
then there should be no uniqueness errors on slave, so DUP_IGNORE is
the same as DUP_ERROR. But in the unlikely case of uniqueness errors
(because the data on the master and slave happen to be different (user
error or bug), we want LOAD DATA to print an error message on the
slave to discover the problem.
If reading from net (a 3.23 master), mysql_load() will change this
to DUP_IGNORE.
*/
handle_dup
=
DUP_ERROR
;
sql_exchange
ex
((
char
*
)
fname
,
sql_ex
.
opt_flags
&
DUMPFILE_FLAG
);
sql_exchange
ex
((
char
*
)
fname
,
sql_ex
.
opt_flags
&
DUMPFILE_FLAG
);
String
field_term
(
sql_ex
.
field_term
,
sql_ex
.
field_term_len
,
log_cs
);
String
field_term
(
sql_ex
.
field_term
,
sql_ex
.
field_term_len
,
log_cs
);
String
enclosed
(
sql_ex
.
enclosed
,
sql_ex
.
enclosed_len
,
log_cs
);
String
enclosed
(
sql_ex
.
enclosed
,
sql_ex
.
enclosed_len
,
log_cs
);
...
@@ -1637,12 +1655,19 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
...
@@ -1637,12 +1655,19 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
close_thread_tables
(
thd
);
close_thread_tables
(
thd
);
if
(
thd
->
query_error
)
if
(
thd
->
query_error
)
{
{
int
sql_error
=
thd
->
net
.
last_errno
;
/* this err/sql_errno code is copy-paste from send_error() */
if
(
!
sql_error
)
const
char
*
err
;
sql_error
=
ER_UNKNOWN_ERROR
;
int
sql_errno
;
slave_print_error
(
rli
,
sql_error
,
if
((
err
=
thd
->
net
.
last_error
)[
0
])
"Error '%s' running LOAD DATA INFILE"
,
sql_errno
=
thd
->
net
.
last_errno
;
ER_SAFE
(
sql_error
));
else
{
sql_errno
=
ER_UNKNOWN_ERROR
;
err
=
ER
(
sql_errno
);
}
slave_print_error
(
rli
,
sql_errno
,
"Error '%s' running load data infile"
,
err
);
free_root
(
&
thd
->
mem_root
,
0
);
free_root
(
&
thd
->
mem_root
,
0
);
return
1
;
return
1
;
}
}
...
...
sql/mysqld.cc
View file @
7a543344
...
@@ -267,7 +267,7 @@ ulong slave_net_timeout;
...
@@ -267,7 +267,7 @@ ulong slave_net_timeout;
ulong
thread_cache_size
=
0
,
binlog_cache_size
=
0
,
max_binlog_cache_size
=
0
;
ulong
thread_cache_size
=
0
,
binlog_cache_size
=
0
,
max_binlog_cache_size
=
0
;
ulong
query_cache_size
=
0
;
ulong
query_cache_size
=
0
;
ulong
com_stat
[(
uint
)
SQLCOM_END
],
com_other
;
ulong
com_stat
[(
uint
)
SQLCOM_END
],
com_other
;
ulong
bytes_sent
,
bytes_received
;
ulong
bytes_sent
,
bytes_received
,
net_big_packet_count
;
ulong
refresh_version
=
1L
,
flush_version
=
1L
;
/* Increments on each reload */
ulong
refresh_version
=
1L
,
flush_version
=
1L
;
/* Increments on each reload */
ulong
query_id
,
long_query_count
,
aborted_threads
,
aborted_connects
;
ulong
query_id
,
long_query_count
,
aborted_threads
,
aborted_connects
;
ulong
delayed_insert_timeout
,
delayed_insert_limit
,
delayed_queue_size
;
ulong
delayed_insert_timeout
,
delayed_insert_limit
,
delayed_queue_size
;
...
@@ -987,14 +987,21 @@ static void set_ports()
...
@@ -987,14 +987,21 @@ static void set_ports()
static
void
set_user
(
const
char
*
user
)
static
void
set_user
(
const
char
*
user
)
{
{
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__)
struct
passwd
*
ent
;
struct
passwd
*
ent
;
uid_t
user_id
=
geteuid
();
// don't bother if we aren't superuser
// don't bother if we aren't superuser
if
(
geteuid
()
)
if
(
user_id
)
{
{
if
(
user
)
if
(
user
)
fprintf
(
stderr
,
{
"Warning: One can only use the --user switch if running as root
\n
"
);
/* Don't give a warning, if real user is same as given with --user */
struct
passwd
*
user_info
=
getpwnam
(
user
);
if
(
!
user_info
||
user_id
!=
user_info
->
pw_uid
)
fprintf
(
stderr
,
"Warning: One can only use the --user switch if running as root
\n
"
);
}
return
;
return
;
}
}
else
if
(
!
user
)
else
if
(
!
user
)
...
...
sql/net_serv.cc
View file @
7a543344
...
@@ -73,11 +73,13 @@ void sql_print_error(const char *format,...);
...
@@ -73,11 +73,13 @@ void sql_print_error(const char *format,...);
#define USE_QUERY_CACHE
#define USE_QUERY_CACHE
extern
uint
test_flags
;
extern
uint
test_flags
;
extern
void
query_cache_insert
(
NET
*
net
,
const
char
*
packet
,
ulong
length
);
extern
void
query_cache_insert
(
NET
*
net
,
const
char
*
packet
,
ulong
length
);
extern
ulong
bytes_sent
,
bytes_received
;
extern
ulong
bytes_sent
,
bytes_received
,
net_big_packet_count
;
extern
pthread_mutex_t
LOCK_bytes_sent
,
LOCK_bytes_received
;
extern
pthread_mutex_t
LOCK_bytes_sent
,
LOCK_bytes_received
;
#else
#else
#undef statistic_add
#undef statistic_add
#undef statistic_increment
#define statistic_add(A,B,C)
#define statistic_add(A,B,C)
#define statistic_increment(A,B)
#endif
#endif
#define TEST_BLOCKING 8
#define TEST_BLOCKING 8
...
@@ -562,7 +564,7 @@ static my_bool net_safe_read(NET *net, char *buff, uint32 length,
...
@@ -562,7 +564,7 @@ static my_bool net_safe_read(NET *net, char *buff, uint32 length,
if
((
tmp
=
vio_read
(
net
->
vio
,(
char
*
)
net
->
buff
,
length
))
<=
0
)
if
((
tmp
=
vio_read
(
net
->
vio
,(
char
*
)
net
->
buff
,
length
))
<=
0
)
{
{
my_bool
interrupted
=
vio_should_retry
(
net
->
vio
);
my_bool
interrupted
=
vio_should_retry
(
net
->
vio
);
if
(
!
thr_got_alarm
(
&
alarmed
)
&&
interrupted
)
if
(
!
thr_got_alarm
(
alarmed
)
&&
interrupted
)
{
/* Probably in MIT threads */
{
/* Probably in MIT threads */
if
(
retry_count
++
<
net
->
retry_count
)
if
(
retry_count
++
<
net
->
retry_count
)
continue
;
continue
;
...
@@ -596,10 +598,13 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed,
...
@@ -596,10 +598,13 @@ static my_bool my_net_skip_rest(NET *net, uint32 remain, thr_alarm_t *alarmed,
DBUG_ENTER
(
"my_net_skip_rest"
);
DBUG_ENTER
(
"my_net_skip_rest"
);
DBUG_PRINT
(
"enter"
,(
"bytes_to_skip: %u"
,
(
uint
)
remain
));
DBUG_PRINT
(
"enter"
,(
"bytes_to_skip: %u"
,
(
uint
)
remain
));
if
(
!
thr_alarm_in_use
(
&
alarmed
))
/* The following is good for debugging */
statistic_increment
(
net_big_packet_count
,
&
LOCK_bytes_received
);
if
(
!
thr_alarm_in_use
(
alarmed
))
{
{
my_bool
old_mode
;
my_bool
old_mode
;
if
(
!
thr_alarm
(
alarmed
,
net
->
read_timeout
,
alarm_buff
)
||
if
(
thr_alarm
(
alarmed
,
net
->
read_timeout
,
alarm_buff
)
||
vio_blocking
(
net
->
vio
,
TRUE
,
&
old_mode
)
<
0
)
vio_blocking
(
net
->
vio
,
TRUE
,
&
old_mode
)
<
0
)
DBUG_RETURN
(
1
);
/* Can't setup, abort */
DBUG_RETURN
(
1
);
/* Can't setup, abort */
}
}
...
...
sql/slave.cc
View file @
7a543344
...
@@ -287,7 +287,7 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
...
@@ -287,7 +287,7 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,
goto
err
;
goto
err
;
rli
->
cur_log
=
&
rli
->
cache_buf
;
rli
->
cur_log
=
&
rli
->
cache_buf
;
}
}
if
(
pos
>
BIN_LOG_HEADER_SIZE
)
if
(
pos
>
=
BIN_LOG_HEADER_SIZE
)
my_b_seek
(
rli
->
cur_log
,(
off_t
)
pos
);
my_b_seek
(
rli
->
cur_log
,(
off_t
)
pos
);
err:
err:
...
@@ -2154,8 +2154,13 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
...
@@ -2154,8 +2154,13 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
else
else
{
{
sql_print_error
(
"\
sql_print_error
(
"\
Could not parse log event entry, check the master for binlog corruption
\n
\
Could not parse relay log event entry. The possible reasons are: the master's \
This may also be a network problem, or just a bug in the master or slave code.\
binary log is corrupted (you can check this by running 'mysqlbinlog' on the \
binary log), the slave's relay log is corrupted (you can check this by running \
'mysqlbinlog' on the relay log), a network problem, or a bug in the master's \
or slave's MySQL code. If you want to check the master's binary log or slave's \
relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' \
on this slave.\
"
);
"
);
return
1
;
return
1
;
}
}
...
...
sql/sql_parse.cc
View file @
7a543344
...
@@ -891,7 +891,11 @@ pthread_handler_decl(handle_one_connection,arg)
...
@@ -891,7 +891,11 @@ pthread_handler_decl(handle_one_connection,arg)
send_error
(
thd
,
net
->
last_errno
,
NullS
);
send_error
(
thd
,
net
->
last_errno
,
NullS
);
statistic_increment
(
aborted_threads
,
&
LOCK_status
);
statistic_increment
(
aborted_threads
,
&
LOCK_status
);
}
}
else
if
(
thd
->
killed
)
{
statistic_increment
(
aborted_threads
,
&
LOCK_status
);
}
end_thread:
end_thread:
close_connection
(
thd
,
0
,
1
);
close_connection
(
thd
,
0
,
1
);
end_thread
(
thd
,
1
);
end_thread
(
thd
,
1
);
...
@@ -1068,7 +1072,10 @@ bool do_command(THD *thd)
...
@@ -1068,7 +1072,10 @@ bool do_command(THD *thd)
vio_description
(
net
->
vio
)));
vio_description
(
net
->
vio
)));
/* Check if we can continue without closing the connection */
/* Check if we can continue without closing the connection */
if
(
net
->
error
!=
3
)
if
(
net
->
error
!=
3
)
{
statistic_increment
(
aborted_threads
,
&
LOCK_status
);
DBUG_RETURN
(
TRUE
);
// We have to close it.
DBUG_RETURN
(
TRUE
);
// We have to close it.
}
send_error
(
thd
,
net
->
last_errno
,
NullS
);
send_error
(
thd
,
net
->
last_errno
,
NullS
);
net
->
error
=
0
;
net
->
error
=
0
;
DBUG_RETURN
(
FALSE
);
DBUG_RETURN
(
FALSE
);
...
...
sql/sql_repl.cc
View file @
7a543344
...
@@ -997,7 +997,7 @@ int show_binlog_events(THD* thd)
...
@@ -997,7 +997,7 @@ int show_binlog_events(THD* thd)
{
{
LEX_MASTER_INFO
*
lex_mi
=
&
thd
->
lex
.
mi
;
LEX_MASTER_INFO
*
lex_mi
=
&
thd
->
lex
.
mi
;
ha_rows
event_count
,
limit_start
,
limit_end
;
ha_rows
event_count
,
limit_start
,
limit_end
;
my_off_t
pos
=
lex_mi
->
pos
;
my_off_t
pos
=
max
(
BIN_LOG_HEADER_SIZE
,
lex_mi
->
pos
);
// user-friendly
char
search_file_name
[
FN_REFLEN
],
*
name
;
char
search_file_name
[
FN_REFLEN
],
*
name
;
const
char
*
log_file_name
=
lex_mi
->
log_file_name
;
const
char
*
log_file_name
=
lex_mi
->
log_file_name
;
pthread_mutex_t
*
log_lock
=
mysql_bin_log
.
get_log_lock
();
pthread_mutex_t
*
log_lock
=
mysql_bin_log
.
get_log_lock
();
...
@@ -1025,12 +1025,6 @@ int show_binlog_events(THD* thd)
...
@@ -1025,12 +1025,6 @@ int show_binlog_events(THD* thd)
if
((
file
=
open_binlog
(
&
log
,
linfo
.
log_file_name
,
&
errmsg
))
<
0
)
if
((
file
=
open_binlog
(
&
log
,
linfo
.
log_file_name
,
&
errmsg
))
<
0
)
goto
err
;
goto
err
;
if
(
pos
<
4
)
{
errmsg
=
"Invalid log position"
;
goto
err
;
}
pthread_mutex_lock
(
log_lock
);
pthread_mutex_lock
(
log_lock
);
my_b_seek
(
&
log
,
pos
);
my_b_seek
(
&
log
,
pos
);
...
...
sql/sql_yacc.yy
View file @
7a543344
...
@@ -804,6 +804,18 @@ master_def:
...
@@ -804,6 +804,18 @@ master_def:
MASTER_LOG_POS_SYM EQ ulonglong_num
MASTER_LOG_POS_SYM EQ ulonglong_num
{
{
Lex->mi.pos = $3;
Lex->mi.pos = $3;
/*
If the user specified a value < BIN_LOG_HEADER_SIZE, adjust it
instead of causing subsequent errors.
We need to do it in this file, because only there we know that
MASTER_LOG_POS has been explicitely specified. On the contrary
in change_master() (sql_repl.cc) we cannot distinguish between 0
(MASTER_LOG_POS explicitely specified as 0) and 0 (unspecified),
whereas we want to distinguish (specified 0 means "read the binlog
from 0" (4 in fact), unspecified means "don't change the position
(keep the preceding value)").
*/
Lex->mi.pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.pos);
}
}
|
|
MASTER_CONNECT_RETRY_SYM EQ ULONG_NUM
MASTER_CONNECT_RETRY_SYM EQ ULONG_NUM
...
@@ -819,6 +831,8 @@ master_def:
...
@@ -819,6 +831,8 @@ master_def:
RELAY_LOG_POS_SYM EQ ULONG_NUM
RELAY_LOG_POS_SYM EQ ULONG_NUM
{
{
Lex->mi.relay_log_pos = $3;
Lex->mi.relay_log_pos = $3;
/* Adjust if < BIN_LOG_HEADER_SIZE (same comment as Lex->mi.pos) */
Lex->mi.relay_log_pos = max(BIN_LOG_HEADER_SIZE, Lex->mi.relay_log_pos);
}
}
;
;
...
...
sql/unireg.h
View file @
7a543344
...
@@ -141,10 +141,13 @@
...
@@ -141,10 +141,13 @@
*/
*/
#define MIN_TURBOBM_PATTERN_LEN 3
#define MIN_TURBOBM_PATTERN_LEN 3
/* Defines for binary logging */
/*
Defines for binary logging.
#define BIN_LOG_HEADER_SIZE 4
Do not decrease the value of BIN_LOG_HEADER_SIZE.
Do not even increase it before checking code.
*/
#define BIN_LOG_HEADER_SIZE 4
#define FLOATING_POINT_BUFFER 331
#define FLOATING_POINT_BUFFER 331
/* Include prototypes for unireg */
/* Include prototypes for unireg */
...
...
support-files/mysql.server.sh
View file @
7a543344
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
# Required-Start: $local_fs $network $remote_fs
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Start: 2 3 4 5
# Default-Stop:
2 3 4 5
# Default-Stop:
0 1 6
# Short-Description: start and stop MySQL
# Short-Description: start and stop MySQL
# Description: MySQL is a very fast and reliable SQL database engine.
# Description: MySQL is a very fast and reliable SQL database engine.
### END INIT INFO
### END INIT INFO
...
...
support-files/mysql.spec.sh
View file @
7a543344
...
@@ -254,6 +254,13 @@ export PATH
...
@@ -254,6 +254,13 @@ export PATH
# Build the 4.0 Max binary (includes BDB and UDFs and therefore
# Build the 4.0 Max binary (includes BDB and UDFs and therefore
# cannot be linked statically against the patched glibc)
# cannot be linked statically against the patched glibc)
# If we want to compile with RAID using gcc 3, we need to use
# gcc instead of g++ to avoid linking problems (RAID code is written in C++)
if
gcc
-v
2>&1 |
grep
'version 3'
>
/dev/null 2>&1
then
export
CXX
=
"gcc"
fi
BuildMySQL
"--enable-shared
\
BuildMySQL
"--enable-shared
\
--with-openssl
\
--with-openssl
\
--with-berkeley-db
\
--with-berkeley-db
\
...
@@ -319,6 +326,10 @@ install -m644 $MBD/sql/mysqld.sym $RBR/usr/lib/mysql/mysqld.sym
...
@@ -319,6 +326,10 @@ install -m644 $MBD/sql/mysqld.sym $RBR/usr/lib/mysql/mysqld.sym
install
-m644
$MBD
/support-files/mysql-log-rotate
$RBR
/etc/logrotate.d/mysql
install
-m644
$MBD
/support-files/mysql-log-rotate
$RBR
/etc/logrotate.d/mysql
install
-m755
$MBD
/support-files/mysql.server
$RBR
/etc/init.d/mysql
install
-m755
$MBD
/support-files/mysql.server
$RBR
/etc/init.d/mysql
# Create a symlink "rcmysql", pointing to the init.script. SuSE users
# will appreciate that, as all services usually offer this.
ln
-s
../../sbin/init.d/mysql
$RPM_BUILD_ROOT
/usr/sbin/rcmysql
# Create symbolic compatibility link safe_mysqld -> mysqld_safe
# Create symbolic compatibility link safe_mysqld -> mysqld_safe
# (safe_mysqld will be gone in MySQL 4.1)
# (safe_mysqld will be gone in MySQL 4.1)
ln
-sf
./mysqld_safe
$RBR
/usr/bin/safe_mysqld
ln
-sf
./mysqld_safe
$RBR
/usr/bin/safe_mysqld
...
@@ -463,6 +474,7 @@ fi
...
@@ -463,6 +474,7 @@ fi
%attr
(
755, root, root
)
/usr/bin/safe_mysqld
%attr
(
755, root, root
)
/usr/bin/safe_mysqld
%attr
(
755, root, root
)
/usr/sbin/mysqld
%attr
(
755, root, root
)
/usr/sbin/mysqld
%attr
(
755, root, root
)
/usr/sbin/rcmysql
%attr
(
644, root, root
)
/usr/lib/mysql/mysqld.sym
%attr
(
644, root, root
)
/usr/lib/mysql/mysqld.sym
%attr
(
644, root, root
)
/etc/logrotate.d/mysql
%attr
(
644, root, root
)
/etc/logrotate.d/mysql
...
...
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