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

Encrypt demo all #84

Closed
wants to merge 83 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
baec61d
fix mutation_log_test.cpp
acelyc111 Aug 17, 2023
6c14533
encrypt_demo_0
acelyc111 Aug 17, 2023
58ff440
fmt
acelyc111 Aug 23, 2023
7ee766b
app base
acelyc111 Aug 23, 2023
c0f6303
fix dup log test
acelyc111 Aug 24, 2023
a9b23b7
pegasus_unit_test test ok
acelyc111 Aug 24, 2023
ab4bd19
pegasus ut
acelyc111 Aug 24, 2023
7e2c964
fix
acelyc111 Aug 24, 2023
4498c38
pass more tests
acelyc111 Aug 25, 2023
304058c
base api test
acelyc111 Aug 27, 2023
6f12861
function test
acelyc111 Aug 28, 2023
7a6dc4e
enc enc
acelyc111 Aug 28, 2023
0402858
iwyu
acelyc111 Aug 28, 2023
c309480
make
acelyc111 Aug 28, 2023
bee9bd5
revert
acelyc111 Aug 28, 2023
31d214a
cmake
acelyc111 Aug 28, 2023
7c2755f
aio
acelyc111 Aug 28, 2023
ad0b909
iwyu
acelyc111 Aug 28, 2023
ccc2f2e
aio test
acelyc111 Aug 28, 2023
d2d216e
hdfs
acelyc111 Aug 28, 2023
bf71cc5
hdfs fmt
acelyc111 Aug 28, 2023
6837d53
block service
acelyc111 Aug 28, 2023
29cc755
direct io
acelyc111 Aug 28, 2023
a71b2ac
dsn_block_service_test
acelyc111 Aug 28, 2023
3c37234
fmt
acelyc111 Aug 28, 2023
0f6188d
geo
acelyc111 Aug 28, 2023
318e0cc
pegasus_geo_test
acelyc111 Aug 28, 2023
658c147
nfs
acelyc111 Aug 28, 2023
6f36ee8
add copy util
acelyc111 Aug 28, 2023
98cb7a1
fix reopen bug, add new md5sum
acelyc111 Aug 29, 2023
057877a
1
acelyc111 Aug 29, 2023
d019d11
fmt
acelyc111 Aug 29, 2023
c711cd3
add todo
acelyc111 Aug 29, 2023
94c9759
add todo
acelyc111 Aug 29, 2023
3b016d5
dsn_replica_dup_test
acelyc111 Aug 29, 2023
7be7252
src/replica/replica_restore.cpp
acelyc111 Aug 29, 2023
f55d6c8
base info
acelyc111 Aug 29, 2023
f435743
base info
acelyc111 Aug 29, 2023
4325151
/mutation_log_test.cpp
acelyc111 Aug 29, 2023
204e42f
simple_kv.server.impl.cpp
acelyc111 Aug 30, 2023
1db5292
simple kv
acelyc111 Aug 30, 2023
2c55eb0
replica_test.cpp
acelyc111 Aug 30, 2023
1ad91fd
utils
acelyc111 Aug 30, 2023
ab0068d
remove read/write file
acelyc111 Aug 30, 2023
8842d85
fs
acelyc111 Aug 30, 2023
68e5cbf
add ut
acelyc111 Aug 30, 2023
c22740c
src/server/test/hotkey_collector_test.cpp
acelyc111 Aug 30, 2023
46dba17
revert opts
acelyc111 Aug 30, 2023
240a9b3
comment
acelyc111 Aug 30, 2023
46440e1
iwyu
acelyc111 Aug 30, 2023
94a5137
ini
acelyc111 Aug 30, 2023
29b6073
fix cold backup
acelyc111 Aug 30, 2023
69becf1
bulkload test
acelyc111 Aug 31, 2023
8ad6101
1
acelyc111 Aug 31, 2023
0ff0c46
ut
acelyc111 Aug 31, 2023
3479b9a
fix
acelyc111 Aug 31, 2023
670f434
bulk_load_test.bulk_load_test_failed2 ok
acelyc111 Aug 31, 2023
b5654cb
log
acelyc111 Sep 1, 2023
96ac794
fix
acelyc111 Sep 4, 2023
5664262
ut
acelyc111 Sep 4, 2023
51c7497
all ut
acelyc111 Sep 4, 2023
8ebdba7
fix bulkload ut
acelyc111 Sep 5, 2023
d2c54b0
aio fmt
acelyc111 Sep 5, 2023
76fc79f
aio
acelyc111 Sep 5, 2023
f51c939
cmake
acelyc111 Sep 5, 2023
bec0cbc
rename utils
acelyc111 Sep 6, 2023
ccbde3b
copy
acelyc111 Sep 6, 2023
9a76eb4
copy
acelyc111 Sep 6, 2023
f5ec101
copy file test
acelyc111 Sep 6, 2023
924df30
file
acelyc111 Sep 6, 2023
91ef39c
local service
acelyc111 Sep 6, 2023
8d0d191
config
acelyc111 Sep 6, 2023
2717004
copy test
acelyc111 Sep 6, 2023
5dfd6e3
fix
acelyc111 Sep 6, 2023
6edb296
fmt
acelyc111 Sep 6, 2023
90b7aed
close
acelyc111 Sep 6, 2023
e9c9ca8
block service
acelyc111 Sep 6, 2023
99cdf51
log
acelyc111 Sep 6, 2023
5ce23a6
ut
acelyc111 Sep 7, 2023
8fe5e13
hdfs test
acelyc111 Sep 7, 2023
bcc575a
hdfs
acelyc111 Sep 7, 2023
9142ce0
revert
acelyc111 Sep 7, 2023
41b8270
iwyu
acelyc111 Sep 7, 2023
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
68 changes: 34 additions & 34 deletions .github/workflows/lint_and_test_cpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
# Build thirdparties and leave some necessary libraries and source
run: |
mkdir build
cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=ON -B build/
cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=1 -B build/
cmake --build build/ -j $(nproc)
rm -rf build/Build build/Download/[a-y]* build/Source/[a-g]* build/Source/[i-q]* build/Source/[s-z]*
../scripts/download_hadoop.sh hadoop-bin
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
run: |
rm -f /root/thirdparties-src.zip
mkdir build
cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=ON -B build/
cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=1 -B build/
cmake --build build/ -j $(nproc)
rm -rf build/Build build/Download/[a-y]* build/Source/[a-g]* build/Source/[i-q]* build/Source/[s-z]*
find ./ -name '*CMakeFiles*' -type d -exec rm -rf "{}" +
Expand Down Expand Up @@ -195,39 +195,39 @@ jobs:
matrix:
test_module:
- backup_restore_test
- base_api_test
- base_test
- base_api_test # added enc, ing
- base_test # ok
- bulk_load_test
- detect_hotspot_test
- dsn_aio_test
- dsn_block_service_test
- dsn_client_test
- dsn.failure_detector.tests
- dsn_http_test
- dsn_meta_state_tests
- dsn.meta.test
- dsn_nfs_test
- dsn_perf_counter_test
- dsn_replica_backup_test
- dsn_replica_bulk_load_test
- dsn_replica_dup_test
- dsn_replica_split_test
- dsn.replica.test
- dsn_replication_common_test
- dsn.replication.simple_kv
- dsn.rep_tests.simple_kv
- dsn_runtime_tests
- dsn_utils_tests
- dsn.zookeeper.tests
- detect_hotspot_test # enc ignored, ok
- dsn_aio_test # added enc, ok
- dsn_block_service_test # partial added enc, ok
- dsn_client_test # ok
- dsn.failure_detector.tests # ok
- dsn_http_test # ok
- dsn_meta_state_tests # added enc, ok
- dsn.meta.test # need add enc, ok
- dsn_nfs_test # ok, need encrypted test files
- dsn_perf_counter_test # ok
- dsn_replica_backup_test # added enc, ok
- dsn_replica_bulk_load_test # added enc, ok
- dsn_replica_dup_test # added enc, ok
- dsn_replica_split_test # added enc, ok
- dsn.replica.test # added enc, ok
- dsn_replication_common_test # added enc, ok
- dsn.replication.simple_kv # ok
- dsn.rep_tests.simple_kv # need add enc, ok
- dsn_runtime_tests # ok
- dsn_utils_tests # ok
- dsn.zookeeper.tests # ok
# TODO(yingchun): Disable it because we find it's too flaky, we will re-enable it after
# it has been optimized.
# - partition_split_test
- pegasus_geo_test
- pegasus_rproxy_test
- pegasus_unit_test
- recovery_test
- restore_test
- throttle_test
- pegasus_geo_test # added enc, ok
- pegasus_rproxy_test # ok
- pegasus_unit_test # added enc, ok
- recovery_test -
- restore_test -
- throttle_test -
needs: build_Release
runs-on: ubuntu-latest
container:
Expand Down Expand Up @@ -296,7 +296,7 @@ jobs:
run: |
rm -f /root/thirdparties-src.zip
mkdir build
cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=ON -B build/
cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=1 -B build/
cmake --build build/ -j $(nproc)
rm -rf build/Build build/Download/[a-y]* build/Source/[a-g]* build/Source/[i-q]* build/Source/[s-z]*
find ./ -name '*CMakeFiles*' -type d -exec rm -rf "{}" +
Expand Down Expand Up @@ -438,7 +438,7 @@ jobs:
# run: |
# rm -f /root/thirdparties-src.zip
# mkdir build
# cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=ON -B build/
# cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=1 -B build/
# cmake --build build/ -j $(nproc)
# rm -rf build/Build build/Download/[a-y]* build/Source/[a-g]* build/Source/[i-q]* build/Source/[s-z]*
# find ./ -name '*CMakeFiles*' -type d -exec rm -rf "{}" +
Expand Down Expand Up @@ -576,7 +576,7 @@ jobs:
run: |
rm -f /root/thirdparties-src.zip
mkdir build
cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=ON -DUSE_JEMALLOC=ON -B build/
cmake -DCMAKE_BUILD_TYPE=Release -DROCKSDB_PORTABLE=1 -DUSE_JEMALLOC=ON -B build/
cmake --build build/ -j $(nproc)
rm -rf build/Build build/Download/[a-y]* build/Source/[a-g]* build/Source/[i-q]* build/Source/[s-z]*
find ./ -name '*CMakeFiles*' -type d -exec rm -rf "{}" +
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/thirdparty-regular-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ jobs:
build-args: |
GITHUB_BRANCH=${{ github.ref_name }}
OS_VERSION=${{ matrix.osversion }}
ROCKSDB_PORTABLE=ON
ROCKSDB_PORTABLE=1
HADOOP_BIN_PATH=hadoop-bin
ZOOKEEPER_BIN_PATH=zookeeper-bin
- name: Image digest
Expand Down Expand Up @@ -203,7 +203,7 @@ jobs:
build-args: |
GITHUB_BRANCH=${{ github.ref_name }}
OS_VERSION=${{ matrix.osversion }}
ROCKSDB_PORTABLE=ON
ROCKSDB_PORTABLE=1
USE_JEMALLOC=ON
HADOOP_BIN_PATH=hadoop-bin
ZOOKEEPER_BIN_PATH=zookeeper-bin
Expand Down
12 changes: 8 additions & 4 deletions cmake_modules/BaseFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function(dsn_setup_compiler_flags)
# We want access to the PRI* print format macros.
add_definitions(-D__STDC_FORMAT_MACROS)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -gdwarf-4" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -gdwarf-4" CACHE STRING "" FORCE)

# -Wall: Enable all warnings.
add_compile_options(-Wall)
Expand All @@ -217,6 +217,7 @@ function(dsn_setup_compiler_flags)
add_compile_options(-Wno-deprecated-declarations)
add_compile_options(-Wno-inconsistent-missing-override)
add_compile_options(-Wno-attributes)
add_compile_options(-Wno-register) # kbr5.h uses the legacy 'register' keyword.
# -fno-omit-frame-pointer
# use frame pointers to allow simple stack frame walking for backtraces.
# This has a small perf hit but worth it for the ability to profile in production
Expand Down Expand Up @@ -389,10 +390,13 @@ function(dsn_common_setup)
set(BUILD_SHARED_LIBS OFF)

include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++1y" COMPILER_SUPPORTS_CXX1Y)
if(NOT ${COMPILER_SUPPORTS_CXX1Y})
message(FATAL_ERROR "You need a compiler with C++1y support.")
CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
if(NOT ${COMPILER_SUPPORTS_CXX17})
message(FATAL_ERROR "You need a compiler with C++17 support.")
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

dsn_setup_system_libs()
dsn_setup_compiler_flags()
Expand Down
2 changes: 1 addition & 1 deletion docker/thirdparties-bin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ COPY --from=builder /root/thirdparties-src.zip /root/thirdparties-src.zip

