Added function documentation, moved one non-error log entry to message log, cleaned up a bit.

This commit is contained in:
VilhoRaatikka
2014-12-08 16:02:16 +02:00
parent b1eaaea961
commit 5264a1abc9
6 changed files with 73 additions and 79 deletions

View File

@ -455,23 +455,14 @@ return_succp:
/**
* @node Initializes log managing routines in MariaDB Corporation MaxScale.
* Initializes log managing routines in MariaDB Corporation MaxScale.
*
* Parameters:
* @param p_ctx - in, give
* pointer to memory location where logmanager stores private write
* buffer.
* @param argc number of arguments in argv array
*
* @param argc - in, use
* number of arguments in argv array
* @param argv arguments array
*
* @param argv - in, use
* arguments array
*
* @return
*
*
* @details (write detailed description here)
* @return true if succeed, otherwise false
*
*/
bool skygw_logmanager_init(
@ -495,7 +486,12 @@ return_succp:
return succp;
}
/**
* Release resources of log manager.
*
* Lock must have been acquired before calling
* this function.
*/
static void logmanager_done_nomutex(void)
{
int i;
@ -540,17 +536,7 @@ static void logmanager_done_nomutex(void)
/**
* @node This function is provided for atexit() system function.
*
* Parameters:
* @param void - <usage>
* <description>
*
* @return void
*
*
* @details (write detailed description here)
*
* This function is provided for atexit() system function.
*/
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:
* @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.
* Stops file writing thread, releases filewriter, and logfiles.
*
*/
void skygw_logmanager_done(void)
@ -623,37 +598,24 @@ 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:
*
* @param id - in, use
* logfile object identifier
* @param id 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
* 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)
* @return 0 if succeed, -1 otherwise
*
*/
static int logmanager_write_log(
@ -905,6 +867,12 @@ 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(
blockbuf_t* bb)
{
@ -913,7 +881,12 @@ static void blockbuf_register(
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(
blockbuf_t* bb)
{

View File

@ -198,7 +198,12 @@ HASHENTRIES *entry, *ptr;
* @param vfreefn The free function for the value
*/
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)
table->kcopyfn = kcopyfn;

View File

@ -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->pending_status & (SERVER_MASTER)) {
if (!(root_master->mon_prev_status & SERVER_STALE_STATUS) && !(root_master->server->status & SERVER_MAINT)) {
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
LOGIF(LM, (skygw_log_write(
LOGFILE_MESSAGE,
"Info: A Master Server is now available: %s:%i",
root_master->server->name,
root_master->server->port)));

View File

@ -30,8 +30,6 @@
* Date Who Description
* 14/06/2013 Mark Riddoch Initial version
* 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.
* 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

View File

@ -682,7 +682,8 @@ int gw_read_client_event(
int message_len = 25 + MYSQL_DATABASE_MAXLEN;
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);
} else {

View File

@ -374,6 +374,15 @@ ROUTER_OBJECT* GetModuleObject()
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(
ROUTER_INSTANCE* router,
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(
ROUTER* router_instance,
void* router_client_session)