mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-26 07:30:54 +00:00
83833637c1
Summary: The `FileMetaData` objects associated with table files already contain the number of the oldest blob file referenced by the SST in question. This patch adds the inverse mapping to `BlobFileMetaData`, namely the set of table file numbers for which the oldest blob file link points to the given blob file (these are referred to as *linked SSTs*). This mapping will be used by the GC logic. Implementation-wise, the patch builds on the `BlobFileMetaDataDelta` functionality introduced in https://github.com/facebook/rocksdb/pull/6835: newly linked/unlinked SSTs are accumulated in `BlobFileMetaDataDelta`, and the changes to the linked SST set are applied in one shot when the new `Version` is saved. The patch also reworks the blob file related consistency checks in `VersionBuilder` so they validate the consistency of the forward table file -> blob file links and the backward blob file -> table file links for blob files that are part of the `Version`. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6945 Test Plan: `make check` Reviewed By: riversand963 Differential Revision: D21912228 Pulled By: ltamasi fbshipit-source-id: c5bc7acf6e729a8fccbb12672dd5cd00f6f000f8
56 lines
1.5 KiB
C++
56 lines
1.5 KiB
C++
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
// (found in the LICENSE.Apache file in the root directory).
|
|
|
|
#include "db/blob/blob_file_meta.h"
|
|
|
|
#include <ostream>
|
|
#include <sstream>
|
|
|
|
namespace ROCKSDB_NAMESPACE {
|
|
|
|
std::string SharedBlobFileMetaData::DebugString() const {
|
|
std::ostringstream oss;
|
|
oss << (*this);
|
|
|
|
return oss.str();
|
|
}
|
|
|
|
std::ostream& operator<<(std::ostream& os,
|
|
const SharedBlobFileMetaData& shared_meta) {
|
|
os << "blob_file_number: " << shared_meta.GetBlobFileNumber()
|
|
<< " total_blob_count: " << shared_meta.GetTotalBlobCount()
|
|
<< " total_blob_bytes: " << shared_meta.GetTotalBlobBytes()
|
|
<< " checksum_method: " << shared_meta.GetChecksumMethod()
|
|
<< " checksum_value: " << shared_meta.GetChecksumValue();
|
|
|
|
return os;
|
|
}
|
|
|
|
std::string BlobFileMetaData::DebugString() const {
|
|
std::ostringstream oss;
|
|
oss << (*this);
|
|
|
|
return oss.str();
|
|
}
|
|
|
|
std::ostream& operator<<(std::ostream& os, const BlobFileMetaData& meta) {
|
|
const auto& shared_meta = meta.GetSharedMeta();
|
|
assert(shared_meta);
|
|
os << (*shared_meta);
|
|
|
|
os << " linked_ssts: {";
|
|
for (uint64_t file_number : meta.GetLinkedSsts()) {
|
|
os << ' ' << file_number;
|
|
}
|
|
os << " }";
|
|
|
|
os << " garbage_blob_count: " << meta.GetGarbageBlobCount()
|
|
<< " garbage_blob_bytes: " << meta.GetGarbageBlobBytes();
|
|
|
|
return os;
|
|
}
|
|
|
|
} // namespace ROCKSDB_NAMESPACE
|