mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 02:15:45 +02:00
chore: Add tiered_storage_test. (#613)
1. Support tiered deletion. 2. Add notion of tiered entity in "DEBUG OBJECT" output. Signed-off-by: Roman Gershman <roman@dragonflydb.io> Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
e39d266abe
commit
63b83c5b99
19 changed files with 225 additions and 62 deletions
|
@ -17,6 +17,7 @@ extern "C" {
|
|||
#include "base/logging.h"
|
||||
#include "facade/facade_test.h" // needed to find operator== for RespExpr.
|
||||
#include "io/file.h"
|
||||
#include "io/file_util.h"
|
||||
#include "server/engine_shard_set.h"
|
||||
#include "server/rdb_load.h"
|
||||
#include "server/test_utils.h"
|
||||
|
@ -31,15 +32,32 @@ using absl::StrCat;
|
|||
ABSL_DECLARE_FLAG(int32, list_compress_depth);
|
||||
ABSL_DECLARE_FLAG(int32, list_max_listpack_size);
|
||||
ABSL_DECLARE_FLAG(int, compression_mode);
|
||||
ABSL_DECLARE_FLAG(string, dbfilename);
|
||||
|
||||
namespace dfly {
|
||||
|
||||
class RdbTest : public BaseFamilyTest {
|
||||
protected:
|
||||
protected:
|
||||
static void SetUpTestSuite();
|
||||
void TearDown();
|
||||
|
||||
io::FileSource GetSource(string name);
|
||||
};
|
||||
|
||||
void RdbTest::SetUpTestSuite() {
|
||||
BaseFamilyTest::SetUpTestSuite();
|
||||
SetFlag(&FLAGS_dbfilename, "rdbtestdump");
|
||||
}
|
||||
|
||||
void RdbTest::TearDown() {
|
||||
auto rdb_files = io::StatFiles("rdbtestdump*");
|
||||
CHECK(rdb_files);
|
||||
for (const auto& fl : *rdb_files) {
|
||||
unlink(fl.name.c_str());
|
||||
}
|
||||
BaseFamilyTest::TearDown();
|
||||
}
|
||||
|
||||
inline const uint8_t* to_byte(const void* s) {
|
||||
return reinterpret_cast<const uint8_t*>(s);
|
||||
}
|
||||
|
@ -146,7 +164,7 @@ TEST_F(RdbTest, Stream) {
|
|||
}
|
||||
|
||||
TEST_F(RdbTest, ComressionModeSaveDragonflyAndReload) {
|
||||
Run({"debug", "populate", "500000"});
|
||||
Run({"debug", "populate", "50000"});
|
||||
|
||||
for (int i = 0; i <= 3; ++i) {
|
||||
SetFlag(&FLAGS_compression_mode, i);
|
||||
|
@ -156,7 +174,7 @@ TEST_F(RdbTest, ComressionModeSaveDragonflyAndReload) {
|
|||
auto save_info = service_->server_family().GetLastSaveInfo();
|
||||
resp = Run({"debug", "load", save_info->file_name});
|
||||
ASSERT_EQ(resp, "OK");
|
||||
ASSERT_EQ(500000, CheckedInt({"dbsize"}));
|
||||
ASSERT_EQ(50000, CheckedInt({"dbsize"}));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,7 +258,8 @@ TEST_F(RdbTest, SaveManyDbs) {
|
|||
Run({"select", "1"});
|
||||
Run({"debug", "populate", "10000"});
|
||||
});
|
||||
auto metrics = service_->server_family().GetMetrics();
|
||||
|
||||
auto metrics = GetMetrics();
|
||||
ASSERT_EQ(2, metrics.db.size());
|
||||
EXPECT_EQ(50000, metrics.db[0].key_count);
|
||||
EXPECT_EQ(10000, metrics.db[1].key_count);
|
||||
|
@ -272,7 +291,7 @@ TEST_F(RdbTest, SaveManyDbs) {
|
|||
auto resp = Run({"debug", "reload", "NOSAVE"});
|
||||
EXPECT_EQ(resp, "OK");
|
||||
|
||||
metrics = service_->server_family().GetMetrics();
|
||||
metrics = GetMetrics();
|
||||
ASSERT_EQ(2, metrics.db.size());
|
||||
EXPECT_EQ(50000, metrics.db[0].key_count);
|
||||
EXPECT_EQ(10000, metrics.db[1].key_count);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue