mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge
BitKeeper/etc/logging_ok: auto-union Makefile.am: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/information_schema_db.result: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_federated.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/log.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_udf.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/unireg.cc: Auto merged storage/innobase/row/row0mysql.c: Auto merged storage/innobase/srv/srv0start.c: Auto merged storage/innobase/trx/trx0trx.c: Auto merged storage/myisam/rt_split.c: Auto merged storage/myisammrg/myrg_open.c: Auto merged storage/ndb/src/common/debugger/SignalLoggerManager.cpp: Auto merged storage/ndb/src/common/util/File.cpp: Auto merged storage/ndb/src/cw/cpcd/Process.cpp: Auto merged storage/ndb/src/kernel/blocks/dbtux/Dbtux.hpp: Auto merged storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp: Auto merged storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp: Auto merged sql/sql_delete.cc: merge sql/sql_update.cc: merge sql/table.cc: SCCS merged support-files/mysql.spec.sh: merge
This commit is contained in:
@@ -1479,9 +1479,12 @@ bool show_binlog_info(THD* thd)
|
||||
bool show_binlogs(THD* thd)
|
||||
{
|
||||
IO_CACHE *index_file;
|
||||
LOG_INFO cur;
|
||||
File file;
|
||||
char fname[FN_REFLEN];
|
||||
List<Item> field_list;
|
||||
uint length;
|
||||
int cur_dir_len;
|
||||
Protocol *protocol= thd->protocol;
|
||||
DBUG_ENTER("show_binlogs");
|
||||
|
||||
@@ -1492,21 +1495,44 @@ bool 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,
|
||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||
DBUG_RETURN(TRUE);
|
||||
mysql_bin_log.lock_index();
|
||||
index_file=mysql_bin_log.get_index_file();
|
||||
|
||||
|
||||
mysql_bin_log.get_current_log(&cur);
|
||||
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)
|
||||
{
|
||||
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);
|
||||
/* The -1 is for removing newline from fname */
|
||||
protocol->store(fname + dir_len, length-1-dir_len, &my_charset_bin);
|
||||
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 an old log, open it and find the size */
|
||||
if ((file= my_open(fname+dir_len, O_RDONLY | O_SHARE | O_BINARY,
|
||||
MYF(0))) >= 0)
|
||||
{
|
||||
file_length= (ulonglong) my_seek(file, 0L, MY_SEEK_END, MYF(0));
|
||||
my_close(file, MYF(0));
|
||||
}
|
||||
}
|
||||
protocol->store(file_length);
|
||||
if (protocol->write())
|
||||
goto err;
|
||||
}
|
||||
|
Reference in New Issue
Block a user