Add distributed snapshot recovery test
Summary: Test to check that the recovery works even if the snapshot is corrupted in distributed. Depends on D1930 Reviewers: vkasljevic, mferencevic Reviewed By: mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1950
This commit is contained in:
parent
ad0d9e1f87
commit
67ff1cdce3
@ -3,9 +3,10 @@
|
|||||||
#include "distributed_common.hpp"
|
#include "distributed_common.hpp"
|
||||||
|
|
||||||
#include "database/distributed/graph_db_accessor.hpp"
|
#include "database/distributed/graph_db_accessor.hpp"
|
||||||
|
#include "durability/distributed/paths.hpp"
|
||||||
#include "durability/distributed/snapshooter.hpp"
|
#include "durability/distributed/snapshooter.hpp"
|
||||||
#include "durability/distributed/version.hpp"
|
#include "durability/distributed/version.hpp"
|
||||||
#include "durability/distributed/paths.hpp"
|
#include "utils/file.hpp"
|
||||||
#include "utils/string.hpp"
|
#include "utils/string.hpp"
|
||||||
|
|
||||||
std::vector<fs::path> DirFiles(fs::path dir) {
|
std::vector<fs::path> DirFiles(fs::path dir) {
|
||||||
@ -196,6 +197,27 @@ TEST_F(DistributedDurability, RecoveryFailure) {
|
|||||||
EXPECT_DEATH(RestartWithRecovery(), "worker failed to recover");
|
EXPECT_DEATH(RestartWithRecovery(), "worker failed to recover");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(DistributedDurability, InvalidSnapshotRecovery) {
|
||||||
|
{
|
||||||
|
auto dba = master().Access();
|
||||||
|
// Make sure we first create a valid snapshot to ensure valid dir structure.
|
||||||
|
master().MakeSnapshot(*dba);
|
||||||
|
|
||||||
|
auto path = durability::MakeSnapshotPath(
|
||||||
|
GetDurabilityDirectory(0), master().WorkerId(), dba->transaction_id());
|
||||||
|
|
||||||
|
// Create a fake snapshot.
|
||||||
|
utils::LogFile snapshot;
|
||||||
|
snapshot.Open(path);
|
||||||
|
snapshot.Write("This is not the snapshot you're looking for");
|
||||||
|
snapshot.Sync();
|
||||||
|
}
|
||||||
|
// We expect that the db doesn't crash on the next line.
|
||||||
|
RestartWithRecovery();
|
||||||
|
// Make sure we didn't recover anything from the corrupted snapshot.
|
||||||
|
CheckVertices(0);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(DistributedDurability, WalWrite) {
|
TEST_F(DistributedDurability, WalWrite) {
|
||||||
{
|
{
|
||||||
CleanDurability();
|
CleanDurability();
|
||||||
|
Loading…
Reference in New Issue
Block a user