orientdb icon indicating copy to clipboard operation
orientdb copied to clipboard

[1.7.9] The field 'ORestricted._allowRead' has been declared as LINKSET but contains a null record (

Open giastfader opened this issue 12 years ago • 3 comments

Hi guys, I think I found a problem with the ORestricted class management that leads to a DB inconsistence. TLTR; when a role is deleted its references into the _allow* fields are not removed too. This happens via SQL statements AND via OSecurity.dropRole() API

I think that at least using the Java API, the db engine has to ensure the db integrity for these kind of operations.

Steps to reproduce the problem:

create class testorole extends orestricted
Class created successfully. Total classes in database now: 24

insert into orole set name = 'developer', mode = 0
Inserted record 'ORole#4:15{name:developer,mode:0} v11' in 0.006000 sec(s).

insert into testorole (name,_allowRead) values ("test",[#4:15])
Inserted record 'testorole#24:0{name:test,_allowRead:[1],_allow:[1]} v1' in 0.004000 sec(s).

select expand(_allowRead) from testorole  
----+-----+---------+----
#   |@RID |name     |mode
----+-----+---------+----
0   |#4:15|developer|0   
----+-----+---------+----

1 item(s) found. Query executed in 0.002 sec(s).

delete from ORole where name = 'developer'
Delete record(s) '1' in 0.004000 sec(s).

select from testorole                   
----+-----+----+----------+------
#   |@RID |name|_allowRead|_allow
----+-----+----+----------+------
0   |#24:0|test|[1]       |[1]   
----+-----+----+----------+------

update testorole add _allowRead = #4:0
Error: com.orientechnologies.orient.core.exception.OCommandExecutionException: Error on execution of command: sql.select from testorole
Error: com.orientechnologies.orient.core.exception.OValidationException: The field 'ORestricted._allowRead' has been declared as LINKSET but contains a null record (probably a deleted record?)

giastfader avatar Nov 16 '14 19:11 giastfader

Is this still valid with 2.0-SNAPSHOT?

lvca avatar Jan 08 '15 18:01 lvca

Checked in 2.0.7 and it works.

giastfader avatar Apr 20 '15 06:04 giastfader

@giastfader @lvca How did you fix this issue?

I deleted a user from Baasbox using your suggestions from googlegroups:

delete vertex _BB_NodeVertex where _node.user.name='xyz';
delete from _bb_node where user.name='xyz';
delete from ORole where name = 'friends_of_xyz'; 
delete from OUser where name='xyz';

Getting the same error now when I try to enable Push Notifications for a user:

2018-11-02 05:00:12,613 - [debug] - application: play-akka.actor.default-dispatcher-7  Command to execute: sql.select from _BB_UserAttributes where login_info contains (pushToken = 'eIt4huiWD1Y:APA91bFbETgVX4m1CAcu78Vjnx7UxZMf8PjWQQV8TDSbOUZL17eV8oW_LlCqGPVVuzjYBFfncGcBt1YbXWOHTIeK7PFCo0frb2lpCshkRxOop3bYhuWS8aWiZPCn8muzazFPmPYG4FX5') AND login_info contains (os = 'ios') 
2018-11-02 05:00:12,638 - [debug] - application: play-akka.actor.default-dispatcher-7  closing connection 
2018-11-02 05:00:12,641 - [debug] - application: play-akka.actor.default-dispatcher-7  ConnectToDB: an expected error has been detected: com.orientechnologies.orient.core.exception.OValidationException: The field 'ORestricted._allow' has been declared as LINKSET but contains a null record (probably a deleted record?)

Appreciate your quick response! Orientdb version is 1.7.10.

kishykumar avatar Nov 02 '18 12:11 kishykumar