[liboblog-ce] adapt modify of oblogmsg

This commit is contained in:
SanmuWangZJU
2021-11-25 14:13:50 +08:00
committed by LINxiansheng
parent 78b5e48569
commit 41007070b8

View File

@ -27,6 +27,8 @@ namespace oceanbase
namespace liboblog namespace liboblog
{ {
static __thread LogMsgBuf *lmb = NULL;
ObLogStorager::ObLogStorager() : ObLogStorager::ObLogStorager() :
inited_(false), inited_(false),
round_value_(0), round_value_(0),
@ -82,8 +84,6 @@ void ObLogStorager::destroy()
const int64_t thread_num = StoragerThread::get_thread_num(); const int64_t thread_num = StoragerThread::get_thread_num();
StoragerThread::destroy(); StoragerThread::destroy();
LogMsgDestroy();
inited_ = false; inited_ = false;
round_value_ = 0; round_value_ = 0;
destroy_store_buf_array_(thread_num); destroy_store_buf_array_(thread_num);
@ -149,11 +149,10 @@ int ObLogStorager::push(ObLogEntryTask &task, const int64_t timeout)
int ObLogStorager::thread_begin() int ObLogStorager::thread_begin()
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
int tmp_ret = 0;
// First call, initialization required // First call, initialization required
if (0 != (tmp_ret = LogMsgLocalInit())) { if (OB_ISNULL(lmb = new LogMsgBuf())) {
LOG_ERROR("LogMsgLocalInit fail", K(tmp_ret)); LOG_ERROR("LogMsgLocalInit fail");
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
} else { } else {
LOG_INFO("ObLogStorager LogMsgLocalInit succ"); LOG_INFO("ObLogStorager LogMsgLocalInit succ");
@ -165,7 +164,7 @@ int ObLogStorager::thread_begin()
void ObLogStorager::thread_end() void ObLogStorager::thread_end()
{ {
// LogMsgLocalDestroy return void // LogMsgLocalDestroy return void
LogMsgLocalDestroy(); delete lmb;
LOG_INFO("ObLogStorager LogMsgLocalDestroy succ"); LOG_INFO("ObLogStorager LogMsgLocalDestroy succ");
} }
@ -297,7 +296,7 @@ int ObLogStorager::to_string_binlog_record_(ObLogEntryTask &log_entry_task,
const int record_type = binlog_record->recordType(); const int record_type = binlog_record->recordType();
const char *buf = NULL; // Pointer to the first address of the BinlogRecord serialized byte stream const char *buf = NULL; // Pointer to the first address of the BinlogRecord serialized byte stream
size_t buf_len = 0; // Length of BinlogRecord serialised byte stream size_t buf_len = 0; // Length of BinlogRecord serialised byte stream
buf = binlog_record->toString(&buf_len); buf = binlog_record->toString(&buf_len, lmb);
StoreBuf &store_buf = store_buf_array_[thread_index]; StoreBuf &store_buf = store_buf_array_[thread_index];
void *ptr = NULL; void *ptr = NULL;
char *alloc_buf = NULL; char *alloc_buf = NULL;