Added function documentation, moved one non-error log entry to message log, cleaned up a bit.
This commit is contained in:
@ -455,23 +455,14 @@ return_succp:
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @node Initializes log managing routines in MariaDB Corporation MaxScale.
|
* Initializes log managing routines in MariaDB Corporation MaxScale.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* @param p_ctx - in, give
|
* @param argc number of arguments in argv array
|
||||||
* pointer to memory location where logmanager stores private write
|
|
||||||
* buffer.
|
|
||||||
*
|
*
|
||||||
* @param argc - in, use
|
* @param argv arguments array
|
||||||
* number of arguments in argv array
|
|
||||||
*
|
*
|
||||||
* @param argv - in, use
|
* @return true if succeed, otherwise false
|
||||||
* arguments array
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @details (write detailed description here)
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool skygw_logmanager_init(
|
bool skygw_logmanager_init(
|
||||||
@ -495,7 +486,12 @@ return_succp:
|
|||||||
return succp;
|
return succp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release resources of log manager.
|
||||||
|
*
|
||||||
|
* Lock must have been acquired before calling
|
||||||
|
* this function.
|
||||||
|
*/
|
||||||
static void logmanager_done_nomutex(void)
|
static void logmanager_done_nomutex(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -540,17 +536,7 @@ static void logmanager_done_nomutex(void)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @node This function is provided for atexit() system function.
|
* This function is provided for atexit() system function.
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* @param void - <usage>
|
|
||||||
* <description>
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @details (write detailed description here)
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
void skygw_logmanager_exit(void)
|
void skygw_logmanager_exit(void)
|
||||||
{
|
{
|
||||||
@ -558,20 +544,9 @@ void skygw_logmanager_exit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @node End execution of log manager
|
* End execution of log manager
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Stops file writing thread, releases filewriter, and logfiles.
|
||||||
* @param p_ctx - in, take
|
|
||||||
* pointer to memory location including context pointer. Context will
|
|
||||||
* be freed in this function.
|
|
||||||
*
|
|
||||||
* @param logmanager - in, use
|
|
||||||
* pointer to logmanager.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @details Stops file writing thread, releases filewriter, and logfiles.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void skygw_logmanager_done(void)
|
void skygw_logmanager_done(void)
|
||||||
@ -623,38 +598,25 @@ static logfile_t* logmanager_get_logfile(
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @node Finds write position from block buffer for log string and writes there.
|
* Finds write position from block buffer for log string and writes there.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
*
|
*
|
||||||
* @param id - in, use
|
* @param id logfile object identifier
|
||||||
* logfile object identifier
|
* @param flush indicates whether log string must be written to disk
|
||||||
|
* immediately
|
||||||
|
* @param use_valist does write involve formatting of the string and use of
|
||||||
|
* valist argument
|
||||||
|
* @param spread_down if true, log string is spread to all logs having
|
||||||
|
* larger id.
|
||||||
|
* @param rotate if set, closes currently open log file and opens a
|
||||||
|
* new one
|
||||||
|
* @param str_len length of formatted string
|
||||||
|
* @param str string to be written to log
|
||||||
|
* @param valist variable-length argument list for formatting the string
|
||||||
*
|
*
|
||||||
* @param flush - in, use
|
* @return 0 if succeed, -1 otherwise
|
||||||
* indicates whether log string must be written to disk immediately
|
|
||||||
*
|
|
||||||
* @param use_valist - in, use
|
|
||||||
* does write involve formatting of the string and use of valist argument
|
|
||||||
*
|
|
||||||
* @param spread_down - in, use
|
|
||||||
* if true, log string is spread to all logs having larger id.
|
|
||||||
*
|
*
|
||||||
* @param rotate if set, closes currently open log file and opens a new one
|
|
||||||
*
|
|
||||||
* @param str_len - in, use
|
|
||||||
* length of formatted string
|
|
||||||
*
|
|
||||||
* @param str - in, use
|
|
||||||
* string to be written to log
|
|
||||||
*
|
|
||||||
* @param valist - in, use
|
|
||||||
* variable-length argument list for formatting the string
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @details (write detailed description here)
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static int logmanager_write_log(
|
static int logmanager_write_log(
|
||||||
logfile_id_t id,
|
logfile_id_t id,
|
||||||
@ -905,6 +867,12 @@ return_err:
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register writer to a block buffer. When reference counter is non-zero the
|
||||||
|
* flusher thread doesn't write the block to disk.
|
||||||
|
*
|
||||||
|
* @param bb block buffer
|
||||||
|
*/
|
||||||
static void blockbuf_register(
|
static void blockbuf_register(
|
||||||
blockbuf_t* bb)
|
blockbuf_t* bb)
|
||||||
{
|
{
|
||||||
@ -913,7 +881,12 @@ static void blockbuf_register(
|
|||||||
atomic_add(&bb->bb_refcount, 1);
|
atomic_add(&bb->bb_refcount, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unregister writer from block buffer. If the buffer got filled up and there
|
||||||
|
* are no other registered writers anymore, notify the flusher thread.
|
||||||
|
*
|
||||||
|
* @param bb block buffer
|
||||||
|
*/
|
||||||
static void blockbuf_unregister(
|
static void blockbuf_unregister(
|
||||||
blockbuf_t* bb)
|
blockbuf_t* bb)
|
||||||
{
|
{
|
||||||
|
@ -198,7 +198,12 @@ HASHENTRIES *entry, *ptr;
|
|||||||
* @param vfreefn The free function for the value
|
* @param vfreefn The free function for the value
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
hashtable_memory_fns(HASHTABLE *table, HASHMEMORYFN kcopyfn, HASHMEMORYFN vcopyfn, HASHMEMORYFN kfreefn, HASHMEMORYFN vfreefn)
|
hashtable_memory_fns(
|
||||||
|
HASHTABLE *table,
|
||||||
|
HASHMEMORYFN kcopyfn,
|
||||||
|
HASHMEMORYFN vcopyfn,
|
||||||
|
HASHMEMORYFN kfreefn,
|
||||||
|
HASHMEMORYFN vfreefn)
|
||||||
{
|
{
|
||||||
if (kcopyfn != NULL)
|
if (kcopyfn != NULL)
|
||||||
table->kcopyfn = kcopyfn;
|
table->kcopyfn = kcopyfn;
|
||||||
|
@ -762,8 +762,8 @@ int log_no_master = 1;
|
|||||||
if (root_master && mon_status_changed(root_master) && !(root_master->server->status & SERVER_STALE_STATUS)) {
|
if (root_master && mon_status_changed(root_master) && !(root_master->server->status & SERVER_STALE_STATUS)) {
|
||||||
if (root_master->pending_status & (SERVER_MASTER)) {
|
if (root_master->pending_status & (SERVER_MASTER)) {
|
||||||
if (!(root_master->mon_prev_status & SERVER_STALE_STATUS) && !(root_master->server->status & SERVER_MAINT)) {
|
if (!(root_master->mon_prev_status & SERVER_STALE_STATUS) && !(root_master->server->status & SERVER_MAINT)) {
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LM, (skygw_log_write(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_MESSAGE,
|
||||||
"Info: A Master Server is now available: %s:%i",
|
"Info: A Master Server is now available: %s:%i",
|
||||||
root_master->server->name,
|
root_master->server->name,
|
||||||
root_master->server->port)));
|
root_master->server->port)));
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
* Date Who Description
|
* Date Who Description
|
||||||
* 14/06/2013 Mark Riddoch Initial version
|
* 14/06/2013 Mark Riddoch Initial version
|
||||||
* 17/06/2013 Massimiliano Pinto Added MaxScale To Backends routines
|
* 17/06/2013 Massimiliano Pinto Added MaxScale To Backends routines
|
||||||
* 27/06/2013 Vilho Raatikka Added skygw_log_write command as an example
|
|
||||||
* and necessary headers.
|
|
||||||
* 01/07/2013 Massimiliano Pinto Put Log Manager example code behind SS_DEBUG macros.
|
* 01/07/2013 Massimiliano Pinto Put Log Manager example code behind SS_DEBUG macros.
|
||||||
* 03/07/2013 Massimiliano Pinto Added delayq for incoming data before mysql connection
|
* 03/07/2013 Massimiliano Pinto Added delayq for incoming data before mysql connection
|
||||||
* 04/07/2013 Massimiliano Pinto Added asyncrhronous MySQL protocol connection to backend
|
* 04/07/2013 Massimiliano Pinto Added asyncrhronous MySQL protocol connection to backend
|
||||||
|
@ -682,7 +682,8 @@ int gw_read_client_event(
|
|||||||
int message_len = 25 + MYSQL_DATABASE_MAXLEN;
|
int message_len = 25 + MYSQL_DATABASE_MAXLEN;
|
||||||
|
|
||||||
fail_str = calloc(1, message_len+1);
|
fail_str = calloc(1, message_len+1);
|
||||||
snprintf(fail_str, message_len, "Unknown database '%s'", (char*)((MYSQL_session *)dcb->data)->db);
|
snprintf(fail_str, message_len, "Unknown database '%s'",
|
||||||
|
(char*)((MYSQL_session *)dcb->data)->db);
|
||||||
|
|
||||||
modutil_send_mysql_err_packet(dcb, 2, 0, 1049, "42000", fail_str);
|
modutil_send_mysql_err_packet(dcb, 2, 0, 1049, "42000", fail_str);
|
||||||
} else {
|
} else {
|
||||||
|
@ -313,8 +313,8 @@ static int hashkeyfun(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int hashcmpfun(
|
static int hashcmpfun(
|
||||||
void* v1,
|
void* v1,
|
||||||
void* v2)
|
void* v2)
|
||||||
{
|
{
|
||||||
char* i1 = (char*) v1;
|
char* i1 = (char*) v1;
|
||||||
char* i2 = (char*) v2;
|
char* i2 = (char*) v2;
|
||||||
@ -374,6 +374,15 @@ ROUTER_OBJECT* GetModuleObject()
|
|||||||
return &MyObject;
|
return &MyObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refresh the instance by hte given parameter value.
|
||||||
|
*
|
||||||
|
* @param router Router instance
|
||||||
|
* @param singleparam Parameter fo be reloaded
|
||||||
|
*
|
||||||
|
* Note: this part is not done. Needs refactoring.
|
||||||
|
*/
|
||||||
static void refreshInstance(
|
static void refreshInstance(
|
||||||
ROUTER_INSTANCE* router,
|
ROUTER_INSTANCE* router,
|
||||||
CONFIG_PARAMETER* singleparam)
|
CONFIG_PARAMETER* singleparam)
|
||||||
@ -987,6 +996,14 @@ static void closeSession(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When router session is closed, freeSession can be called to free allocated
|
||||||
|
* resources.
|
||||||
|
*
|
||||||
|
* @param router_instance The router instance the session belongs to
|
||||||
|
* @param router_client_session Client session
|
||||||
|
*
|
||||||
|
*/
|
||||||
static void freeSession(
|
static void freeSession(
|
||||||
ROUTER* router_instance,
|
ROUTER* router_instance,
|
||||||
void* router_client_session)
|
void* router_client_session)
|
||||||
@ -1645,10 +1662,10 @@ skygw_query_type_t is_read_tmp_table(
|
|||||||
* @param type The type of the query resolved so far
|
* @param type The type of the query resolved so far
|
||||||
*/
|
*/
|
||||||
void check_create_tmp_table(
|
void check_create_tmp_table(
|
||||||
ROUTER* instance,
|
ROUTER* instance,
|
||||||
void* router_session,
|
void* router_session,
|
||||||
GWBUF* querybuf,
|
GWBUF* querybuf,
|
||||||
skygw_query_type_t type)
|
skygw_query_type_t type)
|
||||||
{
|
{
|
||||||
|
|
||||||
int klen = 0;
|
int klen = 0;
|
||||||
|
Reference in New Issue
Block a user