Fix direct load thread local variables destruct
This commit is contained in:
parent
b87473dac2
commit
d7d52691d0
@ -7,11 +7,12 @@
|
|||||||
#include "observer/table_load/ob_table_load_task_scheduler.h"
|
#include "observer/table_load/ob_table_load_task_scheduler.h"
|
||||||
#include "common/ob_timeout_ctx.h"
|
#include "common/ob_timeout_ctx.h"
|
||||||
#include "lib/stat/ob_session_stat.h"
|
#include "lib/stat/ob_session_stat.h"
|
||||||
|
#include "observer/omt/ob_tenant.h"
|
||||||
#include "observer/table_load/ob_table_load_stat.h"
|
#include "observer/table_load/ob_table_load_stat.h"
|
||||||
#include "observer/table_load/ob_table_load_task.h"
|
#include "observer/table_load/ob_table_load_task.h"
|
||||||
#include "share/ob_share_util.h"
|
#include "share/ob_share_util.h"
|
||||||
#include "share/rc/ob_tenant_base.h"
|
#include "share/rc/ob_tenant_base.h"
|
||||||
#include "observer/omt/ob_tenant.h"
|
#include "storage/direct_load/ob_direct_load_table_builder_allocator.h"
|
||||||
|
|
||||||
namespace oceanbase
|
namespace oceanbase
|
||||||
{
|
{
|
||||||
@ -19,6 +20,7 @@ namespace observer
|
|||||||
{
|
{
|
||||||
using namespace common;
|
using namespace common;
|
||||||
using namespace share;
|
using namespace share;
|
||||||
|
using namespace storage;
|
||||||
|
|
||||||
void ObTableLoadTaskThreadPoolScheduler::MyThreadPool::run1()
|
void ObTableLoadTaskThreadPoolScheduler::MyThreadPool::run1()
|
||||||
{
|
{
|
||||||
@ -237,6 +239,9 @@ void ObTableLoadTaskThreadPoolScheduler::run(uint64_t thread_idx)
|
|||||||
state_ = STATE_STOPPING;
|
state_ = STATE_STOPPING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// clear thread local variables
|
||||||
|
get_table_builder_allocator()->reset();
|
||||||
|
|
||||||
LOG_INFO("table load task thread stopped", KP(this), "pid", get_tid_cache(), K(thread_idx));
|
LOG_INFO("table load task thread stopped", KP(this), "pid", get_tid_cache(), K(thread_idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,6 +445,7 @@ void ObDDLKV::reset()
|
|||||||
{
|
{
|
||||||
FLOG_INFO("ddl kv reset", KP(this), K(*this));
|
FLOG_INFO("ddl kv reset", KP(this), K(*this));
|
||||||
is_inited_ = false;
|
is_inited_ = false;
|
||||||
|
ObSSTable::reset();
|
||||||
ls_id_.reset();
|
ls_id_.reset();
|
||||||
tablet_id_.reset();
|
tablet_id_.reset();
|
||||||
ddl_start_scn_ = SCN::min_scn();
|
ddl_start_scn_ = SCN::min_scn();
|
||||||
@ -469,7 +470,6 @@ void ObDDLKV::reset()
|
|||||||
sstable_index_builder_ = nullptr;
|
sstable_index_builder_ = nullptr;
|
||||||
}
|
}
|
||||||
block_meta_tree_.destroy();
|
block_meta_tree_.destroy();
|
||||||
ObSSTable::reset();
|
|
||||||
arena_allocator_.reset();
|
arena_allocator_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,33 +13,19 @@ namespace oceanbase
|
|||||||
namespace storage
|
namespace storage
|
||||||
{
|
{
|
||||||
|
|
||||||
class ObDirectLoadTableBuilderAllocator
|
class ObDirectLoadTableBuilderAllocator final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObDirectLoadTableBuilderAllocator();
|
ObDirectLoadTableBuilderAllocator()
|
||||||
~ObDirectLoadTableBuilderAllocator();
|
|
||||||
template <typename T, typename... Args>
|
|
||||||
T *alloc(Args &&... args);
|
|
||||||
void free(ObIDirectLoadPartitionTableBuilder *table_builder);
|
|
||||||
void assert_in_own_thread();
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct Item : public common::ObDLinkBase<Item>
|
|
||||||
{
|
|
||||||
char buf_[];
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
int64_t tid_;
|
|
||||||
ObDList<Item> using_list_;
|
|
||||||
};
|
|
||||||
|
|
||||||
ObDirectLoadTableBuilderAllocator::ObDirectLoadTableBuilderAllocator()
|
|
||||||
{
|
{
|
||||||
tid_ = get_tid_cache();
|
tid_ = get_tid_cache();
|
||||||
}
|
}
|
||||||
|
~ObDirectLoadTableBuilderAllocator()
|
||||||
ObDirectLoadTableBuilderAllocator::~ObDirectLoadTableBuilderAllocator()
|
{
|
||||||
|
assert_in_own_thread();
|
||||||
|
OB_ASSERT(using_list_.is_empty());
|
||||||
|
}
|
||||||
|
void reset()
|
||||||
{
|
{
|
||||||
assert_in_own_thread();
|
assert_in_own_thread();
|
||||||
Item *item = nullptr;
|
Item *item = nullptr;
|
||||||
@ -52,9 +38,8 @@ ObDirectLoadTableBuilderAllocator::~ObDirectLoadTableBuilderAllocator()
|
|||||||
}
|
}
|
||||||
OB_ASSERT(using_list_.is_empty());
|
OB_ASSERT(using_list_.is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename... Args>
|
template <typename T, typename... Args>
|
||||||
T *ObDirectLoadTableBuilderAllocator::alloc(Args &&... args)
|
T *alloc(Args &&... args)
|
||||||
{
|
{
|
||||||
assert_in_own_thread();
|
assert_in_own_thread();
|
||||||
T *t = nullptr;
|
T *t = nullptr;
|
||||||
@ -69,8 +54,7 @@ T *ObDirectLoadTableBuilderAllocator::alloc(Args &&... args)
|
|||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
void free(ObIDirectLoadPartitionTableBuilder *table_builder)
|
||||||
void ObDirectLoadTableBuilderAllocator::free(ObIDirectLoadPartitionTableBuilder *table_builder)
|
|
||||||
{
|
{
|
||||||
assert_in_own_thread();
|
assert_in_own_thread();
|
||||||
if (OB_NOT_NULL(table_builder)) {
|
if (OB_NOT_NULL(table_builder)) {
|
||||||
@ -81,13 +65,23 @@ void ObDirectLoadTableBuilderAllocator::free(ObIDirectLoadPartitionTableBuilder
|
|||||||
ob_free(item);
|
ob_free(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
OB_INLINE void assert_in_own_thread()
|
||||||
void ObDirectLoadTableBuilderAllocator::assert_in_own_thread()
|
|
||||||
{
|
{
|
||||||
const int64_t tid = get_tid_cache();
|
const int64_t tid = get_tid_cache();
|
||||||
OB_ASSERT(tid == tid_);
|
OB_ASSERT(tid == tid_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct Item : public common::ObDLinkBase<Item>
|
||||||
|
{
|
||||||
|
char buf_[];
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
int64_t tid_;
|
||||||
|
ObDList<Item> using_list_;
|
||||||
|
};
|
||||||
|
|
||||||
OB_INLINE ObDirectLoadTableBuilderAllocator *get_table_builder_allocator()
|
OB_INLINE ObDirectLoadTableBuilderAllocator *get_table_builder_allocator()
|
||||||
{
|
{
|
||||||
RLOCAL_INLINE(ObDirectLoadTableBuilderAllocator, allcator);
|
RLOCAL_INLINE(ObDirectLoadTableBuilderAllocator, allcator);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user