From 1308d8a305c0cc3dc6b8297cb37f57157a3e9226 Mon Sep 17 00:00:00 2001 From: hulk Date: Fri, 31 Jan 2025 16:53:55 +0800 Subject: [PATCH 1/6] fix(tests): flaky test case in BLMPOP command (#2754) --- tests/gocase/unit/type/list/list_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/gocase/unit/type/list/list_test.go b/tests/gocase/unit/type/list/list_test.go index b2bd71f5bd9..38854aa7831 100644 --- a/tests/gocase/unit/type/list/list_test.go +++ b/tests/gocase/unit/type/list/list_test.go @@ -1462,15 +1462,16 @@ func testList(t *testing.T, configs util.KvrocksServerConfigs) { // https://github.com/apache/kvrocks/issues/2617 // WriteArgs are required to be executed first time.Sleep(100 * time.Millisecond) - require.NoError(t, rdb.RPush(ctx, key2, "one", "two").Err()) + require.NoError(t, rdb.RPush(ctx, key1, "ONE", "TWO").Err()) + require.NoError(t, rdb.RPush(ctx, key2, "one", "two").Err()) if direction == "LEFT" { - rd.MustReadStringsWithKey(t, key2, []string{"one", "two"}) + rd.MustReadStringsWithKey(t, key1, []string{"ONE", "TWO"}) } else { - rd.MustReadStringsWithKey(t, key2, []string{"two", "one"}) + rd.MustReadStringsWithKey(t, key1, []string{"TWO", "ONE"}) } - require.EqualValues(t, 0, rdb.Exists(ctx, key2).Val()) - require.EqualValues(t, 2, rdb.LLen(ctx, key1).Val()) + require.EqualValues(t, 0, rdb.Exists(ctx, key1).Val()) + require.EqualValues(t, 2, rdb.LLen(ctx, key2).Val()) }) t.Run(fmt.Sprintf("BLMPOP test blocked served secondKey noCount %s", direction), func(t *testing.T) { From 320cdba5ccd6bf62664699454ccd4d8bea1c6cab Mon Sep 17 00:00:00 2001 From: Aleks Lozovyuk Date: Fri, 31 Jan 2025 14:39:08 +0200 Subject: [PATCH 2/6] chore(ci): bump crate-ci/typos to 1.29.5 (#2755) --- .github/workflows/kvrocks.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kvrocks.yaml b/.github/workflows/kvrocks.yaml index 4daf0f83846..521508d33fb 100644 --- a/.github/workflows/kvrocks.yaml +++ b/.github/workflows/kvrocks.yaml @@ -58,7 +58,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Check typos - uses: crate-ci/typos@v1.29.4 + uses: crate-ci/typos@v1.29.5 with: config: .github/config/typos.toml From b87827533396557bc84ee348e2b29674d02ddf64 Mon Sep 17 00:00:00 2001 From: Twice Date: Sat, 1 Feb 2025 17:17:48 +0800 Subject: [PATCH 3/6] fix(tls): remove SSL_sendfile path to avoid errors in replication fullsync (#2757) --- src/commands/cmd_replication.cc | 13 ++++++++----- src/common/io_util.cc | 5 +---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/commands/cmd_replication.cc b/src/commands/cmd_replication.cc index 290b1261f5f..ab288ca8d75 100644 --- a/src/commands/cmd_replication.cc +++ b/src/commands/cmd_replication.cc @@ -240,10 +240,10 @@ class CommandFetchMeta : public Commander { return; } // Send full data file info - if (util::SockSend(repl_fd, files + CRLF, bev).IsOK()) { + if (auto s = util::SockSend(repl_fd, files + CRLF, bev)) { LOG(INFO) << "[replication] Succeed sending full data file info to " << ip; } else { - LOG(WARNING) << "[replication] Fail to send full data file info " << ip << ", error: " << strerror(errno); + LOG(WARNING) << "[replication] Fail to send full data file info " << ip << ", error: " << s.Msg(); } auto now_secs = static_cast(util::GetTimeStamp()); srv->storage->SetCheckpointAccessTimeSecs(now_secs); @@ -295,11 +295,14 @@ class CommandFetchFile : public Commander { if (!fd) break; // Send file size and content - if (util::SockSend(repl_fd, std::to_string(file_size) + CRLF, bev).IsOK() && - util::SockSendFile(repl_fd, *fd, file_size, bev).IsOK()) { + auto s = util::SockSend(repl_fd, std::to_string(file_size) + CRLF, bev); + if (s) { + s = util::SockSendFile(repl_fd, *fd, file_size, bev); + } + if (s) { LOG(INFO) << "[replication] Succeed sending file " << file << " to " << ip; } else { - LOG(WARNING) << "[replication] Fail to send file " << file << " to " << ip << ", error: " << strerror(errno); + LOG(WARNING) << "[replication] Fail to send file " << file << " to " << ip << ", error: " << s.Msg(); break; } fd.Close(); diff --git a/src/common/io_util.cc b/src/common/io_util.cc index 23cccc69fb7..1136dbb1848 100644 --- a/src/common/io_util.cc +++ b/src/common/io_util.cc @@ -274,11 +274,8 @@ Status SockSendFile(int out_fd, int in_fd, size_t size) { return SockSendFileImp Status SockSendFile(int out_fd, int in_fd, size_t size, [[maybe_unused]] ssl_st *ssl) { #ifdef ENABLE_OPENSSL if (ssl) { -#if OPENSSL_VERSION_NUMBER >= 0x30000000L - return SockSendFileImpl(ssl, in_fd, size, 0); -#else + // NOTE: SockSendFileImpl will cause errors, refer to #2756 return SockSendFileImpl(ssl, in_fd, size); -#endif } #endif return SockSendFile(out_fd, in_fd, size); From c76a4d3bb1a7018a70e7c251b2195c0d09d78fca Mon Sep 17 00:00:00 2001 From: Minoru Maekawa <126235344+err931@users.noreply.github.com> Date: Sun, 2 Feb 2025 00:16:48 +0900 Subject: [PATCH 4/6] build: remove glibc-specific dependencies (#2759) Signed-off-by: Minoru Maekawa <126235344+err931@users.noreply.github.com> --- CMakeLists.txt | 2 -- src/cli/signal_util.h | 1 - 2 files changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc41537102b..64d819427c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,8 +38,6 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") cmake_policy(SET CMP0135 NEW) endif() -find_package(Backtrace REQUIRED) - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8) message(FATAL_ERROR "It is expected to build kvrocks with GCC 8 or above") diff --git a/src/cli/signal_util.h b/src/cli/signal_util.h index 8df0b3e01ce..eee3d2c054b 100644 --- a/src/cli/signal_util.h +++ b/src/cli/signal_util.h @@ -20,7 +20,6 @@ #pragma once -#include #include #include From a81fd2f6b96428e92c21b4e2804db111da3d27d7 Mon Sep 17 00:00:00 2001 From: Twice Date: Sun, 2 Feb 2025 13:42:59 +0800 Subject: [PATCH 5/6] ci: add an alpine-based build & test workflow (#2760) --- .github/workflows/kvrocks.yaml | 15 +++++++++++++-- src/storage/redis_metadata.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/kvrocks.yaml b/.github/workflows/kvrocks.yaml index 521508d33fb..cc441af359c 100644 --- a/.github/workflows/kvrocks.yaml +++ b/.github/workflows/kvrocks.yaml @@ -443,6 +443,10 @@ jobs: - name: Debian 12 image: debian:12 compiler: gcc + - name: Alpine 3 + image: alpine:3 + compiler: gcc + disable_jemalloc: -DDISABLE_JEMALLOC=ON runs-on: ubuntu-22.04 container: @@ -498,6 +502,13 @@ jobs: apt install -y bash build-essential cmake curl git libssl-dev libtool python3 python3-pip wget echo "NPROC=$(nproc)" >> $GITHUB_ENV + - name: Setup Alpine + if: ${{ startsWith(matrix.image, 'alpine') }} + run: | + apk update + apk add bash cmake curl git python3 wget make gcc g++ autoconf linux-headers py3-pip py3-redis + echo "NPROC=$(nproc)" >> $GITHUB_ENV + - name: Cache redis id: cache-redis uses: actions/cache@v4 @@ -533,7 +544,7 @@ jobs: - name: Build Kvrocks run: | - ./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} + ./x.py build -j$NPROC --unittest --compiler ${{ matrix.compiler }} ${{ matrix.disable_jemalloc }} - name: Run Unit Test run: | @@ -546,7 +557,7 @@ jobs: ./x.py test go build $GOCASE_RUN_ARGS - name: Install redis-py for openSUSE and Rocky - if: ${{ !startsWith(matrix.image, 'archlinux') && !startsWith(matrix.image, 'debian') }} + if: ${{ !startsWith(matrix.image, 'archlinux') && !startsWith(matrix.image, 'debian') && !startsWith(matrix.image, 'alpine') }} run: pip3 install redis==4.3.6 - name: Install redis-py for Debian diff --git a/src/storage/redis_metadata.h b/src/storage/redis_metadata.h index cba9df80cb5..69a0db1cc52 100644 --- a/src/storage/redis_metadata.h +++ b/src/storage/redis_metadata.h @@ -21,6 +21,7 @@ #pragma once #include +#include #include #include From b8b969d80b9183106284049ff5338d0156ee5686 Mon Sep 17 00:00:00 2001 From: Aleks Lozovyuk Date: Sun, 2 Feb 2025 17:33:57 +0200 Subject: [PATCH 6/6] chore(test): update godeps (#2762) --- tests/gocase/go.mod | 6 +++--- tests/gocase/go.sum | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/gocase/go.mod b/tests/gocase/go.mod index 192b2301a1a..9d1921ccd81 100644 --- a/tests/gocase/go.mod +++ b/tests/gocase/go.mod @@ -4,16 +4,16 @@ go 1.23 require ( github.com/redis/go-redis/v9 v9.7.0 - github.com/shirou/gopsutil/v4 v4.24.12 + github.com/shirou/gopsutil/v4 v4.25.1 github.com/stretchr/testify v1.10.0 - golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f + golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c ) require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/ebitengine/purego v0.8.1 // indirect + github.com/ebitengine/purego v0.8.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/tests/gocase/go.sum b/tests/gocase/go.sum index c46dca0b2bc..7c5e825ae1d 100644 --- a/tests/gocase/go.sum +++ b/tests/gocase/go.sum @@ -10,6 +10,8 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/ebitengine/purego v0.8.1 h1:sdRKd6plj7KYW33EH5As6YKfe8m9zbN9JMrOjNVF/BE= github.com/ebitengine/purego v0.8.1/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= +github.com/ebitengine/purego v0.8.2 h1:jPPGWs2sZ1UgOSgD2bClL0MJIqu58nOmIcBuXr62z1I= +github.com/ebitengine/purego v0.8.2/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= @@ -25,6 +27,8 @@ github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/shirou/gopsutil/v4 v4.24.12 h1:qvePBOk20e0IKA1QXrIIU+jmk+zEiYVVx06WjBRlZo4= github.com/shirou/gopsutil/v4 v4.24.12/go.mod h1:DCtMPAad2XceTeIAbGyVfycbYQNBGk2P8cvDi7/VN9o= +github.com/shirou/gopsutil/v4 v4.25.1 h1:QSWkTc+fu9LTAWfkZwZ6j8MSUk4A2LV7rbH0ZqmLjXs= +github.com/shirou/gopsutil/v4 v4.25.1/go.mod h1:RoUCUpndaJFtT+2zsZzzmhvbfGoDCJ7nFXKJf8GqJbI= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZb78yU= @@ -35,6 +39,8 @@ github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f h1:XdNn9LlyWAhLVp6P/i8QYBW+hlyhrhei9uErw2B5GJo= golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:D5SMRVC3C2/4+F/DB1wZsLRnSNimn2Sp/NPsCrsv8ak= +golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c h1:KL/ZBHXgKGVmuZBZ01Lt57yE5ws8ZPSkkihmEyq7FXc= +golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU= golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=