Skip to content

Commit

Permalink
kvserver: fix TestCheckConsistencyInconsistent's VFS use
Browse files Browse the repository at this point in the history
Fix TestCheckConsistencyInconsistent to not access an Engine's filesystem after
closing the Engine. Instead, acquire a vfs.FS directly from the sticky VFS
registry and use that to check for the inconsistency death rattle.

Resolves #110293.
Epic: none
Release note: none
  • Loading branch information
jbowens committed Sep 14, 2023
1 parent 542b506 commit ef71b2f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/kv/kvserver/consistency_queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ func TestCheckConsistencyInconsistent(t *testing.T) {

// Write some arbitrary data only to store on n2. Inconsistent key "e"!
s2 := tc.GetFirstStoreFromServer(t, 1)
s2AuxDir := s2.TODOEngine().GetAuxiliaryDir()
var val roachpb.Value
val.SetInt(42)
// Put an inconsistent key "e" to s2, and have s1 and s3 still agree.
Expand Down Expand Up @@ -411,9 +412,10 @@ func TestCheckConsistencyInconsistent(t *testing.T) {
assert.Equal(t, hashes[0], hashes[2]) // s1 and s3 agree
assert.NotEqual(t, hashes[0], hashes[1]) // s2 diverged

// A death rattle should have been written on s2.
eng := s2.TODOEngine()
f, err := eng.Open(base.PreventedStartupFile(eng.GetAuxiliaryDir()))
// A death rattle should have been written on s2. Note that the VFSes are
// zero-indexed whereas store IDs are one-indexed.
fs := stickyVFSRegistry.Get("1")
f, err := fs.Open(base.PreventedStartupFile(s2AuxDir))
require.NoError(t, err)
b, err := io.ReadAll(f)
require.NoError(t, err)
Expand Down

0 comments on commit ef71b2f

Please sign in to comment.