ARG GITHUB_BRANCH=master
ARG GITHUB_REPOSITORY_URL=https://github.com/apache/incubator-pegasus.git
ARG ROCKSDB_PORTABLE=OFF
ARG ROCKSDB_PORTABLE=0
ARG USE_JEMALLOC=OFF
ARG HADOOP_BIN_PATH
ARG ZOOKEEPER_BIN_PATH
Expand Down
4 changes: 2 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ function run_build()
ENABLE_GPERF=ON
SKIP_THIRDPARTY=NO
SANITIZER=""
ROCKSDB_PORTABLE=OFF
ROCKSDB_PORTABLE=0
USE_JEMALLOC=OFF
BUILD_TEST=OFF
IWYU=""
Expand Down Expand Up @@ -177,7 +177,7 @@ function run_build()
SKIP_THIRDPARTY=YES
;;
--enable_rocksdb_portable)
ROCKSDB_PORTABLE=ON
ROCKSDB_PORTABLE=1
;;
--use_jemalloc)
ENABLE_GPERF=OFF
Expand Down
2 changes: 1 addition & 1 deletion src/aio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ set(MY_PROJ_SRC "")
#"GLOB" for non - recursive search
set(MY_SRC_SEARCH_MODE "GLOB")

set(MY_PROJ_LIBS dsn_runtime)
set(MY_PROJ_LIBS dsn_runtime rocksdb)

