Commit 275ae0a5 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Bug fix: Storage node now store the last OID used during import, SQL query is

executed each time a transaction is stored and only if the last OID has changed.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1175 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 07cee755
...@@ -420,7 +420,8 @@ class Application(object): ...@@ -420,7 +420,8 @@ class Application(object):
node.setState(protocol.PENDING_STATE) node.setState(protocol.PENDING_STATE)
self.broadcastNodeInformation(node) self.broadcastNodeInformation(node)
logging.debug('cluster starts with this partition table :') logging.debug('cluster starts with loid=%s and this partition table :',
dump(self.loid))
self.pt.log() self.pt.log()
def verifyTransaction(self, tid): def verifyTransaction(self, tid):
......
...@@ -32,6 +32,7 @@ class StorageServiceHandler(BaseServiceHandler): ...@@ -32,6 +32,7 @@ class StorageServiceHandler(BaseServiceHandler):
def connectionCompleted(self, conn): def connectionCompleted(self, conn):
node = self.app.nm.getNodeByUUID(conn.getUUID()) node = self.app.nm.getNodeByUUID(conn.getUUID())
if node.getState() == protocol.RUNNING_STATE: if node.getState() == protocol.RUNNING_STATE:
conn.notify(protocol.notifyLastOID(self.app.loid))
conn.notify(protocol.startOperation()) conn.notify(protocol.startOperation())
def handleNodeLost(self, conn, node): def handleNodeLost(self, conn, node):
......
...@@ -28,6 +28,13 @@ class TransactionInformation(object): ...@@ -28,6 +28,13 @@ class TransactionInformation(object):
self._uuid = uuid self._uuid = uuid
self._object_dict = {} self._object_dict = {}
self._transaction = None self._transaction = None
self._last_oid_changed = False
def lastOIDLchange(self):
self._last_oid_changed = True
def isLastOIDChanged(self):
return self._last_oid_changed
def getUUID(self): def getUUID(self):
return self._uuid return self._uuid
...@@ -102,14 +109,13 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler): ...@@ -102,14 +109,13 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
uuid = conn.getUUID() uuid = conn.getUUID()
app = self.app app = self.app
t = app.transaction_dict.setdefault(tid, TransactionInformation(uuid)) t = app.transaction_dict.setdefault(tid, TransactionInformation(uuid))
if t.isLastOIDChanged():
self.app.dm.setLastOID(self.app.loid)
t.addTransaction(oid_list, user, desc, ext) t.addTransaction(oid_list, user, desc, ext)
conn.answer(protocol.answerStoreTransaction(tid), packet.getId()) conn.answer(protocol.answerStoreTransaction(tid), packet.getId())
def handleAskStoreObject(self, conn, packet, oid, serial, def handleAskStoreObject(self, conn, packet, oid, serial,
compression, checksum, data, tid): compression, checksum, data, tid):
if oid != protocol.INVALID_OID and oid > self.app.loid:
args = dump(oid), dump(self.app.loid)
logging.warning('Greater OID used in StoreObject : %s > %s', *args)
uuid = conn.getUUID() uuid = conn.getUUID()
# First, check for the locking state. # First, check for the locking state.
app = self.app app = self.app
...@@ -144,3 +150,10 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler): ...@@ -144,3 +150,10 @@ class ClientOperationHandler(BaseClientAndStorageOperationHandler):
conn.answer(p, packet.getId()) conn.answer(p, packet.getId())
app.store_lock_dict[oid] = tid app.store_lock_dict[oid] = tid
# check if a greater OID last the last generated was used
if oid != protocol.INVALID_OID and oid > self.app.loid:
args = dump(oid), dump(self.app.loid)
logging.warning('Greater OID used in StoreObject : %s > %s', *args)
self.app.loid = oid
t.lastOIDLchange()
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