fix some bug

This commit is contained in:
obdev 2024-11-28 17:16:00 +00:00 committed by ob-robot
parent b58946d7f6
commit 9fe0296236
5 changed files with 22 additions and 5 deletions

View File

@ -13,6 +13,10 @@
#define TC_INFO(format, ...) fprintf(stderr, format "\n", ##__VA_ARGS__)
#endif
#ifndef ALLOCATE_QDTABLE
#define ALLOCATE_QDTABLE(size, name) static_cast<void**>(new (std::nothrow) void*[size])
#endif
#ifndef CACHE_ALIGNED
#define CACHE_ALIGNED __attribute__((aligned(64)))
#endif

View File

@ -44,6 +44,7 @@ public:
};
enum QD_TYPE { QDISC_ROOT, QDISC_BUFFER_QUEUE, QDISC_WEIGHTED_QUEUE, QDISC_QUEUE_END, TCLIMIT_BYTES, TCLIMIT_COUNT };
int init_qdtable();
int tclimit_create(int type, const char* name);
void tclimit_destroy(int limiter_id);
int tclimit_set_limit(int limiter_id, int64_t limit);

View File

@ -10,9 +10,21 @@
* See the Mulan PubL v2 for more details.
*/
const int QID_CAPACITY = 1<<13;
const int QID_CAPACITY = 1<<16;
const int MAX_QDISC_COUNT = QID_CAPACITY * (MAX_N_CHAN + 1);
void* qdtable[MAX_QDISC_COUNT];
void** qdtable = nullptr;
int __attribute__((constructor)) init_qdtable()
{
int ret = 0;
qdtable = ALLOCATE_QDTABLE(MAX_QDISC_COUNT * sizeof(void*), "qdtable");
if (qdtable == nullptr) {
ret = -ENOMEM;
} else {
std::memset(qdtable, 0, MAX_QDISC_COUNT * sizeof(void*));
}
return ret;
}
static void* imap_fetch(int id)
{
@ -23,7 +35,6 @@ static int imap_lock()
{
for(int i = 0; i < QID_CAPACITY; i++) {
if (!qdtable[i]) {
qdtable[i] = (void*)~0ULL;
return i;
}
}

View File

@ -14,8 +14,9 @@
#include "lib/oblog/ob_log.h"
#include "lib/ob_define.h"
#include "lib/thread_local/ob_tsi_utils.h"
#include "deps/oblib/src/lib/allocator/ob_malloc.h"
#define TC_INFO(...) _OB_LOG(INFO, __VA_ARGS__)
#define ALLOCATE_QDTABLE(size, name) static_cast<void**>(oceanbase::ob_malloc(size, name))
#define MAX_CPU_NUM oceanbase::common::OB_MAX_CPU_NUM
#define tc_itid oceanbase::common::get_itid
#include "ob_tc.cpp"

View File

@ -978,7 +978,7 @@ int ObIOResult::transform_group_config_index_to_usage_index(const ObIOGroupKey &
if (is_sys_module()) {
offset = is_object_device_req_ ? 1 : 0;
offset = offset * 2 + static_cast<uint64_t>(get_mode());
tmp_index = get_sys_module_id();
tmp_index = get_sys_module_id() - SYS_MODULE_START_ID;
usage_index = tmp_index * GROUP_MODE_CNT + offset;
} else {
if (OB_FAIL(tenant_io_mgr_.get_ptr()->get_group_index(key, tmp_index))) {