logger.c do NOT call fsync after write
parent
876a08d370
commit
31db77f3cd
3
HISTORY
3
HISTORY
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
Version 1.06 2014-06-27
|
Version 1.06 2014-07-02
|
||||||
* update source code from FastDFS V5.02
|
* update source code from FastDFS V5.02
|
||||||
* add function short2buff and buff2short
|
* add function short2buff and buff2short
|
||||||
* add object memory pool (fast_mblock.h and fast_mblock.c)
|
* add object memory pool (fast_mblock.h and fast_mblock.c)
|
||||||
|
|
@ -14,6 +14,7 @@ Version 1.06 2014-06-27
|
||||||
* add libfastcommon.spec for building RPM
|
* add libfastcommon.spec for building RPM
|
||||||
* logger can delete old rotated files
|
* logger can delete old rotated files
|
||||||
* bug fixed: connection pool should NOT increase counter when connect fail
|
* bug fixed: connection pool should NOT increase counter when connect fail
|
||||||
|
* logger.c do NOT call fsync after write
|
||||||
|
|
||||||
Version 1.05 2012-07-08
|
Version 1.05 2012-07-08
|
||||||
* update source code from FastDFS V3.09
|
* update source code from FastDFS V3.09
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "fast_mblock.h"
|
#include "fast_mblock.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "shared_func.h"
|
#include "shared_func.h"
|
||||||
|
|
@ -21,7 +22,7 @@ int fast_mblock_init(struct fast_mblock_man *mblock, const int element_size, \
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mblock->element_size = element_size;
|
mblock->element_size = MEM_ALIGN(element_size);
|
||||||
if (alloc_elements_once > 0)
|
if (alloc_elements_once > 0)
|
||||||
{
|
{
|
||||||
mblock->alloc_elements_once = alloc_elements_once;
|
mblock->alloc_elements_once = alloc_elements_once;
|
||||||
|
|
@ -30,7 +31,7 @@ int fast_mblock_init(struct fast_mblock_man *mblock, const int element_size, \
|
||||||
{
|
{
|
||||||
int block_size;
|
int block_size;
|
||||||
block_size = MEM_ALIGN(sizeof(struct fast_mblock_node) \
|
block_size = MEM_ALIGN(sizeof(struct fast_mblock_node) \
|
||||||
+ element_size);
|
+ mblock->element_size);
|
||||||
mblock->alloc_elements_once = (1024 * 1024) / block_size;
|
mblock->alloc_elements_once = (1024 * 1024) / block_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,7 +86,6 @@ static int fast_mblock_prealloc(struct fast_mblock_man *mblock)
|
||||||
pNode = (struct fast_mblock_node *)p;
|
pNode = (struct fast_mblock_node *)p;
|
||||||
pNode->next = (struct fast_mblock_node *)(p + block_size);
|
pNode->next = (struct fast_mblock_node *)(p + block_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
((struct fast_mblock_node *)pLast)->next = NULL;
|
((struct fast_mblock_node *)pLast)->next = NULL;
|
||||||
mblock->free_chain_head = (struct fast_mblock_node *)pTrunkStart;
|
mblock->free_chain_head = (struct fast_mblock_node *)pTrunkStart;
|
||||||
|
|
||||||
|
|
@ -116,6 +116,7 @@ void fast_mblock_destroy(struct fast_mblock_man *mblock)
|
||||||
}
|
}
|
||||||
mblock->malloc_chain_head = NULL;
|
mblock->malloc_chain_head = NULL;
|
||||||
mblock->free_chain_head = NULL;
|
mblock->free_chain_head = NULL;
|
||||||
|
mblock->total_count = 0;
|
||||||
|
|
||||||
pthread_mutex_destroy(&(mblock->lock));
|
pthread_mutex_destroy(&(mblock->lock));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -391,6 +391,7 @@ static int log_fsync(LogContext *pContext, const bool bNeedLock)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (pContext->log_fd != STDERR_FILENO)
|
if (pContext->log_fd != STDERR_FILENO)
|
||||||
{
|
{
|
||||||
if (fsync(pContext->log_fd) != 0)
|
if (fsync(pContext->log_fd) != 0)
|
||||||
|
|
@ -402,6 +403,7 @@ static int log_fsync(LogContext *pContext, const bool bNeedLock)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (pContext->rotate_immediately)
|
if (pContext->rotate_immediately)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue