761417898 commented on code in PR #345:
URL: https://github.com/apache/tsfile/pull/345#discussion_r1919757346
##########
cpp/src/common/tsfile_common.h:
##########
@@ -868,6 +886,8 @@ struct TsFileMeta {
return ret;
}
+ int serialize_to_table_model(common::ByteStream &out);
Review Comment:
fixed
##########
cpp/src/file/tsfile_io_writer.cc:
##########
@@ -405,30 +417,67 @@ int TsFileIOWriter::write_file_index() {
}
if (IS_SUCC(ret)) {
- MetaIndexNode *device_index_root_node = nullptr;
- if (RET_FAIL(build_device_level(device_map, device_index_root_node,
- writing_mm))) {
+ if (!generate_table_schema_) {
+ MetaIndexNode *device_index_root_node = nullptr;
+ if (RET_FAIL(build_device_level(device_map, device_index_root_node,
+ writing_mm))) {
+ } else {
+ TsFileMeta tsfile_meta;
+ tsfile_meta.index_node_ = device_index_root_node;
+ tsfile_meta.meta_offset_ = meta_offset;
+ tsfile_meta.bloom_filter_ = &filter;
+ int64_t tsfile_meta_offset = cur_file_position();
+ uint32_t size = 0; // cppcheck-suppress unreadVariable
+ OFFSET_DEBUG("before tsfile_meta written");
+ if (RET_FAIL(tsfile_meta.serialize_to(write_stream_))) {
+ } else if (RET_FAIL(filter.serialize_to(write_stream_))) {
+ } else {
+ int64_t tsfile_meta_end_offset = cur_file_position();
+ size =
+ (uint32_t)(tsfile_meta_end_offset -
tsfile_meta_offset);
+ ret = SerializationUtil::write_ui32(size, write_stream_);
+ }
+#if DEBUG_SE
+ std::cout << "writer tsfile_meta: " << tsfile_meta
+ << ", tsfile_meta_offset=" << tsfile_meta_offset
+ << ", size=" << size << std::endl;
+#endif
+ tsfile_meta.index_node_ =
+ nullptr; // memory management is delegated to writing_mm
+ tsfile_meta.bloom_filter_ = nullptr;
+ }
} else {
Review Comment:
fixed
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]