This commit is contained in:
Markus Makela
2015-02-05 18:33:00 +02:00
7 changed files with 42494 additions and 50 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
[Search page for MaxScale Documentation]((http://mariadb-corporation.github.io/MaxScale/Search/)
# Contents # Contents
## About MaxScale ## About MaxScale

View File

@ -62,82 +62,46 @@ $ cd build
The next step is to run the cmake command to build the Makefile you need to compile Maxscale. There are a number of options you may give to configure cmake and point it to the various packages it requires. These are documented in the MaxScale README file, in this example we will assume the MariaDB developer packages have been installed in a non-standard location and set all the options required to locate these, along with options to build the unit tests and configure the installation target directory. The next step is to run the cmake command to build the Makefile you need to compile Maxscale. There are a number of options you may give to configure cmake and point it to the various packages it requires. These are documented in the MaxScale README file, in this example we will assume the MariaDB developer packages have been installed in a non-standard location and set all the options required to locate these, along with options to build the unit tests and configure the installation target directory.
$ cmake -DMYSQL_DIR=~/usr/include/mysql \ $ cmake -DMYSQL\_DIR=/usr/mariadb-5.5.41-linux-x86_64/include/mysql \
-DEMBEDDED\_LIB=/usr/mariadb-5.5.41-linux-x86\_64/lib/libmysqld.a \
-DEMBEDDED_LIB=~/usr/lib64/libmysqld.a \ -DMYSQLCLIENT\_LIBRARIES=/usr/mariadb-5.5.41-linux-x86_64/lib/libmysqlclient.so \
-DERRMSG=/usr/mariadb-5.5.41-linux-x86\_64/share/english/errmsg.sys \
-DMYSQLCLIENT_LIBRARIES=~/usr/lib64/libmysqlclient.so \ -DINSTALL\_DIR=/home/maxscale/MaxScale -DBUILD_TESTS=Y \
-DINSTALL\_SYSTEM\_FILES=N \
-DERRMSG=~/usr/share/mysql/english/errmsg.sys \ -DBUILD_BINLOG=Y ../
-DINSTALL_DIR=/usr/local/maxscale -DBUILD_TESTS=Y \
-DINSTALL_SYSTEM_FILES=N ../MaxScale
-- CMake version: 2.8.12.2 -- CMake version: 2.8.12.2
-- The C compiler identification is GNU 4.4.7 -- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7 -- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works -- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info -- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done -- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works -- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done -- Detecting CXX compiler ABI info - done
-- Library was found at: /lib64/libaio.so -- Library was found at: /lib64/libaio.so
-- Library was found at: /usr/lib64/libssl.so -- Library was found at: /usr/lib64/libssl.so
-- Library was found at: /usr/lib64/libcrypt.so -- Library was found at: /usr/lib64/libcrypt.so
-- Library was found at: /usr/lib64/libcrypto.so -- Library was found at: /usr/lib64/libcrypto.so
-- Library was found at: /usr/lib64/libz.so -- Library was found at: /usr/lib64/libz.so
-- Library was found at: /usr/lib64/libm.so -- Library was found at: /usr/lib64/libm.so
-- Library was found at: /usr/lib64/libdl.so -- Library was found at: /usr/lib64/libdl.so
-- Library was found at: /usr/lib64/librt.so -- Library was found at: /usr/lib64/librt.so
-- Library was found at: /usr/lib64/libpthread.so -- Library was found at: /usr/lib64/libpthread.so
-- Using errmsg.sys found at: /home/maxscale/usr/share/mysql/english/errmsg.sys -- Using errmsg.sys found at: /home/maxscale/usr/share/mysql/english/errmsg.sys
-- Using embedded library: /home/mpinto/usr/lib64/libmysqld.a -- Using embedded library: /home/mpinto/usr/lib64/libmysqld.a
-- Valgrind found: /usr/bin/valgrind -- Valgrind found: /usr/bin/valgrind
-- Found dynamic MySQL client library: /home/maxscale/usr/lib64/libmysqlclient.so -- Found dynamic MySQL client library: /home/maxscale/usr/lib64/libmysqlclient.so
-- Found static MySQL client library: /usr/lib/libmysqlclient.a -- Found static MySQL client library: /usr/lib/libmysqlclient.a
-- C Compiler supports: -Werror=format-security -- C Compiler supports: -Werror=format-security
-- Linking against: /home/mpinto/usr/lib64/libmysqlclient.so -- Linking against: /home/mpinto/usr/lib64/libmysqlclient.so
-- Installing MaxScale to: /usr/local/maxscale/ -- Installing MaxScale to: /usr/local/maxscale/
-- Generating RPM packages -- Generating RPM packages
-- Found Doxygen: /usr/bin/doxygen (found version "1.6.1") -- Found Doxygen: /usr/bin/doxygen (found version "1.6.1")
-- Configuring done -- Configuring done
-- Generating done -- Generating done
-- Build files have been written to: /home/maxscale/develop/build -- Build files have been written to: /home/maxscale/develop/build
-bash-4.1$ make depend -bash-4.1$ make depend

View File

@ -1,29 +1,42 @@
Hint Syntax # Hint Syntax
Use either ’-- ’ (notice the whitespace) or ’#’after the semicolon or ’/* .. */’ before
Use either ’-- ’ (notice the whitespace) or ’#’ after the semicolon or ’/* .. */’ before
the semicolon. the semicolon.
The MySQL manual doesn’t specify if comment blocks, i.e. ’/* .. */’, should contain a w The MySQL manual doesn’t specify if comment blocks, i.e. ’/* .. */’, should contain a w
hitespace character before or after the tags. hitespace character before or after the tags.
All hints must start with the ’maxscale tag’: All hints must start with the ’maxscale tag’:
-- maxscale <hint> -- maxscale <hint>
The hints right now have two types, ones that route to a server and others that contain The hints right now have two types, ones that route to a server and others that contain
name-value pairs. name-value pairs.
Routing queries to a server: Routing queries to a server:
-- maxscale route to [master | slave | server <server name>] -- maxscale route to [master | slave | server <server name>]
The name of the server is the same as in MaxScale.cnf The name of the server is the same as in MaxScale.cnf
Creating a name-value pair: Creating a name-value pair:
-- maxscale <param>=<value> -- maxscale <param>=<value>
Currently the only accepted parameter is Currently the only accepted parameter is
’max_slave_replication_lag’ ’max_slave_replication_lag’
Hints can be either single-use hints, which makes them affect only one query, or named Hints can be either single-use hints, which makes them affect only one query, or named
hints, which can be pushed on and off a stack of active hints. hints, which can be pushed on and off a stack of active hints.
Defining named hints: Defining named hints:
-- maxscale <hint name> prepare <hint content> -- maxscale <hint name> prepare <hint content>
Pushing a hint onto the stack: Pushing a hint onto the stack:
-- maxscale <hint name> begin -- maxscale <hint name> begin
Popping the topmost hint off the stack: Popping the topmost hint off the stack:
-- maxscale end -- maxscale end
You can define and activate a hint in a single command using the following: You can define and activate a hint in a single command using the following:
-- maxscale <hint name> begin <hint content> -- maxscale <hint name> begin <hint content>
You can also push anonymous hints onto the stack which are only used as long as they ar
e on the stack: You can also push anonymous hints onto the stack which are only used as long as they are on the stack:
-- maxscale begin <hint content> -- maxscale begin <hint content>

View File

@ -80,7 +80,7 @@ This parameter is used to provide the stem of the file names that are used to st
### initialfile ### initialfile
This optional parameter allows for the administrator to define the number of the first binlog file to download. In normal circumstances MaxScale will use any existing binlog file to determine what to request from the master. If there are no files it will then ask for the binlog file with the index number defined in the initialfile parameter. If this parameter is not set then MaxScale will ask the master for binlog events from file 1. This optional parameter allows for the administrator to define the number of the first binlog file to download. If MaxScale has previously received binlogs it will use those existing binlog files to determine what to request from the master. If no files have been downloaded MaxScale will then ask for the binlog file with the index number defined in the initialfile parameter. If this parameter is not set then MaxScale will ask the master for binlog events from file 1.
### binlogdir ### binlogdir
@ -99,7 +99,7 @@ A complete example of a service entry for a binlog router service would be as fo
[Replication] [Replication]
type=service type=service
router=binlogrouter router=binlogrouter
servers=maserdb servers=masterdb
version_string=5.6.17-log version_string=5.6.17-log
router_options=uuid=f12fcb7f-b97b-11e3-bc5e-0401152c4c22,server-id=3,user=repl,password=slavepass,master-id=1,filestem=mybin,heartbeat=30,binlogdir=/home/mriddoch/binlogs router_options=uuid=f12fcb7f-b97b-11e3-bc5e-0401152c4c22,server-id=3,user=repl,password=slavepass,master-id=1,filestem=mybin,heartbeat=30,binlogdir=/home/mriddoch/binlogs
user=maxscale user=maxscale

View File

@ -354,6 +354,10 @@ int n;
unsigned long filelen = 0; unsigned long filelen = 0;
struct stat statb; struct stat statb;
if (!file)
{
return NULL;
}
if (fstat(file->fd, &statb) == 0) if (fstat(file->fd, &statb) == 0)
filelen = statb.st_size; filelen = statb.st_size;
if (pos >= filelen) if (pos >= filelen)

View File

@ -1079,6 +1079,15 @@ uint32_t chksum;
ptr = GWBUF_DATA(queue); ptr = GWBUF_DATA(queue);
len = extract_field(ptr, 24); len = extract_field(ptr, 24);
binlognamelen = len - 11; binlognamelen = len - 11;
if (binlognamelen > BINLOG_FNAMELEN)
{
LOGIF(LE, (skygw_log_write(
LOGFILE_ERROR,
"blr_slave_binlog_dump truncating binlog filename "
"from %d to %d",
binlognamelen, BINLOG_FNAMELEN)));
binlognamelen = BINLOG_FNAMELEN;
}
ptr += 4; // Skip length and sequence number ptr += 4; // Skip length and sequence number
if (*ptr++ != COM_BINLOG_DUMP) if (*ptr++ != COM_BINLOG_DUMP)
{ {
@ -1098,6 +1107,13 @@ uint32_t chksum;
strncpy(slave->binlogfile, (char *)ptr, binlognamelen); strncpy(slave->binlogfile, (char *)ptr, binlognamelen);
slave->binlogfile[binlognamelen] = 0; slave->binlogfile[binlognamelen] = 0;
LOGIF(LD, (skygw_log_write(
LOGFILE_DEBUG,
"%s: COM_BINLOG_DUMP: binlog name '%s', length %d, "
"from position %d.", router->service->name,
slave->binlogfile, binlognamelen,
slave->binlog_pos)));
slave->seqno = 1; slave->seqno = 1;