6089 Commits

Author SHA1 Message Date
Markus Makela
8ae76e3ced Clean up dbfwfilter
Removed unused functions, made function names more consistent.
2016-11-18 08:53:43 +02:00
Markus Makela
696d103ed0 Allow servers to be removed from multiple objects
Since servers can be added to multiple objects, it only makes sense to be
able to remove them from multiple objects.
2016-11-17 12:37:50 +02:00
Markus Makela
ae339f174c Allow servers to be added to multiple objects at one time
The maxadmin interface to add servers to objects now allows a maximum of
11 objects to be listed. This will make it simpler to add a server to both
a monitor and a service in one command.
2016-11-17 12:37:50 +02:00
Markus Makela
b08e481137 Fix memory leak on reactivation of old server
If a destroyed server was reactivated, it would leak memory.
2016-11-17 12:37:50 +02:00
Markus Makela
042491ac07 Rename dbfwfilter objects to more descriptive ones
The object names in the dbfwfilter weren't very descriptive and were not
that easy to comprehend. The same goes for function names which had
somewhat cryptic names.
2016-11-17 12:36:44 +02:00
Markus Makela
72622bc92f MXS-977: Move common diagnostic code to the core
Almost all monitors printed the same diagnostic output inside the
modules. This should be a part of the core, not the modules themselves.
2016-11-17 12:36:44 +02:00
MassimilianoPinto
cd31b2c2c3 Merge branch 'develop' into binlog_server_wait_data 2016-11-16 15:08:17 +01:00
MassimilianoPinto
3b7eec8655 The hole is created only with BLR_EVENT_DONE master_event_state
This fix allows the gap detection and the writing of an IGNORABLE event
only if master_event_state == BLR_EVENT_DONE.

Note: The hole is not being created if the event is bigger than 16MB
2016-11-16 15:06:24 +01:00
Johan Wikman
27247bea4e Now use maxscale_shutdown()
shutdown_server() has been renamed to maxscale_shutdown().
2016-11-16 15:35:32 +02:00
Markus Makela
5d5802a5a0 Merge branch 'develop-2.0-merge' into develop 2016-11-16 12:57:38 +02:00
Markus Makela
44a55d231f Merge commit 'a7c21eee88c3c2530c06fea8a20c718004eed244' into develop-2.0-merge 2016-11-16 12:57:23 +02:00
Markus Makela
5ecd0af68e Add missing NULL pointer check to monitorRemoveServer
The pointer was falsely assumed to be non-NULL.
2016-11-16 11:56:49 +02:00
Johan Wikman
c4999232ce MXS-935: Implement column matching
With the advent of qc_get_field_info, columns can now be matched.
However, there is still some undeterminism caused by the table
information not containing contextual information (exactly where
is the table used).

Further, suppose table X contains the column A and table Y contains
the column B, then given a statement like

    SELECT a, b from X, Z;

we cannot know whether a is in X or Z, or b in X or Z, without being
aware of the schema, which we currently are not.

Consequently, as long as MaxScale is not aware of the schema, some
heuristics must be applied. For instance, if exactly one table is
referred to, then we can assume that columns that are not explicitly
qualified are from that table.

The rule tests are currently rather rudimentary and need to be
expanded.
2016-11-16 10:44:56 +02:00
Markus Makela
a7c21eee88 Always treat master failures as fatal errors
When a connection to the master fails, readwritesplit should always treat
it the same way. Previously, if a connection to the master was lost but it
hadn't lost the master status, the failure would be treated like a slave
server failure.
2016-11-15 22:18:26 +02:00
MassimilianoPinto
d530779cf3 Merge branch 'develop' into binlog_server_wait_data 2016-11-15 14:00:52 +01:00
Markus Makela
548182afe3 Fix debug assertion in config.c
The debug assertion was triggered due to a wrongly structured conditional
statement.
2016-11-15 10:50:06 +02:00
Markus Makela
3c15b58891 Merge branch '2.0' into develop-2.0-merge 2016-11-15 00:09:24 +02:00
Markus Makela
2202ec7a33 Allow multiple monitor alterations at one time
The monitor alteration now also uses a list of key-value pairs. This
allows multiple changes to be made in one command.
2016-11-14 22:58:26 +02:00
Markus Makela
f18cf407a7 Improve maxadmin error messages
The error messages now report more detailed information about the expected
number of arguments to commands.
2016-11-14 22:58:26 +02:00
Markus Makela
a5bb02bd14 Expect at least two arguments for create server
When a server is created in server_create, it sets the port to the default
of 3306 if no explicit port is defined. The code that called this function
still expected a minimum of three arguments: name, address and port.
2016-11-14 22:58:26 +02:00
Markus Makela
878d01e276 Persist server changes to services
When a service is added or removed from a service, a supplementary
configuration file is created. This allows MaxScale to survive restars and
unexpected downtime even if runtime changes to the servers of a service
have been made.

With these changes, it is possible to start MaxScale without any servers,
create servers, add the created servers to services and monitors and
restart Maxscale without losing the runtime configuration changes.
2016-11-14 22:58:26 +02:00
Markus Makela
a17aa28eed Persist changes to the list of monitored servers
When a server is added to a monitor, an supplementary configuration file
is generated to persist this information. This will allow dynamic
modifications to server lists which will survive restarts and unexpected
downtime.

The monitor will only add new servers to its list of monitored
servers. This prevents duplicate entries in the list and makes it safe to
persist all used servers to the supplementary configuration file instead of only the ones that are not listed in the main configuration.
2016-11-14 22:58:26 +02:00
Markus Makela
a651eff633 Serialize repurposed servers
When a destroyed server is taken into use, it needs to be serialized. This
will allow the server to be created on restart.
2016-11-14 22:58:26 +02:00
Markus Makela
8b692b0754 Add SSL support for created servers
Servers created at runtime can now be configured to use SSL. The
configuration is only possible if the server is not in use.

The `alter server` command in maxadmin now takes a list of `key=value`
strings. This allows the user to define multiple alter operations with one
command.
2016-11-14 22:58:26 +02:00
Markus Makela
b893ca7ba8 Move configuration context processing into subfunctions
The functions allow simple operations on configuration context
objects. This makes it easier to understand what the code does and allows
reuse of the configuration processing code.
2016-11-14 22:58:26 +02:00
Markus Makela
11bee30f61 Fix backend SSL
The backend SSL connections weren't authenticated due to an inverted
check. This caused all SSL connections to fail.
2016-11-14 22:58:26 +02:00
MassimilianoPinto
deda1c844e Develop branch update
Develop branch update
2016-11-14 17:44:39 +01:00
Markus Makela
7ddb4d8e5a Treat connection_timeout as an integer for reload_config
The connection_timeout parameter was treated as a boolean which caused
errors when the configuration was reloaded.
2016-11-14 16:35:03 +02:00
Markus Makela
da129025eb Use common backend closing function
The backend references now use a common closing function so that all
variables are reset to proper states. The stored queries weren't always
freed and they would leak memory if left open.
2016-11-14 16:14:20 +02:00
Markus Makela
ba4ab9d35f Remove sorting of backends with qsort
The backends are no longer sorted with qsort. This removes the possibility
of stale backend references.
2016-11-14 15:01:41 +02:00
MassimilianoPinto
2b2d2cc679 Merge from develop
Merge from develop
2016-11-14 09:43:54 +01:00
MassimilianoPinto
11fc7682dd Maxrows filter documentation update
Maxrows filter documentation update
2016-11-14 09:24:28 +01:00
MassimilianoPinto
fbb46f72eb MXS-930: Maxrows filter documentation
MXS-930: Maxrows filter documentation
2016-11-14 09:24:28 +01:00
Johan Wikman
15e9652c46 qc: Provide information about field usage
Together with the field names, now qc_get_field_info also returns
field usage information, that is, in what context a field is used.
This allows, for instance, the cache to take action if a a particular
field is selected (SELECT a FROM ...), but not if it is used in a
GROUP BY clause (...GROUP BY a).

This caused a significant modifications of qc_mysqlembedded that
earlier did not walk the parse-tree, but instead looped over of a
list of st_select_lex instances that, the name notwithstanding,
also contain information about other things but SELECTs. The former
approach lost all contextual information, so it was not possible
to know where a particular field was used.

