merge from develop

merge from develop
This commit is contained in:
MassimilianoPinto
2015-03-04 17:02:04 +01:00
38 changed files with 4445 additions and 42 deletions

View File

@ -1,5 +1,5 @@
#ifndef _CONFIG_H
#define _CONFIG_H
#ifndef _MAXSCALE_CONFIG_H
#define _MAXSCALE_CONFIG_H
/*
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the

View File

@ -271,6 +271,18 @@ typedef struct dcb {
#endif
} DCB;
/**
* The DCB usage filer used for returning DCB's in use for a certain reason
*/
typedef enum {
DCB_USAGE_CLIENT,
DCB_USAGE_LISTENER,
DCB_USAGE_BACKEND,
DCB_USAGE_INTERNAL,
DCB_USAGE_ZOMBIE,
DCB_USAGE_ALL
} DCB_USAGE;
#if defined(FAKE_CODE)
unsigned char dcb_fake_write_errno[10240];
__int32_t dcb_fake_write_ev[10240];
@ -319,6 +331,7 @@ int dcb_add_callback(DCB *, DCB_REASON, int (*)(struct dcb *, DCB_REASON, void
int dcb_remove_callback(DCB *, DCB_REASON, int (*)(struct dcb *, DCB_REASON, void *),
void *);
int dcb_isvalid(DCB *); /* Check the DCB is in the linked list */
int dcb_count_by_usage(DCB_USAGE); /* Return counts of DCBs */
bool dcb_set_state(DCB* dcb, dcb_state_t new_state, dcb_state_t* old_state);
void dcb_call_foreach (struct server* server, DCB_REASON reason);

View File

@ -19,6 +19,7 @@
*/
#include <dcb.h>
#include <modinfo.h>
#include <resultset.h>
/**
* @file modules.h Utilities for loading modules
@ -34,6 +35,7 @@
* 29/05/14 Mark Riddoch Addition of filter modules
* 01/10/14 Mark Riddoch Addition of call to unload all modules on
* shutdown
* 19/02/15 Mark Riddoch Addition of moduleGetList
* 26/02/15 Massimiliano Pinto Addition of module_feedback_send
*
* @endverbatim
@ -65,7 +67,8 @@ extern void unload_module(const char *module);
extern void unload_all_modules();
extern void printModules();
extern void dprintAllModules(DCB *);
char* get_maxscale_home(void);
extern RESULTSET *moduleGetList();
extern char *get_maxscale_home(void);
extern void module_feedback_send(void*);
#endif

View File

@ -41,6 +41,7 @@
#define PTR_IS_LOCAL_INFILE(b) (b[4] == 0xfb)
extern int modutil_is_SQL(GWBUF *);
extern int modutil_is_SQL_prepare(GWBUF *);
extern int modutil_extract_SQL(GWBUF *, char **, int *);
extern int modutil_MySQL_Query(GWBUF *, char **, int *, int *);
extern char *modutil_get_SQL(GWBUF *);

View File

@ -19,6 +19,7 @@
*/
#include <server.h>
#include <dcb.h>
#include <resultset.h>
/**
* @file monitor.h The interface to the monitor module
@ -35,6 +36,7 @@
* 28/08/14 Massimiliano Pinto Addition of detectStaleMaster
* 30/10/14 Massimiliano Pinto Addition of disableMasterFailback
* 07/11/14 Massimiliano Pinto Addition of setNetworkTimeout
* 19/02/15 Mark Riddoch Addition of monitorGetList
*
* @endverbatim
*/
@ -143,4 +145,5 @@ extern void monitorSetReplicationHeartbeat(MONITOR *, int);
extern void monitorDetectStaleMaster(MONITOR *, int);
extern void monitorDisableMasterFailback(MONITOR *, int);
extern void monitorSetNetworkTimeout(MONITOR *, int, int);
extern RESULTSET *monitorGetList();
#endif

View File

@ -19,6 +19,7 @@
*/
#include <dcb.h>
#include <gwbitmask.h>
#include <resultset.h>
/**
* @file poll.h The poll related functionality
@ -33,6 +34,22 @@
*/
#define MAX_EVENTS 1000
/**
* A statistic identifier that can be returned by poll_get_stat
*/
typedef enum {
POLL_STAT_READ,
POLL_STAT_WRITE,
POLL_STAT_ERROR,
POLL_STAT_HANGUP,
POLL_STAT_ACCEPT,
POLL_STAT_EVQ_LEN,
POLL_STAT_EVQ_PENDING,
POLL_STAT_EVQ_MAX,
POLL_STAT_MAX_QTIME,
POLL_STAT_MAX_EXECTIME
} POLL_STAT;
extern void poll_init();
extern int poll_add_dcb(DCB *);
extern int poll_remove_dcb(DCB *);
@ -46,4 +63,6 @@ extern void dShowThreads(DCB *dcb);
void poll_add_epollin_event_to_dcb(DCB* dcb, GWBUF* buf);
extern void dShowEventQ(DCB *dcb);
extern void dShowEventStats(DCB *dcb);
extern int poll_get_stat(POLL_STAT stat);
extern RESULTSET *eventTimesGetList();
#endif

View File

@ -0,0 +1,88 @@
#ifndef _RESULTSET_H
#define _RESULTSET_H
/*
* This file is distributed as part of the MariaDB Corporation MaxScale. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright MariaDB Corporation Ab 2013-2014
*/
/**
* @file resultset.h The MaxScale generic result set mechanism
*
* @verbatim
* Revision History
*
* Date Who Description
* 17/02/15 Mark Riddoch Initial implementation
*
* @endverbatim
*/
#include <dcb.h>
/**
* Column types
*/
typedef enum {
COL_TYPE_VARCHAR = 0x0f,
COL_TYPE_VARSTRING = 0xfd
} RESULT_COL_TYPE;
/**
* The result set column definition. Each result set has an order linked
* list of column definitions.
*/
typedef struct resultcolumn {
char *name; /*< Column name */
int len; /*< Column length */
RESULT_COL_TYPE type; /*< Column type */
struct resultcolumn *next; /*< next column */
} RESULT_COLUMN;
/**
* A representation of a row within a result set.
*/
typedef struct resultrow {
int n_cols; /*< No. of columns in row */
char **cols; /*< The columns themselves */
} RESULT_ROW;
struct resultset;
/**
* Type of callback function used to supply each row
*/
typedef RESULT_ROW * (*RESULT_ROW_CB)(struct resultset *, void *);
/**
* The representation of the result set itself.
*/
typedef struct resultset {
int n_cols; /*< No. of columns */
RESULT_COLUMN *column; /*< Linked list of column definitions */
RESULT_ROW_CB fetchrow; /*< Fetch a row for the result set */
void *userdata; /*< User data for the fetch row call */
} RESULTSET;
extern RESULTSET *resultset_create(RESULT_ROW_CB, void *);
extern void resultset_free(RESULTSET *);
extern int resultset_add_column(RESULTSET *, char *, int, RESULT_COL_TYPE);
extern void resultset_column_free(RESULT_COLUMN *);
extern RESULT_ROW *resultset_make_row(RESULTSET *);
extern void resultset_free_row(RESULT_ROW *);
extern int resultset_row_set(RESULT_ROW *, int, char *);
extern void resultset_stream_mysql(RESULTSET *, DCB *);
extern void resultset_stream_json(RESULTSET *, DCB *);
#endif

View File

@ -18,6 +18,7 @@
* Copyright MariaDB Corporation Ab 2013-2014
*/
#include <dcb.h>
#include <resultset.h>
/**
* @file service.h
@ -41,6 +42,7 @@
* 30/07/14 Massimiliano Pinto Addition of NDB status for MySQL Cluster
* 30/08/14 Massimiliano Pinto Addition of SERVER_STALE_STATUS
* 27/10/14 Massimiliano Pinto Addition of SERVER_MASTER_STICKINESS
* 19/02/15 Mark Riddoch Addition of serverGetList
*
* @endverbatim
*/
@ -187,4 +189,5 @@ extern void serverAddParameter(SERVER *, char *, char *);
extern char *serverGetParameter(SERVER *, char *);
extern void server_update(SERVER *, char *, char *, char *);
extern void server_set_unique_name(SERVER *, char *);
extern RESULTSET *serverGetList();
#endif

View File

@ -24,6 +24,7 @@
#include <server.h>
#include <filter.h>
#include <hashtable.h>
#include <resultset.h>
#include "config.h"
/**
@ -195,4 +196,7 @@ extern void dListServices(DCB *);
extern void dListListeners(DCB *);
char* service_get_name(SERVICE* svc);
void service_shutdown();
extern int serviceSessionCountAll();
extern RESULTSET *serviceGetList();
extern RESULTSET *serviceGetListenerList();
#endif

View File

@ -41,6 +41,7 @@
#include <atomic.h>
#include <buffer.h>
#include <spinlock.h>
#include <resultset.h>
#include <skygw_utils.h>
#include <log_manager.h>
@ -100,6 +101,14 @@ typedef struct {
void *session;
} SESSION_FILTER;
/**
* Filter type for the sessionGetList call
*/
typedef enum {
SESSION_LIST_ALL,
SESSION_LIST_CONNECTION
} SESSIONLISTFILTER;
/**
* The session status block
*
@ -169,5 +178,6 @@ SESSION* get_session_by_router_ses(void* rses);
void session_enable_log(SESSION* ses, logfile_id_t id);
void session_disable_log(SESSION* ses, logfile_id_t id);
void session_close_timeouts(void* data);
RESULTSET *sessionGetList(SESSIONLISTFILTER);
#endif