Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Report better info while trying to identify cluster sync. GH #7034
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjohnson5972 committed Mar 31, 2019
1 parent 2790d66 commit 6692f2f
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions tests/Cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,18 +517,28 @@ def waitOnClusterBlockNumSync(self, targetBlockNum, timeout=None, blockType=Bloc
"""Wait for all nodes to have targetBlockNum finalized."""
assert(self.nodes)

def doNodesHaveBlockNum(nodes, targetBlockNum, blockType):
def doNodesHaveBlockNum(nodes, targetBlockNum, blockType, printCount):
ret=True
for node in nodes:
try:
if (not node.killed) and (not node.isBlockPresent(targetBlockNum, blockType=blockType)):
return False
ret=False
break
except (TypeError) as _:
# This can happen if client connects before server is listening
return False
ret=False
break

return True
printCount+=1
if Utils.Debug and not ret and printCount%5==0:
blockNums=[]
for i in range(0, len(nodes)):
blockNums.append(nodes[i].getBlockNum())
Utils.Print("Cluster still not in sync, head blocks for nodes: [ %s ]" % (", ".join(blockNums)))
return ret

lam = lambda: doNodesHaveBlockNum(self.nodes, targetBlockNum, blockType)
printCount=0
lam = lambda: doNodesHaveBlockNum(self.nodes, targetBlockNum, blockType, printCount)
ret=Utils.waitForBool(lam, timeout)
return ret

Expand Down

0 comments on commit 6692f2f

Please sign in to comment.