Skip to content

Commit c6254e8

Browse files
authored
Merge branch 'unstable' into bit_op1
2 parents 2a7ccdd + 792df36 commit c6254e8

180 files changed

Lines changed: 12796 additions & 1337 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.asf.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,19 @@ github:
2929
- namespace
3030
- redis
3131
- redis-cluster
32+
pull_requests:
33+
allow_auto_merge: true
34+
allow_update_branch: true
3235
enabled_merge_buttons:
3336
squash: true
37+
squash_commit_message: PR_TITLE_AND_DESC
3438
merge: false
3539
rebase: true
40+
features:
41+
wiki: false
42+
issues: true
43+
projects: true
44+
discussions: true
3645
protected_branches:
3746
unstable:
3847
required_pull_request_reviews:
@@ -56,6 +65,9 @@ github:
5665
'2.10': {}
5766
'2.11': {}
5867
'2.12': {}
68+
'2.13': {}
69+
'2.14': {}
70+
'2.15': {}
5971

6072
notifications:
6173
commits: commits@kvrocks.apache.org

.clang-tidy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# refer to https://clang.llvm.org/extra/clang-tidy/checks/list.html
2-
Checks: -*, clang-analyzer-core.*, clang-analyzer-cplusplus.*, -clang-analyzer-cplusplus.InnerPointer, clang-analyzer-deadcode.*, clang-analyzer-nullability.*, clang-analyzer-security.*, clang-analyzer-unix.*, clang-analyzer-valist.*, cppcoreguidelines-init-variables, cppcoreguidelines-macro-usage, cppcoreguidelines-interfaces-global-init, cppcoreguidelines-narrowing-conversions, cppcoreguidelines-no-malloc, cppcoreguidelines-prefer-member-initializer, cppcoreguidelines-special-member-functions, cppcoreguidelines-slicing, google-build-explicit-make-pair, google-default-arguments, google-explicit-constructor, modernize-avoid-bind, modernize-loop-convert, modernize-macro-to-enum, modernize-make-shared, modernize-make-unique, modernize-pass-by-value, modernize-redundant-void-arg, modernize-return-braced-init-list, modernize-use-auto, modernize-use-bool-literals, modernize-use-emplace, modernize-use-equals-default, modernize-use-equals-delete, modernize-use-nullptr, modernize-use-override, modernize-use-using, performance-faster-string-find, performance-for-range-copy, performance-implicit-conversion-in-loop, performance-inefficient-algorithm, performance-inefficient-vector-operation, performance-move-const-arg, performance-move-constructor-init, performance-no-automatic-move, performance-trivially-destructible, performance-type-promotion-in-math-fn, performance-unnecessary-copy-initialization, performance-unnecessary-value-param, readability-avoid-const-params-in-decls, readability-const-return-type, readability-convert-member-functions-to-static, readability-make-member-function-const, readability-redundant-access-specifiers, readability-redundant-control-flow, readability-redundant-declaration, readability-redundant-member-init, readability-redundant-string-cstr, readability-redundant-string-init, readability-simplify-boolean-expr, readability-simplify-subscript-expr, readability-string-compare, readability-identifier-naming, cppcoreguidelines-avoid-goto, bugprone-use-after-move
2+
Checks: -*, clang-analyzer-core.*, clang-analyzer-cplusplus.*, -clang-analyzer-cplusplus.InnerPointer, clang-analyzer-deadcode.*, clang-analyzer-nullability.*, clang-analyzer-security.*, clang-analyzer-unix.*, clang-analyzer-valist.*, cppcoreguidelines-init-variables, cppcoreguidelines-macro-usage, cppcoreguidelines-interfaces-global-init, cppcoreguidelines-narrowing-conversions, cppcoreguidelines-no-malloc, cppcoreguidelines-prefer-member-initializer, cppcoreguidelines-special-member-functions, cppcoreguidelines-slicing, google-build-explicit-make-pair, google-default-arguments, google-explicit-constructor, modernize-avoid-bind, modernize-macro-to-enum, modernize-make-shared, modernize-make-unique, modernize-pass-by-value, modernize-redundant-void-arg, modernize-return-braced-init-list, modernize-use-auto, modernize-use-bool-literals, modernize-use-emplace, modernize-use-equals-default, modernize-use-equals-delete, modernize-use-nullptr, modernize-use-override, modernize-use-using, performance-faster-string-find, performance-for-range-copy, performance-implicit-conversion-in-loop, performance-inefficient-algorithm, performance-inefficient-vector-operation, performance-move-const-arg, performance-move-constructor-init, performance-no-automatic-move, performance-trivially-destructible, performance-type-promotion-in-math-fn, performance-unnecessary-copy-initialization, performance-unnecessary-value-param, readability-avoid-const-params-in-decls, readability-const-return-type, readability-convert-member-functions-to-static, readability-make-member-function-const, readability-redundant-access-specifiers, readability-redundant-control-flow, readability-redundant-declaration, readability-redundant-member-init, readability-redundant-string-cstr, readability-redundant-string-init, readability-simplify-boolean-expr, readability-simplify-subscript-expr, readability-string-compare, readability-identifier-naming, cppcoreguidelines-avoid-goto, bugprone-use-after-move
33

44
WarningsAsErrors: clang-analyzer-*, -clang-analyzer-security.insecureAPI.rand, google-*, performance-*, cppcoreguidelines-*, modernize-*, readability-*, bugprone-*
55

@@ -50,3 +50,5 @@ CheckOptions:
5050
value: lower_case
5151
- key: readability-identifier-naming.FunctionCase
5252
value: CamelCase
53+
- key: readability-simplify-boolean-expr.IgnoreMacros
54+
value: True

.github/config/typos.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,6 @@ ignore-hidden = false
4444

4545
#Used as a short naming into tests
4646
"typ" = "typ"
47+
48+
#Fix name (Yann Collet)
49+
"Collet" = "Collet"

.github/workflows/kvrocks.yaml

Lines changed: 76 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -51,48 +51,48 @@ jobs:
5151
echo "docs_only=${{ fromJSON(steps.changes.outputs.all_count) == fromJSON(steps.changes.outputs.docs_count) && fromJSON(steps.changes.outputs.docs_count) > 0 }}" >> $GITHUB_OUTPUT
5252
5353
check-typos:
54-
name: Check typos
54+
name: Check typos and licenses
5555
runs-on: ubuntu-22.04
5656
env:
5757
FORCE_COLOR: 1
5858
steps:
5959
- uses: actions/checkout@v4
6060
- name: Check typos
61-
uses: crate-ci/typos@v1.35.1
61+
uses: crate-ci/typos@v1.43.1
6262
with:
6363
config: .github/config/typos.toml
64+
- uses: apache/skywalking-eyes/header@v0.7.0
65+
with:
66+
config: .github/config/licenserc.yml
6467

6568
check-and-lint:
6669
name: Lint and check code
67-
needs: [precondition]
70+
needs: [precondition, check-typos]
6871
if: ${{ needs.precondition.outputs.docs_only != 'true' }}
69-
runs-on: ubuntu-22.04
72+
runs-on: ubuntu-24.04
7073
steps:
7174
- uses: actions/checkout@v4
72-
- uses: apache/skywalking-eyes/header@v0.7.0
73-
with:
74-
config: .github/config/licenserc.yml
7575
- uses: actions/setup-go@v5
7676
with:
7777
go-version-file: 'tests/gocase/go.mod'
7878
cache: false
7979
- name: Prepare Dependencies
8080
run: |
8181
sudo apt update
82-
sudo apt install -y clang-format-14 clang-tidy-14
82+
sudo apt install -y clang-format-18 clang-tidy-18
8383
- name: Check with clang-format
8484
id: check-format
85-
run: ./x.py check format --clang-format-path clang-format-14
85+
run: ./x.py check format --clang-format-path clang-format-18
8686
- name: Check with clang-tidy
8787
run: |
8888
./x.py build --skip-build
89-
./x.py check tidy -j $(nproc) --clang-tidy-path clang-tidy-14 --run-clang-tidy-path run-clang-tidy-14
89+
./x.py check tidy -j $(nproc) --clang-tidy-path clang-tidy-18 --run-clang-tidy-path run-clang-tidy-18
9090
- name: Lint with golangci-lint
9191
run: ./x.py check golangci-lint
9292
- name: Prepare format patch
9393
if: always() && steps.check-format.outcome != 'success'
9494
run: |
95-
./x.py format --clang-format-path clang-format-14
95+
./x.py format --clang-format-path clang-format-18
9696
git diff -p > clang-format.patch
9797
cat clang-format.patch
9898
- name: Upload format patch
@@ -103,7 +103,7 @@ jobs:
103103

