Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update our encryption to match changes in Facebook sources #18

Open
wants to merge 59 commits into
base: stardog/develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
8522d9c
Prepare FragmentedRangeTombstoneIterator for use in compaction (#4740)
abhimadan Dec 11, 2018
96de211
Add compaction logic to RangeDelAggregatorV2 (#4758)
abhimadan Dec 17, 2018
33564d2
Remove v1 RangeDelAggregator (#4778)
abhimadan Dec 18, 2018
de0891e
Fix unused member compile error
abhimadan Dec 18, 2018
8a643b7
Detect if Jemalloc is linked with the binary (#4844)
Jan 4, 2019
ec43385
Enable checkpoint of read-only db (#4681)
riversand963 Dec 8, 2018
663d24f
Improve flushing multiple column families (#4708)
riversand963 Dec 13, 2018
e265e08
Avoid switching empty memtable in certain cases (#4792)
riversand963 Dec 19, 2018
35c950a
Refactor atomic flush result installation to MANIFEST (#4791)
riversand963 Jan 4, 2019
97773d0
Update HISTORY.md
riversand963 Jan 7, 2019
e78f5cf
Fix point lookup on range tombstone sentinel endpoint (#4829)
ajkr Jan 4, 2019
3bcc312
Initialize two members in PerfContext (#4859)
riversand963 Jan 9, 2019
4eeb1bf
Bump version to 5.18.1
riversand963 Jan 10, 2019
9ae0528
Use chrono::time_point instead of time_t (#4868)
riversand963 Jan 16, 2019
35c05bc
Deleting Blob files also goes through SstFileManager (#4904)
siying Jan 23, 2019
53f760b
Always delete Blob DB files in the background (#4928)
Jan 29, 2019
acba14b
Make a copy of MutableCFOptions to avoid race condition (#4876)
riversand963 Jan 12, 2019
65b2298
Use correct FileMeta for atomic flush result install (#4932)
riversand963 Jan 31, 2019
a1774dd
Bump version to 5.18.2
sagar0 Jan 31, 2019
b7434c2
Properly set upper bound of subcompaction output (#4879) (#4898)
Feb 5, 2019
641fae6
update history and bump version
ajkr Feb 11, 2019
5e2f968
Revert "Core-local statistics"
leventov Jun 4, 2018
4e6b92c
Update cmake to not build tests when not in Debug
toktarev Jun 7, 2018
05b54b1
Column family destructor should print column family name on assertion…
toktarev Jul 4, 2018
b1cc1a8
Use the C++ steady_clock on Mac OSX, rather than using the Mach kerne…
Aug 1, 2018
33659a3
Post cherry-pick fixes
toktarev Mar 13, 2019
fdb84c8
Upgrade to 5.18.3
toktarev Mar 19, 2019
3182761
Working Bazel build
Sep 29, 2018
2520fc9
Update OSX defines
Oct 11, 2018
4704cbe
Build with toolchain
Oct 15, 2018
e9a1ddf
Fixed link issue
Oct 15, 2018
30b49bc
Windows is not POSIX
Oct 25, 2018
34703d9
Exclude benchmarking executable range_del_aggregator_bench.cc from db…
Dec 6, 2018
f4644de
Remove dependency on gtest_main as that seems to cause some bad depen…
Oct 28, 2018
0b86b91
Include jemalloc_helper.h only if ROCKSDB_JEMALLOC is enabled
toktarev Mar 19, 2019
98bf022
Added jemalloc_helper.h as a dependency
toktarev Mar 21, 2019
feb5490
Make content_flags_ to be available for public API
toktarev Apr 16, 2019
3e7faa1
Merge branch 'v5.18.3' of github.com:stardog-union/rocksdb into v5.18.3
Apr 30, 2019
41129d5
Turned off performance measurement by default
Sep 26, 2019
5636fba
clean include prefix from rocksdb include paths to fix pragma once pr…
Jan 21, 2020
75c14f9
force win_jemalloc out of the bazel build
Jan 22, 2020
8847d69
wow, we do build these utility files that have the same stupid includ…
Jan 22, 2020
c164550
additional deps to help Windows build
Jan 27, 2020
4556837
mac os cross build suddenly needs std::move definition? why?
Feb 11, 2020
6def808
Adding "_WIN32_WINNT=_WIN32_WINNT_VISTA" to compile defines
Mar 19, 2020
c6063a4
Feature: AES CTR encryption (#6)
matthewvon May 28, 2020
a7d2e8d
fill in missing CompactionJobInfo member. (#8)
matthewvon Jun 5, 2020
5cb1595
default skiplist height same as original leveldb which had 4M write b…
matthewvon Jun 12, 2020
844661e
Porting Facebook required changes back to Stardog (#10)
matthewvon Jun 23, 2020
2c35685
previous PR missed ifdefs within library_loader stuff and switch to u…
matthewvon Jun 30, 2020
4569cef
Backport changes to encryption that Facebook required. (#12)
matthewvon Jul 9, 2020
6acb712
Feature/mv encrypt 2 (#15)
matthewvon Aug 21, 2020
c46e40d
make SetKeys public since now rwlock protected. (#16)
matthewvon Aug 28, 2020
529487e
make mutex mutable for const function
matthewvon Sep 1, 2020
174ccbd
Merge pull request #17 from stardog-union/mv-channel-mutable-lock
jbalint Sep 1, 2020
7ecb246
backport Facebook changes to env_encryption ... then update Stardog o…
matthewvon Sep 6, 2020
ff46be7
update unit test (and fix what it found broken)
matthewvon Sep 7, 2020
743b314
add a paranoid test for all potential partial block starts of Encrypt
matthewvon Sep 8, 2020
a894db0
have paranoid test execute across two offset (32 bytes) instead of ju…
matthewvon Sep 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build --crosstool_top=@toolchain//cpp:toolchain
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ manifest_dump
sst_dump
blob_dump
column_aware_encoding_exp
util/build_version.cc
build_tools/VALGRIND_LOGS/
coverage/COVERAGE_REPORT
.gdbhistory
Expand Down
78 changes: 78 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
config_setting(
name = "linux",
constraint_values = [
"@bazel_tools//platforms:linux",
],
visibility = ["//visibility:public"],
)

config_setting(
name = "osx",
constraint_values = [
"@bazel_tools//platforms:osx",
],
visibility = ["//visibility:public"],
)

config_setting(
name = "windows",
constraint_values = [
"@bazel_tools//platforms:windows",
],
visibility = ["//visibility:public"],
)

config_setting(
name = "tests_enabled_debug_mode",
values = {
"compilation_mode": "dbg",
"define": "enable_tests=1",
},
visibility = ["//visibility:public"],
)

config_setting(
name = "tests_enabled_fastbuild_mode",
values = {
"compilation_mode": "fastbuild",
"define": "enable_tests=1",
},
visibility = ["//visibility:public"],
)

cc_library(
name = "rocksdb",
deps = [
"//cache",
"//db",
"//env",
"//include",
"//memtable",
"//monitoring",
"//options",
"//port",
"//table",
"//third_party/gtest",
"//third_party/lz4",
"//third_party/snappy",
"//util",
"//utilities",
"//utilities/backupable",
"//utilities/checkpoint",
"//utilities/leveldb_options",
"//utilities/merge_operators",
"//utilities/merge_operators/string_append",
"//utilities/options",
"//utilities/table_properties_collectors",
"//utilities/transactions",
"//utilities/ttl",
"//utilities/write_batch_with_index",
],
visibility = ["//visibility:public"],
)

cc_library(
name = "empty_main",
srcs = ["empty_main.cc"],
visibility = ["//visibility:public"],
)
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ else()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DNDEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer")
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-momit-leaf-frame-pointer" HAVE_OMIT_LEAF_FRAME_POINTER)
Expand Down Expand Up @@ -504,7 +505,6 @@ set(SOURCES
db/merge_helper.cc
db/merge_operator.cc
db/range_del_aggregator.cc
db/range_del_aggregator_v2.cc
db/range_tombstone_fragmenter.cc
db/repair.cc
db/snapshot_impl.cc
Expand All @@ -523,6 +523,7 @@ set(SOURCES
env/env_chroot.cc
env/env_encryption.cc
env/env_hdfs.cc
env/env_openssl.cc
env/mock_env.cc
memtable/alloc_tracker.cc
memtable/hash_cuckoo_rep.cc
Expand Down Expand Up @@ -907,7 +908,6 @@ if(WITH_TESTS)
db/plain_table_db_test.cc
db/prefix_test.cc
db/range_del_aggregator_test.cc
db/range_del_aggregator_v2_test.cc
db/range_tombstone_fragmenter_test.cc
db/repair_test.cc
db/table_properties_collector_test.cc
Expand All @@ -919,6 +919,7 @@ if(WITH_TESTS)
db/write_callback_test.cc
db/write_controller_test.cc
env/env_basic_test.cc
env/env_openssl_test.cc
env/env_test.cc
env/mock_env_test.cc
memtable/inlineskiplist_test.cc
Expand Down Expand Up @@ -957,6 +958,7 @@ if(WITH_TESTS)
util/hash_test.cc
util/heap_test.cc
util/rate_limiter_test.cc
util/library_loader_test.cc
util/repeatable_thread_test.cc
util/slice_transform_test.cc
util/timer_queue_test.cc
Expand Down
14 changes: 9 additions & 5 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Rocksdb Change Log
## Unreleased
### New Features
## 5.18.3 (2/11/2019)
### Bug Fixes
* Fix possible LSM corruption when both range deletions and subcompactions are used. The symptom of this corruption is L1+ files overlapping in the user key space.

## 5.18.2 (01/31/2019)
### Public API Change

### Bug Fixes
* Fix a deadlock caused by compaction and file ingestion waiting for each other in the event of write stalls.
* Change time resolution in FileOperationInfo.
* Deleting Blob files also go through SStFileManager.

## 5.18.0 (11/30/2018)
### New Features
Expand All @@ -18,6 +19,7 @@
* Add xxhash64 checksum support
* Introduced `MemoryAllocator`, which lets the user specify custom memory allocator for block based table.
* Improved `DeleteRange` to prevent read performance degradation. The feature is no longer marked as experimental.
* Enabled checkpoint on readonly db (DBImplReadOnly).

### Public API Change
* `DBOptions::use_direct_reads` now affects reads issued by `BackupEngine` on the database's SSTs.
Expand All @@ -34,6 +36,8 @@
* Fixed Get correctness bug in the presence of range tombstones where merge operands covered by a range tombstone always result in NotFound.
* Start populating `NO_FILE_CLOSES` ticker statistic, which was always zero previously.
* The default value of NewBloomFilterPolicy()'s argument use_block_based_builder is changed to false. Note that this new default may cause large temp memory usage when building very large SST files.
* Fix a deadlock caused by compaction and file ingestion waiting for each other in the event of write stalls.
* Make DB ignore dropped column families while committing results of atomic flush.

## 5.17.0 (10/05/2018)
### Public API Change
Expand Down
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,10 @@ TESTS = \
coding_test \
inlineskiplist_test \
env_basic_test \
env_openssl_test \
env_test \
hash_test \
library_loader_test \
thread_local_test \
rate_limiter_test \
perf_context_test \
Expand Down Expand Up @@ -543,7 +545,6 @@ TESTS = \
persistent_cache_test \
statistics_test \
lua_test \
range_del_aggregator_test \
lru_cache_test \
object_registry_test \
repair_test \
Expand All @@ -554,7 +555,7 @@ TESTS = \
trace_analyzer_test \
repeatable_thread_test \
range_tombstone_fragmenter_test \
range_del_aggregator_v2_test \
range_del_aggregator_test \
sst_file_reader_test \

PARALLEL_TEST = \
Expand Down Expand Up @@ -1136,6 +1137,9 @@ coding_test: util/coding_test.o $(LIBOBJECTS) $(TESTHARNESS)
hash_test: util/hash_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK)

library_loader_test: util/library_loader_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK)

option_change_migration_test: utilities/option_change_migration/option_change_migration_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK)

Expand Down Expand Up @@ -1307,6 +1311,9 @@ sim_cache_test: utilities/simulator_cache/sim_cache_test.o db/db_test_util.o $(L
spatial_db_test: utilities/spatialdb/spatial_db_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK)

env_openssl_test: env/env_openssl_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK)

env_mirror_test: utilities/env_mirror_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK)

Expand Down Expand Up @@ -1588,9 +1595,6 @@ repeatable_thread_test: util/repeatable_thread_test.o $(LIBOBJECTS) $(TESTHARNES
range_tombstone_fragmenter_test: db/range_tombstone_fragmenter_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK)

range_del_aggregator_v2_test: db/range_del_aggregator_v2_test.o db/db_test_util.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK)

sst_file_reader_test: table/sst_file_reader_test.o $(LIBOBJECTS) $(TESTHARNESS)
$(AM_LINK)

Expand Down
26 changes: 15 additions & 11 deletions TARGETS
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,11 @@ is_opt_mode = build_mode.startswith("opt")
if is_opt_mode:
rocksdb_compiler_flags.append("-DNDEBUG")

default_allocator = read_config("fbcode", "default_allocator")

sanitizer = read_config("fbcode", "sanitizer")

# Let RocksDB aware of jemalloc existence.
# Do not enable it if sanitizer presents.
if is_opt_mode and default_allocator.startswith("jemalloc") and sanitizer == "":
# Do not enable jemalloc if sanitizer presents. RocksDB will further detect
# whether the binary is linked with jemalloc at runtime.
if sanitizer == "":
rocksdb_compiler_flags.append("-DROCKSDB_JEMALLOC")
rocksdb_external_deps.append(("jemalloc", None, "headers"))

Expand Down Expand Up @@ -124,7 +122,6 @@ cpp_library(
"db/merge_helper.cc",
"db/merge_operator.cc",
"db/range_del_aggregator.cc",
"db/range_del_aggregator_v2.cc",
"db/range_tombstone_fragmenter.cc",
"db/repair.cc",
"db/snapshot_impl.cc",
Expand All @@ -143,6 +140,7 @@ cpp_library(
"env/env_chroot.cc",
"env/env_encryption.cc",
"env/env_hdfs.cc",
"env/env_openssl.cc",
"env/env_posix.cc",
"env/io_posix.cc",
"env/mock_env.cc",
Expand Down Expand Up @@ -230,6 +228,7 @@ cpp_library(
"util/filter_policy.cc",
"util/hash.cc",
"util/jemalloc_nodump_allocator.cc",
"util/library_loader.cc",
"util/log_buffer.cc",
"util/murmurhash.cc",
"util/random.cc",
Expand Down Expand Up @@ -705,6 +704,11 @@ ROCKS_TESTS = [
"env/env_basic_test.cc",
"serial",
],
[
"env_openssl_test",
"env/env_openssl_test.cc",
"serial",
],
[
"env_test",
"env/env_test.cc",
Expand Down Expand Up @@ -815,6 +819,11 @@ ROCKS_TESTS = [
"tools/ldb_cmd_test.cc",
"serial",
],
[
"library_loader_test",
"util/library_loader_test.cc",
"serial",
],
[
"listener_test",
"db/listener_test.cc",
Expand Down Expand Up @@ -935,11 +944,6 @@ ROCKS_TESTS = [
"db/range_del_aggregator_test.cc",
"serial",
],
[
"range_del_aggregator_v2_test",
"db/range_del_aggregator_v2_test.cc",
"serial",
],
[
"range_tombstone_fragmenter_test",
"db/range_tombstone_fragmenter_test.cc",
Expand Down
36 changes: 36 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
workspace(name = "rocksdb")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "com_google_googletest",
urls = ["https://github.com/google/googletest/archive/release-1.8.1.zip"],
strip_prefix = "googletest-release-1.8.1",
sha256 = "927827c183d01734cc5cfef85e0ff3f5a92ffe6188e0d18e909c5efebf28a0c7",
)

http_archive(
name = "com_google_snappy",
urls = ["https://github.com/stardog-union/snappy/archive/add_bazel.zip"],
strip_prefix = "snappy-add_bazel",
)

new_http_archive(
name = "org_lz4",
urls = ["https://github.com/lz4/lz4/archive/v1.8.2.zip"],
strip_prefix = "lz4-1.8.2",
build_file = "third_party/lz4/BUILD.external",
sha256 = "6df2bc7b830d4a23ca6f0a19a772fc0a61100f98baa843f9bbf873a80b6840d5",
)

http_archive(
name = "toolchain",
urls = [
# The file: URL is useful for testing the build, but is not generally necessary since Bazel handles caching
# external dependencies.
# TODO(james): Remove this URL when the Bazel build is stable.
# "file:///home/james/git/toolchain-master.tgz",
"https://github.com/stardog-union/toolchain/archive/master.zip",
],
strip_prefix = "toolchain-master",
sha256 = "d0740cacb99833911baba82041bb4429f9d3182522fe0fd4c131335ac8343891",
)
8 changes: 3 additions & 5 deletions buckifier/targets_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,11 @@
if is_opt_mode:
rocksdb_compiler_flags.append("-DNDEBUG")

default_allocator = read_config("fbcode", "default_allocator")

sanitizer = read_config("fbcode", "sanitizer")

# Let RocksDB aware of jemalloc existence.
# Do not enable it if sanitizer presents.
if is_opt_mode and default_allocator.startswith("jemalloc") and sanitizer == "":
# Do not enable jemalloc if sanitizer presents. RocksDB will further detect
# whether the binary is linked with jemalloc at runtime.
if sanitizer == "":
rocksdb_compiler_flags.append("-DROCKSDB_JEMALLOC")
rocksdb_external_deps.append(("jemalloc", None, "headers"))
"""
Expand Down
13 changes: 13 additions & 0 deletions build_tools/build_detect_platform
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,18 @@ EOF
PLATFORM_CXXFLAGS="$PLATFORM_CXXFLAGS -faligned-new -DHAVE_ALIGNED_NEW"
fi
fi

if ! test $ROCKSDB_DISABLE_OPENSSL; then
# Test whether openssl is available
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null <<EOF
#include <openssl/evp.h>
int main() {}
EOF
if [ "$?" = 0 ]; then
COMMON_FLAGS="$COMMON_FLAGS -DROCKSDB_OPENSSL_AES_CTR"
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -ldl"
fi
fi
fi

# TODO(tec): Fix -Wshorten-64-to-32 errors on FreeBSD and enable the warning.
Expand Down Expand Up @@ -612,6 +624,7 @@ echo "JEMALLOC_LIB=$JEMALLOC_LIB" >> "$OUTPUT"
echo "ROCKSDB_MAJOR=$ROCKSDB_MAJOR" >> "$OUTPUT"
echo "ROCKSDB_MINOR=$ROCKSDB_MINOR" >> "$OUTPUT"
echo "ROCKSDB_PATCH=$ROCKSDB_PATCH" >> "$OUTPUT"
echo "ROCKSDB_OPENSSL_AES_CTR=$ROCKSDB_OPENSSL_AES_CTR" >> "$OUTPUT"
echo "CLANG_SCAN_BUILD=$CLANG_SCAN_BUILD" >> "$OUTPUT"
echo "CLANG_ANALYZER=$CLANG_ANALYZER" >> "$OUTPUT"
echo "PROFILING_FLAGS=$PROFILING_FLAGS" >> "$OUTPUT"
Expand Down
Loading