mongodb write data miss

29 views
Skip to first unread message

卢先宁

unread,
Jul 23, 2014, 3:19:12 AM7/23/14
to mongod...@googlegroups.com
Hi, I am using a mongodb cluster with six mongos, three config, four replication(master/slave/arbiter).
There is about 300 concurrent write query with php drivers which will return the successful insert _id to client.
After inserted 1000w records, I using the returned _ids to check the stored data, discovering about 5/1000 missing.
ps: At the cluster running periods, I killed and restart each rep once.

Is there any reasons to explain the missing data?

software versions:
mongodb 2.6
php driver 1.5

Asya Kamsky

unread,
Jul 24, 2014, 3:43:54 AM7/24/14
to mongodb-user
What write concern are you using and are you checking the success of the write operation?

One thing you have to keep in mind is that the _id is generated by the driver, on the client side - it is NOT generated by the server.
So having the _id does not mean that the data was successfully sent/delivered to the server.

Now, if you are getting back success for the write and you are using writeConcern w:1 (acknowledged) but during the data load you are losing the primary, unless you have used w:2 as write concern (waiting for replication to at least one other node before acknowledgement) you will potentially have some records that would be written to the primary, not replicated and then if you shut down the primary and another node becomes the primary, the original node will have to roll back that write (since it's not on the new primary).   If that's what happened, you will be able to find a "rollback" directory in the data directory which will have the documents that were rolled back.

Asya



--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/a0defae0-8ca2-4441-b4eb-7bdc772519f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages