mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
A number of fixes:
- Replace raw slice comparison with a call to user comparator.
Added test for custom comparators.
- Fix end of namespace comments.
- Fixed bug in picking inputs for a level-0 compaction.
When finding overlapping files, the covered range may expand
as files are added to the input set. We now correctly expand
the range when this happens instead of continuing to use the
old range. For example, suppose L0 contains files with the
following ranges:
F1: a .. d
F2: c .. g
F3: f .. j
and the initial compaction target is F3. We used to search
for range f..j which yielded {F2,F3}. However we now expand
the range as soon as another file is added. In this case,
when F2 is added, we expand the range to c..j and restart the
search. That picks up file F1 as well.
This change fixes a bug related to deleted keys showing up
incorrectly after a compaction as described in Issue 44.
(Sync with upstream @25072954)
This commit is contained in:
@@ -65,4 +65,4 @@ char* Arena::AllocateNewBlock(size_t block_bytes) {
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
@@ -63,6 +63,6 @@ inline char* Arena::Allocate(size_t bytes) {
|
||||
return AllocateFallback(bytes);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
#endif // STORAGE_LEVELDB_UTIL_ARENA_H_
|
||||
|
||||
@@ -61,7 +61,7 @@ TEST(ArenaTest, Simple) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
return leveldb::test::RunAllTests();
|
||||
|
||||
@@ -325,4 +325,4 @@ Cache* NewLRUCache(size_t capacity) {
|
||||
return new ShardedLRUCache(capacity);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
@@ -179,7 +179,7 @@ TEST(CacheTest, NewId) {
|
||||
ASSERT_NE(a, b);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
return leveldb::test::RunAllTests();
|
||||
|
||||
@@ -191,4 +191,4 @@ bool GetLengthPrefixedSlice(Slice* input, Slice* result) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
@@ -99,6 +99,6 @@ inline const char* GetVarint32Ptr(const char* p,
|
||||
return GetVarint32PtrFallback(p, limit, value);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
#endif // STORAGE_LEVELDB_UTIL_CODING_H_
|
||||
|
||||
@@ -166,7 +166,7 @@ TEST(Coding, Strings) {
|
||||
ASSERT_EQ("", input.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
return leveldb::test::RunAllTests();
|
||||
|
||||
@@ -63,11 +63,11 @@ class BytewiseComparatorImpl : public Comparator {
|
||||
// *key is a run of 0xffs. Leave it alone.
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
static const BytewiseComparatorImpl bytewise;
|
||||
|
||||
const Comparator* BytewiseComparator() {
|
||||
return &bytewise;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
@@ -328,5 +328,5 @@ uint32_t Extend(uint32_t crc, const char* buf, size_t size) {
|
||||
return l ^ 0xffffffffu;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace crc32c
|
||||
} // namespace leveldb
|
||||
|
||||
@@ -39,7 +39,7 @@ inline uint32_t Unmask(uint32_t masked_crc) {
|
||||
return ((rot >> 17) | (rot << 15));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace crc32c
|
||||
} // namespace leveldb
|
||||
|
||||
#endif // STORAGE_LEVELDB_UTIL_CRC32C_H_
|
||||
|
||||
@@ -64,8 +64,8 @@ TEST(CRC, Mask) {
|
||||
ASSERT_EQ(crc, Unmask(Unmask(Mask(Mask(crc)))));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace crc32c
|
||||
} // namespace leveldb
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
return leveldb::test::RunAllTests();
|
||||
|
||||
@@ -79,4 +79,4 @@ Status ReadFileToString(Env* env, const std::string& fname, std::string* data) {
|
||||
EnvWrapper::~EnvWrapper() {
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
@@ -553,7 +553,7 @@ void PosixEnv::StartThread(void (*function)(void* arg), void* arg) {
|
||||
pthread_create(&t, NULL, &StartThreadWrapper, state));
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace
|
||||
|
||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
static Env* default_env;
|
||||
@@ -564,4 +564,4 @@ Env* Env::Default() {
|
||||
return default_env;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
@@ -95,7 +95,7 @@ TEST(EnvPosixTest, StartThread) {
|
||||
ASSERT_EQ(state.val, 3);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
return leveldb::test::RunAllTests();
|
||||
|
||||
@@ -42,4 +42,4 @@ uint32_t Hash(const char* data, size_t n, uint32_t seed) {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
@@ -136,4 +136,4 @@ std::string Histogram::ToString() const {
|
||||
return r;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
@@ -37,6 +37,6 @@ class Histogram {
|
||||
double StandardDeviation() const;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
#endif // STORAGE_LEVELDB_UTIL_HISTOGRAM_H_
|
||||
|
||||
@@ -78,4 +78,4 @@ bool ConsumeDecimalNumber(Slice* in, uint64_t* val) {
|
||||
return (digits > 0);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
@@ -42,6 +42,6 @@ extern bool ConsumeChar(Slice* in, char c);
|
||||
// unspecified state.
|
||||
extern bool ConsumeDecimalNumber(Slice* in, uint64_t* val);
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
#endif // STORAGE_LEVELDB_UTIL_LOGGING_H_
|
||||
|
||||
@@ -33,7 +33,7 @@ class MutexLock {
|
||||
void operator=(const MutexLock&);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
|
||||
#endif // STORAGE_LEVELDB_UTIL_MUTEXLOCK_H_
|
||||
|
||||
@@ -25,4 +25,4 @@ Options::Options()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
@@ -93,6 +93,6 @@ class PosixLogger : public Logger {
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
#endif // STORAGE_LEVELDB_UTIL_POSIX_LOGGER_H_
|
||||
|
||||
@@ -54,6 +54,6 @@ class Random {
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
#endif // STORAGE_LEVELDB_UTIL_RANDOM_H_
|
||||
|
||||
@@ -72,4 +72,4 @@ std::string Status::ToString() const {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace leveldb
|
||||
|
||||
@@ -73,5 +73,5 @@ int RandomSeed() {
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace leveldb
|
||||
|
||||
@@ -132,7 +132,7 @@ void TCONCAT(_Test_,name)::_Run()
|
||||
extern bool RegisterTest(const char* base, const char* name, void (*func)());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace leveldb
|
||||
|
||||
#endif // STORAGE_LEVELDB_UTIL_TESTHARNESS_H_
|
||||
|
||||
@@ -47,5 +47,5 @@ extern Slice CompressibleString(Random* rnd, double compressed_fraction,
|
||||
return Slice(*dst);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace leveldb
|
||||
|
||||
@@ -47,7 +47,7 @@ class ErrorEnv : public EnvWrapper {
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace test
|
||||
} // namespace leveldb
|
||||
|
||||
#endif // STORAGE_LEVELDB_UTIL_TESTUTIL_H_
|
||||
|
||||
Reference in New Issue
Block a user