Commit 11c428e0 authored by Julien Muchembled's avatar Julien Muchembled

Code cleanup

parent 7834ef10
...@@ -67,8 +67,6 @@ class Storage(BaseStorage.BaseStorage, ...@@ -67,8 +67,6 @@ class Storage(BaseStorage.BaseStorage,
'deleteObject', 'deleteObject',
'undo', 'undo',
'undoLog', 'undoLog',
'abortVersion',
'commitVersion',
): ):
setattr(self, method_id, raiseReadOnlyError) setattr(self, method_id, raiseReadOnlyError)
if _app is None: if _app is None:
...@@ -156,12 +154,6 @@ class Storage(BaseStorage.BaseStorage, ...@@ -156,12 +154,6 @@ class Storage(BaseStorage.BaseStorage,
def supportsTransactionalUndo(self): def supportsTransactionalUndo(self):
return True return True
def abortVersion(self, src, transaction):
return self.app.abortVersion(src, transaction)
def commitVersion(self, src, dest, transaction):
return self.app.commitVersion(src, dest, transaction)
def loadEx(self, oid, version): def loadEx(self, oid, version):
try: try:
data, serial, _ = self.app.load(oid) data, serial, _ = self.app.load(oid)
......
...@@ -465,7 +465,6 @@ class Application(object): ...@@ -465,7 +465,6 @@ class Application(object):
if answer_ttid is None: if answer_ttid is None:
raise NEOStorageError('tpc_begin failed') raise NEOStorageError('tpc_begin failed')
assert tid in (None, answer_ttid), (tid, answer_ttid) assert tid in (None, answer_ttid), (tid, answer_ttid)
txn_context['txn'] = transaction
txn_context['ttid'] = answer_ttid txn_context['ttid'] = answer_ttid
def store(self, oid, serial, data, version, transaction): def store(self, oid, serial, data, version, transaction):
...@@ -475,7 +474,6 @@ class Application(object): ...@@ -475,7 +474,6 @@ class Application(object):
raise StorageTransactionError(self, transaction) raise StorageTransactionError(self, transaction)
logging.debug('storing oid %s serial %s', dump(oid), dump(serial)) logging.debug('storing oid %s serial %s', dump(oid), dump(serial))
self._store(txn_context, oid, serial, data) self._store(txn_context, oid, serial, data)
return None
def _store(self, txn_context, oid, serial, data, data_serial=None, def _store(self, txn_context, oid, serial, data, data_serial=None,
unlock=False): unlock=False):
...@@ -984,16 +982,6 @@ class Application(object): ...@@ -984,16 +982,6 @@ class Application(object):
self._askPrimary(Packets.AskLastTransaction()) self._askPrimary(Packets.AskLastTransaction())
return self.last_tid return self.last_tid
def abortVersion(self, src, transaction):
if self._txn_container.get(transaction) is None:
raise StorageTransactionError(self, transaction)
return '', []
def commitVersion(self, src, dest, transaction):
if self._txn_container.get(transaction) is None:
raise StorageTransactionError(self, transaction)
return '', []
def __del__(self): def __del__(self):
"""Clear all connection.""" """Clear all connection."""
# Due to bug in ZODB, close is not always called when shutting # Due to bug in ZODB, close is not always called when shutting
......
...@@ -114,7 +114,7 @@ class ConnectionPool(object): ...@@ -114,7 +114,7 @@ class ConnectionPool(object):
if not cell_list: if not cell_list:
raise NEOStorageError('no storage available') raise NEOStorageError('no storage available')
getConnForNode = self.getConnForNode getConnForNode = self.getConnForNode
while cell_list: while 1:
new_cell_list = [] new_cell_list = []
# Shuffle to randomise node to access... # Shuffle to randomise node to access...
shuffle(cell_list) shuffle(cell_list)
...@@ -131,10 +131,11 @@ class ConnectionPool(object): ...@@ -131,10 +131,11 @@ class ConnectionPool(object):
# state can have changed during connection attempt. # state can have changed during connection attempt.
elif node.isRunning(): elif node.isRunning():
new_cell_list.append(cell) new_cell_list.append(cell)
if not new_cell_list:
break
cell_list = new_cell_list cell_list = new_cell_list
if new_cell_list: # wait a bit to avoid a busy loop
# wait a bit to avoid a busy loop time.sleep(1)
time.sleep(1)
def getConnForNode(self, node): def getConnForNode(self, node):
"""Return a locked connection object to a given node """Return a locked connection object to a given node
......
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