chore: remove asserts of mempool
This commit is contained in:
parent
b58620cedf
commit
1509df2e91
|
@ -505,7 +505,7 @@ pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('linux test') {
|
stage('linux test') {
|
||||||
agent{label "slave1_47 || slave1_48 || slave1_49 || slave1_50 || slave1_52 || slave1_59 || slave1_63"}
|
agent{label "slave1_47 || slave1_48 || slave1_49 || slave1_50 || slave1_52 || slave1_59 || slave1_63 || worker03 || slave215 || slave217 || slave219 "}
|
||||||
options { skipDefaultCheckout() }
|
options { skipDefaultCheckout() }
|
||||||
when {
|
when {
|
||||||
changeRequest()
|
changeRequest()
|
||||||
|
|
|
@ -21,9 +21,9 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "tlockfree.h"
|
|
||||||
#include "thash.h"
|
|
||||||
#include "tglobal.h"
|
#include "tglobal.h"
|
||||||
|
#include "thash.h"
|
||||||
|
#include "tlockfree.h"
|
||||||
|
|
||||||
#define MP_CHUNK_CACHE_ALLOC_BATCH_SIZE 1000
|
#define MP_CHUNK_CACHE_ALLOC_BATCH_SIZE 1000
|
||||||
#define MP_NSCHUNK_CACHE_ALLOC_BATCH_SIZE 500
|
#define MP_NSCHUNK_CACHE_ALLOC_BATCH_SIZE 500
|
||||||
|
@ -36,7 +36,6 @@ extern "C" {
|
||||||
#define MP_MIN_MEM_CHK_INTERVAL_MS 1
|
#define MP_MIN_MEM_CHK_INTERVAL_MS 1
|
||||||
#define MP_MEMORY_TRIM_INTERVAL_TIMES 500
|
#define MP_MEMORY_TRIM_INTERVAL_TIMES 500
|
||||||
|
|
||||||
|
|
||||||
#define MP_RETIRE_HIGH_THRESHOLD_PERCENT (0.95)
|
#define MP_RETIRE_HIGH_THRESHOLD_PERCENT (0.95)
|
||||||
#define MP_RETIRE_MID_THRESHOLD_PERCENT (0.9)
|
#define MP_RETIRE_MID_THRESHOLD_PERCENT (0.9)
|
||||||
#define MP_RETIRE_LOW_THRESHOLD_PERCENT (0.85)
|
#define MP_RETIRE_LOW_THRESHOLD_PERCENT (0.85)
|
||||||
|
@ -48,12 +47,10 @@ extern "C" {
|
||||||
#define MP_MIN_FREE_SIZE_AFTER_RESERVE (4 * 1024 * 1048576L)
|
#define MP_MIN_FREE_SIZE_AFTER_RESERVE (4 * 1024 * 1048576L)
|
||||||
#define MP_MIN_MEM_POOL_SIZE (5 * 1024 * 1048576L)
|
#define MP_MIN_MEM_POOL_SIZE (5 * 1024 * 1048576L)
|
||||||
|
|
||||||
|
|
||||||
// FLAGS AREA
|
// FLAGS AREA
|
||||||
#define MP_CHUNK_FLAG_IN_USE (1 << 0)
|
#define MP_CHUNK_FLAG_IN_USE (1 << 0)
|
||||||
#define MP_CHUNK_FLAG_NS_CHUNK (1 << 1)
|
#define MP_CHUNK_FLAG_NS_CHUNK (1 << 1)
|
||||||
|
|
||||||
|
|
||||||
// STAT FLAGS
|
// STAT FLAGS
|
||||||
#define MP_LOG_FLAG_ALL_MEM (1 << 0)
|
#define MP_LOG_FLAG_ALL_MEM (1 << 0)
|
||||||
#define MP_LOG_FLAG_ALL_CHUNK (1 << 1)
|
#define MP_LOG_FLAG_ALL_CHUNK (1 << 1)
|
||||||
|
@ -69,7 +66,6 @@ extern "C" {
|
||||||
|
|
||||||
#define MP_STAT_FLAG_LOG_ALL (0xFFFFFFFFFFFFFFFF)
|
#define MP_STAT_FLAG_LOG_ALL (0xFFFFFFFFFFFFFFFF)
|
||||||
|
|
||||||
|
|
||||||
// STAT PROCESURE FLAGS
|
// STAT PROCESURE FLAGS
|
||||||
#define MP_STAT_PROC_FLAG_EXEC (1 << 0)
|
#define MP_STAT_PROC_FLAG_EXEC (1 << 0)
|
||||||
#define MP_STAT_PROC_FLAG_INPUT_ERR (1 << 1)
|
#define MP_STAT_PROC_FLAG_INPUT_ERR (1 << 1)
|
||||||
|
@ -82,7 +78,6 @@ extern "C" {
|
||||||
#define MP_CTRL_FLAG_LOCK_DBG (1 << 2)
|
#define MP_CTRL_FLAG_LOCK_DBG (1 << 2)
|
||||||
#define MP_CTRL_FLAG_LOG_MAXSIZE (1 << 3)
|
#define MP_CTRL_FLAG_LOG_MAXSIZE (1 << 3)
|
||||||
|
|
||||||
|
|
||||||
typedef enum EMPStatLogItem {
|
typedef enum EMPStatLogItem {
|
||||||
E_MP_STAT_LOG_MEM_MALLOC = 1,
|
E_MP_STAT_LOG_MEM_MALLOC = 1,
|
||||||
E_MP_STAT_LOG_MEM_CALLOC,
|
E_MP_STAT_LOG_MEM_CALLOC,
|
||||||
|
@ -102,8 +97,8 @@ typedef enum EMPStatLogItem {
|
||||||
#define MP_MEM_HEADER_FLAG_NS_CHUNK (1 << 0)
|
#define MP_MEM_HEADER_FLAG_NS_CHUNK (1 << 0)
|
||||||
|
|
||||||
typedef struct SMPMemHeader {
|
typedef struct SMPMemHeader {
|
||||||
uint64_t flags:24;
|
uint64_t flags : 24;
|
||||||
uint64_t size:40;
|
uint64_t size : 40;
|
||||||
} SMPMemHeader;
|
} SMPMemHeader;
|
||||||
|
|
||||||
typedef struct SMPMemTailer {
|
typedef struct SMPMemTailer {
|
||||||
|
@ -111,12 +106,12 @@ typedef struct SMPMemTailer {
|
||||||
} SMPMemTailer;
|
} SMPMemTailer;
|
||||||
|
|
||||||
typedef struct SMPListNode {
|
typedef struct SMPListNode {
|
||||||
void *pNext;
|
void* pNext;
|
||||||
} SMPListNode;
|
} SMPListNode;
|
||||||
|
|
||||||
typedef struct SMPChunk {
|
typedef struct SMPChunk {
|
||||||
SMPListNode list;
|
SMPListNode list;
|
||||||
char *pMemStart;
|
char* pMemStart;
|
||||||
int32_t flags;
|
int32_t flags;
|
||||||
/* KEEP ABOVE SAME WITH SMPNSChunk */
|
/* KEEP ABOVE SAME WITH SMPNSChunk */
|
||||||
|
|
||||||
|
@ -125,7 +120,7 @@ typedef struct SMPChunk {
|
||||||
|
|
||||||
typedef struct SMPNSChunk {
|
typedef struct SMPNSChunk {
|
||||||
SMPListNode list;
|
SMPListNode list;
|
||||||
char *pMemStart;
|
char* pMemStart;
|
||||||
int32_t flags;
|
int32_t flags;
|
||||||
/* KEEP ABOVE SAME WITH SMPChunk */
|
/* KEEP ABOVE SAME WITH SMPChunk */
|
||||||
|
|
||||||
|
@ -133,11 +128,10 @@ typedef struct SMPNSChunk {
|
||||||
uint64_t memBytes;
|
uint64_t memBytes;
|
||||||
} SMPNSChunk;
|
} SMPNSChunk;
|
||||||
|
|
||||||
|
|
||||||
typedef struct SMPCacheGroup {
|
typedef struct SMPCacheGroup {
|
||||||
int32_t nodesNum;
|
int32_t nodesNum;
|
||||||
int32_t idleOffset;
|
int32_t idleOffset;
|
||||||
void *pNodes;
|
void* pNodes;
|
||||||
void* pNext;
|
void* pNext;
|
||||||
} SMPCacheGroup;
|
} SMPCacheGroup;
|
||||||
|
|
||||||
|
@ -151,7 +145,6 @@ typedef struct SMPStatInput {
|
||||||
void* pOrigMem;
|
void* pOrigMem;
|
||||||
} SMPStatInput;
|
} SMPStatInput;
|
||||||
|
|
||||||
|
|
||||||
typedef struct SMPCtrlInfo {
|
typedef struct SMPCtrlInfo {
|
||||||
int64_t statFlags;
|
int64_t statFlags;
|
||||||
int64_t funcFlags;
|
int64_t funcFlags;
|
||||||
|
@ -166,7 +159,7 @@ typedef struct SMPStatSession {
|
||||||
typedef struct SMPAllocStat {
|
typedef struct SMPAllocStat {
|
||||||
int64_t allocTimes;
|
int64_t allocTimes;
|
||||||
int64_t allocBytes;
|
int64_t allocBytes;
|
||||||
//int64_t freeIDs[]; // TODO
|
// int64_t freeIDs[]; // TODO
|
||||||
} SMPAllocStat;
|
} SMPAllocStat;
|
||||||
|
|
||||||
typedef struct SMPFreeStat {
|
typedef struct SMPFreeStat {
|
||||||
|
@ -200,7 +193,6 @@ typedef struct SMPStatInfo {
|
||||||
SMPStatPos posStat;
|
SMPStatPos posStat;
|
||||||
} SMPStatInfo;
|
} SMPStatInfo;
|
||||||
|
|
||||||
|
|
||||||
typedef struct SMPJob {
|
typedef struct SMPJob {
|
||||||
SMemPoolJob job; // KEEP IT FIRST
|
SMemPoolJob job; // KEEP IT FIRST
|
||||||
SMPStatInfo stat;
|
SMPStatInfo stat;
|
||||||
|
@ -212,25 +204,25 @@ typedef struct SMPSessionChunk {
|
||||||
int64_t reUseChunkNum;
|
int64_t reUseChunkNum;
|
||||||
|
|
||||||
int32_t srcChunkNum;
|
int32_t srcChunkNum;
|
||||||
SMPChunk *srcChunkHead;
|
SMPChunk* srcChunkHead;
|
||||||
SMPChunk *srcChunkTail;
|
SMPChunk* srcChunkTail;
|
||||||
|
|
||||||
int32_t inUseChunkNum;
|
int32_t inUseChunkNum;
|
||||||
SMPChunk *inUseChunkHead;
|
SMPChunk* inUseChunkHead;
|
||||||
SMPChunk *inUseChunkTail;
|
SMPChunk* inUseChunkTail;
|
||||||
|
|
||||||
SMPNSChunk *inUseNSChunkHead;
|
SMPNSChunk* inUseNSChunkHead;
|
||||||
SMPNSChunk *inUseNSChunkTail;
|
SMPNSChunk* inUseNSChunkTail;
|
||||||
|
|
||||||
SMPChunk *reUseChunkHead;
|
SMPChunk* reUseChunkHead;
|
||||||
SMPChunk *reUseChunkTail;
|
SMPChunk* reUseChunkTail;
|
||||||
|
|
||||||
SMPNSChunk *reUseNSChunkHead;
|
SMPNSChunk* reUseNSChunkHead;
|
||||||
SMPNSChunk *reUseNSChunkTail;
|
SMPNSChunk* reUseNSChunkTail;
|
||||||
} SMPSessionChunk;
|
} SMPSessionChunk;
|
||||||
|
|
||||||
typedef struct SMPSession {
|
typedef struct SMPSession {
|
||||||
//SMPListNode list;
|
// SMPListNode list;
|
||||||
|
|
||||||
char* sessionId;
|
char* sessionId;
|
||||||
SMPJob* pJob;
|
SMPJob* pJob;
|
||||||
|
@ -238,7 +230,7 @@ typedef struct SMPSession {
|
||||||
int64_t allocMemSize;
|
int64_t allocMemSize;
|
||||||
int64_t maxAllocMemSize;
|
int64_t maxAllocMemSize;
|
||||||
|
|
||||||
//SMPSessionChunk chunk;
|
// SMPSessionChunk chunk;
|
||||||
|
|
||||||
SMPStatInfo stat;
|
SMPStatInfo stat;
|
||||||
} SMPSession;
|
} SMPSession;
|
||||||
|
@ -247,8 +239,8 @@ typedef struct SMPCacheGroupInfo {
|
||||||
int16_t nodeSize;
|
int16_t nodeSize;
|
||||||
int64_t allocNum;
|
int64_t allocNum;
|
||||||
int32_t groupNum;
|
int32_t groupNum;
|
||||||
SMPCacheGroup *pGrpHead;
|
SMPCacheGroup* pGrpHead;
|
||||||
void *pIdleList;
|
void* pIdleList;
|
||||||
} SMPCacheGroupInfo;
|
} SMPCacheGroupInfo;
|
||||||
|
|
||||||
typedef struct SMPChunkMgmt {
|
typedef struct SMPChunkMgmt {
|
||||||
|
@ -268,21 +260,20 @@ typedef struct SMPChunkMgmt {
|
||||||
int32_t readyChunkLowNum;
|
int32_t readyChunkLowNum;
|
||||||
int32_t readyChunkGotNum;
|
int32_t readyChunkGotNum;
|
||||||
SRWLatch readyChunkLock;
|
SRWLatch readyChunkLock;
|
||||||
SMPChunk *readyChunkHead;
|
SMPChunk* readyChunkHead;
|
||||||
SMPChunk *readyChunkTail;
|
SMPChunk* readyChunkTail;
|
||||||
|
|
||||||
int64_t readyNSChunkNum;
|
int64_t readyNSChunkNum;
|
||||||
SMPChunk *readyNSChunkHead;
|
SMPChunk* readyNSChunkHead;
|
||||||
SMPChunk *readyNSChunkTail;
|
SMPChunk* readyNSChunkTail;
|
||||||
} SMPChunkMgmt;
|
} SMPChunkMgmt;
|
||||||
|
|
||||||
|
|
||||||
typedef struct SMemPool {
|
typedef struct SMemPool {
|
||||||
char *name;
|
char* name;
|
||||||
int16_t slotId;
|
int16_t slotId;
|
||||||
SRWLatch cfgLock;
|
SRWLatch cfgLock;
|
||||||
SMemPoolCfg cfg;
|
SMemPoolCfg cfg;
|
||||||
//int64_t retireThreshold[3];
|
// int64_t retireThreshold[3];
|
||||||
int64_t retireUnit;
|
int64_t retireUnit;
|
||||||
|
|
||||||
int64_t maxAllocMemSize;
|
int64_t maxAllocMemSize;
|
||||||
|
@ -322,11 +313,10 @@ typedef struct SMemPoolMgmt {
|
||||||
|
|
||||||
extern SMemPoolMgmt gMPMgmt;
|
extern SMemPoolMgmt gMPMgmt;
|
||||||
|
|
||||||
|
|
||||||
typedef int32_t (*mpAllocFunc)(SMemPool*, SMPSession*, int64_t*, uint32_t, void**);
|
typedef int32_t (*mpAllocFunc)(SMemPool*, SMPSession*, int64_t*, uint32_t, void**);
|
||||||
typedef void (*mpFreeFunc)(SMemPool*, SMPSession*, void *, int64_t*);
|
typedef void (*mpFreeFunc)(SMemPool*, SMPSession*, void*, int64_t*);
|
||||||
typedef int64_t (*mpGetSizeFunc)(SMemPool*, SMPSession*, void*);
|
typedef int64_t (*mpGetSizeFunc)(SMemPool*, SMPSession*, void*);
|
||||||
typedef int32_t (*mpReallocFunc)(SMemPool*, SMPSession*, void **, int64_t*, int64_t*);
|
typedef int32_t (*mpReallocFunc)(SMemPool*, SMPSession*, void**, int64_t*, int64_t*);
|
||||||
typedef int32_t (*mpInitSessionFunc)(SMemPool*, SMPSession*);
|
typedef int32_t (*mpInitSessionFunc)(SMemPool*, SMPSession*);
|
||||||
typedef int32_t (*mpInitFunc)(SMemPool*, char*, SMemPoolCfg*);
|
typedef int32_t (*mpInitFunc)(SMemPool*, char*, SMemPoolCfg*);
|
||||||
typedef int32_t (*mpUpdateCfgFunc)(SMemPool*);
|
typedef int32_t (*mpUpdateCfgFunc)(SMemPool*);
|
||||||
|
@ -353,10 +343,13 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MP_STAT_FORMAT "%-8s => inErr:%10" PRId64 ", exec:%12" PRId64 ", succ:%12" PRId64 ", fail:%12" PRId64
|
#define MP_STAT_FORMAT "%-8s => inErr:%10" PRId64 ", exec:%12" PRId64 ", succ:%12" PRId64 ", fail:%12" PRId64
|
||||||
#define MP_STAT_ORIG_FORMAT "%-8s => inErr:%10" PRId64 ", exec:%12" PRId64 ", succ:%12" PRId64 ", fail:%12" PRId64 ", oExec:%12" PRId64 ", oSucc:%12" PRId64 ", oFail:%12" PRId64
|
#define MP_STAT_ORIG_FORMAT \
|
||||||
|
"%-8s => inErr:%10" PRId64 ", exec:%12" PRId64 ", succ:%12" PRId64 ", fail:%12" PRId64 ", oExec:%12" PRId64 \
|
||||||
|
", oSucc:%12" PRId64 ", oFail:%12" PRId64
|
||||||
|
|
||||||
#define MP_STAT_VALUE(_name, _item) _name, (_item).inErr, (_item).exec, (_item).succ, (_item).fail
|
#define MP_STAT_VALUE(_name, _item) _name, (_item).inErr, (_item).exec, (_item).succ, (_item).fail
|
||||||
#define MP_STAT_ORIG_VALUE(_name, _item) _name, (_item).inErr, (_item).exec, (_item).succ, (_item).fail, (_item).origExec, (_item).origSucc, (_item).origFail
|
#define MP_STAT_ORIG_VALUE(_name, _item) \
|
||||||
|
_name, (_item).inErr, (_item).exec, (_item).succ, (_item).fail, (_item).origExec, (_item).origSucc, (_item).origFail
|
||||||
|
|
||||||
#define MP_INIT_MEM_HEADER(_header, _size, _nsChunk) \
|
#define MP_INIT_MEM_HEADER(_header, _size, _nsChunk) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -384,49 +377,42 @@ enum {
|
||||||
do { \
|
do { \
|
||||||
if (MP_READ == (type)) { \
|
if (MP_READ == (type)) { \
|
||||||
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
||||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before try read lock"); \
|
|
||||||
uDebug("MP TRY RLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
uDebug("MP TRY RLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||||
} \
|
} \
|
||||||
(_res) = taosRTryLockLatch(_lock); \
|
(_res) = taosRTryLockLatch(_lock); \
|
||||||
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
||||||
uDebug("MP TRY RLOCK%p:%d %s, %s:%d E", (_lock), atomic_load_32(_lock), (_res) ? "failed" : "succeed", __FILE__, __LINE__); \
|
uDebug("MP TRY RLOCK%p:%d %s, %s:%d E", (_lock), atomic_load_32(_lock), (_res) ? "failed" : "succeed", \
|
||||||
ASSERTS((_res) ? atomic_load_32((_lock)) >= 0 : atomic_load_32((_lock)) > 0, "invalid lock value after try read lock"); \
|
__FILE__, __LINE__); \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
||||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before try write lock"); \
|
|
||||||
uDebug("MP TRY WLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
uDebug("MP TRY WLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||||
} \
|
} \
|
||||||
(_res) = taosWTryLockLatch(_lock); \
|
(_res) = taosWTryLockLatch(_lock); \
|
||||||
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
||||||
uDebug("MP TRY WLOCK%p:%d %s, %s:%d E", (_lock), atomic_load_32(_lock), (_res) ? "failed" : "succeed", __FILE__, __LINE__); \
|
uDebug("MP TRY WLOCK%p:%d %s, %s:%d E", (_lock), atomic_load_32(_lock), (_res) ? "failed" : "succeed", \
|
||||||
ASSERTS((_res) ? atomic_load_32((_lock)) >= 0 : atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value after try write lock"); \
|
__FILE__, __LINE__); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
#define MP_LOCK(type, _lock) \
|
#define MP_LOCK(type, _lock) \
|
||||||
do { \
|
do { \
|
||||||
if (MP_READ == (type)) { \
|
if (MP_READ == (type)) { \
|
||||||
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
||||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before read lock"); \
|
|
||||||
uDebug("MP RLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
uDebug("MP RLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||||
} \
|
} \
|
||||||
taosRLockLatch(_lock); \
|
taosRLockLatch(_lock); \
|
||||||
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
||||||
uDebug("MP RLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
uDebug("MP RLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||||
ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value after read lock"); \
|
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
||||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value before write lock"); \
|
|
||||||
uDebug("MP WLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
uDebug("MP WLOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||||
} \
|
} \
|
||||||
taosWLockLatch(_lock); \
|
taosWLockLatch(_lock); \
|
||||||
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
||||||
uDebug("MP WLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
uDebug("MP WLOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||||
ASSERTS(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value after write lock"); \
|
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -435,28 +421,23 @@ enum {
|
||||||
do { \
|
do { \
|
||||||
if (MP_READ == (type)) { \
|
if (MP_READ == (type)) { \
|
||||||
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
||||||
ASSERTS(atomic_load_32((_lock)) > 0, "invalid lock value before read unlock"); \
|
|
||||||
uDebug("MP RULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
uDebug("MP RULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||||
} \
|
} \
|
||||||
taosRUnLockLatch(_lock); \
|
taosRUnLockLatch(_lock); \
|
||||||
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
||||||
uDebug("MP RULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
uDebug("MP RULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after read unlock"); \
|
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
||||||
ASSERTS(atomic_load_32((_lock)) == TD_RWLATCH_WRITE_FLAG_COPY, "invalid lock value before write unlock"); \
|
|
||||||
uDebug("MP WULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
uDebug("MP WULOCK%p:%d, %s:%d B", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||||
} \
|
} \
|
||||||
taosWUnLockLatch(_lock); \
|
taosWUnLockLatch(_lock); \
|
||||||
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
if (MP_GET_FLAG(gMPMgmt.ctrl.funcFlags, MP_CTRL_FLAG_LOCK_DBG)) { \
|
||||||
uDebug("MP WULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
uDebug("MP WULOCK%p:%d, %s:%d E", (_lock), atomic_load_32(_lock), __FILE__, __LINE__); \
|
||||||
ASSERTS(atomic_load_32((_lock)) >= 0, "invalid lock value after write unlock"); \
|
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
#define MP_ERR_RET(c) \
|
#define MP_ERR_RET(c) \
|
||||||
do { \
|
do { \
|
||||||
int32_t _code = c; \
|
int32_t _code = c; \
|
||||||
|
@ -484,21 +465,24 @@ enum {
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define MP_CHECK_QUOTA(_pool, _job, _size) do { \
|
#define MP_CHECK_QUOTA(_pool, _job, _size) \
|
||||||
|
do { \
|
||||||
if (*(_pool)->cfg.jobQuota > 0) { \
|
if (*(_pool)->cfg.jobQuota > 0) { \
|
||||||
int64_t cAllocSize = atomic_add_fetch_64(&(_job)->job.allocMemSize, (_size)); \
|
int64_t cAllocSize = atomic_add_fetch_64(&(_job)->job.allocMemSize, (_size)); \
|
||||||
if (cAllocSize > (*(_pool)->cfg.jobQuota * 1048576L)) { \
|
if (cAllocSize > (*(_pool)->cfg.jobQuota * 1048576L)) { \
|
||||||
uWarn("job 0x%" PRIx64 " remainSession:%d allocSize %" PRId64 " is over than quota %dMB", (_job)->job.jobId, (_job)->job.remainSession, cAllocSize, *(_pool)->cfg.jobQuota); \
|
uWarn("job 0x%" PRIx64 " remainSession:%d allocSize %" PRId64 " is over than quota %dMB", (_job)->job.jobId, \
|
||||||
|
(_job)->job.remainSession, cAllocSize, *(_pool)->cfg.jobQuota); \
|
||||||
(_pool)->cfg.cb.reachFp(pJob->job.jobId, (_job)->job.clientId, TSDB_CODE_QRY_REACH_QMEM_THRESHOLD); \
|
(_pool)->cfg.cb.reachFp(pJob->job.jobId, (_job)->job.clientId, TSDB_CODE_QRY_REACH_QMEM_THRESHOLD); \
|
||||||
mpSchedTrim(NULL); \
|
mpSchedTrim(NULL); \
|
||||||
terrno = TSDB_CODE_QRY_REACH_QMEM_THRESHOLD; \
|
terrno = TSDB_CODE_QRY_REACH_QMEM_THRESHOLD; \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
} else { \
|
} else { \
|
||||||
uDebug("job 0x%" PRIx64 " remainSession:%d allocSize %" PRId64 " is lower than quota %dMB", (_job)->job.jobId, (_job)->job.remainSession, cAllocSize, *(_pool)->cfg.jobQuota); \
|
uDebug("job 0x%" PRIx64 " remainSession:%d allocSize %" PRId64 " is lower than quota %dMB", (_job)->job.jobId, \
|
||||||
|
(_job)->job.remainSession, cAllocSize, *(_pool)->cfg.jobQuota); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
if (atomic_load_64(&tsCurrentAvailMemorySize) <= ((_pool)->cfg.reserveSize + (_size))) { \
|
if (atomic_load_64(&tsCurrentAvailMemorySize) <= ((_pool)->cfg.reserveSize + (_size))) { \
|
||||||
uWarn("%s pool sysAvailMemSize %" PRId64 " can't alloc %" PRId64" while keeping reserveSize %" PRId64 " bytes", \
|
uWarn("%s pool sysAvailMemSize %" PRId64 " can't alloc %" PRId64 " while keeping reserveSize %" PRId64 " bytes", \
|
||||||
(_pool)->name, atomic_load_64(&tsCurrentAvailMemorySize), (_size), (_pool)->cfg.reserveSize); \
|
(_pool)->name, atomic_load_64(&tsCurrentAvailMemorySize), (_size), (_pool)->cfg.reserveSize); \
|
||||||
(_pool)->cfg.cb.reachFp((_job)->job.jobId, (_job)->job.clientId, TSDB_CODE_QRY_QUERY_MEM_EXHAUSTED); \
|
(_pool)->cfg.cb.reachFp((_job)->job.jobId, (_job)->job.clientId, TSDB_CODE_QRY_QUERY_MEM_EXHAUSTED); \
|
||||||
mpSchedTrim(NULL); \
|
mpSchedTrim(NULL); \
|
||||||
|
@ -507,32 +491,30 @@ enum {
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
// direct
|
// direct
|
||||||
void* mpDirectAlloc(SMemPool* pPool, SMPJob* pJob, int64_t size);
|
void* mpDirectAlloc(SMemPool* pPool, SMPJob* pJob, int64_t size);
|
||||||
void* mpDirectAlignAlloc(SMemPool* pPool, SMPJob* pJob, uint32_t alignment, int64_t size);
|
void* mpDirectAlignAlloc(SMemPool* pPool, SMPJob* pJob, uint32_t alignment, int64_t size);
|
||||||
void* mpDirectCalloc(SMemPool* pPool, SMPJob* pJob, int64_t num, int64_t size);
|
void* mpDirectCalloc(SMemPool* pPool, SMPJob* pJob, int64_t num, int64_t size);
|
||||||
void mpDirectFree(SMemPool* pPool, SMPJob* pJob, void *ptr);
|
void mpDirectFree(SMemPool* pPool, SMPJob* pJob, void* ptr);
|
||||||
void* mpDirectRealloc(SMemPool* pPool, SMPJob* pJob, void* ptr, int64_t size);
|
void* mpDirectRealloc(SMemPool* pPool, SMPJob* pJob, void* ptr, int64_t size);
|
||||||
void* mpDirectStrdup(SMemPool* pPool, SMPJob* pJob, const void* ptr);
|
void* mpDirectStrdup(SMemPool* pPool, SMPJob* pJob, const void* ptr);
|
||||||
void* mpDirectStrndup(SMemPool* pPool, SMPJob* pJob, const void* ptr, int64_t size);
|
void* mpDirectStrndup(SMemPool* pPool, SMPJob* pJob, const void* ptr, int64_t size);
|
||||||
|
|
||||||
int32_t mpDirectFullAlloc(SMemPool* pPool, SMPSession* pSession, int64_t* size, uint32_t alignment, void** ppRes);
|
int32_t mpDirectFullAlloc(SMemPool* pPool, SMPSession* pSession, int64_t* size, uint32_t alignment, void** ppRes);
|
||||||
int64_t mpDirectGetMemSize(SMemPool* pPool, SMPSession* pSession, void *ptr);
|
int64_t mpDirectGetMemSize(SMemPool* pPool, SMPSession* pSession, void* ptr);
|
||||||
void mpDirectFullFree(SMemPool* pPool, SMPSession* pSession, void *ptr, int64_t* origSize);
|
void mpDirectFullFree(SMemPool* pPool, SMPSession* pSession, void* ptr, int64_t* origSize);
|
||||||
int32_t mpDirectFullRealloc(SMemPool* pPool, SMPSession* pSession, void **pPtr, int64_t* size, int64_t* origSize);
|
int32_t mpDirectFullRealloc(SMemPool* pPool, SMPSession* pSession, void** pPtr, int64_t* size, int64_t* origSize);
|
||||||
int32_t mpDirectTrim(SMemPool* pPool, SMPSession* pSession, int32_t size, bool* trimed);
|
int32_t mpDirectTrim(SMemPool* pPool, SMPSession* pSession, int32_t size, bool* trimed);
|
||||||
|
|
||||||
// chunk
|
// chunk
|
||||||
int32_t mpChunkInit(SMemPool* pPool, char* poolName, SMemPoolCfg* cfg);
|
int32_t mpChunkInit(SMemPool* pPool, char* poolName, SMemPoolCfg* cfg);
|
||||||
int64_t mpChunkGetMemSize(SMemPool* pPool, SMPSession* pSession, void *ptr);
|
int64_t mpChunkGetMemSize(SMemPool* pPool, SMPSession* pSession, void* ptr);
|
||||||
int32_t mpChunkAlloc(SMemPool* pPool, SMPSession* pSession, int64_t* size, uint32_t alignment, void** ppRes);
|
int32_t mpChunkAlloc(SMemPool* pPool, SMPSession* pSession, int64_t* size, uint32_t alignment, void** ppRes);
|
||||||
void mpChunkFree(SMemPool* pPool, SMPSession* pSession, void *ptr, int64_t* origSize);
|
void mpChunkFree(SMemPool* pPool, SMPSession* pSession, void* ptr, int64_t* origSize);
|
||||||
int32_t mpChunkRealloc(SMemPool* pPool, SMPSession* pSession, void **pPtr, int64_t* size, int64_t* origSize);
|
int32_t mpChunkRealloc(SMemPool* pPool, SMPSession* pSession, void** pPtr, int64_t* size, int64_t* origSize);
|
||||||
int32_t mpChunkInitSession(SMemPool* pPool, SMPSession* pSession);
|
int32_t mpChunkInitSession(SMemPool* pPool, SMPSession* pSession);
|
||||||
int32_t mpChunkUpdateCfg(SMemPool* pPool);
|
int32_t mpChunkUpdateCfg(SMemPool* pPool);
|
||||||
|
|
||||||
|
|
||||||
int32_t mpPopIdleNode(SMemPool* pPool, SMPCacheGroupInfo* pInfo, void** ppRes);
|
int32_t mpPopIdleNode(SMemPool* pPool, SMPCacheGroupInfo* pInfo, void** ppRes);
|
||||||
int32_t mpChkFullQuota(SMemPool* pPool, SMPSession* pSession, int64_t size);
|
int32_t mpChkFullQuota(SMemPool* pPool, SMPSession* pSession, int64_t size);
|
||||||
void mpUpdateAllocSize(SMemPool* pPool, SMPSession* pSession, int64_t size, int64_t addSize);
|
void mpUpdateAllocSize(SMemPool* pPool, SMPSession* pSession, int64_t size, int64_t addSize);
|
||||||
|
@ -540,8 +522,6 @@ int32_t mpAddCacheGroup(SMemPool* pPool, SMPCacheGroupInfo* pInfo, SMPCacheGroup
|
||||||
int32_t mpMalloc(SMemPool* pPool, SMPSession* pSession, int64_t* size, uint32_t alignment, void** ppRes);
|
int32_t mpMalloc(SMemPool* pPool, SMPSession* pSession, int64_t* size, uint32_t alignment, void** ppRes);
|
||||||
void mpSchedTrim(int64_t* loopTimes);
|
void mpSchedTrim(int64_t* loopTimes);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -808,7 +808,7 @@ void mpLogPosStat(SMPStatPos* pStat, EMPStatLogItem item, SMPStatInput* pInput,
|
||||||
MP_ERR_JRET(code);
|
MP_ERR_JRET(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT((pInput->pOrigMem && pInput->origSize > 0) || (NULL == pInput->pOrigMem && pInput->origSize == 0));
|
// ASSSRT((pInput->pOrigMem && pInput->origSize > 0) || (NULL == pInput->pOrigMem && pInput->origSize == 0));
|
||||||
|
|
||||||
if (pInput->pOrigMem && pInput->origSize > 0) {
|
if (pInput->pOrigMem && pInput->origSize > 0) {
|
||||||
code = taosHashRemove(pStat->remainHash, &pInput->pOrigMem, POINTER_BYTES);
|
code = taosHashRemove(pStat->remainHash, &pInput->pOrigMem, POINTER_BYTES);
|
||||||
|
|
|
@ -186,8 +186,7 @@ class TDTestCase:
|
||||||
raise Exception(repr(e))
|
raise Exception(repr(e))
|
||||||
finally:
|
finally:
|
||||||
if infoFile:
|
if infoFile:
|
||||||
infoFile.flush()
|
infoFile.close()
|
||||||
# close()
|
|
||||||
|
|
||||||
def s3_check_show_grants_granted(self):
|
def s3_check_show_grants_granted(self):
|
||||||
tdLog.printNoPrefix("======== test show grants granted: ")
|
tdLog.printNoPrefix("======== test show grants granted: ")
|
||||||
|
|
Loading…
Reference in New Issue