fix compilation with g++ option `-Wsuggest-override` (#4272)

Summary:
Fixes compilation warnings (which are turned into compilation errors by default) when compiling with g++ option `-Wsuggest-override`.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4272

Differential Revision: D9322556

Pulled By: siying

fbshipit-source-id: abd57a29ec8f544bee77c0bb438f31be830b7244
main
jsteemann 6 years ago committed by Facebook Github Bot
parent bf07e90cf2
commit 33ad9060d3
  1. 24
      db/range_del_aggregator.cc
  2. 2
      db/snapshot_checker.h
  3. 10
      util/testutil.h
  4. 10
      utilities/env_mirror.cc
  5. 10
      utilities/persistent_cache/persistent_cache_tier.h

@ -50,7 +50,7 @@ class UncollapsedRangeDelMap : public RangeDelMap {
: rep_(TombstoneStartKeyComparator(ucmp)), ucmp_(ucmp) {}
bool ShouldDelete(const ParsedInternalKey& parsed,
RangeDelPositioningMode mode) {
RangeDelPositioningMode mode) override {
(void)mode;
assert(mode == RangeDelPositioningMode::kFullScan);
for (const auto& tombstone : rep_) {
@ -65,7 +65,7 @@ class UncollapsedRangeDelMap : public RangeDelMap {
return false;
}
bool IsRangeOverlapped(const Slice& start, const Slice& end) {
bool IsRangeOverlapped(const Slice& start, const Slice& end) override {
for (const auto& tombstone : rep_) {
if (ucmp_->Compare(start, tombstone.end_key_) < 0 &&
ucmp_->Compare(tombstone.start_key_, end) <= 0 &&
@ -76,13 +76,13 @@ class UncollapsedRangeDelMap : public RangeDelMap {
return false;
}
void AddTombstone(RangeTombstone tombstone) { rep_.emplace(tombstone); }
void AddTombstone(RangeTombstone tombstone) override { rep_.emplace(tombstone); }
size_t Size() const { return rep_.size(); }
size_t Size() const override { return rep_.size(); }
void InvalidatePosition() {} // no-op
void InvalidatePosition() override {} // no-op
std::unique_ptr<RangeDelIterator> NewIterator() {
std::unique_ptr<RangeDelIterator> NewIterator() override {
return std::unique_ptr<RangeDelIterator>(new Iterator(this->rep_));
}
};
@ -176,7 +176,7 @@ class CollapsedRangeDelMap : public RangeDelMap {
}
bool ShouldDelete(const ParsedInternalKey& parsed,
RangeDelPositioningMode mode) {
RangeDelPositioningMode mode) override {
if (iter_ == rep_.end() &&
(mode == RangeDelPositioningMode::kForwardTraversal ||
mode == RangeDelPositioningMode::kBackwardTraversal)) {
@ -227,14 +227,14 @@ class CollapsedRangeDelMap : public RangeDelMap {
return parsed.sequence < iter_->second;
}
bool IsRangeOverlapped(const Slice&, const Slice&) {
bool IsRangeOverlapped(const Slice&, const Slice&) override {
// Unimplemented because the only client of this method, file ingestion,
// uses uncollapsed maps.
fprintf(stderr, "CollapsedRangeDelMap::IsRangeOverlapped unimplemented");
abort();
}
void AddTombstone(RangeTombstone t) {
void AddTombstone(RangeTombstone t) override {
if (ucmp_->Compare(t.start_key_, t.end_key_) >= 0 || t.seq_ == 0) {
// The tombstone covers no keys. Nothing to do.
return;
@ -344,11 +344,11 @@ class CollapsedRangeDelMap : public RangeDelMap {
}
}
size_t Size() const { return rep_.size() - 1; }
size_t Size() const override { return rep_.size() - 1; }
void InvalidatePosition() { iter_ = rep_.end(); }
void InvalidatePosition() override { iter_ = rep_.end(); }
std::unique_ptr<RangeDelIterator> NewIterator() {
std::unique_ptr<RangeDelIterator> NewIterator() override {
return std::unique_ptr<RangeDelIterator>(new Iterator(this->rep_));
}
};

@ -20,7 +20,7 @@ class DisableGCSnapshotChecker : public SnapshotChecker {
public:
virtual ~DisableGCSnapshotChecker() {}
virtual bool IsInSnapshot(SequenceNumber /*sequence*/,
SequenceNumber /*snapshot_sequence*/) const {
SequenceNumber /*snapshot_sequence*/) const override {
// By returning false, we prevent all the values from being GCed
return false;
}

@ -247,7 +247,7 @@ class RandomRWStringSink : public RandomRWFile {
public:
explicit RandomRWStringSink(StringSink* ss) : ss_(ss) {}
Status Write(uint64_t offset, const Slice& data) {
Status Write(uint64_t offset, const Slice& data) override {
if (offset + data.size() > ss_->contents_.size()) {
ss_->contents_.resize(offset + data.size(), '\0');
}
@ -258,7 +258,7 @@ class RandomRWStringSink : public RandomRWFile {
}
Status Read(uint64_t offset, size_t n, Slice* result,
char* /*scratch*/) const {
char* /*scratch*/) const override {
*result = Slice(nullptr, 0);
if (offset < ss_->contents_.size()) {
size_t str_res_sz =
@ -268,11 +268,11 @@ class RandomRWStringSink : public RandomRWFile {
return Status::OK();
}
Status Flush() { return Status::OK(); }
Status Flush() override { return Status::OK(); }
Status Sync() { return Status::OK(); }
Status Sync() override { return Status::OK(); }
Status Close() { return Status::OK(); }
Status Close() override { return Status::OK(); }
const std::string& contents() const { return ss_->contents(); }

@ -20,7 +20,7 @@ class SequentialFileMirror : public SequentialFile {
std::string fname;
explicit SequentialFileMirror(std::string f) : fname(f) {}
Status Read(size_t n, Slice* result, char* scratch) {
Status Read(size_t n, Slice* result, char* scratch) override {
Slice aslice;
Status as = a_->Read(n, &aslice, scratch);
if (as == Status::OK()) {
@ -44,13 +44,13 @@ class SequentialFileMirror : public SequentialFile {
return as;
}
Status Skip(uint64_t n) {
Status Skip(uint64_t n) override {
Status as = a_->Skip(n);
Status bs = b_->Skip(n);
assert(as == bs);
return as;
}
Status InvalidateCache(size_t offset, size_t length) {
Status InvalidateCache(size_t offset, size_t length) override {
Status as = a_->InvalidateCache(offset, length);
Status bs = b_->InvalidateCache(offset, length);
assert(as == bs);
@ -64,7 +64,7 @@ class RandomAccessFileMirror : public RandomAccessFile {
std::string fname;
explicit RandomAccessFileMirror(std::string f) : fname(f) {}
Status Read(uint64_t offset, size_t n, Slice* result, char* scratch) const {
Status Read(uint64_t offset, size_t n, Slice* result, char* scratch) const override {
Status as = a_->Read(offset, n, result, scratch);
if (as == Status::OK()) {
char* bscratch = new char[n];
@ -86,7 +86,7 @@ class RandomAccessFileMirror : public RandomAccessFile {
return as;
}
size_t GetUniqueId(char* id, size_t max_size) const {
size_t GetUniqueId(char* id, size_t max_size) const override {
// NOTE: not verified
return a_->GetUniqueId(id, max_size);
}

@ -251,20 +251,20 @@ class PersistentCacheTier : public PersistentCache {
// Print stats to string recursively
virtual std::string PrintStats();
virtual PersistentCache::StatsType Stats();
virtual PersistentCache::StatsType Stats() override;
// Insert to page cache
virtual Status Insert(const Slice& page_key, const char* data,
const size_t size) = 0;
const size_t size) override = 0;
// Lookup page cache by page identifier
virtual Status Lookup(const Slice& page_key, std::unique_ptr<char[]>* data,
size_t* size) = 0;
size_t* size) override = 0;
// Does it store compressed data ?
virtual bool IsCompressed() = 0;
virtual bool IsCompressed() override = 0;
virtual std::string GetPrintableOptions() const = 0;
virtual std::string GetPrintableOptions() const override = 0;
// Return a reference to next tier
virtual Tier& next_tier() { return next_tier_; }

Loading…
Cancel
Save