log_manager.cc:

State update for filewriter was missing and that caused Maxscale to fail if opening of any log file failed.
dcb.c:
	Added EAGAIN and EWOULDBLOCK handling to dcb_read. If dcb_close is called for freshly created dcb, dcb is only freed.
gateway.c:
	Added file_write_footer and write_footer of which the latter is called at exit time. It simply draws a line to screen.
gw_utils.c:
	Some macros for helping comparison between gw_read_gwbuff and dcb_read, which overlap.
poll.c:
	Some macros to help enable/disable mutexing in poll_waitevents
service.c:
	Check return value of listen and session_alloc and behave accordingly.

mysql_client.c:
	If ioctl returned successfully with b==0 it earlier caused closing the client and backend dcbs. Since that doesn't reliably indicate that client has closed socket on its side, Maxscale doesn't close its sockets either.
mysql_common.c:
	In gw_receive_backend_auth, if dcb_read returns n==0, it is not considered as an error anymore. The implemented behavior is not yet complete and correct. Result should be successful but the protocol state shouldn't change to MYSQL_IDLE before backend return is received.
	In gw_send_authentication_to_backend protocol state was always set to MYSQL_AUTH_RECV even if gw_rwite had failed. Now, return value is read and state is set in caller's context basen on the return value.
skygw_utils.cc:
	Removed ss_dassert from skyge_file_init because it prevented from returning meaningful error meassage to the client.:
This commit is contained in:
vraatikka
2013-10-06 22:31:32 +03:00
parent e3a4be8b9d
commit 80b67d1083
11 changed files with 318 additions and 186 deletions

View File

@ -98,6 +98,9 @@ static void log_flush_shutdown(void);
static void log_flush_cb(void* arg);
static void libmysqld_done(void);
static bool file_write_header(FILE* outfile);
static bool file_write_footer(FILE* outfile);
static void write_footer(void);
/**
* Handler for SIGHUP signal. Reload the configuration for the
* gateway.
@ -211,7 +214,28 @@ return_home:
}
#endif
static void write_footer(void)
{
file_write_footer(stdout);
}
static bool file_write_footer(
FILE* outfile)
{
bool succp = false;
size_t wbytes1;
size_t len1;
const char* header_buf1;
header_buf1 = "------------------------------------------------------"
"\n\n";
len1 = strlen(header_buf1);
wbytes1=fwrite((void*)header_buf1, len1, 1, outfile);
succp = true;
return succp;
}
static bool file_write_header(
FILE* outfile)
{
@ -303,10 +327,11 @@ main(int argc, char **argv)
l = atexit(skygw_logmanager_exit);
if (l != 0) {
fprintf(stderr, "Couldn't register exit function.\n");
fprintf(stderr, "* Couldn't register exit function.\n");
}
atexit(datadir_cleanup);
atexit(write_footer);
for (n = 0; n < argc; n++)
{
if (strcmp(argv[n], "-d") == 0)
@ -327,8 +352,8 @@ main(int argc, char **argv)
skygw_log_write_flush(
LOGFILE_ERROR,
"Fatal : Unable to find a MaxScale "
"configuration file, either install one in "
"/etc/MaxScale.cnf, "
"configuration file, either install one "
"in /etc/MaxScale.cnf, "
"$MAXSCALE_HOME/etc/MaxScale.cnf "
"or use the -c option. Exiting.");
}
@ -469,7 +494,7 @@ main(int argc, char **argv)
"file, either install one in /etc/MaxScale.cnf, "
"$MAXSCALE_HOME/etc/MaxScale.cnf "
"or use the -c option. Exiting.");
fprintf(stderr, "Unable to find MaxScale configuration file. "
fprintf(stderr, "* Unable to find MaxScale configuration file. "
"Exiting.\n");
exit(1);
}
@ -483,7 +508,7 @@ main(int argc, char **argv)
server_options[i] = ddopt;
}
}
if (mysql_library_init(num_elements, server_options, server_groups))
{
skygw_log_write_flush(
@ -499,20 +524,20 @@ main(int argc, char **argv)
exit(1);
}
libmysqld_started = TRUE;
if (!config_load(cnf_file))
{
skygw_log_write_flush(
LOGFILE_ERROR,
"Fatal : Failed to load MaxScale configuration file %s. "
"Error : Failed to load MaxScale configuration file %s. "
"Exiting.",
cnf_file);
fprintf(stderr,
"Failed to load MaxScale configuration file. "
"* Failed to load MaxScale configuration file. "
"Exiting.\n");
exit(1);
}
skygw_log_write(
LOGFILE_MESSAGE,
"SkySQL MaxScale (C) SkySQL Ab 2013");
@ -534,7 +559,7 @@ main(int argc, char **argv)
"Fatal : Failed to start any MaxScale services. "
"Exiting.");
fprintf(stderr,
"Failed to start any MaxScale services. Exiting.\n");
"* Failed to start any MaxScale services. Exiting.\n");
exit(1);
}
skygw_log_write(