go: store/types: value_store_test.go: PR feedback, some comments.

This commit is contained in:
Aaron Son
2025-02-13 14:47:39 -08:00
parent b7e5c01770
commit ea5615dae2

View File

@@ -261,16 +261,21 @@ func TestGCStateDetails(t *testing.T) {
var running atomic.Int32
for i := 0; i < numThreads; i++ {
go func() {
// We attempt to yield a bunch to get parallelism, but
// in reality this test is best-effort looking for
// wonkiness where transitionToOldGenGC allows more
// than one thread to enter GC at a time or something
// like that.
defer wg.Done()
runtime.Gosched()
vs.transitionToOldGenGC()
assert.True(t, running.CompareAndSwap(0, 1))
require.True(t, running.CompareAndSwap(0, 1))
runtime.Gosched()
vs.transitionToNewGenGC()
runtime.Gosched()
vs.transitionToFinalizingGC()
runtime.Gosched()
assert.True(t, running.CompareAndSwap(1, 0))
require.True(t, running.CompareAndSwap(1, 0))
vs.transitionToNoGC()
}()
}