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

add debugging messages #550

Draft
wants to merge 3 commits into
base: slack-19.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions go/vt/discovery/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@ func (hc *HealthCheckImpl) TabletConnection(alias *topodata.TabletAlias, target
hc.mu.Unlock()
if thc == nil || thc.Conn == nil {
// TODO: test that throws this error
log.Warningf("NOT_FOUND: tablet: %v is either down or nonexistent", alias)
return nil, vterrors.Errorf(vtrpc.Code_NOT_FOUND, "tablet: %v is either down or nonexistent", alias)
}
return thc.Connection(hc), nil
Expand Down
1 change: 1 addition & 0 deletions go/vt/vtgate/engine/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ func (svss *SysVarSetAware) Execute(ctx context.Context, vcursor VCursor, env *e
return vterrors.NewErrorf(vtrpcpb.Code_INVALID_ARGUMENT, vterrors.WrongValueForVar, "variable 'session_track_gtids' can't be set to the value of '%s'", str)
}
default:
log.Warningf("NOT_FOUOND: unknown system variable '%s'", svss.Name)
return vterrors.NewErrorf(vtrpcpb.Code_NOT_FOUND, vterrors.UnknownSystemVariable, "unknown system variable '%s'", svss.Name)
}

Expand Down
2 changes: 2 additions & 0 deletions go/vt/vtgate/plan_execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,14 @@ func (e *Executor) handleTransactions(
case sqlparser.StmtSRollback:
qr, err := e.handleSavepoint(ctx, safeSession, plan.Original, "Rollback Savepoint", logStats, func(query string) (*sqltypes.Result, error) {
// Error as there is no transaction, so there is no savepoint that exists.
log.Warningf("NOT_FOUND: SAVEPOINT does not exist: %s", query)
return nil, vterrors.NewErrorf(vtrpcpb.Code_NOT_FOUND, vterrors.SPDoesNotExist, "SAVEPOINT does not exist: %s", query)
}, vcursor.ignoreMaxMemoryRows)
return qr, err
case sqlparser.StmtRelease:
qr, err := e.handleSavepoint(ctx, safeSession, plan.Original, "Release Savepoint", logStats, func(query string) (*sqltypes.Result, error) {
// Error as there is no transaction, so there is no savepoint that exists.
log.Warningf("NOT_FOUND: SAVEPOINT does not exist: %s", query)
return nil, vterrors.NewErrorf(vtrpcpb.Code_NOT_FOUND, vterrors.SPDoesNotExist, "SAVEPOINT does not exist: %s", query)
}, vcursor.ignoreMaxMemoryRows)
return qr, err
Expand Down
1 change: 1 addition & 0 deletions go/vt/vtgate/scatter_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,7 @@ func lockInfo(target *querypb.Target, session *SafeSession, lockFuncType sqlpars
info := &shardActionInfo{actionNeeded: nothing}
if session.LockSession != nil {
if !proto.Equal(target, session.LockSession.Target) {
log.Warningf("NOT_FOUND: target does match the existing lock session target: (%v, %v)", target, session.LockSession.Target)
return nil, vterrors.Errorf(vtrpcpb.Code_NOT_FOUND, "target does match the existing lock session target: (%v, %v)", target, session.LockSession.Target)
}
info.reservedID = session.LockSession.ReservedId
Expand Down
2 changes: 2 additions & 0 deletions go/vt/vtgate/semantics/derived_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package semantics
import (
"strings"

"vitess.io/vitess/go/vt/log"
vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc"
"vitess.io/vitess/go/vt/sqlparser"
"vitess.io/vitess/go/vt/vterrors"
Expand Down Expand Up @@ -183,6 +184,7 @@ func (dt *DerivedTable) getExprFor(s string) (sqlparser.Expr, error) {
return dt.cols[i], nil
}
}
log.Warningf("NOT_FOUND: Unknown column '%s' in 'field list'", s)
return nil, vterrors.NewErrorf(vtrpcpb.Code_NOT_FOUND, vterrors.BadFieldError, "Unknown column '%s' in 'field list'", s)
}

Expand Down
6 changes: 5 additions & 1 deletion go/vt/vtgate/tabletgateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,15 @@ func (gw *TabletGateway) TabletsHealthyStatus() discovery.TabletsCacheStatusList
}

func (gw *TabletGateway) updateDefaultConnCollation(tablet *topodatapb.Tablet) {
if tablet.DefaultConnCollation == 45 {
log.Warningf("slack: unexpected collation on tablet host: %s", tablet.Hostname)
}
if gw.defaultConnCollation.CompareAndSwap(0, tablet.DefaultConnCollation) {
return
}
if gw.defaultConnCollation.Load() != tablet.DefaultConnCollation {
log.Warning("this Vitess cluster has tablets with different default connection collations")
log.Warningf("this Vitess cluster has tablets with different default connection collations: gw: %v, tablet:%v, host:%v",
gw.defaultConnCollation.Load(), tablet.DefaultConnCollation, tablet.Hostname)
}
}

Expand Down
13 changes: 13 additions & 0 deletions go/vt/vtgate/vindexes/vschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"vitess.io/vitess/go/mysql/collations"
"vitess.io/vitess/go/sqlescape"
"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/vt/log"
querypb "vitess.io/vitess/go/vt/proto/query"
topodatapb "vitess.io/vitess/go/vt/proto/topodata"
vschemapb "vitess.io/vitess/go/vt/proto/vschema"
Expand Down Expand Up @@ -493,6 +494,9 @@ func buildKeyspaceReferences(vschema *VSchema, ksvschema *KeyspaceSchema) error
if vterrors.Code(err) != vtrpcpb.Code_NOT_FOUND || vterrors.ErrState(err) != vterrors.BadDb {
return err
}
log.Warningf("NOT_FOUND: source %q references a non-existent keyspace %q",
source,
sourceKsname)
return vterrors.Errorf(
vtrpcpb.Code_NOT_FOUND,
"source %q references a non-existent keyspace %q",
Expand All @@ -501,6 +505,10 @@ func buildKeyspaceReferences(vschema *VSchema, ksvschema *KeyspaceSchema) error
)
}
if sourceT == nil {
log.Warningf("NOT_FOUND: source %q references a table %q that is not present in the VSchema of keyspace %q",
source,
sourceTname,
sourceKsname)
return vterrors.Errorf(
vtrpcpb.Code_NOT_FOUND,
"source %q references a table %q that is not present in the VSchema of keyspace %q",
Expand Down Expand Up @@ -606,6 +614,8 @@ func buildTables(ks *vschemapb.Keyspace, vschema *VSchema, ksvschema *KeyspaceSc
}
t.Type = table.Type
default:
log.Warningf("NOT_FOUND: unidentified table type %s",
table.Type)
return vterrors.Errorf(
vtrpcpb.Code_NOT_FOUND,
"unidentified table type %s",
Expand Down Expand Up @@ -828,6 +838,9 @@ func resolveAutoIncrement(source *vschemapb.SrvVSchema, vschema *VSchema, parser
// Better to remove the table than to leave it partially initialized.
delete(ksvschema.Tables, tname)
delete(vschema.globalTables, tname)
log.Warningf("NOT_FOUND: cannot resolve sequence %s: %s",
table.AutoIncrement.Sequence,
err.Error())
ksvschema.Error = vterrors.Errorf(
vtrpcpb.Code_NOT_FOUND,
"cannot resolve sequence %s: %s",
Expand Down
Loading