Commit Graph

3748 Commits

Author SHA1 Message Date
099a482f04 Add missing default case to masking filter
The default case for the PS field values was missing.
2017-09-14 15:30:44 +03:00
45e0e8bb59 Introduce internal protocol command enum
The enums exposed by the connector are not intended to be used by the
users of the library. The fact that the protocol, and other, modules used
it was in violation of how the library is intended to be used.

Adding an internal mapping into MaxScale also removes some of the
dependencies that the core has on the connector.
2017-09-14 15:30:43 +03:00
3676dcebb1 MXS-1398: Clean up mysql.h header
Cleaned up the MaxScale version of the mysql.h header by removing all
unused includes. This revealed a large amount of dependencies on these
removed includes in other files which needed to be fixed.

Also sorted all includes in changed files by type and alphabetical
order. Removed explicit revision history from modified files.
2017-09-14 15:30:43 +03:00
7e48941a04 MXS-1412: Process response buffers individually
By processing each buffer individually, the need to iterate over the whole
resultset is removed. Profiling showed that most of the time was spent
navigating the linked list of buffers when an offset into the whole
resultset was used instead of an offset to the individual response buffer.
2017-09-14 09:50:05 +03:00
efb1e541e2 Add missing DbfwThread initialization
The thread objects didn't initialize the rule version to the proper value.
2017-09-13 18:03:43 +03:00
3df5e6f137 Fix CHANGE MASTER TO with binlog server state BLRM_UNCONFIGURED
Fix CHANGE MASTER TO with binlog server state BLRM_UNCONFIGURED
2017-09-13 15:51:35 +02:00
7e1e63aef6 The poll_fake_write_event() ins no longer needed after the blr_slave_fake_rotate() call
Also removed some useless branches with ‘record’ pointer being not NULL
2017-09-13 13:57:56 +02:00
16d3eab59f Merge branch '2.1' into develop 2017-09-12 22:42:11 +03:00
0f3a13e6ac Remove unused binlogrouter variables
The unused variables cause compilation to fail.
2017-09-12 22:32:40 +03:00
43d5f67a76 MXS-1383: fix for some change master to MASTER_LOG_FILE, POS settings that fail.
MXS-1383: fix for some change master to MASTER_LOG_FILE, POS settings
that fail.
2017-09-12 14:33:10 +02:00
e0c85d02fa Minor fixes for testbinlog.c
Minor fixes for testbinlog.c
2017-09-12 14:33:10 +02:00
d2f790a06c Merge remote-tracking branch 'origin/develop' into develop 2017-09-12 11:22:10 +03:00
16127d893c Fix compilation failures on CentOS 6
Thread-local non-POD types are not supported on CentOS 6 and thus they
need to be replaced with pointers to the relevant objects and initialized
at runtime.

In addition to this, functor objects don't appear to work as expected in
CentOS 6 and replacing them with a simple for-loop seems to work.
2017-09-12 11:17:19 +03:00
02b9e0a01d Merge branch '2.1.7' into develop-2.1-merge 2017-09-12 11:08:02 +03:00
9ceb23dd65 MXS-1396: Fix persistent connection hangs
When a COM_CHANGE_USER was executed, it is possible that the server
responds with a AuthSwitchRequest packet instead of an OK packet. In this
case, the server sends a new scramble which must be used to create the 20
byte hash that is expected as the response.
2017-09-11 12:50:24 +03:00
6cf90ceb15 MXS-1390: Update MaxAdmin documentation
Added the missing documentation for the alteration of
admin_log_auth_failures.
2017-09-11 12:49:11 +03:00
847496d4fa Fix for testbinlog.c library set and object creation checks
Fix for testbinlog.c library set and object creation checks
2017-09-11 10:02:15 +02:00
6606983181 MXS-1383: abort slave connection if requested filename doesn't exist
MXS-1383: abort slave connection if requested filename doesn't exist
2017-09-08 18:43:01 +02:00
9617119aa9 Added blr_abort_change_master() routine
Added blr_abort_change_master() routine
2017-09-08 14:25:09 +02:00
ac0de09c7c Fix log message when GTID is in use
Fix log message when GTID is in use
2017-09-08 14:25:09 +02:00
daef8ad5d7 With GTID master registration always get filename from GTID repo
With GTID master registration always get filename from GTID repo.

The filestem option is not written if binlog_name is not set: this is
not needed by GTID registration.
router->fileroot is set when last name is loaded from GTID repo.
2017-09-08 10:48:35 +02:00
bca1e34d27 MXS-1389: Add missing basic rule type
The basic rule type that matches everything was not created when a rule
with only an optional part was defined. This caused a crash when only one
rule with only an optional part was created. This was caused by the
expectation that the list of rules was never empty.
2017-09-08 09:31:38 +03:00
a4975edbba MXS-1389: Fix rule reloading and query parsing requirements
Reloading of rules now properly uses the current rule file if no argument
was provided. The rule version counter also used atomic operations for the
sake of correctness.

The rule parsing is now only required for DML type statements that should
be fully parsed.
2017-09-08 09:31:38 +03:00
26f0c08522 MXS-1389: Allow mandatory commands to pass
All commands that are deemed mandatory must be allowed to pass through the
filter.
2017-09-08 09:31:38 +03:00
a08179afcb MXS-1346: make value comparisons case-insensitive
All values for columns, function and function_usage rules should be
compared in a case-insensitive way.
2017-09-08 09:31:38 +03:00
9ed0524699 MXS-1346: Fix at_times time period calculcation
The time period matched for one extra second.
2017-09-08 09:31:38 +03:00
68baf582c8 Deprecate deny and allow in dbfwfilter rules
The `deny` and `allow` tokens are replaced with `match` which better
describes the action. Use of the old tokens causes a warning to be logged.
2017-09-08 09:31:38 +03:00
7272d9401d MXS-1346: Fix the at_times rule
The rule used the values from the QuerySpeed struct instead of the values
in the rule itself.
2017-09-08 09:31:38 +03:00
b9698f15e7 MXS-1346: Clear value stack when a new rule is created
The values on the stack are cleared when a new rule is created.
2017-09-08 09:31:37 +03:00
1fcf4ef59a MXS-1346: Allow combination of function and columns rules
The `function` type rule can now be combined with the `columns` type rule
to form a new rule which matches if specific columns use specific
functions.
2017-09-08 09:31:37 +03:00
a955e4a623 MXS-1346: Only parse text queries
Only text format queries (COM_QUERY, COM_STMT_PREPARE) can be parsed by
the query classifier.

Also fixed invalid use of a NULL value in a string constructor.
2017-09-08 09:31:37 +03:00
2ccdd93d44 MXS-1346: Fix rule handling
The call to update_rules is needed before each query to make sure that the
rules are up to date.

The check whether the rule was active was inverted.
2017-09-08 09:31:37 +03:00
6067c21c1b MXS-1346: Use the filter template in dbfwfilter
The dbfwfilter now uses the MaxScale filter template. Also fixed up some
of the filter template documentation.
2017-09-08 09:31:37 +03:00
fc1435d0c2 MXS-1346: Hide DbfwSession internals
The DbfwSession now only exposes the necessary methods with the exception
of the DOWNSTREAM and UPSTREAM structures. These will be handled when the
session implements the filter template.
2017-09-08 09:31:37 +03:00
dc7b25d0fe MXS-1346: Make Dbfw a proper class
The Dbfw class now only exposes the necessary methods which are required.
2017-09-08 09:31:37 +03:00
cf2e8d8b34 MXS-1346: Add DbfwSession method implementations
Added the implementation of the DbfwSession methods.
2017-09-08 09:31:36 +03:00
f5401c5244 MXS-1346: Rename dbfwfilter instance and session
Renamed the structures to C++ naming style and added initial declarations
for DbfwSession methods.

The DbfwSession methods are not yet fully implemented which is why parts
of the class are still public. The intention is to use the filter template
when the session class is sufficiently refactored.
2017-09-08 09:31:36 +03:00
fa6f155d29 MXS-1346: Make Rule methods const
Most of the methods can be const functions.
2017-09-08 09:31:36 +03:00
3648b5e702 MXS-1346: Clean up dbfwfilter.cc
Remove redundant code, move assignments to struct constructors, organize
variable declarations, use standard library functions.
2017-09-08 09:31:36 +03:00
4c4ea94319 MXS-1346: Clean up unused code
Removed the rule type enum and replaced it with a string description of
the type. Moved the rule type and name strings as private to the Rule
class. Replaced the need_full_parsing of the base class with a simple
constant.

Removed the unused array of rule names as well and the STRLINK structure
and the functions that use it.
2017-09-08 09:31:36 +03:00
594956178d MXS-1346: Implement LimitQueriesRule::matches_query
Moved the code into the LimitQueriesRule class and cleaned it up. Renamed
the QUERYSPEED struct and added simple constructor.
2017-09-08 09:31:36 +03:00
890f860650 MXS-1346: Refactor column, function and function usage rules
The rule matching implementations are now done in the ColumnsRule,
FunctionRule and FunctionUsageRule classes. The query_matches function now
also takes the session as its first parameter to relay session related
information to the rule. This will be needed by the LimitQueriesRule
class.
2017-09-08 09:31:36 +03:00
eb884aeb6e MXS-1346: Rename users.cc to user.cc
user.cc better describes the contents of the file as it defines the User
class.
2017-09-08 09:31:36 +03:00
1d11a12dcf MXS-1346: Move matching implementation into classes
Added the implementations of the query_matches method for the RegexRule,
WhereClauseRule and WildCardRule classes and moved the query matching code
into these functions.
2017-09-08 09:31:36 +03:00
f5d7919dbb MXS-1346: Add classes for all rule types
Added class declarations for all rule types. The matching functionality
for each class still needs to be implemented.
2017-09-08 09:31:36 +03:00
c55c46ac0c MXS-1346: Move rule matching into the User class
The User class now only exposes the `match` method which can be used to
check if any of the rules for a user match a query. Further cleanup is
required once individual rule classes have been implemented.
2017-09-08 09:31:36 +03:00
f7b978b2a2 MXS-1346: Make User more like a class
The User class now handles the appending of the rules by itself and it
also provides a method for accessing the name instead of exposing the name
itself.

The rules matching is still done externally to the User class and moving
it into the User class depends on other changes being made first.
2017-09-08 09:31:36 +03:00
ee88ae67f8 MXS-1346: Make dbfwfilter objects non-copyable
The User and Rule classes should not be copied.
2017-09-08 09:31:35 +03:00
eee32a4e21 MXS-1346: Split dbfwfilter declarations into multiple headers
The core declarations of the dbfwfilter are in dbfwfilter.hh, the rules in
rules.hh and the users in users.hh. The implementation of the rules is in
rules.cc.
2017-09-08 09:31:35 +03:00
0d8284f82e MXS-1346: Make permission rules a class
The default rule is of the type that always matches any query and the Rule
base class should reflect this.
2017-09-08 09:31:35 +03:00