MXS-1141: maxbinlogcheck to replace an event with ignorable event

maxbinlogcheck utility can replace an event at pos with an ignorable
event

New option is -R, —replace

-R $pos

The -R needs -f as file will be modified
This commit is contained in:
MassimilianoPinto
2017-02-16 09:45:43 +01:00
parent 7a6c38bd13
commit 755a3601ec
4 changed files with 61 additions and 15 deletions

View File

@ -73,6 +73,7 @@ MXS_BEGIN_DECLS
/* BINLOG_EVENT_LEN_OFFSET points to event_size in event_header */
#define BINLOG_EVENT_LEN_OFFSET 9
#define BINLOG_FATAL_ERROR_READING 1236
#define BINLOG_DATA_TRUNCATED 2032
/* Binlog Encryption */
#define BINLOG_ENC_ALGO_NAME_LEN 13
@ -638,6 +639,23 @@ typedef struct binlog_encryption_ctx
char *binlog_file; /**< Current binlog file being encrypted */
} BINLOG_ENCRYPTION_CTX;
/**
* Holds information about:
* truncating a corrupted file
* or replace an event at specified pos
* or replace a transaction that start
* at specified pos
*/
typedef struct binlog_pos_fix
{
bool fix; /**< Truncate file to last safe pos */
uint64_t pos; /**< Position of the event to be replaced
* by an Ignorable Event */
bool replace_trx; /**< Replace all events belonging to
* a transaction starting at pos */
} BINLOG_FILE_FIX;
/**
* Defines and offsets for binlog encryption
*
@ -809,7 +827,7 @@ extern int blr_send_custom_error(DCB *, int, int, char *, char *, unsigned int);
extern int blr_file_next_exists(ROUTER_INSTANCE *, ROUTER_SLAVE *);
uint32_t extract_field(uint8_t *src, int bits);
void blr_cache_read_master_data(ROUTER_INSTANCE *router);
int blr_read_events_all_events(ROUTER_INSTANCE *router, int fix, int debug);
int blr_read_events_all_events(ROUTER_INSTANCE *, const BINLOG_FILE_FIX *, int);
int blr_save_dbusers(const ROUTER_INSTANCE *router);
char *blr_get_event_description(ROUTER_INSTANCE *router, uint8_t event);
void blr_file_append(ROUTER_INSTANCE *router, char *file);