top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

MongoDB Secondary server shows higher record count that primary

0 votes
336 views

We have a 3 server MongoDB cluster where there is one Primary, one secondary and one hidden. In one of our collections data gets only inserted by the front end APP and cannot be deleted. I am seeing a strange behavior - when I run count query on this collection (from shell) I always see secondary's count 1-2 more than the count on Primary.

Is this possible or is there some mismatch in my configuration?

posted Jul 15, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Have you had an unclean shutdown on some of your nodes? You may be running into SERVER-19472, where an unclean shutdown may cause an incorrect count results using WiredTiger. Note that this is not a bug. The incorrect count was a direct result of an unclean shutdown.

You could try to:

Restart the affected Secondaries as a standalone node (without the --replSet parameter)

Execute db.collection.validate(true) on the affected collections

Restart the node with the --replSet parameter

Check if the count returned is correct once the node rejoins the replica set as a Secondary

answer Sep 28, 2016 by Manikandan J
Similar Questions
0 votes

some same cases data is not important, and replicate them from primary to secondary will waste servers performance. Is there any ways to config?

0 votes

I have implemented sharding for two collections based on a column which is not indexed. Now after checking sh.status(), I can see all the data is saving in primary shard only. Data is not distributing among the other shard servers. What to do?

+1 vote

Can someone please explain the difference between db.serverStatus().metrics.cursor and db.serverStatus().wiredTiger.session with regards to open cursor count and open session count.?

I am seeing different values in these fields (specifically a high and increasing value for WiredTiger) and I want to be sure that I have been releasing cursors where necessary. I cannot see much information in the docs for WiredTiger.

...