From 9b6af8c5a1cd42ab3cd17a4b7e97db5c947337c5 Mon Sep 17 00:00:00 2001 From: hiddenbomb Date: Wed, 7 Feb 2024 08:26:07 +0000 Subject: [PATCH] optimize tablet to string --- src/storage/tablet/ob_tablet.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/storage/tablet/ob_tablet.cpp b/src/storage/tablet/ob_tablet.cpp index 4d7c5a0a0..c2b90831f 100644 --- a/src/storage/tablet/ob_tablet.cpp +++ b/src/storage/tablet/ob_tablet.cpp @@ -5886,38 +5886,28 @@ int ObTablet::build_transfer_tablet_param( int64_t ObTablet::to_string(char *buf, const int64_t buf_len) const { int64_t pos = 0; - if (OB_ISNULL(buf) || buf_len <= 0) { - // do nothing + if (OB_ISNULL(buf) || OB_UNLIKELY(buf_len <= 0)) { + // do nothing } else { J_OBJ_START(); - J_NAME("ObTablet"); - J_COLON(); J_KV(KP(this), + K_(is_inited), K_(wash_score), + K_(hold_ref_cnt), K_(ref_cnt), K_(version), K_(length), K_(tablet_addr), KP_(allocator), K_(tablet_meta), - K_(table_store_cache), - KP_(ddl_kvs), - K_(ddl_kv_count), K_(table_store_addr), K_(storage_schema_addr), K_(macro_info_addr), - K_(next_tablet_guard), - K_(pointer_hdl), - KP_(next_tablet), - KP_(log_handler), - KPC_(rowkey_read_info), K_(mds_data), - K_(hold_ref_cnt), - K_(is_inited), - K_(memtable_count)); + KP_(ddl_kvs), + K_(ddl_kv_count)); J_COMMA(); - BUF_PRINTF("memtables"); - J_COLON(); + BUF_PRINTF("memtables:"); J_ARRAY_START(); for (int64_t i = 0; i < MAX_MEMSTORE_CNT; ++i) { if (i > 0) { @@ -5926,6 +5916,8 @@ int64_t ObTablet::to_string(char *buf, const int64_t buf_len) const BUF_PRINTO(OB_P(memtables_[i])); } J_ARRAY_END(); + J_COMMA(); + J_KV(K_(memtable_count)); J_OBJ_END(); } return pos;