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
60021dbe
Commit
60021dbe
authored
May 19, 2005
by
lars@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CSC#4944: Adding File_size to output of SHOW BINARY lOGS
parent
af557076
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
24 deletions
+51
-24
mysql-test/r/rpl_log.result
mysql-test/r/rpl_log.result
+6
-6
mysql-test/r/rpl_rotate_logs.result
mysql-test/r/rpl_rotate_logs.result
+15
-15
sql/sql_repl.cc
sql/sql_repl.cc
+30
-3
No files found.
mysql-test/r/rpl_log.result
View file @
60021dbe
...
...
@@ -67,14 +67,14 @@ master-bin.000002 110 Query 1 110 use `test`; create table t1 (n int)
master-bin.000002 168 Query 1 168 use `test`; insert into t1 values (1)
master-bin.000002 228 Query 1 228 use `test`; drop table t1
show binary logs;
Log_name
master-bin.000001
master-bin.000002
Log_name
File_size
master-bin.000001
0
master-bin.000002
276
start slave;
show binary logs;
Log_name
slave-bin.000001
slave-bin.000002
Log_name
File_size
slave-bin.000001
0
slave-bin.000002
170
show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info
slave-bin.000001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3
...
...
mysql-test/r/rpl_rotate_logs.result
View file @
60021dbe
...
...
@@ -26,10 +26,10 @@ create table t2(m int not null auto_increment primary key);
insert into t2 values (34),(67),(123);
flush logs;
show binary logs;
Log_name
master-bin.000001
master-bin.000002
master-bin.000003
Log_name
File_size
master-bin.000001
0
master-bin.000002
0
master-bin.000003
4
create table t3 select * from temp_table;
select * from t3;
a
...
...
@@ -42,18 +42,18 @@ set global sql_slave_skip_counter=1;
start slave;
purge master logs to 'master-bin.000002';
show master logs;
Log_name
master-bin.000002
master-bin.000003
Log_name
File_size
master-bin.000002
0
master-bin.000003
229
purge binary logs to 'master-bin.000002';
show binary logs;
Log_name
master-bin.000002
master-bin.000003
Log_name
File_size
master-bin.000002
0
master-bin.000003
229
purge master logs before now();
show binary logs;
Log_name
master-bin.000003
Log_name
File_size
master-bin.000003
229
insert into t2 values (65);
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
...
...
@@ -73,9 +73,9 @@ count(*)
100
create table t4 select * from temp_table;
show binary logs;
Log_name
master-bin.000003
master-bin.000004
Log_name
File_size
master-bin.000003
0
master-bin.000004
2886
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000004 2886
...
...
sql/sql_repl.cc
View file @
60021dbe
...
...
@@ -1337,6 +1337,11 @@ int show_binlog_info(THD* thd)
int
show_binlogs
(
THD
*
thd
)
{
IO_CACHE
*
index_file
;
LOG_INFO
cur
;
IO_CACHE
log
;
File
file
;
const
char
*
errmsg
=
0
;
MY_STAT
stat_area
;
char
fname
[
FN_REFLEN
];
List
<
Item
>
field_list
;
uint
length
;
...
...
@@ -1351,20 +1356,42 @@ int show_binlogs(THD* thd)
}
field_list
.
push_back
(
new
Item_empty_string
(
"Log_name"
,
255
));
field_list
.
push_back
(
new
Item_return_int
(
"File_size"
,
20
,
MYSQL_TYPE_LONGLONG
));
if
(
protocol
->
send_fields
(
&
field_list
,
1
))
DBUG_RETURN
(
1
);
mysql_bin_log
.
lock_index
();
index_file
=
mysql_bin_log
.
get_index_file
();
mysql_bin_log
.
get_current_log
(
&
cur
);
int
cur_dir_len
=
dirname_length
(
cur
.
log_file_name
);
reinit_io_cache
(
index_file
,
READ_CACHE
,
(
my_off_t
)
0
,
0
,
0
);
/* The file ends with EOF or empty line */
while
((
length
=
my_b_gets
(
index_file
,
fname
,
sizeof
(
fname
)))
>
1
)
{
fname
[
--
length
]
=
'\0'
;
/* remove the newline */
protocol
->
prepare_for_resend
();
int
dir_len
=
dirname_length
(
fname
);
/* The -1 is for removing newline from fname */
protocol
->
store
(
fname
+
dir_len
,
length
-
1
-
dir_len
,
&
my_charset_bin
);
protocol
->
store
(
fname
+
dir_len
,
length
-
dir_len
,
&
my_charset_bin
);
if
(
!
(
strncmp
(
fname
+
dir_len
,
cur
.
log_file_name
+
cur_dir_len
,
length
-
dir_len
)))
{
/* this is the active log, use the active position */
protocol
->
store
((
ulonglong
)
cur
.
pos
);
}
else
{
/* this is an old log, open it and find the size */
if
((
file
=
open_binlog
(
&
log
,
fname
+
dir_len
,
&
errmsg
))
>=
0
)
{
protocol
->
store
((
ulonglong
)
my_b_filelength
(
&
log
));
end_io_cache
(
&
log
);
my_close
(
file
,
MYF
(
0
));
}
else
{
/* the file wasn't openable, but 0 is an invalid value anyway */
protocol
->
store
((
ulonglong
)
0
);
}
}
if
(
protocol
->
write
())
goto
err
;
}
...
...
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