From 70029b748006414f6244358a6cabb7c5fab80e96 Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Fri, 21 Feb 2025 13:50:34 +0530 Subject: [PATCH] wip Signed-off-by: Harshit Gangal --- go/vt/vttablet/tabletserver/tx/api.go | 81 ++++++++++++++------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/go/vt/vttablet/tabletserver/tx/api.go b/go/vt/vttablet/tabletserver/tx/api.go index a7bc4389b89..f42bcb86486 100644 --- a/go/vt/vttablet/tabletserver/tx/api.go +++ b/go/vt/vttablet/tabletserver/tx/api.go @@ -26,7 +26,6 @@ import ( 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 ( @@ -124,55 +123,59 @@ var txNames = map[ReleaseReason]string{ // 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 + // 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 + // 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 + // 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