
------- Removed DCB states DCB_STATE_IDLE, and DCB_STATE_PROCESSING. Added DCB_STATE_UNDEFINED for initial content for state variable which doesn't have any specific value set, and DCB_STATE_NOPOLLING to indicate that dcb has been removed from poll set. Added following dcb roles: DCB_ROLE_SERVICE_LISTENER for listeners of services, and DCB_ROLE_REQUEST_HANDLER for client/backend dcbs. Listeners may have state DCB_STATE_LISTENING, but not DCB_STATE_POLLING. Request handlers may have DCB_STATE_POLLING but not DCB_STATE_LISTENING. Role is passed as an argument to dcb.c:dcb_alloc. From now on, struct check numbers of DCB are included and checked in DEBUG build only. Added dcb_role_t dcb_role-member to DCB as well as SPINLOCK dcb_initlock, which protects state changes. Removed extern keyword from function declarations because functions are by default externally visible if they are declared in header. dcb.b ------ Function dcb_set_state, and dcb_set_state_nomutex provide functions for changing dcb states. Latter implements a state machine for dcb. Function dcb_add_to_zombieslist replaces dcb_free. It adds in atomic step dcb to zombieslist and changes state to DCB_STATE_ZOMBIE. Function dcb_final_free removes dcb from allDCBs list, terminates router and client sessions, and frees dcb and related memory. Function dcb_process_zombies removes executing thread from dcb's bitmask, and it there are no further thread bits, moves dcb to a victim list, and finally, for each dcb on victim list, closes fd and sets state to DCB_STATE_DISCONNECTED. Function dcb_close sets dcb state to DCB_STATE_NOPOLLIN, removes dcb from poll set and sets bit to bitmask for each server thread in an atomic step. poll.c ------ Function poll_add_dcb sets either DCB_STATE_LISTENING or DCB_STATE_POLLING state for newly created dcb, depending whether the role of dcb is DCB_ROLE_SERVICE_LISTENER, or DCB_ROLE_REQUEST_HANDLER, respectively. Then dcb is set to poll set. poll_waitevents : commented out code which skipped event if dcb was added to zombieslist or if fd was closed. Added state checks. service.c : Minor changes. httpd.c : Removed dcb state changes. They are done in core. mysql_backend.c : Added checks, removed dcb state changes. mysql_client.c : Removed dcb state changes. Added checks. mysql_common.c : Minor changes telnetd.c : Removed state changes. Replaced some typecasts and pointer references with local variable reads. skygw_debug.h : Removed two states, and added two to state printing macro.
/** \mainpage MaxScale by SkySQL The SkySQL MaxScale is an intelligent proxy that allows forwarding of database statements to one or more database server user complex rules and a semantic understanding of the database satements and the roles of the various servers within the backend cluster of databases. The MaxScale is designed to provided load balancing and high avilability functionality transparantly to the applications. In addition it provides a highly scalable and flexibile architecture, with plugin components to support differnt protocols and routing decissions. The MaxScale is implemented in C and makes entensive use of the asynchronous I/O capabilities of the Linux operating system. The epoll system is used to provide the event driven framework for the input and output via sockets. The protocols are implemented as external shared object modules which can be loaded and runtime. These modules support a fixed interface, communicating the entries points via a structure consisting of a set of function pointers. This structured is called the "module object". The code that routes the queries to the database servers is also loaed as external shared objects and are referred to as routing modules. \section Building Building the MaxScale Edit the file build_gateway.inc in your skygateway directory and set the ROOT_PATH and MARIADB_SRC_PATH variables to the location in which you checked out the code and the location of your MariaDB source. Build the libmysqld in $MARIADB_SRC_PATH Go to the sky gateway directory and do a make depend to update all the dependency files and then do a make. This should get you all the things built that you need. Other make targets are available install - Installs the binary and the modules in the location defined by the make variable DEST ctags - Build tags files for the vi editor documentation - Build the doxygen documentation depend - Update the dependencies used by the makefiles Two files are required for the libmysqld library that is used within MaxScale, /usr/local/mysql/share/english/errmsg,sys and a my.cnf file with the following: [mysqld] max_connections=4096 \section Running Running the MaxScale The gateway consists of a core executable and a number of modules that implement the different protocols and routing algorithms. These modules are built as shared objects that are loaded on demand. In order for the gateway to find these modules it will search using a predescribed search path. The rules are: 1. Look in the current directory for the module 2. Look in $MAXSCALE_HOME/modules 3. Look in /usr/local/skysql/MaxScale/modules Configuration is read by default from the file $MAXSCALE_HOME/etc/MaxScale.cnf, /etc/MaxScale.cnf, an example file is included in the root of the source tree. The default location can be overriden by use of the -c flag on the command line. This should be immediately followed by the path to the configuration file. */
Description
Languages
C
50.9%
C++
30.8%
Shell
3.7%
HTML
3.2%
Tcl
3.1%
Other
8.1%