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

2.1 develop - Incorrect number of edges returned #4641

Closed
guglielmomoretti opened this issue Jul 24, 2015 · 9 comments
Closed

2.1 develop - Incorrect number of edges returned #4641

guglielmomoretti opened this issue Jul 24, 2015 · 9 comments

Comments

@guglielmomoretti
Copy link

Good morning,

I'm using the develop branch of 2.1 compiled two days ago.

image

As you can see from the last query in the picture select from CardCode where code = 8330000

The out('CurrentProfile') shows more than one edge.

Actually there is only one (as it should really be as per my code).
In fact, this is shown in the first query of the screenshot.

This is confirmed by the second query. If I try to select the #72:0 RID as listed on the first query, the result is empty.

Due to this, if I try to iterate over the out('CurrentProfile'), the output log shows this:
image

Hope this helps

Regards

Guglielmo

@luigidellaquila
Copy link
Member

Hi Guglielmo,
two quick questions:

  1. how did you create these edges? did you use a transaction for it?
  2. did you manually delete edge records, eg. using UNSAFE?

@guglielmomoretti
Copy link
Author

Hi Luigi,

  1. I use the java API either for inserting and for deleting edges. And yes, I use transactions.
  2. No, I don't delete any EDGE manually and/or using unsafe. I discovered this behaviour while reading the output of my software.

Thanks

@guglielmomoretti
Copy link
Author

Sorry Luigi,

I have a script that I use for development purposes for truncating all classes, that uses the UNSAFE keyword. The keyword has been added because the script was no more working with 2.1. I used this script with older version of OrientDB without any problems (but without the UNSAFE keywor).

The script is the following:

js var result = db.query('select name from (select expand(classes) from metadata:schema) where name.charAt(0) <> "O"'); 
for (var i = 0; i < result.length; i++) { 
var className = result[i].getRecord().field('name'); 
db.command('truncate class ' + className + ' UNSAFE');
}; 
result.length + ' classes truncated'; 

Would you like me to try again starting from a plain db?

Regards

Guglielmo

@luigidellaquila
Copy link
Member

Hi Guglielmo,
it must be something like that.
When you use Graph API, like DELETE EDGE, the consistency is guaranteed between edge and vertex records.
If you use UNSAFE, raw records are deleted, so you can have dirty data around.
In this case, the structure that contains pointers to edges in the vertex (it's called a RidBag) still contains references to edges that do not exist anymore (maybe they were truncated or deleted with UNSAFE).
It's not a big problem while traversing or using Graph API in general, because OrientDB just ignores hanging references, but for sure you have a dirty db.

I think I can close this issue. If it happened for other reasons and you think it's actually a bug, please reopen

Thanks

@guglielmomoretti
Copy link
Author

@luigidellaquila

I recreted the database from scratch and yes, now it's working as expected.

Unsafe is really UNSAFE ;)

Thanks (and sorry) for your time

Regards

@guglielmomoretti
Copy link
Author

@luigidellaquila

I'm sorry but the issue still persists. I've recreated the database manually.

The message now is different from the past:

(pool-4191-thread-1) Record (#59:3) is null
(pool-4191-thread-1) Record (#59:13) is null
(pool-4191-thread-1) Record (#59:57) is null
(pool-4191-thread-1) Record (#59:72) is null
(pool-4191-thread-1) Record (#59:86) is null
(pool-4191-thread-1) Record (#59:93) is null
(pool-4191-thread-1) Record (#59:100) is null
(pool-4191-thread-1) Record (#59:119) is null
(pool-4191-thread-1) Record (#59:159) is null
(pool-4191-thread-1) Record (#59:178) is null
(pool-4191-thread-1) Record (#59:193) is null
(pool-4191-thread-1) Record (#59:207) is null
(pool-4191-thread-1) Record (#59:213) is null
(pool-4191-thread-1) Record (#59:221) is null
(pool-4191-thread-1) Record (#59:229) is null

This time I've never used UNSAFE.

The behaviour is the same as the image posted before.

In addition, if I try to run

select out('CurrentProfile') from cardCode where code = 8330000

I get an error message stating "java.lang.NullPointerException"

Also, if I run

select out_CurrentProfile from cardCode where code = 8330000

I get an error message stating "java.lang.NullPointerException: Impossible to add a null identifiable in a ridbag"

Can you reopen the issue? I can't

Regards

Guglielmo

@luigidellaquila
Copy link
Member

Hi Guglielmo,

Ok, reopening. Can you share the procedure you use to create the db, or a test case to reproduce the problem?

@guglielmomoretti
Copy link
Author

ok,

I'll try to recreate a test case for you, i'll need time. I'll be back as soon as i get a valid test case

Regards

@luigidellaquila
Copy link
Member

Thanks a lot!!

2015-07-24 13:42 GMT+02:00 Guglielmo Moretti notifications@github.com:

ok,

I'll try to recreate a test case for you, i'll need time. I'll be back as
soon as i get a valid test case

Regards


Reply to this email directly or view it on GitHub
#4641 (comment)
.

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

3 participants