761417898 commented on code in PR #522: URL: https://github.com/apache/tsfile/pull/522#discussion_r2163257761
########## cpp/src/file/tsfile_io_reader.cc: ########## @@ -280,42 +316,11 @@ int TsFileIOReader::load_device_index_entry( } int TsFileIOReader::load_measurement_index_entry( - const std::string &measurement_name_str, int64_t start_offset, - int64_t end_offset, std::shared_ptr<IMetaIndexEntry> &ret_measurement_index_entry, + const std::string &measurement_name_str, std::shared_ptr<MetaIndexNode> top_node, + std::shared_ptr<IMetaIndexEntry> &ret_measurement_index_entry, int64_t &ret_end_offset) { -#if DEBUG_SE - std::cout << "load_measurement_index_entry: measurement_name_str=" - << measurement_name_str << ", start_offset=" << start_offset - << ", end_offset=" << end_offset << std::endl; -#endif - ASSERT(start_offset < end_offset); int ret = E_OK; - - // 1. load top measuremnt_index_node - PageArena pa; - pa.init(512, MOD_TSFILE_READER); - const int32_t read_size = (int32_t) (end_offset - start_offset); - int32_t ret_read_len = 0; - char *data_buf = (char *) pa.alloc(read_size); - void *m_idx_node_buf = pa.alloc(sizeof(MetaIndexNode)); - if (IS_NULL(data_buf) || IS_NULL(m_idx_node_buf)) { - return E_OOM; - } - auto *top_node_ptr = new(m_idx_node_buf) MetaIndexNode(&pa); - auto top_node = std::shared_ptr<MetaIndexNode>( - top_node_ptr, MetaIndexNode::self_deleter); - - if (RET_FAIL(read_file_->read(start_offset, data_buf, read_size, - ret_read_len))) { - } else if (RET_FAIL(top_node->deserialize_from(data_buf, read_size))) { - } -#if DEBUG_SE - std::cout - << "load_measurement_index_entry deserialize MetaIndexNode, top_node=" - << *top_node << " at file pos " << start_offset << " to " << end_offset - << std::endl; -#endif - // 2. search from top_node in top-down way + // search from top_node in top-down way if (IS_SUCC(ret)) { Review Comment: removed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@tsfile.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org