Skip to content

Commit

Permalink
Package rocksdb deb
Browse files Browse the repository at this point in the history
  • Loading branch information
lizhanhui committed Jun 22, 2023
1 parent cb68b46 commit 2467d38
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 12 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ buckifier/*.pyc
buckifier/__pycache__

compile_commands.json
compile_commands.events.json
clang-format-diff.py
.py3/

Expand Down
16 changes: 16 additions & 0 deletions dist/build.sh
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions dist/rocksdb/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Package: rocksdb
Version: 8.1.1
Maintainer: Li Zhanhui
Architecture: amd64
Description: Pre-built RocksDB
2 changes: 2 additions & 0 deletions dist/rocksdb/DEBIAN/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
ldconfig
4 changes: 4 additions & 0 deletions dist/rocksdb/usr/local/include/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
4 changes: 4 additions & 0 deletions dist/rocksdb/usr/local/lib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
7 changes: 3 additions & 4 deletions env/env_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include <cassert>


#include "port/lang.h"
#if !defined(OS_WIN)

Expand Down Expand Up @@ -370,9 +369,9 @@ class PosixEnv : public CompositeEnv {
return Status::OK();
}
void SetCpuSet(std::vector<int> 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<int>::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) {
Expand Down
8 changes: 5 additions & 3 deletions include/rocksdb/c.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions include/rocksdb/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -675,7 +674,7 @@ class Env : public Customizable {

// Pointer to the underlying SystemClock implementation
std::shared_ptr<SystemClock> system_clock_;

std::vector<int> cpu_set_;

private:
Expand Down
6 changes: 3 additions & 3 deletions util/threadpool_imp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2467d38

Please sign in to comment.