Skip to content

hanging when creating edge with useLightweightEdges enabled #166

Description

@DarrenLamb

I'm new to OrientDb (and noSQL databases in general) and have put together a small application to model "friend" relationships.

The "FriendOf" edge is ideally just a link between two Person vertices, I had read in the documentation that the use of lightweight edges may increase performance. The below code works fine when lightweight edges are disabled. However, when enabling them the line to create the edge hangs.

Am I missing something?

public static void EnableLightweightEdges(ODatabase orient)
{
  orient.Command("ALTER DATABASE custom useLightweightEdges=true");
}

public static void DisableLightweightEdges(ODatabase orient)
{
   orient.Command("ALTER DATABASE custom useLightweightEdges=false");
}

public ODatabase Connect()
{
   return new ODatabase(_connectionOptions);
}

public void EnsureCreated()
{
   using (var orient = Connect())
   {
       DisableLightweightEdges(orient);
       if (!orient.Schema.IsClassExist<Person>())
       {
           orient.Create.Class<Person>().Extends<OVertex>().CreateProperties().Run();
       }

       if (!orient.Schema.IsClassExist("FriendOf"))
       {
           orient.Create.Class("FriendOf").Extends<OEdge>().Run();
       }
       CreatePeople(orient);
   }
}

private static void CreatePeople(ODatabase orient)
{         
   // Clear existing data
   orient.Delete.Edge("FriendOf").Run();
   orient.Delete.Vertex<Person>().Run();

   var person1 = new Person {Id = Guid.Parse("199a5b7a-b4fe-4927-901b-d5b5d2226045"), Name = "Person1"};
   var person1Vertex = orient.Create.Vertex(person1).Run();

   var person2 = new Person {Id = Guid.Parse("5dee19d8-86f0-41a8-b2d8-62a77f80b6d1"), Name = "Person2"};
   var person2Vertex = orient.Create.Vertex(person2).Run();

   orient.Create.Edge("FriendOf").From(person1.ORID).To(person2.ORID).Run();
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions