Skip to content

Commit

Permalink
Merge branch 'unstable' into rocksdb_threads
Browse files Browse the repository at this point in the history
  • Loading branch information
ltagliamonte-dd authored Feb 3, 2025
2 parents 4b5298c + b8b969d commit a343064
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 23 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/kvrocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Check typos
uses: crate-ci/[email protected].4
uses: crate-ci/[email protected].5
with:
config: .github/config/typos.toml

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion src/cli/signal_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#pragma once

#include <execinfo.h>
#include <glog/logging.h>
#include <signal.h>

Expand Down
13 changes: 8 additions & 5 deletions src/commands/cmd_replication.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<time_t>(util::GetTimeStamp());
srv->storage->SetCheckpointAccessTimeSecs(now_secs);
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 1 addition & 4 deletions src/common/io_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_sendfile>(ssl, in_fd, size, 0);
#else
// NOTE: SockSendFileImpl<SSL_sendfile> will cause errors, refer to #2756
return SockSendFileImpl<SendFileSSLImpl>(ssl, in_fd, size);
#endif
}
#endif
return SockSendFile(out_fd, in_fd, size);
Expand Down
1 change: 1 addition & 0 deletions src/storage/redis_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#pragma once

#include <rocksdb/status.h>
#include <sys/time.h>

#include <atomic>
#include <bitset>
Expand Down
6 changes: 3 additions & 3 deletions tests/gocase/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions tests/gocase/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand All @@ -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=
Expand All @@ -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=
Expand Down
11 changes: 6 additions & 5 deletions tests/gocase/unit/type/list/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a343064

Please sign in to comment.