Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/pika_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ class PikaConf : public pstd::BaseConf {
TryPushDiffCommands("max-background-jobs", std::to_string(value));
max_background_jobs_ = value;
}
void SetWriteBufferSize(const int& value) {
void SetWriteBufferSize(int64_t value) {
std::lock_guard l(rwlock_);
TryPushDiffCommands("write-buffer-size", std::to_string(value));
write_buffer_size_ = value;
Expand Down
2 changes: 1 addition & 1 deletion src/pika_admin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2692,7 +2692,7 @@ void ConfigCmd::ConfigSet(std::shared_ptr<DB> db) {
res_.AppendStringRaw("-ERR Set write-buffer-size wrong: " + s.ToString() + "\r\n");
return;
}
g_pika_conf->SetWriteBufferSize(static_cast<int>(ival));
g_pika_conf->SetWriteBufferSize(ival);
res_.AppendStringRaw("+OK\r\n");
} else if (set_item == "max-write-buffer-num") {
if (pstd::string2int(value.data(), value.size(), &ival) == 0) {
Expand Down
12 changes: 12 additions & 0 deletions tests/integration/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,18 @@ var _ = Describe("Server", func() {
Expect(r.Val()).To(Equal("OK"))
})

It("should ConfigSet write-buffer-size large value", func() {
// Test for fix: when setting write-buffer-size value larger than 2147483647,
// the value should not become negative
configSet := client.ConfigSet(ctx, "write-buffer-size", "3000000000")
Expect(configSet.Err()).NotTo(HaveOccurred())
Expect(configSet.Val()).To(Equal("OK"))

configGet := client.ConfigGet(ctx, "write-buffer-size")
Expect(configGet.Err()).NotTo(HaveOccurred())
Expect(configGet.Val()).To(Equal(map[string]string{"write-buffer-size": "3000000000"}))
})

It("should ConfigSet maxmemory", func() {
configGet := client.ConfigGet(ctx, "maxmemory")
Expect(configGet.Err()).NotTo(HaveOccurred())
Expand Down
Loading