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

Create edge edges are created as corrupted #9255

Closed
DiarmaidEverycs opened this issue May 19, 2020 · 18 comments
Closed

Create edge edges are created as corrupted #9255

DiarmaidEverycs opened this issue May 19, 2020 · 18 comments
Assignees
Labels

Comments

@DiarmaidEverycs
Copy link

OrientDB Version: 3.0.31

Java Version:

openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

OS: Windows running orientdb through docker

To reproduce

Create a new database instance by running
docker run -d --name orientdb -p 2424:2424 -p 2480:2480 -e ORIENTDB_ROOT_PASSWORD=root orientdb:latest

Navigate to the studio and run:
create class A extends V
create class B extends V
create class C extends E
create class AR extends V, ORestricted
create class BR extends V, ORestricted
create class CR extends E, ORestricted

insert into A content {"name": "First", "num": 1}
insert into A content {"name": "Second", "num": 10}
insert into B content {"name": "First", "num": 10}
insert into B content {"name": "Second", "num": 1}

insert into AR content {"name": "First", "num": 1}
insert into AR content {"name": "Second", "num": 10}
insert into BR content {"name": "First", "num": 10}
insert into BR content {"name": "Second", "num": 1}

create edge C from (select from A where name = "First") to (select from B where name = "First") content {"cr": 13}

In a seperate tab, navigate to the bin folder of orientdb and connect to the database
Run the repair database --fix-graph command

Expected behavior

That there would be nothing to fix. After running the repair database command, you would have 8 vertices and 1 edge.

Actual behavior

It reports that the edge which is created is corrupted, and deletes it. After you have 8 vertices and 0 edges.

Further Steps to reproduce

Further attempts to create edges are also corrupted. Output of repair database --fix-graph
orientdb {db=rte}> repair database --fix-graph
Repair of graph 'remote:localhost/rte' is started ...
Scanning 9 edges (skipEdges=0)...

fix-bonsai can be run only on plocal connection

@milan-cvejic
Copy link

I have manged to reproduce this issue using console, and executing all of those statements. Weird thing is that if I close the session (exit console), reconnect and execute repair database --fix-graph there are no errors reported, but if I delete edges, recreate them, and run repair database --fix-graph edges are removed as they are reported as broken.

@andrii0lomakin
Copy link
Member

Hi @milan-cvejic looks like tracking of intermediate changes in the transaction is broken. I will try to check it ASAP.

@andrii0lomakin andrii0lomakin self-assigned this May 20, 2020
@milan-cvejic
Copy link

@Laa Thanks.

Same issue is reproducible on 2.2.37

@andrii0lomakin
Copy link
Member

Hi @milan-cvejic what do you mean by "In a separate tab, navigate to the bin folder of oriented and connect to the database
Run the repair database --fix-graph command" do you establish a connection to the embedded database while the server is running?

@milan-cvejic
Copy link

Hi @Laa, by "In a separate tab" was meant as a new terminal instance. Issue is reproducible if you execute all statements one after another in orientDB console.

@DiarmaidEverycs
Copy link
Author

Hi @Laa The database was running when I ran the repair database --fix-graph command, yes.

@andrii0lomakin
Copy link
Member

Hi @DiarmaidEverycs . You can not do that. You should use the same server to access the database. We use file locks to protect from this kind of access but maybe it does not work in case of embedded containers.

@milan-cvejic
Copy link

milan-cvejic commented Jun 9, 2020

@Laa To clarify, it is the same server. Issue is reproducible from within same session of orientDB console.

Executing:

create class A extends V
create class B extends V
create class C extends E

insert into A content {"name": "First", "num": 1}
insert into A content {"name": "Second", "num": 10}
insert into B content {"name": "First", "num": 10}
insert into B content {"name": "Second", "num": 1}

create edge C from (select from A where name = "First") to (select from B where name = "First") content {"cr": 13}

and then running repair database --fix-graph is enough to reproduce this error.

@andrii0lomakin
Copy link
Member

@milan-cvejic problem is that I tried to reproduce it but without any success. Just to double-check. Do you connect to the database using remote connection?

@milan-cvejic
Copy link

Yes, it is remote connection. I was able to reproduce it when copy/pasting mentioned statements in same console session.

Tested on docker provided version 3.0.31 and version 2.2.37 that is installed on remote server.

@DiarmaidEverycs
Copy link
Author

DiarmaidEverycs commented Jun 9, 2020

@Laa If you connect using plocal, then the issue does not occur, it is only whey you are connecting to the server through the remote connection.

docker run -d -p 2424:2424 -p 2480:2480 -e ORIENTDB_ROOT_PASSWORD=root orientdb:latest
docker exec -it <image_name> /bin/bash

In docker image:

cd bin
./console.sh

In console:

create database plocal:/orientdb/databases/df
create class A extends V
create class B extends V
create class C extends E

insert into A content {"name": "First", "num": 1}
insert into A content {"name": "Second", "num": 10}
insert into B content {"name": "First", "num": 10}
insert into B content {"name": "Second", "num": 1}
 create edge C from (select from A where name = "First") to (select from B where name = "First") content {"cr": 13}

repair database --fix-graph

which gives (correctly)

Repair of graph 'plocal:/orientdb/databases/df' is started ...
Scanning 1 edges (skipEdges=0)...
Scanning edges completed
Scanning 1 vertices...
Scanning vertices completed
Repair of graph 'plocal:/orientdb/databases/df' completed in 0 secs
 scannedEdges.....: 1
 removedEdges.....: 0
 scannedVertices..: 1
 scannedLinks.....: 0
 removedLinks.....: 0
 repairedVertices.: 0

