Skip to content

Commit

Permalink
Merge branch 'sideplugin-8.11.0-2023-12-17-5b981b64' into sideplugin-…
Browse files Browse the repository at this point in the history
…8.11.0-2023-12-21-106058c0
  • Loading branch information
rockeet committed Dec 23, 2023
2 parents 106058c + 98320a2 commit 9f98780
Show file tree
Hide file tree
Showing 312 changed files with 11,540 additions and 2,989 deletions.
129 changes: 129 additions & 0 deletions .github/workflows/topling-jni.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# TODO: How to cache make files / speed up build progress here?
name: "build topling-jni"

on:
workflow_dispatch:
inputs:
repository_url:
required: true
default: 'topling/toplingdb'
repository_branch:
required: false
default: 'sideplugin-7.10.0-2022-12-21-bec42648'
test:
required: false
type: boolean
description: test SideGetBenchmarks
default: false
deploy_maven:
required: false
type: boolean
description: publish to maven repo
default: true

jobs:
build:
# refer https://github.com/actions/runner-images to get the details
runs-on: ubuntu-latest
env:
GCC_VER: "11.3" # TODO: better get from the 'gcc --version'
GITHUB_TOKEN: ${{ github.token }}
REP_URL: ${{ inputs.repository_url }}
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ inputs.repository_url }}
ref: ${{ inputs.repository_branch }}
fetch-depth: 1

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
#- name: Cache Maven # Replace by setup-java now
# uses: actions/cache@v3
# with:
# path: ~/.m2/repository
# key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
# restore-keys: ${{ runner.os }}-m2

- name: Init Env & Compile RocksDB
run: |
cat $GITHUB_WORKSPACE/settings.xml
sudo apt-get update -y && sudo apt-get install -y \
libjemalloc-dev libaio-dev libgflags-dev zlib1g-dev \
libbz2-dev libcurl4-gnutls-dev liburing-dev \
libsnappy-dev libbz2-dev liblz4-dev libzstd-dev
gcc --version
git submodule update --init --recursive
mkdir -p ~/.ssh && mkdir -p /opt/lib
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
# this step could take a long time?
make -j`nproc` DEBUG_LEVEL=0 shared_lib
sudo make install-shared PREFIX=/opt
ls -l /opt/lib
- name: Compile RocksDBJava
run: |
echo $JAVA_HOME
make rocksdbjava -j`nproc` DEBUG_LEVEL=0
- name: Move to Local Maven Repo
run: |
cd java/target || exit
cp -v rocksdbjni-7.10.0-linux64.jar rocksdbjni-7.10.0-SNAPSHOT-linux64.jar
mvn install:install-file -ntp -Dfile=rocksdbjni-7.10.0-SNAPSHOT-linux64.jar \
-DgroupId=org.rocksdb -DartifactId=rocksdbjni -Dversion=7.10.0-SNAPSHOT -Dpackaging=jar
# TODO: why 'deploy' doesn't include install step here? if we only use deploy, will lack local jar
if ${{ inputs.deploy_maven }}; then
# TODO: what's the pom file for it? add with '-DpomFile=/xx/pom.xml'
mvn deploy:deploy-file -e -s $GITHUB_WORKSPACE/settings.xml \
-DpomFile=$GITHUB_WORKSPACE/java/pom.xml.template \
-Durl=https://maven.pkg.github.com/$REP_URL -DrepositoryId=github \
-Dfile=rocksdbjni-7.10.0-SNAPSHOT-linux64.jar -DgroupId=org.rocksdb \
-DartifactId=rocksdbjni -Dversion=7.10.0-SNAPSHOT -Dpackaging=jar
fi
# for compile jmh.jar to test the performance
- name: Build SideGetBenchmarks with Maven
run: |
echo ${{ github.workspace }} && echo $GITHUB_WORKSPACE
pwd && ls -l
(cd java/jmh && ls -l && pwd) || exit
mvn clean package -e -ntp -f $GITHUB_WORKSPACE/java/jmh/pom.xml # -B in non-interactive (Batch) mode
- name: Run SideGetBenchmarks & Check it
if: ${{ inputs.test }}
run: |
mkdir -p /dev/shm/db_bench_community
cd $GITHUB_WORKSPACE/java/jmh || exit
ls ../../sideplugin/rockside/src/topling/web
cp -v $GITHUB_WORKSPACE/sideplugin/rockside/src/topling/web/{style.css,index.html} /dev/shm/db_bench_community
echo $LD_LIBRARY_PATH
export LD_LIBRARY_PATH=/opt/lib:$LD_LIBRARY_PATH # for libterark-*
echo $LD_LIBRARY_PATH && ls -l /opt/lib
# Note: webserver should visit while running
export LD_PRELOAD=libterark-zbs-g++-11.3-r.so:libterark-fsa-g++-11.3-r.so:libjemalloc.so
java -jar target/rocksdbjni-jmh-1.0-SNAPSHOT-benchmarks.jar \
-p keyCount=1000 -p keySize=128 -p valueSize=32768 \
-p sideConf=$GITHUB_WORKSPACE/sideplugin/rockside/sample-conf/db_bench_community.yaml SideGetBenchmarks
- name: Publish JAR to GitHub Packages
if: ${{ inputs.deploy_maven }}
run: |
cd $GITHUB_WORKSPACE/java/jmh || exit
ls -l $GITHUB_WORKSPACE && tail -15 pom.xml
mvn deploy -e -f $GITHUB_WORKSPACE/java/jmh/pom.xml -s $GITHUB_WORKSPACE/settings.xml \
-DaltDeploymentRepository=github::default::https://maven.pkg.github.com/$REP_URL
#env:
# GITHUB_TOKEN: ${{ github.token }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ rocksdb.pc
*.dylib*
*.gcda
*.gcno
*.log
*.o
*.o.tmp
*.so
Expand All @@ -25,11 +26,13 @@ rocksdb.pc
*.vcxproj
*.vcxproj.filters
*.sln
*.sst
*.cmake
.watchmanconfig
CMakeCache.txt
CMakeFiles/
build/
build-ut/

