storj/satellite/audit
paul cannon 231c783698 satellite/audit: fix reservoir sampling bias
While researching logs from a large set of audits, I noticed that nearly
all of them had streamIDs starting with 0 or 1. This seemed very odd,
because streamIDs are supposed to be pretty much entirely random, and
every hex digit from 0-f should have been represented with roughly equal
frequency.

It turned out that our A-Chao implementation of reservoir sampling is
flawed. As far as we can tell, so is the Wikipedia implementation. No
one has yet reviewed the original 1982 paper by Dr. Chao in enough
detail to know where the error originated, but we do know that we have
been auditing segments near the beginning of the segment loop (low
streamIDs) far more often than segments near the end of the segment loop
(high streamIDs).

This change uses an algorithm Wikipedia calls "A-Res" instead, and adds
a test to check for that sort of bias creeping back in somehow. A-Res
will be slightly slower than A-Chao, because of a few extra steps that
need to be done, but it does appear to be selecting items uniformly.

Change-Id: I45eba4c522bafc729cebe2aab6f3fe65cd6336be
2022-12-09 18:16:58 -06:00
..
audit_test.go satellite/audit: use db for auditor queue 2022-11-22 14:04:00 +00:00
chore.go satellite/audit: help performance of pushing to audit queue 2022-11-29 15:37:49 +00:00
collector_test.go satellite/audit: optimize loop observer 2022-10-02 22:24:37 +00:00
collector.go satellite/audit: optimize loop observer 2022-10-02 22:24:37 +00:00
containment2_test.go satellite/{satellitedb,audit}: add NewContainment 2022-12-07 18:03:37 +00:00
containment_test.go satellite/{audit, reputation}: fix potential nodes reputation status 2022-01-06 21:05:59 +00:00
containment.go satellite/{satellitedb,audit}: add NewContainment 2022-12-07 18:03:37 +00:00
cryptosource.go all: fix dots 2020-07-16 14:58:28 +00:00
disqualification_test.go all: reformat comments as required by gofmt 1.19 2022-08-10 18:24:55 +00:00
getshare_test.go satellite/{satellitedb,audit}: add NewContainment 2022-12-07 18:03:37 +00:00
integration_test.go satellite/audit: use db for auditor queue 2022-11-22 14:04:00 +00:00
pieces_test.go satellite/repair: update audit records during repair 2021-09-24 00:48:13 +00:00
pieces.go satellite/repair: move over audit.Pieces 2022-09-22 16:43:03 +00:00
queue.go satellite/audit: Split Reverifier from Verifier 2022-12-05 09:55:49 -06:00
reporter_test.go satellite/reputation: reconfigure lambda and alpha 2022-08-17 18:52:53 +00:00
reporter.go satellite/{satellitedb,audit}: add NewContainment 2022-12-07 18:03:37 +00:00
reservoir_test.go satellite/audit: fix reservoir sampling bias 2022-12-09 18:16:58 -06:00
reservoir.go satellite/audit: fix reservoir sampling bias 2022-12-09 18:16:58 -06:00
reverifier_test.go satellite/audit: change signature of ReverifyPiece 2022-12-07 18:32:42 +00:00
reverifier.go satellite/audit: change signature of ReverifyPiece 2022-12-07 18:32:42 +00:00
reverify_test.go satellite/{satellitedb,audit}: add NewContainment 2022-12-07 18:03:37 +00:00
verifier_test.go satellite/{satellitedb,audit}: add NewContainment 2022-12-07 18:03:37 +00:00
verifier_unit_test.go satellite/audit: retire audit.Queues 2022-12-01 13:12:43 +00:00
verifier.go satellite/{satellitedb,audit}: add NewContainment 2022-12-07 18:03:37 +00:00
worker.go satellite/audit: help performance of pushing to audit queue 2022-11-29 15:37:49 +00:00