From 2467d38e842df1bbbc594c2e7f90cf507ac1fdf6 Mon Sep 17 00:00:00 2001 From: Li Zhanhui Date: Tue, 13 Jun 2023 11:40:20 +0000 Subject: [PATCH] Package rocksdb deb --- .github/workflows/release.yml | 27 +++++++++++++++++++++++ .gitignore | 1 + dist/build.sh | 16 ++++++++++++++ dist/rocksdb/DEBIAN/control | 5 +++++ dist/rocksdb/DEBIAN/postinst | 2 ++ dist/rocksdb/usr/local/include/.gitignore | 4 ++++ dist/rocksdb/usr/local/lib/.gitignore | 4 ++++ env/env_posix.cc | 7 +++--- include/rocksdb/c.h | 8 ++++--- include/rocksdb/env.h | 3 +-- util/threadpool_imp.cc | 6 ++--- 11 files changed, 71 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100755 dist/build.sh create mode 100644 dist/rocksdb/DEBIAN/control create mode 100755 dist/rocksdb/DEBIAN/postinst create mode 100644 dist/rocksdb/usr/local/include/.gitignore create mode 100644 dist/rocksdb/usr/local/lib/.gitignore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000000..866b812a41b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,27 @@ +name: Data Node Release + +on: + push: + tags: + - 'rocksdb-v[0-9]+.[0-9]+.[0-9]+b[0-9]+' + +permissions: + contents: write + +jobs: + package: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04] + steps: + - uses: actions/checkout@v2 + - name: Build + working-directory: ./dist + run: | + ./build.sh + - name: Release + uses: softprops/action-gh-release@v1 + with: + generate_release_notes: true + files: ./dist/rocksdb.deb diff --git a/.gitignore b/.gitignore index 1ff5b7437e4..5b07a718a81 100644 --- a/.gitignore +++ b/.gitignore @@ -87,6 +87,7 @@ buckifier/*.pyc buckifier/__pycache__ compile_commands.json +compile_commands.events.json clang-format-diff.py .py3/ diff --git a/dist/build.sh b/dist/build.sh new file mode 100755 index 00000000000..26884408c1a --- /dev/null +++ b/dist/build.sh @@ -0,0 +1,16 @@ +#!/bin/bash +BASEDIR=$(dirname "$0") +cd "$BASEDIR/.." || exit 1 +PORTABLE=1 make shared_lib -j $(nproc) || exit 1 +cp --no-dereference --preserve=links librocksdb.so* dist/rocksdb/usr/local/lib/ +cp -r include/rocksdb dist/rocksdb/usr/local/include/ +cd dist +strip -g rocksdb/usr/local/lib/librocksdb.so +rm rocksdb/usr/local/lib/.gitignore +rm rocksdb/usr/local/include/.gitignore +arch=$(uname -m) +if [ "$arch" == "aarch64" ]; then + echo "Change architecture in control file" + sed -i 's/amd64/arm64/g' rocksdb/DEBIAN/control +fi +dpkg-deb -Zxz -b rocksdb diff --git a/dist/rocksdb/DEBIAN/control b/dist/rocksdb/DEBIAN/control new file mode 100644 index 00000000000..66c710af42e --- /dev/null +++ b/dist/rocksdb/DEBIAN/control @@ -0,0 +1,5 @@ +Package: rocksdb +Version: 8.1.1 +Maintainer: Li Zhanhui +Architecture: amd64 +Description: Pre-built RocksDB diff --git a/dist/rocksdb/DEBIAN/postinst b/dist/rocksdb/DEBIAN/postinst new file mode 100755 index 00000000000..36c1a54d561 --- /dev/null +++ b/dist/rocksdb/DEBIAN/postinst @@ -0,0 +1,2 @@ +#!/bin/bash +ldconfig \ No newline at end of file diff --git a/dist/rocksdb/usr/local/include/.gitignore b/dist/rocksdb/usr/local/include/.gitignore new file mode 100644 index 00000000000..5e7d2734cfc --- /dev/null +++ b/dist/rocksdb/usr/local/include/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/dist/rocksdb/usr/local/lib/.gitignore b/dist/rocksdb/usr/local/lib/.gitignore new file mode 100644 index 00000000000..5e7d2734cfc --- /dev/null +++ b/dist/rocksdb/usr/local/lib/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/env/env_posix.cc b/env/env_posix.cc index 1431e9a3846..de411528901 100644 --- a/env/env_posix.cc +++ b/env/env_posix.cc @@ -15,7 +15,6 @@ #include - #include "port/lang.h" #if !defined(OS_WIN) @@ -370,9 +369,9 @@ class PosixEnv : public CompositeEnv { return Status::OK(); } void SetCpuSet(std::vector cpu_set) override { - printf("env_posix.cc: SetCpuSet, size = %d\n", cpu_set.size()); - for(int i = 0; i < cpu_set.size(); i++) { - printf("env_posix.cc: cpu_set[%d]: %d\n", i, cpu_set[i]); + printf("env_posix.cc: SetCpuSet, size = %ld\n", cpu_set.size()); + for (std::vector::size_type i = 0; i < cpu_set.size(); i++) { + printf("env_posix.cc: cpu_set[%ld]: %d\n", i, cpu_set[i]); } #ifdef _GNU_SOURCE for (int processor_id : cpu_set) { diff --git a/include/rocksdb/c.h b/include/rocksdb/c.h index 906795c98f7..104596891d3 100644 --- a/include/rocksdb/c.h +++ b/include/rocksdb/c.h @@ -2089,8 +2089,9 @@ extern ROCKSDB_LIBRARY_API void rocksdb_envoptions_destroy( extern ROCKSDB_LIBRARY_API void rocksdb_create_dir_if_missing( rocksdb_env_t* env, const char* path, char** errptr); -extern ROCKSDB_LIBRARY_API void rocksdb_env_set_cpu_set( - rocksdb_env_t* env, const int* cpu_set, size_t n); +extern ROCKSDB_LIBRARY_API void rocksdb_env_set_cpu_set(rocksdb_env_t* env, + const int* cpu_set, + size_t n); /* SstFile */ @@ -2238,7 +2239,8 @@ extern ROCKSDB_LIBRARY_API rocksdb_fifo_compaction_options_t* rocksdb_fifo_compaction_options_create(void); extern ROCKSDB_LIBRARY_API void rocksdb_fifo_compaction_options_set_allow_compaction( - rocksdb_fifo_compaction_options_t* fifo_opts, unsigned char allow_compaction); + rocksdb_fifo_compaction_options_t* fifo_opts, + unsigned char allow_compaction); extern ROCKSDB_LIBRARY_API unsigned char rocksdb_fifo_compaction_options_get_allow_compaction( rocksdb_fifo_compaction_options_t* fifo_opts); diff --git a/include/rocksdb/env.h b/include/rocksdb/env.h index c3fb2348487..d6f5321a202 100644 --- a/include/rocksdb/env.h +++ b/include/rocksdb/env.h @@ -664,7 +664,6 @@ class Env : public Customizable { this->cpu_set_.swap(cpu_set); } - protected: // The pointer to an internal structure that will update the // status of each thread. @@ -675,7 +674,7 @@ class Env : public Customizable { // Pointer to the underlying SystemClock implementation std::shared_ptr system_clock_; - + std::vector cpu_set_; private: diff --git a/util/threadpool_imp.cc b/util/threadpool_imp.cc index 4e9d66beabe..6b343571021 100644 --- a/util/threadpool_imp.cc +++ b/util/threadpool_imp.cc @@ -125,9 +125,9 @@ struct ThreadPoolImpl::Impl { return released_threads_in_success; } - #ifdef _GNU_SOURCE - void SetCpuSet(cpu_set_t* cpu_set) { cpu_set_ = cpu_set; } - #endif +#ifdef _GNU_SOURCE + void SetCpuSet(cpu_set_t* cpu_set) { cpu_set_ = cpu_set; } +#endif private: static void BGThreadWrapper(void* arg);