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

*: make SET TRANSACTION ISOLATION LEVEL READ COMMITTED take effect #3619

Merged
merged 9 commits into from
Jul 17, 2017

Conversation

tiancaiamao
Copy link
Contributor

it is equivalent to setting "tx_isolation" variable.
if the value is READ-COMMITTED, set the transaction isolation level option.

@disksing @zimulala @shenli

@tiancaiamao tiancaiamao force-pushed the tiancaiamao/read-committed branch from c4c2ae6 to f4ed935 Compare July 4, 2017 08:01
tp.Charset, tp.Collate = parser.charset, parser.collation
expr := ast.NewValueExpr($3)
expr.SetType(tp)
$$ = &ast.VariableAssignment{Name: "tx_isolation", Value: expr, IsSystem: true}
Copy link
Member

Choose a reason for hiding this comment

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

Use a const for tx_isolation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tx_isolation is a session variable name.
I don't want to put it in other places except variable package.
I also don't like parser package to import variable package.
So use the string "tx_isolation" is the best compromise.

session.go Outdated
@@ -1130,6 +1130,9 @@ func (s *session) ActivePendingTxn() error {
if err != nil {
return errors.Trace(err)
}
if s.sessionVars.Systems[variable.TxnIsolation] == "READ-COMMITTED" {
Copy link
Member

Choose a reason for hiding this comment

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

Use const for READ-COMMITTED.

@disksing
Copy link
Contributor

disksing commented Jul 4, 2017

Any need to print error when user wants to set unsupported levels?

it is equivalent to setting "tx_isolation" variable.
if the value is READ-COMMITTED, set the transaction isolation level option.
@tiancaiamao tiancaiamao force-pushed the tiancaiamao/read-committed branch from f4ed935 to e38a2fc Compare July 4, 2017 11:16
@disksing
Copy link
Contributor

disksing commented Jul 4, 2017

Need to set kv.Request too.

@tiancaiamao tiancaiamao added the DNM label Jul 5, 2017
@tiancaiamao
Copy link
Contributor Author

Begin;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT * FROM T;    // isolation level should take effect in this query.
COMMIT;

@tiancaiamao
Copy link
Contributor Author

PTAL @disksing @shenli @zimulala

@disksing
Copy link
Contributor

LGTM

@shenli shenli removed the DNM label Jul 17, 2017
@tiancaiamao tiancaiamao added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 17, 2017
@shenli
Copy link
Member

shenli commented Jul 17, 2017

LGTM

@hanfei1991 hanfei1991 merged commit d8aaa22 into master Jul 17, 2017
@hanfei1991 hanfei1991 deleted the tiancaiamao/read-committed branch July 17, 2017 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants