提交 468e92a4 编写于 作者: M michael4338 提交者: Xiangquan Xiao

Tools: smart recorder bug fixes

上级 04022954
......@@ -3,9 +3,9 @@ syntax = "proto2";
package apollo.data;
message RecordSegmentSetting {
// Segmentation of restored records in size or time, default is by size 200MB
optional int32 size_segment = 1 [default = 200];
optional int32 time_segment = 2;
// Segmentation of restored records in size or time
optional int32 size_segment = 1 [default = 500];
optional int32 time_segment = 2 [default = 180];
}
message Trigger {
......
......@@ -42,14 +42,14 @@ namespace {
using apollo::common::Header;
using apollo::common::util::StrCat;
using cyber::CreateNode;
using cyber::common::EnsureDirectory;
using cyber::common::GetFileName;
using cyber::common::PathExists;
using cyber::CreateNode;
using cyber::record::HeaderBuilder;
using cyber::record::Recorder;
using cyber::record::RecordFileReader;
using cyber::record::RecordMessage;
using cyber::record::RecordFileReader;
using cyber::record::RecordReader;
using cyber::record::RecordViewer;
......@@ -202,7 +202,7 @@ void RealtimeRecordProcessor::PublishStatus(const RecordingState state,
}
bool RealtimeRecordProcessor::GetNextValidRecord(
std::string* record_path) const {
std::string* const record_path) const {
*record_path = StrCat(source_record_dir_, "/", default_output_filename_, ".",
GetNextRecordFileName(*record_path));
while (!is_terminating_ && !IsRecordValid(*record_path)) {
......@@ -223,12 +223,13 @@ void RealtimeRecordProcessor::RestoreMessage(const uint64_t message_time) {
const uint64_t target_end = std::max(
interval.end_time,
message_time - static_cast<uint64_t>(max_backward_time_ * 1000000000UL));
if (target_end <=
restore_reader_time_ +
static_cast<uint64_t>(min_restore_chunk_ * 1000000000UL)) {
const bool small_channels_only = restore_reader_time_ >= interval.end_time;
if (small_channels_only &&
target_end <=
restore_reader_time_ +
static_cast<uint64_t>(min_restore_chunk_ * 1000000000UL)) {
return;
}
const bool small_channels_only = interval.end_time == 0;
do {
if (!IsRecordValid(restore_path_)) {
AWARN << "invalid restore path " << restore_path_ << ", exit";
......
......@@ -54,9 +54,9 @@ bool RecordProcessor::Init(const SmartRecordTrigger& trigger_conf) {
// Init writer
writer_.reset(new RecordWriter());
writer_->SetIntervalOfFileSegmentation(
trigger_conf.segment_setting().size_segment() * 1024UL);
trigger_conf.segment_setting().time_segment());
writer_->SetSizeOfFileSegmentation(
trigger_conf.segment_setting().time_segment() * 1000000000UL);
trigger_conf.segment_setting().size_segment() * 1024UL);
const std::string output_file = GetDefaultOutputFile();
AINFO << "output file path: " << output_file;
if (!writer_->Open(output_file)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册