Moving memtable related files from util to a new directory memtable

Summary:
We are cleaning up dependencies.
This diff takes a first step at moving memtable files to their own
directory called memtable. In future diffs, we will move other memtable
files from db to memtable.

Test Plan: make check

Reviewers: sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D48915
This commit is contained in:
Venkatesh Radhakrishnan 2015-10-16 14:10:33 -07:00
parent 8f143e03fb
commit a98fbacfa0
21 changed files with 59 additions and 38 deletions

View File

@ -131,6 +131,9 @@ set(SOURCES
db/write_batch_base.cc
db/write_controller.cc
db/write_thread.cc
memtable/hash_cuckoo_rep.cc
memtable/hash_linklist_rep.cc
memtable/hash_skiplist_rep.cc
port/stack_trace.cc
port/win/env_win.cc
port/win/port_win.cc
@ -185,9 +188,6 @@ set(SOURCES
util/file_reader_writer.cc
util/filter_policy.cc
util/hash.cc
util/hash_cuckoo_rep.cc
util/hash_linklist_rep.cc
util/hash_skiplist_rep.cc
util/histogram.cc
util/instrumented_mutex.cc
util/iostats_context.cc

View File

@ -27,9 +27,9 @@
#include "db/version_set.h"
#include "db/write_controller.h"
#include "db/writebuffer.h"
#include "memtable/hash_skiplist_rep.h"
#include "util/autovector.h"
#include "util/compression.h"
#include "util/hash_skiplist_rep.h"
#include "util/options_helper.h"
#include "util/thread_status_util.h"
#include "util/xfunc.h"

View File

@ -27,6 +27,7 @@
#include "db/job_context.h"
#include "db/version_set.h"
#include "db/write_batch_internal.h"
#include "memtable/hash_linklist_rep.h"
#include "port/stack_trace.h"
#include "rocksdb/cache.h"
#include "rocksdb/compaction_filter.h"
@ -50,7 +51,6 @@
#include "table/scoped_arena_iterator.h"
#include "util/compression.h"
#include "util/hash.h"
#include "util/hash_linklist_rep.h"
#include "util/logging.h"
#include "util/mock_env.h"
#include "util/mutexlock.h"

View File

@ -7,10 +7,11 @@
#include <map>
#include <string>
#include "memtable/stl_wrappers.h"
#include "rocksdb/db.h"
#include "rocksdb/env.h"
#include "util/hash.h"
#include "util/stl_wrappers.h"
#include "util/kv_map.h"
#include "util/string_util.h"
#include "util/testharness.h"
#include "util/testutil.h"

View File

@ -50,6 +50,8 @@
#include "db/write_batch_internal.h"
#include "db/write_callback.h"
#include "db/writebuffer.h"
#include "memtable/hash_linklist_rep.h"
#include "memtable/hash_skiplist_rep.h"
#include "port/likely.h"
#include "port/port.h"
#include "rocksdb/cache.h"
@ -77,8 +79,6 @@
#include "util/db_info_dumper.h"
#include "util/file_reader_writer.h"
#include "util/file_util.h"
#include "util/hash_linklist_rep.h"
#include "util/hash_skiplist_rep.h"
#include "util/iostats_context_imp.h"
#include "util/log_buffer.h"
#include "util/logging.h"

View File

@ -30,6 +30,7 @@
#include "db/job_context.h"
#include "db/version_set.h"
#include "db/write_batch_internal.h"
#include "memtable/hash_linklist_rep.h"
#include "port/stack_trace.h"
#include "rocksdb/cache.h"
#include "rocksdb/compaction_filter.h"
@ -57,7 +58,6 @@
#include "table/scoped_arena_iterator.h"
#include "util/file_reader_writer.h"
#include "util/hash.h"
#include "util/hash_linklist_rep.h"
#include "utilities/merge_operators.h"
#include "util/logging.h"
#include "util/compression.h"

View File

@ -30,6 +30,7 @@
#include "db/db_test_util.h"
#include "db/dbformat.h"
#include "db/filename.h"
#include "memtable/hash_linklist_rep.h"
#include "rocksdb/cache.h"
#include "rocksdb/compaction_filter.h"
#include "rocksdb/convenience.h"
@ -45,7 +46,6 @@
#include "table/plain_table_factory.h"
#include "table/scoped_arena_iterator.h"
#include "util/compression.h"
#include "util/hash_linklist_rep.h"
#include "util/mock_env.h"
#include "util/mutexlock.h"

View File

@ -8,6 +8,7 @@
#include "db/filename.h"
#include "db/version_set.h"
#include "db/write_batch_internal.h"
#include "memtable/hash_linklist_rep.h"
#include "rocksdb/cache.h"
#include "rocksdb/compaction_filter.h"
#include "rocksdb/db.h"
@ -22,7 +23,6 @@
#include "table/block_based_table_factory.h"
#include "table/plain_table_factory.h"
#include "util/hash.h"
#include "util/hash_linklist_rep.h"
#include "util/logging.h"
#include "util/mutexlock.h"
#include "util/rate_limiter.h"

View File

@ -5,8 +5,7 @@
//
#ifndef ROCKSDB_LITE
#include "util/hash_cuckoo_rep.h"
#include "memtable/hash_cuckoo_rep.h"
#include <algorithm>
#include <atomic>
@ -18,9 +17,10 @@
#include "db/memtable.h"
#include "db/skiplist.h"
#include "memtable/stl_wrappers.h"
#include "port/port.h"
#include "rocksdb/memtablerep.h"
#include "util/murmurhash.h"
#include "util/stl_wrappers.h"
namespace rocksdb {
namespace {

View File

@ -6,8 +6,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#ifndef ROCKSDB_LITE
#pragma once
#ifndef ROCKSDB_LITE
#include "port/port.h"
#include "rocksdb/slice_transform.h"
#include "rocksdb/memtablerep.h"

View File

@ -5,7 +5,7 @@
//
#ifndef ROCKSDB_LITE
#include "util/hash_linklist_rep.h"
#include "memtable/hash_linklist_rep.h"
#include <algorithm>
#include <atomic>

View File

@ -6,8 +6,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#ifndef ROCKSDB_LITE
#pragma once
#ifndef ROCKSDB_LITE
#include "rocksdb/slice_transform.h"
#include "rocksdb/memtablerep.h"

View File

@ -5,7 +5,7 @@
//
#ifndef ROCKSDB_LITE
#include "util/hash_skiplist_rep.h"
#include "memtable/hash_skiplist_rep.h"
#include <atomic>

View File

@ -6,8 +6,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#ifndef ROCKSDB_LITE
#pragma once
#ifndef ROCKSDB_LITE
#include "rocksdb/slice_transform.h"
#include "rocksdb/memtablerep.h"

View File

@ -30,17 +30,5 @@ struct Compare : private Base {
}
};
struct LessOfComparator {
explicit LessOfComparator(const Comparator* c = BytewiseComparator())
: cmp(c) {}
bool operator()(const std::string& a, const std::string& b) const {
return cmp->Compare(Slice(a), Slice(b)) < 0;
}
const Comparator* cmp;
};
typedef std::map<std::string, std::string, LessOfComparator> KVMap;
}
}

6
src.mk
View File

@ -46,6 +46,9 @@ LIB_SOURCES = \
db/write_batch_base.cc \
db/write_controller.cc \
db/write_thread.cc \
memtable/hash_cuckoo_rep.cc \
memtable/hash_linklist_rep.cc \
memtable/hash_skiplist_rep.cc \
port/stack_trace.cc \
port/port_posix.cc \
table/adaptive_table_factory.cc \
@ -96,9 +99,6 @@ LIB_SOURCES = \
util/file_reader_writer.cc \
util/filter_policy.cc \
util/hash.cc \
util/hash_cuckoo_rep.cc \
util/hash_linklist_rep.cc \
util/hash_skiplist_rep.cc \
util/histogram.cc \
util/instrumented_mutex.cc \
util/iostats_context.cc \

View File

@ -11,12 +11,12 @@
#include "db/builder.h"
#include "db/table_properties_collector.h"
#include "util/kv_map.h"
#include "rocksdb/comparator.h"
#include "rocksdb/options.h"
#include "rocksdb/slice.h"
#include "table/block_builder.h"
#include "table/format.h"
#include "util/stl_wrappers.h"
namespace rocksdb {

View File

@ -14,6 +14,7 @@
#include <string>
#include <utility>
#include "util/kv_map.h"
#include "port/port.h"
#include "rocksdb/comparator.h"
#include "rocksdb/table.h"
@ -21,7 +22,6 @@
#include "table/table_builder.h"
#include "table/table_reader.h"
#include "util/mutexlock.h"
#include "util/stl_wrappers.h"
#include "util/testharness.h"
#include "util/testutil.h"

View File

@ -21,6 +21,7 @@
#include "db/memtable.h"
#include "db/write_batch_internal.h"
#include "db/writebuffer.h"
#include "memtable/stl_wrappers.h"
#include "rocksdb/cache.h"
#include "rocksdb/db.h"
#include "rocksdb/env.h"
@ -43,7 +44,6 @@
#include "util/compression.h"
#include "util/random.h"
#include "util/statistics.h"
#include "util/stl_wrappers.h"
#include "util/string_util.h"
#include "util/testharness.h"
#include "util/testutil.h"

31
util/kv_map.h Normal file
View File

@ -0,0 +1,31 @@
// Copyright (c) 2013, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
#pragma once
#include <map>
#include <string>
#include "rocksdb/comparator.h"
#include "rocksdb/slice.h"
#include "util/coding.h"
#include "util/murmurhash.h"
namespace rocksdb {
namespace stl_wrappers {
struct LessOfComparator {
explicit LessOfComparator(const Comparator* c = BytewiseComparator())
: cmp(c) {}
bool operator()(const std::string& a, const std::string& b) const {
return cmp->Compare(Slice(a), Slice(b)) < 0;
}
const Comparator* cmp;
};
typedef std::map<std::string, std::string, LessOfComparator> KVMap;
}
}

View File

@ -14,9 +14,9 @@
#include "util/arena.h"
#include "db/memtable.h"
#include "memtable/stl_wrappers.h"
#include "port/port.h"
#include "util/mutexlock.h"
#include "util/stl_wrappers.h"
namespace rocksdb {
namespace {