diff --git a/source/util/inc/tmempoolInt.h b/source/util/inc/tmempoolInt.h index afbb6cac61..183ce3ee04 100755 --- a/source/util/inc/tmempoolInt.h +++ b/source/util/inc/tmempoolInt.h @@ -41,12 +41,12 @@ extern "C" { #define MP_RETIRE_MID_THRESHOLD_PERCENT (0.9) #define MP_RETIRE_LOW_THRESHOLD_PERCENT (0.85) #define MP_RETIRE_UNIT_PERCENT (0.1) -#define MP_RETIRE_UNIT_MIN_SIZE (50 * 1048576UL) -#define MP_CFG_UPDATE_MIN_RESERVE_SIZE (50 * 1024 * 1048576UL) +#define MP_RETIRE_UNIT_MIN_SIZE (50 * 1048576L) +#define MP_CFG_UPDATE_MIN_RESERVE_SIZE (50 * 1024 * 1048576L) #define MP_DEFAULT_RESERVE_MEM_PERCENT 20 -#define MP_MIN_FREE_SIZE_AFTER_RESERVE (4 * 1024 * 1048576UL) -#define MP_MIN_MEM_POOL_SIZE (5 * 1024 * 1048576UL) +#define MP_MIN_FREE_SIZE_AFTER_RESERVE (4 * 1024 * 1048576L) +#define MP_MIN_MEM_POOL_SIZE (5 * 1024 * 1048576L) // FLAGS AREA diff --git a/source/util/src/tmempool.c b/source/util/src/tmempool.c index 49e5dccc50..4189efd684 100644 --- a/source/util/src/tmempool.c +++ b/source/util/src/tmempool.c @@ -319,7 +319,7 @@ int32_t mpChkFullQuota(SMemPool* pPool, SMPSession* pSession, int64_t size) { SMPJob* pJob = pSession->pJob; int64_t cAllocSize = atomic_add_fetch_64(&pJob->job.allocMemSize, size); int64_t quota = atomic_load_32(pPool->cfg.jobQuota); - if (quota > 0 && cAllocSize / 1048576UL > quota) { + if (quota > 0 && cAllocSize > (quota * 1048576L)) { code = TSDB_CODE_QRY_REACH_QMEM_THRESHOLD; uWarn("job 0x%" PRIx64 " allocSize %" PRId64 " is over than quota %" PRId64, pJob->job.jobId, cAllocSize, quota); pPool->cfg.cb.reachFp(pJob->job.jobId, pJob->job.clientId, code); diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index 47a6b418f6..8e7147c2d3 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -395,6 +395,7 @@ ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/test_hot_refresh_configurations.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/subscribe_stream_privilege.py ,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/empty_identifier.py +,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/qmemCtrl.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/composite_primary_key_create.py ,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/composite_primary_key_insert.py diff --git a/tests/system-test/0-others/qmemCtrl.py b/tests/system-test/0-others/qmemCtrl.py index 0df9a7ccab..2aacc2c6ed 100644 --- a/tests/system-test/0-others/qmemCtrl.py +++ b/tests/system-test/0-others/qmemCtrl.py @@ -38,10 +38,10 @@ class TDTestCase: } def update_cfg(self, use_mpool = 1, min_rsize = 0, single_msize = 0): - updatecfgDict = {'queryUseMemoryPool':'{use_mpool}','minReservedMemorySize': min_rsize, 'singleQueryMaxMemorySize': single_msize} + updatecfgDict = {'queryUseMemoryPool':f'{use_mpool}','minReservedMemorySize': min_rsize, 'singleQueryMaxMemorySize': single_msize} tdDnodes.stop(1) - tdDnodes.deploy(1) - tdDnodes.start(1) + tdDnodes.deploy(1, updatecfgDict) + tdDnodes.starttaosd(1) def alter_cfg(self, use_mpool = 1, min_rsize = 0, single_msize = 0): tdSql.error(f"alter dnode 1 'queryUseMemoryPool' '{use_mpool}'") @@ -83,8 +83,12 @@ class TDTestCase: self.variables_check(0, 0, 1024, 0) tdLog.info(f'[enable pool + up limit] start') - self.update_cfg(1, 1000000000, 1000000000) - self.variables_check(0, 1, 1000000000, 1000000000) + self.update_cfg(1, 1024, 1000000000) + self.variables_check(0, 1, 1024, 1000000000) + + tdLog.info(f'[enable pool + reserve limit] start') + self.update_cfg(1, 1000000000, 3000) + self.variables_check(0, 1, 1000000000, 3000) tdLog.info(f'[enable pool + out of reserve] start') self.update_cfg(1, 1000000001)