37 Commits

Author SHA1 Message Date
Markus Mäkelä
dd99cadfd2
Prevent unintended sharing of parsing info
When a single GWBUF was split into two with gwbuf_split, the new GWBUF
would point to the start of the shared data and the old one to the
end. Data-wise, this is fine but as the parsing info for queries is stored
in the shared buffer it causes problems when multiple packets get read in
one network payload. The end result would be that only the first query in
the lot would get parsed and the rest would get the same classification as
the first one.

To properly fix this without the need to deep clone the buffer would
require a reorganization of the buffer mechanism in MaxScale.

This commit alone doesn't fix the queued query routing problems in
readwritesplit. The commit from 2.2 which fixes the ordering problems with
queued queries is also required for a fully functional queued query
mechanism.
2019-03-18 12:17:48 +02:00
Markus Mäkelä
775fc043c8
MXS-2326: Clone routing hints on gwbuf_clone
When a buffer is cloned the hints for that buffer should also be cloned.
2019-02-13 13:34:48 +02:00
Markus Mäkelä
f461ab428e
Fix backend DCB writeq throttling
The callbacks iterated over all threads when only the local ones must be
iterated. This prevents a deadlock from occurring when multiple threads
start throttling at the same time.

Also fixed the gwbuf_append debug assertion.
2018-10-20 11:53:57 +03:00
Markus Mäkelä
b33b888b07
Remove atomic operations from buffers
As buffers are meant to be used only within a particular session, the
atomic operations are no longer necessary and can thus be removed. This
removes the extra overhead that the atomic operations add.
2018-10-03 12:12:59 +03:00
Markus Mäkelä
a645467827
Clean up buffer.cc
Cleaned up the code by removing gotos and initializing variables when they
are declared. Also added some space to some functions that felt cramped.
2018-10-03 12:12:59 +03:00
Markus Mäkelä
1ed708559d
Assert that buffers are thread-local
Cross-thread usage of buffers should not happen and the debug assertions
help verify it.
2018-10-03 08:41:43 +03:00
Markus Mäkelä
304286e5fa
Remove unused code
The BUFFER_TRACE code was not in use and did not work as the HASHTABLE was
removed.
2018-10-03 08:41:42 +03:00
Markus Mäkelä
9278da1f54
MXS-2067: Remove spinlock.h
Removed the spinlock.h header and replaced with plain pthread types and
functions.
2018-09-28 12:18:24 +03:00
Markus Mäkelä
2e069fa892
MXS-1632: Take mxb::atomic::add into use
The function now mostly replaces the use of atomic_add_ functions declared
in atomic.h.
2018-09-18 15:21:54 +03:00
Niclas Antti
c447e5cf15 Uncrustify maxscale
See script directory for method. The script to run in the top level
MaxScale directory is called maxscale-uncrustify.sh, which uses
another script, list-src, from the same directory (so you need to set
your PATH). The uncrustify version was 0.66.
2018-09-09 22:26:19 +03:00
Johan Wikman
ab9a9f92cb MXS-2020 Remove maxscale/debug.h
- Removed from all files.
- maxbase/assert.h included where necessary.
2018-08-22 11:35:35 +03:00
Johan Wikman
3f53eddbde MXS-2020 Replace ss[_info]_dassert with mxb_assert[_message] 2018-08-22 11:34:59 +03:00
Johan Wikman
b1e405442f MXS-2020 Replace ss_debug with MXB_AT_DEBUG 2018-08-22 11:34:06 +03:00
Johan Wikman
cf0aeed516 MXS-2014 Rename log_manager.h to log.h
There's nothing resembling a manager anymore.
2018-08-17 10:59:37 +03:00
Johan Wikman
ae43e4f0f2 MXS-2013 Remove all CHK_-macros 2018-08-15 09:28:04 +03:00
Johan Wikman
f3f802cabe MXS-2008 Move maxscale/atomic.h to maxbase/atomic.h 2018-08-15 08:44:39 +03:00
Markus Mäkelä
6c59da77fb
Merge branch '2.2' into develop 2018-07-26 11:27:09 +03:00
Markus Mäkelä
4b7cd7a281
Dump queue contents on unexpectedly NULL buffer
When the query queue does not contain a complete packet
(i.e. modutil_get_next_MySQL_packet return NULL), an informative dump of
how many bytes and what is stored is logged.
2018-07-24 09:51:48 +03:00
Markus Mäkelä
ea5c5f3a07
Never return NULL from gwbuf_make_contiguous
By aborting the process if memory runs out when a buffer needs to be made
contiguous, we rule out other, more subtle, errors. Failing as soon as a
possible when memory allocation fails gives better error messages.
2018-07-24 09:51:47 +03:00
Markus Mäkelä
bbe4f42935
Add more packet splitting debug assertions
Having more debug assertions in functions that split packets guarantees
that they work as expected.
2018-07-24 09:51:47 +03:00
Markus Mäkelä
44ef4912e8
Merge branch '2.2' into develop 2018-07-03 21:13:41 +03:00
Markus Mäkelä
e455e7f15d
MXS-1953: Always initialize the GWBUF spinlock
The spinlock in the buffer is used but it was not always initialized. Also
added missing initialization of the SERVER pointer.
2018-07-03 11:32:36 +03:00
Markus Mäkelä
295d59881e
Remove spinlocks from GWBUF
The spinlock does not protect from or prevent misuse as buffers must not
be used concurrently by multiple threads.
2018-07-02 13:29:21 +03:00
Johan Wikman
cc0299aee6 Update change date of 2.3 2018-06-25 10:07:52 +03:00
Niclas Antti
5d02d8c0ba Merge branch '2.2' into develop 2018-06-01 09:33:04 +03:00
Niclas Antti
89296ed4e4 MXS-1740 Hintfilter leaks memory
Single spot where an existing hint ptr was overwritten. Removed gwbuf_add_hint()
because it was  adding hints at the opposite end compared to functions in hint.h.
Added hint_splice() to replace.
2018-05-31 14:04:22 +03:00
dapeng
8a0c8e63f2 MXS-199: Support Causal Read in Read Write Splitting (#164)
* MXS-199: Support Causal Read in Read Write Splitting

* move most causal read logic into rwsplit router and get server type from monitor

* misc fix: remove new line

* refactor, move config to right place, replace ltrim with gwbuf_consume

* refacter a little for previous commit

* fix code style
2018-02-05 09:09:18 +02:00
Markus Mäkelä
6b877de5bc Make gwbuf_{add|get}_property const correct
The function now takes const arguments.
2018-01-24 20:29:09 +02:00
Markus Mäkelä
a04843da9d Add function for logging buffer contents as hex
The gwbuf_hexdump write the contents of the buffer into the info log. This
is quite helpful for debugging of protocol related problems.
2017-10-12 12:29:43 +03:00
Johan Wikman
5d18ab86ea Allocate shared buffer and its data in one chunk
The GWBUF shared buffer and its data is now allocated in one
chunk so that the data directly follows the shared buffer.
That way, creating a GWBUF will involve 2 and not 3 calls to
malloc and freeing one will involve 2 and not 3 calls to free.
2017-10-12 12:29:43 +03:00
Johan Wikman
de7004cb95 Merge branch '2.1' into develop 2017-08-15 10:31:30 +03:00
Markus Mäkelä
1f4856cdc5 Merge branch '2.1' into develop 2017-08-03 19:01:32 +03:00
MassimilianoPinto
cb57e10761 Develop merge
Develop merge
2017-06-29 15:34:22 +02:00
Johan Wikman
f546a17e77 Update change date of 2.2 2017-06-01 10:24:20 +03:00
Markus Mäkelä
ad1c05b015 Merge branch '2.1' into develop 2017-04-05 11:35:13 +03:00
Johan Wikman
640f0d5139 Compile modutil.c as C++ 2017-03-24 09:21:20 +02:00
Johan Wikman
c84c2dcfbd Compile authenticator.c and buffer.c as C++ 2017-03-24 09:21:20 +02:00