jt2594838 commented on code in PR #192:
URL: https://github.com/apache/tsfile/pull/192#discussion_r1730633564
##########
cpp/test/writer/tsfile_writer_test.cc:
##########
@@ -221,7 +222,80 @@ TEST_F(TsFileWriterTest, WriteMultipleRecords) {
DataPoint point(measurement_name, (int32_t)i);
record.append_data_point(point);
ASSERT_EQ(tsfile_writer_->write_record(record), E_OK);
+ ASSERT_EQ(tsfile_writer_->flush(), E_OK);
+ }
+ ASSERT_EQ(tsfile_writer_->close(), E_OK);
+}
+
+TEST_F(TsFileWriterTest, WriteMultipleTabletsMultiFlush) {
+ const int device_num = 20;
+ const int measurement_num = 20;
+ int max_rows = 100;
+ std::vector<std::vector<MeasurementSchema>> schema_vecs(
+ device_num, std::vector<MeasurementSchema>(measurement_num));
+ for (int i = 0; i < device_num; i++) {
+ std::string device_name = "test_device" + std::to_string(i);
+ for (int j = 0; j < measurement_num; j++) {
+ std::string measure_name = "measurement" + std::to_string(j);
+ schema_vecs[i][j] =
+ MeasurementSchema(measure_name, common::TSDataType::INT32,
+ common::TSEncoding::PLAIN,
+ common::CompressionType::UNCOMPRESSED);
+ tsfile_writer_->register_timeseries(
+ device_name, measure_name, common::TSDataType::INT32,
+ common::TSEncoding::PLAIN,
+ common::CompressionType::UNCOMPRESSED);
+ }
+ }
+
+ for (int row = 0; row < max_rows; row++) {
+ for (int i = 0; i < device_num; i++) {
+ std::string device_name = "test_device" + std::to_string(i);
+ Tablet tablet(device_name, &schema_vecs[i], max_rows);
+ tablet.init();
+ for (int j = 0; j < measurement_num; j++) {
+ tablet.set_timestamp(row, 16225600000 + row * 100);
+ tablet.set_value(row, j, static_cast<int32_t>(row));
+ }
+ ASSERT_EQ(tsfile_writer_->write_tablet(tablet), E_OK);
+ }
+ ASSERT_EQ(tsfile_writer_->flush(), E_OK);
+ }
Review Comment:
max_rows should be the inner loop. Otherwise, each tablet will only have one
row but will be declared with max_rows rows.
##########
cpp/src/writer/page_writer.cc:
##########
@@ -147,7 +128,7 @@ void PageWriter::destroy() {
EncoderFactory::free(time_encoder_);
EncoderFactory::free(value_encoder_);
StatisticFactory::free(statistic_);
- compressor_->destroy();
+ // compressor_->destroy();
CompressorFactory::free(compressor_);
Review Comment:
Just remove it.
--
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]