if ioctl() return 0 bytes, recv(..., MSG_PEEK) is called, reading 1 byte.
if recv returns 0 or -1 the socket is closed and dcb->func.close(dcb) is called.
Client, session and backend connections will be closed
Tested with 4 MaxScale running threads
Added macros which allow for testing locally if log is enabled or not.
server/Makefile
Added directory creation command to Makefile. This fixes problem where errmsg.sys was copied to MaxScale/mysql instead of MaxScale/mysql/errmsg.sys
dcb.b
Added external variable which carries the information of enabled logs from log_manager.cc
gateway.c
Tuned logging.
Removed MARIADB_SRC_PATH
Added MYSQL_ROOT - root directory where MariaDB headers are installed
Added MYSQL_HEADERS - -I notation for three header directories
Added EMBEDDED_LIB - for embedded library directory
Added ERRMSG - for errmsg.sys file
log_manager.cc
Little fixes
log_manager/makefile
Updated header include directive
makefile.inc
Removed DEBUGGER and BACKGR as unnecessary
Added LIB for embedded library file name
query_classifier/makefile
Updated header include directives and embedded library directory
query_classifier/query_classifier.cc
clean up
server/core/Makefile
Updated header include directives and embedded library directory
Added libaio and install of errmsg.sys
server/core/dcb.c
clean up
server/core/gateway.c
Added --language and --skip-innodb to mysql_library_init command-line arguments list
clean up
server/core/load_utils.c
clean up
server/modules/monitor/Makefile
server/modules/routing/readwritesplit/Makefile
Updated header include directives and embedded library directory
utils/skygw_debug.h
http://bugs.skysql.com/show_bug.cgi?id=369
utils/skygw_types.h
utils/skygw_utils.cc
clean up
Added global variable lm_enabled_logfiles_bitmask which holds a bit for each enbaled logfile. It is updated when situation changes.
gateway.c
Changed gateway.c:main so that command-line argument -f specifies either the name of config file in $MAXSCALE_HOME/etc or exact location and name of it. Updated README correspondingly.
Added eternal variable lm_enabled_logfiles_bitmask to be used for quick check before calling logging library functions.
Added following static functions:
bool file_is_readable(char*)
bool file_is_writable(char)
void usage(void)
char* get_expanded_pathname(char*, char*, char*)
void print_log_n_stderr(bool, bool, char*, char*, int)
bool resolve_maxscale_conf_fname(char**, char*, char*)
bool resolve_maxscale_homedir(char**)
Added new command-line argument '-f' which allows the user for specifying relative, or absolute pathname for configuration file. It is also possible to specify only a file name which will be concatenated to path held in MAXSCALE_HOME environment variable.
Old command-line parameter '-c' allow the user for specifying MaxScale home directory also as relative or absolute path. Relative path will be expanded before tested for readability and for writeability.
renamed file_exists to file_exists_and_is_writable, added missing file open flags.
gateway.c
Removed command-line parameter '-m' because setting LD_LIBRARY_PATH after the program has started has no effect.
Corrected some comments.
external optind variable must be reset before using it because getopt may have been called earlier in the same process and without resetting argument parsing fails.
dcb.c
check dcb state before attempting to write to dcb in dcb_write
gateway.c
daemon_mode moved to global so that it can be taken into account when deciding where to print messages.
added get_config_filename by using home directory name given as a parameter. Returns absolute paths to config file and to home directory regardless of home directory argument was relative of absolute.
In main, arguments are parsed by using getopt.
Changed argument '-c' to specify home directory because MaxScale.cnf is always in <home>/etc/ directory.
Added argument '-m' to specify modules directory. Both arguments override any other settings.
skygw_types.h
Added PATH_MAX
Commented why spread-down logging is disabled.
In MaxScale start, log paths are printed in their complete form to make it easier to copy-paste the names.
gateway.c
Replaced print_signal_set_error with more general-purpose print_log_n_stderr which prints non-formatted messages to error log and to stderr to the point MaxScale switches to run in daemon process. After that only error log is printed.
skyge_utils.cc
polish
Replaced fprintf's with log write commands, removed the second argument from call of mysql_reset_thd_for_next_command(thd) according to changes in mariadb/5.5/sql/sql_parse.c #rev 3958.
server/Makefile
Instead of installing MaxScale.cnf (and overwriting previous config file), install MaxScale_template.cnf to DEST directory.
config.c
Replace references to 'Gateway' with 'MaxScale', change configuration parameter 'auth' to 'passwd' as it is named in other instances where referenced to password.
Declared program_invocation_name, and program_invocation_short_name. They are used as identifier strings in syslog logging in cases where log_manager is not initialized explicitly and/or the caller hasn't specified program name as one of the arguments in arguments array.
Fixed memory corruption. Length of sequence number of file name was calculated to as one too short and one byte was written to unallocated memory.
Freed also the linkpath in cases where at least one of the log files is written to shm and a symlink is added to log directory.
mysql_client.c
Added debug check for protocol pointer because of memory issues in mysql_client.c
Added syslog support. There's a new argument '-l' which takes log file ids as additional arguments. Writes to those logs will be written to syslog as well. syslog write causes additional overhead. Thus, writing frequently may become a bottleneck.
gateway.c
Set LOGFILE_ERROR, and LOGFILE_MESSAGE to be log files whose writes will be copied to syslog too.
Added new argument '-s' which takes additional argument composed of list of logfile identifiers. Logfiles listed with '-s' will be written on main memory instead of disk. In practice, the log file in question will be written in /dev/shm but corresponding symlink is added to log directory. In the case of name conflicts with log files and links, a differentiating sequence number is included in hte name of the file. This, however, is done only when existing file is not writable or is of different type (symlink <> file).
Added new logfile LOGFILE_DEBUG whose contents will be largerly what was included up to date in trace log.
Disabled feature which spreads writes to log files to others because of bug (#338) in the way block buffers are managed.
Changed log manager parameters to match with the current implementation. List of arguments:
"-h - help\n"
"-a <debug prefix> ............(\"skygw_debug\")\n"
"-b <debug suffix> ............(\".log\")\n"
"-c <trace prefix> ............(\"skygw_trace\")\n"
"-d <trace suffix> ............(\".log\")\n"
"-e <message prefix> ............(\"skygw_msg\")\n"
"-f <message suffix> ............(\".log\")\n"
"-g <error prefix> ............(\"skygw_err\")\n"
"-i <error suffix> ............(\".log\")\n"
"-j <log path> ............(\"/tmp\")\n"
"-s <shmem log file ids> ........(no default)\n";
dcb.c
dcb_add_to_zombieslist, add dcb to the front of zombies list instead of inserting to the end of it.
gateway.c
Renamed shutdown_gateway to shutdown_server (Bug #131)
Call skygw_logmanager_init so that trace and debug logs are written to shared memory.
poll.c
dcb.h
Removed some dead code and references to unneeded mutexes.
debugcmd.c
Added enable/disable log command for debug log.
skygw_utils.cc
skygw_file_init now takes optional symlink name as a second argument. Symlink is created to point to the file being created.