Commit 89a9a658 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Forget a lost storage node from all data structures.

Otherwise the getUUIDList() used to notify non-lost storage nodes that
the transaction is fully locked will also return the uuid of the lost node.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2319 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 8fff33c1
...@@ -91,6 +91,7 @@ class Transaction(object): ...@@ -91,6 +91,7 @@ class Transaction(object):
# data but was later found to be disconnected. This loss has no impact # data but was later found to be disconnected. This loss has no impact
# on current code, but it might be disturbing to reader or future code. # on current code, but it might be disturbing to reader or future code.
self._lock_wait_uuid_set.discard(uuid) self._lock_wait_uuid_set.discard(uuid)
self._uuid_set.discard(uuid)
return self.locked() return self.locked()
def lock(self, uuid): def lock(self, uuid):
......
...@@ -238,6 +238,8 @@ class MasterStorageHandlerTests(NeoTestBase): ...@@ -238,6 +238,8 @@ class MasterStorageHandlerTests(NeoTestBase):
# Check state after node lost # Check state after node lost
# T1: last locking node lost, client receives AnswerTransactionFinished # T1: last locking node lost, client receives AnswerTransactionFinished
self.checkAnswerTransactionFinished(cconn1) self.checkAnswerTransactionFinished(cconn1)
self.checkNotifyUnlockInformation(conn2)
self.checkNoPacketSent(conn1)
# ...and notifications are sent to other clients # ...and notifications are sent to other clients
self.checkInvalidateObjects(cconn2) self.checkInvalidateObjects(cconn2)
self.checkInvalidateObjects(cconn3) self.checkInvalidateObjects(cconn3)
......
...@@ -178,11 +178,14 @@ class testTransactionManager(NeoTestBase): ...@@ -178,11 +178,14 @@ class testTransactionManager(NeoTestBase):
# Storage 1 dies: # Storage 1 dies:
# t1 is over # t1 is over
self.assertTrue(t1.forget(storage_1_uuid)) self.assertTrue(t1.forget(storage_1_uuid))
self.assertEqual(t1.getUUIDList(), [storage_2_uuid])
# t2 still waits for storage 2 # t2 still waits for storage 2
self.assertFalse(t2.forget(storage_1_uuid)) self.assertFalse(t2.forget(storage_1_uuid))
self.assertEqual(t2.getUUIDList(), [storage_2_uuid])
self.assertTrue(t2.lock(storage_2_uuid)) self.assertTrue(t2.lock(storage_2_uuid))
# t3 doesn't care # t3 doesn't care
self.assertFalse(t3.forget(storage_1_uuid)) self.assertFalse(t3.forget(storage_1_uuid))
self.assertEqual(t3.getUUIDList(), [storage_2_uuid])
self.assertTrue(t3.lock(storage_2_uuid)) self.assertTrue(t3.lock(storage_2_uuid))
if __name__ == '__main__': if __name__ == '__main__':
......
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