f808252142
Summary: This diff consolidates local and remote update handling. It ensures and tests that updates for remote elements are visible locally (on the updating worker). The next part will be accumulating remote updates and applying them on the owner. Also extracted a common testing fixture. Reviewers: dgleich, buda, mtomic Reviewed By: mtomic Subscribers: mtomic, pullbot Differential Revision: https://phabricator.memgraph.io/D1169
32 lines
933 B
C++
32 lines
933 B
C++
#include <gtest/gtest.h>
|
|
|
|
#include "database/graph_db_accessor.hpp"
|
|
|
|
#include "distributed_common.hpp"
|
|
|
|
TEST_F(DistributedGraphDbTest, RemoteUpdateLocalVisibility) {
|
|
database::GraphDbAccessor dba_tx1{worker1()};
|
|
auto v = dba_tx1.InsertVertex();
|
|
auto v_ga = v.GlobalAddress();
|
|
dba_tx1.Commit();
|
|
|
|
database::GraphDbAccessor dba_tx2_w2{worker2()};
|
|
v = VertexAccessor(v_ga, dba_tx2_w2);
|
|
ASSERT_FALSE(v.address().is_local());
|
|
auto label = dba_tx2_w2.Label("l");
|
|
EXPECT_FALSE(v.has_label(label));
|
|
v.add_label(label);
|
|
v.SwitchNew();
|
|
EXPECT_TRUE(v.has_label(label));
|
|
v.SwitchOld();
|
|
EXPECT_FALSE(v.has_label(label));
|
|
|
|
// In the same transaction on the owning worker there is no label.
|
|
database::GraphDbAccessor dba_tx2_w1{worker1(), dba_tx2_w2.transaction_id()};
|
|
v = VertexAccessor(v_ga, dba_tx2_w1);
|
|
v.SwitchOld();
|
|
EXPECT_FALSE(v.has_label(label));
|
|
v.SwitchNew();
|
|
EXPECT_FALSE(v.has_label(label));
|
|
}
|