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
00a4a502
Commit
00a4a502
authored
Nov 11, 2000
by
sasha@laptop.slkc.uswest.net
Browse files
Options
Browse Files
Download
Plain Diff
Merge work.mysql.com:/home/bk/mysql
into laptop.slkc.uswest.net:/home/sasha/src/mysql
parents
b873d68a
dd3c64a4
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
189 additions
and
112 deletions
+189
-112
BUILD/compile-pentium-debug
BUILD/compile-pentium-debug
+2
-2
BUILD/compile-pentium-debug-no-bdb
BUILD/compile-pentium-debug-no-bdb
+19
-0
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
sql/Makefile.am
sql/Makefile.am
+1
-1
sql/log.cc
sql/log.cc
+1
-0
sql/log_event.cc
sql/log_event.cc
+22
-22
sql/log_event.h
sql/log_event.h
+4
-4
sql/mysql_priv.h
sql/mysql_priv.h
+0
-14
sql/mysqld.cc
sql/mysqld.cc
+10
-3
sql/slave.cc
sql/slave.cc
+23
-14
sql/slave.h
sql/slave.h
+95
-0
sql/sql_class.h
sql/sql_class.h
+0
-46
sql/sql_insert.cc
sql/sql_insert.cc
+2
-0
sql/sql_repl.cc
sql/sql_repl.cc
+7
-2
sql/sql_repl.h
sql/sql_repl.h
+2
-4
No files found.
BUILD/compile-pentium-debug
View file @
00a4a502
...
@@ -13,8 +13,8 @@ C_WARNINGS="$GLOBAL_WARNINGS -Wunused"
...
@@ -13,8 +13,8 @@ C_WARNINGS="$GLOBAL_WARNINGS -Wunused"
CC_WARNINGS="$GLOBAL_WARNINGS -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
CC_WARNINGS="$GLOBAL_WARNINGS -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
CFLAGS="-DFORCE_INIT_OF_VARS -O2 -mpentiumpro $C_WARNINGS" CXX=gcc \
CFLAGS="-D
EXTRA_DEBUG -D
FORCE_INIT_OF_VARS -O2 -mpentiumpro $C_WARNINGS" CXX=gcc \
CXXFLAGS="-DFORCE_INIT_OF_VARS -O2 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti $CC_WARNINGS" \
CXXFLAGS="-D
EXTRA_DEBUG -D
FORCE_INIT_OF_VARS -O2 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti $CC_WARNINGS" \
./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex --with-debug=full \
./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex --with-debug=full \
--with-berkeley-db=/usr/local/BerkeleyDB
--with-berkeley-db=/usr/local/BerkeleyDB
make
make
BUILD/compile-pentium-debug-no-bdb
0 → 100755
View file @
00a4a502
make -k clean
/bin/rm -f */.deps/*.P config.cache
aclocal; autoheader; aclocal; automake; autoconf
# If you are not using codefusion add "-Wpointer-arith" to WARNINGS
# The following warning flag will give too many warnings:
# -Wshadow -Wunused -Winline (The later isn't usable in C++ as
# __attribute()__ doesn't work with gnu C++)
GLOBAL_WARNINGS="-Wimplicit -Wreturn-type -Wid-clash-51 -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wuninitialized -Wformat -Wimplicit-function-dec -Wimplicit-int -Wparentheses -Wsign-compare -Wwrite-strings"
C_WARNINGS="$GLOBAL_WARNINGS -Wunused"
CC_WARNINGS="$GLOBAL_WARNINGS -Woverloaded-virtual -Wextern-inline -Wsign-promo -Wreorder -Wctor-dtor-privacy -Wnon-virtual-dtor"
CFLAGS="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -O2 -mpentiumpro $C_WARNINGS" CXX=gcc \
CXXFLAGS="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -O2 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti $CC_WARNINGS" \
./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex --with-debug=full
make
BitKeeper/etc/logging_ok
View file @
00a4a502
jcole@tetra.bedford.progress.com
jcole@tetra.bedford.progress.com
sasha@laptop.slkc.uswest.net
sasha@mysql.sashanet.com
sasha@mysql.sashanet.com
sasha@work.mysql.com
sasha@work.mysql.com
serg@serg.mysql.com
serg@serg.mysql.com
...
...
sql/Makefile.am
View file @
00a4a502
...
@@ -48,7 +48,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
...
@@ -48,7 +48,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
opt_range.h opt_ft.h
\
opt_range.h opt_ft.h
\
sql_select.h structs.h table.h sql_udf.h hash_filo.h
\
sql_select.h structs.h table.h sql_udf.h hash_filo.h
\
lex.h lex_symbol.h sql_acl.h sql_crypt.h md5.h
\
lex.h lex_symbol.h sql_acl.h sql_crypt.h md5.h
\
log_event.h mini_client.h sql_repl.h
log_event.h mini_client.h sql_repl.h
slave.h
mysqld_SOURCES
=
sql_lex.cc
\
mysqld_SOURCES
=
sql_lex.cc
\
item.cc item_sum.cc item_buff.cc item_func.cc
\
item.cc item_sum.cc item_buff.cc item_func.cc
\
item_cmpfunc.cc item_strfunc.cc item_timefunc.cc
\
item_cmpfunc.cc item_strfunc.cc item_timefunc.cc
\
...
...
sql/log.cc
View file @
00a4a502
...
@@ -289,6 +289,7 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log)
...
@@ -289,6 +289,7 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log)
bool
logs_to_purge_inited
=
0
,
logs_to_keep_inited
=
0
,
found_log
=
0
;
bool
logs_to_purge_inited
=
0
,
logs_to_keep_inited
=
0
,
found_log
=
0
;
DYNAMIC_ARRAY
logs_to_purge
,
logs_to_keep
;
DYNAMIC_ARRAY
logs_to_purge
,
logs_to_keep
;
my_off_t
purge_offset
;
my_off_t
purge_offset
;
LINT_INIT
(
purge_offset
);
pthread_mutex_lock
(
&
LOCK_index
);
pthread_mutex_lock
(
&
LOCK_index
);
if
(
my_fseek
(
index_file
,
0
,
MY_SEEK_SET
,
if
(
my_fseek
(
index_file
,
0
,
MY_SEEK_SET
,
...
...
sql/log_event.cc
View file @
00a4a502
...
@@ -207,14 +207,17 @@ Log_event* Log_event::read_log_event(FILE* file, pthread_mutex_t* log_lock)
...
@@ -207,14 +207,17 @@ Log_event* Log_event::read_log_event(FILE* file, pthread_mutex_t* log_lock)
return
NULL
;
return
NULL
;
}
}
Log_event
*
Log_event
::
read_log_event
(
const
char
*
buf
,
int
max_buf
)
Log_event
*
Log_event
::
read_log_event
(
const
char
*
buf
,
int
event_len
)
{
{
if
(
event_len
<
EVENT_LEN_OFFSET
||
(
uint
)
event_len
!=
uint4korr
(
buf
+
EVENT_LEN_OFFSET
))
return
NULL
;
// general sanity check - will fail on a partial read
switch
(
buf
[
EVENT_TYPE_OFFSET
])
switch
(
buf
[
EVENT_TYPE_OFFSET
])
{
{
case
QUERY_EVENT
:
case
QUERY_EVENT
:
{
{
Query_log_event
*
q
=
new
Query_log_event
(
buf
,
max_buf
);
Query_log_event
*
q
=
new
Query_log_event
(
buf
,
event_len
);
if
(
!
q
->
query
)
if
(
!
q
->
query
)
{
{
delete
q
;
delete
q
;
...
@@ -226,7 +229,7 @@ Log_event* Log_event::read_log_event(const char* buf, int max_buf)
...
@@ -226,7 +229,7 @@ Log_event* Log_event::read_log_event(const char* buf, int max_buf)
case
LOAD_EVENT
:
case
LOAD_EVENT
:
{
{
Load_log_event
*
l
=
new
Load_log_event
(
buf
,
max_buf
);
Load_log_event
*
l
=
new
Load_log_event
(
buf
,
event_len
);
if
(
!
l
->
table_name
)
if
(
!
l
->
table_name
)
{
{
delete
l
;
delete
l
;
...
@@ -238,7 +241,7 @@ Log_event* Log_event::read_log_event(const char* buf, int max_buf)
...
@@ -238,7 +241,7 @@ Log_event* Log_event::read_log_event(const char* buf, int max_buf)
case
ROTATE_EVENT
:
case
ROTATE_EVENT
:
{
{
Rotate_log_event
*
r
=
new
Rotate_log_event
(
buf
,
max_buf
);
Rotate_log_event
*
r
=
new
Rotate_log_event
(
buf
,
event_len
);
if
(
!
r
->
new_log_ident
)
if
(
!
r
->
new_log_ident
)
{
{
delete
r
;
delete
r
;
...
@@ -357,12 +360,12 @@ Start_log_event::Start_log_event(const char* buf) :Log_event(buf)
...
@@ -357,12 +360,12 @@ Start_log_event::Start_log_event(const char* buf) :Log_event(buf)
created
=
uint4korr
(
buf
+
2
+
sizeof
(
server_version
));
created
=
uint4korr
(
buf
+
2
+
sizeof
(
server_version
));
}
}
Rotate_log_event
::
Rotate_log_event
(
const
char
*
buf
,
int
max_buf
)
:
Rotate_log_event
::
Rotate_log_event
(
const
char
*
buf
,
int
event_len
)
:
Log_event
(
buf
),
new_log_ident
(
NULL
),
alloced
(
0
)
Log_event
(
buf
),
new_log_ident
(
NULL
),
alloced
(
0
)
{
{
ulong
event_len
;
// the caller will ensure that event_len is what we have at
event_len
=
uint4korr
(
buf
+
EVENT_LEN_OFFSET
);
// EVENT_LEN_OFFSET
if
(
event_len
<
ROTATE_EVENT_OVERHEAD
||
event_len
>
(
ulong
)
max_buf
)
if
(
event_len
<
ROTATE_EVENT_OVERHEAD
)
return
;
return
;
ident_len
=
(
uchar
)(
event_len
-
ROTATE_EVENT_OVERHEAD
);
ident_len
=
(
uchar
)(
event_len
-
ROTATE_EVENT_OVERHEAD
);
...
@@ -415,16 +418,15 @@ Query_log_event::Query_log_event(FILE* file, time_t when_arg,
...
@@ -415,16 +418,15 @@ Query_log_event::Query_log_event(FILE* file, time_t when_arg,
*
((
char
*
)
query
+
q_len
)
=
0
;
*
((
char
*
)
query
+
q_len
)
=
0
;
}
}
Query_log_event
::
Query_log_event
(
const
char
*
buf
,
int
max_buf
)
:
Query_log_event
::
Query_log_event
(
const
char
*
buf
,
int
event_len
)
:
Log_event
(
buf
),
data_buf
(
0
),
query
(
NULL
),
db
(
NULL
)
Log_event
(
buf
),
data_buf
(
0
),
query
(
NULL
),
db
(
NULL
)
{
{
if
(
event_len
<
QUERY_EVENT_OVERHEAD
)
return
;
ulong
data_len
;
ulong
data_len
;
buf
+=
EVENT_LEN_OFFSET
;
buf
+=
EVENT_LEN_OFFSET
;
data_len
=
uint4korr
(
buf
);
data_len
=
event_len
-
QUERY_EVENT_OVERHEAD
;
if
(
data_len
<
QUERY_EVENT_OVERHEAD
||
data_len
>
(
ulong
)
max_buf
)
return
;
// tear-drop attack protection :)
data_len
-=
QUERY_EVENT_OVERHEAD
;
exec_time
=
uint4korr
(
buf
+
8
);
exec_time
=
uint4korr
(
buf
+
8
);
error_code
=
uint2korr
(
buf
+
13
);
error_code
=
uint2korr
(
buf
+
13
);
...
@@ -603,7 +605,7 @@ Load_log_event::Load_log_event(FILE* file, time_t when, uint32 server_id):
...
@@ -603,7 +605,7 @@ Load_log_event::Load_log_event(FILE* file, time_t when, uint32 server_id):
fname_len
=
data_len
-
2
-
db_len
-
table_name_len
-
num_fields
-
field_block_len
;
fname_len
=
data_len
-
2
-
db_len
-
table_name_len
-
num_fields
-
field_block_len
;
}
}
Load_log_event
::
Load_log_event
(
const
char
*
buf
,
int
max_buf
)
:
Load_log_event
::
Load_log_event
(
const
char
*
buf
,
int
event_len
)
:
Log_event
(
when
,
0
,
0
,
server_id
),
data_buf
(
0
),
num_fields
(
0
),
fields
(
0
),
Log_event
(
when
,
0
,
0
,
server_id
),
data_buf
(
0
),
num_fields
(
0
),
fields
(
0
),
field_lens
(
0
),
field_block_len
(
0
),
field_lens
(
0
),
field_block_len
(
0
),
table_name
(
0
),
db
(
0
),
fname
(
0
)
table_name
(
0
),
db
(
0
),
fname
(
0
)
...
@@ -611,14 +613,12 @@ Load_log_event::Load_log_event(const char* buf, int max_buf):
...
@@ -611,14 +613,12 @@ Load_log_event::Load_log_event(const char* buf, int max_buf):
{
{
ulong
data_len
;
ulong
data_len
;
if
(
(
uint
)
max_buf
<
(
LOAD_EVENT_OVERHEAD
+
LOG_EVENT_HEADER_LEN
))
if
(
event_len
<
(
LOAD_EVENT_OVERHEAD
+
LOG_EVENT_HEADER_LEN
))
return
;
return
;
buf
+=
EVENT_LEN_OFFSET
;
buf
+=
EVENT_LEN_OFFSET
;
data_len
=
uint4korr
(
buf
);
data_len
=
event_len
;
if
((
uint
)
data_len
>
(
uint
)
max_buf
)
return
;
thread_id
=
uint4korr
(
buf
+
4
);
thread_id
=
uint4korr
(
buf
+
4
);
exec_time
=
uint4korr
(
buf
+
8
);
exec_time
=
uint4korr
(
buf
+
8
);
...
...
sql/log_event.h
View file @
00a4a502
...
@@ -93,7 +93,7 @@ public:
...
@@ -93,7 +93,7 @@ public:
// if mutex is 0, the read will proceed without mutex
// if mutex is 0, the read will proceed without mutex
static
Log_event
*
read_log_event
(
FILE
*
file
,
pthread_mutex_t
*
log_lock
);
static
Log_event
*
read_log_event
(
FILE
*
file
,
pthread_mutex_t
*
log_lock
);
static
Log_event
*
read_log_event
(
const
char
*
buf
,
int
max_buf
);
static
Log_event
*
read_log_event
(
const
char
*
buf
,
int
event_len
);
#ifndef MYSQL_CLIENT
#ifndef MYSQL_CLIENT
static
int
read_log_event
(
FILE
*
file
,
String
*
packet
,
static
int
read_log_event
(
FILE
*
file
,
String
*
packet
,
...
@@ -133,7 +133,7 @@ public:
...
@@ -133,7 +133,7 @@ public:
#endif
#endif
Query_log_event
(
FILE
*
file
,
time_t
when
,
uint32
server_id
);
Query_log_event
(
FILE
*
file
,
time_t
when
,
uint32
server_id
);
Query_log_event
(
const
char
*
buf
,
int
max_buf
);
Query_log_event
(
const
char
*
buf
,
int
event_len
);
~
Query_log_event
()
~
Query_log_event
()
{
{
if
(
data_buf
)
if
(
data_buf
)
...
@@ -273,7 +273,7 @@ public:
...
@@ -273,7 +273,7 @@ public:
#endif
#endif
Load_log_event
(
FILE
*
file
,
time_t
when
,
uint32
server_id
);
Load_log_event
(
FILE
*
file
,
time_t
when
,
uint32
server_id
);
Load_log_event
(
const
char
*
buf
,
int
max_buf
);
Load_log_event
(
const
char
*
buf
,
int
event_len
);
~
Load_log_event
()
~
Load_log_event
()
{
{
if
(
data_buf
)
if
(
data_buf
)
...
@@ -398,7 +398,7 @@ public:
...
@@ -398,7 +398,7 @@ public:
{}
{}
Rotate_log_event
(
FILE
*
file
,
time_t
when
,
uint32
server_id
)
;
Rotate_log_event
(
FILE
*
file
,
time_t
when
,
uint32
server_id
)
;
Rotate_log_event
(
const
char
*
buf
,
int
max_buf
);
Rotate_log_event
(
const
char
*
buf
,
int
event_len
);
~
Rotate_log_event
()
~
Rotate_log_event
()
{
{
if
(
alloced
)
if
(
alloced
)
...
...
sql/mysql_priv.h
View file @
00a4a502
...
@@ -205,19 +205,6 @@ inline THD *_current_thd(void)
...
@@ -205,19 +205,6 @@ inline THD *_current_thd(void)
#include "sql_class.h"
#include "sql_class.h"
#include "opt_range.h"
#include "opt_range.h"
int
mysql_table_dump
(
THD
*
thd
,
char
*
db
,
char
*
tbl_name
,
int
fd
=
-
1
);
// if fd is -1, dump to NET
int
fetch_nx_table
(
THD
*
thd
,
MASTER_INFO
*
mi
);
// retrieve non-exitent table from master
// the caller must set thd->last_nx_table and thd->last_nx_db first
int
show_master_info
(
THD
*
thd
);
int
show_binlog_info
(
THD
*
thd
);
int
db_ok
(
const
char
*
db
,
I_List
<
i_string
>
&
do_list
,
I_List
<
i_string
>
&
ignore_list
);
// check to see if the database is ok to operate on with respect to the
// do and ignore lists - used in replication
void
mysql_create_db
(
THD
*
thd
,
char
*
db
,
uint
create_info
);
void
mysql_create_db
(
THD
*
thd
,
char
*
db
,
uint
create_info
);
void
mysql_binlog_send
(
THD
*
thd
,
char
*
log_ident
,
ulong
pos
,
ushort
flags
);
void
mysql_binlog_send
(
THD
*
thd
,
char
*
log_ident
,
ulong
pos
,
ushort
flags
);
...
@@ -522,7 +509,6 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list);
...
@@ -522,7 +509,6 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list);
void
unlock_table_name
(
THD
*
thd
,
TABLE_LIST
*
table_list
);
void
unlock_table_name
(
THD
*
thd
,
TABLE_LIST
*
table_list
);
bool
wait_for_locked_table_names
(
THD
*
thd
,
TABLE_LIST
*
table_list
);
bool
wait_for_locked_table_names
(
THD
*
thd
,
TABLE_LIST
*
table_list
);
extern
int
flush_master_info
(
MASTER_INFO
*
mi
);
/* old unireg functions */
/* old unireg functions */
...
...
sql/mysqld.cc
View file @
00a4a502
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include <mysql.h>
#include <mysql.h>
#include <m_ctype.h>
#include <m_ctype.h>
#include "sql_acl.h"
#include "sql_acl.h"
#include "slave.h"
#ifdef HAVE_BERKELEY_DB
#ifdef HAVE_BERKELEY_DB
#include "ha_berkeley.h"
#include "ha_berkeley.h"
#endif
#endif
...
@@ -179,7 +180,6 @@ static char *opt_ssl_capath = 0;
...
@@ -179,7 +180,6 @@ static char *opt_ssl_capath = 0;
static
VioSSLAcceptorFd
*
ssl_acceptor_fd
=
0
;
static
VioSSLAcceptorFd
*
ssl_acceptor_fd
=
0
;
#endif
/* HAVE_OPENSSL */
#endif
/* HAVE_OPENSSL */
extern
bool
slave_running
;
I_List
<
i_string_pair
>
replicate_rewrite_db
;
I_List
<
i_string_pair
>
replicate_rewrite_db
;
I_List
<
i_string
>
replicate_do_db
,
replicate_ignore_db
;
I_List
<
i_string
>
replicate_do_db
,
replicate_ignore_db
;
...
@@ -2229,7 +2229,8 @@ enum options {
...
@@ -2229,7 +2229,8 @@ enum options {
OPT_BINLOG_IGNORE_DB
,
OPT_WANT_CORE
,
OPT_BINLOG_IGNORE_DB
,
OPT_WANT_CORE
,
OPT_SKIP_CONCURRENT_INSERT
,
OPT_MEMLOCK
,
OPT_MYISAM_RECOVER
,
OPT_SKIP_CONCURRENT_INSERT
,
OPT_MEMLOCK
,
OPT_MYISAM_RECOVER
,
OPT_REPLICATE_REWRITE_DB
,
OPT_SERVER_ID
,
OPT_SKIP_SLAVE_START
,
OPT_REPLICATE_REWRITE_DB
,
OPT_SERVER_ID
,
OPT_SKIP_SLAVE_START
,
OPT_SKIP_INNOBASE
,
OPT_SAFEMALLOC_MEM_LIMIT
OPT_SKIP_INNOBASE
,
OPT_SAFEMALLOC_MEM_LIMIT
,
OPT_REPLICATE_DO_TABLE
,
OPT_REPLICATE_IGNORE_TABLE
};
};
static
struct
option
long_options
[]
=
{
static
struct
option
long_options
[]
=
{
...
@@ -2297,7 +2298,12 @@ static struct option long_options[] = {
...
@@ -2297,7 +2298,12 @@ static struct option long_options[] = {
{
"pid-file"
,
required_argument
,
0
,
(
int
)
OPT_PID_FILE
},
{
"pid-file"
,
required_argument
,
0
,
(
int
)
OPT_PID_FILE
},
{
"port"
,
required_argument
,
0
,
'P'
},
{
"port"
,
required_argument
,
0
,
'P'
},
{
"replicate-do-db"
,
required_argument
,
0
,
(
int
)
OPT_REPLICATE_DO_DB
},
{
"replicate-do-db"
,
required_argument
,
0
,
(
int
)
OPT_REPLICATE_DO_DB
},
{
"replicate-ignore-db"
,
required_argument
,
0
,
(
int
)
OPT_REPLICATE_IGNORE_DB
},
{
"replicate-do-table"
,
required_argument
,
0
,
(
int
)
OPT_REPLICATE_DO_TABLE
},
{
"replicate-ignore-db"
,
required_argument
,
0
,
(
int
)
OPT_REPLICATE_IGNORE_DB
},
{
"replicate-ignore-table"
,
required_argument
,
0
,
(
int
)
OPT_REPLICATE_IGNORE_TABLE
},
{
"replicate-rewrite-db"
,
required_argument
,
0
,
{
"replicate-rewrite-db"
,
required_argument
,
0
,
(
int
)
OPT_REPLICATE_REWRITE_DB
},
(
int
)
OPT_REPLICATE_REWRITE_DB
},
{
"safe-mode"
,
no_argument
,
0
,
(
int
)
OPT_SAFE
},
{
"safe-mode"
,
no_argument
,
0
,
(
int
)
OPT_SAFE
},
...
@@ -3744,4 +3750,5 @@ skipp: ;
...
@@ -3744,4 +3750,5 @@ skipp: ;
template
class
I_List
<
THD
>;
template
class
I_List
<
THD
>;
template
class
I_List_iterator
<
THD
>;
template
class
I_List_iterator
<
THD
>;
template
class
I_List
<
i_string
>;
template
class
I_List
<
i_string
>;
template
class
I_List
<
i_string_pair
>;
#endif
#endif
sql/slave.cc
View file @
00a4a502
...
@@ -18,31 +18,20 @@
...
@@ -18,31 +18,20 @@
#include "mysql_priv.h"
#include "mysql_priv.h"
#include <mysql.h>
#include <mysql.h>
#include "mini_client.h"
#include "mini_client.h"
#include "slave.h"
#include <thr_alarm.h>
#include <thr_alarm.h>
#include <my_dir.h>
#include <my_dir.h>
pthread_handler_decl
(
handle_slave
,
arg
);
extern
bool
volatile
abort_loop
,
abort_slave
;
// the master variables are defaults read from my.cnf or command line
extern
uint
master_port
,
master_connect_retry
;
extern
my_string
master_user
,
master_password
,
master_host
,
master_info_file
;
extern
I_List
<
i_string
>
replicate_do_db
,
replicate_ignore_db
;
extern
I_List
<
i_string_pair
>
replicate_rewrite_db
;
extern
I_List
<
THD
>
threads
;
bool
slave_running
=
0
;
bool
slave_running
=
0
;
pthread_t
slave_real_id
;
pthread_t
slave_real_id
;
MASTER_INFO
glob_mi
;
MASTER_INFO
glob_mi
;
HASH
replicate_do_table
,
replicate_ignore_table
;
bool
do_table_inited
=
0
,
ignore_table_inited
=
0
;
extern
bool
opt_log_slave_updates
;
static
inline
void
skip_load_data_infile
(
NET
*
net
);
static
inline
void
skip_load_data_infile
(
NET
*
net
);
static
inline
bool
slave_killed
(
THD
*
thd
);
static
inline
bool
slave_killed
(
THD
*
thd
);
static
int
init_slave_thread
(
THD
*
thd
);
static
int
init_slave_thread
(
THD
*
thd
);
int
init_master_info
(
MASTER_INFO
*
mi
);
static
void
safe_connect
(
THD
*
thd
,
MYSQL
*
mysql
,
MASTER_INFO
*
mi
);
static
void
safe_connect
(
THD
*
thd
,
MYSQL
*
mysql
,
MASTER_INFO
*
mi
);
static
void
safe_reconnect
(
THD
*
thd
,
MYSQL
*
mysql
,
MASTER_INFO
*
mi
);
static
void
safe_reconnect
(
THD
*
thd
,
MYSQL
*
mysql
,
MASTER_INFO
*
mi
);
static
int
safe_sleep
(
THD
*
thd
,
int
sec
);
static
int
safe_sleep
(
THD
*
thd
,
int
sec
);
...
@@ -50,6 +39,26 @@ static int request_table_dump(MYSQL* mysql, char* db, char* table);
...
@@ -50,6 +39,26 @@ static int request_table_dump(MYSQL* mysql, char* db, char* table);
static
int
create_table_from_dump
(
THD
*
thd
,
NET
*
net
,
const
char
*
db
,
static
int
create_table_from_dump
(
THD
*
thd
,
NET
*
net
,
const
char
*
db
,
const
char
*
table_name
);
const
char
*
table_name
);
static
inline
char
*
rewrite_db
(
char
*
db
);
static
inline
char
*
rewrite_db
(
char
*
db
);
static
void
free_table_ent
(
TABLE_RULE_ENT
*
e
)
{
my_free
((
byte
*
)
e
,
MYF
(
0
));
}
static
byte
*
get_table_key
(
TABLE_RULE_ENT
*
e
,
uint
*
len
,
my_bool
not_used
__attribute__
((
unused
)))
{
*
len
=
e
->
key_len
;
return
(
byte
*
)
e
->
db
;
}
void
init_table_rule_hash
(
HASH
*
h
,
bool
*
h_inited
)
{
hash_init
(
h
,
TABLE_RULE_HASH_SIZE
,
0
,
0
,
(
hash_get_key
)
get_table_key
,
(
void
(
*
)(
void
*
))
free_table_ent
,
0
);
*
h_inited
=
1
;
}
static
inline
bool
slave_killed
(
THD
*
thd
)
static
inline
bool
slave_killed
(
THD
*
thd
)
{
{
...
...
sql/slave.h
0 → 100644
View file @
00a4a502
#ifndef SLAVE_H
#define SLAVE_H
typedef
struct
st_master_info
{
char
log_file_name
[
FN_REFLEN
];
ulonglong
pos
,
pending
;
FILE
*
file
;
// we keep the file open, so we need to remember the file pointer
// the variables below are needed because we can change masters on the fly
char
host
[
HOSTNAME_LENGTH
+
1
];
char
user
[
USERNAME_LENGTH
+
1
];
char
password
[
HASH_PASSWORD_LENGTH
+
1
];
uint
port
;
uint
connect_retry
;
pthread_mutex_t
lock
;
bool
inited
;
st_master_info
()
:
pending
(
0
),
inited
(
0
)
{
host
[
0
]
=
0
;
user
[
0
]
=
0
;
password
[
0
]
=
0
;
pthread_mutex_init
(
&
lock
,
NULL
);
}
~
st_master_info
()
{
pthread_mutex_destroy
(
&
lock
);
}
inline
void
inc_pending
(
ulonglong
val
)
{
pending
+=
val
;
}
inline
void
inc_pos
(
ulonglong
val
)
{
pthread_mutex_lock
(
&
lock
);
pos
+=
val
+
pending
;
pending
=
0
;
pthread_mutex_unlock
(
&
lock
);
}
// thread safe read of position - not needed if we are in the slave thread,
// but required otherwise
inline
void
read_pos
(
ulonglong
&
var
)
{
pthread_mutex_lock
(
&
lock
);
var
=
pos
;
pthread_mutex_unlock
(
&
lock
);
}
}
MASTER_INFO
;
typedef
struct
st_table_rule_ent
{
char
*
db
;
char
*
tbl_name
;
uint
key_len
;
}
TABLE_RULE_ENT
;
#define TABLE_RULE_HASH_SIZE 16
int
flush_master_info
(
MASTER_INFO
*
mi
);
int
mysql_table_dump
(
THD
*
thd
,
char
*
db
,
char
*
tbl_name
,
int
fd
=
-
1
);
// if fd is -1, dump to NET
int
fetch_nx_table
(
THD
*
thd
,
MASTER_INFO
*
mi
);
// retrieve non-exitent table from master
// the caller must set thd->last_nx_table and thd->last_nx_db first
int
show_master_info
(
THD
*
thd
);
int
show_binlog_info
(
THD
*
thd
);
int
db_ok
(
const
char
*
db
,
I_List
<
i_string
>
&
do_list
,
I_List
<
i_string
>
&
ignore_list
);
// check to see if the database is ok to operate on with respect to the
// do and ignore lists - used in replication
int
init_master_info
(
MASTER_INFO
*
mi
);
extern
bool
opt_log_slave_updates
;
pthread_handler_decl
(
handle_slave
,
arg
);
extern
bool
volatile
abort_loop
,
abort_slave
;
extern
bool
slave_running
;
extern
pthread_t
slave_real_id
;
extern
MASTER_INFO
glob_mi
;
extern
HASH
replicate_do_table
,
replicate_ignore_table
;
extern
bool
do_table_inited
,
ignore_table_inited
;
// the master variables are defaults read from my.cnf or command line
extern
uint
master_port
,
master_connect_retry
;
extern
my_string
master_user
,
master_password
,
master_host
,
master_info_file
;
extern
I_List
<
i_string
>
replicate_do_db
,
replicate_ignore_db
;
extern
I_List
<
i_string_pair
>
replicate_rewrite_db
;
extern
I_List
<
THD
>
threads
;
#endif
sql/sql_class.h
View file @
00a4a502
...
@@ -50,52 +50,6 @@ typedef struct st_log_info
...
@@ -50,52 +50,6 @@ typedef struct st_log_info
~
st_log_info
()
{
pthread_mutex_destroy
(
&
lock
);}
~
st_log_info
()
{
pthread_mutex_destroy
(
&
lock
);}
}
LOG_INFO
;
}
LOG_INFO
;
typedef
struct
st_master_info
{
char
log_file_name
[
FN_REFLEN
];
ulonglong
pos
,
pending
;
FILE
*
file
;
// we keep the file open, so we need to remember the file pointer
// the variables below are needed because we can change masters on the fly
char
host
[
HOSTNAME_LENGTH
+
1
];
char
user
[
USERNAME_LENGTH
+
1
];
char
password
[
HASH_PASSWORD_LENGTH
+
1
];
uint
port
;
uint
connect_retry
;
pthread_mutex_t
lock
;
bool
inited
;
st_master_info
()
:
inited
(
0
),
pending
(
0
)
{
host
[
0
]
=
0
;
user
[
0
]
=
0
;
password
[
0
]
=
0
;
pthread_mutex_init
(
&
lock
,
NULL
);
}
~
st_master_info
()
{
pthread_mutex_destroy
(
&
lock
);
}
inline
void
inc_pending
(
ulonglong
val
)
{
pending
+=
val
;
}
inline
void
inc_pos
(
ulonglong
val
)
{
pthread_mutex_lock
(
&
lock
);
pos
+=
val
+
pending
;
pending
=
0
;
pthread_mutex_unlock
(
&
lock
);
}
// thread safe read of position - not needed if we are in the slave thread,
// but required otherwise
inline
void
read_pos
(
ulonglong
&
var
)
{
pthread_mutex_lock
(
&
lock
);
var
=
pos
;
pthread_mutex_unlock
(
&
lock
);
}
}
MASTER_INFO
;
class
MYSQL_LOG
{
class
MYSQL_LOG
{
public:
public:
...
...
sql/sql_insert.cc
View file @
00a4a502
...
@@ -1089,12 +1089,14 @@ bool delayed_insert::handle_inserts(void)
...
@@ -1089,12 +1089,14 @@ bool delayed_insert::handle_inserts(void)
pthread_mutex_lock
(
&
LOCK_delayed_status
);
pthread_mutex_lock
(
&
LOCK_delayed_status
);
delayed_insert_errors
++
;
delayed_insert_errors
++
;
pthread_mutex_unlock
(
&
LOCK_delayed_status
);
pthread_mutex_unlock
(
&
LOCK_delayed_status
);
row
->
log_query
=
0
;
}
}
if
(
row
->
query
&&
row
->
log_query
)
if
(
row
->
query
&&
row
->
log_query
)
{
{
mysql_update_log
.
write
(
&
thd
,
row
->
query
,
row
->
query_length
);
mysql_update_log
.
write
(
&
thd
,
row
->
query
,
row
->
query_length
);
if
(
mysql_bin_log
.
is_open
())
if
(
mysql_bin_log
.
is_open
())
{
{
thd
.
query_length
=
row
->
query_length
;
Query_log_event
qinfo
(
&
thd
,
row
->
query
);
Query_log_event
qinfo
(
&
thd
,
row
->
query
);
mysql_bin_log
.
write
(
&
qinfo
);
mysql_bin_log
.
write
(
&
qinfo
);
}
}
...
...
sql/sql_repl.cc
View file @
00a4a502
...
@@ -149,7 +149,7 @@ int purge_master_logs(THD* thd, const char* to_log)
...
@@ -149,7 +149,7 @@ int purge_master_logs(THD* thd, const char* to_log)
char
search_file_name
[
FN_REFLEN
];
char
search_file_name
[
FN_REFLEN
];
mysql_bin_log
.
make_log_name
(
search_file_name
,
to_log
);
mysql_bin_log
.
make_log_name
(
search_file_name
,
to_log
);
int
res
=
mysql_bin_log
.
purge_logs
(
thd
,
search_file_name
);
int
res
=
mysql_bin_log
.
purge_logs
(
thd
,
search_file_name
);
char
*
errmsg
=
0
;
c
onst
c
har
*
errmsg
=
0
;
switch
(
res
)
switch
(
res
)
{
{
case
0
:
break
;
case
0
:
break
;
...
@@ -169,9 +169,14 @@ binlog purge"; break;
...
@@ -169,9 +169,14 @@ binlog purge"; break;
}
}
if
(
errmsg
)
if
(
errmsg
)
{
send_error
(
&
thd
->
net
,
0
,
errmsg
);
send_error
(
&
thd
->
net
,
0
,
errmsg
);
return
1
;
}
else
else
send_ok
(
&
thd
->
net
);
send_ok
(
&
thd
->
net
);
return
0
;
}
}
void
mysql_binlog_send
(
THD
*
thd
,
char
*
log_ident
,
ulong
pos
,
ushort
flags
)
void
mysql_binlog_send
(
THD
*
thd
,
char
*
log_ident
,
ulong
pos
,
ushort
flags
)
...
...
sql/sql_repl.h
View file @
00a4a502
#ifndef SQL_REPL_H
#ifndef SQL_REPL_H
#define SQL_REPL_H
#define SQL_REPL_H
extern
bool
slave_running
;
#include "slave.h"
extern
volatile
bool
abort_slave
;
extern
char
*
master_host
;
extern
char
*
master_host
;
extern
pthread_t
slave_real_id
;
extern
MASTER_INFO
glob_mi
;
extern
my_string
opt_bin_logname
,
master_info_file
;
extern
my_string
opt_bin_logname
,
master_info_file
;
extern
I_List
<
i_string
>
binlog_do_db
,
binlog_ignore_db
;
extern
I_List
<
i_string
>
binlog_do_db
,
binlog_ignore_db
;
...
...
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