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
fb78bfeb
Commit
fb78bfeb
authored
Feb 01, 2005
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
open binlog index file *before* tc_log->open() and binlog itself *after*
parent
a1690b46
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
252 additions
and
226 deletions
+252
-226
sql/log.cc
sql/log.cc
+129
-90
sql/mysql_priv.h
sql/mysql_priv.h
+0
-5
sql/mysqld.cc
sql/mysqld.cc
+25
-47
sql/slave.cc
sql/slave.cc
+66
-69
sql/slave.h
sql/slave.h
+9
-10
sql/sql_class.h
sql/sql_class.h
+22
-4
sql/sql_yacc.yy
sql/sql_yacc.yy
+1
-1
No files found.
sql/log.cc
View file @
fb78bfeb
This diff is collapsed.
Click to expand it.
sql/mysql_priv.h
View file @
fb78bfeb
...
@@ -930,11 +930,6 @@ void sql_print_information(const char *format, ...);
...
@@ -930,11 +930,6 @@ void sql_print_information(const char *format, ...);
bool
fn_format_relative_to_data_home
(
my_string
to
,
const
char
*
name
,
bool
fn_format_relative_to_data_home
(
my_string
to
,
const
char
*
name
,
const
char
*
dir
,
const
char
*
extension
);
const
char
*
dir
,
const
char
*
extension
);
bool
open_log
(
MYSQL_LOG
*
log
,
const
char
*
hostname
,
const
char
*
opt_name
,
const
char
*
extension
,
const
char
*
index_file_name
,
enum_log_type
type
,
bool
read_append
,
bool
no_auto_events
,
ulong
max_size
);
File
open_binlog
(
IO_CACHE
*
log
,
const
char
*
log_file_name
,
File
open_binlog
(
IO_CACHE
*
log
,
const
char
*
log_file_name
,
const
char
**
errmsg
);
const
char
**
errmsg
);
handlerton
*
binlog_init
();
handlerton
*
binlog_init
();
...
...
sql/mysqld.cc
View file @
fb78bfeb
...
@@ -2289,45 +2289,14 @@ extern "C" pthread_handler_decl(handle_shutdown,arg)
...
@@ -2289,45 +2289,14 @@ extern "C" pthread_handler_decl(handle_shutdown,arg)
#endif
#endif
const
char
*
load_default_groups
[]
=
{
const
char
*
load_default_groups
[]
=
{
#ifdef HAVE_NDBCLUSTER_DB
#ifdef HAVE_NDBCLUSTER_DB
"mysql_cluster"
,
"mysql_cluster"
,
#endif
#endif
"mysqld"
,
"server"
,
MYSQL_BASE_VERSION
,
0
,
0
};
"mysqld"
,
"server"
,
MYSQL_BASE_VERSION
,
0
,
0
};
static
const
int
load_default_groups_sz
=
static
const
int
load_default_groups_sz
=
sizeof
(
load_default_groups
)
/
sizeof
(
load_default_groups
[
0
]);
sizeof
(
load_default_groups
)
/
sizeof
(
load_default_groups
[
0
]);
bool
open_log
(
MYSQL_LOG
*
log
,
const
char
*
hostname
,
const
char
*
opt_name
,
const
char
*
extension
,
const
char
*
index_file_name
,
enum_log_type
type
,
bool
read_append
,
bool
no_auto_events
,
ulong
max_size
)
{
char
tmp
[
FN_REFLEN
];
if
(
!
opt_name
||
!
opt_name
[
0
])
{
/*
TODO: The following should be using fn_format(); We just need to
first change fn_format() to cut the file name if it's too long.
*/
strmake
(
tmp
,
hostname
,
FN_REFLEN
-
5
);
strmov
(
fn_ext
(
tmp
),
extension
);
opt_name
=
tmp
;
}
// get rid of extension if the log is binary to avoid problems
if
(
type
==
LOG_BIN
)
{
char
*
p
=
fn_ext
(
opt_name
);
uint
length
=
(
uint
)
(
p
-
opt_name
);
strmake
(
tmp
,
opt_name
,
min
(
length
,
FN_REFLEN
));
opt_name
=
tmp
;
}
return
log
->
open
(
opt_name
,
type
,
0
,
index_file_name
,
(
read_append
)
?
SEQ_READ_APPEND
:
WRITE_CACHE
,
no_auto_events
,
max_size
,
0
);
}
/*
/*
Initialize one of the global date/time format variables
Initialize one of the global date/time format variables
...
@@ -2335,7 +2304,7 @@ bool open_log(MYSQL_LOG *log, const char *hostname,
...
@@ -2335,7 +2304,7 @@ bool open_log(MYSQL_LOG *log, const char *hostname,
init_global_datetime_format()
init_global_datetime_format()
format_type What kind of format should be supported
format_type What kind of format should be supported
var_ptr Pointer to variable that should be updated
var_ptr Pointer to variable that should be updated
NOTES
NOTES
The default value is taken from either opt_date_time_formats[] or
The default value is taken from either opt_date_time_formats[] or
the ISO format (ANSI SQL)
the ISO format (ANSI SQL)
...
@@ -2617,8 +2586,7 @@ static int init_server_components()
...
@@ -2617,8 +2586,7 @@ static int init_server_components()
#endif
#endif
/* Setup log files */
/* Setup log files */
if
(
opt_log
)
if
(
opt_log
)
open_log
(
&
mysql_log
,
glob_hostname
,
opt_logname
,
".log"
,
NullS
,
mysql_log
.
open_query_log
(
opt_logname
);
LOG_NORMAL
,
0
,
0
,
0
);
if
(
opt_update_log
)
if
(
opt_update_log
)
{
{
/*
/*
...
@@ -2671,20 +2639,13 @@ version 5.0 and above. It is replaced by the binary log. Now starting MySQL \
...
@@ -2671,20 +2639,13 @@ version 5.0 and above. It is replaced by the binary log. Now starting MySQL \
with --log-bin instead."
);
with --log-bin instead."
);
}
}
}
}
if
(
opt_bin_log
)
if
(
opt_log_slave_updates
&&
!
opt_bin_log
)
{
open_log
(
&
mysql_bin_log
,
glob_hostname
,
opt_bin_logname
,
"-bin"
,
opt_binlog_index_name
,
LOG_BIN
,
0
,
0
,
max_binlog_size
);
using_update_log
=
1
;
}
else
if
(
opt_log_slave_updates
)
sql_print_warning
(
"\
sql_print_warning
(
"\
y
ou need to use --log-bin to make --log-slave-updates work. \
Y
ou need to use --log-bin to make --log-slave-updates work. \
Now disabling --log-slave-updates."
);
Now disabling --log-slave-updates."
);
if
(
opt_slow_log
)
if
(
opt_slow_log
)
open_log
(
&
mysql_slow_log
,
glob_hostname
,
opt_slow_logname
,
"-slow.log"
,
mysql_slow_log
.
open_slow_log
(
opt_slow_logname
);
NullS
,
LOG_NORMAL
,
0
,
0
,
0
);
#ifdef HAVE_REPLICATION
#ifdef HAVE_REPLICATION
if
(
opt_log_slave_updates
&&
replicate_same_server_id
)
if
(
opt_log_slave_updates
&&
replicate_same_server_id
)
...
@@ -2716,12 +2677,25 @@ server.");
...
@@ -2716,12 +2677,25 @@ server.");
}
}
}
}
if
(
opt_bin_log
)
{
char
buf
[
FN_REFLEN
];
const
char
*
ln
;
ln
=
mysql_bin_log
.
generate_name
(
opt_bin_logname
,
"-bin"
,
1
,
buf
);
if
(
ln
==
buf
)
{
my_free
(
opt_bin_logname
,
MYF
(
0
));
opt_bin_logname
=
my_strdup
(
buf
,
MYF
(
0
));
}
mysql_bin_log
.
open_index_file
(
opt_binlog_index_name
,
ln
);
using_update_log
=
1
;
}
if
(
ha_init
())
if
(
ha_init
())
{
{
sql_print_error
(
"Can't init databases"
);
sql_print_error
(
"Can't init databases"
);
unireg_abort
(
1
);
unireg_abort
(
1
);
}
}
tc_log
=
total_ha_2pc
>
1
?
opt_bin_log
?
tc_log
=
total_ha_2pc
>
1
?
opt_bin_log
?
(
TC_LOG
*
)
&
mysql_bin_log
:
(
TC_LOG
*
)
&
mysql_bin_log
:
(
TC_LOG
*
)
&
tc_log_mmap
:
(
TC_LOG
*
)
&
tc_log_mmap
:
...
@@ -2733,6 +2707,10 @@ server.");
...
@@ -2733,6 +2707,10 @@ server.");
unireg_abort
(
1
);
unireg_abort
(
1
);
}
}
if
(
opt_bin_log
)
mysql_bin_log
.
open
(
opt_bin_logname
,
LOG_BIN
,
0
,
WRITE_CACHE
,
0
,
max_binlog_size
,
0
);
#ifdef HAVE_REPLICATION
#ifdef HAVE_REPLICATION
if
(
opt_bin_log
&&
expire_logs_days
)
if
(
opt_bin_log
&&
expire_logs_days
)
{
{
...
...
sql/slave.cc
View file @
fb78bfeb
This diff is collapsed.
Click to expand it.
sql/slave.h
View file @
fb78bfeb
/* Copyright (C) 2000-2003 MySQL AB
/* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
(at your option) any later version.
This program is distributed in the hope that it will be useful,
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
...
@@ -366,11 +366,11 @@ typedef struct st_master_info
...
@@ -366,11 +366,11 @@ typedef struct st_master_info
my_bool
ssl
;
// enables use of SSL connection if true
my_bool
ssl
;
// enables use of SSL connection if true
char
ssl_ca
[
FN_REFLEN
],
ssl_capath
[
FN_REFLEN
],
ssl_cert
[
FN_REFLEN
];
char
ssl_ca
[
FN_REFLEN
],
ssl_capath
[
FN_REFLEN
],
ssl_cert
[
FN_REFLEN
];
char
ssl_cipher
[
FN_REFLEN
],
ssl_key
[
FN_REFLEN
];
char
ssl_cipher
[
FN_REFLEN
],
ssl_key
[
FN_REFLEN
];
my_off_t
master_log_pos
;
my_off_t
master_log_pos
;
File
fd
;
// we keep the file open, so we need to remember the file pointer
File
fd
;
// we keep the file open, so we need to remember the file pointer
IO_CACHE
file
;
IO_CACHE
file
;
pthread_mutex_t
data_lock
,
run_lock
;
pthread_mutex_t
data_lock
,
run_lock
;
pthread_cond_t
data_cond
,
start_cond
,
stop_cond
;
pthread_cond_t
data_cond
,
start_cond
,
stop_cond
;
THD
*
io_thd
;
THD
*
io_thd
;
...
@@ -385,7 +385,7 @@ typedef struct st_master_info
...
@@ -385,7 +385,7 @@ typedef struct st_master_info
bool
inited
;
bool
inited
;
volatile
bool
abort_slave
,
slave_running
;
volatile
bool
abort_slave
,
slave_running
;
volatile
ulong
slave_run_id
;
volatile
ulong
slave_run_id
;
/*
/*
The difference in seconds between the clock of the master and the clock of
The difference in seconds between the clock of the master and the clock of
the slave (second - first). It must be signed as it may be <0 or >0.
the slave (second - first). It must be signed as it may be <0 or >0.
clock_diff_with_master is computed when the I/O thread starts; for this the
clock_diff_with_master is computed when the I/O thread starts; for this the
...
@@ -394,8 +394,8 @@ typedef struct st_master_info
...
@@ -394,8 +394,8 @@ typedef struct st_master_info
clock_of_slave - last_timestamp_executed_by_SQL_thread - clock_diff_with_master
clock_of_slave - last_timestamp_executed_by_SQL_thread - clock_diff_with_master
*/
*/
long
clock_diff_with_master
;
long
clock_diff_with_master
;
st_master_info
()
st_master_info
()
:
ssl
(
0
),
fd
(
-
1
),
io_thd
(
0
),
inited
(
0
),
:
ssl
(
0
),
fd
(
-
1
),
io_thd
(
0
),
inited
(
0
),
abort_slave
(
0
),
slave_running
(
0
),
slave_run_id
(
0
)
abort_slave
(
0
),
slave_running
(
0
),
slave_run_id
(
0
)
...
@@ -403,7 +403,7 @@ typedef struct st_master_info
...
@@ -403,7 +403,7 @@ typedef struct st_master_info
host
[
0
]
=
0
;
user
[
0
]
=
0
;
password
[
0
]
=
0
;
host
[
0
]
=
0
;
user
[
0
]
=
0
;
password
[
0
]
=
0
;
ssl_ca
[
0
]
=
0
;
ssl_capath
[
0
]
=
0
;
ssl_cert
[
0
]
=
0
;
ssl_ca
[
0
]
=
0
;
ssl_capath
[
0
]
=
0
;
ssl_cert
[
0
]
=
0
;
ssl_cipher
[
0
]
=
0
;
ssl_key
[
0
]
=
0
;
ssl_cipher
[
0
]
=
0
;
ssl_key
[
0
]
=
0
;
bzero
((
char
*
)
&
file
,
sizeof
(
file
));
bzero
((
char
*
)
&
file
,
sizeof
(
file
));
pthread_mutex_init
(
&
run_lock
,
MY_MUTEX_INIT_FAST
);
pthread_mutex_init
(
&
run_lock
,
MY_MUTEX_INIT_FAST
);
pthread_mutex_init
(
&
data_lock
,
MY_MUTEX_INIT_FAST
);
pthread_mutex_init
(
&
data_lock
,
MY_MUTEX_INIT_FAST
);
...
@@ -523,7 +523,6 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
...
@@ -523,7 +523,6 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
bool
abort_if_no_master_info_file
,
bool
abort_if_no_master_info_file
,
int
thread_mask
);
int
thread_mask
);
void
end_master_info
(
MASTER_INFO
*
mi
);
void
end_master_info
(
MASTER_INFO
*
mi
);
int
init_relay_log_info
(
RELAY_LOG_INFO
*
rli
,
const
char
*
info_fname
);
void
end_relay_log_info
(
RELAY_LOG_INFO
*
rli
);
void
end_relay_log_info
(
RELAY_LOG_INFO
*
rli
);
void
lock_slave_threads
(
MASTER_INFO
*
mi
);
void
lock_slave_threads
(
MASTER_INFO
*
mi
);
void
unlock_slave_threads
(
MASTER_INFO
*
mi
);
void
unlock_slave_threads
(
MASTER_INFO
*
mi
);
...
...
sql/sql_class.h
View file @
fb78bfeb
...
@@ -255,7 +255,7 @@ class MYSQL_LOG: public TC_LOG
...
@@ -255,7 +255,7 @@ class MYSQL_LOG: public TC_LOG
{
{
#ifndef DBUG_OFF
#ifndef DBUG_OFF
char
buf1
[
22
],
buf2
[
22
];
char
buf1
[
22
],
buf2
[
22
];
#endif
#endif
DBUG_ENTER
(
"harvest_bytes_written"
);
DBUG_ENTER
(
"harvest_bytes_written"
);
(
*
counter
)
+=
bytes_written
;
(
*
counter
)
+=
bytes_written
;
DBUG_PRINT
(
"info"
,(
"counter: %s bytes_written: %s"
,
llstr
(
*
counter
,
buf1
),
DBUG_PRINT
(
"info"
,(
"counter: %s bytes_written: %s"
,
llstr
(
*
counter
,
buf1
),
...
@@ -272,11 +272,29 @@ class MYSQL_LOG: public TC_LOG
...
@@ -272,11 +272,29 @@ class MYSQL_LOG: public TC_LOG
bool
no_auto_events_arg
,
ulong
max_size
);
bool
no_auto_events_arg
,
ulong
max_size
);
void
init_pthread_objects
();
void
init_pthread_objects
();
void
cleanup
();
void
cleanup
();
bool
open
(
const
char
*
log_name
,
enum_log_type
log_type
,
bool
open
(
const
char
*
log_name
,
const
char
*
new_name
,
const
char
*
index_file_name_arg
,
enum_log_type
log_type
,
const
char
*
new_name
,
enum
cache_type
io_cache_type_arg
,
enum
cache_type
io_cache_type_arg
,
bool
no_auto_events_arg
,
ulong
max_size
,
bool
no_auto_events_arg
,
ulong
max_size
,
bool
null_created
);
bool
null_created
);
const
char
*
generate_name
(
const
char
*
log_name
,
const
char
*
suffix
,
bool
strip_ext
,
char
*
buff
);
/* simplified open_xxx wrappers for the gigantic open above */
bool
open_query_log
(
const
char
*
log_name
)
{
char
buf
[
FN_REFLEN
];
return
open
(
generate_name
(
log_name
,
".log"
,
0
,
buf
),
LOG_NORMAL
,
0
,
WRITE_CACHE
,
0
,
0
,
0
);
}
bool
open_slow_log
(
const
char
*
log_name
)
{
char
buf
[
FN_REFLEN
];
return
open
(
generate_name
(
log_name
,
"-slow.log"
,
0
,
buf
),
LOG_NORMAL
,
0
,
WRITE_CACHE
,
0
,
0
,
0
);
}
bool
open_index_file
(
const
char
*
index_file_name_arg
,
const
char
*
log_name
);
void
new_file
(
bool
need_lock
=
1
);
void
new_file
(
bool
need_lock
=
1
);
bool
write
(
THD
*
thd
,
enum
enum_server_command
command
,
bool
write
(
THD
*
thd
,
enum
enum_server_command
command
,
const
char
*
format
,...);
const
char
*
format
,...);
...
@@ -291,7 +309,7 @@ class MYSQL_LOG: public TC_LOG
...
@@ -291,7 +309,7 @@ class MYSQL_LOG: public TC_LOG
*/
*/
bool
appendv
(
const
char
*
buf
,
uint
len
,...);
bool
appendv
(
const
char
*
buf
,
uint
len
,...);
bool
append
(
Log_event
*
ev
);
bool
append
(
Log_event
*
ev
);
int
generate_new_name
(
char
*
new_name
,
const
char
*
old_name
);
int
generate_new_name
(
char
*
new_name
,
const
char
*
old_name
);
void
make_log_name
(
char
*
buf
,
const
char
*
log_ident
);
void
make_log_name
(
char
*
buf
,
const
char
*
log_ident
);
bool
is_active
(
const
char
*
log_file_name
);
bool
is_active
(
const
char
*
log_file_name
);
...
...
sql/sql_yacc.yy
View file @
fb78bfeb
...
@@ -8052,7 +8052,7 @@ xa: XA_SYM begin_or_start xid opt_join_or_resume
...
@@ -8052,7 +8052,7 @@ xa: XA_SYM begin_or_start xid opt_join_or_resume
;
;
xid: ident_or_text { Lex->ident=$1; }
xid: ident_or_text { Lex->ident=$1; }
;
;
begin_or_start: BEGIN_SYM {}
begin_or_start: BEGIN_SYM {}
| START_SYM {}
| START_SYM {}
...
...
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