mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge from 4.1
BitKeeper/deleted/.del-ha_isam.cc~4dce65904db2675e: Auto merged BitKeeper/deleted/.del-ha_isammrg.cc~dc682e4755d77a2e: Auto merged client/sql_string.cc: Auto merged client/sql_string.h: Auto merged include/my_global.h: Auto merged include/my_sys.h: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysys/my_open.c: Auto merged mysys/raid.cc: Auto merged ndb/src/kernel/blocks/dbtux/Dbtux.hpp: Auto merged sql/field.cc: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_blackhole.cc: Auto merged sql/ha_heap.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_myisam.cc: Auto merged sql/ha_myisammrg.cc: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_geofunc.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/item_uniq.cc: Auto merged sql/item_uniq.h: Auto merged sql/log_event.cc: Auto merged sql/log_event.h: Auto merged sql/procedure.cc: Auto merged sql/protocol.cc: Auto merged sql/protocol_cursor.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_analyse.cc: Auto merged sql/sql_analyse.h: Auto merged sql/sql_lex.cc: Auto merged sql/sql_map.cc: Auto merged sql/sql_olap.cc: Auto merged sql/sql_string.cc: Auto merged sql/sql_udf.cc: Auto merged sql/tztime.cc: Auto merged sql/opt_range.cc: Manual merge sql/sql_parse.cc: Use select_lex pointer instead of lex->select_lex sql/sql_repl.cc: Function moved to log.cc, fix made there instead sql/sql_class.cc: Auto merged sql/sql_select.cc: Auto merged
This commit is contained in:
@@ -1479,13 +1479,11 @@ bool 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;
|
||||
int cur_dir_len;
|
||||
Protocol *protocol= thd->protocol;
|
||||
DBUG_ENTER("show_binlogs");
|
||||
|
||||
@@ -1505,34 +1503,35 @@ bool show_binlogs(THD* thd)
|
||||
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);
|
||||
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 */
|
||||
int dir_len;
|
||||
ulonglong file_length= 0; // Length if open fails
|
||||
fname[--length] = '\0'; // remove the newline
|
||||
|
||||
protocol->prepare_for_resend();
|
||||
int dir_len = dirname_length(fname);
|
||||
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)))
|
||||
dir_len= dirname_length(fname);
|
||||
length-= dir_len;
|
||||
protocol->store(fname + dir_len, length, &my_charset_bin);
|
||||
|
||||
if (!(strncmp(fname+dir_len, cur.log_file_name+cur_dir_len, length)))
|
||||
file_length= cur.pos; /* The active log, use the active position */
|
||||
else
|
||||
{
|
||||
/* 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)
|
||||
if ((file= my_open(fname+dir_len, O_RDONLY | O_SHARE | O_BINARY,
|
||||
MYF(0))) >= 0)
|
||||
{
|
||||
protocol->store((ulonglong) my_b_filelength(&log));
|
||||
end_io_cache(&log);
|
||||
file_length= (ulonglong) my_seek(file, 0L, MY_SEEK_END, MYF(0));
|
||||
my_close(file, MYF(0));
|
||||
} else {
|
||||
/* the file wasn't openable, but 0 is an invalid value anyway */
|
||||
protocol->store((ulonglong) 0);
|
||||
}
|
||||
}
|
||||
protocol->store(file_length);
|
||||
if (protocol->write())
|
||||
goto err;
|
||||
}
|
||||
|
Reference in New Issue
Block a user