Now the parse tree is walked, which means that the contextual
information is known, and thus the field usage can be updated.
2016-11-14 09:35:16 +02:00
Markus Mäkelä
0e641108d4 Merge pull request #112 from JindongChen/save-time-on-wildcard-domain-name
Save time when domain name contains wildcard '%'
2016-11-11 18:24:30 +02:00
陈金栋
8edd0d3bae Save time when domain name contains wildcard '%' 2016-11-11 23:40:55 +08:00
ekorh475
d7c476314e Have maxadmin ask for password if none was given with -p
MXS-399 If maxadmin was started with -p and no password was given,
it printed a help message. Now it asks for password as if no -p was
given.
2016-11-11 15:05:36 +02:00
Markus Makela
03951fff11 Remove FAKE_CODE from use
This functionality is not used in tests and parts of it didn't work. Since
it is not actively maintained or even used, it is better to remove it.
2016-11-11 12:17:22 +02:00
Markus Makela
8a8e1a6650 Add check for NULL authenticator
The server creation was missing a check for NULL authenticator parameter.
2016-11-11 12:08:14 +02:00
Markus Makela
0a712017a8 Add dynamic server configuration to release notes
The release notes list the new commands and point to
`maxadmin help <command>` for more details.
2016-11-11 11:35:15 +02:00
Markus Makela
2fcfc102be Abstract server active checks
The checks for the server active status are now hidden behind a
macro. This allows for the conditions of the activity to change without
having to alter the code that uses it.
2016-11-11 11:35:13 +02:00
Markus Makela
ae7981f147 Add warnings for string truncation in servers
Now that servers use an array for the server name, name truncation can
occur. Although this is nigh impossible, a warning message is a prudent
precaution.
2016-11-11 11:17:30 +02:00
Markus Makela
08ebb88aec Make server creation simpler
Server creation and allocation are now the same apart from the fact that
allocation only adds the server to the running configuration where as the
creation of a server also persist it to disk.

The server serialization should not be seen through the server.h API. This
allows the serialization method to change without actually having to
change the interfaces.
2016-11-11 10:54:34 +02:00
Markus Makela
16e8aa7178 Fix server usage bugs in monitors and servers
The MySQL Monitor did not reset the pointer to the root master reference
which would lead to a crash if the master was removed.

When service details were shown, it listed all servers that existed. Only
servers that haven't been removed or destroyed should be shown.
2016-11-11 10:54:34 +02:00
Markus Makela
e67a829daf Take server destruction into use
The servers can now be destroyed with the `destroy server NAME` maxadmin
command.
2016-11-11 10:54:33 +02:00
Markus Makela
261f5fdc36 Enable destruction of servers
The servers can now be destroyed which removes them from the list of
active servers. If the server was not created at runtime, a warning is
logged.
2016-11-11 10:54:32 +02:00
Markus Makela
f0082256f5 Only print servers that aren't destroyed
If a server were to be destroyed, it should not show up among
non-destroyed servers. Even though the servers aren't actually destroyed,
it hides unnecessary information from the user.
2016-11-11 10:47:47 +02:00
ekorh475
7499630614 MXS-576 Check for negative values for config settings
Previously, negative values were allowed for persistpoolmax and
persistmaxtime. Now they cause an error. Also, monitor_interval
allowed negative (or zero) values, which were then implicitly cast to
unsigned, causing unintended behaviour. Now this causes a warning
and the default value is used.
2016-11-11 10:07:10 +02:00
MassimilianoPinto
2334c663e0 Merge branch 'develop' into MXS-936 2016-11-10 15:42:09 +01:00
Markus Makela
c9218351b8 MXS-922: Serialize created servers
When a server is created via MaxAdmin, it will be serialized to disk. This
allows created servers to be retained through a restart of MaxScale.

Currently, all serialized objects are stored in one folder and there is no
structure in the created files. In the future, servers could be created
under a `servers` subdirectory so that it is easier to see what was
added. Whether there is a need for this will be seen.
2016-11-10 15:15:10 +02:00