Filters are now loaded and created at startup

Previously filter instances were created when the first session was made. This
caused filter configuration errors to be noticed only after MaxScale was successfully
started. Now filters are loaded and the instance is created when a service applies its filters.
This commit is contained in:
Markus Makela
2015-11-16 10:38:55 +02:00
parent ab6dae897d
commit 40dc49c887
3 changed files with 45 additions and 24 deletions

View File

@ -1092,12 +1092,19 @@ int n = 0;
MXS_ERROR("Out of memory adding filters to service.");
return;
}
if ((flist[n-1] = filter_find(trim(ptr))) == NULL)
char *filter_name = trim(ptr);
if ((flist[n-1] = filter_find(filter_name)) == NULL)
{
MXS_WARNING("Unable to find filter '%s' for service '%s'\n",
trim(ptr), service->name);
filter_name, service->name);
n--;
}
else if (!filter_load(flist[n - 1]))
{
MXS_ERROR("Failed to load filter '%s' for service '%s'.",
filter_name, service->name);
}
flist[n] = NULL;
ptr = strtok_r(NULL, "|", &brkt);
}