Now run:

connect remote:localhost/df root root
 create edge C from (select from A where name = "First") to (select from B where name = "First") content {"cr": 13}
repair database --fix-graph

And the output is:

Repair of graph 'remote:localhost/df' is started ...
Scanning 2 edges (skipEdges=0)...
+ deleting corrupted edge C#17:1{out:#13:0,in:#15:0,cr:13} v1 because outgoing vertex (null) does not contain the edge, incoming vertex (null) does not contain the edge
Scanning edges completed
Scanning 1 vertices...
Scanning vertices completed
Repair of graph 'remote:localhost/df' completed in 0 secs
 scannedEdges.....: 2
 removedEdges.....: 1
 scannedVertices..: 1
 scannedLinks.....: 0
 removedLinks.....: 0
 repairedVertices.: 0

@andrii0lomakin
Copy link
Member

Hi @DiarmaidEverycs . You can not work like that. You can not connect to the plocal and to the remote the same time. If you perform all the actions only using remote connection do you have those problems?

@DiarmaidEverycs
Copy link
Author

DiarmaidEverycs commented Jun 15, 2020

Hi @Laa

Im a little confused? So whenever I am opening the console to repair the database I have to do it from the database server itself?

We are running OrientDB on a remote server. We start up that server, and connect via the studio, and run the above commands. I then connect from my local machine, and run the repair database command.

Sometimes it deletes the edges, and sometimes it repairs the vertices. It seems to depend on whether the edge was created after I connected via the console (in which case it deletes the edge) or afterwards (in which case it repairs the vertices)

orientdb> connect remote:34.245.52.59/test makersite
Enter password:

Connecting to database [remote:34.245.52.59/test] with user 'makersite'...Warning: Nashorn engine is planned to be removed from a future JDK release
OK
orientdb {db=test}> repair database --fix-graph
Repair of graph 'remote:34.245.52.59/test' is started ...
Scanning 7 edges (skipEdges=0)...
Scanning edges completed
Scanning 8 vertices...
+ repaired corrupted vertex AR#23:2{out_CR:[#26:2, #26:3, #26:6, #27:5, #26:8, #27:7, #26:9],name:Second,num:10} v16
+ repaired corrupted vertex BR#25:2{in_CR:[#26:2, #26:3, #26:6, #27:5, #26:8, #27:7, #26:9],name:Second,num:1} v16
Scanning vertices completed
Repair of graph 'remote:34.245.52.59/test' completed in 2 secs
 scannedEdges.....: 7
 removedEdges.....: 0
 scannedVertices..: 8
 scannedLinks.....: 18
 removedLinks.....: 4
 repairedVertices.: 2

 fix-bonsai can be run only on plocal connection

or

orientdb {db=test}> repair database --fix-graph
Repair of graph 'remote:34.245.52.59/test' is started ...
Scanning 6 edges (skipEdges=0)...
+ deleting corrupted edge CR#26:7{out:#23:2,in:#25:2,cr:20} v1 because outgoing vertex (#23:2) does not contain the edge, incoming vertex (#25:2) does not contain the edge
+ deleting corrupted edge CR#27:6{out:#23:2,in:#25:2,cr:20} v1 because outgoing vertex (#23:2) does not contain the edge, incoming vertex (#25:2) does not contain the edge
Scanning edges completed
Scanning 8 vertices...
Scanning vertices completed
Repair of graph 'remote:34.245.52.59/test' completed in 1 secs
 scannedEdges.....: 6
 removedEdges.....: 2
 scannedVertices..: 8
 scannedLinks.....: 8
 removedLinks.....: 0
 repairedVertices.: 0

 fix-bonsai can be run only on plocal connection

@andrii0lomakin
Copy link
Member

Hi guys,
This is a screenshot of what I am doing https://i.imgur.com/q16tEs3.png https://i.imgur.com/9fg4KQu.png . As you can see there are no broken edges. Could you explain how that differs from what you are doing?

@milan-cvejic
Copy link

@Laa You can reproduce it by using only console.

https://imgur.com/ds00fdb
https://imgur.com/N0lKuWD

Cheers

@andrii0lomakin
Copy link
Member

Thank you, reproduced it. Will fix ASAP.

andrii0lomakin added a commit that referenced this issue Jun 19, 2020
andrii0lomakin added a commit that referenced this issue Jun 19, 2020
andrii0lomakin added a commit that referenced this issue Jun 19, 2020
andrii0lomakin added a commit that referenced this issue Jun 19, 2020
andrii0lomakin added a commit that referenced this issue Jun 19, 2020
andrii0lomakin added a commit that referenced this issue Jun 19, 2020
andrii0lomakin added a commit that referenced this issue Jun 21, 2020
@andrii0lomakin
Copy link
Member

Fixed. Will be released at the next hotfix.

tglman added a commit that referenced this issue Jul 6, 2020
@tglman
Copy link
Member

tglman commented Jul 6, 2020

Hi,
I had to revert one fix was causing other issues in other use cases, I'm re-opening this, anyway the fix i did revert can be worked around with a simple begin() commit() around the sql statement.

@tglman tglman reopened this Jul 6, 2020
@tglman tglman self-assigned this Jul 6, 2020
@andrii0lomakin andrii0lomakin removed their assignment Jul 8, 2020
tglman added a commit that referenced this issue Jul 9, 2020
This reverts commit a71a149.
tglman added a commit that referenced this issue Jul 9, 2020
This reverts commit a71a149.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants