fix & optimize table store print function
This commit is contained in:
parent
e8d55a05af
commit
917359f57b
@ -837,22 +837,6 @@ bool ObMemtableArray::exist_memtable_with_end_scn(const ObITable *table, const S
|
||||
return is_exist;
|
||||
}
|
||||
|
||||
int64_t ObMemtableArray::to_string(char *buf, const int64_t buf_len) const
|
||||
{
|
||||
int64_t pos = 0;
|
||||
if (OB_ISNULL(buf) || buf_len <= 0) {
|
||||
// do nothing
|
||||
} else {
|
||||
J_OBJ_START();
|
||||
J_NAME("ObMemtableArray");
|
||||
J_KV(KP(this),
|
||||
K_(count),
|
||||
"memtable_ptr_array", ObArrayWrap<memtable::ObIMemtable *>(memtable_array_, count_));
|
||||
J_OBJ_END();
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
int ObDDLKVArray::init(
|
||||
ObArenaAllocator &allocator,
|
||||
common::ObIArray<ObITable *> &ddl_kvs)
|
||||
@ -917,21 +901,7 @@ int ObDDLKVArray::deep_copy(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int64_t ObDDLKVArray::to_string(char *buf, const int64_t buf_len) const
|
||||
{
|
||||
int64_t pos = 0;
|
||||
if (OB_ISNULL(buf) || buf_len <= 0) {
|
||||
// do nothing
|
||||
} else {
|
||||
J_OBJ_START();
|
||||
J_NAME("ObDDLKVArray");
|
||||
J_KV(KP(this),
|
||||
K_(count),
|
||||
"ddl_kv_ptr_array", ObArrayWrap<ObITable *>(ddl_kvs_, count_));
|
||||
J_OBJ_END();
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
/* ObTableStoreUtil Section */
|
||||
bool ObTableStoreUtil::ObITableLogTsRangeCompare::operator()(
|
||||
const ObITable *ltable, const ObITable *rtable) const
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
int find(const ObITable::TableKey &table_key, ObITable *&table) const;
|
||||
int find(const share::SCN &start_scn, const int64_t base_version, ObITable *&table, int64_t &mem_pos) const;
|
||||
int assign(ObMemtableArray &dst_array) const;
|
||||
int64_t to_string(char *buf, const int64_t buf_len) const;
|
||||
TO_STRING_KV(K_(count));
|
||||
private:
|
||||
bool exist_memtable_with_end_scn(const ObITable *table, const share::SCN &end_scn);
|
||||
memtable::ObIMemtable *memtable_array_[MAX_MEMSTORE_CNT];
|
||||
@ -151,7 +151,7 @@ public:
|
||||
OB_INLINE int64_t get_deep_copy_size() const { return count_ * sizeof(ObITable *); }
|
||||
int init(ObArenaAllocator &allocator, common::ObIArray<ObITable *> &ddl_kvs);
|
||||
int deep_copy(char *buf, const int64_t buf_size, int64_t &pos, ObDDLKVArray &dst) const;
|
||||
int64_t to_string(char *buf, const int64_t buf_len) const;
|
||||
TO_STRING_KV(K_(count), K_(is_inited));
|
||||
private:
|
||||
bool is_inited_;
|
||||
ObITable **ddl_kvs_;
|
||||
|
@ -2460,71 +2460,138 @@ int64_t ObTabletTableStore::to_string(char *buf, const int64_t buf_len) const
|
||||
// do nothing
|
||||
} else {
|
||||
J_OBJ_START();
|
||||
J_NAME("ObTabletTableStore");
|
||||
J_COLON();
|
||||
J_KV(KP(this), K_(version), K_(major_tables), K_(minor_tables), K_(memtables), K_(is_ready_for_read));
|
||||
J_KV(KP(this), K_(version), K_(major_tables), K_(minor_tables), K_(ddl_sstables), K_(meta_major_tables), K_(memtables), K_(is_ready_for_read));
|
||||
J_COMMA();
|
||||
J_ARRAY_START();
|
||||
for (int64_t i = 0; i < major_tables_.count(); ++i) {
|
||||
const ObSSTable *table = major_tables_[i];
|
||||
J_OBJ_START();
|
||||
J_KV(K(i), "addr", table->get_addr(),
|
||||
"type", ObITable::get_table_type_name(table->get_key().table_type_),
|
||||
"tablet_id", table->get_key().tablet_id_,
|
||||
"scn_range", table->get_key().scn_range_,
|
||||
"snapshot_version", table->get_snapshot_version(),
|
||||
"max_merge_version", table->get_max_merged_trans_version());
|
||||
J_OBJ_END();
|
||||
J_COMMA();
|
||||
}
|
||||
for (int64_t i = 0; i < minor_tables_.count(); ++i) {
|
||||
const ObSSTable *table = minor_tables_[i];
|
||||
J_OBJ_START();
|
||||
J_KV(K(i), "addr", table->get_addr(),
|
||||
|
||||
BUF_PRINTF("sstable_arrays:");
|
||||
J_OBJ_START();
|
||||
|
||||
BUF_PRINTF("major_tables:{");
|
||||
if (0 == major_tables_.count()) {
|
||||
BUF_PRINTF("null");
|
||||
} else {
|
||||
for (int64_t i = 0; i < major_tables_.count(); ++i) {
|
||||
const ObSSTable *table = major_tables_[i];
|
||||
if (0 != i) {
|
||||
J_COMMA();
|
||||
}
|
||||
J_OBJ_START();
|
||||
J_KV(K(i), "addr", table->get_addr(),
|
||||
"type", ObITable::get_table_type_name(table->get_key().table_type_),
|
||||
"tablet_id", table->get_key().tablet_id_,
|
||||
"scn_range", table->get_key().scn_range_,
|
||||
"contain_uncommitted_row", table->contain_uncommitted_row() ? "yes" : "no",
|
||||
"max_merge_version", table->get_max_merged_trans_version(),
|
||||
"upper_trans_version", table->get_upper_trans_version());
|
||||
J_OBJ_END();
|
||||
J_COMMA();
|
||||
}
|
||||
for (int64_t i = 0; i < ddl_sstables_.count(); ++i) {
|
||||
const ObSSTable *table = ddl_sstables_[i];
|
||||
J_OBJ_START();
|
||||
J_KV(K(i), "type", ObITable::get_table_type_name(table->get_key().table_type_),
|
||||
"tablet_id", table->get_key().tablet_id_,
|
||||
"scn_range", table->get_key().scn_range_,
|
||||
"snapshot_version", table->get_snapshot_version(),
|
||||
"max_merge_version", table->get_max_merged_trans_version());
|
||||
J_OBJ_END();
|
||||
J_COMMA();
|
||||
J_OBJ_END();
|
||||
}
|
||||
}
|
||||
for (int64_t i = 0; i < ddl_mem_sstables_.count(); ++i) {
|
||||
ObITable *table = ddl_mem_sstables_[i];
|
||||
if (NULL != table && table->is_sstable()) {
|
||||
BUF_PRINTF("}");
|
||||
|
||||
J_COMMA();
|
||||
BUF_PRINTF("minor_tables:{");
|
||||
if (0 == minor_tables_.count()) {
|
||||
BUF_PRINTF("null");
|
||||
} else {
|
||||
for (int64_t i = 0; i < minor_tables_.count(); ++i) {
|
||||
const ObSSTable *table = minor_tables_[i];
|
||||
if (0 != i) {
|
||||
J_COMMA();
|
||||
}
|
||||
J_OBJ_START();
|
||||
J_KV(K(i), "addr", table->get_addr(),
|
||||
"type", ObITable::get_table_type_name(table->get_key().table_type_),
|
||||
"tablet_id", table->get_key().tablet_id_,
|
||||
"scn_range", table->get_key().scn_range_,
|
||||
"contain_uncommitted_row", table->contain_uncommitted_row() ? "yes" : "no",
|
||||
"max_merge_version", table->get_max_merged_trans_version(),
|
||||
"upper_trans_version", table->get_upper_trans_version());
|
||||
J_OBJ_END();
|
||||
}
|
||||
}
|
||||
BUF_PRINTF("}");
|
||||
|
||||
J_COMMA();
|
||||
BUF_PRINTF("ddl_sstables:{");
|
||||
if (0 == ddl_sstables_.count()) {
|
||||
BUF_PRINTF("null");
|
||||
} else {
|
||||
for (int64_t i = 0; i < ddl_sstables_.count(); ++i) {
|
||||
const ObSSTable *table = ddl_sstables_[i];
|
||||
if (0 != i) {
|
||||
J_COMMA();
|
||||
}
|
||||
J_OBJ_START();
|
||||
J_KV(K(i), "type", ObITable::get_table_type_name(table->get_key().table_type_),
|
||||
"tablet_id", table->get_key().tablet_id_,
|
||||
"scn_range", table->get_key().scn_range_,
|
||||
"ref", table->get_ref(),
|
||||
"max_merge_version", static_cast<ObSSTable *>(table)->get_max_merged_trans_version());
|
||||
"tablet_id", table->get_key().tablet_id_,
|
||||
"scn_range", table->get_key().scn_range_,
|
||||
"max_merge_version", table->get_max_merged_trans_version());
|
||||
J_OBJ_END();
|
||||
}
|
||||
}
|
||||
BUF_PRINTF("}");
|
||||
|
||||
J_COMMA();
|
||||
BUF_PRINTF("ddl_mem_sstables:{");
|
||||
if (0 == ddl_mem_sstables_.count()) {
|
||||
BUF_PRINTF("null");
|
||||
} else {
|
||||
for (int64_t i = 0; i < ddl_mem_sstables_.count(); ++i) {
|
||||
ObITable *table = ddl_mem_sstables_[i];
|
||||
if (NULL != table && table->is_sstable()) {
|
||||
if (0 != i) {
|
||||
J_COMMA();
|
||||
}
|
||||
J_OBJ_START();
|
||||
J_KV(K(i), "type", ObITable::get_table_type_name(table->get_key().table_type_),
|
||||
"tablet_id", table->get_key().tablet_id_,
|
||||
"scn_range", table->get_key().scn_range_,
|
||||
"ref", table->get_ref(),
|
||||
"max_merge_version", static_cast<ObSSTable *>(table)->get_max_merged_trans_version());
|
||||
J_OBJ_END();
|
||||
}
|
||||
}
|
||||
}
|
||||
BUF_PRINTF("}");
|
||||
|
||||
J_COMMA();
|
||||
BUF_PRINTF("meta_major_tables:{");
|
||||
if (0 == meta_major_tables_.count()) {
|
||||
BUF_PRINTF("null");
|
||||
} else {
|
||||
for (int64_t i = 0; i < meta_major_tables_.count(); ++i) {
|
||||
const ObSSTable *table = meta_major_tables_[i];
|
||||
if (0 != i) {
|
||||
J_COMMA();
|
||||
}
|
||||
J_OBJ_START();
|
||||
J_KV(K(i), "type", ObITable::get_table_type_name(table->get_key().table_type_),
|
||||
"tablet_id", table->get_key().tablet_id_,
|
||||
"scn_range", table->get_key().scn_range_,
|
||||
"max_merge_version", table->get_max_merged_trans_version());
|
||||
J_OBJ_END();
|
||||
J_COMMA();
|
||||
}
|
||||
}
|
||||
for (int64_t i = 0; i < meta_major_tables_.count(); ++i) {
|
||||
const ObSSTable *table = meta_major_tables_[i];
|
||||
J_OBJ_START();
|
||||
J_KV(K(i), "type", ObITable::get_table_type_name(table->get_key().table_type_),
|
||||
"tablet_id", table->get_key().tablet_id_,
|
||||
"scn_range", table->get_key().scn_range_,
|
||||
"max_merge_version", table->get_max_merged_trans_version());
|
||||
J_OBJ_END();
|
||||
J_COMMA();
|
||||
}
|
||||
BUF_PRINTF("}");
|
||||
|
||||
J_ARRAY_END();
|
||||
J_COMMA();
|
||||
BUF_PRINTF("memtables_:{");
|
||||
if (0 == memtables_.count()) {
|
||||
BUF_PRINTF("null");
|
||||
} else {
|
||||
for (int64_t i = 0; i < memtables_.count(); ++i) {
|
||||
const memtable::ObIMemtable *memtable = memtables_[i];
|
||||
if (0 != i) {
|
||||
J_COMMA();
|
||||
}
|
||||
J_OBJ_START();
|
||||
J_KV(K(i), KPC(memtable));
|
||||
J_OBJ_END();
|
||||
}
|
||||
}
|
||||
BUF_PRINTF("}");
|
||||
|
||||
J_OBJ_END();
|
||||
J_OBJ_END();
|
||||
}
|
||||
return pos;
|
||||
|
Loading…
x
Reference in New Issue
Block a user