Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-1065

WT_CURSOR.search_near and invisible updates

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Resolution: Done
    • None
    • WT2.2.1
    • None

    Description

      The WT_CURSOR.search_near method can return an incorrect key/value pair if the update record for an insert object is invisible to the session.

      What happens is we successfully find the insert object and take the key from it; because the update record is invisible, we fall-through to the case where we're taking a value from the on-page cell, and we return the insert object's key with the last-known on-page object's value.

      • This is a row-store test, but I expect the same failure happens for column-store as well.
      • We can't simply switch to taking the on-page cell key/value pair, because there may be insert objects that are visible to the transaction.

      Here's the script:

          def test_insert_list_invisible(self):
              # Open a table an insert a bunch of records.
              uri = 'table:xxx'
              self.session.create(uri, 'key_format=S,value_format=S')
              cursor = self.session.open_cursor(uri, None)
              for i in range(1, 40):
                  cursor.set_key(key_populate(cursor, i))
                  cursor.set_value(value_populate(cursor, i))
                  cursor.insert()
              cursor.close()
       
              # Close/reopen the table to move the records "on-page".
              self.reopen_conn()
       
              # Append more records, making them visible.
              cursor = self.session.open_cursor(uri, None)
              for i in range(40, 50):
                  cursor.set_key(key_populate(cursor, i))
                  cursor.set_value(value_populate(cursor, i))
                  cursor.insert()
       
              # Append more records, making them invisible.
              self.session.begin_transaction()
              cursor = self.session.open_cursor(uri, None)
              for i in range(50, 60):
                  cursor.set_key(key_populate(cursor, i))
                  cursor.set_value(value_populate(cursor, i))
                  cursor.insert()
       
              # Search-near in the middle of the invisible records.
              s = self.conn.open_session()
              cursor = s.open_cursor(uri, None)
              cursor.set_key(key_populate(cursor, 55))
              cursor.search_near()
              print cursor.get_key() + "/" + cursor.get_value()
      

      Attachments

        Issue Links

          Activity

            People

              keith.bostic@mongodb.com Keith Bostic (Inactive)
              keith.bostic@mongodb.com Keith Bostic (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: