Index is not being updated after insert

76 views
Skip to first unread message

Ran Mizrachi

unread,
Aug 10, 2015, 5:19:51 AM8/10/15
to OrientDB
Hi there,

I see that my index is not being updated after insert operations.
The index is a unique hash index and I'm creating it using the following command:

      CREATE INDEX contactId on Contact(id) UNIQUE_HASH_INDEX

I see clearly that after I rebuild the index new results returns in the queries.


Any ideas?

Thanks!


Enrico Risa

unread,
Aug 10, 2015, 5:21:47 AM8/10/15
to orient-...@googlegroups.com
Hi Ran

which version of OrientDB?

--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ran Mizrachi

unread,
Aug 10, 2015, 5:23:48 AM8/10/15
to OrientDB
I'm using the latest version 2.0.13

Enrico Risa

unread,
Aug 10, 2015, 5:25:04 AM8/10/15
to orient-...@googlegroups.com

Do you have some code/step to reproduce the issue?

Ran Mizrachi

unread,
Aug 10, 2015, 7:47:32 AM8/10/15
to OrientDB
It's pretty simple. I create the index using the command below \ using the studio and insert a new record.
when I search for this record using the indexed property value it return empty results. after rebuilding the index, the same query returns the expected results.


On Monday, August 10, 2015 at 12:19:51 PM UTC+3, Ran Mizrachi wrote:

SavioL

unread,
Aug 10, 2015, 11:45:03 AM8/10/15
to orient-...@googlegroups.com
Hi,
if this is the sequence that you used

previous insert
1,2,3...

select from Contact  --> return all vertices with id 1,2 and 3


CREATE INDEX contactId on
Contact(id)
UNIQUE_HASH_INDEX

insert
into Contact (id) values (4)

have you tried to get the last id added, with the query:
SELECT FROM Contact WHERE id = 4
or this:
SELECT FROM INDEX: contactID WHERE key = 4

always
empty results in both cases?


Regards,
Savio L.

Ran Mizrachi

unread,
Aug 10, 2015, 1:53:53 PM8/10/15
to OrientDB
here are the exact repro steps, I created new database and validated the this behaviour reproduce.

I'm creating the db schema using the following script:

CREATE CLASS Contact extends V
CREATE PROPERTY Contact.id STRING
CREATE INDEX Contactid on Contact(id) UNIQUE_HASH_INDEX
ALTER PROPERTY Contact.id NOTNULL true
ALTER PROPERTY Contact.id READONLY true
ALTER PROPERTY Contact.id MANDATORY true

then I insert new Contact vertex using the following command: INSERT INTO Contact SET ID = '555'
The query SELECT * FROM Contact WHERE ID = '555' returns empty 
After I rebuild the index the query return the results.


Any ideas?
Thanks!

 

On Monday, August 10, 2015 at 12:19:51 PM UTC+3, Ran Mizrachi wrote:

SavioL

unread,
Aug 11, 2015, 3:55:47 AM8/11/15
to OrientDB
Hi Ran,
I tried your sql script and it works (at the beginning I had a mistake because in the insert command and select the id field is written upper case, and in the declaration of the id field was written lowercase, never mind this is not the problem :) ..
In your log file (OrientDB folder / log / the last log) there is some error message during any stage of your script, from 'created class ...' to 'select from ...'?


Ran Mizrachi

unread,
Aug 11, 2015, 6:39:03 AM8/11/15
to OrientDB
I just tried the same test on another machine and it worked as expected. 
It makes me think there some environment issue or configuration value that cause this behavior but I couldn't find anything...
There is nothing on the logs either.


Can you think of anything else?


Thanks!




On Monday, August 10, 2015 at 12:19:51 PM UTC+3, Ran Mizrachi wrote:

SavioL

unread,
Aug 11, 2015, 8:09:26 AM8/11/15
to OrientDB
Having experienced the same situation in another machine and having seen that it works is a good road, I think it is a problem only to that database instance on the machine that does not work well .. You might try downloading a new version (also always 2.0.13 or 2.0.14), and test if the issue is resolved .. Of configuration there should be nothing to fix.

If you can try to let me know how it goes :) ...
Reply all
Reply to author
Forward
0 new messages