Skip to content

Commit ba6d660

Browse files
author
Naveen
committed
Resolving merge conflict
2 parents 51eeaf6 + 0a29ce5 commit ba6d660

File tree

191 files changed

+10588
-4491
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+10588
-4491
lines changed

.travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ before_install:
1414
- sudo dpkg -i libgflags-dev_2.0-1_amd64.deb
1515
# Lousy hack to disable use and testing of fallocate, which doesn't behave quite
1616
# as EnvPosixTest::AllocateTest expects within the Travis OpenVZ environment.
17-
- sed -i "s/fallocate(/HACK_NO_fallocate(/" build_tools/build_detect_platform
18-
script: make check -j8
17+
script: OPT=-DTRAVIS make check -j8
1918
notifications:
2019
email: false

HISTORY.md

+25-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,34 @@
11
# Rocksdb Change Log
22

3-
### Unreleased
3+
## Unreleased (will be released with 3.6)
4+
### Disk format changes
5+
* If you're using RocksDB on ARM platforms and you're using default bloom filter, there is a disk format change you need to be aware of. There are three steps you need to do when you convert to new release: 1. turn off filter policy, 2. compact the whole database, 3. turn on filter policy
6+
7+
### Behavior changes
8+
* We have refactored our system of stalling writes. Any stall-related statistics' meanings are changed. Instead of per-write stall counts, we now count stalls per-epoch, where epochs are periods between flushes and compactions. You'll find more information in our Tuning Perf Guide once we release RocksDB 3.6.
9+
* When disableDataSync=true, we no longer sync the MANIFEST file.
10+
* Add identity_as_first_hash property to CuckooTable. SST file needs to be rebuilt to be opened by reader properly.
11+
* Change target_file_size_base type to uint64_t from int.
12+
13+
----- Past Releases -----
14+
15+
## 3.5.0 (9/3/2014)
16+
### New Features
17+
* Add include/utilities/write_batch_with_index.h, providing a utilitiy class to query data out of WriteBatch when building it.
18+
* Move BlockBasedTable related options to BlockBasedTableOptions from Options. Change corresponding JNI interface. Options affected include:
19+
no_block_cache, block_cache, block_cache_compressed, block_size, block_size_deviation, block_restart_interval, filter_policy, whole_key_filtering. filter_policy is changed to shared_ptr from a raw pointer.
20+
* Remove deprecated options: disable_seek_compaction and db_stats_log_interval
21+
* OptimizeForPointLookup() takes one parameter for block cache size. It now builds hash index, bloom filter, and block cache.
22+
23+
### Public API changes
24+
* The Prefix Extractor used with V2 compaction filters is now passed user key to SliceTransform::Transform instead of unparsed RocksDB key.
25+
26+
## 3.4.0 (8/18/2014)
427
### New Features
528
* Support Multiple DB paths in universal style compactions
629
* Add feature of storing plain table index and bloom filter in SST file.
730
* CompactRange() will never output compacted files to level 0. This used to be the case when all the compaction input files were at level 0.
31+
* Added iterate_upper_bound to define the extent upto which the forward iterator will return entries. This will prevent iterating over delete markers and overwritten entries for edge cases where you want to break out the iterator anyways. This may improve perfomance in case there are a large number of delete markers or overwritten entries.
832

933
### Public API changes
1034
* DBOptions.db_paths now is a vector of a DBPath structure which indicates both of path and target size

Makefile

+47-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# found in the LICENSE file. See the AUTHORS file for names of contributors.
44

55
# Inherit some settings from environment variables, if available
6-
INSTALL_PATH ?= $(CURDIR)
76

87
#-----------------------------------------------
98

@@ -49,6 +48,27 @@ else
4948
PLATFORM_CCFLAGS += $(JEMALLOC_INCLUDE) -DHAVE_JEMALLOC
5049
endif
5150

