13022 Commits

Author SHA1 Message Date
Johan Wikman
8fc761ce49 MXS-2363 Add maxctrl show qc_cache 2019-03-29 11:31:35 +02:00
Johan Wikman
d7e3dd1a23 MXS-2363 Return QC cache information as collection
More logcal perhaps and Makes it easier to handle the output in maxctrl.
2019-03-29 11:31:35 +02:00
Johan Wikman
ea6ffe2371 MXS-2363 Add REST-API test 2019-03-29 11:31:35 +02:00
Johan Wikman
5f5d2ef183 MXS-2363 Implement /v1/maxscale/query_classifier/cache
That URL will now return information about the statements in
the query classifier cache. The information is collected using
the same map in a serial manner from all routing workers (that
each have their own cache). Since all caches will contains the
same statements, collecting the information in a serial manner
means that the overall memory consumption will be lower than
what it would be if the information was collected in parallel.
2019-03-29 11:31:35 +02:00
Johan Wikman
64a0327ada MXS-2363 Add string constants needed by new QC functionality 2019-03-29 11:31:35 +02:00
Johan Wikman
56ec56f7a0 MXS-2363 Enable the serial execution of function objects
Make it possible to run function objects serially on all
routing workers. Sometimes that is exactly what you want.
2019-03-29 11:31:35 +02:00
Johan Wikman
9ec82932cf MXS-2363 Skeleton of /v1/maxscale/query_classifier/cache
URL routing in place, callback exists, but no actual information.
2019-03-29 11:31:35 +02:00
Johan Wikman
1a81371346 MXS-2363 Keep track of individual QC cache hits
Useful statistics.
2019-03-29 11:31:35 +02:00
Markus Mäkelä
6aa846ebc7
MXS-1951: Document SO_REUSEPORT effects
Added a section into limitations and noted the effects in the release
notes.
2019-03-28 16:34:12 +02:00
Markus Mäkelä
66f850d77d
MXS-1951: Fix maxctrl cluster tests
The fact that two MaxScale processes can bind to the same port is now
possible due to the use of SO_REUSEPORT. As this is doable only with a
very deliberate setup, it is unlikely to be a practical problem in most
cases. Regardless, the test needs to be fixed to accept multiple MaxScales
bound to the same port.
2019-03-28 16:34:12 +02:00
Markus Mäkelä
388e952c5f
MXS-1951: Fix port conflict detection
With the addition of SO_REUSEPORT support, it is no longer possible to
rely on the network stack to prevent multiple listeners from listening on
the same port. Without explicitly checking for the ports it would be
possible for two listeners from two different services to listen on the
same port in which case the service would be almost randomly chosen.
2019-03-28 16:34:12 +02:00
Markus Mäkelä
df3b501563
MXS-1951: Add SO_REUSEPORT support
If SO_REUSEPORT is available and the kernel supports it, listeners will
now listen on separate file descriptors. This removes the need for
cross-worker communication when in normal operation which should make
MaxScale scale better.
2019-03-28 16:34:12 +02:00
Markus Mäkelä
cb957200c9
MXS-1951: Detect SO_REUSEPORT support
The support for SO_REUSEPORT is now detected at runtime.
2019-03-28 16:34:12 +02:00
Markus Mäkelä
e745d1cffb
MXS-2312: Use default network buffer sizes
Removed the hard-coded network buffer sizes. This effectively makes them
configurable via the kernel.
2019-03-28 16:34:12 +02:00
Markus Mäkelä
db97c3343d
MXS-1951: Move worker selection into Listener
The worker to which the client DCB is assigned to is now chosen by the
Listener. This makes the protocol code simpler which is always a good
thing.
2019-03-28 16:34:12 +02:00
Markus Mäkelä
5c7846da3f
MXS-1951: Make listener fd worker-local
By storing the file descriptor inside a worker-local variable, it is
possible to handle both unique file descriptors (created with
SO_REUSEPORT) and shared file descriptors with the same code. The way in
which the file descriptor is stored in the rworker_local object determines
the way the listener behaves.
2019-03-28 16:34:12 +02:00
Markus Mäkelä
27cc247e47
MXS-1951: Clean up listener creation
The old values that were encoded into a string wasn't necessary as the
data is already present in a processed form in the member variables.
2019-03-28 16:34:12 +02:00
Esa Korhonen
841bdf4d0f Merge branch '2.3' into develop 2019-03-28 15:33:09 +02:00
Markus Mäkelä
116efb2409
MXS-2379: Fix maxinfo HTTP interface
Added the missing HTTP request handlers and a new JSON conversion
function.
2019-03-28 14:03:56 +02:00
Markus Mäkelä
0fa7ad8580
Remove excessive memory allocation from dcb_printf
The function allocated a constant-sized chunk of memory for all messages
which was excessive as well as potentially dangerous when used with large
strings.
2019-03-28 14:03:56 +02:00
Markus Mäkelä
6bc2c54081
Merge commit 'a78f0fbe2537542dc7f3f0dd8b19b93ac8d9d7f8' into develop 2019-03-28 13:53:40 +02:00
Markus Mäkelä
18cd890474
Fix binlogrouter slave heartbeat task addition
The task was added multiple times when only one task is needed.
2019-03-28 13:21:24 +02:00
Markus Mäkelä
f6219d1a80
Fix persistent connection debug assertion
The assertion was done before the DCB was assigned.
2019-03-28 13:21:24 +02:00
Markus Mäkelä
abd6e0924f
Always load module defaults for monitors
The creation of a monitor from JSON relied on the non-JSON version for the
addition of default parameters but it proceeded to check the validity of
the parameters before it. Whenever parameters are checked, the default
parameters should be present.
2019-03-28 13:21:24 +02:00
Markus Mäkelä
548223ec9d
Fix mxs2273_being_drained
The test didn't expect the Drained state. Also expanded the test to check
that the Draining state is not present when there are no connections.
2019-03-28 13:21:24 +02:00
Markus Mäkelä
858327acf7
Rename Being Drained to Draining
With this, the words are unique and can be searched for more easily. This
does not fix the test failure of mxs2273_being_drained.
2019-03-28 13:21:24 +02:00
Markus Mäkelä
02bdc5ef4d
Fix object names in test configurations
Some of the test configurations relied on the name conversion that is now
removed.
2019-03-28 13:21:24 +02:00
Markus Mäkelä
3a8accee8f
Fix mxs2326_hint_clone configuration
Whitespace in object names is not allowed anymore.
2019-03-28 13:21:24 +02:00
Markus Mäkelä
c3f3200d2c
Fix removal of last server from monitor
If the last server was removed, the parameter would be rejected due to it
being empty. To remove the parameter, the
MonitorManager::reconfigure_monitor should be used. Also fixed the
unnecessary serialization after a failure to remove server from a monitor
and the fact that some errors were logged instead of written to the caller
of the command.
2019-03-28 13:21:23 +02:00
Markus Mäkelä
5ee9b74770
Fix readwritesplit server selection
If a server with zero weight was chosen as the only candidate, it was
possible that the starting minimum value was smaller than the server
score. This would mean that a candidate wouldn't be chosen if the score
was too high. To preven this, the values are capped to a value smaller
than the initial minimum score.
2019-03-28 13:21:23 +02:00
Markus Mäkelä
906f0ed3cd
Add RAII class for stopping monitors
This way the state is encapsulated in the object and the required changes
are done in one place. This makes the code reusable across all functions
making it easier to implement better monitor alteration code.
2019-03-28 13:21:23 +02:00
Markus Mäkelä
ac0a3d1d47
Extend string helper functions
Moved mxs::strtok into mxb namespace and added mxb::join for joining
objects into strings.
2019-03-28 13:21:23 +02:00
Esa Korhonen
c4b82b7d83 MXS-2359 Route statements with database but no table dependence
Queries such as SHOW TABLES FROM db1 are now routed to the backend with db1.
This gives the correct result as long as db1 is not sharded to multiple
backends.
2019-03-27 13:46:36 +02:00
Esa Korhonen
ee88180c54 MXS-2409 Check that prepared statement exists
If the PREPARE is malformed, the extracted statement is null.
2019-03-27 13:46:36 +02:00
Niclas Antti
d46778d5d9 Formatting change.
Two changes in uncrustify. 1. do not align member initializers.
2. Do not split enums to multiple lines, force commas to be trailing.
Intendation is aligned as before.

