Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/unstable' into unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
PokIsemaine committed Jul 8, 2024
2 parents c263c75 + 51569ad commit dcb37c1
Show file tree
Hide file tree
Showing 110 changed files with 3,897 additions and 1,044 deletions.
10 changes: 10 additions & 0 deletions .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ github:
strict: true
contexts:
- Required
'1.3': {}
'2.0': {}
'2.1': {}
'2.2': {}
'2.3': {}
'2.4': {}
'2.5': {}
'2.6': {}
'2.7': {}
'2.8': {}

notifications:
commits: [email protected]
Expand Down
81 changes: 32 additions & 49 deletions .github/workflows/kvrocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ jobs:
FORCE_COLOR: 1
steps:
- uses: actions/checkout@v4
- name: Install typos
run: curl -LsSf https://github.com/crate-ci/typos/releases/download/v1.18.2/typos-v1.18.2-x86_64-unknown-linux-musl.tar.gz | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
- name: Run typos check
run: typos --config .github/config/typos.toml
- name: Check typos
uses: crate-ci/typos@v1.22.9
with:
config: .github/config/typos.toml

check-and-lint:
name: Lint and check code
Expand Down Expand Up @@ -110,24 +110,25 @@ jobs:
fail-fast: false
matrix:
include:
- name: Darwin Clang
os: macos-11
compiler: auto
# FIXME: update macos-11 to macos-12/13
# - name: Darwin Clang
# os: macos-11
# compiler: auto
- name: Darwin Clang arm64
os: macos-14
compiler: auto
- name: Darwin Clang without Jemalloc
os: macos-11
compiler: auto
without_jemalloc: -DDISABLE_JEMALLOC=ON
- name: Darwin Clang with OpenSSL
os: macos-11
compiler: auto
with_openssl: -DENABLE_OPENSSL=ON
- name: Darwin Clang without luaJIT
os: macos-11
compiler: auto
without_luajit: -DENABLE_LUAJIT=OFF
# - name: Darwin Clang without Jemalloc
# os: macos-11
# compiler: auto
# without_jemalloc: -DDISABLE_JEMALLOC=ON
# - name: Darwin Clang with OpenSSL
# os: macos-11
# compiler: auto
# with_openssl: -DENABLE_OPENSSL=ON
# - name: Darwin Clang without luaJIT
# os: macos-11
# compiler: auto
# without_luajit: -DENABLE_LUAJIT=OFF
- name: Ubuntu GCC
os: ubuntu-20.04
compiler: gcc
Expand Down Expand Up @@ -191,14 +192,14 @@ jobs:
os: ubuntu-20.04
without_luajit: -DENABLE_LUAJIT=OFF
compiler: clang
- name: Ubuntu GCC with new encoding
- name: Ubuntu GCC with old encoding
os: ubuntu-20.04
compiler: gcc
new_encoding: -DENABLE_NEW_ENCODING=TRUE
- name: Ubuntu Clang with new encoding
new_encoding: -DENABLE_NEW_ENCODING=FALSE
- name: Ubuntu Clang with old encoding
os: ubuntu-22.04
compiler: clang
new_encoding: -DENABLE_NEW_ENCODING=TRUE
new_encoding: -DENABLE_NEW_ENCODING=FALSE
- name: Ubuntu GCC with speedb enabled
os: ubuntu-20.04
compiler: gcc
Expand Down Expand Up @@ -273,6 +274,8 @@ jobs:
- name: Build Kvrocks (SonarCloud)
if: ${{ matrix.sonarcloud }}
run: |
build-wrapper-linux-x86-64 --out-dir ${{ env.SONARCLOUD_OUTPUT_DIR }} ./x.py build -j$NPROC --compiler ${{ matrix.compiler }} --skip-build
cp -r build _build
build-wrapper-linux-x86-64 --out-dir ${{ env.SONARCLOUD_OUTPUT_DIR }} ./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} ${{ matrix.sonarcloud }}
- name: Setup Coredump
Expand Down Expand Up @@ -327,7 +330,6 @@ jobs:
sleep 10s
python3 utils/kvrocks2redis/tests/populate-kvrocks.py --password="" --flushdb=true
sleep 10s
ps aux
python3 utils/kvrocks2redis/tests/check_consistency.py --src_password=""
- name: Find reports and crashes
Expand Down Expand Up @@ -375,7 +377,9 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: sonarcloud-data
path: ${{ env.SONARCLOUD_OUTPUT_DIR }}
path: |
${{ env.SONARCLOUD_OUTPUT_DIR }}
_build
check-docker:
name: Check Docker image
Expand All @@ -386,7 +390,7 @@ jobs:
- uses: actions/checkout@v4
- name: Get core numbers
run: echo "NPROC=$(nproc)" >> $GITHUB_ENV
- uses: docker/build-push-action@v5
- uses: docker/build-push-action@v6
with:
context: .
build-args: MORE_BUILD_ARGS=-j${{ env.NPROC }}
Expand Down Expand Up @@ -416,9 +420,6 @@ jobs:
fail-fast: false
matrix:
include:
- name: CentOS 7
image: centos:7
compiler: gcc
- name: openSUSE Leap 15
image: opensuse/leap:15
compiler: gcc
Expand All @@ -430,17 +431,6 @@ jobs:
container:
image: ${{ matrix.image }}
steps:
- name: Setup CentOS
if: ${{ startsWith(matrix.image, 'centos') }}
run: |
yum install -y centos-release-scl-rh
yum install -y devtoolset-11 python3 python3-pip autoconf automake wget git gcc gcc-c++
echo "NPROC=$(nproc)" >> $GITHUB_ENV
mv /usr/bin/gcc /usr/bin/gcc-4.8.5
ln -s /opt/rh/devtoolset-11/root/bin/gcc /usr/bin/gcc
mv /usr/bin/g++ /usr/bin/g++-4.8.5
ln -s /opt/rh/devtoolset-11/root/bin/g++ /usr/bin/g++
- name: Setup ArchLinux
if: ${{ startsWith(matrix.image, 'archlinux') }}
run: |
Expand Down Expand Up @@ -483,15 +473,8 @@ jobs:
pushd redis-6.2.14 && USE_JEMALLOC=no make -j$NPROC redis-cli && mv src/redis-cli $HOME/local/bin/ && popd
pushd redis-6.2.14 && USE_JEMALLOC=no make -j$NPROC redis-server && mv src/redis-server $HOME/local/bin/ && popd
- name: Install cmake
if: ${{ startsWith(matrix.image, 'centos') }}
run: |
VERSION=3.26.4
wget https://github.com/Kitware/CMake/releases/download/v$VERSION/cmake-$VERSION-linux-x86_64.sh
bash cmake-$VERSION-linux-x86_64.sh --skip-license --prefix=/usr
- uses: actions/checkout@v3 #v4 use Node 20 and not working at CentOS 7
- uses: actions/setup-go@v4 #v5 use Node 20 too
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
if: ${{ !startsWith(matrix.image, 'opensuse') }}
with:
go-version-file: 'tests/gocase/go.mod'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
type=sha,prefix=nightly-{{date 'YYYYMMDD'}}-,format=short
type=raw,value=nightly
- uses: docker/build-push-action@v5
- uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64, linux/arm64
Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/pr-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: read

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Configure which types are allowed (newline-delimited).
# Default: https://github.com/commitizen/conventional-commit-types
types: |
fix
feat
build
chore
ci
docs
perf
refactor
revert
style
test
# Configure which scopes are allowed (newline-delimited).
# These are regex patterns auto-wrapped in `^ $`.
scopes: |
\S+
# Configure that a scope must always be provided.
requireScope: false
# Configure which scopes are disallowed in PR titles (newline-delimited).
# For instance by setting the value below, `chore(release): ...` (lowercase)
# and `ci(e2e,release): ...` (unknown scope) will be rejected.
# These are regex patterns auto-wrapped in `^ $`.
# disallowScopes: |
# release
# [A-Z]+
# Configure additional validation for the subject based on a regex.
# This example ensures the subject doesn't start with an uppercase character.
# subjectPattern: ^(?![A-Z]).+$
# If `subjectPattern` is configured, you can use this property to override
# the default error message that is shown when the pattern doesn't match.
# The variables `subject` and `title` can be used within the message.
# subjectPatternError: |
# The subject "{subject}" found in the pull request title "{title}"
# didn't match the configured pattern. Please ensure that the subject
# doesn't start with an uppercase character.
# The GitHub base URL will be automatically set to the correct value from the GitHub context variable.
# If you want to override this, you can do so here (not recommended).
# githubBaseUrl: https://github.myorg.com/api/v3
# If the PR contains one of these newline-delimited labels, the
# validation is skipped. If you want to rerun the validation when
# labels change, you might want to use the `labeled` and `unlabeled`
# event triggers in your workflow.
ignoreLabels: |
disable-pr-lint
# If you're using a format for the PR title that differs from the traditional Conventional
# Commits spec, you can use these options to customize the parsing of the type, scope and
# subject. The `headerPattern` should contain a regex where the capturing groups in parentheses
# correspond to the parts listed in `headerPatternCorrespondence`.
# See: https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser#headerpattern
# headerPattern: '^(\w*)(?:\(([\w$.\-*/ ]*)\))?: (.*)$'
# headerPatternCorrespondence: type, scope, subject
9 changes: 4 additions & 5 deletions .github/workflows/sonar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@ jobs:
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/sonarcloud-data.zip`, Buffer.from(download.data));
- name: 'Unzip code coverage'
run: |
unzip sonarcloud-data.zip -d sonarcloud-data
ls -a sonarcloud-data
unzip sonarcloud-data.zip
mv _build build
mkdir -p build/CMakeFiles/CMakeTmp
ls -a sonarcloud-data build
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Configure Kvrocks
run: |
./x.py build -j$(nproc) --compiler gcc --skip-build

- name: Run sonar-scanner
env:
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ option(ENABLE_STATIC_LIBSTDCXX "link kvrocks with static library of libstd++ ins
option(ENABLE_LUAJIT "enable use of luaJIT instead of lua" ON)
option(ENABLE_OPENSSL "enable openssl to support tls connection" OFF)
option(ENABLE_IPO "enable interprocedural optimization" ON)
option(ENABLE_UNWIND "enable libunwind in glog" ON)
option(ENABLE_SPEEDB "enable speedb instead of rocksdb" OFF)
set(SYMBOLIZE_BACKEND "" CACHE STRING "symbolization backend library for cpptrace (libbacktrace, libdwarf, or empty)")
set(PORTABLE 0 CACHE STRING "build a portable binary (disable arch-specific optimizations)")
# TODO: set ENABLE_NEW_ENCODING to ON when we are ready
option(ENABLE_NEW_ENCODING "enable new encoding (#1033) for storing 64bit size and expire time in milliseconds" ON)
Expand Down Expand Up @@ -169,6 +169,7 @@ include(cmake/span.cmake)
include(cmake/trie.cmake)
include(cmake/pegtl.cmake)
include(cmake/rangev3.cmake)
include(cmake/cpptrace.cmake)

if (ENABLE_LUAJIT)
include(cmake/luajit.cmake)
Expand Down Expand Up @@ -203,6 +204,7 @@ list(APPEND EXTERNAL_LIBS span-lite)
list(APPEND EXTERNAL_LIBS tsl_hat_trie)
list(APPEND EXTERNAL_LIBS pegtl)
list(APPEND EXTERNAL_LIBS range-v3)
list(APPEND EXTERNAL_LIBS cpptrace::cpptrace)

# Add git sha to version.h
find_package(Git REQUIRED)
Expand Down
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,29 @@
# specific language governing permissions and limitations
# under the License.

FROM alpine:3.16 as build
FROM debian:bookworm-slim AS build

ARG MORE_BUILD_ARGS

RUN apk update && apk upgrade && apk add git gcc g++ make cmake ninja autoconf automake libtool python3 linux-headers curl openssl-dev libexecinfo-dev redis
RUN DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get upgrade -y && apt-get -y --no-install-recommends install git build-essential autoconf cmake libtool python3 libssl-dev && apt-get autoremove && apt-get clean

WORKDIR /kvrocks

COPY . .
RUN ./x.py build -DENABLE_OPENSSL=ON -DPORTABLE=1 -DCMAKE_BUILD_TYPE=Release -j $(nproc) $MORE_BUILD_ARGS

FROM alpine:3.16
FROM debian:bookworm-slim

RUN DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get upgrade -y && apt-get -y install openssl ca-certificates redis-tools && apt-get clean

RUN apk update && apk upgrade && apk add libexecinfo
RUN mkdir /var/run/kvrocks

VOLUME /var/lib/kvrocks

COPY --from=build /kvrocks/build/kvrocks /bin/
COPY --from=build /usr/bin/redis-cli /bin/

HEALTHCHECK --interval=10s --timeout=1s --start-period=30s --retries=3 \
CMD ./bin/redis-cli -p 6666 PING | grep -E '(PONG|NOAUTH)' || exit 1
CMD redis-cli -p 6666 PING | grep -E '(PONG|NOAUTH)' || exit 1

COPY ./LICENSE ./NOTICE ./licenses /kvrocks/
COPY ./kvrocks.conf /var/lib/kvrocks/
Expand Down
1 change: 1 addition & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ The text of each license is also included in licenses/LICENSE-[project].txt
* lua(https://github.com/KvrocksLabs/lua, alternative to LuaJIT)
* hat-trie(https://github.com/Tessil/hat-trie)
* pegtl(https://github.com/taocpp/PEGTL, NOTE: changed to Boost Software License Version 1.0 in main branch)
* cpptrace(https://github.com/jeremy-rifkin/cpptrace)

================================================================
Boost Software License Version 1.0
Expand Down
Binary file modified assets/KQIR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit dcb37c1

Please sign in to comment.