[SERVER-12022] Background index dropped before secondary completes isn't removed Created: 09/Dec/13  Updated: 11/Jul/16  Resolved: 14/Jan/14

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: 2.5.4
Fix Version/s: 2.5.5

Type: Bug Priority: Major - P3
Reporter: Michael Grundy Assignee: Eric Milkie
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

tested on linux and osx with nightly build e7dce6441d29464a616565b946e0c7a78580f2cc


Attachments: File drop-bgindex.js    
Issue Links:
Related
Operating System: ALL
Steps To Reproduce:

jstest attached. Sometimes it works, very frustrating, but mostly it fails.

Participants:

 Description   

Create a background indexing job, drop the index before the secondary finishes building it and it won't be deleted from the secondary. The secondary does receive the drop command:

m31000| 2013-12-09T23:15:13.719+0000 [conn1] build index on: fgIndexSec.jstests_feh properties: { v: 1, key: { i: 1.0 }, name: "i_1", ns: "fgIndexSec.jstests_feh", background: true }
 m31000| 2013-12-09T23:15:14.057+0000 [conn1] build index done.  scanned 100000 total records. 0.338 secs
 m31000| 2013-12-09T23:15:14.057+0000 [conn1] command fgIndexSec.$cmd command: { insert: "system.indexes", documents: [ { _id: ObjectId('52a64f010da7f86215d22152'), ns: "fgIndexSec.jstests_feh", key: { i: 1.0 }, name: "i_1", background: true } ], ordered: true } keyUpdates:0  reslen:40 338ms

Secondary starts index build:

 m31001| 2013-12-09T23:15:14.058+0000 [repl index builder 0] build index on: fgIndexSec.jstests_feh properties: { v: 1, key: { i: 1.0 }, name: "i_1", ns: "fgIndexSec.jstests_feh", background: true }

system.indexes.find().forEach(printjson) on primary and secondary:

{
	"v" : 1,
	"key" : {
		"_id" : 1
	},
	"name" : "_id_",
	"ns" : "fgIndexSec.jstests_feh"
}
{
	"v" : 1,
	"key" : {
		"i" : 1
	},
	"name" : "i_1",
	"ns" : "fgIndexSec.jstests_feh",
	"background" : true
}
{
	"v" : 1,
	"key" : {
		"_id" : 1
	},
	"name" : "_id_",
	"ns" : "fgIndexSec.jstests_feh"
}
{
	"v" : 1,
	"key" : {
		"i" : 1
	},
	"name" : "i_1",
	"ns" : "fgIndexSec.jstests_feh",
	"background" : true
}

At this point (from currentOp) the index build progress on the secondary is:

"bg index build Background Index Build Progress: 1367/100000 1%"

drop the index

 m31000| 2013-12-09T23:15:14.062+0000 [conn1] CMD: dropIndexes fgIndexSec.jstests_feh

Secondary gets dropIndexes:

 m31001| 2013-12-09T23:15:14.065+0000 [repl writer worker 1] CMD: dropIndexes fgIndexSec.jstests_feh

But after index build completes, doesn't drop:
Primary:

 
{
	"v" : 1,
	"key" : {
		"_id" : 1
	},
	"name" : "_id_",
	"ns" : "fgIndexSec.jstests_feh"
}

Secondary:

 
{
	"v" : 1,
	"key" : {
		"_id" : 1
	},
	"name" : "_id_",
	"ns" : "fgIndexSec.jstests_feh"
}
{
	"v" : 1,
	"key" : {
		"i" : 1
	},
	"name" : "i_1",
	"ns" : "fgIndexSec.jstests_feh",
	"background" : true
}


Generated at Thu Feb 08 03:27:22 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.