[ovs-dev] [PATCH v2 2/2] ovn: Test for full logical flow processing in ovn-controller

Jakub Sitnicki jkbs at redhat.com
Fri Jun 1 13:49:46 UTC 2018


On Thu, 31 May 2018 10:14:50 -0700
Han Zhou <zhouhan at gmail.com> wrote:

> > +# vec_sub VEC_A VEC_B
> > +#
> > +# Subtracts two vectors:
> > +#
> > +#     VEC_A = [a1, a2, ...]
> > +#     VEC_B = [b1, b2, ...]
> > +#     OUT = [(a1 - b1), (a2 - b2), ...]
> > +#
> > +# VEC_A and VEC_B must be lists of values separated by a character from  
> $IFS.
> > +vec_sub() {
> > +    local a b i j
> > +
> > +    i=0
> > +    for a in $1; do
> > +        j=0
> > +        for b in $2; do
> > +            if test $i -eq $j; then
> > +                expr $a - $b
> > +                break
> > +            fi
> > +            j=`expr $j + 1`
> > +        done
> > +        i=`expr $i + 1`
> > +    done  
> 
> The loop is O(n^2) while ideally it can be O(n). I think it is not a big
> deal since it is testing, and I don't have better idea how to achieve O(n)
> while keeping the current convenient input parameters. Just to confirm it
> is not supposed to be used in scalability testing environment to calculate
> counters for thousands of sandboxes, right?

Oh, no, I would not be brave enough to go testing 1000's of sandboxes
with shell scripts. For that scale I would rewrite the whole test to
Python probably.

This is the best I could come up with, w/o going into Bash arrays. It
is intended only for the scale we test at in the automated test suite.
So just a few sandboxes as most.

Thanks for the review,
-Jakub


More information about the dev mailing list