51+
#-------------------------------------------------
52+
# make install related stuff
53+
INSTALL_PATH ?= /usr/local
54+
55+
uninstall:
56+
@rm -rf $(INSTALL_PATH)/include/rocksdb
57+
@rm -rf $(INSTALL_PATH)/lib/$(LIBRARY)
58+
@rm -rf $(INSTALL_PATH)/lib/$(SHARED)
59+
60+
install:
61+
@install -d $(INSTALL_PATH)/lib
62+
@for header_dir in `find "include/rocksdb" -type d`; do \
63+
install -d $(INSTALL_PATH)/$$header_dir; \
64+
done
65+
@for header in `find "include/rocksdb" -type f -name *.h`; do \
66+
install -C -m 644 $$header $(INSTALL_PATH)/$$header; \
67+
done
68+
@[ ! -e $(LIBRARY) ] || install -C -m 644 $(LIBRARY) $(INSTALL_PATH)/lib
69+
@[ ! -e $(SHARED) ] || install -C -m 644 $(SHARED) $(INSTALL_PATH)/lib
70+
#-------------------------------------------------
71+
5272
WARNING_FLAGS = -Wall -Werror -Wsign-compare
5373
CFLAGS += $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CCFLAGS) $(OPT)
5474
CXXFLAGS += $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT) -Woverloaded-virtual
@@ -90,12 +110,14 @@ TESTS = \
90110
blob_store_test \
91111
filelock_test \
92112
filename_test \
93-
filter_block_test \
113+
block_based_filter_block_test \
114+
full_filter_block_test \
94115
histogram_test \
95116
log_test \
96117
manual_compaction_test \
97118
memenv_test \
98119
merge_test \
120+
merger_test \
99121
redis_test \
100122
reduce_levels_test \
101123
plain_table_db_test \
@@ -111,17 +133,18 @@ TESTS = \
111133
version_edit_test \
112134
version_set_test \
113135
file_indexer_test \
114-
write_batch_test\
136+
write_batch_test \
137+
write_controller_test\
115138
deletefile_test \
116139
table_test \
117140
thread_local_test \
118141
geodb_test \
119142
rate_limiter_test \
120-
cuckoo_table_builder_test \
121143
options_test \
122144
cuckoo_table_builder_test \
123145
cuckoo_table_reader_test \
124-
cuckoo_table_db_test
146+
cuckoo_table_db_test \
147+
write_batch_with_index_test
125148

126149
TOOLS = \
127150
sst_dump \
@@ -132,7 +155,7 @@ TOOLS = \
132155
options_test \
133156
blob_store_bench
134157

135-
PROGRAMS = db_bench signal_test table_reader_bench log_and_apply_bench $(TOOLS)
158+
PROGRAMS = db_bench signal_test table_reader_bench log_and_apply_bench cache_bench $(TOOLS)
136159

137160
# The library name is configurable since we are maintaining libraries of both
138161
# debug/release mode.
@@ -175,7 +198,7 @@ endif # PLATFORM_SHARED_EXT
175198

176199
.PHONY: blackbox_crash_test check clean coverage crash_test ldb_tests \
177200
release tags valgrind_check whitebox_crash_test format static_lib shared_lib all \
178-
dbg rocksdbjavastatic rocksdbjava
201+
dbg rocksdbjavastatic rocksdbjava install uninstall
179202

180203
all: $(LIBRARY) $(PROGRAMS) $(TESTS)
181204

@@ -264,6 +287,9 @@ $(LIBRARY): $(LIBOBJECTS)
264287
db_bench: db/db_bench.o $(LIBOBJECTS) $(TESTUTIL)
265288
$(CXX) db/db_bench.o $(LIBOBJECTS) $(TESTUTIL) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
266289

290+
cache_bench: util/cache_bench.o $(LIBOBJECTS) $(TESTUTIL)
291+
$(CXX) util/cache_bench.o $(LIBOBJECTS) $(TESTUTIL) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
292+
267293
block_hash_index_test: table/block_hash_index_test.o $(LIBOBJECTS) $(TESTHARNESS)
268294
$(CXX) table/block_hash_index_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
269295

@@ -375,6 +401,9 @@ spatial_db_test: utilities/spatialdb/spatial_db_test.o $(LIBOBJECTS) $(TESTHARNE
375401
ttl_test: utilities/ttl/ttl_test.o $(LIBOBJECTS) $(TESTHARNESS)
376402
$(CXX) utilities/ttl/ttl_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
377403

404+
write_batch_with_index_test: utilities/write_batch_with_index/write_batch_with_index_test.o $(LIBOBJECTS) $(TESTHARNESS)
405+
$(CXX) utilities/write_batch_with_index/write_batch_with_index_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
406+
378407
dbformat_test: db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS)
379408
$(CXX) db/dbformat_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
380409

@@ -387,8 +416,11 @@ rate_limiter_test: util/rate_limiter_test.o $(LIBOBJECTS) $(TESTHARNESS)
387416
filename_test: db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS)
388417
$(CXX) db/filename_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
389418

390-
filter_block_test: table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS)
391-
$(CXX) table/filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
419+
block_based_filter_block_test: table/block_based_filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS)
420+
$(CXX) table/block_based_filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
421+
422+
full_filter_block_test: table/full_filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS)
423+
$(CXX) table/full_filter_block_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
392424

393425
log_test: db/log_test.o $(LIBOBJECTS) $(TESTHARNESS)
394426
$(CXX) db/log_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
@@ -417,9 +449,15 @@ reduce_levels_test: tools/reduce_levels_test.o $(LIBOBJECTS) $(TESTHARNESS)
417449
write_batch_test: db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS)
418450
$(CXX) db/write_batch_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
419451

452+
write_controller_test: db/write_controller_test.o $(LIBOBJECTS) $(TESTHARNESS)
453+
$(CXX) db/write_controller_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
454+
420455
merge_test: db/merge_test.o $(LIBOBJECTS) $(TESTHARNESS)
421456
$(CXX) db/merge_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
422457

