H1 integration bound: the heartbeat and the counter tests hold under load
TestTheRuntimeSaysItIsThereEveryInterval slept 70 ms and wanted three
beats at 20 ms: a loaded machine that did not schedule the heartbeat in
time failed it (main.20's integration step on the build node); and its
stop returned before the heartbeat's goroutine ended, so a beat could be
said after it ("said after it was stopped"). The ticks are now the
caller's (keep, beside Keep's own ticker), the test drives them and waits
on each beat, and stop returns once nothing more is said. Pinned to one
processor at idle priority beside six busy loops, the old test failed 13
of 100 runs; the new passes 100 of 100.
TestTwoWritersIncrementingOneCounterOnTheBusLoseNoUpdate bounded a
writer's tries at 1000, a guess: on one processor the scheduler lets one
writer win every round and the other lost its 1000 tries every time. A
write is lost only to the other writer's write, so the bound is the
other's count plus one.
Builds: design 47 H §774; principle 11
This commit is contained in:
@@ -78,7 +78,10 @@ func increment(b launch.Bus, key string, attempts int) (n uint64, lost int, err
|
||||
|
||||
// Two writers incrementing one counter a thousand times each, against a real bus, end at two thousand:
|
||||
// every number handed out once and none lost, because the runtime writes only at the revision read
|
||||
// (novox/hq research 042: an issue's number is handed out once).
|
||||
// (novox/hq research 042: an issue's number is handed out once). A write is lost only to the other writer's
|
||||
// write, so one increment loses at most as many times as the other writer increments: that, not a guess,
|
||||
// is the bound on its tries, and a machine whose scheduler lets one writer win every round still passes
|
||||
// (one processor starved a writer of a thousand tries; principle 11, design 47 H §774).
|
||||
func TestTwoWritersIncrementingOneCounterOnTheBusLoseNoUpdate(t *testing.T) {
|
||||
b := counterBus(t)
|
||||
const each = 1000
|
||||
@@ -91,7 +94,7 @@ func TestTwoWritersIncrementingOneCounterOnTheBusLoseNoUpdate(t *testing.T) {
|
||||
go func(w int) {
|
||||
defer wg.Done()
|
||||
for i := 0; i < each; i++ {
|
||||
n, l, err := increment(b, "issue", 1000)
|
||||
n, l, err := increment(b, "issue", each+1)
|
||||
lost[w] += l
|
||||
if err != nil {
|
||||
errs[w] = err
|
||||
|
||||
Reference in New Issue
Block a user