-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.0.2
-
Component/s: Index Maintenance
-
Fully Compatible
-
ALL
Test case:
db.foo.drop() db.foo.insert({x: [1,2]}) db.foo.insert({x: [1,2]}) db.foo.ensureIndex({x:1}, {unique:true, dropDups:true})
Results in dropping (some of) the duplicates but not creating the index:
Tue Jan 24 22:02:24 [conn1] Assertion: 10334:Invalid BSONObj size: -286331154 (0xEEEEEEEE) first element: _id: ObjectId('4f1f70c01ef6a89e507a79b5') 0x1000873ed 0x10000b071 0x100407f49 0x10040a3f9 0x10040b22a 0x10040c060 0x10040d51a 0x10040eca6 0x1003d65dc 0x1003e308f 0x1003e5679 0x10060d574 0x1001495e2 0x100614734 0x7fff8fdfc8bf 0x7fff8fdffb75 0 mongod 0x00000001000873ed _ZN5mongo11msgassertedEiPKc + 333 1 mongod 0x000000010000b071 _ZNK5mongo7BSONObj14_assertInvalidEv + 1057 2 mongod 0x0000000100407f49 _ZN5mongo11DataFileMgr12deleteRecordEPKcPNS_6RecordERKNS_7DiskLocEbbb + 1945 3 mongod 0x000000010040a3f9 _ZN5mongo14fastBuildIndexEPKcPNS_16NamespaceDetailsERNS_12IndexDetailsEi + 1689 4 mongod 0x000000010040b22a _ZN5mongo12buildAnIndexESsPNS_16NamespaceDetailsERNS_12IndexDetailsEib + 938 5 mongod 0x000000010040c060 _ZN5mongo16insert_makeIndexEPNS_16NamespaceDetailsERKSsRKNS_7DiskLocE + 448 6 mongod 0x000000010040d51a _ZN5mongo11DataFileMgr6insertEPKcPKvibbPb + 1050 7 mongod 0x000000010040eca6 _ZN5mongo11DataFileMgr16insertWithObjModEPKcRNS_7BSONObjEb + 70 8 mongod 0x00000001003d65dc _ZN5mongo14checkAndInsertEPKcRNS_7BSONObjE + 172 9 mongod 0x00000001003e308f _ZN5mongo14receivedInsertERNS_7MessageERNS_5CurOpE + 639 10 mongod 0x00000001003e5679 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 4457 11 mongod 0x000000010060d574 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 148 12 mongod 0x00000001001495e2 _ZN5mongo3pms9threadRunEPNS_13MessagingPortE + 754 13 mongod 0x0000000100614734 thread_proxy + 132 14 libsystem_c.dylib 0x00007fff8fdfc8bf _pthread_start + 335 15 libsystem_c.dylib 0x00007fff8fdffb75 thread_start + 13 Tue Jan 24 22:02:24 [conn1] insert test.system.indexes exception: Invalid BSONObj size: -286331154 (0xEEEEEEEE) first element: _id: ObjectId('4f1f70c01ef6a89e507a79b5') code:10334 63ms
This can be worked around by setting
{background:true}because it uses a different code path. Building the index in the foreground adds the same document to the list of docs to delete for each duplicate which can result in trying to delete the same document twice.
- is duplicated by
-
SERVER-4562 createIndex on array field with unique and dropDups:true gives "Invalid BSONObj size" error instead of duplicate key error if array has 2 or more duplicates
- Closed