• antirez's avatar
    redis-benchmark: changes to random arguments substitution. · 689829f2
    antirez authored
    Before this commit redis-benchmark supported random argumetns in the
    form of :rand:000000000000. In every string of that form, the zeros were
    replaced with a random number of 12 digits at every command invocation.
    
    However this was far from perfect as did not allowed to generate simply
    random numbers as arguments, there was always the :rand: prefix.
    
    Now instead every argument in the form __rand_int__ is replaced with a
    12 digits number. Note that "__rand_int__" is 12 characters itself.
    
    In order to implement the new semantic, it was needed to change a few
    thigns in the internals of redis-benchmark, as new clients are created
    cloning old clients, so without a stable prefix such as ":rand:" the old
    way of cloning the client was no longer able to understand, from the old
    command line, what was the position of the random strings to substitute.
    
    Now instead a client structure is passed as a reference for cloning, so
    that we can directly clone the offsets inside the command line.
    689829f2
redis-benchmark.c 26.8 KB