Closed hho closed 9 years ago
Update: Subsequent attempts (both in Studio as well as the console) now throw a java.lang.NullPointerException: Impossible to add a null identifiable in a ridbag
.
I guess my database is now corrupt?
Did you try with 2.1 GA?
With 2.1-GA the IllegalStateException still happens, I have been unable to reproduce the NullPointerException though.
On the first attempt 100 Records get actually moved, on the second attempt another 78 (again, throwing the IllegalStateException). Further attempts only throw the exception and move nothing.
Console log follows:
➜ ./console.sh
OrientDB console v.2.1.0 (build UNKNOWN@r; 2015-08-05 13:38:23+0000) www.orientdb.com
Type 'help' to display all the supported commands.
Installing extensions for GREMLIN language v.2.6.0
orientdb> connect remote:localhost/GratefulDeadConcerts admin admin
Connecting to database [remote:localhost/GratefulDeadConcerts] with user 'admin'...OK
orientdb {db=GratefulDeadConcerts}> create class Song extends V
Class created successfully. Total classes in database now: 14
orientdb {db=GratefulDeadConcerts}> move vertex (select from V where type='song') to class:Song
Error: com.orientechnologies.orient.core.exception.OCommandExecutionException: Error on execution of command: sql.move vertex (select from V where type='song') to class:Song
Error: java.lang.IllegalStateException: Move vertex requires an active transaction to be executed in safe manner
orientdb {db=GratefulDeadConcerts}> list classes
CLASSES
----------------------------------------------+------------------------------------+------------+----------------+
NAME | SUPERCLASS | CLUSTERS | RECORDS |
----------------------------------------------+------------------------------------+------------+----------------+
E | | 10 | 0 |
followed_by | [E] | 11 | 7047 |
OFunction | | 6 | 0 |
OIdentity | | - | 0 |
ORestricted | | - | 0 |
ORIDs | | 8 | 0 |
ORole | [OIdentity] | 4 | 3 |
OSchedule | | 7 | 0 |
OTriggered | | - | 0 |
OUser | [OIdentity] | 5 | 3 |
Song | [V] | 14 | 100 |
sung_by | [E] | 13 | 501 |
V | | 9 | 709 |
written_by | [E] | 12 | 501 |
----------------------------------------------+------------------------------------+------------+----------------+
TOTAL = 14 8864 |
----------------------------------------------+------------------------------------+------------+----------------+
orientdb {db=GratefulDeadConcerts}> move vertex (select from V where type='song') to class:Song
Error: com.orientechnologies.orient.core.exception.OCommandExecutionException: Error on execution of command: sql.move vertex (select from V where type='song') to class:Song
Error: java.lang.IllegalStateException: Move vertex requires an active transaction to be executed in safe manner
orientdb {db=GratefulDeadConcerts}> list classes
CLASSES
----------------------------------------------+------------------------------------+------------+----------------+
NAME | SUPERCLASS | CLUSTERS | RECORDS |
----------------------------------------------+------------------------------------+------------+----------------+
E | | 10 | 0 |
followed_by | [E] | 11 | 7047 |
OFunction | | 6 | 0 |
OIdentity | | - | 0 |
ORestricted | | - | 0 |
ORIDs | | 8 | 0 |
ORole | [OIdentity] | 4 | 3 |
OSchedule | | 7 | 0 |
OTriggered | | - | 0 |
OUser | [OIdentity] | 5 | 3 |
Song | [V] | 14 | 178 |
sung_by | [E] | 13 | 501 |
V | | 9 | 631 |
written_by | [E] | 12 | 501 |
----------------------------------------------+------------------------------------+------------+----------------+
TOTAL = 14 8864 |
----------------------------------------------+------------------------------------+------------+----------------+
orientdb {db=GratefulDeadConcerts}> move vertex (select from V where type='song') to class:Song
Error: com.orientechnologies.orient.core.exception.OCommandExecutionException: Error on execution of command: sql.move vertex (select from V where type='song') to class:Song
Error: java.lang.IllegalStateException: Move vertex requires an active transaction to be executed in safe manner
orientdb {db=GratefulDeadConcerts}> list classes
CLASSES
----------------------------------------------+------------------------------------+------------+----------------+
NAME | SUPERCLASS | CLUSTERS | RECORDS |
----------------------------------------------+------------------------------------+------------+----------------+
E | | 10 | 0 |
followed_by | [E] | 11 | 7047 |
OFunction | | 6 | 0 |
OIdentity | | - | 0 |
ORestricted | | - | 0 |
ORIDs | | 8 | 0 |
ORole | [OIdentity] | 4 | 3 |
OSchedule | | 7 | 0 |
OTriggered | | - | 0 |
OUser | [OIdentity] | 5 | 3 |
Song | [V] | 14 | 178 |
sung_by | [E] | 13 | 501 |
V | | 9 | 631 |
written_by | [E] | 12 | 501 |
----------------------------------------------+------------------------------------+------------+----------------+
TOTAL = 14 8864 |
----------------------------------------------+------------------------------------+------------+----------------+
orientdb {db=GratefulDeadConcerts}>
Is the issue in the console only or with API? I think the console uses an instance with no autoTransaction(true), so when the move vertex does the commit, the TX is not open anymore. If you have this problem in console only, as workaround, please call the begin
before further move vertex commands
I have only tried console and Studio, but as I already wrote in the first post at the top: It doesn't change anything if I call begin
before trying to move
.
Oh, I also just found out how to reproduce the NullPointerException:
The GratefulDeadConcerts
databases included with OrientDB is not the same as the one which is downloadable in Studio.
So when I delete the one which came with OrientDB and then download it again in Studio, that "Error: java.lang.NullPointerException: Impossible to add a null identifiable in a ridbag" happens on the second attempt to move
.
Seemingly something prevents MOVE VERTEX
from accomplishing anything beyond the first 100 items. The resulting items do not seem corrupt though...
One temporary workaround is to make a function with a loop and move in batches of 100. Here is a javascript example:
var g = orient.getGraph();
var cnt = g.command("sql", "select count(*) from v where type='song'")[0].getProperty("count");
var j = parseInt(cnt/100);
cmd = "move vertex (select from v where type='song' limit 100) to class:Song";
for (i = 0; i <= j; i++) {
g.command("sql", cmd);
}
return cnt;
It worked for me...
@hho , indeed the Null Pointer Exception have to do with corrupt data. But the database has been delivered corrupt it seems. For instance I found huge collections of null values under in_sung_by
field of V
where type='artist'. The exception probably pertains to those, not the
MOVE VERTEX` per se.
@lvca more info here:
The issue emanates from batch processing. What happens is that MOVE VERTEX
fails after the first batch regardless of whether we are within a manually opened transaction or in auto-commit mode. Setting BATCH
option helps getting rid of the error (as long as the data size is small enough). For instance in the MovieRatings database, the following succeeds from time to time because the number of women is less than 2000 (about 1700):
CREATE CLASS Women EXTENDS Users
MOVE VERTEX (SELECT FROM Users WHERE gender = "F") TO Class:Women BATCH 2000
But a similar command definitely fails for men, because the number of men is more than 2000 (about 4300):
CREATE CLASS Men EXTENDS Users
MOVE VERTEX (SELECT FROM Users WHERE gender = "M") TO Class:Men BATCH 2000
And this time I don't get an error, but the server simply goes haywire and I have to kill it (all the 16 cores of a Sandy Bridge Xeon go to 100% for a minute with no result). I have 128GBs of memory installed and 4GB allocated to Xmx, so the memory shouldn't really be a problem here.
@hho seems the build procedure created a broken GratefulDeadConcerts
database, I'm trying to see what's happened.
@retrography you're right. I wasn't able to reproduce the exact your problem, but I fixed a couple of issues in move vertex. Please could you try with 2.1.x branch?
I'm trying to get started with OrientDB, using the "GratefulDeadConcerts" demo database.
I created a class Song and tried to move the song vertices to it:
Even though an Exception is thrown, the first 100 records seem to be moved to the
Song
class? The error message seems to be misleading – if I issue abegin
before themove
the outcome is the same.With 2.0.13 everything works as expected.