Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
fix dup test
Browse files Browse the repository at this point in the history
  • Loading branch information
neverchanje committed Nov 4, 2020
1 parent d5a4ca1 commit 02654df
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class load_from_private_log_test : public duplication_test_base
// log.2.xxx starts from 39100
// log.3.xxx starts from 38200
mutation_log_ptr mlog = create_private_log();
ASSERT_NE(mlog, nullptr);
ASSERT_NE(mlog, nullptr) << log_utils::list_files_to_string(open_log_file_map(_log_dir));
auto files = mlog->get_log_file_map();
ASSERT_EQ(files.size(), 2);

Expand Down
7 changes: 4 additions & 3 deletions src/replica/mutation_log_replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,10 @@ namespace replication {
log_file_ptr &log = kv.second;

if (log->start_offset() != end_offset) {
derror("offset mismatch in log file offset and global offset %" PRId64 " vs %" PRId64,
log->start_offset(),
end_offset);
derror_f("offset mismatch in log file ({}) offset and global offset: {} vs {}",
log->path(),
log->start_offset(),
end_offset);
return ERR_INVALID_DATA;
}

Expand Down
15 changes: 15 additions & 0 deletions src/replica/mutation_log_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@ error_s check_log_files_continuity(const std::map<int, log_file_ptr> &logs)
return error_s::ok();
}

/*extern*/ std::string list_files_to_string(const std::map<int, log_file_ptr> &logs)
{
bool first = true;
std::string all_log_files_str;
for (const auto &id_file : logs) {
if (!first) {
all_log_files_str += ", ";
}
first = false;
all_log_files_str +=
fmt::format("log.{}.{}", id_file.second->index(), id_file.second->start_offset());
}
return all_log_files_str;
}

} // namespace log_utils
} // namespace replication
} // namespace dsn
3 changes: 3 additions & 0 deletions src/replica/mutation_log_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ inline error_s check_log_files_continuity(const std::string &dir)
return check_log_files_continuity(log_file_map) << "check_log_files_continuity(dir)";
}

//
extern std::string list_files_to_string(const std::map<int, log_file_ptr> &logs);

} // namespace log_utils
} // namespace replication
} // namespace dsn

0 comments on commit 02654df

Please sign in to comment.