mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 02:15:45 +02:00
feat(rdb save): add unit test to save df with all compression levels (#517)
feat(rdb save): add unit test to save df with all comression levels Signed-off-by: adi_holden <adi@dragonflydb.io>
This commit is contained in:
parent
685b4411e8
commit
cf2ba8eb84
2 changed files with 16 additions and 1 deletions
|
@ -952,7 +952,7 @@ RdbSaver::RdbSaver(::io::Sink* sink, SaveMode save_mode, bool align_writes) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
VLOG(1) << "Rdb save using compression mode:" << uint32_t(compression_mode_);
|
||||||
impl_.reset(new Impl(align_writes, producer_count, compression_mode_, sink));
|
impl_.reset(new Impl(align_writes, producer_count, compression_mode_, sink));
|
||||||
save_mode_ = save_mode;
|
save_mode_ = save_mode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ using absl::StrCat;
|
||||||
|
|
||||||
ABSL_DECLARE_FLAG(int32, list_compress_depth);
|
ABSL_DECLARE_FLAG(int32, list_compress_depth);
|
||||||
ABSL_DECLARE_FLAG(int32, list_max_listpack_size);
|
ABSL_DECLARE_FLAG(int32, list_max_listpack_size);
|
||||||
|
ABSL_DECLARE_FLAG(int, compression_mode);
|
||||||
|
|
||||||
namespace dfly {
|
namespace dfly {
|
||||||
|
|
||||||
|
@ -144,6 +145,20 @@ TEST_F(RdbTest, Stream) {
|
||||||
Run({"save"});
|
Run({"save"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(RdbTest, ComressionModeSaveDragonflyAndReload) {
|
||||||
|
Run({"debug", "populate", "500000"});
|
||||||
|
|
||||||
|
for (int i = 0; i <= 2; ++i) {
|
||||||
|
SetFlag(&FLAGS_compression_mode, i);
|
||||||
|
RespExpr resp = Run({"save", "df"});
|
||||||
|
ASSERT_EQ(resp, "OK");
|
||||||
|
|
||||||
|
auto save_info = service_->server_family().GetLastSaveInfo();
|
||||||
|
resp = Run({"debug", "load", save_info->file_name});
|
||||||
|
ASSERT_EQ(resp, "OK");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(RdbTest, Reload) {
|
TEST_F(RdbTest, Reload) {
|
||||||
absl::FlagSaver fs;
|
absl::FlagSaver fs;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue