At service startup service->rate_limit.last is set back to USERS_REFRESH_TIME

At service startup service->rate_limit.last is set back to
USERS_REFRESH_TIME
This allows reloading users’ table as soon as possible

Fixed mysql_users_alloc instead of users_alloc in replace_mysql_users()
and added MYSQL_USER_MAXLEN where missing
This commit is contained in:
MassimilianoPinto
2014-02-28 18:26:24 +01:00
parent 92d94e16ac
commit c6cfc99ee3
2 changed files with 19 additions and 9 deletions

View File

@ -84,9 +84,9 @@ SERVICE *service;
service->enable_root = 0;
service->routerOptions = NULL;
service->databases = NULL;
memset(&service->rate_limit, 0, sizeof(SERVICE_REFRESH_RATE));
spinlock_init(&service->users_table_spin);
spinlock_init(&service->spin);
spinlock_init(&service->users_table_spin);
memset(&service->rate_limit, 0, sizeof(SERVICE_REFRESH_RATE));
spinlock_acquire(&service_spin);
service->next = allServices;
@ -121,6 +121,13 @@ GWPROTOCOL *funcs;
/* Allocate specific data for MySQL users */
service->users = mysql_users_alloc();
loaded = load_mysql_users(service);
/* At service start last update is set to USERS_REFRESH_TIME seconds earlier.
* This way MaxScale could try reloading users' just after startup
*/
service->rate_limit.last=time(NULL) - USERS_REFRESH_TIME;
service->rate_limit.nloads=1;
LOGIF(LM, (skygw_log_write(
LOGFILE_MESSAGE,
"Loaded %d MySQL Users.",