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

Prevent transactions committing data at a timestamp prior to the stable using the timestamp_transaction API

    • 5
    • Storage - Ra 2022-05-16, Storage - Ra 2022-05-30

      While thinking about the issues discussed in WT-9115 I noticed that a behaviour is currently legal within the API, if a transaction calls timestamp_transaction(commit_timestamp=X) and then performs an update and then the stable is moved in the system to say X+5, then the transaction commits with a commit timestamp of X+10 the transaction will succeed despite having used invalid timestamps on its updates.

      Reproducer:

      import wiredtiger, wttest
      from wtscenario import make_scenarios
      
      class test_hs12(wttest.WiredTigerTestCase):
          def test_hang(self):
              uri = "table:hang"
              create_params = 'value_format=S,key_format=i'
              value1 = 'abcedfghijklmnopqrstuvwxyz' * 5
              value2 = 'b' * 100
              self.session.create(uri, create_params)
              cursor = self.session.open_cursor(uri)
              session2 = self.setUpSessionOpen(self.conn)
              session2.create(uri, create_params)
              cursor2 = session2.open_cursor(uri)
              self.conn.set_timestamp("stable_timestamp=" + self.timestamp_str(1))
              # Insert a full value.
              self.session.begin_transaction()
              self.session.timestamp_transaction('commit_timestamp=' + self.timestamp_str(2))
              cursor[2] = value1
              self.session.timestamp_transaction('commit_timestamp=' + self.timestamp_str(3))
              cursor[3] = value2
              self.conn.set_timestamp("stable_timestamp=" + self.timestamp_str(5))
              #session2.checkpoint()
              self.session.commit_transaction('commit_timestamp=' + self.timestamp_str(10))
      
      if __name__ == '__main__':
          wttest.run()
      

            Assignee:
            will.korteland@mongodb.com Will Korteland
            Reporter:
            luke.pearson@mongodb.com Luke Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: