Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB local.oplog.rs query running for long time

Tags:

mongodb

I have 2 node cluster(8 vCPUs, 52 GB) for mongodb(3.2.0). I was debugging couple of queries that took several seconds, I ran db.currentOp() to see what queries are running and how much time they are taking and I found a query regarding local.oplog.rs that was running for more than 4000 seconds, following is the query in question

         {
            "desc" : "WT RecordStoreThread: local.oplog.rs",
            "threadId" : "139625785952000",
            "active" : true,
            "opid" : "rs0:145981225",
            "secs_running" : 4168,
            "microsecs_running" : NumberLong("4168129663"),
            "op" : "none",
            "ns" : "local.oplog.rs",
            "query" : {

            },
            "numYields" : 0,
            "locks" : {

            },
            "waitingForLock" : false,
            "lockStats" : {
                "Global" : {
                    "acquireCount" : {
                        "r" : NumberLong(1),
                        "w" : NumberLong(1)
                    }
                },
                "Database" : {
                    "acquireCount" : {
                        "w" : NumberLong(1)
                    }
                },
                "oplog" : {
                    "acquireCount" : {
                        "w" : NumberLong(1)
                    }
                }
            }
        },

Could any please shed some light on this? what is this query doing and should I be concerned?

like image 644
ChintanShah25 Avatar asked Oct 10 '16 20:10

ChintanShah25


People also ask

What is local Oplog RS?

local.oplog.rs is the capped collection that holds the oplog. You set its size at creation using the oplogSizeMB setting. To resize the oplog after replica set initiation, use the Change the Size of the Oplog procedure.

What is the risk of having a small Oplog?

Risks with the oplog are related to its being capped: if your oplog is too small, any maintenance operations that require you to take down a replica can cause the copy to fail.


1 Answers

These are threads related to replication. They're part of normal operation.

  • WT RecordStoreThread: local.oplog.rs
  • rsSync
  • rsBackgroundSync
  • ReplBatcher

There's actually an open bug about showing these results by default when they should probably be hidden because they're always long running operations: https://jira.mongodb.org/browse/SERVER-28257

From the bug report:

At present db.currentOp() by default shows replication-related threads such as:

"WT RecordStoreThread: local.oplog.rs"

"rsSync"

"rsBackgroundSync"

"ReplBatcher"

Often these operations are long running and users may get a wrong impression that there is a performance problem.

like image 158
dustin.schultz Avatar answered Sep 20 '22 09:09

dustin.schultz