[ZODB-Dev] Storage iterator() method

Jeremy Hylton jeremy@alum.mit.edu
Thu, 25 Jul 2002 06:23:27 -0400


>>>>> "TD" == Toby Dickenson <tdickenson@geminidataloggers.com> writes:

  TD> Im looking at the iterator() method of the storage
  TD> interface. Ive not been able to find any information about its
  TD> performance or concurency requirements.

Me neither <wink>.  (Is that any performance information about other
parts of the storage API?)

  TD> I know this method is very useful for offline uses such as
  TD> copyTransactionsFrom, but is it intended to be useful while the
  TD> storage is being accessed from other threads?

I don't think it was designed for that purpose, but I think the
implementations in berkeley storage and file storage should work well
enough.  FileStorage implements the iterator by opening a new Python
file object (read-only) on the Data.fs and reading that.  The only
potential gotcha, and I'd have to check the code to be sure it exists,
is that it could read a partial transaction if another thread is in
the midst of a commit when the next record is pulled off the iterator;
if it did, I expect it would raise an exception.

Berkeley should be even safer, since it is just reading transactions
out of the transaction log.  The storage uses berkeley transactions
for storage transactions, so clients using an iterator should get ACID
semantics.

Jeremy