Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect edges count after committing with sbtree-based ridbag #9805

Closed
johny65 opened this issue May 12, 2022 · 4 comments
Closed

Incorrect edges count after committing with sbtree-based ridbag #9805

johny65 opened this issue May 12, 2022 · 4 comments
Assignees
Milestone

Comments

@johny65
Copy link

johny65 commented May 12, 2022

OrientDB Version: 3.2.6

Java Version: openjdk version "11.0.15"

OS: Ubuntu 22.04

Expected behavior

A committed vertex should return the correct edges after adding a new edge.

Actual behavior

When sbtree-based rigbad is activated (server configured with ORIENTDB_SETTINGS="-DridBag.embeddedToSbtreeBonsaiThreshold=-1"), adding an edge to a vertex and then committing, the vertex returns incorrect count of edges.

This is the same as #9076 but for OrientDB version 3.2 with Multi Model API. The behavior is correct in version 3.1. As noted in #9076 (comment), in 3.0 configuring the client with GlobalConfiguration.RID_BAG_EMBEDDED_TO_SBTREEBONSAI_THRESHOLD.setValue(-1) fixes the case, but this is not true in 3.2.

Steps to reproduce

        ODatabaseSession g = pool.acquire();
        g.begin();
        OVertex vertex1 = g.newVertex("V"); vertex1.save();
        OVertex vertex2 = g.newVertex("V"); vertex2.save();
        g.commit();
        
        int version = vertex1.getProperty("@version");
        System.out.println("Version: " + version);
        System.out.println("vertex1 out: " + countEdges(vertex1, ODirection.OUT));
        System.out.println("vertex2 in: " + countEdges(vertex2, ODirection.IN));
        /* output:
           Version: 1
           vertex1 out: 0
           vertex2 in: 0
        */
        
        g.begin();
        vertex1.addEdge(vertex2);
        vertex1.save();
        
        version = vertex1.getProperty("@version");
        System.out.println("Pre-commit:");
        System.out.println("Version: " + version);
        System.out.println("vertex1 out: " + countEdges(vertex1, ODirection.OUT));
        System.out.println("vertex2 in: " + countEdges(vertex2, ODirection.IN));
        /* output:
           Pre-commit:
           Version: 1
           vertex1 out: 1
           vertex2 in: 1
        */
        
        g.commit();
        
        version = vertex1.getProperty("@version");
        System.out.println("Post-commit:");
        System.out.println("Version: " + version);
        System.out.println("vertex1 out: " + countEdges(vertex1, ODirection.OUT));
        System.out.println("vertex2 in: " + countEdges(vertex2, ODirection.IN));
        /* output:
           Post-commit:
           Version: 2
           vertex1 out: 0 <- INCORRECT
           vertex2 in: 0 <- INCORRECT
        */
        
        g.close();
        
        g = pool.acquire();
        vertex1 = g.load(vertex1.getIdentity());
        vertex2 = g.load(vertex2.getIdentity());

        version = vertex1.getProperty("@version");        
        System.out.println("Reload in new transaction:");
        System.out.println("Version: " + version);
        System.out.println("vertex1 out: " + countEdges(vertex1, ODirection.OUT));
        System.out.println("vertex2 in: " + countEdges(vertex2, ODirection.IN));
        /* output:
           Reload in new transaction:
           Version: 2
           vertex1 out: 1
           vertex2 in: 1
        */
    private int countEdges(OVertex v, ODirection dir) throws Exception {
        int c = 0;
        Iterator it = v.getEdges(dir).iterator();
        while (it.hasNext()) { c++; it.next(); }
        return c;
    }
@tglman tglman self-assigned this May 16, 2022
@tglman
Copy link
Member

tglman commented May 17, 2022

Hi,

Tried to write a test out of the specified case, but seems to work fine, could you help me to reproduce?
here is the commit: effc313

Regards

@johny65
Copy link
Author

johny65 commented May 24, 2022

Hi @tglman. The server must be configured with ORIENTDB_SETTINGS="-DridBag.embeddedToSbtreeBonsaiThreshold=-1" (I edit the server.sh file for convenience). Changing the option in the client side does not take effect.
Can you try with this configuration?

@tglman tglman added this to the 3.2.x milestone Jun 14, 2022
@tglman
Copy link
Member

tglman commented Mar 9, 2023

Hi,

I could reproduce the case in remote and fix it, the fix will be released with the next hotfix 3.2.18.

Regards

@tglman tglman modified the milestones: 3.2.x, 3.2.18 Mar 9, 2023
@johny65
Copy link
Author

johny65 commented Apr 13, 2023

Hi, I tested 3.2.18 and it is fixed. Thanks.

@johny65 johny65 closed this as completed Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants