Removed unnecessary argument from log manager commands because it is not used and it is always NULL.

This commit is contained in:
vraatikka
2013-08-04 23:30:47 +03:00
parent 9fb072ea74
commit cae4d38a7e
22 changed files with 202 additions and 215 deletions

View File

@ -153,12 +153,12 @@ char fname[1024], *home, *cpasswd;
sprintf(fname, "/usr/local/skysql/MaxScale/etc/passwd");
if (users == NULL)
{
skygw_log_write(NULL, LOGFILE_MESSAGE, "Create initial password file.\n");
skygw_log_write( LOGFILE_MESSAGE, "Create initial password file.\n");
if ((users = users_alloc()) == NULL)
return ADMIN_ERR_NOMEM;
if ((fp = fopen(fname, "w")) == NULL)
{
skygw_log_write(NULL, LOGFILE_ERROR,
skygw_log_write( LOGFILE_ERROR,
"Unable to create password file %s.\n",
fname);
return ADMIN_ERR_PWDFILEOPEN;
@ -173,7 +173,7 @@ char fname[1024], *home, *cpasswd;
users_add(users, uname, cpasswd);
if ((fp = fopen(fname, "a")) == NULL)
{
skygw_log_write(NULL, LOGFILE_ERROR,
skygw_log_write( LOGFILE_ERROR,
"Unable to append to password file %s.\n",
fname);
return ADMIN_ERR_FILEAPPEND;
@ -207,14 +207,14 @@ char* admin_remove_user(
int n_deleted;
if (!admin_search_user(uname)) {
skygw_log_write(NULL,
skygw_log_write(
LOGFILE_MESSAGE,
"Couldn't find user %s. Removing user failed", uname);
return ADMIN_ERR_USERNOTFOUND;
}
if (admin_verify(uname, passwd) == 0) {
skygw_log_write(NULL,
skygw_log_write(
LOGFILE_MESSAGE,
"Authentication failed, wrong user/password combination.\n"
"Removing user failed");
@ -226,7 +226,7 @@ char* admin_remove_user(
n_deleted = users_delete(users, uname);
if (n_deleted == 0) {
skygw_log_write(NULL,
skygw_log_write(
LOGFILE_MESSAGE,
"Deleting the only user is forbidden. add new user "
"before deleting the old one.\n");
@ -248,7 +248,7 @@ char* admin_remove_user(
if ((fp = fopen(fname, "r")) == NULL)
{
int err = errno;
skygw_log_write(NULL, LOGFILE_ERROR,
skygw_log_write( LOGFILE_ERROR,
"Unable to open password file %s : errno %d.\n"
"Removing user from file failed; it must be done manually.",
fname,
@ -261,7 +261,7 @@ char* admin_remove_user(
if ((fp_tmp = fopen(fname_tmp, "w")) == NULL)
{
int err = errno;
skygw_log_write(NULL, LOGFILE_ERROR,
skygw_log_write( LOGFILE_ERROR,
"Unable to open tmp file %s : errno %d.\n"
"Removing user from passwd file failed; "
"it must be done manually.",
@ -276,7 +276,7 @@ char* admin_remove_user(
*/
if (fgetpos(fp, &rpos) != 0) {
int err = errno;
skygw_log_write(NULL, LOGFILE_ERROR,
skygw_log_write( LOGFILE_ERROR,
"Unable to process passwd file %s : errno %d.\n"
"Removing user from file failed, and must be done manually.",
fname,
@ -298,7 +298,7 @@ char* admin_remove_user(
if (fgetpos(fp, &rpos) != 0) {
int err = errno;
skygw_log_write(NULL, LOGFILE_ERROR,
skygw_log_write( LOGFILE_ERROR,
"Unable to process passwd file %s : errno %d.\n"
"Removing user from file failed, and must be "
"done manually.",
@ -313,7 +313,7 @@ char* admin_remove_user(
*/
if (rename(fname_tmp, fname)) {
int err = errno;
skygw_log_write(NULL, LOGFILE_ERROR,
skygw_log_write( LOGFILE_ERROR,
"Unable to rename new passwd file %s : errno %d.\n"
"Rename it to %s manually.",
fname_tmp,

View File

@ -170,7 +170,7 @@ CONFIG_CONTEXT *obj;
{
char *type = config_get_value(obj->parameters, "type");
if (type == NULL)
skygw_log_write(NULL, LOGFILE_ERROR, "Object %s has no type\n", obj->object);
skygw_log_write( LOGFILE_ERROR, "Object %s has no type\n", obj->object);
else if (!strcmp(type, "service"))
{
char *router = config_get_value(obj->parameters, "router");
@ -183,7 +183,7 @@ CONFIG_CONTEXT *obj;
serviceSetUser(obj->element, user, auth);
}
else
skygw_log_write(NULL, LOGFILE_ERROR, "No router define for service '%s'\n",
skygw_log_write( LOGFILE_ERROR, "No router define for service '%s'\n",
obj->object);
}
else if (!strcmp(type, "server"))
@ -399,7 +399,7 @@ SERVER *server;
{
char *type = config_get_value(obj->parameters, "type");
if (type == NULL)
skygw_log_write(NULL, LOGFILE_ERROR, "Object %s has no type\n", obj->object);
skygw_log_write( LOGFILE_ERROR, "Object %s has no type\n", obj->object);
else if (!strcmp(type, "service"))
{
char *router = config_get_value(obj->parameters, "router");
@ -422,7 +422,7 @@ SERVER *server;
}
}
else
skygw_log_write(NULL, LOGFILE_ERROR, "No router defined for service '%s'\n",
skygw_log_write( LOGFILE_ERROR, "No router defined for service '%s'\n",
obj->object);
}
else if (!strcmp(type, "server"))

View File

@ -102,19 +102,19 @@ getUsers(SERVICE *service, struct users *users)
serviceGetUser(service, &service_user, &service_passwd);
/** multi-thread environment requires that thread init succeeds. */
if (mysql_thread_init()) {
skygw_log_write_flush(NULL, LOGFILE_ERROR, "ERROR : mysql_thread_init failed.\n");
skygw_log_write_flush(LOGFILE_ERROR, "ERROR : mysql_thread_init failed.\n");
return -1;
}
con = mysql_init(NULL);
if (con == NULL) {
skygw_log_write(NULL, LOGFILE_ERROR, "mysql_init: %s\n", mysql_error(con));
skygw_log_write( LOGFILE_ERROR, "mysql_init: %s\n", mysql_error(con));
return -1;
}
if (mysql_options(con, MYSQL_OPT_USE_REMOTE_CONNECTION, NULL)) {
skygw_log_write_flush(NULL, LOGFILE_ERROR, "Fatal : failed to set external connection. "
skygw_log_write_flush(LOGFILE_ERROR, "Fatal : failed to set external connection. "
"It is needed for backend server connections. Exiting.\n");
return -1;
}
@ -140,7 +140,6 @@ getUsers(SERVICE *service, struct users *users)
if (server == NULL)
{
skygw_log_write(
NULL,
LOGFILE_ERROR,
"Unable to get user data from backend database for service "
"%s. Missing server information.",
@ -150,7 +149,7 @@ getUsers(SERVICE *service, struct users *users)
}
if (mysql_query(con, "SELECT user, password FROM mysql.user")) {
skygw_log_write(NULL, LOGFILE_ERROR,
skygw_log_write( LOGFILE_ERROR,
"Loading users for service %s encountered error: %s\n",
service->name, mysql_error(con));
mysql_close(con);
@ -160,7 +159,7 @@ getUsers(SERVICE *service, struct users *users)
result = mysql_store_result(con);
if (result == NULL) {
skygw_log_write(NULL, LOGFILE_ERROR,
skygw_log_write( LOGFILE_ERROR,
"Loading users for service %s encountered error: %s\n",
service->name, mysql_error(con));
mysql_close(con);

View File

@ -126,7 +126,7 @@ dcb_free(DCB *dcb)
{
if (dcb->state == DCB_STATE_ZOMBIE)
{
skygw_log_write(NULL, LOGFILE_ERROR, "Call to free a DCB that is already a zombie.\n");
skygw_log_write( LOGFILE_ERROR, "Call to free a DCB that is already a zombie.\n");
return;
}
@ -144,7 +144,7 @@ dcb_free(DCB *dcb)
{
if (ptr == dcb)
{
skygw_log_write(NULL, LOGFILE_ERROR, "Attempt to add DCB to zombie queue "
skygw_log_write( LOGFILE_ERROR, "Attempt to add DCB to zombie queue "
"when it is already in the queue");
break;
}
@ -285,7 +285,7 @@ GWPROTOCOL *funcs;
if ((funcs = (GWPROTOCOL *)load_module(protocol, MODULE_PROTOCOL)) == NULL)
{
dcb_final_free(dcb);
skygw_log_write(NULL, LOGFILE_ERROR,
skygw_log_write( LOGFILE_ERROR,
"Failed to load protocol module for %s, feee dcb %p\n", protocol, dcb);
return NULL;
}
@ -295,7 +295,7 @@ GWPROTOCOL *funcs;
if ((dcb->fd = dcb->func.connect(dcb, server, session)) == -1)
{
dcb_final_free(dcb);
skygw_log_write(NULL, LOGFILE_ERROR, "Failed to connect to server %s:%d, free dcb %p\n",
skygw_log_write( LOGFILE_ERROR, "Failed to connect to server %s:%d, free dcb %p\n",
server->name, server->port, dcb);
return NULL;
}

View File

@ -90,14 +90,14 @@ static char datadir[1024] = "";
*/
static void sighup_handler (int i)
{
skygw_log_write(NULL, LOGFILE_MESSAGE, "Refreshing configuration following SIGHUP\n");
skygw_log_write( LOGFILE_MESSAGE, "Refreshing configuration following SIGHUP\n");
config_reload();
}
static void sigterm_handler (int i) {
extern void shutdown_gateway();
skygw_log_write(NULL, LOGFILE_ERROR, "Signal SIGTERM %i received ...Exiting!\n", i);
skygw_log_write( LOGFILE_ERROR, "Signal SIGTERM %i received ...Exiting!\n", i);
shutdown_gateway();
}
@ -110,7 +110,7 @@ static void signal_set (int sig, void (*handler)(int)) {
sigact.sa_handler = handler;
GW_NOINTR_CALL(err = sigaction(sig, &sigact, NULL));
if (err < 0) {
skygw_log_write(NULL, LOGFILE_ERROR,"sigaction() error %s\n", strerror(errno));
skygw_log_write( LOGFILE_ERROR,"sigaction() error %s\n", strerror(errno));
exit(1);
}
}
@ -261,7 +261,7 @@ char ddopt[1024];
if (s==10) {
skygw_log_write(
NULL, LOGFILE_ERROR,
LOGFILE_ERROR,
"Fatal : missing file name. \n"
"Unable to find a MaxScale configuration file, "
"either install one in /etc/MaxScale.cnf, "
@ -280,7 +280,7 @@ char ddopt[1024];
if (daemon_mode == 1)
{
if (sigfillset(&sigset) != 0) {
skygw_log_write(NULL,
skygw_log_write(
LOGFILE_ERROR,
"sigfillset() error %s\n",
strerror(errno));
@ -288,21 +288,21 @@ char ddopt[1024];
}
if (sigdelset(&sigset, SIGHUP) != 0) {
skygw_log_write(NULL,
skygw_log_write(
LOGFILE_ERROR,
"sigdelset(SIGHUP) error %s\n",
strerror(errno));
}
if (sigdelset(&sigset, SIGTERM) != 0) {
skygw_log_write(NULL,
skygw_log_write(
LOGFILE_ERROR,
"sigdelset(SIGTERM) error %s\n",
strerror(errno));
}
if (sigprocmask(SIG_SETMASK, &sigset, NULL) != 0) {
skygw_log_write(NULL,
skygw_log_write(
LOGFILE_ERROR,
"sigprocmask() error %s\n",
strerror(errno));
@ -366,12 +366,12 @@ char ddopt[1024];
argv[1] = "-g";
argv[2] = buf;
argv[3] = NULL;
skygw_logmanager_init(NULL, 3, argv);
skygw_logmanager_init(3, argv);
}
if (cnf_file == NULL) {
skygw_log_write_flush(
NULL, LOGFILE_ERROR,
LOGFILE_ERROR,
"Fatal : Unable to find a MaxScale configuration file, either "
"install one in /etc/MaxScale.cnf, $MAXSCALE_HOME/etc/MaxScale.cnf "
"or use the -c option. Exiting.\n");
@ -391,7 +391,6 @@ char ddopt[1024];
if (mysql_library_init(num_elements, server_options, server_groups))
{
skygw_log_write_flush(
NULL,
LOGFILE_ERROR,
"Fatal : mysql_library_init failed, %s. This is mandatory "
"component, required by router services and the MaxScale core, "
@ -406,16 +405,15 @@ char ddopt[1024];
if (!config_load(cnf_file))
{
skygw_log_write_flush(
NULL,
LOGFILE_ERROR,
"Failed to load MaxScale configuration file %s", cnf_file);
exit(1);
}
skygw_log_write(NULL,
skygw_log_write(
LOGFILE_MESSAGE,
"SkySQL MaxScale (C) SkySQL Ab 2013");
skygw_log_write(NULL,
skygw_log_write(
LOGFILE_MESSAGE,
"MaxScale is starting, PID %i",
getpid());
@ -426,8 +424,7 @@ char ddopt[1024];
* Start the services that were created above
*/
n_services = serviceStartAll();
skygw_log_write_flush(NULL,
LOGFILE_MESSAGE,
skygw_log_write_flush(LOGFILE_MESSAGE,
"Start modules completed");
/*
@ -445,7 +442,7 @@ char ddopt[1024];
/* Stop all the monitors */
monitorStopAll();
skygw_log_write(NULL,
skygw_log_write(
LOGFILE_MESSAGE,
"MaxScale shutdown, PID %i\n",
getpid());

View File

@ -81,14 +81,14 @@ MODULES *mod;
sprintf(fname, "%s/modules/lib%s.so", home, module);
if (access(fname, F_OK) == -1)
{
skygw_log_write(NULL, LOGFILE_ERROR,
skygw_log_write( LOGFILE_ERROR,
"Unable to find library for module: %s\n", module);
return NULL;
}
}
if ((dlhandle = dlopen(fname, RTLD_NOW|RTLD_LOCAL)) == NULL)
{
skygw_log_write(NULL, LOGFILE_ERROR,
skygw_log_write( LOGFILE_ERROR,
"Unable to load library for module: %s, %s\n", module, dlerror());
return NULL;
}
@ -96,7 +96,6 @@ MODULES *mod;
if ((sym = dlsym(dlhandle, "version")) == NULL)
{
skygw_log_write_flush(
NULL,
LOGFILE_ERROR,
"Version interface not supported by module: %s, %s\n",
module,
@ -119,7 +118,6 @@ MODULES *mod;
if ((sym = dlsym(dlhandle, "GetModuleObject")) == NULL)
{
skygw_log_write_flush(
NULL,
LOGFILE_ERROR,
"Expected entry point interface missing from module: "
"%s, %s\n",
@ -131,8 +129,7 @@ MODULES *mod;
ep = sym;
modobj = ep();
skygw_log_write_flush(NULL,
LOGFILE_MESSAGE,
skygw_log_write_flush(LOGFILE_MESSAGE,
"Loaded module %s: %s\n",
module,
version);

View File

@ -61,7 +61,7 @@ MONITOR *mon;
mon->name = strdup(name);
if ((mon->module = load_module(module, MODULE_MONITOR)) == NULL)
{
skygw_log_write(NULL, LOGFILE_ERROR, "Unable to load monitor module '%s'\n", name);
skygw_log_write( LOGFILE_ERROR, "Unable to load monitor module '%s'\n", name);
free(mon->name);
free(mon);
return NULL;

View File

@ -70,31 +70,31 @@ int fd;
/* open secret file */
if ((fd = open(secret_file, O_RDONLY)) < 0)
{
skygw_log_write(NULL, LOGFILE_ERROR, "secrets_readKeys, failed opening secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno));
skygw_log_write( LOGFILE_ERROR, "secrets_readKeys, failed opening secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno));
return NULL;
}
/* accessing file details */
if (fstat(fd, &secret_stats) < 0) {
skygw_log_write(NULL, LOGFILE_ERROR, "secrets_readKeys, failed accessing secret file details [%s]. Error %i, %s\n", secret_file, errno, strerror(errno));
skygw_log_write( LOGFILE_ERROR, "secrets_readKeys, failed accessing secret file details [%s]. Error %i, %s\n", secret_file, errno, strerror(errno));
return NULL;
}
if (secret_stats.st_size != sizeof(MAXKEYS))
{
skygw_log_write(NULL, LOGFILE_ERROR, "Secrets file %s is incorrect size\n", secret_file);
skygw_log_write( LOGFILE_ERROR, "Secrets file %s is incorrect size\n", secret_file);
return NULL;
}
if (secret_stats.st_mode != (S_IRUSR|S_IFREG))
{
skygw_log_write(NULL, LOGFILE_ERROR, "Ignoring secrets file, permissions must be read only fo rthe owner\n");
skygw_log_write( LOGFILE_ERROR, "Ignoring secrets file, permissions must be read only fo rthe owner\n");
return NULL;
}
if ((keys = (MAXKEYS *)malloc(sizeof(MAXKEYS))) == NULL)
{
skygw_log_write(NULL, LOGFILE_ERROR,
skygw_log_write( LOGFILE_ERROR,
"Insufficient memory to create the keys structure.\n");
return NULL;
}
@ -102,13 +102,13 @@ int fd;
/* read all data from file */
if (read(fd, keys, sizeof(MAXKEYS)) != sizeof(MAXKEYS))
{
skygw_log_write(NULL, LOGFILE_ERROR, "secrets_readKeys, failed reading from secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno));
skygw_log_write( LOGFILE_ERROR, "secrets_readKeys, failed reading from secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno));
return NULL;
}
/* Close the file */
if (close(fd) < 0) {
skygw_log_write(NULL, LOGFILE_ERROR, "secrets_readKeys, failed closing the secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno));
skygw_log_write( LOGFILE_ERROR, "secrets_readKeys, failed closing the secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno));
return NULL;
}
@ -132,7 +132,7 @@ MAXKEYS key;
/* Open for writing | Create | Truncate the file for writing */
if ((fd = open(secret_file, O_CREAT | O_WRONLY | O_TRUNC), S_IRUSR) < 0)
{
skygw_log_write(NULL, LOGFILE_ERROR, "secrets_createKeys, failed opening secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno));
skygw_log_write( LOGFILE_ERROR, "secrets_createKeys, failed opening secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno));
return 1;
}
@ -143,14 +143,14 @@ MAXKEYS key;
/* Write data */
if (write(fd, &key, sizeof(key)) < 0)
{
skygw_log_write(NULL, LOGFILE_ERROR, "secrets_createKeys, failed writing into secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno));
skygw_log_write( LOGFILE_ERROR, "secrets_createKeys, failed writing into secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno));
return 1;
}
/* close file */
if (close(fd) < 0)
{
skygw_log_write(NULL, LOGFILE_ERROR, "secrets_createKeys, failed closing the secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno));
skygw_log_write( LOGFILE_ERROR, "secrets_createKeys, failed closing the secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno));
}
chmod(secret_file, S_IRUSR);

View File

@ -302,7 +302,7 @@ server_update(SERVER *server, char *protocol, char *user, char *passwd)
{
if (!strcmp(server->protocol, protocol))
{
skygw_log_write(NULL,
skygw_log_write(
LOGFILE_MESSAGE,
"Update server protocol for server %s to protocol %s",
server->name,
@ -315,7 +315,7 @@ server_update(SERVER *server, char *protocol, char *user, char *passwd)
if (strcmp(server->monuser, user) == 0 ||
strcmp(server->monpw, passwd) == 0)
{
skygw_log_write(NULL,
skygw_log_write(
LOGFILE_MESSAGE,
"Update server monitor credentials for server %s",
server->name);

View File

@ -112,7 +112,7 @@ GWPROTOCOL *funcs;
loaded = load_mysql_users(service);
skygw_log_write(NULL, LOGFILE_MESSAGE, "MySQL Users loaded: %i\n", loaded);
skygw_log_write( LOGFILE_MESSAGE, "MySQL Users loaded: %i\n", loaded);
}
if ((funcs = (GWPROTOCOL *)load_module(port->protocol, MODULE_PROTOCOL)) == NULL)
@ -605,12 +605,12 @@ void *router_obj;
{
if ((router_obj = load_module(router, MODULE_ROUTER)) == NULL)
{
skygw_log_write(NULL, LOGFILE_ERROR, "Failed to update router for service %s to %s",
skygw_log_write( LOGFILE_ERROR, "Failed to update router for service %s to %s",
service->name, router);
}
else
{
skygw_log_write(NULL, LOGFILE_MESSAGE, "Update router for service %s to %s",
skygw_log_write( LOGFILE_MESSAGE, "Update router for service %s to %s",
service->name, router);
free(service->routerModule);
service->routerModule = strdup(router);
@ -619,7 +619,7 @@ void *router_obj;
}
if (user && (strcmp(service->credentials.name, user) != 0 || strcmp(service->credentials.authdata, auth) != 0))
{
skygw_log_write(NULL, LOGFILE_MESSAGE, "Update credentials for service %s", service->name);
skygw_log_write( LOGFILE_MESSAGE, "Update credentials for service %s", service->name);
serviceSetUser(service, user, auth);
}
}

View File

@ -62,12 +62,12 @@ int setnonblocking(int fd) {
int fl;
if ((fl = fcntl(fd, F_GETFL, 0)) == -1) {
skygw_log_write(NULL, LOGFILE_ERROR, "Can't GET fcntl for %i, errno = %d, %s", fd, errno, strerror(errno));
skygw_log_write( LOGFILE_ERROR, "Can't GET fcntl for %i, errno = %d, %s", fd, errno, strerror(errno));
return 1;
}
if (fcntl(fd, F_SETFL, fl | O_NONBLOCK) == -1) {
skygw_log_write(NULL, LOGFILE_ERROR, "Can't SET fcntl for %i, errno = %d, %s", fd, errno, strerror(errno));
skygw_log_write( LOGFILE_ERROR, "Can't SET fcntl for %i, errno = %d, %s", fd, errno, strerror(errno));
return 1;
}

View File

@ -72,7 +72,7 @@ version()
void
ModuleInit()
{
skygw_log_write(NULL, LOGFILE_MESSAGE, "Initialise the MySQL Galera Monitor module %s.\n",
skygw_log_write( LOGFILE_MESSAGE, "Initialise the MySQL Galera Monitor module %s.\n",
version_str);
}
@ -334,8 +334,7 @@ MONITOR_SERVERS *ptr;
if (mysql_thread_init())
{
skygw_log_write_flush(NULL,
LOGFILE_ERROR,
skygw_log_write_flush(LOGFILE_ERROR,
"Fatal : mysql_init_thread failed in monitor "
"module. Exiting.\n");
return;

View File

@ -76,7 +76,7 @@ version()
void
ModuleInit()
{
skygw_log_write(NULL, LOGFILE_MESSAGE, "Initialise the MySQL Monitor module %s.\n",
skygw_log_write( LOGFILE_MESSAGE, "Initialise the MySQL Monitor module %s.\n",
version_str);
}
@ -372,8 +372,7 @@ MONITOR_SERVERS *ptr;
if (mysql_thread_init())
{
skygw_log_write_flush(NULL,
LOGFILE_ERROR,
skygw_log_write_flush(LOGFILE_ERROR,
"Fatal : mysql_init_thread failed in monitor "
"module. Exiting.\n");
return;

View File

@ -91,7 +91,7 @@ void
ModuleInit()
{
#if defined(SS_DEBUG)
skygw_log_write(NULL,
skygw_log_write(
LOGFILE_MESSAGE,
strdup("Initial MySQL Backend Protcol module."));
#endif

View File

@ -78,7 +78,7 @@ version()
void
ModuleInit()
{
skygw_log_write(NULL, LOGFILE_MESSAGE, "Initialise debug CLI router module %s.\n", version_str);
skygw_log_write( LOGFILE_MESSAGE, "Initialise debug CLI router module %s.\n", version_str);
spinlock_init(&instlock);
instances = NULL;
}

View File

@ -114,7 +114,7 @@ version()
void
ModuleInit()
{
skygw_log_write(NULL,
skygw_log_write(
LOGFILE_MESSAGE,
"Initialise readconnroute router module %s.\n", version_str);
spinlock_init(&instlock);

View File

@ -88,8 +88,7 @@ version()
void
ModuleInit()
{
skygw_log_write_flush(NULL,
LOGFILE_MESSAGE,
skygw_log_write_flush(LOGFILE_MESSAGE,
"Initialize read/write split router module.\n");
spinlock_init(&instlock);
instances = NULL;
@ -104,8 +103,7 @@ ModuleInit()
* @return The module object
*/
ROUTER_OBJECT* GetModuleObject() {
skygw_log_write(NULL,
LOGFILE_TRACE,
skygw_log_write(LOGFILE_TRACE,
"Returning readwritesplit router module object.");
return &MyObject;
}
@ -206,17 +204,17 @@ static void* newSession(
int i;
if ((client = (CLIENT_SESSION *)malloc(sizeof(CLIENT_SESSION))) == NULL)
{
{
return NULL;
}
/**
* Find a backend server to connect to. This is the extent of the
* load balancing algorithm we need to implement for this simple
* connection router.
*/
for (i = 0; inst->servers[i]; i++)
{
{
if (inst->servers[i] && SERVER_IS_SLAVE(inst->servers[i]->server))
{
@ -226,8 +224,8 @@ static void* newSession(
}
/**
* Loop over all the servers and find any that have fewer connections than our
* candidate server.
* Loop over all the servers and find any that have fewer connections
* than our candidate server.
*
* If a server has less connections than the current candidate we mark this
* as the new candidate to connect to.
@ -434,7 +432,7 @@ static int routeQuery(
"Packet type\t%s",
STRPACKETTYPE(packet_type));
#endif
switch (qtype) {
case QUERY_TYPE_WRITE:
#if defined(SS_DEBUG_)