ldb
manifest_dump
Expand Down Expand Up @@ -98,3 +101,8 @@ cmake-build-*
third-party/folly/
.cache
*.sublime-*
*_dbg
*_test

generated-sources
target
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "sideplugin/rockside"]
path = sideplugin/rockside
url = https://github.com/topling/rockside.git
68 changes: 68 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ else()
endif()
endif()

include_directories(sideplugin/rockside/src)

option(WITH_MD_LIBRARY "build with MD" ON)
if(WIN32 AND MSVC)
if(WITH_MD_LIBRARY)
Expand All @@ -181,6 +183,11 @@ if(WIN32 AND MSVC)
endif()

if(MSVC)
if(MSVC_VERSION LESS 1926)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /experimental:preprocessor")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:preprocessor")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi /nologo /EHsc /GS /Gd /GR /GF /fp:precise /Zc:wchar_t /Zc:forScope /errorReport:queue")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FC /d2Zi+ /W4 /wd4127 /wd4800 /wd4996 /wd4351 /wd4100 /wd4204 /wd4324")
else()
Expand Down Expand Up @@ -613,8 +620,68 @@ endif()
find_package(Threads REQUIRED)

# Main library source code
if (EXISTS ${PROJECT_SOURCE_DIR}/sideplugin/topling-rocks/CMakeFileList.txt)
message(STATUS "found ${PROJECT_SOURCE_DIR}/sideplugin/topling-rocks/CMakeFileList.txt")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
include(${PROJECT_SOURCE_DIR}/sideplugin/topling-rocks/CMakeFileList.txt)
else()
message(STATUS "not found ${PROJECT_SOURCE_DIR}/sideplugin/topling-rocks/CMakeFileList.txt")
endif()

if (EXISTS ${PROJECT_SOURCE_DIR}/sideplugin/rockside/CMakeFileList.txt)
message(STATUS "found ${PROJECT_SOURCE_DIR}/sideplugin/rockside/CMakeFileList.txt")
include(${PROJECT_SOURCE_DIR}/sideplugin/rockside/CMakeFileList.txt)
else()
message(STATUS "not found ${PROJECT_SOURCE_DIR}/sideplugin/rockside/CMakeFileList.txt")
endif()

