jt2594838 commented on code in PR #731:
URL: https://github.com/apache/tsfile/pull/731#discussion_r2893466735
##########
cpp/src/writer/tsfile_writer.cc:
##########
@@ -113,11 +115,50 @@ int TsFileWriter::init(WriteFile* write_file) {
}
write_file_ = write_file;
write_file_created_ = false;
+ io_writer_owned_ = true;
io_writer_ = new TsFileIOWriter();
io_writer_->init(write_file_);
return E_OK;
}
+int TsFileWriter::init(RestorableTsFileIOWriter* rw) {
+ // Initialize from a recovered writer: take schema from file, do not own
+ // io_writer_
+ if (rw == nullptr) {
+ return E_INVALID_ARG;
+ }
+ if (!rw->can_write()) {
+ return E_INVALID_ARG;
+ }
+ write_file_ = rw->get_write_file();
+ write_file_created_ = false;
+ io_writer_owned_ = false;
+ io_writer_ = rw; // RestorableTsFileIOWriter is also a TsFileIOWriter
+ std::shared_ptr<Schema> known = rw->get_known_schema();
+ for (const auto& kv : known->table_schema_map_) {
+ const std::string& table_name = kv.first;
+ const std::shared_ptr<TableSchema>& ts = kv.second;
+ if (!ts || ts->get_measurement_names().empty()) {
+ continue;
+ }
+ auto device_id = std::make_shared<StringArrayDeviceID>(table_name);
+ auto* ms_group = new MeasurementSchemaGroup;
Review Comment:
Why "table_name is used as device key"
--
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]