1

Background:

  • I'm using mongodb 4.2.0
  • I have deployed a mongo cluster which contain 5 configs, 3 querys and 3 - shards. Each shard consist of 4 replicas and 1 arbiter.
  • All members are set on VMs.
  • ReplicaSets writeConcernMajorityJournalDefault flag is true.
  • Test conducted with pymongo

The Test:

Before implementing the cluster on the production environment, I've conducted several "stress tests". I have created a simple script that performs many inserts to the cluster and returns the amount of successful inserts.

When I run and stop the script everything is just fine. The number of inserts_count is identical to the count of documents in the collection.

BUT, When I run the script and then PowerOff the Primary member, I'm facing a hitch. My script's insert_count is bigger (10-20) than the count of documents in my collection. I assume that I'm losing data.

I got successful insert acknowledge even though my replicaSet is set writeConcernMajorityJournalDefault true.

Raising the primary doesn't help to retrieve the lost data.

I think the data was still in memory!

Conclusion:

I believe that there is some malfunction with the journaling setting.

Please help me understand what am I doing wrong.

P.S:

I tried insert with {w: majority, j: true, wtimeout: 5000} parameters.

Same results :/

  • If you can share the code you used, it will help to replicate & confirm what you're seeing. – kevinadi Jan 14 at 4:43
0

How much time your query was running?? and from where you get next count as you mentioned after stopping primary you get this count is lesser?? also If you can share your script.

It will be obvious that If you are stopping the Script the data will not going to be insert as you expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.