set (cspp_memtab ${PROJECT_SOURCE_DIR}/sideplugin/cspp-memtable/cspp_memtable.cc)
if (EXISTS ${cspp_memtab})
message(STATUS "found ${cspp_memtab}")
set (topling_rocks_src ${topling_rocks_src} ${cspp_memtab})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAS_TOPLING_CSPP_MEMTABLE")
else()
message(STATUS "not found ${cspp_memtab}")
endif()

set (cspp_wbwi ${PROJECT_SOURCE_DIR}/sideplugin/cspp-wbwi/cspp_wbwi.cc)
if (EXISTS ${cspp_wbwi})
message(STATUS "found ${cspp_wbwi}")
set (topling_rocks_src ${topling_rocks_src} ${cspp_wbwi})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAS_TOPLING_CSPP_WBWI")
else()
message(STATUS "not found ${cspp_wbwi}")
endif()

FILE(GLOB topling_sst ${PROJECT_SOURCE_DIR}/sideplugin/topling-sst/src/table/*.cc)
if (EXISTS ${PROJECT_SOURCE_DIR}/sideplugin/topling-sst/src/table)
message(STATUS "found ${topling_sst}")
set (topling_rocks_src ${topling_rocks_src} ${topling_sst})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAS_TOPLING_SST -Isideplugin/topling-sst/src")
else()
message(STATUS "not found ${topling_sst}")
endif()

FILE(GLOB topling_zip_table_reader ${PROJECT_SOURCE_DIR}/sideplugin/topling-zip_table_reader/src/table/*.cc)
if (EXISTS ${PROJECT_SOURCE_DIR}/sideplugin/topling-zip_table_reader/src/table)
message(STATUS "found ${topling_zip_table_reader}")
set (topling_rocks_src ${topling_rocks_src} ${topling_zip_table_reader})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Isideplugin/topling-zip_table_reader/src")
else()
message(STATUS "not found ${topling_zip_table_reader}")
endif()

FILE(GLOB topling_dcompact ${PROJECT_SOURCE_DIR}/sideplugin/topling-dcompact/src/dcompact/*.cc)
if (EXISTS ${PROJECT_SOURCE_DIR}/sideplugin/topling-dcompact/src/dcompact)
message(STATUS "found ${topling_dcompact}")
set (topling_rocks_src ${topling_rocks_src} ${topling_dcompact})
else()
message(STATUS "not found ${topling_dcompact}")
endif()

set(SOURCES
${rockside_src}
${topling_rocks_src}
cache/cache.cc
cache/cache_entry_roles.cc
cache/cache_key.cc
Expand Down Expand Up @@ -646,6 +713,7 @@ set(SOURCES
db/builder.cc
db/c.cc
db/column_family.cc
db/compaction/compaction_executor.cc
db/compaction/compaction.cc
db/compaction/compaction_iterator.cc
db/compaction/compaction_picker.cc
Expand Down
9 changes: 9 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ most processors made since roughly 2013.

## Dependencies

* ToplingDB dependencies
- [libcurl](https://curl.se/libcurl/) - libcurl is a free and easy-to-use client-side URL transfer library
* ToplingDB [dcompact](https://github.com/topling/topling-dcompact) use libcurl to submit compaction jobs to compaction service(dcompact_worker)
- [liburing](https://github.com/axboe/liburing) - the io_uring library, ToplingDB use it to optimize MultiGet
* ToplingDB adds `ReadOptions::async_queue_depth` for queue depth of io_uring
* When compiled to shared library, this is not needed - it's used in [topling-zip](https://github.com/topling/topling-zip)
- [libaio](https://pagure.io/libaio) - The Linux-native asynchronous I/O facility
* libaio is old linux async io, io_uring should be preferred than libaio

* You can link RocksDB with following compression libraries:
- [zlib](http://www.zlib.net/) - a library for data compression.
- [bzip2](http://www.bzip.org/) - a library for data compression.
Expand Down
1 change: 0 additions & 1 deletion LICENSE.Apache
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down
Loading

0 comments on commit 9f98780

Please sign in to comment.