const SOME_THINGS config_thing_params[] =
{
    {A,    B,  {C  ,D}};
    {E,
    F,
    {G,H}
    }
}
=>
const SOME_THINGS config_thing_params[] =
{
    {A, B, {C, D}};
    {E,
     F,
     {G, H}}
}

static const MXS_ENUM_VALUE ssl_values[] =
{
    {"required", 1              },
    {"true",     1              },
    {"yes",      1              },
    {"on",       1              },
    {"1",        1              },
    {"disabled", 0              },
    {"false",    0              },
    {"no",       0              },
    {"off",      0              },
    {"0",        0              }
}
=>
static const MXS_ENUM_VALUE ssl_values[] =
{
    {"required", 1},
    {"true", 1},
    {"yes", 1},
    {"on", 1},
    {"1", 1},
    {"disabled", 0},
    {"false", 0},
    {"no", 0},
    {"off", 0},
    {"0", 0}
}

enum E1 {A, B  ,  C};
=>
enum E1 {A, B, C};

enum E
{
    A, B
    ,Z
};
=>
enum E
{
    A, B,
    Z
};
2019-03-27 13:31:59 +02:00
Niclas Antti
d40e29d5f6 A little houskeeping.
Increasing counter sizes from int to long for averages.
Rename random functions to end with _co instead of _exclusive to
indicate range [close, open[, and to allow future suffixes oc, cc and oo.
2019-03-27 13:15:14 +02:00
Markus Mäkelä
a78f0fbe25
Merge branch '2.2' into 2.3 2019-03-27 12:16:54 +02:00
Markus Mäkelä
04f70879d2
MXS-2410: Uniquely identify DCBs
The address alone doesn't guarantee validity of a DCB.
2019-03-27 11:58:31 +02:00
Esa Korhonen
c6ce4c2234 MXS-2359 Update schemarouter documentation
Moved limitations to the router documentation. Documented which queries get
exceptional handling.
2019-03-27 10:30:29 +02:00
Esa Korhonen
c6272594d6 MXS-2359 Remove special handling for SHOW TABLES
The code only handled the basic version of the command, returning incorrect
results if modifiers were used. The code is now removed, causing the command
to be routed to the backend of the current database. This will give correct
results as long as that backend contains all the tables of the database e.g.
no table sharding.
2019-03-27 10:30:29 +02:00
Johan Wikman
3a32612096 MXS-2403 Extend test 2019-03-27 09:38:29 +02:00
Markus Mäkelä
03121c63d4
Add monitor reconfiguration helper
The MonitorManager function reconfigured a monitor and rolls back to the
old configuration if the new one doesn't work.
2019-03-26 17:30:38 +02:00
Markus Mäkelä
22004702bc
Don't use CONFIG_CONTEXT in config_runtime.cc
The only thing that's needed is MXS_CONFIG_PARAMETER.
2019-03-26 15:53:20 +02:00
Markus Mäkelä
156abe81ee
Add type and module to default parameters
When default parameters are loaded, the type and module name are
added. This helps object serialization and allows all the code to expect
that all the parameters needed to create an object are always present.
2019-03-26 15:53:20 +02:00
Markus Mäkelä
b180c346d9
Make filter parameters a part of the definition
The filter parameters are now a part of the filter definition.
2019-03-26 13:44:04 +02:00
Markus Mäkelä
fd39291542
Don't indent extern "C" blocks 2019-03-26 13:44:04 +02:00
Markus Mäkelä
f8bc6b18fc
Only add tasks once in binlogrouter
Adding the same task twice isn't allowed. The API of the housekeeper tasks
might have to be changed in a way that makes it possible for the caller to
know whether a task has been added.
2019-03-26 13:44:04 +02:00
Markus Mäkelä
0915487329
Pass std::string to add/remove task
By passing strings instead of const char pointers to the task control
functions, we can safely make copies of them knowing that the contents
won't disappear.
2019-03-26 13:44:04 +02:00
Markus Mäkelä
f0756cd708
Queue addition of housekeeper tasks
This fixes the hang on startup when binlogrouter calls hktask_add.
2019-03-25 19:21:12 +02:00
Markus Mäkelä
1e4c5f5d2f
Remove housekeeper.cc
It is no longer used.
2019-03-25 19:21:12 +02:00