This commit is contained in:
nobody 2025-02-26 06:45:45 +00:00 committed by GitHub
commit ba5ec1afe4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View File

@ -77,7 +77,7 @@ void MemTable::Add(SequenceNumber s, ValueType type, const Slice& key,
const Slice& value) { const Slice& value) {
// Format of an entry is concatenation of: // Format of an entry is concatenation of:
// key_size : varint32 of internal_key.size() // key_size : varint32 of internal_key.size()
// key bytes : char[internal_key.size()] // key bytes : char[key.size()]
// tag : uint64((sequence << 8) | type) // tag : uint64((sequence << 8) | type)
// value_size : varint32 of value.size() // value_size : varint32 of value.size()
// value bytes : char[value.size()] // value bytes : char[value.size()]
@ -106,7 +106,7 @@ bool MemTable::Get(const LookupKey& key, std::string* value, Status* s) {
if (iter.Valid()) { if (iter.Valid()) {
// entry format is: // entry format is:
// klength varint32 // klength varint32
// userkey char[klength] // userkey char[klength - 8]
// tag uint64 // tag uint64
// vlength varint32 // vlength varint32
// value char[vlength] // value char[vlength]

View File

@ -33,11 +33,10 @@ void Footer::EncodeTo(std::string* dst) const {
const size_t original_size = dst->size(); const size_t original_size = dst->size();
metaindex_handle_.EncodeTo(dst); metaindex_handle_.EncodeTo(dst);
index_handle_.EncodeTo(dst); index_handle_.EncodeTo(dst);
dst->resize(2 * BlockHandle::kMaxEncodedLength); // Padding dst->resize(original_size + 2 * BlockHandle::kMaxEncodedLength); // Padding
PutFixed32(dst, static_cast<uint32_t>(kTableMagicNumber & 0xffffffffu)); PutFixed32(dst, static_cast<uint32_t>(kTableMagicNumber & 0xffffffffu));
PutFixed32(dst, static_cast<uint32_t>(kTableMagicNumber >> 32)); PutFixed32(dst, static_cast<uint32_t>(kTableMagicNumber >> 32));
assert(dst->size() == original_size + kEncodedLength); assert(dst->size() == original_size + kEncodedLength);
(void)original_size; // Disable unused variable warning.
} }
Status Footer::DecodeFrom(Slice* input) { Status Footer::DecodeFrom(Slice* input) {