Skip to content

Commit

Permalink
Merge branch 'master' into fix_data_race_ddl
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkingrei authored Jul 19, 2022
2 parents 8df7165 + 0cecfc8 commit b134f7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions util/paging/paging.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ package paging
import "math"

// A paging request may be separated into multi requests if there are more data than a page.
// The paging size grows from min to max, it's not well tuned yet.
// e.g. a paging request scans over range (r1, r200), it requires 64 rows in the first batch,
// The paging size grows from min to max. See https://github.com/pingcap/tidb/issues/36328
// e.g. a paging request scans over range (r1, r200), it requires 128 rows in the first batch,
// if it's not drained, then the paging size grows, the new range is calculated like (r100, r200), then send a request again.
// Compare with the common unary request, paging request allows early access of data, it offers a streaming-like way processing data.
// TODO: may make the paging parameters configurable.
const (
MinPagingSize uint64 = 64
MinPagingSize uint64 = 128
maxPagingSizeShift = 7
pagingSizeGrow = 2
MaxPagingSize = MinPagingSize << maxPagingSizeShift
MaxPagingSize = 8192
pagingGrowingSum = ((2 << maxPagingSizeShift) - 1) * MinPagingSize
Threshold uint64 = 960
)
Expand Down
4 changes: 2 additions & 2 deletions util/paging/paging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (

func TestGrowPagingSize(t *testing.T) {
require.Equal(t, GrowPagingSize(MinPagingSize), MinPagingSize*pagingSizeGrow)
require.Equal(t, GrowPagingSize(MaxPagingSize), MaxPagingSize)
require.Equal(t, GrowPagingSize(MaxPagingSize/pagingSizeGrow+1), MaxPagingSize)
require.Equal(t, GrowPagingSize(MaxPagingSize), uint64(MaxPagingSize))
require.Equal(t, GrowPagingSize(MaxPagingSize/pagingSizeGrow+1), uint64(MaxPagingSize))
}

func TestCalculateSeekCnt(t *testing.T) {
Expand Down

0 comments on commit b134f7a

Please sign in to comment.