Use BasicResult instead of optional for v2 Commit
Summary: Depends on D2365 Reviewers: mferencevic, ipaljak Reviewed By: mferencevic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2366
This commit is contained in:
parent
51d8d16114
commit
1000a5e544
@ -580,7 +580,7 @@ EdgeTypeId Storage::Accessor::NameToEdgeType(const std::string &name) {
|
||||
|
||||
void Storage::Accessor::AdvanceCommand() { ++transaction_.command_id; }
|
||||
|
||||
[[nodiscard]] std::optional<ExistenceConstraintViolation>
|
||||
utils::BasicResult<ExistenceConstraintViolation, void>
|
||||
Storage::Accessor::Commit() {
|
||||
CHECK(is_transaction_active_) << "The transaction is already terminated!";
|
||||
CHECK(!transaction_.must_abort) << "The transaction can't be committed!";
|
||||
@ -641,7 +641,7 @@ Storage::Accessor::Commit() {
|
||||
storage_->CollectGarbage();
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
return {};
|
||||
}
|
||||
|
||||
void Storage::Accessor::Abort() {
|
||||
|
@ -275,9 +275,9 @@ class Storage final {
|
||||
|
||||
/// Commit returns `ExistenceConstraintViolation` if the changes made by
|
||||
/// this transaction violate an existence constraint. In that case the
|
||||
/// transaction is automatically aborted. Otherwise, nullopt is returned.
|
||||
/// transaction is automatically aborted. Otherwise, void is returned.
|
||||
/// @throw std::bad_alloc
|
||||
[[nodiscard]] std::optional<ExistenceConstraintViolation> Commit();
|
||||
utils::BasicResult<ExistenceConstraintViolation, void> Commit();
|
||||
|
||||
/// @throw std::bad_alloc
|
||||
void Abort();
|
||||
|
@ -43,7 +43,7 @@ void UpdateLabelFunc(int thread_id, storage::Storage *storage,
|
||||
<< "Vertex with GID " << gid.AsUint() << " doesn't exist";
|
||||
if (vertex->AddLabel(storage::LabelId::FromUint(label_dist(gen)))
|
||||
.HasValue()) {
|
||||
CHECK(acc.Commit() == std::nullopt);
|
||||
CHECK(!acc.Commit().HasError());
|
||||
} else {
|
||||
acc.Abort();
|
||||
}
|
||||
@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
|
||||
for (int i = 0; i < FLAGS_num_vertices; ++i) {
|
||||
vertices.push_back(acc.CreateVertex().Gid());
|
||||
}
|
||||
CHECK(acc.Commit() == std::nullopt);
|
||||
CHECK(!acc.Commit().HasError());
|
||||
}
|
||||
|
||||
utils::Timer timer;
|
||||
|
@ -25,7 +25,7 @@ TEST(StorageV2, Commit) {
|
||||
EXPECT_EQ(CountVertices(&acc, storage::View::OLD), 0U);
|
||||
ASSERT_TRUE(acc.FindVertex(gid, storage::View::NEW).has_value());
|
||||
EXPECT_EQ(CountVertices(&acc, storage::View::NEW), 1U);
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
{
|
||||
auto acc = store.Access();
|
||||
@ -45,7 +45,7 @@ TEST(StorageV2, Commit) {
|
||||
EXPECT_EQ(CountVertices(&acc, storage::View::OLD), 1U);
|
||||
EXPECT_EQ(CountVertices(&acc, storage::View::NEW), 0U);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
{
|
||||
auto acc = store.Access();
|
||||
@ -111,7 +111,7 @@ TEST(StorageV2, AdvanceCommandCommit) {
|
||||
ASSERT_TRUE(acc.FindVertex(gid1, storage::View::OLD).has_value());
|
||||
ASSERT_TRUE(acc.FindVertex(gid1, storage::View::NEW).has_value());
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
{
|
||||
auto acc = store.Access();
|
||||
@ -185,7 +185,7 @@ TEST(StorageV2, SnapshotIsolation) {
|
||||
EXPECT_EQ(CountVertices(&acc1, storage::View::NEW), 1U);
|
||||
EXPECT_EQ(CountVertices(&acc2, storage::View::NEW), 0U);
|
||||
|
||||
ASSERT_EQ(acc1.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc1.Commit().HasError());
|
||||
|
||||
ASSERT_FALSE(acc2.FindVertex(gid, storage::View::OLD).has_value());
|
||||
EXPECT_EQ(CountVertices(&acc2, storage::View::OLD), 0U);
|
||||
@ -224,7 +224,7 @@ TEST(StorageV2, AccessorMove) {
|
||||
ASSERT_TRUE(moved.FindVertex(gid, storage::View::NEW).has_value());
|
||||
EXPECT_EQ(CountVertices(&moved, storage::View::NEW), 1U);
|
||||
|
||||
ASSERT_EQ(moved.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(moved.Commit().HasError());
|
||||
}
|
||||
{
|
||||
auto acc = store.Access();
|
||||
@ -253,7 +253,7 @@ TEST(StorageV2, VertexDeleteCommit) {
|
||||
EXPECT_EQ(CountVertices(&acc2, storage::View::OLD), 0U);
|
||||
ASSERT_TRUE(acc2.FindVertex(gid, storage::View::NEW).has_value());
|
||||
EXPECT_EQ(CountVertices(&acc2, storage::View::NEW), 1U);
|
||||
ASSERT_EQ(acc2.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc2.Commit().HasError());
|
||||
}
|
||||
|
||||
auto acc3 = store.Access(); // read transaction
|
||||
@ -283,7 +283,7 @@ TEST(StorageV2, VertexDeleteCommit) {
|
||||
EXPECT_EQ(CountVertices(&acc4, storage::View::OLD), 1U);
|
||||
EXPECT_EQ(CountVertices(&acc4, storage::View::NEW), 0U);
|
||||
|
||||
ASSERT_EQ(acc4.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc4.Commit().HasError());
|
||||
}
|
||||
|
||||
auto acc5 = store.Access(); // read transaction
|
||||
@ -324,7 +324,7 @@ TEST(StorageV2, VertexDeleteAbort) {
|
||||
EXPECT_EQ(CountVertices(&acc2, storage::View::OLD), 0U);
|
||||
ASSERT_TRUE(acc2.FindVertex(gid, storage::View::NEW).has_value());
|
||||
EXPECT_EQ(CountVertices(&acc2, storage::View::NEW), 1U);
|
||||
ASSERT_EQ(acc2.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc2.Commit().HasError());
|
||||
}
|
||||
|
||||
auto acc3 = store.Access(); // read transaction
|
||||
@ -390,7 +390,7 @@ TEST(StorageV2, VertexDeleteAbort) {
|
||||
EXPECT_EQ(CountVertices(&acc6, storage::View::OLD), 1U);
|
||||
EXPECT_EQ(CountVertices(&acc6, storage::View::NEW), 0U);
|
||||
|
||||
ASSERT_EQ(acc6.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc6.Commit().HasError());
|
||||
}
|
||||
|
||||
auto acc7 = store.Access(); // read transaction
|
||||
@ -420,10 +420,10 @@ TEST(StorageV2, VertexDeleteAbort) {
|
||||
EXPECT_EQ(CountVertices(&acc7, storage::View::NEW), 0U);
|
||||
|
||||
// Commit all accessors
|
||||
ASSERT_EQ(acc1.Commit(), std::nullopt);
|
||||
ASSERT_EQ(acc3.Commit(), std::nullopt);
|
||||
ASSERT_EQ(acc5.Commit(), std::nullopt);
|
||||
ASSERT_EQ(acc7.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc1.Commit().HasError());
|
||||
ASSERT_FALSE(acc3.Commit().HasError());
|
||||
ASSERT_FALSE(acc5.Commit().HasError());
|
||||
ASSERT_FALSE(acc7.Commit().HasError());
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE(hicpp-special-member-functions)
|
||||
@ -437,7 +437,7 @@ TEST(StorageV2, VertexDeleteSerializationError) {
|
||||
auto acc = store.Access();
|
||||
auto vertex = acc.CreateVertex();
|
||||
gid = vertex.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
auto acc1 = store.Access();
|
||||
@ -481,7 +481,7 @@ TEST(StorageV2, VertexDeleteSerializationError) {
|
||||
}
|
||||
|
||||
// Finalize both accessors
|
||||
ASSERT_EQ(acc1.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc1.Commit().HasError());
|
||||
acc2.Abort();
|
||||
|
||||
// Check whether the vertex exists
|
||||
@ -491,7 +491,7 @@ TEST(StorageV2, VertexDeleteSerializationError) {
|
||||
ASSERT_FALSE(vertex);
|
||||
EXPECT_EQ(CountVertices(&acc, storage::View::OLD), 0U);
|
||||
EXPECT_EQ(CountVertices(&acc, storage::View::NEW), 0U);
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,7 +535,7 @@ TEST(StorageV2, VertexDeleteSpecialCases) {
|
||||
ASSERT_TRUE(res.GetValue());
|
||||
EXPECT_EQ(CountVertices(&acc, storage::View::OLD), 0U);
|
||||
EXPECT_EQ(CountVertices(&acc, storage::View::NEW), 0U);
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the vertices exist
|
||||
@ -564,7 +564,7 @@ TEST(StorageV2, VertexDeleteLabel) {
|
||||
gid = vertex.Gid();
|
||||
ASSERT_FALSE(acc.FindVertex(gid, storage::View::OLD).has_value());
|
||||
ASSERT_TRUE(acc.FindVertex(gid, storage::View::NEW).has_value());
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Add label, delete the vertex and check the label API (same command)
|
||||
@ -725,7 +725,7 @@ TEST(StorageV2, VertexDeleteProperty) {
|
||||
gid = vertex.Gid();
|
||||
ASSERT_FALSE(acc.FindVertex(gid, storage::View::OLD).has_value());
|
||||
ASSERT_TRUE(acc.FindVertex(gid, storage::View::NEW).has_value());
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Set property, delete the vertex and check the property API (same command)
|
||||
@ -903,7 +903,7 @@ TEST(StorageV2, VertexLabelCommit) {
|
||||
ASSERT_FALSE(res.GetValue());
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
{
|
||||
auto acc = store.Access();
|
||||
@ -962,7 +962,7 @@ TEST(StorageV2, VertexLabelCommit) {
|
||||
ASSERT_FALSE(res.GetValue());
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
{
|
||||
auto acc = store.Access();
|
||||
@ -996,7 +996,7 @@ TEST(StorageV2, VertexLabelAbort) {
|
||||
auto acc = store.Access();
|
||||
auto vertex = acc.CreateVertex();
|
||||
gid = vertex.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Add label 5, but abort the transaction.
|
||||
@ -1083,7 +1083,7 @@ TEST(StorageV2, VertexLabelAbort) {
|
||||
ASSERT_FALSE(res.GetValue());
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check that label 5 exists.
|
||||
@ -1209,7 +1209,7 @@ TEST(StorageV2, VertexLabelAbort) {
|
||||
ASSERT_FALSE(res.GetValue());
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check that label 5 doesn't exist.
|
||||
@ -1243,7 +1243,7 @@ TEST(StorageV2, VertexLabelSerializationError) {
|
||||
auto acc = store.Access();
|
||||
auto vertex = acc.CreateVertex();
|
||||
gid = vertex.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
auto acc1 = store.Access();
|
||||
@ -1311,7 +1311,7 @@ TEST(StorageV2, VertexLabelSerializationError) {
|
||||
}
|
||||
|
||||
// Finalize both accessors.
|
||||
ASSERT_EQ(acc1.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc1.Commit().HasError());
|
||||
acc2.Abort();
|
||||
|
||||
// Check which labels exist.
|
||||
@ -1388,7 +1388,7 @@ TEST(StorageV2, VertexPropertyCommit) {
|
||||
ASSERT_EQ(properties[property].ValueString(), "nandare");
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
{
|
||||
auto acc = store.Access();
|
||||
@ -1452,7 +1452,7 @@ TEST(StorageV2, VertexPropertyCommit) {
|
||||
ASSERT_TRUE(res.GetValue());
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
{
|
||||
auto acc = store.Access();
|
||||
@ -1488,7 +1488,7 @@ TEST(StorageV2, VertexPropertyAbort) {
|
||||
auto acc = store.Access();
|
||||
auto vertex = acc.CreateVertex();
|
||||
gid = vertex.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Set property 5 to "nandare", but abort the transaction.
|
||||
@ -1599,7 +1599,7 @@ TEST(StorageV2, VertexPropertyAbort) {
|
||||
ASSERT_EQ(properties[property].ValueString(), "nandare");
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check that property 5 is "nandare".
|
||||
@ -1755,7 +1755,7 @@ TEST(StorageV2, VertexPropertyAbort) {
|
||||
ASSERT_TRUE(vertex->GetProperty(property, storage::View::NEW)->IsNull());
|
||||
ASSERT_EQ(vertex->Properties(storage::View::NEW)->size(), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check that property 5 is null.
|
||||
@ -1791,7 +1791,7 @@ TEST(StorageV2, VertexPropertySerializationError) {
|
||||
auto acc = store.Access();
|
||||
auto vertex = acc.CreateVertex();
|
||||
gid = vertex.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
auto acc1 = store.Access();
|
||||
@ -1855,7 +1855,7 @@ TEST(StorageV2, VertexPropertySerializationError) {
|
||||
}
|
||||
|
||||
// Finalize both accessors.
|
||||
ASSERT_EQ(acc1.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc1.Commit().HasError());
|
||||
acc2.Abort();
|
||||
|
||||
// Check which properties exist.
|
||||
@ -2141,5 +2141,5 @@ TEST(StorageV2, VertexLabelPropertyMixed) {
|
||||
ASSERT_EQ(vertex.Properties(storage::View::OLD)->size(), 0);
|
||||
ASSERT_EQ(vertex.Properties(storage::View::NEW)->size(), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ TEST_F(ConstraintsTest, CreateFailure1) {
|
||||
auto acc = storage.Access();
|
||||
auto vertex = acc.CreateVertex();
|
||||
ASSERT_NO_ERROR(vertex.AddLabel(label1));
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_NO_ERROR(acc.Commit());
|
||||
}
|
||||
{
|
||||
auto res = storage.CreateExistenceConstraint(label1, prop1);
|
||||
@ -72,7 +72,7 @@ TEST_F(ConstraintsTest, CreateFailure1) {
|
||||
for (auto vertex : acc.Vertices(View::OLD)) {
|
||||
ASSERT_NO_ERROR(acc.DeleteVertex(&vertex));
|
||||
}
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_NO_ERROR(acc.Commit());
|
||||
}
|
||||
{
|
||||
auto res = storage.CreateExistenceConstraint(label1, prop1);
|
||||
@ -86,7 +86,7 @@ TEST_F(ConstraintsTest, CreateFailure2) {
|
||||
auto acc = storage.Access();
|
||||
auto vertex = acc.CreateVertex();
|
||||
ASSERT_NO_ERROR(vertex.AddLabel(label1));
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_NO_ERROR(acc.Commit());
|
||||
}
|
||||
{
|
||||
auto res = storage.CreateExistenceConstraint(label1, prop1);
|
||||
@ -99,7 +99,7 @@ TEST_F(ConstraintsTest, CreateFailure2) {
|
||||
for (auto vertex : acc.Vertices(View::OLD)) {
|
||||
ASSERT_NO_ERROR(vertex.SetProperty(prop1, PropertyValue(1)));
|
||||
}
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_NO_ERROR(acc.Commit());
|
||||
}
|
||||
{
|
||||
auto res = storage.CreateExistenceConstraint(label1, prop1);
|
||||
@ -120,8 +120,9 @@ TEST_F(ConstraintsTest, ViolationOnCommit) {
|
||||
ASSERT_NO_ERROR(vertex.AddLabel(label1));
|
||||
|
||||
auto res = acc.Commit();
|
||||
EXPECT_TRUE(res.has_value() &&
|
||||
(*res == ExistenceConstraintViolation{label1, prop1}));
|
||||
EXPECT_TRUE(
|
||||
res.HasError() &&
|
||||
(res.GetError() == ExistenceConstraintViolation{label1, prop1}));
|
||||
}
|
||||
|
||||
{
|
||||
@ -129,7 +130,7 @@ TEST_F(ConstraintsTest, ViolationOnCommit) {
|
||||
auto vertex = acc.CreateVertex();
|
||||
ASSERT_NO_ERROR(vertex.AddLabel(label1));
|
||||
ASSERT_NO_ERROR(vertex.SetProperty(prop1, PropertyValue(1)));
|
||||
EXPECT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_NO_ERROR(acc.Commit());
|
||||
}
|
||||
|
||||
{
|
||||
@ -139,8 +140,9 @@ TEST_F(ConstraintsTest, ViolationOnCommit) {
|
||||
}
|
||||
|
||||
auto res = acc.Commit();
|
||||
EXPECT_TRUE(res.has_value() &&
|
||||
(*res == ExistenceConstraintViolation{label1, prop1}));
|
||||
EXPECT_TRUE(
|
||||
res.HasError() &&
|
||||
(res.GetError() == ExistenceConstraintViolation{label1, prop1}));
|
||||
}
|
||||
|
||||
{
|
||||
@ -152,7 +154,7 @@ TEST_F(ConstraintsTest, ViolationOnCommit) {
|
||||
ASSERT_NO_ERROR(acc.DeleteVertex(&vertex));
|
||||
}
|
||||
|
||||
EXPECT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_NO_ERROR(acc.Commit());
|
||||
}
|
||||
|
||||
ASSERT_TRUE(storage.DropExistenceConstraint(label1, prop1));
|
||||
@ -161,6 +163,6 @@ TEST_F(ConstraintsTest, ViolationOnCommit) {
|
||||
auto acc = storage.Access();
|
||||
auto vertex = acc.CreateVertex();
|
||||
ASSERT_NO_ERROR(vertex.AddLabel(label1));
|
||||
EXPECT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_NO_ERROR(acc.Commit());
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ TEST(StorageV2, EdgeCreateFromSmallerCommit) {
|
||||
auto vertex_to = acc.CreateVertex();
|
||||
gid_from = vertex_from.Gid();
|
||||
gid_to = vertex_to.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge
|
||||
@ -85,7 +85,7 @@ TEST(StorageV2, EdgeCreateFromSmallerCommit) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -168,7 +168,7 @@ TEST(StorageV2, EdgeCreateFromSmallerCommit) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ TEST(StorageV2, EdgeCreateFromLargerCommit) {
|
||||
auto vertex_from = acc.CreateVertex();
|
||||
gid_to = vertex_to.Gid();
|
||||
gid_from = vertex_from.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge
|
||||
@ -253,7 +253,7 @@ TEST(StorageV2, EdgeCreateFromLargerCommit) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -336,7 +336,7 @@ TEST(StorageV2, EdgeCreateFromLargerCommit) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -351,7 +351,7 @@ TEST(StorageV2, EdgeCreateFromSameCommit) {
|
||||
auto acc = store.Access();
|
||||
auto vertex = acc.CreateVertex();
|
||||
gid_vertex = vertex.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge
|
||||
@ -405,7 +405,7 @@ TEST(StorageV2, EdgeCreateFromSameCommit) {
|
||||
ASSERT_EQ(vertex->InEdges({other_et}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(vertex->InEdges({et, other_et}, storage::View::NEW)->size(), 1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -474,7 +474,7 @@ TEST(StorageV2, EdgeCreateFromSameCommit) {
|
||||
ASSERT_EQ(vertex->OutEdges({et, other_et}, storage::View::OLD)->size(), 1);
|
||||
ASSERT_EQ(vertex->OutEdges({et, other_et}, storage::View::NEW)->size(), 1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -493,7 +493,7 @@ TEST(StorageV2, EdgeCreateFromSmallerAbort) {
|
||||
auto vertex_to = acc.CreateVertex();
|
||||
gid_from = vertex_from.Gid();
|
||||
gid_to = vertex_to.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge, but abort the transaction
|
||||
@ -588,7 +588,7 @@ TEST(StorageV2, EdgeCreateFromSmallerAbort) {
|
||||
ASSERT_EQ(vertex_to->OutEdges({}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(*vertex_to->OutDegree(storage::View::NEW), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge
|
||||
@ -654,7 +654,7 @@ TEST(StorageV2, EdgeCreateFromSmallerAbort) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -737,7 +737,7 @@ TEST(StorageV2, EdgeCreateFromSmallerAbort) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -756,7 +756,7 @@ TEST(StorageV2, EdgeCreateFromLargerAbort) {
|
||||
auto vertex_from = acc.CreateVertex();
|
||||
gid_to = vertex_to.Gid();
|
||||
gid_from = vertex_from.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge, but abort the transaction
|
||||
@ -851,7 +851,7 @@ TEST(StorageV2, EdgeCreateFromLargerAbort) {
|
||||
ASSERT_EQ(vertex_to->OutEdges({}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(*vertex_to->OutDegree(storage::View::NEW), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge
|
||||
@ -917,7 +917,7 @@ TEST(StorageV2, EdgeCreateFromLargerAbort) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -1000,7 +1000,7 @@ TEST(StorageV2, EdgeCreateFromLargerAbort) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1015,7 +1015,7 @@ TEST(StorageV2, EdgeCreateFromSameAbort) {
|
||||
auto acc = store.Access();
|
||||
auto vertex = acc.CreateVertex();
|
||||
gid_vertex = vertex.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge, but abort the transaction
|
||||
@ -1088,7 +1088,7 @@ TEST(StorageV2, EdgeCreateFromSameAbort) {
|
||||
ASSERT_EQ(vertex->OutEdges({}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(*vertex->OutDegree(storage::View::NEW), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge
|
||||
@ -1142,7 +1142,7 @@ TEST(StorageV2, EdgeCreateFromSameAbort) {
|
||||
ASSERT_EQ(vertex->InEdges({other_et}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(vertex->InEdges({et, other_et}, storage::View::NEW)->size(), 1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -1211,7 +1211,7 @@ TEST(StorageV2, EdgeCreateFromSameAbort) {
|
||||
ASSERT_EQ(vertex->OutEdges({et, other_et}, storage::View::OLD)->size(), 1);
|
||||
ASSERT_EQ(vertex->OutEdges({et, other_et}, storage::View::NEW)->size(), 1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1230,7 +1230,7 @@ TEST(StorageV2, EdgeDeleteFromSmallerCommit) {
|
||||
auto vertex_to = acc.CreateVertex();
|
||||
gid_from = vertex_from.Gid();
|
||||
gid_to = vertex_to.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge
|
||||
@ -1296,7 +1296,7 @@ TEST(StorageV2, EdgeDeleteFromSmallerCommit) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -1379,7 +1379,7 @@ TEST(StorageV2, EdgeDeleteFromSmallerCommit) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Delete edge
|
||||
@ -1444,7 +1444,7 @@ TEST(StorageV2, EdgeDeleteFromSmallerCommit) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::OLD)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -1473,7 +1473,7 @@ TEST(StorageV2, EdgeDeleteFromSmallerCommit) {
|
||||
ASSERT_EQ(vertex_to->OutEdges({}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(*vertex_to->OutDegree(storage::View::NEW), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1492,7 +1492,7 @@ TEST(StorageV2, EdgeDeleteFromLargerCommit) {
|
||||
auto vertex_from = acc.CreateVertex();
|
||||
gid_from = vertex_from.Gid();
|
||||
gid_to = vertex_to.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge
|
||||
@ -1558,7 +1558,7 @@ TEST(StorageV2, EdgeDeleteFromLargerCommit) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -1641,7 +1641,7 @@ TEST(StorageV2, EdgeDeleteFromLargerCommit) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Delete edge
|
||||
@ -1706,7 +1706,7 @@ TEST(StorageV2, EdgeDeleteFromLargerCommit) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::OLD)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -1735,7 +1735,7 @@ TEST(StorageV2, EdgeDeleteFromLargerCommit) {
|
||||
ASSERT_EQ(vertex_to->OutEdges({}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(*vertex_to->OutDegree(storage::View::NEW), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1750,7 +1750,7 @@ TEST(StorageV2, EdgeDeleteFromSameCommit) {
|
||||
auto acc = store.Access();
|
||||
auto vertex = acc.CreateVertex();
|
||||
gid_vertex = vertex.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge
|
||||
@ -1804,7 +1804,7 @@ TEST(StorageV2, EdgeDeleteFromSameCommit) {
|
||||
ASSERT_EQ(vertex->InEdges({other_et}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(vertex->InEdges({et, other_et}, storage::View::NEW)->size(), 1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -1873,7 +1873,7 @@ TEST(StorageV2, EdgeDeleteFromSameCommit) {
|
||||
ASSERT_EQ(vertex->OutEdges({et, other_et}, storage::View::OLD)->size(), 1);
|
||||
ASSERT_EQ(vertex->OutEdges({et, other_et}, storage::View::NEW)->size(), 1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Delete edge
|
||||
@ -1926,7 +1926,7 @@ TEST(StorageV2, EdgeDeleteFromSameCommit) {
|
||||
ASSERT_EQ(vertex->OutEdges({other_et}, storage::View::OLD)->size(), 0);
|
||||
ASSERT_EQ(vertex->OutEdges({et, other_et}, storage::View::OLD)->size(), 1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -1945,7 +1945,7 @@ TEST(StorageV2, EdgeDeleteFromSameCommit) {
|
||||
ASSERT_EQ(vertex->OutEdges({}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(*vertex->OutDegree(storage::View::NEW), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1964,7 +1964,7 @@ TEST(StorageV2, EdgeDeleteFromSmallerAbort) {
|
||||
auto vertex_to = acc.CreateVertex();
|
||||
gid_from = vertex_from.Gid();
|
||||
gid_to = vertex_to.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge
|
||||
@ -2030,7 +2030,7 @@ TEST(StorageV2, EdgeDeleteFromSmallerAbort) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -2113,7 +2113,7 @@ TEST(StorageV2, EdgeDeleteFromSmallerAbort) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Delete the edge, but abort the transaction
|
||||
@ -2261,7 +2261,7 @@ TEST(StorageV2, EdgeDeleteFromSmallerAbort) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Delete the edge
|
||||
@ -2326,7 +2326,7 @@ TEST(StorageV2, EdgeDeleteFromSmallerAbort) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::OLD)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -2355,7 +2355,7 @@ TEST(StorageV2, EdgeDeleteFromSmallerAbort) {
|
||||
ASSERT_EQ(vertex_to->OutEdges({}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(*vertex_to->OutDegree(storage::View::NEW), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2374,7 +2374,7 @@ TEST(StorageV2, EdgeDeleteFromLargerAbort) {
|
||||
auto vertex_to = acc.CreateVertex();
|
||||
gid_from = vertex_from.Gid();
|
||||
gid_to = vertex_to.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge
|
||||
@ -2440,7 +2440,7 @@ TEST(StorageV2, EdgeDeleteFromLargerAbort) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -2523,7 +2523,7 @@ TEST(StorageV2, EdgeDeleteFromLargerAbort) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Delete the edge, but abort the transaction
|
||||
@ -2672,7 +2672,7 @@ TEST(StorageV2, EdgeDeleteFromLargerAbort) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::NEW)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Delete the edge
|
||||
@ -2737,7 +2737,7 @@ TEST(StorageV2, EdgeDeleteFromLargerAbort) {
|
||||
ASSERT_EQ(vertex_to->InEdges({et, other_et}, storage::View::OLD)->size(),
|
||||
1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -2766,7 +2766,7 @@ TEST(StorageV2, EdgeDeleteFromLargerAbort) {
|
||||
ASSERT_EQ(vertex_to->OutEdges({}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(*vertex_to->OutDegree(storage::View::NEW), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2781,7 +2781,7 @@ TEST(StorageV2, EdgeDeleteFromSameAbort) {
|
||||
auto acc = store.Access();
|
||||
auto vertex = acc.CreateVertex();
|
||||
gid_vertex = vertex.Gid();
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Create edge
|
||||
@ -2835,7 +2835,7 @@ TEST(StorageV2, EdgeDeleteFromSameAbort) {
|
||||
ASSERT_EQ(vertex->InEdges({other_et}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(vertex->InEdges({et, other_et}, storage::View::NEW)->size(), 1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -2904,7 +2904,7 @@ TEST(StorageV2, EdgeDeleteFromSameAbort) {
|
||||
ASSERT_EQ(vertex->OutEdges({et, other_et}, storage::View::OLD)->size(), 1);
|
||||
ASSERT_EQ(vertex->OutEdges({et, other_et}, storage::View::NEW)->size(), 1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Delete the edge, but abort the transaction
|
||||
@ -3026,7 +3026,7 @@ TEST(StorageV2, EdgeDeleteFromSameAbort) {
|
||||
ASSERT_EQ(vertex->OutEdges({et, other_et}, storage::View::OLD)->size(), 1);
|
||||
ASSERT_EQ(vertex->OutEdges({et, other_et}, storage::View::NEW)->size(), 1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Delete the edge
|
||||
@ -3079,7 +3079,7 @@ TEST(StorageV2, EdgeDeleteFromSameAbort) {
|
||||
ASSERT_EQ(vertex->OutEdges({other_et}, storage::View::OLD)->size(), 0);
|
||||
ASSERT_EQ(vertex->OutEdges({et, other_et}, storage::View::OLD)->size(), 1);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check whether the edge exists
|
||||
@ -3098,7 +3098,7 @@ TEST(StorageV2, EdgeDeleteFromSameAbort) {
|
||||
ASSERT_EQ(vertex->OutEdges({}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(*vertex->OutDegree(storage::View::NEW), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -3156,7 +3156,7 @@ TEST(StorageV2, VertexDetachDeleteSingleCommit) {
|
||||
ASSERT_EQ(vertex_to.OutEdges({}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(*vertex_to.OutDegree(storage::View::NEW), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Detach delete vertex
|
||||
@ -3223,7 +3223,7 @@ TEST(StorageV2, VertexDetachDeleteSingleCommit) {
|
||||
ASSERT_EQ(vertex_to->OutEdges({}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(*vertex_to->OutDegree(storage::View::NEW), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check dataset
|
||||
@ -3386,7 +3386,7 @@ TEST(StorageV2, VertexDetachDeleteMultipleCommit) {
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Detach delete vertex
|
||||
@ -3536,7 +3536,7 @@ TEST(StorageV2, VertexDetachDeleteMultipleCommit) {
|
||||
ASSERT_EQ(e.ToVertex(), *vertex2);
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check dataset
|
||||
@ -3651,7 +3651,7 @@ TEST(StorageV2, VertexDetachDeleteSingleAbort) {
|
||||
ASSERT_EQ(vertex_to.OutEdges({}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(*vertex_to.OutDegree(storage::View::NEW), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Detach delete vertex, but abort the transaction
|
||||
@ -3759,7 +3759,7 @@ TEST(StorageV2, VertexDetachDeleteSingleAbort) {
|
||||
ASSERT_EQ(vertex_to->OutEdges({}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(*vertex_to->OutDegree(storage::View::NEW), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Detach delete vertex
|
||||
@ -3826,7 +3826,7 @@ TEST(StorageV2, VertexDetachDeleteSingleAbort) {
|
||||
ASSERT_EQ(vertex_to->OutEdges({}, storage::View::NEW)->size(), 0);
|
||||
ASSERT_EQ(*vertex_to->OutDegree(storage::View::NEW), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check dataset
|
||||
@ -3989,7 +3989,7 @@ TEST(StorageV2, VertexDetachDeleteMultipleAbort) {
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Detach delete vertex, but abort the transaction
|
||||
@ -4333,7 +4333,7 @@ TEST(StorageV2, VertexDetachDeleteMultipleAbort) {
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Detach delete vertex
|
||||
@ -4483,7 +4483,7 @@ TEST(StorageV2, VertexDetachDeleteMultipleAbort) {
|
||||
ASSERT_EQ(e.ToVertex(), *vertex2);
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check dataset
|
||||
@ -4593,7 +4593,7 @@ TEST(StorageV2, EdgePropertyCommit) {
|
||||
ASSERT_EQ(properties[property].ValueString(), "nandare");
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
{
|
||||
auto acc = store.Access();
|
||||
@ -4657,7 +4657,7 @@ TEST(StorageV2, EdgePropertyCommit) {
|
||||
ASSERT_TRUE(res.GetValue());
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
{
|
||||
auto acc = store.Access();
|
||||
@ -4697,7 +4697,7 @@ TEST(StorageV2, EdgePropertyAbort) {
|
||||
ASSERT_EQ(edge.EdgeType(), et);
|
||||
ASSERT_EQ(edge.FromVertex(), vertex);
|
||||
ASSERT_EQ(edge.ToVertex(), vertex);
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Set property 5 to "nandare", but abort the transaction.
|
||||
@ -4807,7 +4807,7 @@ TEST(StorageV2, EdgePropertyAbort) {
|
||||
ASSERT_EQ(properties[property].ValueString(), "nandare");
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check that property 5 is "nandare".
|
||||
@ -4963,7 +4963,7 @@ TEST(StorageV2, EdgePropertyAbort) {
|
||||
ASSERT_TRUE(edge.GetProperty(property, storage::View::NEW)->IsNull());
|
||||
ASSERT_EQ(edge.Properties(storage::View::NEW)->size(), 0);
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Check that property 5 is null.
|
||||
@ -5003,7 +5003,7 @@ TEST(StorageV2, EdgePropertySerializationError) {
|
||||
ASSERT_EQ(edge.EdgeType(), et);
|
||||
ASSERT_EQ(edge.FromVertex(), vertex);
|
||||
ASSERT_EQ(edge.ToVertex(), vertex);
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
auto acc1 = store.Access();
|
||||
@ -5067,7 +5067,7 @@ TEST(StorageV2, EdgePropertySerializationError) {
|
||||
}
|
||||
|
||||
// Finalize both accessors.
|
||||
ASSERT_EQ(acc1.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc1.Commit().HasError());
|
||||
acc2.Abort();
|
||||
|
||||
// Check which properties exist.
|
||||
|
@ -47,7 +47,7 @@ TEST(StorageV2Gc, Sanity) {
|
||||
EXPECT_EQ(vertex_new.has_value(), i % 5 != 0);
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Verify existing vertices and add labels to some of them.
|
||||
@ -90,7 +90,7 @@ TEST(StorageV2Gc, Sanity) {
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
|
||||
// Add and remove some edges.
|
||||
@ -150,7 +150,7 @@ TEST(StorageV2Gc, Sanity) {
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc.Commit().HasError());
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ TEST(StorageV2Gc, Indices) {
|
||||
auto vertex = acc0.CreateVertex();
|
||||
ASSERT_TRUE(*vertex.AddLabel(acc0.NameToLabel("label")));
|
||||
}
|
||||
ASSERT_EQ(acc0.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc0.Commit().HasError());
|
||||
}
|
||||
{
|
||||
auto acc1 = storage.Access();
|
||||
@ -182,7 +182,7 @@ TEST(StorageV2Gc, Indices) {
|
||||
for (auto vertex : acc2.Vertices(storage::View::OLD)) {
|
||||
ASSERT_TRUE(*vertex.RemoveLabel(acc2.NameToLabel("label")));
|
||||
}
|
||||
ASSERT_EQ(acc2.Commit(), std::nullopt);
|
||||
ASSERT_FALSE(acc2.Commit().HasError());
|
||||
|
||||
// Wait for GC.
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(300));
|
||||
|
@ -149,7 +149,7 @@ TEST_F(IndexTest, LabelIndexDuplicateVersions) {
|
||||
EXPECT_THAT(GetIds(acc.Vertices(label1, View::NEW), View::NEW),
|
||||
UnorderedElementsAre(0, 1, 2, 3, 4));
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_NO_ERROR(acc.Commit());
|
||||
}
|
||||
|
||||
{
|
||||
@ -194,7 +194,7 @@ TEST_F(IndexTest, LabelIndexTransactionalIsolation) {
|
||||
EXPECT_THAT(GetIds(acc_after.Vertices(label1, View::NEW), View::NEW),
|
||||
IsEmpty());
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_NO_ERROR(acc.Commit());
|
||||
|
||||
auto acc_after_commit = storage.Access();
|
||||
|
||||
@ -336,7 +336,7 @@ TEST_F(IndexTest, LabelPropertyIndexDuplicateVersions) {
|
||||
EXPECT_THAT(GetIds(acc.Vertices(label1, prop_val, View::NEW), View::NEW),
|
||||
UnorderedElementsAre(0, 1, 2, 3, 4));
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_NO_ERROR(acc.Commit());
|
||||
}
|
||||
|
||||
{
|
||||
@ -386,7 +386,7 @@ TEST_F(IndexTest, LabelPropertyIndexTransactionalIsolation) {
|
||||
GetIds(acc_after.Vertices(label1, prop_val, View::NEW), View::NEW),
|
||||
IsEmpty());
|
||||
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_NO_ERROR(acc.Commit());
|
||||
|
||||
auto acc_after_commit = storage.Access();
|
||||
|
||||
@ -420,7 +420,7 @@ TEST_F(IndexTest, LabelPropertyIndexFiltering) {
|
||||
ASSERT_NO_ERROR(vertex.SetProperty(
|
||||
prop_val, i % 2 ? PropertyValue(i / 2) : PropertyValue(i / 2.0)));
|
||||
}
|
||||
ASSERT_EQ(acc.Commit(), std::nullopt);
|
||||
ASSERT_NO_ERROR(acc.Commit());
|
||||
}
|
||||
{
|
||||
auto acc = storage.Access();
|
||||
|
Loading…
Reference in New Issue
Block a user