From 89b27014951294fee5dfeb20ace1a04eb31bbdee Mon Sep 17 00:00:00 2001 From: JiahuaChen Date: Tue, 26 Oct 2021 19:24:45 +0800 Subject: [PATCH] Fix ob_admin parse partition macro meta slog fail --- src/storage/ob_partition_meta_redo_module.cpp | 11 ++++++++++- tools/ob_admin/main.cpp | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/storage/ob_partition_meta_redo_module.cpp b/src/storage/ob_partition_meta_redo_module.cpp index c090d2c1b7..bec9ddbf81 100644 --- a/src/storage/ob_partition_meta_redo_module.cpp +++ b/src/storage/ob_partition_meta_redo_module.cpp @@ -451,14 +451,23 @@ int ObPartitionMetaRedoModule::parse(const int64_t subcmd, const char* buf, cons ObPGKey pgkey; ObITable::TableKey table_key; blocksstable::ObMacroBlockMetaV2 meta; + common::ObObj *endkey = static_cast(ob_malloc(sizeof(ObObj) * common::OB_MAX_COLUMN_NUMBER)); MacroBlockId macro_block_id; ObPGMacroBlockMetaLogEntry entry(pgkey, table_key, 0, 0, macro_block_id, meta); - if (OB_FAIL(entry.deserialize(buf, len, pos))) { + if (OB_UNLIKELY(nullptr == endkey)) { + ret = OB_ALLOCATE_MEMORY_FAILED; + LOG_WARN("alloc memory fail", K(ret)); + } else if (FALSE_IT(meta.endkey_ = endkey)) { + } else if (OB_FAIL(entry.deserialize(buf, len, pos))) { LOG_WARN("Fail to deserialize ObPGMacroBlockMetaLogEntry", K(ret)); } else if (0 > fprintf(stream, "ObPGMacroBlockMetaLogEntry\n%s\n", to_cstring(entry))) { ret = OB_IO_ERROR; LOG_WARN("failed to print ObPGMacroBlockMetaLogEntry", K(ret), K(entry)); } + + if (nullptr != endkey) { + ob_free(endkey); + } break; } case REDO_LOG_UPDATE_TENANT_FILE_INFO: { diff --git a/tools/ob_admin/main.cpp b/tools/ob_admin/main.cpp index fb4d4a1007..6f487bbced 100644 --- a/tools/ob_admin/main.cpp +++ b/tools/ob_admin/main.cpp @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) { int ret = 0; OB_LOGGER.set_log_level("INFO"); - OB_LOGGER.set_file_name("ob_admin.log", true, false); + OB_LOGGER.set_file_name("ob_admin.log", true, false, "ob_admin_rs.log"); const char *log_level = getenv("OB_ADMIN_LOG_LEVEL"); if (NULL != log_level) { OB_LOGGER.set_log_level(log_level);