-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: 'load data' should not use latches #6927
Conversation
'load data' is not retryable when it meets conflicts, while latches may result in false positive transaction conflicts. so enable latches will lead to 'load data' abort abnormally, even there are no conflicts.
store/tikv/txn.go
Outdated
forUpdate = option.(bool) | ||
var bypassLatch bool | ||
if option := txn.us.GetOption(kv.BypassLatch); option != nil { | ||
bypassLatch = option.(bool) | ||
} | ||
// For update transaction is not retryable, commit directly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update the comment too.
"github.com/pingcap/tidb/table" | ||
"github.com/pingcap/tidb/types" | ||
"github.com/pingcap/tidb/util/testkit" | ||
) | ||
|
||
type testBypassSuite struct{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not reuse the testSuite
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test create a new store to set latch capacity, it's not common in testSuite
.
And if I write it in testSuite
, I found TestShow
fail:
FAIL: show_test.go:35: testSuite.TestShow
show_test.go:141:
result = tk.MustQuery(testSQL)
/media/genius/OS/project/src/github.com/pingcap/tidb/util/testkit/testkit.go:180:
tk.c.Assert(errors.ErrorStack(err), check.Equals, "", comment)
... obtained string = "" +
... "/media/genius/OS/project/src/github.com/pingcap/tidb/store/tikv/snapshot.go:312: tikv aborts txn: leveldb: closed\n" +
... "/media/genius/OS/project/src/github.com/pingcap/tidb/store/tikv/snapshot.go:314: \n" +
... "/media/genius/OS/project/src/github.com/pingcap/tidb/store/tikv/snapshot.go:269: \n" +
... "/media/genius/OS/project/src/github.com/pingcap/tidb/store/tikv/snapshot.go:218: \n" +
... "/media/genius/OS/project/src/github.com/pingcap/tidb/kv/union_store.go:186: \n" +
... "/media/genius/OS/project/src/github.com/pingcap/tidb/store/tikv/txn.go:96: \n" +
... "/media/genius/OS/project/src/github.com/pingcap/tidb/structure/list.go:220: \n" +
... "/media/genius/OS/project/src/github.com/pingcap/tidb/structure/list.go:164: \n" +
... "/media/genius/OS/project/src/github.com/pingcap/tidb/meta/meta.go:499: \n" +
... "/media/genius/OS/project/src/github.com/pingcap/tidb/meta/meta.go:512: \n" +
... "/media/genius/OS/project/src/github.com/pingcap/tidb/util/admin/admin.go:52: \n" +
... "/media/genius/OS/project/src/github.com/pingcap/tidb/ddl/stat.go:58: \n" +
... "/media/genius/OS/project/src/github.com/pingcap/tidb/kv/txn.go:57: \n" +
So I just create a new Suite
.
LGTM |
PTAL @zhexuany |
PTAL @jackysp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@tiancaiamao Please resolve conflict. |
What have you changed? (mandatory)
'load data' is not retryable when it meets conflicts, while latches may result in
false positive transaction conflicts. so enable latches will lead to 'load data'
abort abnormally, even there are no conflicts.
What are the type of the changes (mandatory)?
How has this PR been tested (mandatory)?
Refer to a related PR or issue link (optional)
#6418
@coocood @AndreMouche @shenli