Bug with local cache?

Skip to first unread message

Johan Sjöberg

Dec 2, 2015, 10:53:34 AM12/2/15
to OrientDB
Consider the following.

A class called "Brand" which contains one vertex:
@rid = #11:0
= "BMW"

A class called "Type" which contains two vertices:

@rid = #10:0
= "SUV"

@rid = #10:1
= "Sedan"

I have two edges of the same edgeclass, TypeToBrand:

@rid = #12:0
out = #10:0
in = #11:0
@rid = #12:1
out = #10:1
in = #11:0

Giving me the following basic graph:
Brand               BMW #11:0
/     \
/       \
/         \
TypeToBrand  #12:0  /                    \ #12:1
                 /             \
/               \
/                 \
Type       SUV #10:0         Sedan #10:1

Now to my problem! Consider the following queries: 

String brandQ = "SELECT expand(out('TypeToBrand')) FROM ( SELECT FROM #10:0 )";
.command(new OSQLSynchQuery(brandQ)).execute();

//        db.getLocalCache().invalidate();

String carsQ = "SELECT expand(in('TypeToBrand')) FROM #11:0;
printResult(db.command(new OSQLSynchQuery(carQ)).execute());

If we ignore how strange the first query is (this is after all a toy example) then the expected result would be both the two Type vertices since we are expanding the TypeToBrand edges from the Brand.
If I run a remote server this is the result I get.
But if I run an embedded server I only get a single type, the SUV type. If I would instead change the first query to #10:1, the second query would return that type.
I can fix this by adding the commented code, by clearing the cache the second query returns two types as as intended. 
Now this is a super strange to me.. My guess is that this is a (pretty severe) bug with the cache somehow, perhaps the expand of TypeToBrand somehow is cached and reused (even if the direction is opposite and a complete different query)?
Or is this an embedded server setting I'm missing? I really don't want to use the invalidate local cache..
Reply all
Reply to author
0 new messages