#Extra files that will be installed
set(MY_BINPLACES "")
Expand Down
15 changes: 12 additions & 3 deletions src/aio/aio_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@
#pragma once

#include <stdint.h>
#include <memory>
#include <string>

#include "utils/error_code.h"
#include "utils/factory_store.h"

namespace rocksdb {
class RandomAccessFile;
class RandomRWFile;
} // namespace rocksdb

namespace dsn {

class aio_context;
Expand All @@ -46,6 +53,7 @@ struct linux_fd_t
inline bool is_invalid() const { return fd == DSN_INVALID_FILE_HANDLE; }
};

// TODO(yingchun): remove the class
class aio_provider
{
public:
Expand All @@ -60,10 +68,11 @@ class aio_provider
explicit aio_provider(disk_engine *disk);
virtual ~aio_provider() = default;

virtual linux_fd_t open(const char *file_name, int flag, int pmode) = 0;
virtual std::unique_ptr<rocksdb::RandomAccessFile> open_read_file(const std::string &fname) = 0;
virtual std::unique_ptr<rocksdb::RandomRWFile> open_write_file(const std::string &fname) = 0;

virtual error_code close(linux_fd_t fd) = 0;
virtual error_code flush(linux_fd_t fd) = 0;
virtual error_code close(rocksdb::RandomRWFile *rwf) = 0;
virtual error_code flush(rocksdb::RandomRWFile *rwf) = 0;
virtual error_code write(const aio_context &aio_ctx, /*out*/ uint64_t *processed_bytes) = 0;
virtual error_code read(const aio_context &aio_ctx, /*out*/ uint64_t *processed_bytes) = 0;

Expand Down
12 changes: 10 additions & 2 deletions src/aio/disk_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#include "disk_engine.h"

#include <algorithm>
#include <list>
// IWYU pragma: no_include <string>
#include <utility>
Expand All @@ -46,6 +45,10 @@
#include "utils/link.h"
#include "utils/threadpool_code.h"

namespace rocksdb {
class RandomRWFile;
} // namespace rocksdb

namespace dsn {
DEFINE_TASK_CODE_AIO(LPC_AIO_BATCH_WRITE, TASK_PRIORITY_COMMON, THREAD_POOL_DEFAULT)

Expand Down Expand Up @@ -103,22 +106,26 @@ aio_task *disk_write_queue::unlink_next_workload(void *plength)
return first;
}

disk_file::disk_file(linux_fd_t fd) : _fd(fd) {}
disk_file::disk_file(std::unique_ptr<rocksdb::RandomAccessFile> rf) : _read_file(std::move(rf)) {}
disk_file::disk_file(std::unique_ptr<rocksdb::RandomRWFile> wf) : _write_file(std::move(wf)) {}

aio_task *disk_file::read(aio_task *tsk)
{
CHECK(_read_file, "");
tsk->add_ref(); // release on completion, see `on_read_completed`.
return _read_queue.add_work(tsk, nullptr);
}

aio_task *disk_file::write(aio_task *tsk, void *ctx)
{
CHECK(_write_file, "");
tsk->add_ref(); // release on completion
return _write_queue.add_work(tsk, ctx);
}

aio_task *disk_file::on_read_completed(aio_task *wk, error_code err, size_t size)
{
CHECK(_read_file, "");
CHECK(wk->next == nullptr, "");
auto ret = _read_queue.on_work_completed(wk, nullptr);
wk->enqueue(err, size);
Expand All @@ -129,6 +136,7 @@ aio_task *disk_file::on_read_completed(aio_task *wk, error_code err, size_t size

aio_task *disk_file::on_write_completed(aio_task *wk, void *ctx, error_code err, size_t size)
{
CHECK(_write_file, "");
auto ret = _write_queue.on_work_completed(wk, ctx);

while (wk) {
Expand Down
12 changes: 9 additions & 3 deletions src/aio/disk_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include <stdint.h>
#include <memory>

#include <rocksdb/env.h>

#include "aio/aio_task.h"
#include "aio_provider.h"
#include "utils/singleton.h"
Expand All @@ -56,17 +58,21 @@ class disk_write_queue : public work_queue<aio_task>
class disk_file
{
public:
explicit disk_file(linux_fd_t fd);
explicit disk_file(std::unique_ptr<rocksdb::RandomAccessFile> rf);
explicit disk_file(std::unique_ptr<rocksdb::RandomRWFile> wf);
aio_task *read(aio_task *tsk);
aio_task *write(aio_task *tsk, void *ctx);

aio_task *on_read_completed(aio_task *wk, error_code err, size_t size);
aio_task *on_write_completed(aio_task *wk, void *ctx, error_code err, size_t size);

linux_fd_t native_handle() const { return _fd; }
rocksdb::RandomAccessFile *rfile() const { return _read_file.get(); }
rocksdb::RandomRWFile *wfile() const { return _write_file.get(); }

private:
linux_fd_t _fd;
// TODO(yingchun): unify to use a single RandomRWFile member variable.
std::unique_ptr<rocksdb::RandomAccessFile> _read_file;
std::unique_ptr<rocksdb::RandomRWFile> _write_file;
disk_write_queue _write_queue;
work_queue<aio_task> _read_queue;
};
Expand Down
Loading