• Tom Lane's avatar
    Fix newly-introduced issues in pgbench. · 9779bda8
    Tom Lane authored
    The result of FD_ISSET() doesn't necessarily fit in a bool, though
    assigning it to one might accidentally work depending on platform and which
    socket FD number is being inquired of.  Rewrite to test it with if(),
    rather than making any specific assumption about the result width,
    to match the way every other such call in PG is written.
    
    Don't break out of the input_mask-filling loop after finding the first
    client that we're waiting for results from.  That mostly breaks parallel
    query management.
    
    Also, if we choose not to call select(), be sure to clear out any bits
    the mask-filling loop might have set, so that we don't accidentally call
    doCustom for clients we don't know have input.  Doing so would likely
    be harmless, but it's a waste of cycles and doesn't seem to be intended.
    
    Make this_usec wide enough.  (Yeah, the value would usually fit in an
    int, but then why are we using int64 everywhere else?)
    
    Minor cosmetic adjustments, mostly comment improvements.
    
    Problems introduced by commit 12788ae4.  The first issue was discovered
    by buildfarm testing, the others by code review.
    9779bda8
pgbench.c 119 KB