diff --git a/pkg/schema_store/utils.go b/pkg/schema_store/utils.go index a95e0705..8a4f10b0 100644 --- a/pkg/schema_store/utils.go +++ b/pkg/schema_store/utils.go @@ -178,7 +178,10 @@ func GetTableDefFromDB(db *sql.DB, dbName string, tableName string) (*Table, err } else { column.IsPrimaryKey = false } - if extra.Valid && strings.Contains(strings.ToUpper(extra.String), "GENERATED") { + + // TiDB describes certain column as `DEFAULT_GENERATED` + if extra.Valid && (strings.Contains(strings.ToUpper(extra.String), "VIRTUAL GENERATED") || + strings.Contains(strings.ToUpper(extra.String), "STORED GENERATED")) { column.IsGenerated = true } diff --git a/pkg/sql_execution_engine/internal_txn_tagger.go b/pkg/sql_execution_engine/internal_txn_tagger.go index 738ec4e1..589d68ca 100644 --- a/pkg/sql_execution_engine/internal_txn_tagger.go +++ b/pkg/sql_execution_engine/internal_txn_tagger.go @@ -20,6 +20,7 @@ import ( "database/sql" "github.com/juju/errors" + log "github.com/sirupsen/logrus" "github.com/moiot/gravity/pkg/utils" ) @@ -47,6 +48,9 @@ func ExecWithInternalTxnTag( } if !internalTxnTaggerCfg.TagInternalTxn { + if log.IsLevelEnabled(log.DebugLevel) { + log.Debugf("query: %v, args: %v", newQuery, args) + } _, err := db.Exec(newQuery, args...) return errors.Annotatef(err, "query: %v, args: %v", query, args) } @@ -64,6 +68,9 @@ func ExecWithInternalTxnTag( return errors.Trace(err) } + if log.IsLevelEnabled(log.DebugLevel) { + log.Debugf("query: %v, args: %v", newQuery, args) + } _, err = txn.Exec(query, args...) if err != nil { txn.Rollback()