[FEAT MERGE] log4100 branch

Co-authored-by: tino247 <tino247@126.com>
Co-authored-by: BinChenn <binchenn.bc@gmail.com>
Co-authored-by: HaHaJeff <jeffzhouhhh@gmail.com>
This commit is contained in:
obdev
2023-01-28 18:17:31 +08:00
committed by ob-robot
parent a269ffe6be
commit 50024b39cd
772 changed files with 60275 additions and 11301 deletions

View File

@ -24,6 +24,7 @@
#include "storage/tx/ob_keep_alive_ls_handler.h"
#include "logservice/ob_log_base_header.h"
#include "logservice/ob_garbage_collector.h"
#include "logservice/data_dictionary/ob_data_dict_iterator.h" // ObDataDictIterator
#include "share/scn.h"
@ -44,7 +45,7 @@ ObAdminParserLogEntry::ObAdminParserLogEntry(const LogEntry &entry,
const LSN lsn,
const ObAdminMutatorStringArg &str_arg)
: buf_(entry.get_data_buf()), buf_len_(entry.get_data_len()), pos_(0),
scn_val_(entry.get_scn().get_val_for_logservice()), block_id_(block_id), lsn_(lsn)
scn_val_(entry.get_scn().get_val_for_logservice()), block_id_(block_id), lsn_(lsn), str_arg_()
{
str_arg_ = str_arg;
}
@ -483,6 +484,80 @@ int ObAdminParserLogEntry::parse_gais_log_()
return ret;
}
int ObAdminParserLogEntry::parse_data_dict_log_()
{
int ret = OB_SUCCESS;
static datadict::ObDataDictIterator dict_iterator;
ObArenaAllocator allocator("ObAdmDictDump");
if (OB_FAIL(dict_iterator.init(OB_SERVER_TENANT_ID))) {
LOG_WARN("dict_iterator init failed", KR(ret), KP_(buf), K_(buf_len), K_(pos));
} else if (OB_FAIL(dict_iterator.append_log_buf(buf_, buf_len_, pos_))) {
LOG_WARN("append palf_log to data_dict_iterator failed", KR(ret), KP_(buf), K_(buf_len), K_(pos));
} else {
while (OB_SUCC(ret)) {
datadict::ObDictMetaHeader header;
if (OB_FAIL(dict_iterator.next_dict_header(header))) {
if (OB_ITER_END != ret) {
LOG_WARN("next_dict_header failed", KR(ret), K(header));
}
} else if (! header.is_valid()) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("expect valid dict_header", KR(ret), K(header));
} else {
ObAdminLogNormalDumper normal_writer;
str_arg_.writer_ptr_ = &normal_writer;
str_arg_.writer_ptr_->start_object();
str_arg_.writer_ptr_->dump_key("DictHeader");
str_arg_.writer_ptr_->dump_string(to_cstring(header));
switch (header.get_dict_meta_type()) {
case datadict::ObDictMetaType::TENANT_META: {
datadict::ObDictTenantMeta tenant_meta(&allocator);
if (OB_FAIL(dict_iterator.next_dict_entry(tenant_meta))) {
LOG_ERROR("get next_dict_entry failed", KR(ret), K(header), K(tenant_meta));
} else {
str_arg_.writer_ptr_->dump_key("TenantMeta");
str_arg_.writer_ptr_->dump_string(to_cstring(tenant_meta));
}
break;
}
case datadict::ObDictMetaType::DATABASE_META: {
datadict::ObDictDatabaseMeta db_meta(&allocator);
if (OB_FAIL(dict_iterator.next_dict_entry(db_meta))) {
LOG_ERROR("get next_dict_entry failed", KR(ret), K(header), K(db_meta));
} else {
str_arg_.writer_ptr_->dump_key("DatabaseMeta");
str_arg_.writer_ptr_->dump_string(to_cstring(db_meta));
}
break;
}
case datadict::ObDictMetaType::TABLE_META: {
datadict::ObDictTableMeta table_meta(&allocator);
if (OB_FAIL(dict_iterator.next_dict_entry(table_meta))) {
LOG_ERROR("get next_dict_entry failed", KR(ret), K(header), K(table_meta));
} else {
str_arg_.writer_ptr_->dump_key("TableMeta");
str_arg_.writer_ptr_->dump_string(to_cstring(table_meta));
}
break;
}
default: {
ret = OB_NOT_SUPPORTED;
LOG_WARN("invalid meta_type", KR(ret), K(header));
}
}
str_arg_.writer_ptr_->end_object();
}
}
if (OB_ITER_END == ret) {
ret = OB_SUCCESS;
}
}
return ret;
}
int ObAdminParserLogEntry::parse_reserved_snapshot_log_()
{
//not supported so far, just reserved
@ -563,6 +638,10 @@ int ObAdminParserLogEntry::parse_different_entry_type_(const logservice::ObLogBa
ret = parse_gais_log_();
break;
}
case oceanbase::logservice::ObLogBaseType::DATA_DICT_LOG_BASE_TYPE: {
ret = parse_data_dict_log_();
break;
}
case oceanbase::logservice::ObLogBaseType::RESERVED_SNAPSHOT_LOG_BASE_TYPE: {
ret = parse_reserved_snapshot_log_();
break;

View File

@ -16,6 +16,7 @@
#include "storage/tx/ob_tx_log.h"
#include "logservice/ob_log_base_type.h"
#include "../ob_admin_log_tool_executor.h"
namespace oceanbase
{
namespace transaction
@ -60,6 +61,7 @@ private:
int parse_recovery_ls_service_log_();
int parse_standby_timestamp_log_();
int parse_gais_log_();
int parse_data_dict_log_();
int parse_reserved_snapshot_log_();
int parse_medium_log_();