Merge branch '2.3' into develop

This commit is contained in:
Markus Mäkelä
2019-03-11 12:27:42 +02:00
13 changed files with 47 additions and 67 deletions

View File

@ -83,7 +83,7 @@ endif()
# Using initial-exec instead of the default global-dynamic tls-model
# reduces the cost of using thread-local variables in dynamic libraries.
target_compile_options(maxscale-common PUBLIC "-ftls-model=initial-exec")
target_compile_options(maxscale-common PRIVATE "-ftls-model=initial-exec")
add_dependencies(maxscale-common pcre2 connector-c libmicrohttpd jansson maxbase)
set_target_properties(maxscale-common PROPERTIES VERSION "1.0.0")

View File

@ -47,7 +47,7 @@ Backend::~Backend()
void Backend::close(close_type type)
{
mxb_assert(m_dcb->n_close == 0);
mxb_assert(m_dcb && m_dcb->n_close == 0);
if (!m_closed)
{
@ -180,7 +180,7 @@ void Backend::set_state(backend_state state)
bool Backend::connect(MXS_SESSION* session, SessionCommandList* sescmd)
{
mxb_assert(!in_use());
mxb_assert(!in_use() && m_dcb == nullptr);
bool rval = false;
if ((m_dcb = dcb_connect(m_backend->server, session, m_backend->server->protocol().c_str())))

View File

@ -313,7 +313,7 @@ const MXS_MODULE_PARAM config_service_params[] =
{CN_LOG_AUTH_WARNINGS, MXS_MODULE_PARAM_BOOL, "true"},
{CN_RETRY_ON_FAILURE, MXS_MODULE_PARAM_BOOL, "true"},
{CN_SESSION_TRACK_TRX_STATE, MXS_MODULE_PARAM_BOOL, "false"},
{CN_RETAIN_LAST_STATEMENTS, MXS_MODULE_PARAM_COUNT, "0"},
{CN_RETAIN_LAST_STATEMENTS, MXS_MODULE_PARAM_COUNT, "-1"},
{CN_CLUSTER, MXS_MODULE_PARAM_STRING},
{NULL}
};
@ -4869,36 +4869,6 @@ bool config_parse_disk_space_threshold(SERVER::DiskSpaceLimits* pDisk_space_thre
return success;
}
void dump_if_changed(const MXS_MODULE_PARAM* params,
int file,
const std::string& key,
const std::string& value)
{
for (int i = 0; params[i].name; i++)
{
if (params[i].name == key)
{
/**
* This detects only exact matches, not ones that are logically equivalent
* but lexicographically different e.g. 1 and true. This might not
* be a bad thing: it'll distinct user defined values from defaults.
*/
if (!params[i].default_value || value != params[i].default_value)
{
if (dprintf(file, "%s=%s\n", key.c_str(), value.c_str()) == -1)
{
MXS_ERROR("Failed to serialize service value: %d, %s",
errno,
mxs_strerror(errno));
}
}
break;
}
}
}
void dump_param_list(int file,
const MXS_CONFIG_PARAMETER* list,
const std::unordered_set<std::string>& ignored,
@ -4911,8 +4881,10 @@ void dump_param_list(int file,
const string& value = p.second;
if (ignored.count(name) == 0 && !value.empty())
{
dump_if_changed(common_params, file, name, value);
dump_if_changed(module_params, file, name, value);
if (dprintf(file, "%s=%s\n", name.c_str(), value.c_str()) == -1)
{
MXS_ERROR("Failed to serialize service value: %d, %s", errno, mxs_strerror(errno));
}
}
}
}

View File

@ -1942,7 +1942,7 @@ static void dcb_hangup_foreach_worker(MXB_WORKER* worker, struct SERVER* server)
for (DCB* dcb = this_unit.all_dcbs[id]; dcb; dcb = dcb->thread.next)
{
if (dcb->state == DCB_STATE_POLLING && dcb->server && dcb->server == server)
if (dcb->state == DCB_STATE_POLLING && dcb->server && dcb->server == server && dcb->n_close == 0)
{
if (!dcb->dcb_errhandle_called)
{

View File

@ -517,12 +517,13 @@ static bool create_filter_config(const SFilterDef& filter, const char* filename)
dprintf(file, "[%s]\n", filter->name.c_str());
dprintf(file, "%s=%s\n", CN_TYPE, CN_FILTER);
dprintf(file, "%s=%s\n", CN_MODULE, filter->module.c_str());
const MXS_MODULE* mod = get_module(filter->module.c_str(), NULL);
mxb_assert(mod);
MXS_MODULE_PARAM no_common_params = {};
dump_param_list(file, filter->parameters, {CN_TYPE}, &no_common_params, mod->parameters);
dump_param_list(file, filter->parameters, {CN_TYPE, CN_MODULE}, &no_common_params, mod->parameters);
close(file);
return true;

View File

@ -224,15 +224,7 @@ Service::Service(const std::string& name,
log_auth_warnings = params->get_bool(CN_LOG_AUTH_WARNINGS);
strip_db_esc = params->get_bool(CN_STRIP_DB_ESC);
session_track_trx_state = params->get_bool(CN_SESSION_TRACK_TRX_STATE);
if (params->contains(CN_RETAIN_LAST_STATEMENTS))
{
retain_last_statements = params->get_integer(CN_RETAIN_LAST_STATEMENTS);
}
else
{
retain_last_statements = -1; // Indicates that it has not been set.
}
retain_last_statements = params->get_integer(CN_RETAIN_LAST_STATEMENTS);
/**
* At service start last update is set to config->users_refresh_time seconds earlier.