675 Commits

Author SHA1 Message Date
Massimiliano Pinto
9646df0cc4 Added details for external packages/libraries needed for compiling MaxScale 2013-12-16 13:41:42 +01:00
Massimiliano Pinto
0e4b8b8b56 Added instructions for missing embedded_priv.h header file 2013-12-16 13:30:01 +01:00
Massimiliano Pinto
fca454fbde The README file has been modified with the new compile instructions:
- MariaDB RPMS
- Existing MariaDB setup
- errmsg.sys file requirements
- static or dynamic embedded mariadb library
2013-12-16 11:20:24 +01:00
Massimiliano Pinto
b6c907eef1 In gw_read_client_event() there is a new method detecting closed client sockets:
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
2013-12-16 09:35:00 +01:00
vraatikka
058d0f4492 Modified comments to be compatible with doxygen 2013-12-13 19:32:10 +02:00
vraatikka
97bc1ed042 Fixed comments to be compatible with doxygen 2013-12-13 19:11:10 +02:00
vraatikka
d700754baa log_manager.cc
Bug #372, http://bugs.skysql.com/show_bug.cgi?id=372
	Do not exceed the buffer capacity in log writing. Now longer strings are cut to fit to the buffer.
2013-12-13 15:21:48 +02:00
vraatikka
4ce4423b3e Made comments doxygen compatible. 2013-12-13 10:52:34 +02:00
vraatikka
d403018fd9 Surrounded every log writing command with LOGIF macro, which tests if the given logfile id matches with those enabled. The comparison is done against local variable and expensive function call is avoided. 2013-12-12 16:14:33 +02:00
vraatikka
272ca036e4 log_manager.h
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.
2013-12-12 07:05:38 +02:00
vraatikka
06ebc6f4b5 Added QUERY_TYPE_GLOBAL_WRITE for writes which don't reflect on binary log, but need to be present in every back-end server once executed. 2013-12-11 14:34:01 +02:00
vraatikka
f785420cc6 Double freeing memory. 2013-12-10 17:27:45 +02:00
Massimiliano Pinto
a016a4aa96 server/core/Makefile
Added librt (-lrt), required for building MaxScale with static libmysqld in some platforms (CentOS 6)
2013-12-10 10:23:35 +01:00
vraatikka
a673fc9c48 Read-write split router doesn't handle QUERY_TYPE_SESSION_WRITE in any special way. Behavior defaults to same as in the case of QUERY_TYPE_WRITE. That is, modification is executed in master only. 2013-12-09 15:30:47 +02:00
vraatikka
10eafd61bc Added more information to error message in case where mysql_error provides wrong error message. 2013-12-09 13:35:45 +02:00
vraatikka
1c55a4cee7 Added a hint for the user in case the libmysqld fails to init. 2013-12-09 11:58:06 +02:00
vraatikka
f50de7a084 build_gateway.inc
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
2013-12-06 00:12:41 +02:00
vraatikka
258bcb27da log_manager.cc
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.
2013-12-04 09:56:48 +02:00
Mark Riddoch
84fbf15bef Updates configuration for backward compatibility and improved error handling 2013-12-02 15:14:52 +00:00
Mark Riddoch
37426a8be6 Updated in line with changes made to the code by Vilho 2013-12-02 10:09:04 +00:00
vraatikka
cbbf3239a5 Doxygen compliance corrections 2013-12-01 21:47:38 +02:00
vraatikka
4a006dd707 Log manager is initialized before configu file name resolution so that if home directory is successfully set, further issues would be logged in log files located under home directory instead of /tmp/.. 2013-12-01 21:37:40 +02:00
vraatikka
6d0d85396e Added global default configuration file name "etc/MaxScale.cnf"
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.
2013-11-29 23:49:37 +02:00
vraatikka
41298a09df Bugzilla entry # 363:
skygw_thread_t and simple_mutex_t make own copy of name argrument. Changed init calls to both accordingly.
2013-11-27 10:51:45 +02:00
vraatikka
8d1553b693 Bugzilla #362, http://bugs.skysql.com/show_bug.cgi?id=362
Modified datadir_cleanup so that it calls nftw to walk the directory tree and remove files and directories it meets.
2013-11-26 21:48:54 +02:00
vraatikka
f9a2a75987 Removed specific version number from MariaDB source path. Replaced it with 'mariadb/5.5' because 5.5 is supported and all existing versions still have serious issues. First possibly working version is 5.5.35 which isn't released yet. 2013-11-26 16:57:25 +02:00
vraatikka
4057ae0b0f log_manager.cc
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.
2013-11-26 16:52:48 +02:00
Massimiliano Pinto
8951f446ac - Removed the MARIADB_SRC_PATH twice set.
- Removed team member names from path examples
2013-11-26 12:49:29 +01:00
vraatikka
973a9a34d7 Added comment about '-m <modules directory>' 2013-11-26 13:07:14 +02:00
vraatikka
bc97b7f5ec log_manager.cc
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
2013-11-26 12:53:46 +02:00
Mark Riddoch
f88969c214 Code tidyup 2013-11-25 16:53:17 +01:00
Mark Riddoch
1437d3f18a Update to arguemnt parsing 2013-11-25 15:50:56 +00:00
Mark Riddoch
050ca7ac7e Some fixes for doxygen generation 2013-11-25 10:12:08 +01:00
vraatikka
3b0d6c23ad log_manager.cc
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
2013-11-25 10:49:45 +02:00
vraatikka
4f14c65040 Polished error mesesages, and made them consistent. 2013-11-22 21:17:38 +02:00
vraatikka
841c51fc5c Polished error messages in main, and made them consistent. 2013-11-22 12:01:41 +02:00
vraatikka
323fb8164e mysql_send_auth_error didn't check whether dcb is in DCB_STATE_POLLING state. If it is, function now returns. 2013-11-21 15:35:55 +02:00
vraatikka
4b2270727b Removed unnecessary debug assert. 2013-11-21 12:07:32 +02:00
vraatikka
4ed4419327 mysql_send_custom_error writes to client dcb but didn't check whether it was in the correct state. 2013-11-21 09:47:02 +02:00
vraatikka
a30e2ab29b Added back read and write mutex to dcb. Locks are acquired in poll.c before calling call-back functions. Additional locks efficiently hide memory corruption issue, which appears when readconn router is used without using those mutexes, with multiple parallel maxscale threads and intensive load. 2013-11-20 17:23:04 +02:00
vraatikka
35d34862b9 Replaced with MaxScale_template.cnf 2013-11-20 16:07:12 +02:00
vraatikka
4b1527b1c8 query_classifier.cc
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.
2013-11-20 15:55:43 +02:00
Massimiliano Pinto
0f120e5593 Added
ss_dassert(len > 0);

before gw_mysql_do_authentication()
2013-11-18 11:16:35 +01:00
vraatikka
1c96824cb3 log_manager.cc
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
2013-11-13 22:08:10 +02:00
vraatikka
1a3fa578da Fixed snprint_timestamp function which left one byte garbage to log file. 2013-11-12 17:49:28 +02:00
vraatikka
836c7ad76d Removed erroneous Warning print. Monitor users and passwords are read in different place. 2013-11-12 15:20:04 +02:00
vraatikka
4487817f59 Renamed shutdown_maxscale to shutdown_server according to definition in gateway.c. 2013-11-12 11:51:31 +02:00
vraatikka
517b6a5ee3 Added argument '-m' to skygw_logmanager_init which takes the identity string for syslog as additional argument. If syslog is enabled in configuration, but identity is not specified, host process name is used. 'maxscale', for example. 2013-11-11 11:02:05 +02:00
vraatikka
b996631fc9 log_manager.cc
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.
2013-11-10 20:45:48 +02:00
vraatikka
9ba7a0d955 log_manager.cc
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.
2013-11-08 12:56:39 +02:00