Commit Graph

101 Commits

Author SHA1 Message Date
52ae676fa4 Add cast when converting to size_t from double. 2016-02-18 13:19:08 +02:00
e1273a2e5f Clean skygw_utils.
Not finished yet. There are e.g. a number of functions that are only used
by the log manager. They could just as well be moved as private functions
to log_manager.cc.
2016-02-09 17:43:55 +02:00
38db155fef Make mlist a separate component.
Mlist is now made available as a separate component instead of
being a part of skygw_utils.
2016-02-09 17:31:15 +02:00
2692d1081c Add slist.
Slist removed from skygw_utils and added as a separate component.
Nobody seems to be using it, so it could also simply be removed.
Left in place for the time being.
2016-02-09 15:30:27 +02:00
5ac1ab412e Formatted utils library sources
Formatted all utils library sources according to the style guide.
2016-01-22 18:55:54 +02:00
54ca1ab2de Canonicalized queries remove non-executable comments
The comments which do not alter the functionality of a query are now removed
from canonicalized queries.

Also fixed missing semicolon in the comment removal regex and added tests
for comment removal.
2016-01-11 17:14:57 +02:00
8ee110efa8 Fixed canonicalization and added more tests
Fixed mistakes in the canonicalization regular expressions and altered the
functions to use a source and destination buffers. This reduces the amount
of memory allocations that take place.

Added more canonical query tests to the internal test suite.
2016-01-11 17:14:44 +02:00
e0c84e0fe3 Added removal of MySQL style comments to query canonicalization.
Also fixed minor issues with the canonicalization regular expressions.
2016-01-11 17:13:14 +02:00
9c9e30fa08 Fixed value replacement and added more tests for canonicalization of queries
The value replacement was not taking session or system variables into notice.
2016-01-11 17:09:40 +02:00
995ed8c9d2 Improved query canonicalization
The query does not need to be parsed for it to be canonicalized and the parsing
uses the PCRE2 library. The regular expressions were changed so that only one
call to the function which replaces literal unquoted values is made.
2016-01-11 17:08:03 +02:00
b01e8b2eec Added utils library initialization function and improved replace_quoted
Currently the initialization function only prepares PCRE2 patterns for use.
Added the call to the new utils_init() function to MaxScale and all relevant
tests.

The replace_quoted now uses a shared PCRE2 pattern which should remove some
of the overhead of the function.
2016-01-11 17:04:39 +02:00
6164b7f301 Fixed unsafe use of localtime
Since localtime is not thread-safe it should not be used in multithreaded
contexts. For this reason all calls to localtime were changed to localtime_r
in code where concurrency issues were possible.

Internal tests were left unchanged because they aren't multithreaded.
2015-11-19 17:17:16 +02:00
dee20fe077 Merge remote-tracking branch 'origin/develop' into MXS-329-develop-20151111
# Conflicts:
#	server/core/CMakeLists.txt
#	server/core/buffer.c
#	server/core/service.c
#	server/modules/filter/tee.c
#	server/modules/monitor/mysql_mon.c
#	server/modules/routing/binlog/blr.c
#	server/modules/routing/binlog/blr_slave.c
#	server/modules/routing/debugcmd.c
#	server/modules/routing/readwritesplit/readwritesplit.c
#	utils/skygw_utils.cc

- resolved.
2015-11-11 11:08:02 +00:00
9064212353 Fixed queries without assignment operators failing to be properly canonized. 2015-10-27 14:20:43 +02:00
cfeaf7d6e9 Merge remote-tracking branch 'origin/develop' into MXS-329
Conflicts:
	server/core/session.c
2015-09-10 13:07:27 +01:00
160bbb70ee MXS-251: strerror
Replaces all calls to strerror with calls to strerror_r. The former
is non-thread safe while the latter is.
2015-09-05 15:52:13 +03:00
820bb4ea00 Avoid name clash - change random to random_jkiss 2015-08-26 16:18:08 +01:00
1f6b544f33 Tidy dcb_free (prefer use of dcb_close) and remove from test code; add good random number generator. 2015-08-26 15:43:21 +01:00
78eab19c62 Fixed compiler warnings. 2015-07-14 17:13:09 +03:00
3992f262ca Fixed Coverity defects 2015-07-14 16:17:50 +03:00
ba417ef633 Merge remote-tracking branch 'origin/develop' into MXS-122
Conflicts:
	server/core/dcb.c
