提交 c9c93592 编写于 作者: Y Yueh-Hsuan Chiang

Move the check to the beginning of the loop in VersionEdit::EncodeTo()

上级 2110e43a
......@@ -98,6 +98,9 @@ bool VersionEdit::EncodeTo(std::string* dst) const {
for (size_t i = 0; i < new_files_.size(); i++) {
const FileMetaData& f = new_files_[i].second;
if (!f.smallest.Valid() || !f.largest.Valid()) {
return false;
}
if (f.fd.GetPathId() == 0) {
// Use older format to make sure user can roll back the build if they
// don't config multiple DB paths.
......@@ -111,9 +114,6 @@ bool VersionEdit::EncodeTo(std::string* dst) const {
PutVarint32(dst, f.fd.GetPathId());
}
PutVarint64(dst, f.fd.GetFileSize());
if (!f.smallest.Valid() || !f.largest.Valid()) {
return false;
}
PutLengthPrefixedSlice(dst, f.smallest.Encode());
PutLengthPrefixedSlice(dst, f.largest.Encode());
PutVarint64(dst, f.smallest_seqno);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册