Skip to content

Commit ed3560d

Browse files
committed
db: test that manual compactions aren't blocked by problem spans
1 parent fac9d89 commit ed3560d

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

compaction_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3021,6 +3021,17 @@ func TestCompactionCorruption(t *testing.T) {
30213021
return !hasExternalFiles(d)
30223022
})
30233023

3024+
case "manual-compaction":
3025+
if err := d.Compact([]byte("a"), []byte("z9999999"), true /* parallelize */); err != nil {
3026+
td.Fatalf(t, "manual compaction failed: %s", err)
3027+
}
3028+
v := d.DebugCurrentVersion()
3029+
for i := 0; i < numLevels-1; i++ {
3030+
if v.Levels[i].Len() > 0 {
3031+
td.Fatalf(t, "expected no tables on L%d", i)
3032+
}
3033+
}
3034+
30243035
default:
30253036
return fmt.Sprintf("unknown command: %s", td.Cmd)
30263037
}

testdata/compaction_corruption

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ y#0,SET = yvalue
1616
z#0,SET = zvalue
1717
----
1818

19-
ingest-external file1
19+
ingest-external
2020
file1 bounds=(a,c0)
2121
file2 bounds=(d,w0)
2222
file3 bounds=(x,z0)
@@ -46,3 +46,29 @@ expire-spans
4646
# files.
4747
wait-for-no-external-files
4848
----
49+
50+
build-remote file4-not-there
51+
a#0,SET = avalue
52+
u#0,SET = uvalue
53+
z#0,SET = zvalue
54+
----
55+
56+
ingest-external
57+
file4 bounds=(a,z0)
58+
----
59+
60+
# Verify that a problem span is set.
61+
wait-for-problem-span
62+
----
63+
64+
stop-workload
65+
----
66+
67+
# Make file4 appear.
68+
move-remote-object file4-not-there file4
69+
----
70+
file4-not-there -> file4
71+
72+
# Verify that a manual compaction goes through despite the problem span.
73+
manual-compaction
74+
----

0 commit comments

Comments
 (0)