mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
merge with 4.0.15
This commit is contained in:
@ -182,7 +182,16 @@ public:
|
||||
void process(Append_block_log_event *ae)
|
||||
{
|
||||
if (ae->file_id >= file_names.elements)
|
||||
die("Skiped CreateFile event for file_id: %u",ae->file_id);
|
||||
{
|
||||
/*
|
||||
There is no Create_file event (a bad binlog or a big
|
||||
--position). Assuming it's a big --position, we just do nothing and
|
||||
print a warning.
|
||||
*/
|
||||
fprintf(stderr,"Warning: ignoring Append_block as there is no \
|
||||
Create_file event for file_id: %u\n",ae->file_id);
|
||||
return;
|
||||
}
|
||||
Create_file_log_event* ce=
|
||||
*((Create_file_log_event**)file_names.buffer + ae->file_id);
|
||||
append_to_file(ce->fname,O_APPEND|O_BINARY|O_WRONLY,ae->block,ae->block_len);
|
||||
@ -567,45 +576,49 @@ Could not read entry at offset %s : Error in log format or read error",
|
||||
}
|
||||
if (rec_count >= offset)
|
||||
{
|
||||
// see if we should skip this event (only care about queries for now)
|
||||
if (one_database)
|
||||
{
|
||||
if (ev->get_type_code() == QUERY_EVENT)
|
||||
{
|
||||
//const char * log_dbname = ev->get_db();
|
||||
const char * log_dbname = ((Query_log_event*)ev)->db;
|
||||
//printf("entry: %llu, database: %s\n", rec_count, log_dbname);
|
||||
|
||||
if ((log_dbname != NULL) && (strcmp(log_dbname, database)))
|
||||
{
|
||||
//printf("skipping, %s is not %s\n", log_dbname, database);
|
||||
rec_count++;
|
||||
delete ev;
|
||||
continue; // next
|
||||
}
|
||||
#ifndef DBUG_OFF
|
||||
else
|
||||
{
|
||||
printf("no skip\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifndef DBUG_OFF
|
||||
else
|
||||
{
|
||||
const char * query_type = ev->get_type_str();
|
||||
printf("not query -- %s\n", query_type);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (!short_form)
|
||||
fprintf(result_file, "# at %s\n",llstr(old_off,llbuff));
|
||||
|
||||
switch (ev->get_type_code()) {
|
||||
case QUERY_EVENT:
|
||||
if (one_database)
|
||||
{
|
||||
const char * log_dbname = ((Query_log_event*)ev)->db;
|
||||
if ((log_dbname != NULL) && (strcmp(log_dbname, database)))
|
||||
{
|
||||
rec_count++;
|
||||
delete ev;
|
||||
continue; // next
|
||||
}
|
||||
}
|
||||
ev->print(result_file, short_form, last_db);
|
||||
break;
|
||||
case CREATE_FILE_EVENT:
|
||||
{
|
||||
Create_file_log_event* ce= (Create_file_log_event*)ev;
|
||||
ce->print(result_file, short_form, last_db,true);
|
||||
if (one_database)
|
||||
{
|
||||
/*
|
||||
We test if this event has to be ignored. If yes, we don't save this
|
||||
event; this will have the good side-effect of ignoring all related
|
||||
Append_block and Exec_load.
|
||||
Note that Load event from 3.23 is not tested.
|
||||
*/
|
||||
const char * log_dbname = ce->db;
|
||||
if ((log_dbname != NULL) && (strcmp(log_dbname, database)))
|
||||
{
|
||||
rec_count++;
|
||||
delete ev;
|
||||
continue; // next
|
||||
}
|
||||
}
|
||||
/*
|
||||
We print the event, but with a leading '#': this is just to inform the
|
||||
user of the original command; the command we want to execute will be a
|
||||
derivation of this original command (we will change the filename and
|
||||
use LOCAL), prepared in the 'case EXEC_LOAD_EVENT' below.
|
||||
*/
|
||||
ce->print(result_file, short_form, last_db, true);
|
||||
load_processor.process(ce);
|
||||
ev= 0;
|
||||
break;
|
||||
@ -619,9 +632,20 @@ Could not read entry at offset %s : Error in log format or read error",
|
||||
ev->print(result_file, short_form, last_db);
|
||||
Execute_load_log_event *exv= (Execute_load_log_event*)ev;
|
||||
Create_file_log_event *ce= load_processor.grab_event(exv->file_id);
|
||||
ce->print(result_file, short_form, last_db,true);
|
||||
my_free((char*)ce->fname,MYF(MY_WME));
|
||||
delete ce;
|
||||
/*
|
||||
if ce is 0, it probably means that we have not seen the Create_file
|
||||
event (a bad binlog, or most probably --position is after the
|
||||
Create_file event). Print a warning comment.
|
||||
*/
|
||||
if (ce)
|
||||
{
|
||||
ce->print(result_file, short_form, last_db,true);
|
||||
my_free((char*)ce->fname,MYF(MY_WME));
|
||||
delete ce;
|
||||
}
|
||||
else
|
||||
fprintf(stderr,"Warning: ignoring Exec_load as there is no \
|
||||
Create_file event for file_id: %u\n",exv->file_id);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -633,7 +657,7 @@ Could not read entry at offset %s : Error in log format or read error",
|
||||
delete ev;
|
||||
}
|
||||
if (fd >= 0)
|
||||
my_close(fd, MYF(MY_WME));
|
||||
my_close(fd, MYF(MY_WME));
|
||||
end_io_cache(file);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user