Fix remote edge create

Summary:
Difficult to test properly as the problem was an implicit conversion of
`gid::Gid` to `mvcc::VersionList<> *`. The only proper way to defend
against this would be to make `gid::Gid` a type.

The `CHECK` added in this diff does not help, but should be there, so...

Reviewers: dgleich

Reviewed By: dgleich

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1244
This commit is contained in:
florijan 2018-02-26 12:38:37 +01:00
parent f1aece8352
commit dc21511e6e
2 changed files with 3 additions and 1 deletions

View File

@ -185,7 +185,7 @@ class RemoteUpdatesRpcServer {
if (creation_result.result == RemoteUpdateResult::DONE && if (creation_result.result == RemoteUpdateResult::DONE &&
data.to.worker_id() == db_.WorkerId()) { data.to.worker_id() == db_.WorkerId()) {
auto to_delta = database::StateDelta::AddInEdge( auto to_delta = database::StateDelta::AddInEdge(
data.tx_id, data.to.gid(), data.from, data.tx_id, data.to.gid(), {data.from, db_.WorkerId()},
{creation_result.gid, db_.WorkerId()}, data.edge_type); {creation_result.gid, db_.WorkerId()}, data.edge_type);
creation_result.result = creation_result.result =
GetUpdates(vertex_updates_, data.tx_id).Emplace(to_delta); GetUpdates(vertex_updates_, data.tx_id).Emplace(to_delta);

View File

@ -173,6 +173,8 @@ class DistributedEdgeCreateTest : public DistributedGraphDbTest {
void CreateEdge(database::GraphDb &creator, storage::VertexAddress from_addr, void CreateEdge(database::GraphDb &creator, storage::VertexAddress from_addr,
storage::VertexAddress to_addr) { storage::VertexAddress to_addr) {
CHECK(from_addr.is_remote() && to_addr.is_remote())
<< "Local address given to CreateEdge";
database::GraphDbAccessor dba{creator}; database::GraphDbAccessor dba{creator};
auto edge_type = dba.EdgeType("et"); auto edge_type = dba.EdgeType("et");
VertexAccessor v1{from_addr, dba}; VertexAccessor v1{from_addr, dba};