rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
print details if details['klass'].endswith('PersistentMapping'): self.assertEqual(details['state'], None) else: self.assert_(details['klass'].endswith('MinPO')) self.assertEqual(details['state'], 0) | self.assertEqual(details["klass"], "Persistence.PersistentMapping") self.assertEqual(details['state'], None) | def checkDetail(self): # XXX need to fix return CACHE_SIZE = 10 self.db.setCacheSize(CACHE_SIZE) |
'r': (self._commit_lock_release, 0), | 'U': (self._commit_lock_release, 0), | def out_of_band_hook( code, args, get_hook={ 'b': (invalidator.begin, 0), 'i': (invalidator.invalidate, 1), 'e': (invalidator.end, 0), 'I': (invalidator.Invalidate, 1), 'r': (self._commit_lock_release, 0), 's': (self._serials.append, 1), 'S': (self._info.update, 1), }.get): |
return unittest.makeSuite(StorageTestCase) | suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(StorageTestCase)) import BDBStorage if BDBStorage.is_available: suite.addTest(unittest.makeSuite(BDBStorageTests)) return suite | def test_suite(): return unittest.makeSuite(StorageTestCase) |
test_merge(base, b1, b2, bm, 'empty one and not other') | test_merge(base, b1, b2, bm, 'empty one and not other', should_fail=1) | def testMergeEmpty(self): base, b1, b2, bm, e1, e2, items = self._setupConflict() |
get_transaction().commit() self.assertRaises(AssertionError, b._check) | self.assertRaises(ConflictError, get_transaction().commit) get_transaction().abort() | def testEmptyBucketConflict(self): # Tests that an emptied bucket *created by* conflict resolution is # viewed as a conflict: conflict resolution doesn't have enough # info to unlink the empty bucket from the BTree correctly. b = self.t for i in range(0, 200, 4): b[i] = i # bucket 0 has 15 values: 0, 4 .. 56 # bucket ... |
"phase commmit") | "phase commit") | def _finishCommit(self, txn): self.logger.debug("%s: commit", txn) try: for r in txn._resources: r.commit(txn) txn._status = Status.COMMITTED except: # An error occured during the second phase of 2PC. We can # no longer guarantee the system is in a consistent state. # The best we can do is abort() all the resource man... |
raise TransactionError("Transaction failed during second " "phase of two-phase commit") | raise TransactionError(msg) | def _finishCommit(self, txn): self.logger.debug("%s: commit", txn) try: for r in txn._resources: r.commit(txn) txn._status = Status.COMMITTED except: # An error occured during the second phase of 2PC. We can # no longer guarantee the system is in a consistent state. # The best we can do is abort() all the resource man... |
LOG("ZODB FS", BLATHER, "next(%d)" % index) | def next(self, index=0): if self._file is None: # A closed iterator. XXX: Is IOError the best we can do? For # now, mimic a read on a closed file. raise IOError, 'iterator is closed' file=self._file seek=file.seek read=file.read pos=self._pos | |
if self._stop is not None: LOG("ZODB FS", BLATHER, ("tid %x > stop %x ? %d" % (U64(tid), U64(self._stop), tid > self._stop))) | def next(self, index=0): if self._file is None: # A closed iterator. XXX: Is IOError the best we can do? For # now, mimic a read on a closed file. raise IOError, 'iterator is closed' file=self._file seek=file.seek read=file.read pos=self._pos | |
self.description = "%s\n\n%s" % (self.description, test.strip()) | self.description = "%s\n\n%s" % (self.description, text.strip()) | def note(self, text): if self.description: self.description = "%s\n\n%s" % (self.description, test.strip()) else: self.description = text.strip() |
elif err[0] == 0: break | def pending(self): """Invoke mainloop until any pending messages are handled.""" if __debug__: log("pending(), async=%d" % self.is_async(), level=zLOG.TRACE) if self.is_async(): return # Inline the asyncore poll() function to know whether any input # was actually read. Repeat until no input is ready. # XXX This only d... | |
else: | except: | def pending(self): """Invoke mainloop until any pending messages are handled.""" if __debug__: log("pending(), async=%d" % self.is_async(), level=zLOG.TRACE) if self.is_async(): return # Inline the asyncore poll() function to know whether any input # was actually read. Repeat until no input is ready. # XXX This only d... |
def read_transaction_header(file, pos, file_size): | def read_txn_header(f, pos, file_size, outp, ltid): | def read_transaction_header(file, pos, file_size): # Read the transaction record file.seek(pos) h = file.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl=u64(stl) if status=='c': raise EOFError if pos+(tl+8) > file_size: error("bad transaction leng... |
file.seek(pos) h = file.read(23) | f.seek(pos) h = f.read(23) | def read_transaction_header(file, pos, file_size): # Read the transaction record file.seek(pos) h = file.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl=u64(stl) if status=='c': raise EOFError if pos+(tl+8) > file_size: error("bad transaction leng... |
tl=u64(stl) if status=='c': raise EOFError if pos+(tl+8) > file_size: | tl = u64(stl) if pos + (tl + 8) > file_size: | def read_transaction_header(file, pos, file_size): # Read the transaction record file.seek(pos) h = file.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl=u64(stl) if status=='c': raise EOFError if pos+(tl+8) > file_size: error("bad transaction leng... |
if status not in ' up': error('invalid status, %s, at %s', status, pos) if tl < (23+ul+dl+el): error('invalid transaction length, %s, at %s', tl, pos) tpos=pos tend=tpos+tl if status=='u': | if tl < (23 + ul + dl + el): error("invalid transaction length, %s, at %s", tl, pos) if ltid and tid < ltid: error("time-stamp reducation %s < %s, at %s", u64(tid), u64(ltid), pos) if status == "c": truncate(f, pos, file_size, output) raise EOFError if status not in " up": error("invalid status, %r, at %s", status, ... | def read_transaction_header(file, pos, file_size): # Read the transaction record file.seek(pos) h = file.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl=u64(stl) if status=='c': raise EOFError if pos+(tl+8) > file_size: error("bad transaction leng... |
file.seek(tend) h = file.read(8) | f.seek(tend) h = f.read(8) | def read_transaction_header(file, pos, file_size): # Read the transaction record file.seek(pos) h = file.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl=u64(stl) if status=='c': raise EOFError if pos+(tl+8) > file_size: error("bad transaction leng... |
error('inconsistent transaction length at %s', pos) | error("inconsistent transaction length at %s", pos) | def read_transaction_header(file, pos, file_size): # Read the transaction record file.seek(pos) h = file.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl=u64(stl) if status=='c': raise EOFError if pos+(tl+8) > file_size: error("bad transaction leng... |
return pos, None | return pos, None, tid | def read_transaction_header(file, pos, file_size): # Read the transaction record file.seek(pos) h = file.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl=u64(stl) if status=='c': raise EOFError if pos+(tl+8) > file_size: error("bad transaction leng... |
user = file.read(ul) description = file.read(dl) | user = f.read(ul) description = f.read(dl) | def read_transaction_header(file, pos, file_size): # Read the transaction record file.seek(pos) h = file.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl=u64(stl) if status=='c': raise EOFError if pos+(tl+8) > file_size: error("bad transaction leng... |
try: e=loads(file.read(el)) | try: e=loads(f.read(el)) | def read_transaction_header(file, pos, file_size): # Read the transaction record file.seek(pos) h = file.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl=u64(stl) if status=='c': raise EOFError if pos+(tl+8) > file_size: error("bad transaction leng... |
file, tpos) pos=tend | f, tpos) pos = tend | def read_transaction_header(file, pos, file_size): # Read the transaction record file.seek(pos) h = file.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl=u64(stl) if status=='c': raise EOFError if pos+(tl+8) > file_size: error("bad transaction leng... |
file.seek(pos) h = file.read(8) | f.seek(pos) h = f.read(8) | def read_transaction_header(file, pos, file_size): # Read the transaction record file.seek(pos) h = file.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl=u64(stl) if status=='c': raise EOFError if pos+(tl+8) > file_size: error("bad transaction leng... |
return pos, result def scan(file, pos): """Return a potential transaction location following pos in file. | return pos, result, tid def truncate(f, pos, file_size, outp): """Copy data from pos to end of f to a .trNNN file.""" i = 0 while 1: trname = outp + ".tr%d" % i if os.path.exists(trname): i += 1 tr = open(trname, "wb") copy(f, tr, file_size - pos) f.seek(pos) tr.close() def copy(src, dst, n): while n: buf = src.read... | def read_transaction_header(file, pos, file_size): # Read the transaction record file.seek(pos) h = file.read(23) if len(h) < 23: raise EOFError tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h) if el < 0: el=t32-el tl=u64(stl) if status=='c': raise EOFError if pos+(tl+8) > file_size: error("bad transaction leng... |
file.seek(pos) data = file.read(8096) | f.seek(pos) data = f.read(8096) | def scan(file, pos): """Return a potential transaction location following pos in file. This routine scans forward from pos looking for the last data record in a transaction. A period '.' always occurs at the end of a pickle, and an 8-byte transaction length follows the last pickle. If a period is followed by a plaus... |
l = data.find('.', s) | l = data.find(".", s) | def scan(file, pos): """Return a potential transaction location following pos in file. This routine scans forward from pos looking for the last data record in a transaction. A period '.' always occurs at the end of a pickle, and an 8-byte transaction length follows the last pickle. If a period is followed by a plaus... |
if l > len(data) - 8: | s = l + 1 if s > len(data) - 8: | def scan(file, pos): """Return a potential transaction location following pos in file. This routine scans forward from pos looking for the last data record in a transaction. A period '.' always occurs at the end of a pickle, and an 8-byte transaction length follows the last pickle. If a period is followed by a plaus... |
s = l + 1 | def scan(file, pos): """Return a potential transaction location following pos in file. This routine scans forward from pos looking for the last data record in a transaction. A period '.' always occurs at the end of a pickle, and an 8-byte transaction length follows the last pickle. If a period is followed by a plaus... | |
print '.', | print ".", | def iprogress(i): if i % 2: print '.', else: print (i/2) % 10, sys.stdout.flush() |
opts, (inp, outp) = getopt.getopt(sys.argv[1:], 'fv:pP:') | opts, (inp, outp) = getopt.getopt(sys.argv[1:], "fv:pP:") | def main(): try: opts, (inp, outp) = getopt.getopt(sys.argv[1:], 'fv:pP:') except getopt.error: die() print __doc__ % argv[0] force = partial = verbose = 0 pack = None for opt, v in opts: if opt == '-v': verbose = int(v) elif opt == '-p': partial = 1 elif opt == '-f': force = 1 elif opt == '-P': pack = time.time() - f... |
if opt == '-v': | if opt == "-v": | def main(): try: opts, (inp, outp) = getopt.getopt(sys.argv[1:], 'fv:pP:') except getopt.error: die() print __doc__ % argv[0] force = partial = verbose = 0 pack = None for opt, v in opts: if opt == '-v': verbose = int(v) elif opt == '-p': partial = 1 elif opt == '-f': force = 1 elif opt == '-P': pack = time.time() - f... |
elif opt == '-p': | elif opt == "-p": | def main(): try: opts, (inp, outp) = getopt.getopt(sys.argv[1:], 'fv:pP:') except getopt.error: die() print __doc__ % argv[0] force = partial = verbose = 0 pack = None for opt, v in opts: if opt == '-v': verbose = int(v) elif opt == '-p': partial = 1 elif opt == '-f': force = 1 elif opt == '-P': pack = time.time() - f... |
elif opt == '-f': | elif opt == "-f": | def main(): try: opts, (inp, outp) = getopt.getopt(sys.argv[1:], 'fv:pP:') except getopt.error: die() print __doc__ % argv[0] force = partial = verbose = 0 pack = None for opt, v in opts: if opt == '-v': verbose = int(v) elif opt == '-p': partial = 1 elif opt == '-f': force = 1 elif opt == '-P': pack = time.time() - f... |
elif opt == '-P': | elif opt == "-P": | def main(): try: opts, (inp, outp) = getopt.getopt(sys.argv[1:], 'fv:pP:') except getopt.error: die() print __doc__ % argv[0] force = partial = verbose = 0 pack = None for opt, v in opts: if opt == '-v': verbose = int(v) elif opt == '-p': partial = 1 elif opt == '-f': force = 1 elif opt == '-P': pack = time.time() - f... |
print 'Recovering', inp, 'into', outp | print "Recovering", inp, "into", outp | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: | f = open(inp, "rb") if f.read(4) != ZODB.FileStorage.packed_version: | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
file.seek(0,2) file_size = file.tell() | f.seek(0,2) file_size = f.tell() | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
preindex = {} | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... | |
npos, transaction = read_transaction_header(file, pos, file_size) | npos, txn, tid = read_txn_header(f, pos, file_size, outp, ltid) | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
except: print "\n%s: %s\n" % sys.exc_info()[:2] | except (KeyboardInterrupt, SystemExit): raise except Exception, err: print "error reading txn header:", err | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
pos = scan(file, pos) | pos = scan(f, pos) if verbose > 1: print "looking for valid txn header at", pos | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
if transaction is None: | ltid = tid if txn is None: | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
tid = transaction.tid | tid = txn.tid | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
print ('Time stamps out of order %s, %s' % (_ts, t)) | print ("Time stamps out of order %s, %s" % (_ts, t)) | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
print ('Time stamps back in order %s' % (t)) | print ("Time stamps back in order %s" % (t)) | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
print 'begin', | print "begin", pos, _ts, | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
ofs.tpc_begin(transaction, tid, transaction.status) if verbose: print 'begin', pos, _ts, if verbose > 1: print sys.stdout.flush() | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... | |
for r in transaction: oid = r.oid | for r in txn: | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
print u64(oid), r.version, len(r.data) pre = preindex.get(oid) s = ofs.store(oid, pre, r.data, r.version, transaction) preindex[oid] = s | if r.data is None: l = "bp" else: l = len(r.data) print "%7d %s %s" % (u64(r.oid), l, r.version) s = ofs.restore(r.oid, r.serial, r.data, r.version, r.data_txn, txn) | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
except: | except (KeyboardInterrupt, SystemExit): raise except Exception, err: | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
ofs._status = 'p' ofs.tpc_vote(transaction) ofs.tpc_finish(transaction) | ofs._status = "p" ofs.tpc_vote(txn) ofs.tpc_finish(txn) | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
print 'partial' | print "partial" | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
ofs.tpc_abort(transaction) print "\n%s: %s\n" % sys.exc_info()[:2] | ofs.tpc_abort(txn) print "error copying transaction:", err | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
ofs.tpc_vote(transaction) ofs.tpc_finish(transaction) | ofs.tpc_vote(txn) ofs.tpc_finish(txn) | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
print 'finish' | print "finish" | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
if __name__ == '__main__': | if __name__ == "__main__": | def recover(inp, outp, verbose=0, partial=0, force=0, pack=0): print 'Recovering', inp, 'into', outp if os.path.exists(outp) and not force: die("%s exists" % outp) file = open(inp, "rb") if file.read(4) != ZODB.FileStorage.packed_version: die("input is not a file storage") file.seek(0,2) file_size = file.tell() ofs... |
d = os.path.split(d)[0] | d = os.path.dirname(d) | def parentdir(p, n=1): """Return the parent of p, n levels up.""" d = p while n: d = os.path.split(d)[0] if not d or d == '.': d = os.getcwd() n -= 1 return d |
address = ('127.9.9.9', 19999) | portoffset = 0 | def handle_read(self): self.recv(8192) self.lock.acquire() try: for thunk in self.thunks: try: thunk() except: nil, t, v, tbinfo = asyncore.compact_traceback() print ('exception in trigger thunk:' ' (%s:%s %s)' % (t, v, tbinfo)) self.thunks = [] finally: self.lock.release() |
host = '127.0.0.1' port = 19999 while 1: | for i in range(NPORTS): trigger.portoffset = (trigger.portoffset + 1) % NPORTS port = MINPORT + trigger.portoffset address = (HOST, port) | def __init__(self): a = socket.socket(socket.AF_INET, socket.SOCK_STREAM) w = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
self.address = host, port a.bind(self.address) | a.bind(address) except socket.error: continue else: | def __init__(self): a = socket.socket(socket.AF_INET, socket.SOCK_STREAM) w = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
except: if port <= 19950: raise 'Bind Error', 'Cannot bind trigger!' port -= 1 | else: raise RuntimeError, 'Cannot bind trigger!' | def __init__(self): a = socket.socket(socket.AF_INET, socket.SOCK_STREAM) w = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
w.connect(self.address) | w.connect(address) | def __init__(self): a = socket.socket(socket.AF_INET, socket.SOCK_STREAM) w = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
raise 'VersionCommitError', ( 'Internal error, can\'t abort to a version') | raise POSException.VersionCommitError( "Internal error, can't abort to a version") | def commitVersion(self, src, dest, transaction, abort=None): # We are going to commit by simply storing back pointers. |
d={} for i in range(20): d[random.randrange(-10000, 10001)]=i*100000 e1={} while len(e1) < 5: k=random.randrange(-10000, 10001) if not d.has_key(k): e1[k]=len(e1) e1=e1.items() e2={} while len(e2) < 5: k=random.randrange(-10000, 10001) if not d.has_key(k) and not e2.has_key(k): e2[k]=len(e2) e2=e2.items() base.updat... | base.update([(i, i*i) for i in l[:20]]) | def _setupConflict(self): base=self.t d={} for i in range(20): d[random.randrange(-10000, 10001)]=i*100000 |
def _setupConflict(self): | def _setupConflict(self): l=[ -5124, -7377, 2274, 8801, -9901, 7327, 1565, 17, -679, 3686, -3607, 14, 6419, -5637, 6040, -4556, -8622, 3847, 7191, -4067] e1=[-1704, 5420, -239, 4024, -6984] e2=[7745, 4868, -2548, -2711, -3154] | def _setupConflict(self): base=self.t d={} for i in range(20): d[random.randrange(-10000, 10001)]=i*100000 |
d={} for i in range(20): d[random.randrange(-10000, 10001)]=i*100000 e1={} while len(e1) < 5: k=random.randrange(-10000, 10001) if not d.has_key(k): e1[k]=len(e1) e1=e1.keys() e2={} while len(e2) < 5: k=random.randrange(-10000, 10001) if not d.has_key(k) and not e2.has_key(k): e2[k]=len(e2) e2=e2.keys() base.update(... | base.update(l) | def _setupConflict(self): base=self.t d={} for i in range(20): d[random.randrange(-10000, 10001)]=i*100000 |
invalidate=self._invalidating.append | def commit_sub(self, t): tmp=self._tmp if tmp is None: return src=self._storage self._storage=tmp self._tmp=None | |
for oid in src._index.keys(): | for oid in oids: | def commit_sub(self, t): tmp=self._tmp if tmp is None: return src=self._storage self._storage=tmp self._tmp=None |
invalidate(oid) | def commit_sub(self, t): tmp=self._tmp if tmp is None: return src=self._storage self._storage=tmp self._tmp=None | |
Now we'll repeat all the setup that was done earlier. | We can execute this test with a single connection, because we're synthesizing the invalidation that is normally generated by the second connection. We need to create two revisions so that there is a non-current revision to load. | ... def hook(self, oid, tid, version): |
Traceback (most recent call last): ... ReadConflictError: database read conflict error (oid 0000000000000002, class ZODB.tests.MinPO.MinPO) | ... def hook(self, oid, tid, version): | |
We still get a non-current version if the invalidation occurs while we are loading the current revision. Can that happen without ZEO? | ... def hook(self, oid, tid, version): | |
if verbose: print oid_repr(oid), r.version, len(r.data) | if verbose: print utils.oid_repr(oid), r.version, len(r.data) | def copyTransactionsFrom(self, other, verbose=0): """Copy transactions from another storage. |
self.closed = 0 | self.closed = False | def __init__(self, sock, addr, obj=None): self.obj = None self.marshal = Marshaller() self.closed = 0 self.msgid = 0 self.peer_protocol_version = None # Set in recv_handshake() if isinstance(addr, types.TupleType): self.log_label = "zrpc-conn:%s:%d" % addr else: self.log_label = "zrpc-conn:%s" % addr self.__super_init(... |
self.thr_async = 0 | self.thr_async = False | def __init__(self, sock, addr, obj=None): self.obj = None self.marshal = Marshaller() self.closed = 0 self.msgid = 0 self.peer_protocol_version = None # Set in recv_handshake() if isinstance(addr, types.TupleType): self.log_label = "zrpc-conn:%s:%d" % addr else: self.log_label = "zrpc-conn:%s" % addr self.__super_init(... |
self._map = {self._fileno: self} | self._singleton = {self._fileno: self} | def __init__(self, sock, addr, obj=None): self.obj = None self.marshal = Marshaller() self.closed = 0 self.msgid = 0 self.peer_protocol_version = None # Set in recv_handshake() if isinstance(addr, types.TupleType): self.log_label = "zrpc-conn:%s:%d" % addr else: self.log_label = "zrpc-conn:%s" % addr self.__super_init(... |
self.waiting_for_reply = 0 | self.waiting_for_reply = False | def __init__(self, sock, addr, obj=None): self.obj = None self.marshal = Marshaller() self.closed = 0 self.msgid = 0 self.peer_protocol_version = None # Set in recv_handshake() if isinstance(addr, types.TupleType): self.log_label = "zrpc-conn:%s:%d" % addr else: self.log_label = "zrpc-conn:%s" % addr self.__super_init(... |
self._map.clear() self.closed = 1 | self._singleton.clear() self.closed = True | def close(self): if self.closed: return self._map.clear() self.closed = 1 self.close_trigger() self.__super_close() |
self.waiting_for_reply = 1 | self.waiting_for_reply = True | def handle_request(self, msgid, flags, name, args): if not self.check_method(name): msg = "Invalid method name: %s on %s" % (name, repr(self.obj)) raise ZRPCError(msg) if __debug__: self.log("calling %s%s" % (name, short_repr(args)), level=zLOG.DEBUG) |
self.waiting_for_reply = 0 | self.waiting_for_reply = False | def handle_request(self, msgid, flags, name, args): if not self.check_method(name): msg = "Invalid method name: %s on %s" % (name, repr(self.obj)) raise ZRPCError(msg) if __debug__: self.log("calling %s%s" % (name, short_repr(args)), level=zLOG.DEBUG) |
asyncore.poll(0.01, self._map) | asyncore.poll(0.01, self._singleton) | def _deferred_call(self, method, *args): if self.closed: raise DisconnectedError() msgid = self.send_call(method, args, 0) asyncore.poll(0.01, self._map) return msgid |
self.thr_async = 0 | self.thr_async = False | def _prepare_async(self): self.thr_async = 0 ThreadedAsync.register_loop_callback(self.set_async) # XXX If we are not in async mode, this will cause dead # Connections to be leaked. |
self.thr_async = 1 | self.thr_async = True | def set_async(self, map): self.trigger = trigger() self.thr_async = 1 |
asyncore.poll(delay, self._map) | asyncore.poll(delay, self._singleton) | def wait(self, msgid): """Invoke asyncore mainloop and wait for reply.""" if __debug__: self.log("wait(%d), async=%d" % (msgid, self.is_async()), level=zLOG.TRACE) if self.is_async(): self._pull_trigger() |
asyncore.poll(0.0, self._map) | asyncore.poll(0.0, self._singleton) | def poll(self): """Invoke asyncore mainloop to get pending message out.""" if __debug__: self.log("poll(), async=%d" % self.is_async(), level=zLOG.TRACE) if self.is_async(): self._pull_trigger() else: asyncore.poll(0.0, self._map) |
self.thr_async = 1 | self.thr_async = True | def check_mgr_async(self): if not self.thr_async and self.mgr.thr_async: assert self.mgr.trigger is not None, \ "manager (%s) has no trigger" % self.mgr self.thr_async = 1 self.trigger = self.mgr.trigger return 1 return 0 |
version, snv = self._getVersion(oid, pre) | if pre: version, snv = self._getVersion(oid, pre) else: version, snv = '', '' | def _transactionalUndoRecord(self, oid, pos, serial, pre, version): """Get the indo information for a data record |
self.timeout.stop() | for timeout in self.timeouts.values(): timeout.stop() | def close_server(self): """Close the dispatcher so that there are no new connections. |
howlong = self._deadline - time.time() | deadline = self._deadline if deadline is None: continue howlong = deadline - time.time() | def run(self): while not self._stop: self._active.wait() self._lock.acquire() try: howlong = self._deadline - time.time() finally: self._lock.release() if howlong <= 0: self.timeout() else: time.sleep(howlong) |
p, os, v, pv, osv = self.zeoLoad(oid) except: return None if os != s: | os = self.getSerial(oid) except KeyError: | def zeoVerify(self, oid, s, sv): try: p, os, v, pv, osv = self.zeoLoad(oid) except: # except what? return None if os != s: self.client.invalidateVerify((oid, '')) elif osv != sv: self.client.invalidateVerify((oid, v)) |
elif osv != sv: self.client.invalidateVerify((oid, v)) | else: if sv: if sv != os: self.client.invalidateVerify((oid, '')) else: if s != os: self.client.invalidateVerify((oid, '')) | def zeoVerify(self, oid, s, sv): try: p, os, v, pv, osv = self.zeoLoad(oid) except: # except what? return None if os != s: self.client.invalidateVerify((oid, '')) elif osv != sv: self.client.invalidateVerify((oid, v)) |
_lock_acquire() locked=1 if self._packt != z64: raise FileStorageError, 'Already packing' self._packt=stop _lock_release() locked=0 | def pack(self, t, referencesf): """Copy data from the current database file to a packed file Non-current records from transactions with time-stamp strings less than packtss are ommitted. As are all undone records. Also, data back pointers that point before packtss are resolved and the associated data are copied, sinc... | |
if cc is not connection and cc._version==version: | if (cc is not connection and (not version or cc._version==version)): | def invalidate(self, oid, connection=None, version='', rc=sys.getrefcount): """Invalidate references to a given oid. |
for oid in db._storage.commitVersion(self._version, dest, t): db.invalidate(oid, version=dest) | oids=db._storage.commitVersion(self._version, dest, t) for oid in oids: db.invalidate(oid, version=dest) if dest: for oid in oids: db.invalidate(oid, version=self._version) | def commit(self, reallyme, t): db=self._db dest=self._dest for oid in db._storage.commitVersion(self._version, dest, t): db.invalidate(oid, version=dest) |
pack_times.append(time.time()) | def set_pack_time(): snooze() pack_times.append(time.time()) | |
time.sleep(1) | def checkPackAllRevisions(self): self._initroot() eq = self.assertEqual raises = self.assertRaises # Create a `persistent' object obj = self._newobj() oid = obj.getoid() obj.value = 1 # Commit three different revisions revid1 = self._dostoreNP(oid, data=pickle.dumps(obj)) obj.value = 2 revid2 = self._dostoreNP(oid, rev... | |
if s: if _type(s) is _st: if s == ResolvedSerial: object._p_changed=None else: object._p_serial=s object._p_changed=0 else: for oi, s in s: if _type(s) is not _st: raise s o=get(oi, oi) if o is not oi: if s == ResolvedSerial: o._p_changed=None else: o._p_serial=s o._p_changed=0 elif oi == oid: if s == ResolvedSeria... | # def persistent_id(object, | |
if s: if _type(s) is _st: o=get(oid, _None) if o is not _None: o._p_serial=s else: for oid, s in s: if _type(s) is not _st: raise s o=get(oid, _None) if o is not _None: o._p_serial=s | self._handle_serial(s, oid, change=0) | def commit_sub(self, t, _type=type, _st=type(''), _None=None): """Commit all work done in subtransactions""" tmp=self._tmp if tmp is _None: return src=self._storage |
if s: get=self._cache.get for oid, s in s: o=get(oid, oid) if o is not oid: if _type(s) is not _st: raise s if s == ResolvedSerial: o._p_changed=None else: o._p_serial=s o._p_changed=0 | self._handle_serial(s) def _handle_serial(self, store_return, oid=None, change=1): """Handle the returns from store() and tpc_vote() calls.""" if not store_return: return if isinstance(store_return, StringType): assert oid is not None serial = store_return obj = self._cache.get(oid, None) if serial == Reso... | def tpc_vote(self, transaction, _type=type, _st=type('')): self.__onCommitActions = () try: vote=self._storage.tpc_vote except: return s=vote(transaction) if s: get=self._cache.get for oid, s in s: o=get(oid, oid) if o is not oid: if _type(s) is not _st: raise s if s == ResolvedSerial: o._p_changed=None else: o._p_seri... |
schema = ZConfig.loadSchema(os.path.join(os.path.dirname(ZEO.__file__), "schema.xml")) | def options(args): """Password-specific options loaded from regular ZEO config file.""" schema = ZConfig.loadSchema(os.path.join(os.path.dirname(ZEO.__file__), "schema.xml")) try: options, args = getopt.getopt(args, "C:", ["configure="]) except getopt.error, msg: usage(msg) config = None delete = False for k, v in op... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.