forked from Qortal/qortal
Reduced "Error while trying to find common block with peer" log from INFO to DEBUG when determining which peer to sync with. When performing the actual synchronization, use INFO logging as this is a more serious error.
This commit is contained in:
parent
3bedba71d5
commit
65c26f17df
@ -321,7 +321,7 @@ public class PeersResource {
|
|||||||
boolean force = true;
|
boolean force = true;
|
||||||
List<BlockSummaryData> peerBlockSummaries = new ArrayList<>();
|
List<BlockSummaryData> peerBlockSummaries = new ArrayList<>();
|
||||||
|
|
||||||
SynchronizationResult findCommonBlockResult = Synchronizer.getInstance().fetchSummariesFromCommonBlock(repository, targetPeer, ourInitialHeight, force, peerBlockSummaries);
|
SynchronizationResult findCommonBlockResult = Synchronizer.getInstance().fetchSummariesFromCommonBlock(repository, targetPeer, ourInitialHeight, force, peerBlockSummaries, true);
|
||||||
if (findCommonBlockResult != SynchronizationResult.OK)
|
if (findCommonBlockResult != SynchronizationResult.OK)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ public class Synchronizer {
|
|||||||
ourInitialHeight, Base58.encode(ourLastBlockSignature), ourLatestBlockData.getTimestamp()));
|
ourInitialHeight, Base58.encode(ourLastBlockSignature), ourLatestBlockData.getTimestamp()));
|
||||||
|
|
||||||
List<BlockSummaryData> peerBlockSummaries = new ArrayList<>();
|
List<BlockSummaryData> peerBlockSummaries = new ArrayList<>();
|
||||||
SynchronizationResult findCommonBlockResult = fetchSummariesFromCommonBlock(repository, peer, ourInitialHeight, false, peerBlockSummaries);
|
SynchronizationResult findCommonBlockResult = fetchSummariesFromCommonBlock(repository, peer, ourInitialHeight, false, peerBlockSummaries, false);
|
||||||
if (findCommonBlockResult != SynchronizationResult.OK) {
|
if (findCommonBlockResult != SynchronizationResult.OK) {
|
||||||
// Logging performed by fetchSummariesFromCommonBlock() above
|
// Logging performed by fetchSummariesFromCommonBlock() above
|
||||||
peer.setCommonBlockData(null);
|
peer.setCommonBlockData(null);
|
||||||
@ -508,7 +508,7 @@ public class Synchronizer {
|
|||||||
ourInitialHeight, Base58.encode(ourLastBlockSignature), ourLatestBlockData.getTimestamp()));
|
ourInitialHeight, Base58.encode(ourLastBlockSignature), ourLatestBlockData.getTimestamp()));
|
||||||
|
|
||||||
List<BlockSummaryData> peerBlockSummaries = new ArrayList<>();
|
List<BlockSummaryData> peerBlockSummaries = new ArrayList<>();
|
||||||
SynchronizationResult findCommonBlockResult = fetchSummariesFromCommonBlock(repository, peer, ourInitialHeight, force, peerBlockSummaries);
|
SynchronizationResult findCommonBlockResult = fetchSummariesFromCommonBlock(repository, peer, ourInitialHeight, force, peerBlockSummaries, true);
|
||||||
if (findCommonBlockResult != SynchronizationResult.OK) {
|
if (findCommonBlockResult != SynchronizationResult.OK) {
|
||||||
// Logging performed by fetchSummariesFromCommonBlock() above
|
// Logging performed by fetchSummariesFromCommonBlock() above
|
||||||
// Clear our common block cache for this peer
|
// Clear our common block cache for this peer
|
||||||
@ -590,7 +590,7 @@ public class Synchronizer {
|
|||||||
* @throws DataException
|
* @throws DataException
|
||||||
* @throws InterruptedException
|
* @throws InterruptedException
|
||||||
*/
|
*/
|
||||||
public SynchronizationResult fetchSummariesFromCommonBlock(Repository repository, Peer peer, int ourHeight, boolean force, List<BlockSummaryData> blockSummariesFromCommon) throws DataException, InterruptedException {
|
public SynchronizationResult fetchSummariesFromCommonBlock(Repository repository, Peer peer, int ourHeight, boolean force, List<BlockSummaryData> blockSummariesFromCommon, boolean infoLogWhenNotFound) throws DataException, InterruptedException {
|
||||||
// Start by asking for a few recent block hashes as this will cover a majority of reorgs
|
// Start by asking for a few recent block hashes as this will cover a majority of reorgs
|
||||||
// Failing that, back off exponentially
|
// Failing that, back off exponentially
|
||||||
int step = INITIAL_BLOCK_STEP;
|
int step = INITIAL_BLOCK_STEP;
|
||||||
@ -619,8 +619,12 @@ public class Synchronizer {
|
|||||||
blockSummariesBatch = this.getBlockSummaries(peer, testSignature, step);
|
blockSummariesBatch = this.getBlockSummaries(peer, testSignature, step);
|
||||||
|
|
||||||
if (blockSummariesBatch == null) {
|
if (blockSummariesBatch == null) {
|
||||||
// No response - give up this time
|
if (infoLogWhenNotFound)
|
||||||
LOGGER.info(String.format("Error while trying to find common block with peer %s", peer));
|
LOGGER.info(String.format("Error while trying to find common block with peer %s", peer));
|
||||||
|
else
|
||||||
|
LOGGER.debug(String.format("Error while trying to find common block with peer %s", peer));
|
||||||
|
|
||||||
|
// No response - give up this time
|
||||||
return SynchronizationResult.NO_REPLY;
|
return SynchronizationResult.NO_REPLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user