Skip to content

Commit

Permalink
Merge branch 'master' into hongyunyan_add_statistic
Browse files Browse the repository at this point in the history
  • Loading branch information
hongyunyan authored Nov 28, 2022
2 parents bae1659 + 0e6364f commit 8b1e65e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions store/helper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,11 +653,11 @@ func newTableWithKeyRange(db *model.DBInfo, table *model.TableInfo) TableInfoWit

// NewIndexWithKeyRange constructs TableInfoWithKeyRange for given index, it is exported only for test.
func NewIndexWithKeyRange(db *model.DBInfo, table *model.TableInfo, index *model.IndexInfo) TableInfoWithKeyRange {
return newIndexWithKeyRange(db, table, index)
return newIndexWithKeyRange(db, table, index, table.ID)
}

func newIndexWithKeyRange(db *model.DBInfo, table *model.TableInfo, index *model.IndexInfo) TableInfoWithKeyRange {
sk, ek := tablecodec.GetTableIndexKeyRange(table.ID, index.ID)
func newIndexWithKeyRange(db *model.DBInfo, table *model.TableInfo, index *model.IndexInfo, physicalID int64) TableInfoWithKeyRange {
sk, ek := tablecodec.GetTableIndexKeyRange(physicalID, index.ID)
startKey := bytesKeyToHex(codec.EncodeBytes(nil, sk))
endKey := bytesKeyToHex(codec.EncodeBytes(nil, ek))
return TableInfoWithKeyRange{
Expand Down Expand Up @@ -727,7 +727,13 @@ func (*Helper) GetTablesInfoWithKeyRange(schemas []*model.DBInfo) []TableInfoWit
tables = append(tables, newTableWithKeyRange(db, table))
}
for _, index := range table.Indices {
tables = append(tables, newIndexWithKeyRange(db, table, index))
if table.Partition == nil || index.Global {
tables = append(tables, newIndexWithKeyRange(db, table, index, table.ID))
continue
}
for _, partition := range table.Partition.Definitions {
tables = append(tables, newIndexWithKeyRange(db, table, index, partition.ID))
}
}
}
}
Expand Down

0 comments on commit 8b1e65e

Please sign in to comment.