[SERVER-21061] Killing one index build interrupts another one on the same collection Created: 21/Oct/15  Updated: 06/Dec/22  Resolved: 17/Jan/19

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

Type: Bug Priority: Major - P3
Reporter: Alexander Komyagin Assignee: Backlog - Query Team (Inactive)
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-3964 Dropping an index invalidates all cur... Closed
Assigned Teams:
Query
Operating System: ALL
Participants:

 Description   

While running 2 concurrent background index builds on the same collection in MongoDB 3.0.7, I tried to kill one of them. It was correctly interrupted, however another index abruptly terminated with ""exception: Unable to complete index build as the collection is no longer readable", which is not expected. Further, restarting mongod causes the rebuild of that index.

> db.test.ensureIndex({y:"hashed"},{background:true})
{
	"createdCollectionAutomatically" : false,
	"numIndexesBefore" : 2,
	"errmsg" : "exception: Unable to complete index build as the collection is no longer readable",
	"code" : 28550,
	"ok" : 0
}
>

logs:

2015-10-21T16:22:50.000-0400 I -        [conn4]   Index Build (background): 255700/1203065 21%
2015-10-21T16:22:52.000-0400 I -        [conn7]   Index Build (background): 481000/1203065 39%
2015-10-21T16:22:52.258-0400 I STORAGE  [FileAllocator] allocating new datafile /private/tmp/test/data/db/test.2, filling with zeroes...
2015-10-21T16:22:52.516-0400 I STORAGE  [FileAllocator] done allocating datafile /private/tmp/test/data/db/test.2, size: 256MB,  took 0.258 secs
2015-10-21T16:22:53.000-0400 I -        [conn4]   Index Build (background): 349000/1203065 29%
2015-10-21T16:22:55.000-0400 I -        [conn7]   Index Build (background): 584700/1203065 48%
2015-10-21T16:22:56.003-0400 I -        [conn4]   Index Build (background): 463200/1203065 38%
2015-10-21T16:22:57.654-0400 I COMMAND  [conn5] going to kill op: op: 3609240.0
2015-10-21T16:22:57.662-0400 I COMMAND  [conn7] command test.$cmd command: createIndexes { createIndexes: "test", indexes: [ { key: { x: "hashed" }, name: "x_hashed", background: true } ] } keyUpdates:0 writeConflicts:0 numYields:5349 reslen:151 locks:{ Global: { acquireCount: { r: 5350, w: 5350 } }, MMAPV1Journal: { acquireCount: { w: 693851 }, acquireWaitCount: { w: 50 }, timeAcquiringMicros: { w: 635311 } }, Database: { acquireCount: { w: 5350, W: 2 }, acquireWaitCount: { w: 3, W: 1 }, timeAcquiringMicros: { w: 17330, W: 937 } }, Collection: { acquireCount: { W: 5350 }, acquireWaitCount: { W: 4149 }, timeAcquiringMicros: { W: 6401748 } }, Metadata: { acquireCount: { W: 7 } } } 13990ms
2015-10-21T16:22:57.662-0400 I COMMAND  [conn4] command test.$cmd command: createIndexes { createIndexes: "test", indexes: [ { key: { y: "hashed" }, name: "y_hashed", background: true } ] } keyUpdates:0 writeConflicts:0 numYields:4150 reslen:196 locks:{ Global: { acquireCount: { r: 4151, w: 4151 } }, MMAPV1Journal: { acquireCount: { w: 537911 }, acquireWaitCount: { w: 61 }, timeAcquiringMicros: { w: 1158757 } }, Database: { acquireCount: { w: 4151, W: 2 }, acquireWaitCount: { w: 3, W: 1 }, timeAcquiringMicros: { w: 20083, W: 616 } }, Collection: { acquireCount: { W: 4151 }, acquireWaitCount: { W: 4148 }, timeAcquiringMicros: { W: 6419789 } }, Metadata: { acquireCount: { W: 6 } } } 12753ms



 Comments   
Comment by David Storch [ 17/Jan/19 ]

alex.komyagin, as milkie suggested, this indeed looks like a duplicate of SERVER-3964. I'm closing this ticket accordingly. Note that versions >= 4.1.7 should not be affected by this problem, as dropping an index now only kills active queries whose plan actually requires that index to exist.

Comment by Eric Milkie [ 21/Oct/15 ]

This is probably a duplicate of another ticket, but it is currently true that dropping an index build kills all outstanding cursors on the collection, including ones that are scanning the collection for another index build.

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