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

sparse indexes break replication of array based operators

    XMLWordPrintable

    Details

    • Operating System:
      ALL

      Description

      When an array based operator is applied to a field that is absent, the replicated operation checks that the field matches null. If there is a sparse index on the field, the operation may not be replicated properly.

      Test

       
      function doTest( sparse ) {
          rt = new ReplTest( "repl14tests" );
          
          m = rt.start( true );
          mc = m.getDB( 'd' )[ 'c' ];
          
          mc.ensureIndex( {a:1}, {sparse:sparse} );
          mc.save( {} );
          
          s = rt.start( false );
          sc = s.getDB( 'd' )[ 'c' ];
          
          assert.soon( function() { return sc.count() > 0; } );
          
          mc.update( {}, {$push:{a:1}} );
          
          assert.soon( function() { return sc.count( {a:1} ) > 0; } );
          
          rt.stop();
      }
       
      doTest( false );
      doTest( true );
       

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: