Commit a4ee90a8 authored by Kristian Nielsen's avatar Kristian Nielsen

MDEV-34705: Binlog in Engine: Start of binlog reader (untested, incomplete)

Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
parent 24146e5b
......@@ -18,7 +18,7 @@ SET SESSION binlog_format= ROW;
--echo *** Do $num_trx transactions ...
--disable_query_log
--let $i= 0
while ($i < 1500) {
while ($i < $num_trx) {
eval INSERT INTO t2 VALUES ($i, REPEAT("x", 2048));
inc $i;
}
......
......@@ -59,6 +59,7 @@ class Field_varstring;
class Field_blob;
class Column_definition;
class select_result;
class handler_binlog_reader;
// the following is for checking tables
......@@ -1528,6 +1529,10 @@ struct handlerton
void (*update_optimizer_costs)(OPTIMIZER_COSTS *costs);
void *optimizer_costs; /* Costs are stored here */
/* Optional implementation of binlog in the engine. */
handler_binlog_reader * (*get_binlog_reader)();
int (*binlog_data)(uchar *data, size_t len);
/*
Optional clauses in the CREATE/ALTER TABLE
*/
......@@ -5791,4 +5796,45 @@ inline void Cost_estimate::reset(handler *file)
avg_io_cost= file->DISK_READ_COST * file->DISK_READ_RATIO;
}
/*
Class for reading a binlog implemented in an engine.
*/
class handler_binlog_reader {
public:
/* ToDo: Should some of this state go to the derived class, in case different engines might want to do something different? */
/* The file number of the currently-being-read binlog file. */
uint64_t cur_file_no;
/* The current offset into the binlog file. */
uint64_t cur_file_offset;
/*
Open file handle of binlog file.
This may be NULL if the currently-being-read binlog file is "hot" and
is being read from in-memory buffers while the data may not yet be
written out to the file on the OS level.
*/
File cur_file;
/* Position and length of any remaining data in buf[]. */
uint32_t buf_data_pos;
uint32_t buf_data_remain;
/* Buffer used when reading data out via read_binlog_data(). */
uchar buf[32768];
handler_binlog_reader()
: cur_file_no(~(uint64_t)0), cur_file_offset(0), cur_file(0),
buf_data_pos(0), buf_data_remain(0)
{ }
virtual int read_binlog_data(uchar *buf, uint32_t len) = 0;
/*
cur_file_no -> implicitly gives file/tablespace
cur_file_offset -> implicitly gives page
cur_file_fh -> open fh, if any
cur_chunk_len
cur_chunk_sofar
*/
virtual ~handler_binlog_reader() { };
};
#endif /* HANDLER_INCLUDED */
This diff is collapsed.
......@@ -4092,6 +4092,7 @@ static int innodb_init(void* p)
= innodb_prepare_commit_versioned;
innobase_hton->update_optimizer_costs= innobase_update_optimizer_costs;
innobase_hton->get_binlog_reader= innodb_get_binlog_reader;
innodb_remember_check_sysvar_funcs();
......
......@@ -581,6 +581,8 @@ void fsp_shrink_temp_space();
extern void fsp_binlog_test(const uchar *data, uint32_t len);
extern void fsp_binlog_trx(trx_t *trx, mtr_t *mtr);
class handler_binlog_reader;
extern handler_binlog_reader *innodb_get_binlog_reader();
#ifndef UNIV_DEBUG
# define fsp_init_file_page(space, block, mtr) fsp_init_file_page(block, mtr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment