4439 Commits

Author SHA1 Message Date
Markus Makela
36896afcbd Fixed missing NULL check when reading records
If the binlog record was not found, a NULL pointer is returned. There was no
check for the return value and it assumed that it was always non-NULL.
2016-02-16 13:06:25 +02:00
Markus Makela
74c8b5e296 Fixed events larger than 2^24 failing without transaction safety
If transaction safety was disabled and a large event sent in multiple SQL
packets was received, the distribution of that event to the slaves would fail.
2016-02-16 13:06:25 +02:00
Markus Makela
2b7e2d3043 Added checksum calculations for events larger than 2^24 bytes
The checksums are now properly calculated for large events that span multiple
SQL packets.
2016-02-16 13:06:25 +02:00
Markus Makela
3609f97ba0 Fixed events which are exactly 0x00fffffe bytes long failing to replicate
The empty packet sent after a large event which fits into exactly one packet
was written to disk and the writing of no bytes caused it to be treated as
an error.
2016-02-16 13:06:25 +02:00
MassimilianoPinto
476691eda1 Removed log message for event larger than 16MB
The log message used during tests is now removed
2016-02-16 13:06:25 +02:00
Markus Makela
3e04a36ac3 Added support for distribution of packets larger than 2^24 bytes
Moved the the sending of the replication events to a different function
and added support for events that span multiple MySQL packets.
2016-02-16 13:06:25 +02:00
Markus Makela
12ee568978 Fixed last_written being set to the size of the event
The addition used =+ instead of += which caused it to be an assignment.
2016-02-16 13:06:25 +02:00
Markus Makela
d2b4713d27 Added missing condition to else clause
This fixes all packets being considered as large packets.
2016-02-16 13:06:25 +02:00
Markus Makela
ae33df3cbc Large events are now processed in chuncks
The router->last_written is used to store the position where the last event was
written. The replication header is also stored in a separate structure in
the router which is used later when the last packet of a multi-packet event
arrives.
2016-02-16 13:06:24 +02:00
MassimilianoPinto
d3e1d4dd2f First fix for 16MB handling in the master part
First fix for 16MB handling in the master part.

Distribute events to up to date slave is not included yet
2016-02-16 13:06:24 +02:00
MassimilianoPinto
ab1fb90d86 Fix for 16MB transmission in the slave part
Fix for 16MB transmission in the slave part
2016-02-16 13:06:24 +02:00
MassimilianoPinto
4eccc1acb6 When creating heartbeat packet too many bytes were copied.
The memory area ‘ptr’ points to contains now the right data
2016-02-11 17:06:13 +01:00
MassimilianoPinto
0ab9733393 The router->rotating is no longer part of Unsafe Pos check
In blr_read_binlog the router->rotating is no longer used for Unsafe
Pos check
2016-02-01 09:12:48 +01:00
Johan Wikman
d9b022db10 Protect updating of router when rotating.
When rotating, all state variables of router are now updated while
protected by the router->binlog_lock lock.
2016-01-28 15:23:22 +02:00
Johan Wikman
0deffbf2f2 Ensure that slave->cstate contains meaningful value.
In blr_slave_callback the bits of slave->cstate are reset and
set as one transaction. Earlier they were reset in one and
set in another, leading to a situation where slave->cstate did
not contain a sensible value for a short period of time.

Further, it is now explicitly checked in blr_distribute_binlog_record
that slave->cstate indeed contains a meaningful value.
2016-01-28 11:00:07 +02:00
MassimilianoPinto
1a4fc56c67 Unsafe Pos detection moved into blr_slave_catchup and removed router->rotating check
Unsafe Pos detection moved into blr_slave_catchup and removed
router->rotating check
2016-01-25 12:27:57 +01:00
MassimilianoPinto
0a3f20f8af Variable moved
Variable moved
2016-01-11 09:59:22 +01:00
MassimilianoPinto
1b0c7d0d90 Force slave disconnection when requesting an unsafe pos with blr_slave_binlog_dump
Force slave disconnection when requesting an unsafe pos with
blr_slave_binlog_dump
2016-01-08 18:51:36 +01:00
MassimilianoPinto
2715d3f8e4 Removed the 16 chars limitation for binlog file name
Removed the 16 chars limitation for binlog file name
2016-01-07 15:30:57 +01:00
Markus Makela
a5ccf09ac5 Unsafe position is no longer an error
The unsafe slave position is no longer an error and will be treated the
same way if no events are available i.e. the slaves are no longer disconnected.

The log messages now have more information such as the current committed
transaction event being processed and the number of events sent by the
current thread.
2015-12-30 18:13:07 +02:00
MassimilianoPinto
23809af02e Changed burst_size to long instead of unsigned long
Changed burst_size to long instead of unsigned long.
This way check burst_size > 0 is now effective.

Setting "burstsize" option in router_options may be required.
i.e.: burstsize=10M
2015-12-30 16:03:30 +01:00
MassimilianoPinto
82914d43d2 Removed extra brace
Removed extra brace
2015-12-17 16:25:04 +01:00
MassimilianoPinto
b55f100e1f Changed behaviour for a slave requesting master_log_pos beyond binlog file size
Slave request for a log_pos behind binlog file size may result in a
disconnection or replication error:

if binlog file is latest one slave get disconnected otherwise an error
message is returned and replication stops
2015-12-17 15:45:16 +01:00
MassimilianoPinto
162e73f083 Added MaxScale version numbers into the CMake cache
This will allow custom version numbers without modifying the source
code.
2015-12-17 15:28:28 +01:00
Johan Wikman
40cfacfec4 Remove file from slave
The binlog file is now always opened when it is needed and closed
when we are finished with it. That will remove any potential
file concurrency issues between different threads dealing with
the same slave.
2015-12-11 17:25:27 +01:00
Markus Makela
28f05198dd Fixed SHOW SLAVE STATUS showing obsolete slaves
If SHOW SLAVE STATUS was executed after DISCONNECT ALL it was possible that
some of the disconnected slaves were used when printing slave hosts.
2015-12-10 14:50:02 +01:00
Markus Makela
992a8e2300 Slaves are set to unregistered state once disconnected
It was possible that the same slave was disconnected multiple times
before the slave DCB was closed.
2015-12-10 14:49:51 +01:00
Markus Makela
c8a9eafdc0 Replaced explicit closeSession calls with dcb_close
The closeSession entry point shouldn't be called directly and dcb_close
should be used instead.
2015-12-10 14:49:40 +01:00
Johan Wikman
2f54f33cfb Make state-change logging conditional. 2015-12-03 09:54:31 +02:00
Johan Wikman
af7a19b7b3 Reduce logging of binlog server
Only the true state changes of a slave - up-to-date -> catch-up
or catch-up to up-to-date - are logged.
2015-12-02 15:23:55 +02:00
MassimilianoPinto
3d8adefa73 Removed useless spaces
Removed useless spaces
2015-12-01 16:21:53 +01:00
MassimilianoPinto
a53213093a Addition of slave transition to catchup mode in logging
Addition of slave transition to catchup mode in logging
2015-12-01 16:16:14 +01:00
MassimilianoPinto
6367ac7148 Changed log level for up to date transition
Changed log level for up to date transition
2015-11-30 19:23:36 +01:00
MassimilianoPinto
592e4d06cb Changed name for bad fd
Changed name for bad fd
2015-11-30 10:22:47 +01:00
MassimilianoPinto
ba135c5548 Log messages fix with slave ip:port and id
Log messages fix with slave ip:port and id
2015-11-30 10:22:12 +01:00
Johan Wikman
e38334c457 Fix locking issue in blr_close_binlog
In blr_open_binlog the refcnt increase of file which is already
open is protected by router->fileslock. In blr_close_binlog the
decrease of the refcnt was protected by file->lock.

This lead to a situation where it was possible that a file was
closed and the file instance freed, even though it just had been
taken into use by somebody else.

This is now fixed by solely using the router->fileslock for protecting
the increase and decrease of the refcnt.
2015-11-26 10:34:34 +02:00
Johan Wikman
c167499c7b Add notice about previous failure to unlock.
In blr_slave.c under certain conditions, two locks were not released.
That was fixed in another change, and with this change a notice will be
logged if that branch is entered. That way it will be possible to find
out whether this may have been the cause of earlier lock-ups.
2015-11-23 09:51:59 +02:00
MassimilianoPinto
99fdf9cdec Fixed reference to LOGIF macro
Fixed reference to LOGIF macro
2015-11-19 17:54:23 +01:00
MassimilianoPinto
023d4bc588 Develop merge
Develop merge
2015-11-19 17:06:30 +01:00
Johan Wikman
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
Markus Makela
84d2c72db2 Formatted mqfilter
Mqfilter formatted according to the style guide.
2015-11-19 12:16:47 +02:00
MassimilianoPinto
90d2dc336c Missing lock release added
Missing lock release added and log message update
2015-11-19 08:58:49 +01:00
Johan Wikman
6613723a1f Update error message when startup fails
Claiming that the loading of maxscale.cnf failed in case of any
error was misleading. Maxscale may not succeed in opening it,
reading it or processing it.
2015-11-19 09:28:14 +02:00
Johan Wikman
0345f3622d LOGIF and skygw_log_write removed.
All places where LOGIF and skygw_log_write were used have been
updated to use the new logging macros instead. Consequently,
they can now be removed.
2015-11-19 09:26:27 +02:00
Johan Wikman
ee7793312b Broken error message fixed in readwritesplit.c
When converting the skygw_ logging calls to MXS_ equivalents,
some part of the error message got lost.
2015-11-18 20:51:11 +02:00
Johan Wikman
3e3770fa82 ss_dassert() no longer uses skygw_log_write.
Use of skygw_log_write() in ss_dassert and ss_info_dassert replaced
with the use of MXS_ERROR(). In addition, ss_dassert and ss_info_dassert
are now expressions that require a trailing ;.
2015-11-18 14:56:08 +02:00
Markus Makela
cbeead7c43 Formatted namedserverfilter
Namedserverfilter formatted according to the style guide.
2015-11-18 14:44:05 +02:00
Markus Makela
036fd6f16c Formatted qlafilter
Qlafilter formatted according to the style guide.
2015-11-18 14:31:02 +02:00
Markus Makela
a7c0952e66 Formatted tee filter
Tee filter formatted according to the style guide.
2015-11-18 14:18:00 +02:00
Markus Makela
e24504c427 Formatted topfilter
Topfilter is now formatted according to the style guide.
2015-11-18 13:46:23 +02:00