fixed log data incorrect because of alloc memory failed.
This commit is contained in:
parent
8023b02a49
commit
a80fd7b5c3
@ -777,7 +777,7 @@ int LogEngine::update_manifest(const block_id_t block_id)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_FAIL(log_meta_storage_.update_manifest_used_for_meta_storage(block_id))) {
|
||||
PALF_LOG(WARN, "append_log_meta_ failed", K(ret), K_(palf_id), K_(is_inited));
|
||||
PALF_LOG(WARN, "update_manifest_used_for_meta_storage failed", K(ret), K_(palf_id), K_(is_inited));
|
||||
} else {
|
||||
PALF_LOG(INFO,
|
||||
"update_max_block_id_for_switch_block_cb success",
|
||||
|
@ -13,7 +13,6 @@
|
||||
#define USING_LOG_PREFIX PALF
|
||||
#include "log_storage.h"
|
||||
#include "lib/ob_errno.h" // OB_INVALID_ARGUMENT
|
||||
#include "share/rc/ob_tenant_base.h" // mtl_malloc
|
||||
#include "log_reader_utils.h" // ReadBuf
|
||||
#include "share/scn.h"
|
||||
|
||||
@ -98,15 +97,15 @@ int LogStorage::load_manifest_for_meta_storage(block_id_t &expected_next_block_i
|
||||
void LogStorage::destroy()
|
||||
{
|
||||
is_inited_ = false;
|
||||
palf_id_ = INVALID_PALF_ID;
|
||||
logical_block_size_ = 0;
|
||||
block_mgr_.destroy();
|
||||
log_reader_.destroy();
|
||||
log_tail_.reset();
|
||||
readable_log_tail_.reset();
|
||||
log_block_header_.reset();
|
||||
curr_block_writable_size_ = 0;
|
||||
palf_id_ = INVALID_PALF_ID;
|
||||
need_append_block_header_ = false;
|
||||
curr_block_writable_size_ = 0;
|
||||
log_block_header_.reset();
|
||||
readable_log_tail_.reset();
|
||||
log_tail_.reset();
|
||||
log_reader_.destroy();
|
||||
block_mgr_.destroy();
|
||||
PALF_LOG(INFO, "LogStorage destroy success");
|
||||
}
|
||||
|
||||
@ -570,6 +569,7 @@ int LogStorage::do_init_(const char *base_dir,
|
||||
snprintf(log_dir, OB_MAX_FILE_NAME_LENGTH, "%s/%s", base_dir, sub_dir))) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
PALF_LOG(ERROR, "LogStorage snprintf failed", K(ret), K(tmp_ret));
|
||||
} else if (FALSE_IT(memset(block_header_serialize_buf_, '\0', MAX_INFO_BLOCK_SIZE))) {
|
||||
} else if (OB_FAIL(block_mgr_.init(log_dir,
|
||||
lsn_2_block(base_lsn, logical_block_size),
|
||||
align_size,
|
||||
@ -653,7 +653,6 @@ int LogStorage::update_block_header_(const block_id_t block_id,
|
||||
const SCN &block_min_scn)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
char *block_header_seria_buf = NULL;
|
||||
int64_t pos = 0;
|
||||
|
||||
log_block_header_.update_lsn_and_scn(block_min_lsn, block_min_scn);
|
||||
@ -661,23 +660,17 @@ int LogStorage::update_block_header_(const block_id_t block_id,
|
||||
palf_id_, lsn_2_block(log_tail_, logical_block_size_));
|
||||
log_block_header_.calc_checksum();
|
||||
|
||||
if (OB_ISNULL(block_header_seria_buf =
|
||||
static_cast<char *>(mtl_malloc(MAX_INFO_BLOCK_SIZE, "LogStorage")))) {
|
||||
} else if (FALSE_IT(memset(block_header_seria_buf, '\0', MAX_INFO_BLOCK_SIZE))) {
|
||||
} else if (OB_FAIL(log_block_header_.serialize(block_header_seria_buf,
|
||||
if (FALSE_IT(memset(block_header_serialize_buf_, '\0', MAX_INFO_BLOCK_SIZE))) {
|
||||
} else if (OB_FAIL(log_block_header_.serialize(block_header_serialize_buf_,
|
||||
MAX_INFO_BLOCK_SIZE, pos))) {
|
||||
PALF_LOG(ERROR, "serialize info block failed", K(ret));
|
||||
} else if (OB_FAIL(block_mgr_.pwrite(block_id, 0, block_header_seria_buf,
|
||||
} else if (OB_FAIL(block_mgr_.pwrite(block_id, 0, block_header_serialize_buf_,
|
||||
MAX_INFO_BLOCK_SIZE))) {
|
||||
PALF_LOG(ERROR, "write info block failed", K(ret), K(block_id), KPC(this));
|
||||
} else {
|
||||
PALF_LOG(INFO, "append_block_header_ success", K(ret), K(block_id),
|
||||
K(log_block_header_));
|
||||
PALF_LOG(INFO, "append_block_header_ success", K(ret), K(block_id), K(log_block_header_));
|
||||
need_append_block_header_ = false;
|
||||
}
|
||||
if (NULL != block_header_seria_buf) {
|
||||
mtl_free(block_header_seria_buf);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,8 @@ public:
|
||||
K_(log_block_header),
|
||||
K_(block_mgr),
|
||||
K(logical_block_size_),
|
||||
K(curr_block_writable_size_));
|
||||
K(curr_block_writable_size_),
|
||||
KP(block_header_serialize_buf_));
|
||||
|
||||
private:
|
||||
int do_init_(const char *log_dir,
|
||||
@ -176,6 +177,7 @@ private:
|
||||
mutable ObSpinLock tail_info_lock_;
|
||||
mutable ObSpinLock delete_block_lock_;
|
||||
UpdateManifestCallback update_manifest_cb_;
|
||||
char block_header_serialize_buf_[MAX_INFO_BLOCK_SIZE];
|
||||
bool is_inited_;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user