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

[Do Not Merge] For Benchmarking Only #17839

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
81 changes: 42 additions & 39 deletions go/vt/vttablet/tabletserver/tx/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc"
"vitess.io/vitess/go/vt/servenv"
"vitess.io/vitess/go/vt/sqlparser"
"vitess.io/vitess/go/vt/vterrors"
)

type (
Expand Down Expand Up @@ -124,55 +123,59 @@

// RecordQueryDetail records the query and tables against this transaction.
func (p *Properties) RecordQueryDetail(query string, tables []string) {
if p == nil {
return
}
p.Queries = append(p.Queries, Query{
Sql: query,
Tables: tables,
})
return

Check failure on line 126 in go/vt/vttablet/tabletserver/tx/api.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

S1023: redundant `return` statement (gosimple)
// if p == nil {
// return
// }
// p.Queries = append(p.Queries, Query{
// Sql: query,
// Tables: tables,
// })
}

// RecordQueryDetail records the query and tables against this transaction.
func (p *Properties) RecordSavePointDetail(savepoint string) {
if p == nil {
return
}
p.Queries = append(p.Queries, Query{
Savepoint: savepoint,
})
return

Check failure on line 138 in go/vt/vttablet/tabletserver/tx/api.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

S1023: redundant `return` statement (gosimple)
// if p == nil {
// return
// }
// p.Queries = append(p.Queries, Query{
// Savepoint: savepoint,
// })
}

func (p *Properties) RollbackToSavepoint(savepoint string) error {
if p == nil {
return nil
}
for i, query := range p.Queries {
if query.Savepoint == savepoint {
p.Queries = p.Queries[:i]
return nil
}
}

return vterrors.VT13001(fmt.Sprintf("savepoint %s not found", savepoint))
return nil
// if p == nil {
// return nil
// }
// for i, query := range p.Queries {
// if query.Savepoint == savepoint {
// p.Queries = p.Queries[:i]
// return nil
// }
// }
//
// return vterrors.VT13001(fmt.Sprintf("savepoint %s not found", savepoint))
}

// RecordQuery records the query and extract tables against this transaction.
func (p *Properties) RecordQuery(query string, parser *sqlparser.Parser) {
if p == nil {
return
}
stmt, err := parser.Parse(query)
if err != nil {
// This should neven happen, but if it does,
// we would not be able to block cut-overs on this query.
return
}
tables := sqlparser.ExtractAllTables(stmt)
p.Queries = append(p.Queries, Query{
Sql: query,
Tables: tables,
})
return

Check failure on line 164 in go/vt/vttablet/tabletserver/tx/api.go

View workflow job for this annotation

GitHub Actions / Static Code Checks Etc

S1023: redundant `return` statement (gosimple)
// if p == nil {
// return
// }
// stmt, err := parser.Parse(query)
// if err != nil {
// // This should neven happen, but if it does,
// // we would not be able to block cut-overs on this query.
// return
// }
// tables := sqlparser.ExtractAllTables(stmt)
// p.Queries = append(p.Queries, Query{
// Sql: query,
// Tables: tables,
// })
}

// InTransaction returns true as soon as this struct is not nil
Expand Down
Loading