2015-07-08 14:54:22 +01:00
e5d9abbdcb Fixes to Coverity defects. 2015-06-25 06:01:33 +03:00
4417f2bbf4 Moved atomic to its own static library. 2015-06-17 16:50:15 +03:00
492918c72c Use common code for atomic_add(). 2015-05-12 16:50:37 +01:00
fc7072786b Fixed null pointer dereferences in maxkeys and maxpasswd. 2015-05-06 16:32:49 +03:00
7c988c4fd5 Removed stdout specific functions in skygw_utils and moved the logic to log_manager instead. 2015-04-30 04:26:48 +03:00
47e5b12eb8 Added a function that frees the skygw_file_t memory but doesn't close it. 2015-04-29 18:25:35 +03:00
9ce225c2cb Added log manager initialization flag that prints all logs to stdout. 2015-04-29 11:20:40 +03:00
1b3af7d61f Fixes to Coverity defects. 2015-04-16 19:41:49 +03:00
051d891680 Added utility functions to skygw_utils and cleaned up tee filter. 2015-04-15 12:42:28 +03:00
282f66f9fd Merge branch 'develop' into MAX-324
Conflicts:
	utils/skygw_utils.cc
2015-03-06 17:07:39 +02:00
8c3409cf32 Fix to MXS-3: https://mariadb.atlassian.net/browse/MXS-3
Added the GNU specific code to skygw_utils.cc. This is a temporary fix and should be revisited at some point.
2015-03-06 12:39:42 +02:00
880adca73e Merge branch 'develop' into MAX-324 2015-03-05 10:45:48 +02:00
9ec31d029e Changed gettimeofday to time(NULL) in low precision logging. 2015-03-02 10:32:20 +02:00
ad49c5f402 Added optional millisecond precision to logfiles and created the changelog document. 2015-02-24 18:10:16 +02:00
fc969acc73 Added optional stripping of escape characters from database names when laoding users. 2015-02-20 21:07:12 +02:00
3924f70d6b Fixed log manager sometimes not writing the last character in a log message.
This was caused by type conversions from int to size_t and the usage of the MAX macro.
2015-02-20 04:42:02 +02:00
ba009e5fd3 Fixes to Coverity defects 85010 84878 72752 72742 72719 and 73418.
skygw_utils.cc: Added function is_valid_posix_path that checks if a path is POSIX-compliant.
2015-01-05 06:05:56 +02:00
01b1b0a304 Fixes to Coverity issues 84388, 84386, 84385
mysql_mon.c: Added back server state logging to Debug build.
query_classifier.cc: removed some extra debug code, cleaned up a bit function documentation.
mysql_client_server_protocol.h, mysql_backend.c, mysql_common.c: changed some variables to signed ones to enable checking of calculations in the code.
skygw_utils.cc: removed erroneous debug assertion.
2014-12-05 23:39:14 +02:00
f2c2e4f81c Fix to bug #617, http://bugs.skysql.com/show_bug.cgi?id=617
When filewriter_init failed due to full disk, error branch freed messages twice. Removed unnecessary free command.
2014-12-02 23:58:28 +02:00
155e795830 Fix to #622, http://bugs.skysql.com/show_bug.cgi?id=622
When MaxScale starts it opens log file of each type and if there exist log files of same types in the same directory, it will try to reuse the file with largest sequence number in it. If there are no existing files, a file name with sequence number 1 will be created. If the file with largest sequence number is not writable, a new log file with larger sequence number will be created.
2014-11-21 13:44:12 +02:00
70eef7aaa8 Fix to bug #513, http://bugs.skysql.com/show_bug.cgi?id=513 2014-11-17 15:33:13 +02:00
780733f870 MAX-325, Log rotation functionality. When skygw_log_rotate is called, corresponding logfile's rotate flag (lf_rotateflag) is set and log writer thread is woken up. Writer opens a new log file and closes the old one. 2014-11-12 14:48:17 +02:00
d1772e300e Addition to fix to bug #613, http://bugs.skysql.com/show_bug.cgi?id=613
Added new declaration of skygw_file_write and modification to the function which returns errno instead of boolean.
2014-11-10 13:59:55 +02:00
f44ed2f3b4 Fixes to Coverity issues 72736 & 72735 2014-11-06 08:45:46 +02:00
0a306b2eeb Fix bug #611, http://bugs.mariadb.com/show_bug.cgi?id=611
Fixes to Coverity issues 72703, 72713, 72718, 72721
2014-11-05 18:37:11 +02:00
9728502522 Fix to Coverity issue 72769 2014-11-05 17:50:07 +02:00
86cd6ec0e9 Fix to Coverity issue 72726 2014-11-05 17:27:37 +02:00
848c7aa0b8 Fixes to Coverity cases 72678 (retry), 72693 2014-10-31 11:38:57 +02:00
7048270062 Coverity : 72678, 72687, 72689
Fixed memory leaks and use of freed memory
2014-10-30 18:19:41 +02:00