[SERVER-1018] reIndex on master fails to create indexes on slave Created: 13/Apr/10  Updated: 12/Jul/16  Resolved: 11/May/10

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

Type: Bug Priority: Major - P3
Reporter: Kristina Chodorow (Inactive) Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Slave log output:

Tue Apr 13 14:41:19 repl: from host:10.211.143.79:27017
Tue Apr 13 14:41:35 building new index on

{ _id: 1 }

for buzzfeed.report
Tue Apr 13 14:41:35 Buildindex buzzfeed.report idxNo:1 { name: "id", ns: "buzzfeed.report", key:

{ _id: 1 }

}
Tue Apr 13 14:41:42 external sort used : 2 files in 6 secs
Tue Apr 13 14:41:43 done for 1153414 records 7.802secs
Tue Apr 13 14:41:43 CMD: reIndex buzzfeed.report
Tue Apr 13 14:41:43 User Exception 10058:not master
Tue Apr 13 14:41:43 buzzfeed.$cmd Caught Assertion in insert , continuing
Tue Apr 13 14:41:43 insert exception userassert:not master 0ms
Tue Apr 13 14:41:43 User Exception 10058:not master
Tue Apr 13 14:41:43 buzzfeed.$cmd Caught Assertion in insert , continuing
Tue Apr 13 14:41:43 insert exception userassert:not master 0ms
Tue Apr 13 14:41:43 repl: applied 5 operations
Tue Apr 13 14:41:43 repl: end sync_pullOpLog syncedTo: Tue Apr 13 14:41:35 2010 4bc4badf:3

Actions:

MASTER:
> db.report.ensureIndex(

{time:1}

);
> db.report.getIndexes()
[
{
"name" : "id",
"ns" : "buzzfeed.report",
"key" :

{ "_id" : 1 }

},
{
"_id" : ObjectId("4bc4ba93b69879591542997a"),
"ns" : "buzzfeed.report",
"key" :

{ "time" : 1 }

,
"name" : "time_1"
}
]

SLAVE:
> db.report.getIndexes()
[
{
"name" : "id",
"ns" : "buzzfeed.report",
"key" :

{ "_id" : 1 }

},
{
"_id" : ObjectId("4bc4b902b698795915429979"),
"ns" : "buzzfeed.report",
"key" :

{ "time" : 1 }

,
"name" : "time_1"
}
]
>

MASTER:
> db.report.reIndex()

SLAVE:
> db.report.getIndexes()
[ ]



 Comments   
Comment by Eliot Horowitz (Inactive) [ 08/Sep/10 ]

Added a new case: SERVER-1755
Can you add any info you have there

Comment by Swen Thümmler [ 08/Sep/10 ]

master:
> db.foo.save({_id:1, _o:2})
> db.foo.ensureIndex({_o:1})
slave:
> db.foo.getIndexes()
[
{
"name" : "id",
"ns" : "test.foo",
"key" :

{ "_id" : 1 }

},
{
"_id" : ObjectId("4c8790ce2ee529bbe28fbe59"),
"ns" : "test.foo",
"key" :

{ "_o" : 1 }

,
"name" : "_o_1"
}
]
master:
> db.foo.reIndex()
{
"nIndexesWas" : 2,
"msg" : "indexes dropped for collection",
"ok" : 1,
"nIndexes" : 2,
"indexes" : [
{
"name" : "id",
"ns" : "test.foo",
"key" :

{ "_id" : 1 }

},
{
"_id" : ObjectId("4c8790ce2ee529bbe28fbe59"),
"ns" : "test.foo",
"key" :

{ "_o" : 1 }

,
"name" : "_o_1"
}
],
"ok" : 1
}
slave:
> db.foo.getIndexes()
[ ]

master log:
Wed Sep 8 15:33:55 [conn4410] building new index on

{ _id: 1 }

for test.foo
Wed Sep 8 15:33:55 [conn4410] Buildindex test.foo idxNo:0 { name: "id", ns: "test.foo", key:

{ _id: 1 }

}
Wed Sep 8 15:33:55 [conn4410] done for 0 records 0secs
Wed Sep 8 15:34:06 [conn4410] building new index on

{ _o: 1.0 }

for test.foo
Wed Sep 8 15:34:06 [conn4410] Buildindex test.foo idxNo:1 { _id: ObjectId('4c8790ce2ee529bbe28fbe59'), ns: "test.foo", key:

{ _o: 1.0 }

, name: "_o_1" }
Wed Sep 8 15:34:06 [conn4410] done for 1 records 0.024secs
Wed Sep 8 15:35:19 [conn4410] CMD: reIndex test.foo
Wed Sep 8 15:35:19 [conn4410] building new index on

{ _id: 1 }

for test.foo
Wed Sep 8 15:35:19 [conn4410] Buildindex test.foo idxNo:0 { name: "id", ns: "test.foo", key:

{ _id: 1 }

}
Wed Sep 8 15:35:19 [conn4410] done for 1 records 0secs
Wed Sep 8 15:35:19 [conn4410] building new index on

{ _o: 1.0 }

for test.foo
Wed Sep 8 15:35:19 [conn4410] Buildindex test.foo idxNo:1 { _id: ObjectId('4c8790ce2ee529bbe28fbe59'), ns: "test.foo", key:

{ _o: 1.0 }

, name: "_o_1" }
Wed Sep 8 15:35:19 [conn4410] done for 1 records 0secs

slave log:
Wed Sep 8 15:33:55 [rs_sync] building new index on

{ _id: 1 }

for test.foo
Wed Sep 8 15:33:55 [rs_sync] Buildindex test.foo idxNo:0 { name: "id", ns: "test.foo", key:

{ _id: 1 }

}
Wed Sep 8 15:33:55 [rs_sync] done for 0 records 0secs
Wed Sep 8 15:34:06 [rs_sync] building new index on

{ _o: 1.0 }

for test.foo
Wed Sep 8 15:34:06 [rs_sync] Buildindex test.foo idxNo:1 { _id: ObjectId('4c8790ce2ee529bbe28fbe59'), ns: "test.foo", key:

{ _o: 1.0 }

, name: "_o_1" }
Wed Sep 8 15:34:06 [rs_sync] done for 1 records 0secs
Wed Sep 8 15:34:22 [initandlisten] connection accepted from 10.228.113.45:38438 #3330
Wed Sep 8 15:35:19 [rs_sync] CMD: reIndex test.foo

Comment by Swen Thümmler [ 08/Sep/10 ]

This issue does not seem to be fixed for replication sets (I'm running 1.6.2 on linux). If I reIndex a collection on the current master, the collection looses all indexes on the slave (even the index on _id)

Comment by auto [ 11/May/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: don't use direct client for creating index on slave with reIndex SERVER-1018
http://github.com/mongodb/mongo/commit/e20da4adcf400b2e43572b58c1f7f5d546492a76

Generated at Thu Feb 08 02:55:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.