[ 
https://issues.apache.org/jira/browse/OAK-3554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14982198#comment-14982198
 ] 

Ian Boston commented on OAK-3554:
---------------------------------

[~chetanm] as discussed offline.
While putting w=2 onto the query that updates the root commit should ensure 
that the data is replicated to sufficient secondaries to avoid data loss in the 
event of a primary election, you may still need w=1 to ensure that the data 
from previous queries is written to the journal and hence present in the oplog 
before the w=2 command hits. If you use w=0 or default, there is probably a 
risk that the data from previous queries wont have reached the oplog. I am 
basing that on a) experiments performed by others showing that MongoDB with w=0 
and w=1 looses data in a replica set and b) and assumption that MongoDB is not 
completely single threaded.

Also, the current advice is not to use a MK based datastore (performance & 
resilience) for production. In which case the performance impact of w=2 is 
considerably less, as the volume of traffic passing via the oplog is also 
considerably less. You may find that the difference between a global w=2 and a 
specific w=2 is negligible, as the oplog is sequential, and with any w=2 
command, they will block until all the data is transferred to a secondary. If 
you think there is going to be benefit, it would be worth proving that under 
real load in a real cluster with more than 1 AEM instance connected to a 3 way 
replica set.

> Use write concern of w:majority when connected to a replica set
> ---------------------------------------------------------------
>
>                 Key: OAK-3554
>                 URL: https://issues.apache.org/jira/browse/OAK-3554
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: mongomk
>            Reporter: Chetan Mehrotra
>             Fix For: 1.3.10
>
>
> Currently while connecting to Mongo MongoDocumentStore relies on default 
> write concern provided as part of mongouri. 
> Recently some issues were seen where Mongo based Oak was connecting to 3 
> member replica set and there were frequent replica state changes due to use 
> of VM for Mongo. This caused data loss and corruption of data in Oak.
> To avoid such situation Oak should default to write concern of majority by 
> default. If some write concern is specified as part of mongouri then that 
> should take precedence. This would allow system admin to take the call of 
> tweaking write concern if required and at same time allows Oak to use the 
> safe write concern.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to