(physicalID int64, keys [][]byte)
| 573 | } |
| 574 | |
| 575 | func (e *SplitTableRegionExec) getSplitTablePhysicalKeysFromBound(physicalID int64, keys [][]byte) ([][]byte, error) { |
| 576 | recordPrefix := tablecodec.GenTableRecordPrefix(physicalID) |
| 577 | // Split a separate region for index. |
| 578 | containsIndex := len(e.tableInfo.Indices) > 0 && !(e.tableInfo.IsCommonHandle && len(e.tableInfo.Indices) == 1) |
| 579 | if containsIndex { |
| 580 | keys = append(keys, recordPrefix) |
| 581 | } |
| 582 | |
| 583 | if e.handleCols.IsInt() { |
| 584 | low, step, err := e.calculateIntBoundValue() |
| 585 | if err != nil { |
| 586 | return nil, err |
| 587 | } |
| 588 | recordID := low |
| 589 | for i := 1; i < e.num; i++ { |
| 590 | recordID += step |
| 591 | key := tablecodec.EncodeRecordKey(recordPrefix, kv.IntHandle(recordID)) |
| 592 | keys = append(keys, key) |
| 593 | } |
| 594 | return keys, nil |
| 595 | } |
| 596 | lowerHandle, err := e.handleCols.BuildHandleByDatums(e.Ctx().GetSessionVars().StmtCtx, e.lower) |
| 597 | if err != nil { |
| 598 | return nil, err |
| 599 | } |
| 600 | upperHandle, err := e.handleCols.BuildHandleByDatums(e.Ctx().GetSessionVars().StmtCtx, e.upper) |
| 601 | if err != nil { |
| 602 | return nil, err |
| 603 | } |
| 604 | if lowerHandle.Compare(upperHandle) >= 0 { |
| 605 | lowerStr := datumSliceToString(e.lower) |
| 606 | upperStr := datumSliceToString(e.upper) |
| 607 | errMsg := fmt.Sprintf("Split table `%v` region lower value %v should less than the upper value %v", |
| 608 | e.tableInfo.Name.O, lowerStr, upperStr) |
| 609 | return nil, exeerrors.ErrInvalidSplitRegionRanges.GenWithStackByArgs(errMsg) |
| 610 | } |
| 611 | low := tablecodec.EncodeRecordKey(recordPrefix, lowerHandle) |
| 612 | up := tablecodec.EncodeRecordKey(recordPrefix, upperHandle) |
| 613 | return getValuesList(low, up, e.num, keys), nil |
| 614 | } |
| 615 | |
| 616 | // RegionMeta contains a region's peer detail |
| 617 | type regionMeta struct { |
no test coverage detected