Summary: This diff splits single node and distributed storage from each other. Currently all of the storage code is copied into two directories (one single node, one distributed). The logic used in the storage implementation isn't touched, it will be refactored in following diffs. To clean the working directory after this diff you should execute: ``` rm database/state_delta.capnp rm database/state_delta.hpp rm storage/concurrent_id_mapper_rpc_messages.capnp rm storage/concurrent_id_mapper_rpc_messages.hpp ``` Reviewers: teon.banek, buda, msantl Reviewed By: teon.banek, msantl Subscribers: teon.banek, pullbot Differential Revision: https://phabricator.memgraph.io/D1625
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
#include <memory>
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "database/graph_db.hpp"
|
|
#include "database/graph_db_accessor.hpp"
|
|
#include "storage/common/types.hpp"
|
|
#include "storage/single_node/indexes/label_property_index.hpp"
|
|
|
|
TEST(GraphDbTest, GarbageCollectIndices) {
|
|
database::Config config;
|
|
config.gc_cycle_sec = -1;
|
|
database::SingleNode graph_db{config};
|
|
std::unique_ptr<database::GraphDbAccessor> dba = graph_db.Access();
|
|
|
|
auto commit = [&] {
|
|
dba->Commit();
|
|
dba = graph_db.Access();
|
|
};
|
|
auto label = dba->Label("label");
|
|
auto property = dba->Property("property");
|
|
dba->BuildIndex(label, property);
|
|
commit();
|
|
|
|
auto vertex = dba->InsertVertex();
|
|
vertex.add_label(label);
|
|
vertex.PropsSet(property, 42);
|
|
commit();
|
|
|
|
EXPECT_EQ(dba->VerticesCount(label, property), 1);
|
|
auto vertex_transferred = dba->Transfer(vertex);
|
|
dba->RemoveVertex(vertex_transferred.value());
|
|
EXPECT_EQ(dba->VerticesCount(label, property), 1);
|
|
commit();
|
|
EXPECT_EQ(dba->VerticesCount(label, property), 1);
|
|
graph_db.CollectGarbage();
|
|
EXPECT_EQ(dba->VerticesCount(label, property), 0);
|
|
}
|