Bug #73072 Suggest to add a logical binlog position to show master/slave status
Submitted: 21 Jun 2014 14:57 Modified: 27 Aug 2014 11:18
Reporter: Fangxin Flou (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S4 (Feature request)
Version:5.5/5.6 OS:Any
Assigned to: CPU Architecture:Any
Tags: binlog

[21 Jun 2014 14:57] Fangxin Flou
Description:
In the current show master/slave status, we get the following information.

1, the current log file
2, the current log position

if we have a logical binlog absolute position, we could monitor the binlog activity easily.

logical binlog absolute position = max_binlog_size * log_index + current position

So at time t1 we get a logical binlog absolution position named p1, at time t2 we get a p2, so during t1 and t2, about p2-p1 binary log are generated.

if we got p1 from master, and p2 from slave, so p1-p2 will be the delay measured by log size.

I think this is very useful in real DBA life, there is no so much code changes for this feature, so it's safe to be implemented by a small patch.

How to repeat:
N/A

Suggested fix:
N/A
[22 Jun 2014 1:14] Fangxin Flou
the patch for show master status

Attachment: mysql_show_master_status_enhance.txt (text/plain), 3.05 KiB.

[22 Jun 2014 1:15] Fangxin Flou
Please ignore the first paragraph in the patch file, just to make the make install copy less files.
[22 Jun 2014 1:20] Fangxin Flou
for show slave status, we can see:

"Read_Master_Log_Pos"
"Read_Master_Log_File"
"Exec_Master_Log_Pos"

so

master log position - Read_Master_Log_Pos = how much log is delayed for transfer
master log position - Exec_Master_Log_Pos = how much log is delayed for apply

is it clear?
[22 Jun 2014 1:22] Fangxin Flou
For example

mysql> show master status;
+----------------------+----------+---------------+--------------+------------------+-------------------+
| File                 | Position | Long_Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+----------------------+----------+---------------+--------------+------------------+-------------------+
| localhost-bin.000008 |      120 |     822837368 |              |                  |                   |
+----------------------+----------+---------------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
[22 Jun 2014 3:42] Fangxin Flou
Both show master and show slave status are patched now

Attachment: mysql_show_master_status_enhance.txt (text/plain), 5.02 KiB.

[22 Jun 2014 6:38] Fangxin Flou
while(len & fname[len - 1] >= '0' && fname[len - 1] <= '9') len --;

Should be

while(len && fname[len - 1] >= '0' && fname[len - 1] <= '9') len --;
[27 Aug 2014 11:18] Fangxin Flou
Filed another bug for this feature.