diff --git a/scripts/generate_dump b/scripts/generate_dump index a566a2e763..41bbc0ccd0 100755 --- a/scripts/generate_dump +++ b/scripts/generate_dump @@ -874,7 +874,7 @@ save_redis() { # Returns: # route ############################################################################### -get_route_table_size_by_asic_id() { +get_route_table_size_by_asic_id_and_ipver() { local asic_id="$1" local ip_ver="$2" local filepath="/tmp/route_summary.txt" @@ -930,21 +930,27 @@ save_saidump_by_route_size() { for (( i=0; i<$NUM_ASICS; i++ )) do - route_size_ipv4=`get_route_table_size_by_asic_id $i ipv4` + route_size_ipv4=`get_route_table_size_by_asic_id_and_ipver $i ipv4` ret=$? + if [ $ret -ne 0 ]; then - echo "get_route_table_size_by_asic_id $i ipv4 failed." + echo "Get route table's size by asicid $i and ipv4 failed." return $ret fi - route_size_ipv6=`get_route_table_size_by_asic_id $i ipv6` + + route_size_ipv6=`get_route_table_size_by_asic_id_and_ipver $i ipv6` ret=$? + if [ $ret -ne 0 ]; then - echo "get_route_table_size_by_asic_id $i ipv6 failed." + echo "Get route table's size by asicid $i and ipv6 failed." return $ret fi - if [[ $route_size_ipv4 -gt $ROUTE_TAB_LIMIT_DIRECT_ITERATION || - $route_size_ipv6 -gt $ROUTE_TAB_LIMIT_DIRECT_ITERATION ]]; then - echo "dump by using Redis save" + + route_size=`expr $route_size_ipv4 + $route_size_ipv6` + echo "The route table's size is $route_size(ipv4 $route_size_ipv4, ipv6 $route_size_ipv6)" + + if [[ $route_size -gt $ROUTE_TAB_LIMIT_DIRECT_ITERATION ]]; then + echo "Dump by using Redis SAVE." if [[ ( "$NUM_ASICS" == 1 ) ]] ; then save_cmd "saidump.sh" "saidump" @@ -953,6 +959,7 @@ save_saidump_by_route_size() { fi else echo "dump by using direct iteration" + if [[ ( "$NUM_ASICS" == 1 ) ]] ; then save_cmd "docker exec syncd saidump" "saidump" else