fix upgrade error && open adaptive_merge_schedule

This commit is contained in:
obdev
2024-02-08 00:23:49 +00:00
committed by ob-robot
parent f0b3bd5883
commit af5bc4a3c3
19 changed files with 146 additions and 111 deletions

View File

@ -301,8 +301,8 @@ int ObTenantCompactionMemPool::init()
chunk_allocator_.set_tenant_id(MTL_ID());
piece_allocator_.set_tenant_id(MTL_ID());
max_block_num_ = MTL_IS_MINI_MODE()
? MAX_MEMORY_LIMIT / ObCompactionBufferChunk::DEFAULT_BLOCK_SIZE
: MAX_MEMORY_LIMIT / (ObCompactionBufferChunk::DEFAULT_BLOCK_SIZE * 2);
? MINI_MODE_CHUNK_MEMORY_LIMIT / ObCompactionBufferChunk::DEFAULT_BLOCK_SIZE
: CHUNK_MEMORY_LIMIT / ObCompactionBufferChunk::DEFAULT_BLOCK_SIZE;
total_block_num_ = 0;
is_inited_ = true;
}
@ -493,8 +493,8 @@ int ObTenantCompactionMemPool::try_shrink()
{
int ret = OB_SUCCESS;
ObSpinLockGuard guard(chunk_lock_);
if (max_block_num_ > total_block_num_) {
// not reserve mem in mini mode
if (!MTL_IS_MINI_MODE() && max_block_num_ > total_block_num_) {
// do nothing
} else if (used_block_num_ <= total_block_num_ / 2) {
// Less than half of blocks were used, need shrink
@ -544,7 +544,9 @@ void ObTenantCompactionMemPool::MemPoolShrinkTask::runTimerTask()
bool ObTenantCompactionMemPool::acquire_reserve_mem()
{
bool bret = false;
bret = ATOMIC_BCAS(&reserve_mode_signal_, 1, 0);
if (!MTL_IS_MINI_MODE()) {
bret = ATOMIC_BCAS(&reserve_mode_signal_, 1, 0);
}
return bret;
}

View File

@ -18,6 +18,7 @@
#include "lib/task/ob_timer.h"
#include "lib/lock/ob_spin_lock.h"
#include "lib/allocator/page_arena.h"
#include "lib/literals/ob_literals.h"
#include "storage/blocksstable/ob_data_buffer.h"
@ -138,9 +139,10 @@ private:
};
public:
static constexpr int64_t MAX_MEMORY_LIMIT = 2 << 26; // 128MB
static constexpr int64_t RESERVE_MEM_SIZE = 2 << 24; // 32MB
static constexpr int64_t CHECK_SHRINK_INTERVAL = 120L * 1000L * 1000L; // 120s
static constexpr int64_t CHUNK_MEMORY_LIMIT = 128_MB;
static constexpr int64_t MINI_MODE_CHUNK_MEMORY_LIMIT = 32_MB;
static constexpr int64_t RESERVE_MEM_SIZE = 32_MB;
static constexpr int64_t CHECK_SHRINK_INTERVAL = 120_s;
private:
MemPoolShrinkTask mem_shrink_task_;
common::DefaultPageAllocator chunk_allocator_;