Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-4782

duplicate doc fields incorrectly generated in 1.8 without assertions, cause '0' assertion when upgrading to 2.0

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • ALL

      In 1.8 certain types of modifier operations, including some cases of implicit subfield creation with use of field names that are identical but for a hyphenated suffix, will generate documents with duplicate field names. This is SERVER-3370. A secondary consequence of SERVER-3370 is that the presence of these duplicate field names does not generate an assertion as long as the hyphenated field remains present.

      Upon upgrade to 2.0 (and potentially 1.8.5), the duplicate field names are still present but since SERVER-3370 is fixed the duplicate field names are actually detected and an assertion is triggered. That assertion is SERVER-4777.

      I don't believe there is any work to be done specifically for this ticket (SERVER-4777 will fix). I'm just creating the ticket so we can easily reference the upgrade issue.

      Example

      // mongo 1.8.3
      
      > c = db.c;
      test.c
      > c.save( {a:{},'a-b':{}} );
      > c.update( {}, {$set:{'a.x':1,'a.y':2,'a-b.u':3,'a-b.v':4}} )
      > c.findOne()
      {
      	"_id" : ObjectId("4f210067baad7632bb897f27"),
      	"a" : {
      		
      	},
      	"a-b" : {
      		"u" : 3,
      		"v" : 4
      	},
      	"a" : {
      		
      	}
      }
      > c.update( {}, {$set:{'a.x':1,'a.y':2,'a-b.u':3,'a-b.v':4}} )
      > c.findOne()
      {
      	"_id" : ObjectId("4f210067baad7632bb897f27"),
      	"a" : {
      		
      	},
      	"a" : {
      		
      	},
      	"a-b" : {
      		"u" : 3,
      		"v" : 4
      	},
      	"a" : {
      		
      	}
      }
      
      // now on mongo 2.0+
      
      > c.update( {}, {$set:{'a.x':1,'a.y':2,'a-b.u':3,'a-b.v':4}} )
      0
      
      In log file:
      
      Wed Jan 25 23:32:59 [conn1]  test.c Assertion failure 0 src/mongo/db/ops/update.cpp 691
      0x10d46a6d5 0x10d811feb 0x10db01ff9 0x10d66fb22 0x10d6534e9 0x10d658625 0x10d65ae73 0x10d8e48d7 0x10d8eb08c 0x10d4553c3 0x10d9e98ea 0x10d9eaf40 0x10d9eafa2 0x10d9eafcd 0x10f70b460 0x7fff924798bf 0x7fff9247cb75 
      
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: