Commit ab371f52 authored by Tim Peters's avatar Tim Peters

load() and loadEx(): eliminate gratuitous differences.

Ideally, load() should call loadEx() instead, but we really
don't want "an extra" Python-level call here (heavily used).

loadEx():  deleted pointless call of self._read_txn_header().

ServerStub.loadEx() comments:  these were obviously wrong in
several ways, but I don't know the full truth.  Better to
say so up front than to leave them clearly wrong, though.
parent 048c040e
......@@ -173,12 +173,17 @@ class StorageServer:
return self.rpc.call('zeoLoad', oid)
##
# Return current data for oid along with tid if transaction that
# wrote the date.
# Return current data for oid in version, the tid of the transaction that
# wrote the most recent revision, and the name of the version for the
# data returned. Versions make this hard to understand; in particular,
# the version string returned may not equal the version string passed
# in, and that's "a feature" I don't understand. Similarly, the tid
# returned is the tid of the most recent revision of oid, and that may
# not equal the tid of the transaction that wrote the data returned.
# @param oid object id
# @param version string, name of version
# @defreturn 4-tuple
# @return data, serial number, transaction id, version,
# @defreturn 3-tuple
# @return data, transaction id, version
# where version is the name of the version the data came
# from or "" for non-version data
# @exception KeyError if oid is not found
......
......@@ -516,7 +516,7 @@ class FileStorage(BaseStorage.BaseStorage,
raise TypeError("invalid oid %r" % (oid,))
def loadEx(self, oid, version):
# A variant of load() that also returns a transaction id.
# A variant of load() that also returns the version string.
# ZEO wants this for managing its cache.
self._lock_acquire()
try:
......@@ -524,7 +524,6 @@ class FileStorage(BaseStorage.BaseStorage,
h = self._read_data_header(pos, oid)
if h.version and h.version != version:
# Return data and tid from pnv (non-version data).
# If we return the old record's transaction id, then
# it will look to the cache like old data is current.
# The tid for the current data must always be greater
......@@ -537,8 +536,7 @@ class FileStorage(BaseStorage.BaseStorage,
else:
# Get the data from the backpointer, but tid from
# currnt txn.
data, _, _, _ = self._loadBack_impl(oid, h.back)
th = self._read_txn_header(h.tloc)
data = self._loadBack_impl(oid, h.back)[0]
return data, h.tid, h.version
finally:
self._lock_release()
......@@ -553,8 +551,11 @@ class FileStorage(BaseStorage.BaseStorage,
data = self._loadBack_impl(oid, h.pnv)[0]
return data, h.tid
if h.plen:
return self._file.read(h.plen), h.tid
data = self._file.read(h.plen)
return data, h.tid
else:
# Get the data from the backpointer, but tid from
# currnt txn.
data = self._loadBack_impl(oid, h.back)[0]
return data, h.tid
finally:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment