Automatic merge
This commit is contained in:
@ -18,16 +18,17 @@ Group: Development/Tools
|
|||||||
BuildRequires: gcc gcc-c++ ncurses-devel bison glibc-devel cmake libgcc perl make libtool openssl-devel
|
BuildRequires: gcc gcc-c++ ncurses-devel bison glibc-devel cmake libgcc perl make libtool openssl-devel
|
||||||
|
|
||||||
%description
|
%description
|
||||||
galera-remote-exec
|
MaxScale
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
|
|
||||||
%setup -q
|
%setup -q
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make ROOT_PATH=`pwd` MARIADB_SRC_PATH=/home/skysql/mariadb-5.5.32 depend
|
MARIADB_SRC_PATH=/home/ec2-user/.jenkins/jobs/MariaDB_for_MaxScale/workspace
|
||||||
make ROOT_PATH=`pwd` MARIADB_SRC_PATH=/home/skysql/mariadb-5.5.32
|
make ROOT_PATH=`pwd` MARIADB_SRC_PATH=$MARIADB_SRC_PATH depend
|
||||||
make DEST=`pwd`/binaries ROOT_PATH=`pwd` MARIADB_SRC_PATH=/home/skysql/mariadb-5.5.32 install
|
make ROOT_PATH=`pwd` MARIADB_SRC_PATH=$MARIADB_SRC_PATH
|
||||||
|
make DEST=`pwd`/binaries ROOT_PATH=`pwd` MARIADB_SRC_PATH=$MARIADB_SRC_PATH install
|
||||||
|
|
||||||
%post
|
%post
|
||||||
|
|
||||||
|
|||||||
@ -58,7 +58,7 @@ install:
|
|||||||
@mkdir -p $(DEST)/MaxScale/etc
|
@mkdir -p $(DEST)/MaxScale/etc
|
||||||
@mkdir -p $(DEST)/lib
|
@mkdir -p $(DEST)/lib
|
||||||
@mkdir -p $(DEST)/Documentation
|
@mkdir -p $(DEST)/Documentation
|
||||||
install MaxScale.cnf $(DEST)/MaxScale/etc
|
install -b MaxScale.cnf $(DEST)/MaxScale/etc
|
||||||
install ../Documentation/*.pdf $(DEST)/Documentation
|
install ../Documentation/*.pdf $(DEST)/Documentation
|
||||||
(cd core; make DEST=$(DEST) install)
|
(cd core; make DEST=$(DEST) install)
|
||||||
(cd modules/routing; make DEST=$(DEST) install)
|
(cd modules/routing; make DEST=$(DEST) install)
|
||||||
|
|||||||
@ -84,6 +84,15 @@ static char* server_groups[] = {
|
|||||||
/* The data directory we created for this gateway instance */
|
/* The data directory we created for this gateway instance */
|
||||||
static char datadir[1024] = "";
|
static char datadir[1024] = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* exit flag for log flusher.
|
||||||
|
*/
|
||||||
|
static bool do_exit = FALSE;
|
||||||
|
|
||||||
|
static void log_flush_shutdown(void);
|
||||||
|
static void log_flush_cb(void* arg);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for SIGHUP signal. Reload the configuration for the
|
* Handler for SIGHUP signal. Reload the configuration for the
|
||||||
* gateway.
|
* gateway.
|
||||||
@ -234,6 +243,8 @@ int i, n, n_threads, n_services;
|
|||||||
void **threads;
|
void **threads;
|
||||||
char mysql_home[1024], buf[1024], *home, *cnf_file = NULL;
|
char mysql_home[1024], buf[1024], *home, *cnf_file = NULL;
|
||||||
char ddopt[1024];
|
char ddopt[1024];
|
||||||
|
void* log_flush_thr = NULL;
|
||||||
|
ssize_t log_flush_timeout_ms = 0;
|
||||||
|
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
@ -424,9 +435,13 @@ char ddopt[1024];
|
|||||||
* Start the services that were created above
|
* Start the services that were created above
|
||||||
*/
|
*/
|
||||||
n_services = serviceStartAll();
|
n_services = serviceStartAll();
|
||||||
skygw_log_write_flush(LOGFILE_MESSAGE,
|
skygw_log_write(LOGFILE_MESSAGE, "Started modules succesfully.");
|
||||||
"Start modules completed");
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start periodic log flusher thread.
|
||||||
|
*/
|
||||||
|
log_flush_timeout_ms = 1000;
|
||||||
|
log_flush_thr = thread_start(log_flush_cb, (void *)&log_flush_timeout_ms);
|
||||||
/*
|
/*
|
||||||
* Start the polling threads, note this is one less than is
|
* Start the polling threads, note this is one less than is
|
||||||
* configured as the main thread will also poll.
|
* configured as the main thread will also poll.
|
||||||
@ -439,6 +454,11 @@ char ddopt[1024];
|
|||||||
for (n = 0; n < n_threads - 1; n++)
|
for (n = 0; n < n_threads - 1; n++)
|
||||||
thread_wait(threads[n]);
|
thread_wait(threads[n]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait the timer thread.
|
||||||
|
*/
|
||||||
|
thread_wait(log_flush_thr);
|
||||||
|
|
||||||
/* Stop all the monitors */
|
/* Stop all the monitors */
|
||||||
monitorStopAll();
|
monitorStopAll();
|
||||||
|
|
||||||
@ -457,4 +477,25 @@ void
|
|||||||
shutdown_gateway()
|
shutdown_gateway()
|
||||||
{
|
{
|
||||||
poll_shutdown();
|
poll_shutdown();
|
||||||
|
log_flush_shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void log_flush_shutdown(void)
|
||||||
|
{
|
||||||
|
do_exit = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void log_flush_cb(
|
||||||
|
void* arg)
|
||||||
|
{
|
||||||
|
ssize_t timeout_ms = *(ssize_t *)arg;
|
||||||
|
|
||||||
|
skygw_log_write(LOGFILE_MESSAGE, "Started MaxScale log flusher.");
|
||||||
|
while (!do_exit) {
|
||||||
|
skygw_log_flush(LOGFILE_ERROR);
|
||||||
|
skygw_log_flush(LOGFILE_MESSAGE);
|
||||||
|
skygw_log_flush(LOGFILE_TRACE);
|
||||||
|
usleep(timeout_ms*1000);
|
||||||
|
}
|
||||||
|
skygw_log_write(LOGFILE_MESSAGE, "Finished MaxScale log flusher.");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -368,7 +368,9 @@ static int gw_create_backend_connection(DCB *backend, SERVER *server, SESSION *s
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, ">>> Backend [%s:%i] added [%i], in the client session [%i]\n", server->name, server->port, backend->fd, session->client->fd);
|
if (backend->fd > 0) {
|
||||||
|
fprintf(stderr, ">>> Backend [%s:%i] added [%i], in the client session [%i]\n", server->name, server->port, backend->fd, session->client->fd);
|
||||||
|
}
|
||||||
|
|
||||||
backend->state = DCB_STATE_POLLING;
|
backend->state = DCB_STATE_POLLING;
|
||||||
|
|
||||||
|
|||||||
@ -263,6 +263,14 @@ int i;
|
|||||||
&& (inst->servers[i]->server->status & inst->bitmask) == inst->bitvalue)
|
&& (inst->servers[i]->server->status & inst->bitmask) == inst->bitvalue)
|
||||||
{
|
{
|
||||||
candidate = inst->servers[i];
|
candidate = inst->servers[i];
|
||||||
|
#if defined(SS_DEBUG)
|
||||||
|
skygw_log_write(
|
||||||
|
LOGFILE_TRACE,
|
||||||
|
"Selected server in port %d to as candidate. "
|
||||||
|
"Connections : %d\n",
|
||||||
|
candidate->server->port,
|
||||||
|
candidate->count);
|
||||||
|
#endif /* SS_DEBUG */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -281,18 +289,28 @@ int i;
|
|||||||
*/
|
*/
|
||||||
for (i = 1; inst->servers[i]; i++)
|
for (i = 1; inst->servers[i]; i++)
|
||||||
{
|
{
|
||||||
|
#if defined(SS_DEBUG)
|
||||||
|
skygw_log_write(
|
||||||
|
LOGFILE_TRACE,
|
||||||
|
"Examine server in port %d with %d connections. Status is %d, "
|
||||||
|
"inst->bitvalue is %d",
|
||||||
|
inst->servers[i]->server->port,
|
||||||
|
inst->servers[i]->count,
|
||||||
|
inst->servers[i]->server->status,
|
||||||
|
inst->bitmask);
|
||||||
|
#endif /* SS_DEBUG */
|
||||||
if (inst->servers[i] && SERVER_IS_RUNNING(inst->servers[i]->server)
|
if (inst->servers[i] && SERVER_IS_RUNNING(inst->servers[i]->server)
|
||||||
&& (inst->servers[i]->server->status & inst->bitmask) == inst->bitvalue)
|
&& (inst->servers[i]->server->status & inst->bitmask) == inst->bitvalue)
|
||||||
{
|
{
|
||||||
if (inst->servers[i]->count < candidate->count)
|
if (inst->servers[i]->count < candidate->count)
|
||||||
{
|
{
|
||||||
candidate = inst->servers[i];
|
candidate = inst->servers[i];
|
||||||
}
|
}
|
||||||
else if (inst->servers[i]->count == candidate->count &&
|
else if (inst->servers[i]->count == candidate->count &&
|
||||||
inst->servers[i]->server->stats.n_connections
|
inst->servers[i]->server->stats.n_connections
|
||||||
< candidate->server->stats.n_connections)
|
< candidate->server->stats.n_connections)
|
||||||
{
|
{
|
||||||
candidate = inst->servers[i];
|
candidate = inst->servers[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -310,8 +328,15 @@ int i;
|
|||||||
atomic_add(&candidate->count, 1);
|
atomic_add(&candidate->count, 1);
|
||||||
|
|
||||||
client->backend = candidate;
|
client->backend = candidate;
|
||||||
|
#if defined(SS_DEBUG)
|
||||||
/*
|
skygw_log_write(
|
||||||
|
LOGFILE_TRACE,
|
||||||
|
"Final selection is server in port %d. "
|
||||||
|
"Connections : %d\n",
|
||||||
|
candidate->server->port,
|
||||||
|
candidate->count);
|
||||||
|
#endif /* SS_DEBUG */
|
||||||
|
/*
|
||||||
* Open a backend connection, putting the DCB for this
|
* Open a backend connection, putting the DCB for this
|
||||||
* connection in the client->dcb
|
* connection in the client->dcb
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user