[Checkins] [zopefoundation/ZODB] 436d6e: Refactored FileStorage transactional undo

GitHub noreply at github.com
Tue Jul 12 22:31:17 CEST 2016


  Branch: refs/heads/fix-testMinimizeTerminates
  Home:   https://github.com/zopefoundation/ZODB
  Commit: 436d6e7bb03a2db3498784b829f9695546dda80a
      https://github.com/zopefoundation/ZODB/commit/436d6e7bb03a2db3498784b829f9695546dda80a
  Author: Jim Fulton <jim at zope.com>
  Date:   2016-07-12 (Tue, 12 Jul 2016)

  Changed paths:
    M src/ZODB/FileStorage/FileStorage.py
    M src/ZODB/tests/TransactionalUndoStorage.py

  Log Message:
  -----------
  Refactored FileStorage transactional undo

As part of a project to provide object-level commit locks for ZEO, I'm
refactiring FileStorage to maintain transaction-specific data in
Tranaction.data.  This involved undo.  In trying to figure this out, I
found:

- A bug in _undoDataInfo, which I verified with some tests and

- _transactionalUndoRecord was maddeningly difficult to reason about
  (and thus change).

I was concerned less by the bug than my inability to know whether a
change to the code would be correct.

So I refactored the code, mainly transactionalUndoRecord, to make the
code easier to understand, fixing some logic errors (I'm pretty sure)
along the way.  This included lots of comments. (Comments are much
easier to compose when you're working out logic you didn't
understand.)

In addition to makeing the code cleaner, it allows undo to be handled
in cases that weren't handled before.


  Commit: 5fa51838f39651c0e22c0fbc1dbb6d89180847cd
      https://github.com/zopefoundation/ZODB/commit/5fa51838f39651c0e22c0fbc1dbb6d89180847cd
  Author: Jim Fulton <jim at zope.com>
  Date:   2016-07-12 (Tue, 12 Jul 2016)

  Changed paths:
    M src/ZODB/FileStorage/FileStorage.py

  Log Message:
  -----------
  removed out of date comment


  Commit: f4e9202f6b24571df6bb4b86acf2bacbfda7845a
      https://github.com/zopefoundation/ZODB/commit/f4e9202f6b24571df6bb4b86acf2bacbfda7845a
  Author: Jim Fulton <jim at zope.com>
  Date:   2016-07-12 (Tue, 12 Jul 2016)

  Changed paths:
    M src/ZODB/tests/testCache.py

  Log Message:
  -----------
  Fix testMinimizeTerminates

This test was spewing exceptions without failing for ZODB5.

The spew was an indication that something was wrong in this case. (The
test was broken.)

There had been some bug in the object cache that caused an infinite
loop when objects woke themselves up while being reaped.  This test is
a regression test for that bug.

The test was sloppy about transaction managers.  The test class
creates a bunch of connections using the threaded transaction manager,
but this test used a thread to execute the critical code.  As a
result, the synchronization methods weren't called.  This didn't
matter much with ZODB4.  The objects were still able to load their
state.

With ZODB5, the synchronization methods are important for proper MVCC
and because they weren't called, the objects' state couldn't be
reloaded, with 2 effects:

- Spew

- The test wasn't really testing that object's that reloaded
  themselves didn't create an infinite loop.

Changed the test to not use a threaded transaction manager.


Compare: https://github.com/zopefoundation/ZODB/compare/436d6e7bb03a^...f4e9202f6b24


More information about the checkins mailing list