Removed FULL option from SHOW BINARY LOGS
If option ‘binlog_structure’ is set to ‘tree’ then SHOW BINARY LOGS displays the tree details of the binlog files. MySQL [(none)]> SHOW BINARY LOGS; +--------------------------+-----------+ | Log_name | File_size | +--------------------------+-----------+ | 0/10122/mysql-bin.000117 | 1167 | | 0/10122/mysql-bin.000118 | 652 | | 0/10124/foo-bin.000016 | 5082 | | 0/10124/foo-bin.000017 | 491 | +--------------------------+-----------+ With option set to ‘flat’ (which is the default) the output contains only names: MySQL [(none)]> SHOW BINARY LOGS; +------------------+-----------+ | Log_name | File_size | +------------------+-----------+ | mysql-bin.000110 | 425 | | mysql-bin.000111 | 10409 | | mysql-bin.000112 | 9659 | +------------------+-----------+
This commit is contained in:
@ -103,7 +103,6 @@ typedef struct
|
|||||||
int seq_no; /* Output sequence in result test */
|
int seq_no; /* Output sequence in result test */
|
||||||
char *last_file; /* Last binlog file found in GTID repo */
|
char *last_file; /* Last binlog file found in GTID repo */
|
||||||
const char *binlogdir; /* Binlog files cache dir */
|
const char *binlogdir; /* Binlog files cache dir */
|
||||||
bool extra_info; /* Add extra ouput info */
|
|
||||||
DCB *client; /* Connected client DCB */
|
DCB *client; /* Connected client DCB */
|
||||||
bool use_tree; /* Binlog structure type */
|
bool use_tree; /* Binlog structure type */
|
||||||
} BINARY_LOG_DATA_RESULT;
|
} BINARY_LOG_DATA_RESULT;
|
||||||
@ -573,7 +572,7 @@ blr_skip_leading_sql_comments(const char *sql_query)
|
|||||||
* SHOW SLAVE HOSTS
|
* SHOW SLAVE HOSTS
|
||||||
* SHOW WARNINGS
|
* SHOW WARNINGS
|
||||||
* SHOW [GLOBAL] STATUS LIKE 'Uptime'
|
* SHOW [GLOBAL] STATUS LIKE 'Uptime'
|
||||||
* SHOW [FULL] BINARY LOGS
|
* SHOW BINARY LOGS
|
||||||
*
|
*
|
||||||
* 12 set commands are supported:
|
* 12 set commands are supported:
|
||||||
* SET @master_binlog_checksum = @@global.binlog_checksum
|
* SET @master_binlog_checksum = @@global.binlog_checksum
|
||||||
@ -7162,9 +7161,7 @@ static bool blr_handle_show_stmt(ROUTER_INSTANCE *router,
|
|||||||
blr_slave_show_warnings(router, slave);
|
blr_slave_show_warnings(router, slave);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (strcasecmp(word, "BINARY") == 0 ||
|
else if (strcasecmp(word, "BINARY") == 0)
|
||||||
(strcasecmp(word, "FULL") == 0 &&
|
|
||||||
strcasecmp(word, "BINARY")))
|
|
||||||
{
|
{
|
||||||
if (router->mariadb10_gtid)
|
if (router->mariadb10_gtid)
|
||||||
{
|
{
|
||||||
@ -8140,6 +8137,13 @@ blr_show_binary_logs(ROUTER_INSTANCE *router,
|
|||||||
"MAX(end_pos) AS size, "
|
"MAX(end_pos) AS size, "
|
||||||
"rep_domain, "
|
"rep_domain, "
|
||||||
"server_id "
|
"server_id "
|
||||||
|
"FROM gtid_maps "
|
||||||
|
"GROUP BY binlog_file "
|
||||||
|
"ORDER BY id ASC;";
|
||||||
|
static const char select_query_full[] = "SELECT binlog_file, "
|
||||||
|
"MAX(end_pos) AS size, "
|
||||||
|
"rep_domain, "
|
||||||
|
"server_id "
|
||||||
"FROM gtid_maps "
|
"FROM gtid_maps "
|
||||||
"GROUP BY rep_domain, "
|
"GROUP BY rep_domain, "
|
||||||
"server_id, "
|
"server_id, "
|
||||||
@ -8148,8 +8152,6 @@ blr_show_binary_logs(ROUTER_INSTANCE *router,
|
|||||||
int seqno;
|
int seqno;
|
||||||
char *errmsg = NULL;
|
char *errmsg = NULL;
|
||||||
BINARY_LOG_DATA_RESULT result = {};
|
BINARY_LOG_DATA_RESULT result = {};
|
||||||
bool extra_info = !strcasecmp(extra_data, "FULL") &&
|
|
||||||
router->storage_type == BLR_BINLOG_STORAGE_TREE;
|
|
||||||
|
|
||||||
/* Get current binlog finename and position */
|
/* Get current binlog finename and position */
|
||||||
spinlock_acquire(&router->binlog_lock);
|
spinlock_acquire(&router->binlog_lock);
|
||||||
@ -8192,7 +8194,6 @@ blr_show_binary_logs(ROUTER_INSTANCE *router,
|
|||||||
result.client = slave->dcb;
|
result.client = slave->dcb;
|
||||||
result.last_file = NULL;
|
result.last_file = NULL;
|
||||||
result.binlogdir = router->binlogdir;
|
result.binlogdir = router->binlogdir;
|
||||||
result.extra_info = extra_info;
|
|
||||||
result.use_tree = router->storage_type == BLR_BINLOG_STORAGE_TREE;
|
result.use_tree = router->storage_type == BLR_BINLOG_STORAGE_TREE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -8205,7 +8206,9 @@ blr_show_binary_logs(ROUTER_INSTANCE *router,
|
|||||||
* - result.seq_no is increased
|
* - result.seq_no is increased
|
||||||
*/
|
*/
|
||||||
if (sqlite3_exec(router->gtid_maps,
|
if (sqlite3_exec(router->gtid_maps,
|
||||||
select_query,
|
!result.use_tree ?
|
||||||
|
select_query :
|
||||||
|
select_query_full,
|
||||||
binary_logs_select_cb,
|
binary_logs_select_cb,
|
||||||
&result,
|
&result,
|
||||||
&errmsg) != SQLITE_OK)
|
&errmsg) != SQLITE_OK)
|
||||||
@ -8242,7 +8245,7 @@ blr_show_binary_logs(ROUTER_INSTANCE *router,
|
|||||||
|
|
||||||
char *filename;
|
char *filename;
|
||||||
char last_filename[BINLOG_FILE_EXTRA_INFO + strlen(current_file) + 1];
|
char last_filename[BINLOG_FILE_EXTRA_INFO + strlen(current_file) + 1];
|
||||||
if (extra_info)
|
if (result.use_tree)
|
||||||
{
|
{
|
||||||
char t_prefix[BINLOG_FILE_EXTRA_INFO];
|
char t_prefix[BINLOG_FILE_EXTRA_INFO];
|
||||||
sprintf(t_prefix,
|
sprintf(t_prefix,
|
||||||
@ -8385,7 +8388,7 @@ static int binary_logs_select_cb(void *data,
|
|||||||
sprintf(file_size, "%" PRIu32 "", fsize);
|
sprintf(file_size, "%" PRIu32 "", fsize);
|
||||||
|
|
||||||
// Include prefix in the output
|
// Include prefix in the output
|
||||||
if (data_set->extra_info)
|
if (data_set->use_tree)
|
||||||
{
|
{
|
||||||
sprintf(filename,
|
sprintf(filename,
|
||||||
"%s%s",
|
"%s%s",
|
||||||
|
Reference in New Issue
Block a user