Commit a760258b authored by Julien Muchembled's avatar Julien Muchembled

master: simplify verification by ignoring completely nodes without readable cells

The scenario that was described in comments was meaningless
because S1 never goes out-of-date.
parent fa63d856
......@@ -66,7 +66,7 @@ class VerificationManager(BaseServiceHandler):
# - there's no unfinished data
# - just before they return the last tid/oid
self._askStorageNodesAndWait(Packets.AskLastIDs(),
[x for x in app.nm.getIdentifiedList() if x.isStorage()])
app.nm.getStorageList(only_identified=True))
app.setLastTransaction(app.tm.getLastTID())
# Just to not return meaningless information in AnswerRecovery.
app.truncate_tid = None
......@@ -78,28 +78,21 @@ class VerificationManager(BaseServiceHandler):
# Gather all transactions that may have been partially finished.
# It's safe to query outdated cells from nodes with readable cells.
# For other nodes, it's more complicated:
# 1. pt: U|U ltid: 10
# On the other hand, we must ignore temporary data from other nodes:
# 1. S1:U S2:U ltid:10
# 2. S1: restart with voted ttid=13
# S2: stop with locked ttid=13
# 3. pt: U|O ltid: 10
# 3. S1:U S2:O ltid:10
# 4. verification drops ttid=13 because it's not locked
# 5. new commits -> ltid: 20
# 5. new commits -> ltid:20
# 6. S1 restarted, S2 started
# 7. ttid=13 must be dropped
# And we can't ignore ttid < last tid for all nodes, even if the
# master serializes unlock notifications:
# 1. pt: U.|.U ltid: 15
# 2. unlock ttid=18 to S1
# 3. unlock ttid=20 to S2
# 4. S1 stopped before unlocking ttid=18
# 5. S2 unlocks ttid=20
# 6. back to recovery, S1 started
# 7. verification must validate ttid=18
# So for nodes without any readable cell, and only for them, we only
# check if they have locked transactions. Replication will do the rest.
self._askStorageNodesAndWait(Packets.AskLockedTransactions(),
[x for x in getIdentifiedList() if x.isStorage()])
# Replication will fix them if the data should have been validated.
# And in the case such node had information about locked transactions,
# a node with readable cells would have unlocked them.
node_set = app.pt.getNodeSet(readable=True)
assert all(node.isIdentified() for node in node_set), node_set
self._askStorageNodesAndWait(Packets.AskLockedTransactions(), node_set)
# Some nodes may have already unlocked these transactions and
# _locked_dict is incomplete, but we can ask them the final tid.
......@@ -142,13 +135,9 @@ class VerificationManager(BaseServiceHandler):
def answerLockedTransactions(self, conn, tid_dict):
uuid = conn.getUUID()
self._uuid_set.remove(uuid)
app = self.app
node = app.nm.getByUUID(uuid)
vote = any(x[1].isReadable() for x in app.pt.iterNodeCell(node))
for ttid, tid in tid_dict.iteritems():
if tid:
self._locked_dict[ttid] = tid
if vote:
self._voted_dict[ttid].add(uuid)
def answerFinalTID(self, conn, tid):
......
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