Skip to content

Commit

Permalink
domain: Log the tables and schema versions when reporting `Informatio…
Browse files Browse the repository at this point in the history
…n schema is changed` (pingcap#31182)

close pingcap#31181
  • Loading branch information
djshow832 authored Jan 4, 2022
1 parent e50e03c commit c884230
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions domain/schema_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,20 @@ func (s *schemaValidator) isRelatedTablesChanged(currVer int64, tableIDs []int64
}

changedTblMap := make(map[int64]uint64)
changedSchemaVers := make([]int64, 0)
for _, item := range newerDeltas {
affected := false
for i, tblID := range item.relatedIDs {
for _, relatedTblID := range tableIDs {
if tblID == relatedTblID {
changedTblMap[tblID] |= item.relatedActions[i]
affected = true
}
}
}
if affected {
changedSchemaVers = append(changedSchemaVers, item.schemaVersion)
}
}
if len(changedTblMap) > 0 {
tblIds := make([]int64, 0, len(changedTblMap))
Expand All @@ -207,6 +213,8 @@ func (s *schemaValidator) isRelatedTablesChanged(currVer int64, tableIDs []int64
res.PhyTblIDS = tblIds
res.ActionTypes = actionTypes
res.Amendable = true
logutil.BgLogger().Info("schema of tables in the transaction are changed", zap.Int64s("conflicted table IDs", tblIds),
zap.Int64("transaction schema", currVer), zap.Int64s("schema versions that changed the tables", changedSchemaVers))
return res, true
}
return res, false
Expand Down

0 comments on commit c884230

Please sign in to comment.