Hey,

Thanks for the ideas.
Both 
readOnlyGraphDb.getConfig().getGraphDbModule().getNodeManager().clearCache()
and cache_type=none worked.

But I've run into some issues down the road.

To test i've taken the same db folder with some nodes, properties and
relations and created a read-only embedded db with it; later the same
folder for "standard" embedded db.

When opening the db as read-only:
1) node.getRelationships() is empty for all nodes whereas it is not
the case in the "standard" mode
2) node.getPropertyKeys() sometimes throws
org.neo4j.kernel.impl.nioneo.store.InvalidRecordException:
Position[63] requested for operation is high id[24], store is ok[true]
        
org.neo4j.kernel.impl.nioneo.store.CommonAbstractStore.acquireWindow(CommonAbstractStore.java:521)
        
org.neo4j.kernel.impl.nioneo.store.AbstractDynamicStore.getLightRecords(AbstractDynamicStore.java:425)
        
org.neo4j.kernel.impl.nioneo.store.PropertyIndexStore.getRecord(PropertyIndexStore.java:196)
        
org.neo4j.kernel.impl.nioneo.xa.ReadTransaction.getPropertyIndex(ReadTransaction.java:201)
        
org.neo4j.kernel.impl.nioneo.xa.NioNeoDbPersistenceSource$ReadOnlyResourceConnection.loadIndex(NioNeoDbPersistenceSource.java:206)
        
org.neo4j.kernel.impl.persistence.PersistenceManager.loadIndex(PersistenceManager.java:84)
        
org.neo4j.kernel.impl.core.PropertyIndexManager.getIndexFor(PropertyIndexManager.java:141)
        org.neo4j.kernel.impl.core.NodeManager.getIndexFor(NodeManager.java:765)
        org.neo4j.kernel.impl.core.Primitive.getPropertyKeys(Primitive.java:117)
        org.neo4j.kernel.impl.core.NodeProxy.getPropertyKeys(NodeProxy.java:129)
        
which works  fine in the  "standard" mode.

I wonder am I doing something wrong or are these issues known?

Alfredas

On Wed, Apr 6, 2011 at 9:18 AM, Mattias Persson
<matt...@neotechnology.com> wrote:
> A "refresh", i.e. clearing of caches can be performed by (API may change):
>
>
> readOnlyGraphDb.getConfig().getGraphDbModule().getNodeManager().clearCache();
>
> and you could maybe keep the default cache_type setting. That should do what
> you're asking for.
>
> 2011/4/5 David Montag <david.mon...@neotechnology.com>
>
>> Alfredas,
>>
>> A solution based on EmbeddedReadOnlyGraphDatabase would not be able to
>> benefit from caching, as each "refresh" of the view would have to clear the
>> caches. You could possibly achieve the solution you want by setting the
>> config parameter cache_type=none for the read-only instance. Then it should
>> not cache anything and always read from disk or OS cache. This would
>> however
>> yield degraded performance if you repeatedly read the same data.
>>
>> If your processing could benefit from caching, then you're better off
>> creating a new instance, or manually clearing the caches. Or going with the
>> HA-based solution that Jim and Mattias outlined.
>>
>> David
>>
>> On Tue, Apr 5, 2011 at 9:36 AM, Alfredas Chmieliauskas
>> <al.fre...@gmail.com>wrote:
>>
>> > Yes. The read only client would query the db at time intervals.
>> >
>> > Alfredas
>> >
>> > On Tue, Apr 5, 2011 at 5:40 PM, David Montag
>> > <david.mon...@neotechnology.com> wrote:
>> > > Alfredas,
>> > > When you say watch, do you mean "poll" the graph at some interval? What
>> > > would the read-only client do?
>> > > Thanks,
>> > > David
>> > >
>> > > On Tue, Apr 5, 2011 at 5:26 AM, Alfredas Chmieliauskas <
>> > al.fre...@gmail.com>
>> > > wrote:
>> > >>
>> > >> Dear all,
>> > >>
>> > >> we have the following situation:
>> > >> - 1 client is writing to the embedded db (writer)
>> > >> - 1 client would like to watch that (read-only)
>> > >>
>> > >> is that possible with the EmbeddedReadOnlyGraphDatabase?
>> > >> Currently it seems that the read-only db does not see the updates from
>> > >> the writer since its creation. It there a way to force refresh besides
>> > >> creating a new instance?
>> > >>
>> > >> Also are there any other/better ways to do that (1 writer, 1 reader)
>> > >> without going into the server mode?
>> > >>
>> > >> Thanks a lot,
>> > >>
>> > >> Alfredas
>> > >> _______________________________________________
>> > >> Neo4j mailing list
>> > >> User@lists.neo4j.org
>> > >> https://lists.neo4j.org/mailman/listinfo/user
>> > >
>> > >
>> > >
>> > > --
>> > > David Montag <david.mon...@neotechnology.com>
>> > > Neo Technology, www.neotechnology.com
>> > > Cell: 650.556.4411
>> > > Skype: ddmontag
>> > >
>> >
>>
>>
>>
>> --
>> David Montag <david.mon...@neotechnology.com>
>> Neo Technology, www.neotechnology.com
>> Cell: 650.556.4411
>> Skype: ddmontag
>> _______________________________________________
>> Neo4j mailing list
>> User@lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>>
>
>
>
> --
> Mattias Persson, [matt...@neotechnology.com]
> Hacker, Neo Technology
> www.neotechnology.com
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to