104104
build-and-test:
105105
name: Build and test
106-
needs: [precondition, check-and-lint, check-typos]
106+
needs: [precondition, check-typos]
107107
if: ${{ needs.precondition.outputs.docs_only != 'true' }}
108108
strategy:
109109
fail-fast: false
@@ -150,13 +150,12 @@ jobs:
150150
- name: Ubuntu Clang
151151
os: ubuntu-22.04
152152
compiler: clang
153-
# FIXME: https://github.com/apache/kvrocks/issues/2411
154-
# - name: Ubuntu 24 GCC
155-
# os: ubuntu-24.04
156-
# compiler: gcc
157-
# - name: Ubuntu 24 Clang
158-
# os: ubuntu-24.04
159-
# compiler: clang
153+
- name: Ubuntu 24 GCC
154+
os: ubuntu-24.04
155+
compiler: gcc
156+
- name: Ubuntu 24 Clang
157+
os: ubuntu-24.04
158+
compiler: clang
160159
- name: Ubuntu GCC ASan
161160
os: ubuntu-22.04
162161
without_jemalloc: -DDISABLE_JEMALLOC=ON
@@ -223,12 +222,33 @@ jobs:
223222
os: ubuntu-24.04-arm
224223
compiler: clang
225224
arm_linux: true
225+
- name: Ubuntu RISC-V GCC without luaJIT (QEMU)
226+
os: ubuntu-24.04
227+
riscv_toolchain: true
228+
toolchain_file: cmake/riscv64.cmake
229+
riscv_toolchain_url: "https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2025.07.03/riscv64-glibc-ubuntu-24.04-gcc-nightly-2025.07.03-nightly.tar.xz"
230+
cmake_crosscompiling: -DCMAKE_CROSSCOMPILING=TRUE
231+
cmake_system_name: -DCMAKE_SYSTEM_NAME=Linux
232+
cmake_system_processor: -DCMAKE_SYSTEM_PROCESSOR=riscv64
233+
without_luajit: -DENABLE_LUAJIT=OFF
226234

