Commit a58e7181 authored by Tim Peters's avatar Tim Peters

Merge rev 31012 from 3.4 branch.

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 729faf25
...@@ -173,12 +173,17 @@ class StorageServer: ...@@ -173,12 +173,17 @@ class StorageServer:
return self.rpc.call('zeoLoad', oid) return self.rpc.call('zeoLoad', oid)
## ##
# Return current data for oid along with tid if transaction that # Return current data for oid in version, the tid of the transaction that
# wrote the date. # 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 oid object id
# @param version string, name of version # @param version string, name of version
# @defreturn 4-tuple # @defreturn 3-tuple
# @return data, serial number, transaction id, version, # @return data, transaction id, version
# where version is the name of the version the data came # where version is the name of the version the data came
# from or "" for non-version data # from or "" for non-version data
# @exception KeyError if oid is not found # @exception KeyError if oid is not found
......
...@@ -516,7 +516,7 @@ class FileStorage(BaseStorage.BaseStorage, ...@@ -516,7 +516,7 @@ class FileStorage(BaseStorage.BaseStorage,
raise TypeError("invalid oid %r" % (oid,)) raise TypeError("invalid oid %r" % (oid,))
def loadEx(self, oid, version): 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. # ZEO wants this for managing its cache.
self._lock_acquire() self._lock_acquire()
try: try:
...@@ -524,7 +524,6 @@ class FileStorage(BaseStorage.BaseStorage, ...@@ -524,7 +524,6 @@ class FileStorage(BaseStorage.BaseStorage,
h = self._read_data_header(pos, oid) h = self._read_data_header(pos, oid)
if h.version and h.version != version: if h.version and h.version != version:
# Return data and tid from pnv (non-version data). # Return data and tid from pnv (non-version data).
# If we return the old record's transaction id, then # If we return the old record's transaction id, then
# it will look to the cache like old data is current. # it will look to the cache like old data is current.
# The tid for the current data must always be greater # The tid for the current data must always be greater
...@@ -537,8 +536,7 @@ class FileStorage(BaseStorage.BaseStorage, ...@@ -537,8 +536,7 @@ class FileStorage(BaseStorage.BaseStorage,
else: else:
# Get the data from the backpointer, but tid from # Get the data from the backpointer, but tid from
# currnt txn. # currnt txn.
data, _, _, _ = self._loadBack_impl(oid, h.back) data = self._loadBack_impl(oid, h.back)[0]
th = self._read_txn_header(h.tloc)
return data, h.tid, h.version return data, h.tid, h.version
finally: finally:
self._lock_release() self._lock_release()
...@@ -553,8 +551,11 @@ class FileStorage(BaseStorage.BaseStorage, ...@@ -553,8 +551,11 @@ class FileStorage(BaseStorage.BaseStorage,
data = self._loadBack_impl(oid, h.pnv)[0] data = self._loadBack_impl(oid, h.pnv)[0]
return data, h.tid return data, h.tid
if h.plen: if h.plen:
return self._file.read(h.plen), h.tid data = self._file.read(h.plen)
return data, h.tid
else: else:
# Get the data from the backpointer, but tid from
# currnt txn.
data = self._loadBack_impl(oid, h.back)[0] data = self._loadBack_impl(oid, h.back)[0]
return data, h.tid return data, h.tid
finally: 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