Merge pull request #12569 from taosdata/fix/query_limit
fix: mem size limit
This commit is contained in:
commit
d8743b728d
|
@ -433,7 +433,8 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
|
|||
|
||||
tsRpcQueueMemoryAllowed = tsTotalMemoryKB * 1024 * 0.1;
|
||||
tsRpcQueueMemoryAllowed = TRANGE(tsRpcQueueMemoryAllowed, TSDB_MAX_WAL_SIZE * 10L, TSDB_MAX_WAL_SIZE * 10000L);
|
||||
if (cfgAddInt64(pCfg, "rpcQueueMemoryAllowed", tsRpcQueueMemoryAllowed, 1, INT64_MAX, 0) != 0) return -1;
|
||||
if (cfgAddInt64(pCfg, "rpcQueueMemoryAllowed", tsRpcQueueMemoryAllowed, TSDB_MAX_WAL_SIZE * 10L, INT64_MAX, 0) != 0)
|
||||
return -1;
|
||||
|
||||
if (cfgAddBool(pCfg, "monitor", tsEnableMonitor, 0) != 0) return -1;
|
||||
if (cfgAddInt32(pCfg, "monitorInterval", tsMonitorInterval, 1, 200000, 0) != 0) return -1;
|
||||
|
|
|
@ -30,6 +30,7 @@ void Testbase::InitLog(const char* path) {
|
|||
tsdbDebugFlag = 0;
|
||||
tsLogEmbedded = 1;
|
||||
tsAsyncLog = 0;
|
||||
tsRpcQueueMemoryAllowed = 1024 * 1024 * 64;
|
||||
|
||||
taosRemoveDir(path);
|
||||
taosMkDir(path);
|
||||
|
|
|
@ -152,7 +152,7 @@ void *taosAllocateQitem(int32_t size, EQItype itype) {
|
|||
|
||||
if (itype == RPC_QITEM) {
|
||||
int64_t alloced = atomic_add_fetch_64(&tsRpcQueueMemoryUsed, size);
|
||||
if (alloced > tsRpcQueueMemoryUsed) {
|
||||
if (alloced > tsRpcQueueMemoryAllowed) {
|
||||
taosMemoryFree(pNode);
|
||||
terrno = TSDB_CODE_OUT_OF_RPC_MEMORY_QUEUE;
|
||||
return NULL;
|
||||
|
|
|
@ -37,7 +37,7 @@ class UtilTesProc : public ::testing::Test {
|
|||
head.msgType = 2;
|
||||
head.noResp = 3;
|
||||
head.persistHandle = 4;
|
||||
|
||||
tsRpcQueueMemoryAllowed = 1024 * 1024 * 64;
|
||||
taosRemoveDir("/tmp/td");
|
||||
taosMkDir("/tmp/td");
|
||||
tstrncpy(tsLogDir, "/tmp/td", PATH_MAX);
|
||||
|
@ -236,7 +236,8 @@ TEST_F(UtilTesProc, 03_Handle) {
|
|||
int32_t i = 0;
|
||||
for (i = 0; i < 20; ++i) {
|
||||
head.handle = (void *)((int64_t)i);
|
||||
ASSERT_EQ(taosProcPutToChildQ(cproc, &head, sizeof(STestMsg), body, i, (void *)((int64_t)i), i, PROC_FUNC_REQ), 0);
|
||||
ASSERT_EQ(taosProcPutToChildQ(cproc, &head, sizeof(STestMsg), body, i, (void *)((int64_t)i), i, PROC_FUNC_REQ),
|
||||
0);
|
||||
}
|
||||
|
||||
cfg.isChild = true;
|
||||
|
|
Loading…
Reference in New Issue