The Wayback Machine - https://web.archive.org/web/20201121010213/https://github.com/github/gh-ost/issues/753
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

Intermittent failures in localtests #753

Closed
zmoazeni opened this issue Jun 7, 2019 · 2 comments
Closed

Intermittent failures in localtests #753

zmoazeni opened this issue Jun 7, 2019 · 2 comments

Comments

@zmoazeni
Copy link
Contributor

@zmoazeni zmoazeni commented Jun 7, 2019 •

Per #750 I was going to try digging into some possible causes for the intermittent failures in localtests.

I now have a way to reliable reproduce it. zmoazeni@b3955d1

If you read the commit, it'll explain how to reproduce (just run ./force-failure). It may take ~4-15 iterations before you run into the issue. It doesn't take that long. About a minute or two.

The problem seems to be in

gh-ost/go/logic/applier.go

Lines 711 to 723 in ffc6c40

func (this *Applier) ExpectProcess(sessionId int64, stateHint, infoHint string) error {
found := false
query := `
select id
from information_schema.processlist
where
id != connection_id()
and ? in (0, id)
and state like concat('%', ?, '%')
and info like concat('%', ?, '%')
`
err := sqlutils.QueryRowsMap(this.db, query, func(m sqlutils.RowMap) error {
found = true

The timing issue is that at the time we query, the sessionId does exist, however neither the state nor the info columns are populated. So we end up getting no rows/found=false based on our hints in the where clause and we return an error.

Update: A followup query does include both. Which made it hard to debug at first, but I decided to push the logic into Go instead which highlighted the problem.

Here's the output of a full run for me that failed on the 3rd attempt (it says 2nd attempt, but...off by one errors :/)

https://gist.github.com/zmoazeni/e40ba08113bc5f8e3843443d51e03b66


I wonder what you think @shlomi-noach (or anyone else). Do you think we should retry this query? Should we do some special handling on the hint criteria? Something else entirely?

@zmoazeni
Copy link
Contributor Author

@zmoazeni zmoazeni commented Jun 8, 2019

Two things worked for me to fix this (50 uninterrupted test runs).

Of the two, I think the 2nd probably makes more sense. Though it's still a guess how long it should wait (unless we make it a command line parameter). I don't know if allowing retries in the localtests is the right approach.

There may be a more appropriate way to deal with this by not using the hints for the query. I'm not sure how you feel about that.

@shlomi-noach
Copy link
Contributor

@shlomi-noach shlomi-noach commented Jun 10, 2019

@zmoazeni thank you for investigating!

I wonder what you think @shlomi-noach (or anyone else). Do you think we should retry this query?

The query is indeed being retried as per:

gh-ost/go/logic/migrator.go

Lines 654 to 667 in ffc6c40

waitForRename := func() error {
if atomic.LoadInt64(&tableRenameKnownToHaveFailed) == 1 {
// We return `nil` here so as to avoid the `retry`. The RENAME has failed,
// it won't show up in PROCESSLIST, no point in waiting
return nil
}
return this.applier.ExpectProcess(renameSessionId, "metadata lock", "rename")
}
// Wait for the RENAME to appear in PROCESSLIST
if err := this.retryOperation(waitForRename, true); err != nil {
// Abort! Release the lock
okToUnlockTable <- true
return err
}

I don't know if allowing retries in the localtests is the right approach.

I'm surprised to see --default-retries=1 in the localtests. I seem to have added this 3 years ago in 2faa27a, but I did not explicitly comment about this and I don't have a recollection of why this was done.

I'm all for using --default-retries=3 (because why not).
Yeah, retries are perfectly legit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.