Merge branch '2.3' into develop
This commit is contained in:
@ -33,6 +33,7 @@
|
||||
#include <maxscale/alloc.h>
|
||||
#include <maxscale/buffer.hh>
|
||||
#include <maxscale/utils.hh>
|
||||
#include <maxscale/routingworker.hh>
|
||||
|
||||
std::pair<std::string, std::string> get_avrofile_and_gtid(std::string file);
|
||||
|
||||
@ -238,22 +239,14 @@ bool file_in_dir(const char* dir, const char* file)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The client callback for sending data
|
||||
*
|
||||
* @param dcb Client DCB
|
||||
* @param reason Why the callback was called
|
||||
* @param userdata Data provided when the callback was added
|
||||
* @return Always 0
|
||||
* Queue the client callback for execution
|
||||
*/
|
||||
int avro_client_callback(DCB* dcb, DCB_REASON reason, void* userdata)
|
||||
void AvroSession::queue_client_callback()
|
||||
{
|
||||
if (reason == DCB_REASON_DRAINED)
|
||||
{
|
||||
AvroSession* client = static_cast<AvroSession*>(userdata);
|
||||
client->client_callback();
|
||||
}
|
||||
|
||||
return 0;
|
||||
auto worker = mxs::RoutingWorker::get(mxs::RoutingWorker::MAIN);
|
||||
worker->execute([this]() {
|
||||
client_callback();
|
||||
}, mxs::RoutingWorker::EXECUTE_QUEUED);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -337,11 +330,7 @@ void AvroSession::process_command(GWBUF* queue)
|
||||
|
||||
if (file_in_dir(router->avrodir.c_str(), avro_binfile.c_str()))
|
||||
{
|
||||
/* set callback routine for data sending */
|
||||
dcb_add_callback(dcb, DCB_REASON_DRAINED, avro_client_callback, this);
|
||||
|
||||
/* Add fake event that will call the avro_client_callback() routine */
|
||||
poll_fake_write_event(dcb);
|
||||
queue_client_callback();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -733,7 +722,7 @@ void AvroSession::client_callback()
|
||||
|
||||
if (next_file || read_more)
|
||||
{
|
||||
poll_fake_write_event(dcb);
|
||||
queue_client_callback();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,11 +173,6 @@ public:
|
||||
*/
|
||||
int routeQuery(GWBUF* buffer);
|
||||
|
||||
/**
|
||||
* Handler for the EPOLLOUT event
|
||||
*/
|
||||
void client_callback();
|
||||
|
||||
private:
|
||||
AvroSession(Avro* instance, MXS_SESSION* session);
|
||||
|
||||
@ -190,6 +185,8 @@ private:
|
||||
bool seek_to_gtid();
|
||||
bool stream_data();
|
||||
void rotate_avro_file(std::string fullname);
|
||||
void client_callback();
|
||||
void queue_client_callback();
|
||||
};
|
||||
|
||||
void read_table_info(uint8_t* ptr,
|
||||
|
Reference in New Issue
Block a user