36 std::string
Key(
int i) {
38 snprintf(buf,
sizeof(buf),
"key%06d", i);
39 return std::string(buf);
43 Range r(start, limit);
59 std::string value(kValueSize,
'x');
63 for (
int i = 0; i <
kCount; i++) {
69 for (
int i = 0; i <
kCount; i++) {
75 const int64_t initial_size =
Size(
Key(0),
Key(n));
76 const int64_t initial_other_size =
Size(
Key(n),
Key(kCount));
79 std::string limit_key =
Key(n);
80 for (
int read = 0;
true; read++) {
81 ASSERT_LT(read, 100) <<
"Taking too long to compact";
92 fprintf(stderr,
"iter %3d => %7.3f MB [other %7.3f MB]\n",
93 read+1, size/1048576.0,
Size(
Key(n),
Key(kCount))/1048576.0);
94 if (size <= initial_size/10) {
101 const int64_t final_other_size =
Size(
Key(n),
Key(kCount));
102 ASSERT_LE(final_other_size, initial_other_size + 1048576);
103 ASSERT_GE(final_other_size, initial_other_size/5 - 1048576);
116 int main(
int argc,
char** argv) {
static const int kTotalSize
uint64_t Size(const Slice &start, const Slice &limit)
int main(int argc, char **argv)
virtual Slice key() const =0
virtual void SleepForMicroseconds(int micros)=0
virtual void SeekToFirst()=0
std::string ToString() const
static const int kValueSize
virtual Status Put(const WriteOptions &options, const Slice &key, const Slice &value)=0
Status DestroyDB(const std::string &dbname, const Options &options)
virtual Status Delete(const WriteOptions &options, const Slice &key)=0
static Status Open(const Options &options, const std::string &name, DB **dbptr)
Status TEST_CompactMemTable()
TEST(AutoCompactTest, ReadAll)
virtual void GetApproximateSizes(const Range *range, int n, uint64_t *sizes)=0
Cache * NewLRUCache(size_t capacity)
virtual Iterator * NewIterator(const ReadOptions &options)=0
virtual bool Valid() const =0
CompressionType compression