37 if (!reader_.
Open(input_file_)) {
38 AERROR <<
"open input file failed, file: " << input_file_;
44 if (!writer_.
Open(output_file_)) {
45 AERROR <<
"open output file failed. file: " << output_file_;
49 AERROR <<
"write header to output file failed. file: " << output_file_;
56 FOR_EACH(i, 0, index.indexes_size()) {
58 if (single_index->
type() != SectionType::SECTION_CHANNEL) {
61 ChannelCache* chan_cache = single_index->mutable_channel_cache();
62 if (std::find(channel_vec_.begin(), channel_vec_.end(),
63 chan_cache->
name()) == channel_vec_.end()) {
64 channel_vec_.push_back(chan_cache->
name());
66 chan.set_name(chan_cache->
name());
79 AINFO <<
"read section failed, try next.";
82 if (section.
type == SectionType::SECTION_INDEX) {
85 switch (section.
type) {
86 case SectionType::SECTION_CHANNEL: {
89 AINFO <<
"one channel section broken, skip it.";
92 if (std::find(channel_vec_.begin(), channel_vec_.end(), chan.
name()) ==
94 channel_vec_.push_back(chan.
name());
99 case SectionType::SECTION_CHUNK_HEADER: {
102 AINFO <<
"one chunk header section broken, skip it.";
106 case SectionType::SECTION_CHUNK_BODY: {
109 AINFO <<
"one chunk body section broken, skip it";
112 for (
int idx = 0; idx < cbd.messages_size(); ++idx) {
114 AERROR <<
"add new message failed.";
121 AERROR <<
"this section should not be here, section type: "
127 AINFO <<
"recover record file done.";
repeated SingleMessage messages