1. in query_classifier.cc autocommit_enabled, and transaction_active variables maintained their values across different sessions. Now those values are stored in each router_client_ses object.
2. As a part of implementation of MAX-95 session variables were added to BACKEND struct which is shared with all sessions using the SERVICE which the particular BACKEND serves. Now each router_client_ses object has a backend reference struct which includes pointer to BACKEND, DCB and to session command cursor.
Added test - set_autocommit_disabled.sql, test_after_autocommit_disabled.sql - to check that session variable is discarded when session where it belongs terminates.
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
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.
poll.c
Removed mutex from epoll_wait.
Removed read and write mutexes from poll_waitevents.
session.c
If session_alloc fails, instead of calling directly free(session), call session_free, which decreases refcounter and only frees session when there are no references left.
Added session_unlink_dcb function which removes link from session and optionally sets the dcb->session pointer to NULL.
readconnection.h, readwritesplit.h
Added check fields to ROUTER_CLIENT_SES strct as well as lock, version number (not used yet) and closed flag.
mysql_backend.c
gw_read_backend_event: if backend_protocol->state was set to MYSQL_AUTH_RECV, function returned, which was unnecessary. If mysql state became MYSQL_AUTH_FAILED, router client session was closed. Removed unnecessary NULL checks because rsession is not allowed to be NULL. Similarly, removed other NULL checks and replaced them with asserts checking that router client session is not NULL at any phase.
mysql_client.c
Removed unused code blocks. Polished log commands. Replaced router client sessions NULL checks with asserts.
mysql_common.c
mysql_send_custom_error: if called with dcb == NULL, return.
readconnroute.c
Replaced malloc with calloc. Added functions rses_begin_router_action and rses_exit_router_action. If router client session is not closed, they take a lock and release it, respectively. Those functions are used for protecting all operations which modify the contents of router client session struct.
readwritesplit.c
Identical changes than in readconnroute.c
skygw_debug.h
Added check number and - macro for ROUTER_CLIENT_SES, and added COM_QUIT to STRPACKETTYPE.
file_write_footer, added checks for the case of failed memory allocation.
service.c
serviceRestart, added check for return value of poll_add_dcb. In failure, service is not moved to SESSION_STATE_LISTENER state and listener counter is not increased.
Removed embedded server startup parameter '--skip-innodb' and replaced TRUE, and FALSE with true and false, respectively.
gateway.c
Removed embedded server startup parameter '--skip-innodb' because libmysqld inside MariaDB 5.5.33 + doesn't start with that paramter.
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.:
tuned error printing and log writing output format
dcb.c :
dcb_connect, check return value of poll_add_dcb and behave accordingly.
dcb_write, in case of SIFPIPE, only write to trace log.
dcb_close, dassert with incorrect dcb states.
gateway.c :
added file_write_header to print header similar than in logs to stderr.
main, add signal handler for SIGPIPE
poll.c :
poll_remove_dcb, don't fail if dcb is in NOPOLLING or in ZOMBIE states.
poll_waitevents, write EPOLLHUPs to trace log, don't even attempt to write to closed socket.
readconnection.h :
shortened comment.
readwritesplit.h :
replaced generic names with more specific ones.
httpd.c :
Check listen return value and behave accordingly.
mysql_backend.c :
Tiny clean up.
mysql_client.c :
gw_MySQLListener, Check listen return value and behave accordingly.
mysql_common.c :
Shortened a header.
telnetd.c :
telnetd_listen, check listen return value and behave accordingly.
readconnroute.c :
Tuned log writing format.
readwritesplit.c :
Added function search_backend_servers, which chooses suitable backend and master server among those known by Maxscale. Fixed clean-up routines. Not ready yet but works somehow.
testroute.c :
Cleanup.
skygw_utils.cc :
Log writing clean up.
- Checked argument types and counts
- Removed trailing line feeds
- Removed thread ids from error logs (they are used in trace / debug log
- Added some state information to dcbs
- Added prefix 'Error' or 'Fatal' to error logs.
- Switches all error logs to use flushing log write.
Reproduce #217 by connecting with telnet to debug client interface and execute command:
fail accept 23
and try to execute read query, for example, with
mysql -h 127.0.0.1 -P 4008 -u maxuser -pmaxpwd -e 'select current_user(), @@server_id'
: dcb_alloc switched malloc to calloc, dcb->fd is initialized to -1.
: dcb_process_zombies return value of close(fd) is checked. Closed fds are stored to conn_open array.
: dcb_connect assigns new fd only if backend connection succeeds. Dcb is added to poll set in the same way, only if connect succeed.
gateway.c : conn_open array is initialized in main. For each created socket, a true is set to corresponding slot. Max. number of slots is 1024.
mysql_client_server_protocol.h : gw_do_connect_to declaration
mysql_backend.c : gw_create_backend_connection returns rv >= 0 and a protocol which is assigned to backend_dcb. In error, -1 is returned and fd is not set.
mysql_client.c : conn_open array is kept up-to-date and protocol pointer is assigned also to dcb outside mysql_protocol_init.
mysql_common.c : gw_do_connect_to_backend 3rd argument is pointer to fd, not protocol. dcb is added to poll set later in dcb_connect.
skygw_debug.h : define conn_open[1024] array where open connections can be marked in debug build.