-
Notifications
You must be signed in to change notification settings - Fork 130
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -75,6 +75,11 @@ public void send(final MessageData message, final Collection<Address> blackList) | |||
|
|||
private void sendMessageToSpecificAddresses( | |||
final Collection<Address> recipients, final MessageData message) { | |||
LOG.trace( | |||
"Sending message to peers messageCode={} messageData={} recipients={}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the message data contained might be useful - but I suspect that given its a byte array, our ability to deconstruct it might be ... hard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be difficult to deconstruct, I was considering leaving it out. thinking about it more I don't think it is useful especially since the raw packet is already logged by netty.
@@ -84,7 +89,10 @@ private void sendMessageToSpecificAddresses( | |||
try { | |||
connection.sendForProtocol(PROTOCOL_NAME, message); | |||
} catch (final PeerNotConnected peerNotConnected) { | |||
LOG.trace("Lost connection to a validator."); | |||
LOG.trace( | |||
"Lost connection to a validator. remoteAddress={} peerInfo={}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to know when we gain/lose validators, we should log that in the add/remove? An error here means we literally ran into the someone disconnected between creating the stream and getting to their turn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do want to know when we gain/remove validators. I've just added additional details to the existing log so we know who peer got disconnected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should log that in the add/remove - not in this exception - in fact, this exception BORDERLINE doesn't need info in it...
actionOrBufferMessage( | ||
signedPayload, currentRound::handleProposalMessage, RoundState::setProposedBlock); | ||
} | ||
|
||
public void handlePreparePayload(final SignedData<PreparePayload> signedPayload) { | ||
LOG.info("Received a prepare Payload."); | ||
LOG.debug("Received a prepare Payload."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
capital P-repare (to match Proposal above)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
actionOrBufferMessage( | ||
signedPayload, currentRound::handlePrepareMessage, RoundState::addPrepareMessage); | ||
} | ||
|
||
public void handleCommitPayload(final SignedData<CommitPayload> payload) { | ||
LOG.info("Received a commit Payload."); | ||
LOG.debug("Received a commit Payload."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
capital C-ommit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -191,7 +196,7 @@ public void handleRoundChangePayload(final SignedData<RoundChangePayload> signed | |||
|
|||
final MessageAge messageAge = determineAgeOfPayload(signedPayload.getPayload()); | |||
if (messageAge == PRIOR_ROUND) { | |||
LOG.info("Received RoundChange Payload for a prior round."); | |||
LOG.info("Received RoundChange Payload for a prior round. targetRound={}", targetRound); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is probably trace - i.e. we really don't care too much about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think more debug than trace. could be useful for troubleshooting issues. changing to debug.
@@ -189,7 +201,7 @@ private boolean updateStateWithProposedBlock(final SignedData<ProposalPayload> m | |||
if (blockAccepted) { | |||
// There are times handling a proposed block is enough to enter prepared. | |||
if (wasPrepared != roundState.isPrepared()) { | |||
LOG.info("Sending commit message."); | |||
LOG.info("Sending commit message. round={}", roundState.getRoundIdentifier()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trace
@@ -212,7 +224,7 @@ private void peerIsPrepared(final SignedData<PreparePayload> msg) { | |||
final boolean wasPrepared = roundState.isPrepared(); | |||
roundState.addPrepareMessage(msg); | |||
if (wasPrepared != roundState.isPrepared()) { | |||
LOG.info("Sending commit message."); | |||
LOG.info("Sending commit message. round={}", roundState.getRoundIdentifier()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug? (maybe trace ...)
@@ -97,7 +97,7 @@ public RoundChangeManager( | |||
final SignedData<RoundChangePayload> msg) { | |||
|
|||
if (!isMessageValid(msg)) { | |||
LOG.info("RoundChange message was invalid."); | |||
LOG.error("RoundChange message was invalid."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably not an error ... just can't use the message (typically pantheon treats malformed packets as bad, but not terrible, as there are so many actors out there ... its kinda normal)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if its normal i'll make it info level.
prepared = | ||
(preparePayloads.size() >= prepareMessageCountForQuorum(quorum)) | ||
&& proposalMessage.isPresent(); | ||
final long prepareQuorum = prepareMessageCountForQuorum(quorum); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should get moved into the class constructor (i.e. can be calculated at startup).
@@ -79,13 +82,15 @@ public boolean setProposedBlock(final SignedData<ProposalPayload> msg) { | |||
public void addPrepareMessage(final SignedData<PreparePayload> msg) { | |||
if (!proposalMessage.isPresent() || validator.validatePrepareMessage(msg)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-reading this conditional kinda hurt my head, its correct, but not obviously.
May be a symptom of the design rather than the code ... but ... :/
Rather see it say "If(Proposal.isPresent() && isValid) store; else if(!Proposal) store.
@@ -75,6 +75,11 @@ public void send(final MessageData message, final Collection<Address> blackList) | |||
|
|||
private void sendMessageToSpecificAddresses( | |||
final Collection<Address> recipients, final MessageData message) { | |||
LOG.trace( | |||
"Sending message to peers messageCode={} messageData={} recipients={}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be difficult to deconstruct, I was considering leaving it out. thinking about it more I don't think it is useful especially since the raw packet is already logged by netty.
@@ -84,7 +89,10 @@ private void sendMessageToSpecificAddresses( | |||
try { | |||
connection.sendForProtocol(PROTOCOL_NAME, message); | |||
} catch (final PeerNotConnected peerNotConnected) { | |||
LOG.trace("Lost connection to a validator."); | |||
LOG.trace( | |||
"Lost connection to a validator. remoteAddress={} peerInfo={}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do want to know when we gain/remove validators. I've just added additional details to the existing log so we know who peer got disconnected.
actionOrBufferMessage( | ||
signedPayload, currentRound::handleProposalMessage, RoundState::setProposedBlock); | ||
} | ||
|
||
public void handlePreparePayload(final SignedData<PreparePayload> signedPayload) { | ||
LOG.info("Received a prepare Payload."); | ||
LOG.debug("Received a prepare Payload."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
actionOrBufferMessage( | ||
signedPayload, currentRound::handlePrepareMessage, RoundState::addPrepareMessage); | ||
} | ||
|
||
public void handleCommitPayload(final SignedData<CommitPayload> payload) { | ||
LOG.info("Received a commit Payload."); | ||
LOG.debug("Received a commit Payload."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -191,7 +196,7 @@ public void handleRoundChangePayload(final SignedData<RoundChangePayload> signed | |||
|
|||
final MessageAge messageAge = determineAgeOfPayload(signedPayload.getPayload()); | |||
if (messageAge == PRIOR_ROUND) { | |||
LOG.info("Received RoundChange Payload for a prior round."); | |||
LOG.info("Received RoundChange Payload for a prior round. targetRound={}", targetRound); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think more debug than trace. could be useful for troubleshooting issues. changing to debug.
@@ -99,11 +104,13 @@ public void startRoundWith( | |||
|
|||
SignedData<ProposalPayload> proposal; | |||
if (!latestCertificate.isPresent()) { | |||
LOG.info("Multicasting NewRound with new block."); | |||
LOG.info("Multicasting NewRound with new block. round={}", roundState.getRoundIdentifier()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree with that. done.
final Block block = blockCreator.createBlock(headerTimestamp); | ||
proposal = messageFactory.createSignedProposalPayload(getRoundIdentifier(), block); | ||
} else { | ||
LOG.info("Multicasting NewRound from PreparedCertificate."); | ||
LOG.info( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'll make this trace too
@@ -132,14 +139,19 @@ public void startRoundWith( | |||
blockHeader, extraDataToPublish)); | |||
final BlockHeader newHeader = headerBuilder.buildBlockHeader(); | |||
final Block newBlock = new Block(newHeader, block.getBody()); | |||
LOG.debug( | |||
"Created proposal from prepared certificate blockHeader={} extraData={}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch. I was going to include the block number as well. don't think it's needed as this is included in the block header.
done.
@@ -169,12 +181,12 @@ private void actionReceivedProposal(final SignedData<ProposalPayload> msg) { | |||
} | |||
|
|||
public void handlePrepareMessage(final SignedData<PreparePayload> msg) { | |||
LOG.info("Received a prepare message."); | |||
LOG.info("Received a prepare message. round={}", roundState.getRoundIdentifier()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure on these. might belong at debug level. is this and the handle logs useful for debugging or is a bit over the top?
@@ -97,7 +97,7 @@ public RoundChangeManager( | |||
final SignedData<RoundChangePayload> msg) { | |||
|
|||
if (!isMessageValid(msg)) { | |||
LOG.info("RoundChange message was invalid."); | |||
LOG.error("RoundChange message was invalid."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if its normal i'll make it info level.
PR description
This adds some additional logging in IBFT. It is mostly centred on logging details in the state machine.
I'm also name=value pairs for the additional data that is being logged both so it is easier to parse (both manually and with logging tools).
Also lowered some of the existing INFO logging levels to DEBUG.
Fixed Issue(s)