Unverified Commit d1a96e46 authored by yiwu-arbug's avatar yiwu-arbug Committed by GitHub

cleanup rocksdb cloud (#611)

The rocksdb cloud integration currently cannot link, and we don't have current plan for it. The rocksdb cloud submodule makes code checkout slow. We are removing it for now.
Signed-off-by: 's avatarYi Wu <yiwu@pingcap.com>
parent 5984dd95
......@@ -7,8 +7,3 @@
path = librocksdb_sys/libtitan_sys/titan
url = https://github.com/tikv/titan.git
branch = master
[submodule "rocksdb-cloud"]
path = librocksdb_sys/librocksdb_cloud_sys/rocksdb-cloud
url = https://github.com/tikv/rocksdb
branch = 6.4.cloud
......@@ -4,11 +4,6 @@ language: rust
rust:
- nightly
cache:
cargo: false
directories:
- "/tmp/aws-sdk-cpp-1.8.14"
addons:
apt:
sources:
......@@ -21,9 +16,6 @@ jobs:
- os: linux
rust: nightly
env: FEATURES="encryption,jemalloc,portable,sse"
- os: linux
rust: nightly
env: FEATURES="cloud"
- os: linux
arch: arm64-graviton2
rust: nightly
......@@ -37,20 +29,6 @@ env:
- RUST_BACKTRACE=1
before_script:
# Installing the AWS-SDK, so increase the maximum number of open file descriptors,
# since some tests use more FDs than the default limit.
- if [ "${FEATURES}" == "cloud" ]; then
echo "limit maxfiles 1024 unlimited" | sudo tee -a /etc/launchd.conf;
pushd /tmp;
wget https://github.com/aws/aws-sdk-cpp/archive/1.8.14.tar.gz -O /tmp/aws-sdk.tar.gz;
tar -xvf /tmp/aws-sdk.tar.gz > /dev/null;
popd;
pushd /tmp/aws-sdk-cpp-1.8.14;
cmake -DBUILD_ONLY='kinesis;core;s3;transfer' -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_TESTING=OFF .;
make -j4 all;
sudo make install;
popd;
fi
- rustup component add rustfmt-preview
- rustup component add clippy
......
......@@ -22,8 +22,6 @@ portable = ["librocksdb_sys/portable"]
sse = ["librocksdb_sys/sse"]
static_libcpp = ["librocksdb_sys/static_libcpp"]
valgrind = []
# rocksdb-cloud integration
cloud = ["librocksdb_sys/cloud"]
[dependencies]
libc = "0.2.11"
......
......@@ -41,14 +41,3 @@ update_rocksdb:
fi
@git submodule sync
@git submodule update --init --remote librocksdb_sys/rocksdb
update_rocksdb_cloud:
@if [ -n "${ROCKSDB_CLOUD_REPO}" ]; then \
git config --file=.gitmodules submodule.rocksdb-cloud.url https://github.com/${ROCKSDB_CLOUD_REPO}/rocksdb.git; \
fi
@if [ -n "${ROCKSDB_CLOUD_BRANCH}" ]; then \
git config --file=.gitmodules submodule.rocksdb-cloud.branch ${ROCKSDB_CLOUD_BRANCH}; \
fi
@git submodule sync
@git submodule update --init --remote librocksdb_sys/librocksdb_cloud_sys/rocksdb-cloud
\ No newline at end of file
......@@ -8,7 +8,6 @@ links = "rocksdb"
[dependencies]
bzip2-sys = "0.1.8+1.0.8"
libc = "0.2.11"
librocksdb_cloud_sys = { path = "librocksdb_cloud_sys" }
libtitan_sys = { path = "libtitan_sys" }
libz-sys = { version = "1.1", features = ["static"] }
openssl-sys = { version = "0.9.54", optional = true, features = ["vendored"] }
......@@ -27,7 +26,6 @@ jemalloc = ["tikv-jemalloc-sys"]
portable = ["libtitan_sys/portable"]
sse = ["libtitan_sys/sse"]
static_libcpp = []
cloud = []
[build-dependencies]
cc = "1.0.3"
......
......@@ -128,10 +128,6 @@ fn link_cpp(build: &mut Build) {
fn build_rocksdb() -> Build {
let target = env::var("TARGET").expect("TARGET was not set");
let mut cfg = Config::new("rocksdb");
// Conditionally compile with support for RocksDB-Cloud, setting USE_AWS
if cfg!(feature = "cloud") {
println!("cargo:rustc-link-lib=static=rocksdb_cloud");
}
if cfg!(feature = "encryption") {
cfg.register_dep("OPENSSL").define("WITH_OPENSSL", "ON");
println!("cargo:rustc-link-lib=static=crypto");
......@@ -199,13 +195,6 @@ fn build_rocksdb() -> Build {
build.include(cur_dir.join("rocksdb"));
build.include(cur_dir.join("libtitan_sys").join("titan").join("include"));
build.include(cur_dir.join("libtitan_sys").join("titan"));
build.include(
cur_dir
.join("librocksdb_cloud_sys")
.join("rocksdb-cloud")
.join("include"),
);
build.include(cur_dir.join("librocksdb_cloud_sys").join("rocksdb-cloud"));
// Adding rocksdb specific compile macros.
// TODO: should make sure crocksdb compile options is the same as rocksdb and titan.
......@@ -213,9 +202,6 @@ fn build_rocksdb() -> Build {
if cfg!(feature = "encryption") {
build.define("OPENSSL", None);
}
if cfg!(feature = "cloud") {
build.define("USE_AWS", None).define("USE_CLOUD", None);
}
println!("cargo:rustc-link-lib=static=rocksdb");
println!("cargo:rustc-link-lib=static=titan");
......
......@@ -15,7 +15,6 @@
#include "db/column_family.h"
#include "rocksdb/cache.h"
#include "rocksdb/cloud/cloud_env_options.h"
#include "rocksdb/compaction_filter.h"
#include "rocksdb/comparator.h"
#include "rocksdb/convenience.h"
......@@ -188,9 +187,6 @@ using rocksdb::titandb::TitanDBOptions;
using rocksdb::titandb::TitanOptions;
using rocksdb::titandb::TitanReadOptions;
using rocksdb::CloudEnv;
using rocksdb::CloudEnvOptions;
using rocksdb::MemoryAllocator;
#ifdef OPENSSL
......@@ -6579,48 +6575,4 @@ void ctitandb_delete_blob_files_in_ranges_cf(
cf->rep, &ranges[0], num_ranges, include_end));
}
/* RocksDB Cloud */
#ifdef USE_CLOUD
struct crocksdb_cloud_envoptions_t {
CloudEnvOptions rep;
};
crocksdb_env_t* crocksdb_cloud_aws_env_create(
crocksdb_env_t* base_env, const char* src_cloud_bucket,
const char* src_cloud_object, const char* src_cloud_region,
const char* dest_cloud_bucket, const char* dest_cloud_object,
const char* dest_cloud_region, crocksdb_cloud_envoptions_t* cloud_options,
char** errptr) {
// Store a reference to a cloud env. A new cloud env object should be
// associated with every new cloud-db.
CloudEnv* cloud_env;
CloudEnv* cenv;
if (SaveError(errptr,
CloudEnv::NewAwsEnv(
base_env->rep, src_cloud_bucket, src_cloud_object,
src_cloud_region, dest_cloud_bucket, dest_cloud_object,
dest_cloud_region, cloud_options->rep, nullptr, &cenv))) {
assert(cenv != nullptr);
return nullptr;
}
cloud_env = cenv;
crocksdb_env_t* result = new crocksdb_env_t;
result->rep = static_cast<Env*>(cloud_env);
result->block_cipher = nullptr;
result->encryption_provider = nullptr;
result->is_default = true;
return result;
}
crocksdb_cloud_envoptions_t* crocksdb_cloud_envoptions_create() {
crocksdb_cloud_envoptions_t* opt = new crocksdb_cloud_envoptions_t;
return opt;
}
void crocksdb_cloud_envoptions_destroy(crocksdb_cloud_envoptions_t* opt) {
delete opt;
}
#endif
} // end extern "C"
......@@ -2603,21 +2603,6 @@ extern C_ROCKSDB_LIBRARY_API void ctitandb_delete_blob_files_in_ranges_cf(
const char* const* limit_keys, const size_t* limit_keys_lens,
size_t num_ranges, unsigned char include_end, char** errptr);
/* RocksDB Cloud */
#ifdef USE_CLOUD
extern C_ROCKSDB_LIBRARY_API crocksdb_env_t* crocksdb_cloud_aws_env_create(
crocksdb_env_t* base_env, const char* src_cloud_bucket,
const char* src_cloud_object, const char* src_cloud_region,
const char* dest_cloud_bucket, const char* dest_cloud_object,
const char* dest_cloud_region, crocksdb_cloud_envoptions_t* cloud_options,
char** errptr);
extern C_ROCKSDB_LIBRARY_API crocksdb_cloud_envoptions_t*
crocksdb_cloud_envoptions_create();
extern C_ROCKSDB_LIBRARY_API void crocksdb_cloud_envoptions_destroy(
crocksdb_cloud_envoptions_t* opt);
#endif
#ifdef __cplusplus
} /* end extern "C" */
#endif
......
# Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.
cmake_minimum_required(VERSION 3.0)
project(rocksdb_cloud)
enable_language(CXX)
enable_language(C)
# Manage absence of rocksdb code dependence
if (NOT ROCKSDB_GIT_REPO)
set(ROCKSDB_GIT_REPO "https://github.com/tikv/rocksdb.git")
endif()
if (NOT ROCKSDB_GIT_BRANCH)
set(ROCKSDB_GIT_BRANCH "6.4.tikv")
endif()
if (NOT DEFINED ROCKSDB_DIR)
if (GIT_FOUND)
if (WIN32)
execute_process(COMMAND $ENV{COMSPEC} /C ${GIT_EXECUTABLE} clone --branch=${ROCKSDB_GIT_BRANCH} ${ROCKSDB_GIT_REPO})
else()
execute_process(COMMAND ${GIT_EXECUTABLE} clone --branch=${ROCKSDB_GIT_BRANCH} ${ROCKSDB_GIT_REPO})
endif()
set(ROCKSDB_DIR "${CMAKE_BINARY_DIR}/rocksdb")
endif()
endif()
if (NOT DEFINED ROCKSDB_DIR)
message(FATAL_ERROR "ROCKSDB_DIR is not defined.")
endif()
# Append rocksdb modules
list(APPEND CMAKE_MODULE_PATH "${ROCKSDB_DIR}/cmake/modules/")
include("cmake_modules/rocksdb_flags.cmake")
include_directories("${ROCKSDB_DIR}")
include_directories("${ROCKSDB_DIR}/include")
include_directories("rocksdb-cloud")
include_directories("rocksdb-cloud/include")
file(GLOB SOURCES rocksdb-cloud/cloud/*.cc)
add_library(rocksdb_cloud STATIC ${SOURCES} $<TARGET_OBJECTS:cloud_env>)
option(WITH_CLOUD_TESTS "Build with tests." ON)
include_directories(SYSTEM ${ROCKSDB_DIR}/third-party/gtest-1.7.0/fused-src)
add_library(cloud_env OBJECT "rocksdb-cloud/cloud/cloud_env.cc")
include(GNUInstallDirs)
install(DIRECTORY include/rocksdb/cloud
COMPONENT devel
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
install(TARGETS rocksdb_cloud
COMPONENT devel
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
)
[package]
name = "librocksdb_cloud_sys"
version = "0.1.0"
edition = "2018"
build = "build.rs"
links = "rocksdb-cloud"
[features]
cloud = []
[build-dependencies]
cc = "1.0.3"
cmake = "0.1"
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.
extern crate cc;
extern crate cmake;
use std::env;
fn main() {
let cur_dir = env::current_dir().unwrap();
let mut cfg = cmake::Config::new(".");
let dst = cfg
.define("ROCKSDB_DIR", cur_dir.join("..").join("rocksdb"))
.env("USE_AWS", "1")
.build_target("rocksdb_cloud")
.very_verbose(true)
.build();
println!("cargo:rustc-link-search=native={}/build", dst.display());
println!("cargo:rustc-link-lib=static=rocksdb_cloud");
}
Subproject commit ac0e18f441de3e265c9f15d69dec22220f916814
// The library requires this file for `cargo build`
......@@ -46,8 +46,6 @@ use libc::{c_char, c_double, c_int, c_uchar, c_void, size_t};
#[repr(C)]
pub struct Options(c_void);
#[repr(C)]
pub struct CloudEnvOptions(c_void);
#[repr(C)]
pub struct ColumnFamilyDescriptor(c_void);
#[repr(C)]
pub struct DBInstance(c_void);
......@@ -2670,26 +2668,6 @@ extern "C" {
);
}
// RocksDB Cloud
extern "C" {
// NewAWSEnv
pub fn crocksdb_cloud_aws_env_create(
base_env: *mut DBEnv,
src_cloud_bucket: *const c_char,
src_cloud_object: *const c_char,
src_cloud_region: *const c_char,
dest_cloud_bucket: *const c_char,
dest_cloud_object: *const c_char,
dest_cloud_region: *const c_char,
opts: *mut CloudEnvOptions,
err: *mut *mut c_char,
) -> *mut DBEnv;
// CloudEnvOptions
pub fn crocksdb_cloud_envoptions_create() -> *mut CloudEnvOptions;
pub fn crocksdb_cloud_envoptions_destroy(opt: *mut CloudEnvOptions);
}
#[cfg(test)]
mod test {
use super::*;
......
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.
use crocksdb_ffi::{self};
/// Options while opening a file in the cloud to read/write
pub struct CloudEnvOptions {
pub inner: *mut crocksdb_ffi::CloudEnvOptions,
}
impl CloudEnvOptions {
pub fn new() -> CloudEnvOptions {
unsafe {
CloudEnvOptions {
inner: crocksdb_ffi::crocksdb_cloud_envoptions_create(),
}
}
}
}
impl Drop for CloudEnvOptions {
fn drop(&mut self) {
unsafe {
crocksdb_ffi::crocksdb_cloud_envoptions_destroy(self.inner);
}
}
}
......@@ -27,8 +27,6 @@ extern crate tempfile;
#[macro_use]
extern crate lazy_static;
#[cfg(feature = "cloud")]
pub use cloud::CloudEnvOptions;
pub use compaction_filter::{
new_compaction_filter, new_compaction_filter_factory, new_compaction_filter_raw,
CompactionFilter, CompactionFilterContext, CompactionFilterDecision, CompactionFilterFactory,
......@@ -82,8 +80,6 @@ pub use write_batch::{WriteBatch, WriteBatchIter, WriteBatchRef};
#[allow(deprecated)]
pub use rocksdb::Kv;
#[cfg(feature = "cloud")]
mod cloud;
mod compaction_filter;
pub mod comparator;
#[cfg(feature = "encryption")]
......
......@@ -38,8 +38,6 @@ use std::str::from_utf8;
use std::sync::Arc;
use std::{fs, ptr, slice};
#[cfg(feature = "cloud")]
use cloud::CloudEnvOptions;
#[cfg(feature = "encryption")]
use encryption::{DBEncryptionKeyManager, EncryptionKeyManager};
use file_system::{DBFileSystemInspector, FileSystemInspector};
......@@ -2581,47 +2579,6 @@ impl Env {
}
}
// Create an cloud env to operate with AWS S3.
#[cfg(feature = "cloud")]
pub fn new_aws_env(
base_env: Arc<Env>,
src_cloud_bucket: &str,
src_cloud_object: &str,
src_cloud_region: &str,
dest_cloud_bucket: &str,
dest_cloud_object: &str,
dest_cloud_region: &str,
opts: CloudEnvOptions,
) -> Result<Env, String> {
let mut err = ptr::null_mut();
let src_cloud_bucket = CString::new(src_cloud_bucket).unwrap();
let src_cloud_object = CString::new(src_cloud_object).unwrap();
let src_cloud_region = CString::new(src_cloud_region).unwrap();
let dest_cloud_bucket = CString::new(dest_cloud_bucket).unwrap();
let dest_cloud_object = CString::new(dest_cloud_object).unwrap();
let dest_cloud_region = CString::new(dest_cloud_region).unwrap();
let env = unsafe {
crocksdb_ffi::crocksdb_cloud_aws_env_create(
base_env.inner,
src_cloud_bucket.as_ptr(),
src_cloud_object.as_ptr(),
src_cloud_region.as_ptr(),
dest_cloud_bucket.as_ptr(),
dest_cloud_object.as_ptr(),
dest_cloud_region.as_ptr(),
opts.inner,
&mut err,
)
};
if !err.is_null() {
return Err(unsafe { crocksdb_ffi::error_message(err) });
}
Ok(Env {
inner: env,
base: Some(base_env),
})
}
// Create a ctr encrypted env with a given base env and a given ciper text.
// The length of ciper text must be 2^n, and must be less or equal to 2048.
// The recommanded block size are 1024, 512 and 256.
......@@ -3552,24 +3509,6 @@ mod test {
assert_eq!(path, first_path.as_str());
}
#[cfg(feature = "cloud")]
#[test]
fn test_cloud_aws_env_creation() {
let k_db_path = "/tmp/rocksdb_main_db";
let k_bucket_suffix = "cloud.clone.example.";
let k_region = "us-west-2";
let _db = Env::new_aws_env(
Arc::new(Env::default()),
&k_bucket_suffix,
&k_db_path,
&k_region,
&k_bucket_suffix,
&k_db_path,
&k_region,
CloudEnvOptions::new(),
);
}
#[test]
fn test_write_append() {
let mut opts = DBOptions::new();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment