1. 02 Jul, 2021 2 commits
    • Kirill Smelkov's avatar
      Fix loadBefore vs GC · 34494fc0
      Kirill Smelkov authored
      TemporaryStorage uses
      
          ._index   {} oid -> serial
          ._opickle {} oid -> data
      
      as data store for load. However for loadBefore
      
          ._conflict_cache  {} (oid,serial) -> (data, time)
      
      is reused as data store.
      
      That would be ok if that place would be treated as data store, but given
      its primary purpose - as its name suggests - was originally to be a
      cache to resolve conflicts, it is "logical" that entries in this cache
      are garbage-collected when entry age becomes > gc threshold.
      
      Only now there is a problem: if an object is committed once, and time
      passes, corresponding entry in ._conflict_cache will be removed. And this
      would manifest itself as
      
          - load(oid)  -> gives latest data for the object (obtained via ._index and ._opickle)
      
      but
      
          - loadBefore(oid, @head)  -> gives POSKeyError
      
      -> Fix it by always preserving latest object revision in
      ._conflict_cache from being removed on GC.
      
      The fix is important for systems that use ZODB5, or ZODB4-wc2[1] because
      there ZODB.Connection switched from primarily using load to exclusively
      using loadBefore.
      
      /cc @icemac @mauritsvanrees @mgedmin @d-maurer @dwt @hannosch
      
      Fixes: https://github.com/zopefoundation/tempstorage/issues/8
      [1] nexedi/ZODB@8e7eab33
      34494fc0
    • Kirill Smelkov's avatar
      Fix tests with ZODB 5.6 · 93b59d51
      Kirill Smelkov authored
      By definition IStorage level methods need to be passed in storage-level
      IStorageTransactionMetaData, not regular transaction.Transaction
      objects:
      
      https://github.com/zopefoundation/ZODB/blob/5.6.0-35-g1fb097b41/src/ZODB/interfaces.py#L827-L830
      
      Passing in there regular transaction.Transaction used to work
      historically, but after https://github.com/zopefoundation/ZODB/commit/2f8cc67a
      it started to fail as:
      
          Error in test test_conflict_cache_clears_over_time (tempstorage.tests.testTemporaryStorage.TemporaryStorageTests)
          Traceback (most recent call last):
            File "/usr/lib/python2.7/unittest/case.py", line 329, in run
              testMethod()
            File "/home/kirr/src/wendelin/z/tempstorage/src/tempstorage/tests/testTemporaryStorage.py", line 195, in test_conflict_cache_clears_over_time
              self._dostore(storage, oid1, data=MinPO(5))
            File "/home/kirr/src/wendelin/z/tempstorage/src/tempstorage/tests/testTemporaryStorage.py", line 132, in _dostore
              storage.tpc_begin(t)
            File "/home/kirr/src/wendelin/z/ZODB/src/ZODB/BaseStorage.py", line 193, in tpc_begin
              ext = transaction.extension_bytes
          AttributeError: 'Transaction' object has no attribute 'extension_bytes'
      
      -> Fix it by using storage-level transactions in tests.
      93b59d51
  2. 13 May, 2020 1 commit
  3. 15 Aug, 2019 4 commits
  4. 14 Aug, 2019 1 commit
  5. 13 Aug, 2019 4 commits
  6. 12 Aug, 2019 1 commit
  7. 10 May, 2019 6 commits
  8. 06 May, 2019 1 commit
  9. 09 Apr, 2019 5 commits
  10. 27 Nov, 2017 4 commits
  11. 19 Sep, 2017 1 commit
  12. 08 Sep, 2017 1 commit
  13. 09 Mar, 2017 8 commits
  14. 24 Feb, 2017 1 commit