1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

changed to use IO_CACHE instead of FILE

Docs/manual.texi:
  Type fixes
myisam/mi_create.c:
  Fixed bug in update from different processes
myisam/mi_locking.c:
  Fixed bug in update from different processes
myisam/mi_open.c:
  Fixed bug in update from different processes
myisam/mi_search.c:
  Fixed bug in update from different processes
myisam/myisamdef.h:
  Fixed bug in update from different processes
mysys/Makefile.am:
  Added mf_iocache2.c
sql/log.cc:
  Changed to use IO_CACHE instead of FILE
sql/sql_class.h:
  Changed to use IO_CACHE instead of FILE
sql/sql_repl.cc:
  Changed to use IO_CACHE instead of FILE
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
This commit is contained in:
unknown
2000-11-16 03:58:58 +02:00
parent c7d2c59ceb
commit 3e6dac34cd
12 changed files with 365 additions and 143 deletions

View File

@ -720,66 +720,66 @@ int show_binlog_info(THD* thd)
int show_binlogs(THD* thd)
{
const char* errmsg = 0;
FILE* index_file;
File index_file;
char fname[FN_REFLEN];
NET* net = &thd->net;
List<Item> field_list;
String* packet = &thd->packet;
IO_CACHE io_cache;
uint length;
if(!mysql_bin_log.is_open())
{
errmsg = "binlog is not open";
goto err;
}
{
errmsg = "binlog is not open";
goto err;
}
field_list.push_back(new Item_empty_string("Log_name", 128));
if(send_fields(thd, field_list, 1))
{
sql_print_error("Failed in send_fields");
return 1;
}
{
sql_print_error("Failed in send_fields");
return 1;
}
mysql_bin_log.lock_index();
index_file = mysql_bin_log.get_index_file();
if(!index_file)
if (index_file < 0)
{
errmsg = "Uninitialized index file pointer";
goto err2;
}
if (init_io_cache(&io_cache, index_file, IO_SIZE, READ_CACHE, 0, 0,
MYF(MY_WME)))
{
errmsg = "Failed on init_io_cache()";
goto err2;
}
while ((length=my_b_gets(&io_cache, fname, sizeof(fname))))
{
fname[--length]=0;
int dir_len = dirname_length(fname);
packet->length(0);
net_store_data(packet, fname + dir_len, length-dir_len);
if(my_net_write(net, (char*) packet->ptr(), packet->length()))
{
errmsg = "Uninitialized index file pointer";
mysql_bin_log.unlock_index();
goto err;
}
if(my_fseek(index_file, 0, MY_SEEK_SET, MYF(MY_WME)))
{
errmsg = "Failed on fseek()";
mysql_bin_log.unlock_index();
goto err;
}
while(fgets(fname, sizeof(fname), index_file))
{
char* fname_end;
*(fname_end = (strend(fname) - 1)) = 0;
int dir_len = dirname_length(fname);
packet->length(0);
net_store_data(packet, fname + dir_len, (fname_end - fname)-dir_len);
if(my_net_write(net, (char*) packet->ptr(), packet->length()))
{
sql_print_error("Failed in my_net_write");
mysql_bin_log.unlock_index();
return 1;
}
sql_print_error("Failed in my_net_write");
end_io_cache(&io_cache);
mysql_bin_log.unlock_index();
return 1;
}
}
mysql_bin_log.unlock_index();
end_io_cache(&io_cache);
send_eof(net);
err:
if(errmsg)
{
send_error(net, 0, errmsg);
return 1;
}
send_ok(net);
return 0;
err2:
mysql_bin_log.unlock_index();
end_io_cache(&io_cache);
err:
send_error(net, 0, errmsg);
return 1;
}