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

Commit

Permalink
address an unfortunate side-effect of a notification storm that was c…
Browse files Browse the repository at this point in the history
…aused by the fix for other sync issues.
  • Loading branch information
pmesnier committed Dec 20, 2017
1 parent 2ef633e commit cdb55c5
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 3 deletions.
14 changes: 11 additions & 3 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,7 @@ namespace eosio {
}

void sync_manager::start_sync( connection_ptr c, uint32_t target) {
#if 0
if( !syncing()) {
sync_last_requested_num = chain_plug->chain().head_block_num();
fc_dlog(logger, "Inform other open connections that we are syncing");
Expand All @@ -1246,6 +1247,12 @@ namespace eosio {
}
}
}
#endif

if (!syncing()) {
fc_dlog( logger, "We are already caught up.");
return;
}
ilog( "Catching up with chain, our last req is ${cc}, theirs is ${t} peer ${p}", ( "cc",sync_last_requested_num)("t",target)("p",c->peer_name()));
if( target > sync_known_lib_num) {
sync_known_lib_num = target;
Expand Down Expand Up @@ -1547,8 +1554,9 @@ namespace eosio {
//--------------------------------
// sync need checkz;
//
// 0. my head block id == peer head id means we are all caugnt up block wize
// 1. my lib < peer lib - start sync locally
// -1. another connection has already decided we are synching so continue with this connection
// 0. my head block id == peer head id means we are all caugnt up block wise
// 1. my head block num < peer lib - start sync locally
// 2. my lib > peer lib - send an last_irr_catch_up notice if not the first generation
//
// 3 my head block num <= peer head block num - update sync state and send a catchup request
Expand Down Expand Up @@ -1611,7 +1619,7 @@ namespace eosio {
c->syncing = true;
return;
}
elog ("sync check failed to resolbe status");
elog ("sync check failed to resolve status");
return;
#if 0
if( peer_lib > head || sync_master->syncing() ) {
Expand Down
107 changes: 107 additions & 0 deletions tests/p2p_tests/sync/message_storm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/bin/bash

###############################################################
# -p <producing nodes count>
# -n <total nodes>
# -s <topology>
# -d <delay between nodes startup>
###############################################################

pnodes=21
topo=mesh
delay=5

args=`getopt p:n:s:d: $*`
if [ $? == 0 ]; then

set -- $args
for i; do
case "$i"
in
-p) pnodes=$2;
shift; shift;;
-n) total_nodes=$2;
shift; shift;;
-d) delay=$2;
shift; shift;;
-s) topo="$2";
shift; shift;;
--) shift;
break;;
esac
done
else
echo "huh we got err $?"
if [ -n "$1" ]; then
pnodes=$1
if [ -n "$2" ]; then
topo=$2
if [ -n "$3" ]; then
total_nodes=$3
fi
fi
fi
fi

total_nodes="${total_nodes:-`echo $pnodes`}"

rm -rf tn_data_*
if [ "$delay" == 0 ]; then
programs/launcher/launcher -p $pnodes -n $total_nodes -s $topo
else
programs/launcher/launcher -p $pnodes -n $total_nodes -s $topo -d $delay --eosd "--log-level-net-plugin debug"
fi

sleep 7
echo "start" > test.out
port=8888
endport=`expr $port + $total_nodes`
echo endport = $endport
while [ $port -ne $endport ]; do
programs/eosc/eosc --port $port get block 1 >> test.out 2>&1;
port=`expr $port + 1`
done

grep 'producer"' test.out | tee summary | sort -u -k2 | tee unique
prodsfound=`wc -l < unique`
lines=`wc -l < summary`
if [ $lines -eq $total_nodes -a $prodsfound -eq 1 ]; then
echo all synced
# programs/launcher/launcher -k 15
# exit
fi
echo $lines reports out of $total_nodes and prods = $prodsfound
sleep 18
programs/eosc/eosc --port 8888 get block 5
sleep 15
programs/eosc/eosc --port 8888 get block 10
sleep 15
programs/eosc/eosc --port 8888 get block 15
sleep 15
programs/eosc/eosc --port 8888 get block 20
sleep 15
echo "pass 2" > test.out
port=8888
while [ $port -ne $endport ]; do
programs/eosc/eosc --port $port get block 1 >> test.out 2>&1;
port=`expr $port + 1`
done


grep 'producer"' test.out | tee summary | sort -u -k2 | tee unique
prodsfound=`wc -l < unique`
lines=`wc -l < summary`
if [ $lines -eq $total_nodes -a $prodsfound -eq 1 ]; then
echo all synced
programs/launcher/launcher -k 15
exit
fi
echo ERROR: $lines reports out of $total_nodes and prods = $prodsfound
programs/launcher/launcher -k 15
echo =================================================================
echo Contents of tn_data_00/config.ini:
cat tn_data_00/config.ini
echo =================================================================
echo Contents of tn_data_00/stderr.txt:
cat tn_data_00/stderr.txt
exit 1

0 comments on commit cdb55c5

Please sign in to comment.