You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by da...@butterdev.com on 2015/12/03 16:03:35 UTC

Safe read after write

I am using Oak with a DocumentNodeStore.  I am storing content then 
adding a message onto a queue.  The consumer of the message uses and id 
to retrieve the content.  I am seeing frequent failures in the consumer 
(node not available/does not exist).  If I add a Thread.sleep after I 
store the node I do not see these failures.  My initial thought was this 
was related to the default Mongo WriteConcern of Acnknowledged, so I 
changed my code:

     public Repository getRepository() throws ClassNotFoundException, 
RepositoryException {
         DB db = new MongoClient(mongoHost, 
mongoPort).getDB(mongoOakDbName);
         db.setWriteConcern(WriteConcern.JOURNALED); // I also tried 
using FSYNC
         DocumentNodeStore ns = new 
DocumentMK.Builder().setMongoDB(db).getNodeStore();
         return new Jcr(new Oak(ns)).createRepository();
     }

but I still see the problem.  Am I missing something?

Thanks

Re: Safe read after write

Posted by Chetan Mehrotra <ch...@gmail.com>.
Does the above setup involves multiple Oak instances (say in separate
JVM) or message producer and consumer of queue are use same Oak
instance?


Chetan Mehrotra


On Thu, Dec 3, 2015 at 8:33 PM,  <da...@butterdev.com> wrote:
> I am using Oak with a DocumentNodeStore.  I am storing content then adding a
> message onto a queue.  The consumer of the message uses and id to retrieve
> the content.  I am seeing frequent failures in the consumer (node not
> available/does not exist).  If I add a Thread.sleep after I store the node I
> do not see these failures.  My initial thought was this was related to the
> default Mongo WriteConcern of Acnknowledged, so I changed my code:
>
>     public Repository getRepository() throws ClassNotFoundException,
> RepositoryException {
>         DB db = new MongoClient(mongoHost, mongoPort).getDB(mongoOakDbName);
>         db.setWriteConcern(WriteConcern.JOURNALED); // I also tried using
> FSYNC
>         DocumentNodeStore ns = new
> DocumentMK.Builder().setMongoDB(db).getNodeStore();
>         return new Jcr(new Oak(ns)).createRepository();
>     }
>
> but I still see the problem.  Am I missing something?
>
> Thanks