Greetings,
Malte
In replicaset mode (when using the Mongo constructor which takes a
list/array) the driver will keep track of the primary/master and send
writes to that node. There is background thread which is responsible
for keeping the state up to date.
> Q2. If the answer to Q1 is "yes, it is automatically decided by the driver",
> what is the lag time and behavior when the master goes down and a new master
> is elected? Will the Java Driver attempt the write to the old location, see
> the error, and query for the new master to retarget or does this require
> programmer interaction?
Yes, and yes, but no retries will be issued on writes; exceptions will
be raised. Your code will need to handle that.
> I am trying to get some usage insight into the details of a geographically
> disperse Mongo replica set via the Java Driver. If there are any other
> interesting details I might be missing (or should know) I'd surely
> appreciate the pointers.
I think you got most of it. If you do slaveOk reads (soon to be
ReadPreference.PreferSecondary) then reads will go to the local
(closest by ping command timing) replica (non-primary).
> Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/mongodb-user/-/ASxucX5upakJ.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to
> mongodb-user...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mongodb-user?hl=en.
>