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

*: 'load data' should not use latches #6927

Merged
merged 7 commits into from
Jul 2, 2018

Conversation

tiancaiamao
Copy link
Contributor

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)?

  • Bug fix (non-breaking change which fixes an issue)

How has this PR been tested (mandatory)?

  • unit text

Refer to a related PR or issue link (optional)

#6418

@coocood @AndreMouche @shenli

'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.
@zhexuany zhexuany added the require-LGT3 Indicates that the PR requires three LGTM. label Jun 28, 2018
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.
Copy link
Member

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.

@tiancaiamao tiancaiamao removed the require-LGT3 Indicates that the PR requires three LGTM. label Jun 28, 2018
"github.com/pingcap/tidb/table"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/testkit"
)

type testBypassSuite struct{}
Copy link
Member

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?

Copy link
Contributor Author

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.

@tiancaiamao tiancaiamao added the type/bugfix This PR fixes a bug. label Jun 28, 2018
@coocood
Copy link
Member

coocood commented Jun 28, 2018

LGTM

@tiancaiamao
Copy link
Contributor Author

PTAL @zhexuany

@tiancaiamao
Copy link
Contributor Author

PTAL @jackysp

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

zhexuany
zhexuany previously approved these changes Jun 29, 2018
Copy link
Contributor

@zhexuany zhexuany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhexuany zhexuany added the status/LGT2 Indicates that a PR has LGTM 2. label Jun 29, 2018
@zhexuany
Copy link
Contributor

@tiancaiamao Please resolve conflict.

@coocood coocood merged commit 8db5811 into pingcap:master Jul 2, 2018
@tiancaiamao tiancaiamao deleted the load-data-latch branch November 21, 2018 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants