pillowfight generates identical "random" values when min and max value size are identical
Description
Observed Behaviour When loading data using pillowfight with with --json and --random-body; while the body is random, it seems to be the same every time - e.g.:
Results in documents:
Expected Behaviour When asking for "random" bodies I would expect to see each document having a different random value, not them all having the same one.
Analysis
Digging into the pillowfight code, this appears to be due to using a min and max value size which are the same (232 in this case) - only one "representative" random value is generated:
docgen.h
Note the minsz == maxsz condition which only adds one element to set of returned values.
I'm marking this as a bug as while one could argue this behaviour is "correct", IMO this breaks the principle of least surprise - if a user asks for "random" bodies they probably expect multiple different random bodies; not just the same one over and over...
Environment
None
Gerrit Reviews
None
Release Notes Description
None
Activity
Show:
CB robot March 28, 2024 at 5:47 AM
Build couchbase-server-7.2.5-7575 contains libcouchbase commit 0a9d386 with commit message: : allow to generate more randomized bodies in pillowfight
CB robot December 19, 2023 at 1:39 AM
Build couchbase-server-7.1.6-3969 contains libcouchbase commit 0a9d386 with commit message: : allow to generate more randomized bodies in pillowfight
CB robot April 27, 2023 at 9:58 AM
Build couchbase-server-8.0.0-1307 contains libcouchbase commit 0a9d386 with commit message: : allow to generate more randomized bodies in pillowfight
CB robot April 26, 2023 at 12:28 PM
Build couchbase-server-7.5.0-4219 contains libcouchbase commit 0a9d386 with commit message: : allow to generate more randomized bodies in pillowfight
The following command pre-generates 3 documents (because size range does not allow to vary size). And in total, it populates 10 documents, which values will cycle the random bodies from the pool:
These are generated documents:
Fixed
Pinned fields
Click on the next to a field label to start pinning.
Observed Behaviour
When loading data using pillowfight with with
--json
and--random-body
; while the body is random, it seems to be the same every time - e.g.:Results in documents:
Expected Behaviour
When asking for "random" bodies I would expect to see each document having a different random value, not them all having the same one.
Analysis
Digging into the pillowfight code, this appears to be due to using a min and max value size which are the same (232 in this case) - only one "representative" random value is generated:
docgen.h
Note the
minsz == maxsz
condition which only adds one element to set of returned values.I'm marking this as a bug as while one could argue this behaviour is "correct", IMO this breaks the principle of least surprise - if a user asks for "random" bodies they probably expect multiple different random bodies; not just the same one over and over...