------------------
- Feature: A new ``IConflictHandler`` interface now controls all aspects of
conflict resolution. The following implementations are provided:
* ``NoCheckConflictHandler``: This handler does nothing and when used, the
system behaves as before when the ``detect_conflicts`` flag was set to
``False``.
* ``SimpleSerialConflictHandler``: This handler uses serial numbers on each
document to keep track of versions and then to detect conflicts. When a
conflict is detected, a ``ConflictError`` is raised. This handler is
identical to ``detect_conflicts`` being set to ``True``.
* ``ResolvingSerialConflictHandler``: Another serial handler, but it has the
ability to resolve a conflict. For this to happen, a persistent object
must implement ``_p_resolveConflict(orig_state, cur_state, new_state)``,
which returns the new, merged state. (Experimental)
As a result, the ``detect_conflicts`` flag of the data manager was removed
and replaced with the ``conflict_handler`` attribute. One can pass in the
``conflict_handler_factory`` to the data manager constructor. The factory
needs to expect on argument, the data manager.
- Feature: The new ``IdNamesMongoContainer`` class uses the natural Mongo
ObjectId as the name/key for the items in the container. No more messing
around with coming up or generating a name. Of course, if you specified
``None`` as a key in the past, it already used the object id, but it was
sotred again in the mapping key field. Now the object id is used directly
everywhere.
- Feature: Whenever ``setattr()`` is called on a persistent object, it is
marked as changed even if the new value equals the old one. To minimize
writes to MongoDB, the latest database state is compared to the new state
and the new state is only written when changes are detected. A flag called
``serialize.IGNORE_IDENTICAL_DOCUMENTS`` (default: ``True``) is used to
control the feature. (Experimental)
- Feature: ``ConflictError`` has now a much more meaningful API. Instead of
just referencing the object and different serials, it now actual has the
original, current and new state documents.
- Feature: Conflicts are now detected while aborting a transaction. The
implemented policy will not reset the document state, if a conflict is
detected.
- Feature: Provide a flag to turn on MongoDB access logging. The flag is false
by default, since access logging is very expensive.
- Feature: Added transaction ID to LoggingDecorator.
- Feature: Added a little script to test performance. It is not very
sophisticated, but it is sufficient for a first round of optimizations.
- Feature: Massively improved performance on all levels. This was mainly
accomplished by removing unnecessary database accesses, better caching and
more efficient algorithms. This results in speedups between 4-25 times.
- When resolving the path to a class, the result is now cached. More
importantly, lookup failures are also cached mapping path ->
``None``. This is important, since an optimization the ``resolve()``
method causes a lot of failing lookups.
- When resolving the dbref to a type, we try to resolve the dbref early
using the document, if we know that the documents within the collection
store their type path. This avoids frequent queries of the name map
collection when it is not needed.
- When getting the object document to read the class path, it will now read
the entire document and store it in the ``_latest_states`` dictionary, so
that other code may pick it up and use it. This should avoid superflous
reads from MongoDB.
- Drastically improved performance for collections that store only one type
of object and where the documents do not store the type (i.e. it is
stored in the name map collection).
- The Mongo Container fast load via find() did not work correctly, since
setstate() did not change the state from ghost to active and thus the
state was loaded again from MongoDB and set on the object. Now we use the
new ``_latest_states`` cache to lookup a document when ``setstate()`` is
called through the proper channels. Now this "fast load" method truly
causes O(1) database lookups.
- Implemented several more mapping methods for the Mongo Container, so that
all methods getting the full list of items are fast now.
- Whenever the Mongo Object Id is used as a hash key, use the hash of the id
instead. The ``__cmp__()`` method of the ``ObjectId`` class is way too
slow.
- Cache collection name lookup from objects in the ``ObjectWriter`` class.
- Bug: We have seen several occasions in production where we suddenly lost
some state in some documents, which prohibited the objects from being
loadable again. The cause was that the ``_original_states`` attribute did not
store the raw MongoDB document, but a modified one. Since those states are
used during abort to reset the state, however, the modified document got
stored making the affected objects inaccessible.
- Bug: When a transaction was aborted, the states of all *loaded* objects were
reset. Now, only *modified* object states are reset. This should drastically
lower problems (by the ratio of read over modified objects) due to lack of
full MVCC.
- Bug: When looking for an item by key/name (``find_*()`` methods) , you would
never get the right object back, but the first one found in the
database. This was due to clobbering the search filter with more general
parameters.