• N
    Fix resource group memory overuse issue when increasing concurrency. · 94a08704
    Ning Yu 提交于
    Resource group may have memory overuse in below case:
    
    	CREATE RESOURCE GROUP rg_concurrency_test WITH
    	(concurrency=1, cpu_rate_limit=20, memory_limit=60,
    	 memory_shared_quota=0, memory_spill_ratio=10);
    	CREATE ROLE role_concurrency_test RESOURCE GROUP rg_concurrency_test;
    
    	11:SET ROLE role_concurrency_test;
    	11:BEGIN;
    
    	21:SET ROLE role_concurrency_test;
    	22:SET ROLE role_concurrency_test;
    	21&:BEGIN;
    	22&:BEGIN;
    
    	ALTER RESOURCE GROUP rg_concurrency_test SET CONCURRENCY 2;
    
    	11:END;
    
    The cause is that we didn't check overall memory quota usage in the
    past, so pending queries can be waken up as long as the concurrency
    limit is not reached, in such a case if the currently running tranctions
    have used all the memory quota in the resource group then the overall
    memory usage will be exceeded.
    
    To fix this issue we now checks both concurrency limit and memory quota
    usage to decide whether to wake up pending queries.
    Signed-off-by: NZhenghua Lyu <zlv@pivotal.io>
    94a08704
resgroup.h 2.7 KB