458+
merger_test: table/merger_test.o $(LIBOBJECTS) $(TESTHARNESS)
459+
$(CXX) table/merger_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS) $(COVERAGEFLAGS)
460+
423461
deletefile_test: db/deletefile_test.o $(LIBOBJECTS) $(TESTHARNESS)
424462
$(CXX) db/deletefile_test.o $(LIBOBJECTS) $(TESTHARNESS) $(EXEC_LDFLAGS) -o $@ $(LDFLAGS)
425463

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Build Status](https://travis-ci.org/facebook/rocksdb.svg?branch=master)](https://travis-ci.org/facebook/rocksdb)
44

55
RocksDB is developed and maintained by Facebook Database Engineering Team.
6-
It is built on on earlier work on LevelDB by Sanjay Ghemawat (sanjay@google.com)
6+
It is built on earlier work on LevelDB by Sanjay Ghemawat (sanjay@google.com)
77
and Jeff Dean (jeff@google.com)
88

99
This code is a library that forms the core building block for a fast

build_tools/build_detect_platform

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ PLATFORM_CXXFLAGS="-std=c++11"
4646
COMMON_FLAGS="-DROCKSDB_PLATFORM_POSIX"
4747

4848
# Default to fbcode gcc on internal fb machines
49-
if [ -d /mnt/gvfs/third-party -a -z "$CXX" ]; then
49+
if [ -z "$ROCKSDB_NO_FBCODE" -a -d /mnt/gvfs/third-party ]; then
5050
FBCODE_BUILD="true"
5151
if [ -z "$USE_CLANG" ]; then
5252
CENTOS_VERSION=`rpm -q --qf "%{VERSION}" \

build_tools/regression_build_test.sh

+34
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,38 @@ common_in_mem_args="--db=/dev/shm/rocksdb \
344344
--threads=32 \
345345
--writes_per_second=81920 > ${STAT_FILE}.seekwhilewriting_in_ram
346346

347+
# measure fillseq with bunch of column families
348+
./db_bench \
349+
--benchmarks=fillseq \
350+
--num_column_families=500 \
351+
--write_buffer_size=1048576 \
352+
--db=$DATA_DIR \
353+
--use_existing_db=0 \
354+
--num=$NUM \
355+
--writes=$NUM \
356+
--open_files=55000 \
357+
--statistics=1 \
358+
--histogram=1 \
359+
--disable_data_sync=1 \
360+
--disable_wal=1 \
361+
--sync=0 > ${STAT_FILE}.fillseq_lots_column_families
362+
363+
# measure overwrite performance with bunch of column families
364+
./db_bench \
365+
--benchmarks=overwrite \
366+
--num_column_families=500 \
367+
--write_buffer_size=1048576 \
368+
--db=$DATA_DIR \
369+
--use_existing_db=1 \
370+
--num=$NUM \
371+
--writes=$((NUM / 10)) \
372+
--open_files=55000 \
373+
--statistics=1 \
374+
--histogram=1 \
375+
--disable_data_sync=1 \
376+
--disable_wal=1 \
377+
--sync=0 \
378+
--threads=8 > ${STAT_FILE}.overwrite_lots_column_families
347379

348380
# send data to ods
349381
function send_to_ods {
@@ -392,3 +424,5 @@ send_benchmark_to_ods readrandom memtablereadrandom $STAT_FILE.memtablefillreadr
392424
send_benchmark_to_ods readwhilewriting readwhilewriting $STAT_FILE.readwhilewriting
393425
send_benchmark_to_ods readwhilewriting readwhilewriting_in_ram ${STAT_FILE}.readwhilewriting_in_ram
394426
send_benchmark_to_ods seekrandomwhilewriting seekwhilewriting_in_ram ${STAT_FILE}.seekwhilewriting_in_ram
427+
send_benchmark_to_ods fillseq fillseq_lots_column_families ${STAT_FILE}.fillseq_lots_column_families
428+
send_benchmark_to_ods overwrite overwrite_lots_column_families ${STAT_FILE}.overwrite_lots_column_families

db/builder.cc

+22-18
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,24 @@ namespace rocksdb {
2626

2727
class TableFactory;
2828

29-
TableBuilder* NewTableBuilder(const Options& options,
29+
TableBuilder* NewTableBuilder(const ImmutableCFOptions& ioptions,
3030
const InternalKeyComparator& internal_comparator,
3131
WritableFile* file,
32-
CompressionType compression_type) {
33-
return options.table_factory->NewTableBuilder(options, internal_comparator,
34-
file, compression_type);
32+
const CompressionType compression_type,
33+
const CompressionOptions& compression_opts) {
34+
return ioptions.table_factory->NewTableBuilder(
35+
ioptions, internal_comparator, file, compression_type, compression_opts);
3536
}
3637

37-
Status BuildTable(const std::string& dbname, Env* env, const Options& options,
38-
const EnvOptions& soptions, TableCache* table_cache,
38+
Status BuildTable(const std::string& dbname, Env* env,
39+
const ImmutableCFOptions& ioptions,
40+
const EnvOptions& env_options, TableCache* table_cache,
3941
Iterator* iter, FileMetaData* meta,
4042
const InternalKeyComparator& internal_comparator,
4143
const SequenceNumber newest_snapshot,
4244
const SequenceNumber earliest_seqno_in_memtable,
4345
const CompressionType compression,
46+
const CompressionOptions& compression_opts,
4447
const Env::IOPriority io_priority) {
4548
Status s;
4649
meta->fd.file_size = 0;
@@ -50,23 +53,24 @@ Status BuildTable(const std::string& dbname, Env* env, const Options& options,
5053
// If the sequence number of the smallest entry in the memtable is
5154
// smaller than the most recent snapshot, then we do not trigger
5255
// removal of duplicate/deleted keys as part of this builder.
53-
bool purge = options.purge_redundant_kvs_while_flush;
56+
bool purge = ioptions.purge_redundant_kvs_while_flush;
5457
if (earliest_seqno_in_memtable <= newest_snapshot) {
5558
purge = false;
5659
}
5760

58-
std::string fname = TableFileName(options.db_paths, meta->fd.GetNumber(),
61+
std::string fname = TableFileName(ioptions.db_paths, meta->fd.GetNumber(),
5962
meta->fd.GetPathId());
6063
if (iter->Valid()) {
6164
unique_ptr<WritableFile> file;
62-
s = env->NewWritableFile(fname, &file, soptions);
65+
s = env->NewWritableFile(fname, &file, env_options);
6366
if (!s.ok()) {
6467
return s;
6568
}
6669
file->SetIOPriority(io_priority);
6770

68-
TableBuilder* builder =
69-
NewTableBuilder(options, internal_comparator, file.get(), compression);
71+
TableBuilder* builder = NewTableBuilder(
72+
ioptions, internal_comparator, file.get(),
73+
compression, compression_opts);
7074

7175
// the first key is the smallest key
7276
Slice key = iter->key();
@@ -75,8 +79,8 @@ Status BuildTable(const std::string& dbname, Env* env, const Options& options,
7579
meta->largest_seqno = meta->smallest_seqno;
7680

7781
MergeHelper merge(internal_comparator.user_comparator(),
78-
options.merge_operator.get(), options.info_log.get(),
79-
options.min_partial_merge_operands,
82+
ioptions.merge_operator, ioptions.info_log,
83+
ioptions.min_partial_merge_operands,
8084
true /* internal key corruption is not ok */);
8185

8286
if (purge) {
@@ -196,12 +200,12 @@ Status BuildTable(const std::string& dbname, Env* env, const Options& options,
196200
delete builder;
197201

198202
// Finish and check for file errors
199-
if (s.ok() && !options.disableDataSync) {
200-
if (options.use_fsync) {
201-
StopWatch sw(env, options.statistics.get(), TABLE_SYNC_MICROS);
203+
if (s.ok() && !ioptions.disable_data_sync) {
204+
if (ioptions.use_fsync) {
205+
StopWatch sw(env, ioptions.statistics, TABLE_SYNC_MICROS);
202206
s = file->Fsync();
203207
} else {
204-
StopWatch sw(env, options.statistics.get(), TABLE_SYNC_MICROS);
208+
StopWatch sw(env, ioptions.statistics, TABLE_SYNC_MICROS);
205209
s = file->Sync();
206210
}
207211
}
@@ -211,7 +215,7 @@ Status BuildTable(const std::string& dbname, Env* env, const Options& options,
211215

212216
if (s.ok()) {
213217
// Verify that the table is usable
214-
Iterator* it = table_cache->NewIterator(ReadOptions(), soptions,
218+
Iterator* it = table_cache->NewIterator(ReadOptions(), env_options,
215219
internal_comparator, meta->fd);
216220
s = it->status();
217221
delete it;

db/builder.h

+8-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "rocksdb/status.h"
1212
#include "rocksdb/types.h"
1313
#include "rocksdb/options.h"
14+
#include "rocksdb/immutable_options.h"
1415

1516
namespace rocksdb {
1617

@@ -26,22 +27,26 @@ class TableBuilder;
2627
class WritableFile;
2728

2829
extern TableBuilder* NewTableBuilder(
29-
const Options& options, const InternalKeyComparator& internal_comparator,
30-
WritableFile* file, CompressionType compression_type);
30+
const ImmutableCFOptions& options,
31+
const InternalKeyComparator& internal_comparator,
32+
WritableFile* file, const CompressionType compression_type,
33+
const CompressionOptions& compression_opts);
3134

3235
// Build a Table file from the contents of *iter. The generated file
3336
// will be named according to number specified in meta. On success, the rest of
3437
// *meta will be filled with metadata about the generated table.
3538
// If no data is present in *iter, meta->file_size will be set to
3639
// zero, and no Table file will be produced.
3740
extern Status BuildTable(const std::string& dbname, Env* env,
38-
const Options& options, const EnvOptions& soptions,
41+
const ImmutableCFOptions& options,
42+
const EnvOptions& env_options,
3943
TableCache* table_cache, Iterator* iter,
4044
FileMetaData* meta,
4145
const InternalKeyComparator& internal_comparator,
4246
const SequenceNumber newest_snapshot,
4347
const SequenceNumber earliest_seqno_in_memtable,
4448
const CompressionType compression,
49+
const CompressionOptions& compression_opts,
4550
const Env::IOPriority io_priority = Env::IO_HIGH);
4651

4752
} // namespace rocksdb

0 commit comments

Comments
 (0)