1.6.1: automatic index lookup fails
Hi! I have an erratic problem with my databases. It seems that after a while we use them, the problem described below, happens apparently without a reason. Scenario:
- OrientDB 1.6.1 embedded
- engine: plocal We have an abstract class named _BB_Node that has an "id" String property. _BB_Node extends ORestricted On this property we have defined an automatic index:
Class................: _BB_Node
Super class..........: ORestricted
Default cluster......: _bb_node (id=12)
Supported cluster ids: [12]Base classes.........: _BB_User, beverages, _BB_Asset, _BB_Collection, products, orders
Properties:
-------------------------------+-------------+-------------------------------+-----------+----------+----------+-----------+-----------+
NAME | TYPE | LINKED TYPE/CLASS | MANDATORY | READONLY | NOT NULL | MIN | MAX |
-------------------------------+-------------+-------------------------------+-----------+----------+----------+-----------+-----------+
id | STRING | null | false | false | false | | |
_links | LINK | _BB_NodeVertex | true | false | true | | |
_creation_date | DATETIME | null | true | false | true | | |
_allowDelete | LINKSET | OIdentity | false | false | false | | |
_allowUpdate | LINKSET | OIdentity | false | false | false | | |
_allowRead | LINKSET | OIdentity | false | false | false | | |
_allow | LINKSET | OIdentity | false | false | false | | |
-------------------------------+-------------+-------------------------------+-----------+----------+----------+-----------+-----------+
Indexes (1 altogether):
-------------------------------+----------------+
NAME | PROPERTIES |
-------------------------------+----------------+
_BB_Node.id | id |
-------------------------------+----------------+
Now if I execute a query like this:
orientdb> select id from _BB_Node where id is not null
----+------+------------------------------------
# |@RID |id
----+------+------------------------------------
0 |#-2:1 |35288a58-0b1b-427c-bcf5-e1c43949fba0
1 |#-2:2 |d81f84d9-2ae9-4985-a03f-a056f66e1078
2 |#-2:3 |dddf5bcd-cd91-4865-91ad-7ebeb1c05042
3 |#-2:4 |9d2d54b4-48fc-4f86-8f1f-a0b5a9cb06db
4 |#-2:5 |32dcc20d-3238-4929-823f-7ec29d11347a
5 |#-2:6 |00064639-1aff-4af6-8db2-6b022384e980
6 |#-2:7 |c2be5127-a944-4d13-9f2d-1f92f1a7e5c5
7 |#-2:8 |93988f95-8b45-41dd-b5e3-457b293aee09
8 |#-2:9 |26b6f555-500b-4e59-8703-7b1b577b76ad
9 |#-2:10|3e20a5e2-dad2-4820-ad92-b32e96c9287d
10 |#-2:11|4acf2ea2-8e94-4e88-9c2f-172e869de4fd
11 |#-2:12|e95bdf34-86ec-4b0e-bdc3-e065c3b77769
12 |#-2:13|e74e86f6-e2ab-4105-b4cc-d260569efc80
13 |#-2:14|947519cd-650e-4846-8092-e610a045eed3
14 |#-2:15|18ed7f1e-9441-4d78-adf4-b4fa4ed763a1
15 |#-2:16|a2e3647c-bbba-4170-bf80-667cbc88b7b3
16 |#-2:17|e90099a6-6538-42de-96d3-781395a396c5
17 |#-2:18|2e7c99dd-8d44-4205-af62-7742b2d9eb02
18 |#-2:19|de41be26-af1b-4c86-a16c-22c2007287cb
19 |#-2:20|c2b280ba-727b-4306-89e1-bd8ce8638494
20 |#-2:21|e6908c63-e998-407e-bd4e-0c91951741af
21 |#-2:22|c18b1173-bb8b-4507-b5dc-dc5af84590a9
22 |#-2:23|7be54da2-3dce-4cfd-ac3e-5b86c59b81fa
23 |#-2:24|353dcc09-71f5-401a-8866-bc794c24d3bc
24 |#-2:25|567a7e9f-c871-4536-aaf1-22f39116626c
25 |#-2:26|ba7b4476-b335-47b3-b102-3d45b405967d
26 |#-2:27|5ac34757-3397-4705-aec9-1968017a2455
27 |#-2:28|efdf9061-c3e7-4e32-9704-9ae2cdf5716d
28 |#-2:29|e97a1882-48af-4790-8660-2f2b0298b9d8
29 |#-2:30|830902ef-008d-43b1-993a-df85b2be5059
30 |#-2:31|257f26cd-0a87-4f1a-a476-9918c01c8e63
31 |#-2:32|c2033b36-43b5-4bc2-89b0-8701e61e802a
32 |#-2:33|70500b12-93e9-439f-b713-f97eff3cec91
33 |#-2:34|2673a401-9179-44f5-987f-dd3a2f3d6765
34 |#-2:35|d1e676f0-8b7f-4bd5-8e39-fd04aee23c50
35 |#-2:36|fea1fded-e3b5-407a-8760-663f95b5db38
36 |#-2:37|c28c18b2-29f8-43b8-85ce-17e29d88322b
37 |#-2:38|27d205eb-d449-4b30-a916-d28bd2ea0a69
38 |#-2:39|3c128089-c82c-4b5a-be78-99e5f4f6d94b
39 |#-2:40|848b99e2-d71e-4542-8530-5d0558737f41
----+------+------------------------------------
40 item(s) found. Query executed in 0.109 sec(s).
I found 40 records, but the index contains only 21 items:
orientdb> info
CLASSES:
----------------------------------------------+------------------------------------+------------+----------------+
NAME | SUPERCLASS | CLUSTERS | RECORDS |
----------------------------------------------+------------------------------------+------------+----------------+
...
_BB_Node | ORestricted | 12 | 1055 |
...
INDEXES:
----------------------------------------------+------------+-----------------------+----------------+------------+
NAME | TYPE | CLASS | FIELDS | RECORDS |
----------------------------------------------+------------+-----------------------+----------------+------------+
...
_BB_Node.id | UNIQUE | _BB_Node | id | 21 |
As mather of fact if I query the class for a specific id, I have no records:
orientdb> select from _BB_Node where id = '848b99e2-d71e-4542-8530-5d0558737f41'
0 item(s) found. Query executed in 0.0010 sec(s).
Nothing happens if I rebuild the index
orientdb> rebuild index _BB_Node.id
Rebuilding index(es)...
Rebuilt index(es). Found 20 link(s) in 0,279000 sec(s).
Index(es) rebuilt successfully
Please note that the rebuild procedure finds only 20 records. However we have 40 records with an id, and more then 1000 records with the id set to null (that it is actually correct for our use case)
I can give you both our databases for further investigation, if they can help you
Thanks
Sure, Could you send it to me ?
On Thu, Dec 5, 2013 at 7:44 PM, giastfader [email protected] wrote:
Hi! I have an erratic problem with my databases. It seems that after a while we use them, the problem described below, happens apparently without a reason. Scenario:
- OrientDB 1.6.1 embedded
- engine: plocal We have an abstract class named _BB_Node that has an "id" String property. _BB_Node extends ORestricted On this property we have defined an automatic index:
Class................: _BB_Node Super class..........: ORestricted Default cluster......: _bb_node (id=12) Supported cluster ids: [12]Base classes.........: _BB_User, beverages, _BB_Asset, _BB_Collection, products, orders
Properties: -------------------------------+-------------+-------------------------------+-----------+----------+----------+-----------+-----------+ NAME | TYPE | LINKED TYPE/CLASS | MANDATORY | READONLY | NOT NULL | MIN | MAX | -------------------------------+-------------+-------------------------------+-----------+----------+----------+-----------+-----------+ id | STRING | null | false | false | false | | | _links | LINK | _BB_NodeVertex | true | false | true | | | _creation_date | DATETIME | null | true | false | true | | | _allowDelete | LINKSET | OIdentity | false | false | false | | | _allowUpdate | LINKSET | OIdentity | false | false | false | | | _allowRead | LINKSET | OIdentity | false | false | false | | | _allow | LINKSET | OIdentity | false | false | false | | | -------------------------------+-------------+-------------------------------+-----------+----------+----------+-----------+-----------+ Indexes (1 altogether): -------------------------------+----------------+ NAME | PROPERTIES | -------------------------------+----------------+ _BB_Node.id | id | -------------------------------+----------------+
Now if I execute a query like this:
orientdb> select id from _BB_Node where id is not null ----+------+------------------------------------
|@RID |id
----+------+------------------------------------ 0 |#-2:1 |35288a58-0b1b-427c-bcf5-e1c43949fba0 1 |#-2:2 |d81f84d9-2ae9-4985-a03f-a056f66e1078 2 |#-2:3 |dddf5bcd-cd91-4865-91ad-7ebeb1c05042 3 |#-2:4 |9d2d54b4-48fc-4f86-8f1f-a0b5a9cb06db 4 |#-2:5 |32dcc20d-3238-4929-823f-7ec29d11347a 5 |#-2:6 |00064639-1aff-4af6-8db2-6b022384e980 6 |#-2:7 |c2be5127-a944-4d13-9f2d-1f92f1a7e5c5 7 |#-2:8 |93988f95-8b45-41dd-b5e3-457b293aee09 8 |#-2:9 |26b6f555-500b-4e59-8703-7b1b577b76ad 9 |#-2:10|3e20a5e2-dad2-4820-ad92-b32e96c9287d 10 |#-2:11|4acf2ea2-8e94-4e88-9c2f-172e869de4fd 11 |#-2:12|e95bdf34-86ec-4b0e-bdc3-e065c3b77769 12 |#-2:13|e74e86f6-e2ab-4105-b4cc-d260569efc80 13 |#-2:14|947519cd-650e-4846-8092-e610a045eed3 14 |#-2:15|18ed7f1e-9441-4d78-adf4-b4fa4ed763a1 15 |#-2:16|a2e3647c-bbba-4170-bf80-667cbc88b7b3 16 |#-2:17|e90099a6-6538-42de-96d3-781395a396c5 17 |#-2:18|2e7c99dd-8d44-4205-af62-7742b2d9eb02 18 |#-2:19|de41be26-af1b-4c86-a16c-22c2007287cb 19 |#-2:20|c2b280ba-727b-4306-89e1-bd8ce8638494 20 |#-2:21|e6908c63-e998-407e-bd4e-0c91951741af 21 |#-2:22|c18b1173-bb8b-4507-b5dc-dc5af84590a9 22 |#-2:23|7be54da2-3dce-4cfd-ac3e-5b86c59b81fa 23 |#-2:24|353dcc09-71f5-401a-8866-bc794c24d3bc 24 |#-2:25|567a7e9f-c871-4536-aaf1-22f39116626c 25 |#-2:26|ba7b4476-b335-47b3-b102-3d45b405967d 26 |#-2:27|5ac34757-3397-4705-aec9-1968017a2455 27 |#-2:28|efdf9061-c3e7-4e32-9704-9ae2cdf5716d 28 |#-2:29|e97a1882-48af-4790-8660-2f2b0298b9d8 29 |#-2:30|830902ef-008d-43b1-993a-df85b2be5059 30 |#-2:31|257f26cd-0a87-4f1a-a476-9918c01c8e63 31 |#-2:32|c2033b36-43b5-4bc2-89b0-8701e61e802a 32 |#-2:33|70500b12-93e9-439f-b713-f97eff3cec91 33 |#-2:34|2673a401-9179-44f5-987f-dd3a2f3d6765 34 |#-2:35|d1e676f0-8b7f-4bd5-8e39-fd04aee23c50 35 |#-2:36|fea1fded-e3b5-407a-8760-663f95b5db38 36 |#-2:37|c28c18b2-29f8-43b8-85ce-17e29d88322b 37 |#-2:38|27d205eb-d449-4b30-a916-d28bd2ea0a69 38 |#-2:39|3c128089-c82c-4b5a-be78-99e5f4f6d94b 39 |#-2:40|848b99e2-d71e-4542-8530-5d0558737f41 ----+------+------------------------------------ 40 item(s) found. Query executed in 0.109 sec(s).
I found 40 records, but the index contains only 21 items:
orientdb> info CLASSES: ----------------------------------------------+------------------------------------+------------+----------------+ NAME | SUPERCLASS | CLUSTERS | RECORDS | ----------------------------------------------+------------------------------------+------------+----------------+ ... _BB_Node | ORestricted | 12 | 1055 | ... INDEXES: ----------------------------------------------+------------+-----------------------+----------------+------------+ NAME | TYPE | CLASS | FIELDS | RECORDS | ----------------------------------------------+------------+-----------------------+----------------+------------+ ... _BB_Node.id | UNIQUE | _BB_Node | id | 21 |
As mather of fact if I query the class for a specific id, I have no records:
orientdb> select from _BB_Node where id = '848b99e2-d71e-4542-8530-5d0558737f41' 0 item(s) found. Query executed in 0.0010 sec(s).
Nothing happens if I rebuild the index
orientdb> rebuild index _BB_Node.id Rebuilding index(es)... Rebuilt index(es). Found 20 link(s) in 0,279000 sec(s). Index(es) rebuilt successfully
Please note that the rebuild procedure finds only 20 records. However we have 40 records with an id, and more then 1000 records with the id set to null (that it is actually correct for our use case)
I can give you both our databases for further investigation, if they can help you
Thanks
— Reply to this email directly or view it on GitHubhttps://github.com/orientechnologies/orientdb/issues/1872 .
Best regards, Andrey Lomakin.
Orient Technologies the Company behind OrientDB
Sent, Thanks!
Hi @laa any news on this one? Thx
sorry we delayed it a bit, I think we will start it again during two days.
ok, thx
Problem of you issue is that some clusters are present in inherited classes were not included in index just drop index and create it. And it will work. I will provide fix for schema management to prevent it happen again.
Your issue is the same as https://github.com/orientechnologies/orientdb/issues/1819 )) I provided your fix description above and issue is fixed in 1.6.2 :-)