Merge branch '2.4.0' into 2.4
This commit is contained in:
@ -112,7 +112,7 @@ PamClientSession* PamClientSession::create(const PamInstance& inst)
|
||||
}
|
||||
|
||||
PamClientSession* rval = NULL;
|
||||
if (!error && ((rval = new(std::nothrow) PamClientSession(dbhandle, inst)) == NULL))
|
||||
if (!error && ((rval = new (std::nothrow) PamClientSession(dbhandle, inst)) == NULL))
|
||||
{
|
||||
error = true;
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ PamInstance* PamInstance::create(char** options)
|
||||
bool error = false;
|
||||
/* This handle may be used from multiple threads, set full mutex. */
|
||||
sqlite3* dbhandle = NULL;
|
||||
int db_flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
|
||||
| SQLITE_OPEN_SHAREDCACHE | SQLITE_OPEN_FULLMUTEX;
|
||||
int db_flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |
|
||||
SQLITE_OPEN_SHAREDCACHE | SQLITE_OPEN_FULLMUTEX;
|
||||
const char* filename = pam_db_fname.c_str();
|
||||
if (sqlite3_open_v2(filename, &dbhandle, db_flags, NULL) != SQLITE_OK)
|
||||
{
|
||||
@ -74,7 +74,7 @@ PamInstance* PamInstance::create(char** options)
|
||||
error = true;
|
||||
}
|
||||
|
||||
char* err = NULL;
|
||||
char *err = NULL;
|
||||
if (!error && sqlite3_exec(dbhandle, drop_sql.c_str(), NULL, NULL, &err) != SQLITE_OK)
|
||||
{
|
||||
MXS_ERROR("Failed to drop table: '%s'", err);
|
||||
@ -88,9 +88,9 @@ PamInstance* PamInstance::create(char** options)
|
||||
error = true;
|
||||
}
|
||||
|
||||
PamInstance* instance = NULL;
|
||||
if (!error
|
||||
&& ((instance = new(std::nothrow) PamInstance(dbhandle, pam_db_fname, pam_table_name)) == NULL))
|
||||
PamInstance *instance = NULL;
|
||||
if (!error &&
|
||||
((instance = new (std::nothrow) PamInstance(dbhandle, pam_db_fname, pam_table_name)) == NULL))
|
||||
{
|
||||
error = true;
|
||||
}
|
||||
|
@ -570,6 +570,9 @@ char** parse_optstr(const char* str, const char* tok, int* szstore)
|
||||
*/
|
||||
static MXS_FILTER* createInstance(const char* name, MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
MXS_WARNING("The mqfilter has been DEPRECATED in MaxScale 2.4 "
|
||||
"and it will be removed in a future release of MaxScale.");
|
||||
|
||||
MQ_INSTANCE* my_instance = static_cast<MQ_INSTANCE*>(MXS_CALLOC(1, sizeof(MQ_INSTANCE)));
|
||||
|
||||
if (my_instance)
|
||||
|
@ -178,11 +178,16 @@ sqlite3* open_or_create_db(const std::string& path)
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Opening/creating the sqlite3 database %s failed: %s",
|
||||
path.c_str(), sqlite3_errstr(rv));
|
||||
if (pDb)
|
||||
{
|
||||
// Memory allocation failure is explained by the caller. Don't close the handle, as the
|
||||
// caller will still use it even if open failed!!
|
||||
MXS_ERROR("Opening/creating the sqlite3 database %s failed: %s",
|
||||
path.c_str(), sqlite3_errmsg(pDb));
|
||||
}
|
||||
MXS_ERROR("Could not open sqlite3 database for storing information "
|
||||
"about dynamically detected Clustrix nodes. The Clustrix "
|
||||
"monitor will remain dependant upon statically defined "
|
||||
"monitor will remain dependent upon statically defined "
|
||||
"bootstrap nodes.");
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ Avro::Avro(SERVICE* service, MXS_CONFIG_PARAMETER* params, SERVICE* source, SRow
|
||||
, handler(service, handler, params->get_compiled_regex("match", 0, NULL).release(),
|
||||
params->get_compiled_regex("exclude", 0, NULL).release())
|
||||
{
|
||||
if (params->contains(CN_SERVERS))
|
||||
if (params->contains(CN_SERVERS) || params->contains(CN_CLUSTER))
|
||||
{
|
||||
MXS_NOTICE("Replicating directly from a master server");
|
||||
cdc::Config cnf;
|
||||
|
@ -279,17 +279,20 @@ std::pair<std::string, std::string> get_avrofile_and_gtid(std::string file)
|
||||
auto first_dot = filename.find_first_of('.');
|
||||
auto last_dot = filename.find_last_of('.');
|
||||
|
||||
if (first_dot != std::string::npos
|
||||
&& last_dot != std::string::npos
|
||||
&& first_dot != last_dot)
|
||||
if (!file.empty())
|
||||
{
|
||||
// Exact file version specified e.g. test.t1.000002
|
||||
filename += ".avro";
|
||||
}
|
||||
else
|
||||
{
|
||||
// No version specified, send first file
|
||||
filename += ".000001.avro";
|
||||
if (first_dot != std::string::npos
|
||||
&& last_dot != std::string::npos
|
||||
&& first_dot != last_dot)
|
||||
{
|
||||
// Exact file version specified e.g. test.t1.000002
|
||||
filename += ".avro";
|
||||
}
|
||||
else
|
||||
{
|
||||
// No version specified, send first file
|
||||
filename += ".000001.avro";
|
||||
}
|
||||
}
|
||||
|
||||
return std::make_pair(filename, gtid);
|
||||
@ -329,13 +332,17 @@ void AvroSession::process_command(GWBUF* queue)
|
||||
|
||||
avro_binfile = file_and_gtid.first;
|
||||
|
||||
if (file_in_dir(router->avrodir.c_str(), avro_binfile.c_str()))
|
||||
if (avro_binfile.empty())
|
||||
{
|
||||
queue_client_callback();
|
||||
dcb_printf(dcb, "ERR NO-FILE Filename not specified.\n");
|
||||
}
|
||||
else if (!file_in_dir(router->avrodir.c_str(), avro_binfile.c_str()))
|
||||
{
|
||||
dcb_printf(dcb, "ERR NO-FILE File '%s' not found.\n", avro_binfile.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
dcb_printf(dcb, "ERR NO-FILE File '%s' not found.\n", avro_binfile.c_str());
|
||||
queue_client_callback();
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -714,6 +721,7 @@ void AvroSession::client_callback()
|
||||
|
||||
/** Stream the data to the client */
|
||||
bool read_more = stream_data();
|
||||
mxb_assert(!avro_binfile.empty() && strstr(avro_binfile.c_str(), ".avro"));
|
||||
std::string filename = get_next_filename(avro_binfile, router->avrodir);
|
||||
|
||||
bool next_file;
|
||||
|
@ -68,7 +68,7 @@ MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params)
|
||||
|
||||
Avro* router = Avro::create(service, handler);
|
||||
|
||||
if (router && !params->contains(CN_SERVERS))
|
||||
if (router && !params->contains(CN_SERVERS) && !params->contains(CN_CLUSTER))
|
||||
{
|
||||
conversion_task_ctl(router, true);
|
||||
}
|
||||
|
Reference in New Issue
Block a user