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

Heap1BtreeImpl::ReverseCursor::advanceTo does not account for current position of cursor

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 2.7.6
    • Storage

    Description

      Relevant snipped of test case extracted below:

      scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );
      scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() );
       
      scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );
       
      WriteUnitOfWork uow( opCtx.get() );
      ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) );
      ASSERT_OK( sorted->insert( opCtx.get(), key1, loc2, true /* allow duplicates */ ) );
      ASSERT_OK( sorted->insert( opCtx.get(), key1, loc3, true /* allow duplicates */ ) );
      uow.commit();
       
      scoped_ptr<SortedDataInterface::Cursor> cursor( sorted->newCursor( opCtx.get(), -1 ) );
      cursor->locate( key1, loc2 );
       
      vector<const BSONElement*> keyEnd( 1 );
      vector<bool> keyEndInclusive( 1 );
       
      cursor->advanceTo( key1, 1, false, keyEnd, keyEndInclusive );
      ASSERT_EQUALS( key1, cursor->getKey() );
      ASSERT_EQUALS( loc1, cursor->getDiskLoc() );

      Instead, the cursor is positioned at (key1, loc3), i.e. the last occurrence of the specified key in the index.

      Attachments

        Activity

          People

            Unassigned Unassigned
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: