MDEV-21256: Replace the 64-bit LCG with a 32-bit Galois LFSR
We should not need anywhere near 32 bits of entropy, so we might just limit ourselves to a 32-bit random number generator. Also, it might be cheaper to use exclusive-or, bit shifting and conditional jumps, instead of multiplication and addition. We use relaxed atomic operations on the global random number generator state in order in an attempt to silence any warnings about race conditions. There is an obvious race condition between the load and store in ut_rnd_gen(), but we do not think that it matters much that the state of the random number generator could 'stutter'. This change seems makes the 'uncompress_ops' nondeterministic in innodb_zip.cmp_per_index after the restart. It looks like there is an inherent race condition in the test, because the table could be opened for InnoDB statistics recalculation already before innodb_cmp_per_index_enabled was set. We might end up having uncompress_ops anywhere between 0 and 9, or perhaps even more. Let us remove that part of the test.
Showing
Please register or sign in to comment