Skip to content

Commit

Permalink
add log & remove reduntant test
Browse files Browse the repository at this point in the history
  • Loading branch information
buchuitoudegou committed Jun 16, 2022
1 parent 3bfd82c commit 5a839c9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
7 changes: 0 additions & 7 deletions br/pkg/lightning/backend/kv/sql2kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,13 +472,6 @@ func isRowIDOverflow(meta *model.ColumnInfo, rowID int64) bool {
return rowID > math.MaxInt8
}
return rowID > math.MaxUint8
// BIGINT
case mysql.TypeLonglong:
if !isUnsigned {
return rowID > math.MaxInt64
}
// impossible for rowID exceeding MaxUint64
return uint64(rowID) > math.MaxUint64
// FLOAT
case mysql.TypeFloat:
if !isUnsigned {
Expand Down
1 change: 1 addition & 0 deletions br/pkg/lightning/mydump/region.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ func makeSourceFileRegion(
log.L().Warn("fail to sample file", zap.String("path", fi.FileMeta.Path), zap.Error(err))
divisor = sizePerRow
}
log.L().Debug("avg row size", zap.String("path", fi.FileMeta.Path), zap.Int64("size per row", sizePerRow))
// If a csv file is overlarge, we need to split it into multiple regions.
// Note: We can only split a csv file whose format is strict.
// We increase the check threshold by 1/10 of the `max-region-size` because the source file size dumped by tools
Expand Down
13 changes: 7 additions & 6 deletions br/pkg/lightning/restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -2175,6 +2175,13 @@ func (cr *chunkRestore) adjustRowID(rowID int64, rc *Controller) (int64, error)
// need to adjust rowID
// rowID should be within [curRowIDBase, curRowIDMax]
if cr.curRowIDBase == 0 || cr.curRowIDBase > cr.curRowIDMax {
logger := cr.tableRestore.logger.With(
zap.String("tableName", cr.tableRestore.tableName),
zap.Int("fileIndex", cr.index),
zap.Stringer("path", &cr.chunk.Key),
zap.String("task", "re-allocate rowID"),
)
logger.Info("start re-allocating")
// 1. curRowIDBase == 0 -> no previous re-allocation
// 2. curRowIDBase > curRowIDMax -> run out of allocated IDs
pos, _ := cr.parser.Pos()
Expand All @@ -2183,12 +2190,6 @@ func (cr *chunkRestore) adjustRowID(rowID int64, rc *Controller) (int64, error)
newRowIDCount := leftFileSize/int64(avgRowSize) + 1 // plus the current row
newBase, newMax, err := cr.tableRestore.allocateRowIDs(newRowIDCount, rc)
if err != nil {
logger := cr.tableRestore.logger.With(
zap.String("tableName", cr.tableRestore.tableName),
zap.Int("fileIndex", cr.index),
zap.Stringer("path", &cr.chunk.Key),
zap.String("task", "re-allocate rowID"),
)
logger.Error("fail to re-allocate rowIDs", zap.Error(err))
return 0, err
}
Expand Down

0 comments on commit 5a839c9

Please sign in to comment.