MXS-1881: Pass the RowEventConverer as a parameter

The RowEventConverter is now passed as a parameter to the Avro
instance. Wrapped the value in an std::auto_ptr to make the cleanup
automatic (when it is implemented).

Fixed a typo in the event handler member variable and removed the unused
stats member.
This commit is contained in:
Markus Mäkelä
2018-06-09 20:09:45 +03:00
parent 8f76cf5f5a
commit c39fa4009e
6 changed files with 32 additions and 33 deletions

View File

@ -40,6 +40,8 @@
#include <maxscale/worker.hh>
#include <binlog_common.h>
#include "avro_converter.hh"
using namespace mxs;
static bool conversion_task_ctl(Avro *inst, bool start);
@ -59,7 +61,12 @@ static bool conversion_task_ctl(Avro *inst, bool start);
*/
MXS_ROUTER* createInstance(SERVICE *service, char **options)
{
Avro* router = Avro::create(service);
uint64_t block_size = config_get_size(service->svc_config_param, "block_size");
mxs_avro_codec_type codec = static_cast<mxs_avro_codec_type>(config_get_enum(service->svc_config_param, "codec", codec_values));
std::string avrodir = config_get_string(service->svc_config_param, "avrodir");
SRowEventHandler handler(new AvroConverter(avrodir, block_size, codec));
Avro* router = Avro::create(service, handler);
if (router)
{
@ -274,7 +281,7 @@ bool converter_func(Worker::Call::action_t action, Avro* router)
/** We reached end of file, flush unwritten records to disk */
if (progress)
{
router->event_hander->flush_tables();
router->event_handler->flush_tables();
avro_save_conversion_state(router);
logged = false;
}