Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TableGC flaky test by reducing check interval #8270

Merged
merged 1 commit into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion go/test/endtoend/tabletmanager/tablegc/tablegc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func TestMain(m *testing.M) {
"-heartbeat_enable",
"-heartbeat_interval", "250ms",
"-gc_check_interval", "5s",
"-gc_purge_check_interval", "5s",
"-table_gc_lifecycle", "hold,purge,evac,drop",
}
// We do not need semiSync for this test case.
Expand Down Expand Up @@ -323,7 +324,7 @@ func TestPurge(t *testing.T) {
checkTableRows(t, tableName, 1024)
}

time.Sleep(2 * time.Minute) // purgeReentranceInterval
time.Sleep(15 * time.Second) // purgeReentranceInterval
{
// We're now both beyond table's timestamp as well as a tableGC interval
exists, _, err := tableExists(tableName)
Expand Down
8 changes: 5 additions & 3 deletions go/vt/vttablet/tabletserver/gc/tablegc.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ import (
)

const (
leaderCheckInterval = 5 * time.Second
purgeReentranceInterval = 1 * time.Minute
leaderCheckInterval = 5 * time.Second
// evacHours is a hard coded, reasonable time for a table to spend in EVAC state
evacHours = 72
throttlerAppName = "tablegc"
Expand All @@ -51,6 +50,9 @@ const (
// checkInterval marks the interval between looking for tables in mysql server/schema
var checkInterval = flag.Duration("gc_check_interval", 1*time.Hour, "Interval between garbage collection checks")

// purgeReentranceInterval marks the interval between searching tables to purge
var purgeReentranceInterval = flag.Duration("gc_purge_check_interval", 1*time.Minute, "Interval between purge discovery checks")

// gcLifecycle is the sequence of steps the table goes through in the process of getting dropped
var gcLifecycle = flag.String("table_gc_lifecycle", "hold,purge,evac,drop", "States for a DROP TABLE garbage collection cycle. Default is 'hold,purge,evac,drop', use any subset ('drop' implcitly always included)")

Expand Down Expand Up @@ -209,7 +211,7 @@ func (collector *TableGC) Operate(ctx context.Context) {
}
tableCheckTicker := addTicker(*checkInterval)
leaderCheckTicker := addTicker(leaderCheckInterval)
purgeReentranceTicker := addTicker(purgeReentranceInterval)
purgeReentranceTicker := addTicker(*purgeReentranceInterval)

log.Info("TableGC: operating")
for {
Expand Down