Can someone please test and confirm that using fetchplan does not place any 
additional records into a local cache (with transacational database in 
remote mode).

You can test for record presence in a local cache like this:
graph.getRawGraph().getLocalCache().findRecord(new ORecordId("#11:0"));



Dne středa 23. září 2015 23:52:13 UTC+2 Jan Plaček napsal(a):
>
> Consider tree like graph represented by "Node" verticies and "childOf" 
> edges (oriented from child to parent) and command:
>
> Iterable<OrientVertex> roots = (Iterable<OrientVertex>) graph.command(new 
> OCommandSQL("select from Node where key = 'root'  fetchplan in_childOf:-1"
> )).execute();
>
>
> Now when I traverse the tree by Vertex.getVerticies(Direction.IN, 
> "childOf")/ODocument.field("in_childOf") I expect there won't be any 
> further remote lookup calls, because verticies have been already fetched by 
> fetch plan.
> But is it really the case?
>
> I was trying to find out how accessing related records (edges) works:
>
> The edges are represented as ORidBag:
> ORidBag ridBag = (ORidBag) root.getRecord().field("in_childOf");
>
> The ORidBag is a collection of OIdentifiable implemented by ORecordId:
> ORecordId rid = (ORecordId) ridBag.iterator().next();
>
> Now I can access the record (implemented by ODocument) representing the 
> edge:
> ODocument inChild = (ODocument) rid.getRecord();
>
> The implementation of ORecordId.getRecord() is quite simple. It basically 
> delegates the record retrieval to current ODatabaseDocument implemented by 
> ODatabaseDocumentTx:
> return (T) db.load(this);
>
> There the things are getting complicated, but if I summarize my foundings, 
> the record is either taken from local cache or requested to be fetched by 
> OStorageRemote.
>
> As you can see I was able to find out only one place where the related 
> record is not requested from the storage again and that is obtaining a 
> record from local cache by ODatabaseDocumentTx.
> However I checked that the related records are not present in local cache 
> after the command is executed, so local cache also isn't responsible for 
> accessing eagerly fetched records.
>
> So am I really working with fetched records or are they fetched again when 
> traversing graph with Document/Graph API in remote mode?
> If yes, which component (ODocument/ORidBag/ODatabase/OStorage) is 
> responsible for obtaining a record which is possibly loaded eagerly via 
> fetch plan? 
> And is there a way to tell if the related record (represented for example 
> by ORecordId) is already fetched?
>
> UPDATE:
> According to some forum posts the eagerly fetched records should be stored 
> in 2nd level client cache, I wonder how do I access that cache?
> UPDATE2:
> Since orientdb 2.0, there is only one local cache, but as I mentioned 
> earlier, it does not contain the verticies/edges after the command is 
> executed (they are present in the cache only after I visit them manually - 
> via traversal methods), is this unexpected behavior?
>
>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to