[SERVER-45426] getIndexes() output different on Primary and Secondary Created: 09/Jan/20  Updated: 07/Apr/23  Resolved: 20/Jul/20

Status: Closed
Project: Core Server
Component/s: Index Maintenance, TTL
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Pratiksha Aggarwal Assignee: Dmitry Agranat
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

Hi,

Created a TTL index on primary instanceof replica set. But the getIndexes() command on primary includes the TTL index while on secondary it does not.

 



 Comments   
Comment by Dmitry Agranat [ 20/Jul/20 ]

Hi pragupta,

We haven’t heard back from you for some time, so I’m going to mark this ticket as resolved. If this is still an issue for you, please provide additional information and we will reopen the ticket.

Regards,
Dima

Comment by Carl Champain (Inactive) [ 15/Jan/20 ]

pragupta,

Sorry for the confusion. We were still unable to recreate the behavior despite the reproduction steps you provided, so we need the output of db.currentOp() to determine wether or not the index is still being built on the secondary (as a sanity check). You previously mentioned that the logs don't cover this kind of operations, but they are now the only way for us to investigate this issue. In order to move forward, we would need you to reproduce the problem with the logging enabled, do you think it's possible?

Comment by Pratiksha Aggarwal [ 15/Jan/20 ]
  1. Checked and the output is still same as shared previously.
  2. How can we expect that after days the output will differ or get in sync for index? Eventually the oplog will get rotate after days and especially in case of high workload. From where do we expect the secondary to get information about the extra TTL index of primary and replicate it? 
Comment by Carl Champain (Inactive) [ 14/Jan/20 ]

pragupta,

Thank you for the additional details.
To have a better understanding of this issue, we would need more information. Can you please:

  1. Run getIndexes() again to check wether or not the output  for the secondary has changed —since your workload is very heavy, it could take time for some operations to complete.
  2. Run db.currentOp() on the primary and secondary nodes and share the output with us.
Comment by Pratiksha Aggarwal [ 13/Jan/20 ]

Please use the below steps for reproducing:

  • Take a replica set with PRimary and two secondaries
  • A read heavy collection with around 50crore records
  • Create TTL index on the primary node. The index build takes around 4-5 hours.
  • After that compare the getIndexes() of master and slave.

Regarding logs, we have customized to log only network , connection and slow queries related data. Hence, we do not have the logs for this.

 

Comment by Carl Champain (Inactive) [ 10/Jan/20 ]

pragupta,

Thank you for sharing the information. However, we were still not able to recreate the described behavior on 4.0.3. Can you please:

  1. Provide the full steps to reproduce the behavior.
  2. Provide the mongod.log file for the primary and secondary nodes covering the TTL index build operation (we do need them to investigate your issue).
Comment by Pratiksha Aggarwal [ 10/Jan/20 ]

Also, we are not logging the relevant logs.

Comment by Pratiksha Aggarwal [ 10/Jan/20 ]

MongoDB Version - 4.0.3

Please find getIndexes() ouput below:

 

Secondary Indexes

 

 
[
 
{
 
"v" : 2,
 
"unique" : true,
 
"key" :
 
{ "x" : 1, "y" : 1, "cust_id" : 1 }
 
,
 
"name" : "x_1_y_1_cust_id_1",
 
"ns" : "test.user"
 
},
 
{
 
"v" : 2,
 
"key" :
 
{ "cust_id" : 1, "updated_at" : -1 }
 
,
 
"name" : "cust_id_1_updated_at_-1",
 
"ns" : "test.user"
 
},
 
{
 
"v" : 2,
 
"key" :
 
{ "z" : 1 }
 
,
 
"name" : "z_1",
 
"ns" : "test.user"
 
},
 
{
 
"v" : 2,
 
"key" :
 
{ "created_at" : 1 }
 
,
 
"name" : "created_at_1",
 
"ns" : "test.user"
 
},
 
{
 
"v" : 2,
 
"key" :
 
{ "_id" : 1 }
 
,
 
"name" : "_id_",
 
"ns" : "test.user"
 
}
 
]
 
 

Primary Indexes

 

[
 
{
 
"v" : 2,
 
"unique" : true,
 
"key" :
 
{ "x" : 1, "y" : 1, "cust_id" : 1 }
 
,
 
"name" : "x_1_y_1_cust_1",
 
"ns" : "test.user"
 
},
 
{
 
"v" : 2,
 
"key" :
 
{ "cust_id" : 1, "updated_at" : -1 }
 
,
 
"name" : "cust_id_1_updated_at_-1",
 
"ns" : "test.user"
 
},
 
{
 
"v" : 2,
 
"key" :
 
{ "z" : 1 }
 
,
 
"name" : "z_1",
 
"ns" : "test.user"
 
},
 
{
 
"v" : 2,
 
"key" :
 
{ "created_at" : 1 }
 
,
 
"name" : "created_at_1",
 
"ns" : "test.user"
 
},
 
{
 
"v" : 2,
 
"key" :
 
{ "_id" : 1 }
 
,
 
"name" : "_id_",
 
"ns" : "test.user"
 
},
 
{
 
"v" : 2,
 
"key" :
 
{ "updated_at" : 1 }
 
,
 
"name" : "updated_at_1",
 
"ns" : "test.user",
 
"expireAfterSeconds" : 31536000,
 
"background" : true
 
}
 
]

 

 

Comment by Carl Champain (Inactive) [ 09/Jan/20 ]

Hi pragupta,

Thanks for the report.
Unfortunately, we were not able to recreate your issue. To help us understand what is happening, can you please:

  1. Tell us what version of MongoDB are you using
  2. Provide the output of getIndexes() for the primary and secondary nodes?
  3. Provide the mongod.log file for the primary and secondary nodes?

Kind regards,
Carl
 

Generated at Thu Feb 08 05:08:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.