227235
runs-on: ${{ matrix.os }}
228236
env:
229237
SONARCLOUD_OUTPUT_DIR: sonarcloud-data
230238
FORCE_JAVASCRIPT_ACTIONS_TO_NODE20: true
239+
RISCV_PATH: "/opt/riscv"
231240
steps:
241+
- name: Maximize build space
242+
if: ${{ startsWith(matrix.os, 'ubuntu') }}
243+
run: |
244+
# refer to https://github.com/easimon/maximize-build-space,
245+
# we take some ideas from this action but don't use it directly.
246+
sudo df -h
247+
sudo rm -rf /usr/share/dotnet
248+
sudo rm -rf /usr/local/lib/android
249+
sudo rm -rf /opt/ghc
250+
sudo df -h
251+
232252
- name: Setup macOS
233253
if: ${{ startsWith(matrix.os, 'macos') }}
234254
run: |
@@ -253,6 +273,21 @@ jobs:
253273
if: ${{ matrix.arm_linux }}
254274
run: |
255275
sudo apt install -y git build-essential cmake libtool python3 python3-pip libssl-dev
276+
- name: Setup RISC-V Toolchain
277+
if: ${{ matrix.riscv_toolchain }}
278+
run: |
279+
sudo apt install -y wget build-essential cmake git python3 \
280+
libgflags-dev libsnappy-dev zlib1g-dev liblz4-dev libzstd-dev \
281+
qemu-user qemu-user-static
282+
sudo mkdir -p $RISCV_PATH
283+
wget "${{ matrix.riscv_toolchain_url }}" -O riscv-toolchain.tar.xz
284+
sudo tar -xvf riscv-toolchain.tar.xz -C $RISCV_PATH --strip-components=1
285+
rm riscv-toolchain.tar.xz
286+
sudo sed -i "s|libdir='/mnt/riscv/riscv64-unknown-linux-gnu/lib'|libdir='$RISCV_PATH/riscv64-unknown-linux-gnu/lib'|g" \
287+
$RISCV_PATH/riscv64-unknown-linux-gnu/lib/libatomic.la
288+
echo "PATH=$RISCV_PATH/bin:$PATH" >> $GITHUB_ENV
289+
echo "LD_LIBRARY_PATH=/opt/riscv/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
290+
echo "QEMU_LD_PREFIX=$RISCV_PATH/sysroot" >> $GITHUB_ENV
256291
257292
- name: Cache redis
258293
id: cache-redis
@@ -293,12 +328,12 @@ jobs:
293328
run: pip install gcovr==5.0 # 5.1 is not supported
294329
if: ${{ matrix.sonarcloud }}
295330

296-
- name: Install sonar-scanner and build-wrapper
297-
uses: SonarSource/sonarcloud-github-c-cpp@v3
331+
- name: Install Build Wrapper
332+
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6.0.0
298333
if: ${{ matrix.sonarcloud }}
299334

300335
- name: Build Kvrocks
301-
if: ${{ !matrix.sonarcloud }}
336+
if: ${{ !matrix.sonarcloud && !matrix.riscv_toolchain }}
302337
run: |
303338
./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} ${{ matrix.without_jemalloc }} \
304339
${{ matrix.without_luajit }} ${{ matrix.with_ninja }} ${{ matrix.with_sanitizer }} ${{ matrix.with_openssl }} \
@@ -311,6 +346,11 @@ jobs:
311346
cp -r build _build
312347
build-wrapper-linux-x86-64 --out-dir ${{ env.SONARCLOUD_OUTPUT_DIR }} ./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} ${{ matrix.sonarcloud }}
313348
349+
- name: Build Kvrocks (RISC-V)
350+
if: ${{ matrix.riscv_toolchain }}
351+
run: |
352+
./x.py build -j$NPROC --unittest --toolchain ${{ matrix.toolchain_file }}
353+
314354
- name: Setup Coredump
315355
if: ${{ startsWith(matrix.os, 'ubuntu') }}
316356
run: |
@@ -416,7 +456,7 @@ jobs:
416456
417457
check-docker:
418458
name: Check Docker image
419-
needs: [precondition, check-and-lint, check-typos]
459+
needs: [precondition, check-typos]
420460
if: ${{ needs.precondition.outputs.docs_only != 'true' }}
421461
runs-on: ${{ matrix.os }}
422462
strategy:
@@ -450,7 +490,7 @@ jobs:
450490
451491
build-and-test-in-container:
452492
name: Build and test in container
453-
needs: [precondition, check-and-lint, check-typos]
493+
needs: [precondition, check-typos]
454494
if: ${{ needs.precondition.outputs.docs_only != 'true' }}
455495
strategy:
456496
fail-fast: false
@@ -472,14 +512,23 @@ jobs:
472512
image: debian:12
473513
compiler: gcc
474514
- name: Alpine 3
475-
image: alpine:3
515+
image: alpine:3.22
476516
compiler: gcc
477517
disable_jemalloc: -DDISABLE_JEMALLOC=ON
478518

479519
runs-on: ubuntu-22.04
480520
container:
481521
image: ${{ matrix.image }}
522+
volumes:
523+
- /usr/local/lib/android:/usr-local-lib-android
524+
- /usr/share/dotnet:/usr-share-dotnet
482525
steps:
526+
- name: Maximize build space
527+
run: |
528+
df -h
529+
rm -rf /usr-local-lib-android/*
530+
rm -rf /usr-share-dotnet/*
531+
df -h
483532
- name: Setup ArchLinux
484533
if: ${{ startsWith(matrix.image, 'archlinux') }}
485534
run: |
@@ -493,7 +542,7 @@ jobs:
493542
- name: Setup openSUSE
494543
if: ${{ startsWith(matrix.image, 'opensuse') }}
495544
run: |
496-
zypper install -y gcc11 gcc11-c++ make wget git autoconf automake python3 python3-pip curl tar gzip cmake go
545+
zypper install -y gcc11 gcc11-c++ make wget git autoconf automake python3 python3-pip curl tar gzip cmake go which
497546
update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-11 100
498547
update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-11 100
499548
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100
@@ -618,6 +667,7 @@ jobs:
618667
runs-on: ubuntu-latest
619668
needs:
620669
- precondition
670+
- check-and-lint
621671
- build-and-test
622672
- build-and-test-in-container
623673
- check-docker

.github/workflows/sonar.yaml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333
repository: ${{ github.event.workflow_run.head_repository.full_name }}
3434
ref: ${{ github.event.workflow_run.head_sha }}
3535
fetch-depth: 0
36-
- name: Install sonar-scanner and build-wrapper
37-
uses: SonarSource/sonarcloud-github-c-cpp@v3
36+
- name: Install Build Wrapper
37+
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v6.0.0
3838
- name: 'Download code coverage'
3939
uses: actions/github-script@v7
4040
with:
@@ -66,18 +66,22 @@ jobs:
6666
with:
6767
python-version: 3.x
6868

69-
- name: Run sonar-scanner
70-
env:
71-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72-
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
69+
- name: Extract PR number
7370
run: |
7471
PR_NUMBER=$(jq -r '.number | select (.!=null)' sonarcloud-data/github-event.json)
75-
echo "The PR number is $PR_NUMBER"
72+
echo "PR_NUMBER=$PR_NUMBER" >> "$GITHUB_ENV"
73+
echo "The PR number is ${PR_NUMBER:-<none>}"
7674
77-
sonar-scanner \
78-
--define sonar.cfamily.build-wrapper-output="sonarcloud-data" \
79-
--define sonar.coverageReportPaths=sonarcloud-data/coverage.xml \
80-
--define sonar.projectKey=apache_kvrocks \
81-
--define sonar.organization=apache \
82-
--define sonar.scm.revision=${{ github.event.workflow_run.head_sha }} \
83-
--define sonar.pullrequest.key=$PR_NUMBER
75+
- name: SonarQube Scan
76+
uses: SonarSource/sonarqube-scan-action@v6.0.0
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
80+
with:
81+
args: >
82+
-Dsonar.cfamily.build-wrapper-output=sonarcloud-data
83+
-Dsonar.coverageReportPaths=sonarcloud-data/coverage.xml
84+
-Dsonar.projectKey=apache_kvrocks
85+
-Dsonar.organization=apache
86+
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }}
87+
-Dsonar.pullrequest.key=${{ env.PR_NUMBER }}

.gitignore

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
*.gch
1212
*.pch
1313

14+
# Linker files
15+
*.ilk
16+
17+
# Debugger Files
18+
*.pdb
19+
1420
# Compiled Dynamic libraries
1521
*.so
1622
*.dylib
@@ -31,19 +37,18 @@
3137
*.out
3238
*.app
3339

34-
*.pyc
35-
*.swp
36-
*.swo
37-
.DS_Store
38-
version.h
40+
# debug information files
41+
*.dwo
3942

40-
.idea
41-
.vscode
42-
.cache
43+
# for macOS
44+
.DS_Store
4345

44-
compactdb
45-
testdb
46+
# for IDEs
47+
/.idea/
48+
/.vscode/
49+
/.cache/
4650

47-
build
48-
cmake-build-*
49-
build-*
51+
# for build directories
52+
/build/
53+
/cmake-build-*/
54+
/build-*/

0 commit comments

Comments
 (0)