Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

br: merge into feature branch br_ddl for binlog test #31044

Merged
merged 699 commits into from
Dec 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
699 commits
Select commit Hold shift + click to select a range
e3e2e8d
dumpling: fix default collation with upstream when dump database and …
WizardXiao Dec 4, 2021
ffe9b38
ddl: fix the enum default value by triming trailing space (#30356)
sylzd Dec 6, 2021
9c62e96
expression: migrate test-infra to testify for flag_simplify_test.go (…
tisonkun Dec 6, 2021
d3ba0c2
server: refine code logic in handleDownloadFile (#30422)
Yisaer Dec 6, 2021
0b3ec09
ddl: migrate test-infra to testify for ddl/table_test.go (#30267)
hawkingrei Dec 6, 2021
464db6b
ddl: handle the error from `addBatchDDLJobs()` correctly (#30401)
tangenta Dec 6, 2021
7203707
br: fix the integration tests (#30423)
3pointer Dec 6, 2021
dfd7157
util, cmd: remove unused filesort (#30438)
wjhuang2016 Dec 6, 2021
3131085
*: update client-go for small backoff time (#30436)
youjiali1995 Dec 6, 2021
d7c2333
server: Fix unstable tests with FakeAuthSwitch (#30287)
dveeden Dec 6, 2021
9d307b0
dumpling: fix dump failed when sequence exists (#30164)
sylzd Dec 6, 2021
d3c6045
*: replace compareDatum by compare (#30421)
wjhuang2016 Dec 6, 2021
bc08b50
lightning: fix gcs max key limit (#30393)
Leavrth Dec 6, 2021
3337405
expression, parser: add built-in func is_uuid (#30318)
unconsolable Dec 6, 2021
889f001
expression: migrate test-infra to testify for constant_fold_test.go (…
tisonkun Dec 7, 2021
cb88a4c
executor: fix pipelined window invalid memory address (#30418)
wshwsh12 Dec 7, 2021
b2ea0e6
makefile: add gotestsum for verify ci (#29848)
tangenta Dec 7, 2021
53f33fa
server: close sql rows to fix unstable test (#30306)
hawkingrei Dec 7, 2021
239fca2
Makefile: add coverage record for BR and Dumpling (#30457)
tangenta Dec 7, 2021
181c0c9
executor: track the mem usage of IndexMergeReader (#30210)
guo-shaoge Dec 7, 2021
7d4895f
infosync: close body when ReadAll encounters error (#30462)
rleungx Dec 7, 2021
ffd59ec
planner: show accessed partition when explain mpp query over partitio…
windtalker Dec 7, 2021
376d542
*: Fix use of user identity in SHOW GRANTS + error messages (#30294)
morgo Dec 7, 2021
4fb333c
ddl: add not null flag for auto_increment column (#30477)
wjhuang2016 Dec 7, 2021
6eb14e0
expression: make some unstable test serial (#30323)
hawkingrei Dec 7, 2021
e7aeae7
expression: migrate test-infra to testify for constant_propagation_te…
tisonkun Dec 7, 2021
2af4624
executor: stable test TestSetDDLReorgBatchSize and TestSetDDLReorgWor…
wjhuang2016 Dec 7, 2021
f82ca6a
statistics, util/ranger: add cardinality estimation trace for `GetRow…
time-and-fate Dec 7, 2021
b585bf9
*: skip mysql client goroutine leak detection in integration ddl (#30…
lcwangchao Dec 7, 2021
d83ee8c
executor,util: write slow query to slow log no matter what log level …
TonsnakeLin Dec 7, 2021
27f7b59
executor: enable index_merge used in transaction. (#29875)
guo-shaoge Dec 8, 2021
7a5a8bf
logutil: add testcase for SlowQueryLogger.MaxDays/MaxSize/MaxBackups …
guo-shaoge Dec 8, 2021
daf8f3e
expression: fix data race in builtin_other_vec_generated_test.go (#30…
hawkingrei Dec 8, 2021
2a1ea89
expression: fix data race in the collationInfo (#30490)
hawkingrei Dec 8, 2021
e520e46
planner/core, session: fix error message of wrong variable scope (#30…
morgo Dec 8, 2021
dac5a68
lightning: support Re/ReregisterMySQL by different tls name (#30463)
Ehco1996 Dec 8, 2021
66dfc70
executor: TestBatchGetandPointGetwithHashPartition test typo (#29669)…
mjonss Dec 8, 2021
1d51261
mockstore: improve log to avoid panic for nil pointer (#30513)
hawkingrei Dec 8, 2021
9773f83
*: replace compareDatum by compare, PR 10 (#30456)
wjhuang2016 Dec 8, 2021
6229c89
planner: Disable dynamic partition prune mode for all non-autocommit …
mjonss Dec 8, 2021
e15e457
expression: change the log level of an confusing log from warn to deb…
XuHuaiyu Dec 8, 2021
7aee819
br: Check crypter.key valid before backup (#29991)
joccau Dec 9, 2021
d9ef107
*: replace compareDatum by compare, PR 11 (#30465)
wjhuang2016 Dec 9, 2021
9f744cd
dumpling: fix default column collation with upstream when dump table …
WizardXiao Dec 9, 2021
6a43317
server: fix prepared cursor select (#30285)
xhebox Dec 9, 2021
80ea238
executor: HashJoinExec checks the buildError even if the probeSide is…
XuHuaiyu Dec 9, 2021
05f7c6d
parser, expression: follow mysql, increase interval precedence (#30528)
Defined2014 Dec 9, 2021
1a543c4
makefile: set timeout 25m for make race (#30555)
hawkingrei Dec 9, 2021
b6c45af
planner: fix the unstable test TestAnalyzeGlobalStatsWithOpts/2 (#30576)
qw4990 Dec 9, 2021
8bc22b1
expression,types: Adjusts UNIX_TIMESTAMP() for non-existing DST value…
mjonss Dec 9, 2021
1833b61
br: add res.Body.close to avoid leak (#30545)
hawkingrei Dec 9, 2021
c89c473
lightning: add back integration test lightning_error_summary (#30547)
glorv Dec 9, 2021
8db9454
sessionctx/variable: small refactor (split large file) (#30511)
morgo Dec 9, 2021
fbcf757
ddl: let `admin cancel ddl jobs` run in a new transaction (#30549)
djshow832 Dec 9, 2021
89fd697
*: Retry when placement PutBundles failed (#30590)
lcwangchao Dec 10, 2021
7c416ed
dumpling: delete unit test in github actions (#30562)
lichunzhu Dec 10, 2021
23af09d
*: support trace plan target='estimation' statement (#30491)
time-and-fate Dec 10, 2021
ed384b2
expression: migrate test-infra to testify for integration_test.go (#3…
hawkingrei Dec 10, 2021
828c1dd
planner: support trace for min/max eliminate (#30441)
Yisaer Dec 10, 2021
4f42291
br: remove cdclog in br (#30573)
joccau Dec 10, 2021
aa002f2
*: show cmd to check if all needed histograms are loaded (#29672)
chrysan Dec 10, 2021
03b6a8e
expression: clone repertoire when clone the scalar function (#30602)
xiongjiwei Dec 10, 2021
9a074f1
*: use the real StateRemote interface implementation for cached table…
tiancaiamao Dec 10, 2021
9d4da4f
*: query failed after add index / timestamp out-of-range (#28424) (#2…
mjonss Dec 10, 2021
512373e
planner: implement collecting predicate columns from logical plan (#2…
xuyifangreeneyes Dec 10, 2021
c08f7fc
*: show PK name when decoding the clustered index row key (#30623)
JmPotato Dec 10, 2021
66163de
ddl/callback_test.go: migrate test-infra to testify (#30317)
zach030 Dec 10, 2021
93e2c12
*: Rename some names of placement ddl operation (#30622)
lcwangchao Dec 10, 2021
3dce612
executor: fix data race in the index_lookup_hash_join (#30619)
hawkingrei Dec 11, 2021
8e525d8
ddl: remove unnecessary locking when adding an index (#29772)
wjhuang2016 Dec 11, 2021
626dee7
server: try to make `TidbTestSuite` more stable (#30643)
bb7133 Dec 12, 2021
7555536
*: Add some PD tests for placement and fix some bug found (#30621)
lcwangchao Dec 12, 2021
1f26870
*: migrate sync.WaitGroup to util.WaitGroupWrapper (#30644)
hawkingrei Dec 13, 2021
6495a5a
planner: add trace for join eliminate rule (#30343)
Yisaer Dec 13, 2021
9a64217
executor: migrate test-infra to testify for executor/shuffle_test.go…
tongtongyin Dec 13, 2021
b8dcc09
planner: make (*AccessPath).OnlyPointRange more succinct (#30520)
xuyifangreeneyes Dec 13, 2021
a532973
planner: add trace for join reorder (#30394)
Yisaer Dec 13, 2021
d3833c2
executor: migrate test-infra to testify for executor/union_scan_test.…
tongtongyin Dec 13, 2021
e8577c7
expression: make cast return error if cast binary literal to another …
xiongjiwei Dec 13, 2021
68118f1
*: update tikv client (#30670)
Yisaer Dec 13, 2021
d8a48d9
*: update sysutil in go.mod to fix panic when search log (#30523)
crazycs520 Dec 13, 2021
12e2288
topsql: shouldn't evict the SQL meta, since the evicted SQL can be ap…
crazycs520 Dec 13, 2021
b876788
testify: migrate test-infra to testify for analyze_test.go (#30640)
znhh6018 Dec 13, 2021
b626745
util: replace compareDatum by compare, point part (#30575)
wjhuang2016 Dec 13, 2021
b4df7ca
test: make all the tests run in serial (#30692)
tangenta Dec 14, 2021
ac25e9f
statistics: add mutex for Handle.globalMap and Handle.feedback (#30550)
xuyifangreeneyes Dec 14, 2021
a8ad203
executor: fix regular expression in json so that it could match ident…
znhh6018 Dec 14, 2021
dd7f71f
util/testkit/testkit.go: fix typo (#30638)
eddiearc Dec 14, 2021
c30d34f
planner: Introduce a new global variable to control the historical st…
An-DJ Dec 14, 2021
e9b1fb8
topsql: introduce datasink interface (#30662)
zhongzc Dec 14, 2021
2f42f7c
planner: unify the argument of stats functions to use SessionCtx inst…
qw4990 Dec 14, 2021
5d463f3
metrics: fix the Max SafeTS Gap metrics (#30689)
JmPotato Dec 14, 2021
4b48e55
lightning: Add source dir existence check for s3 (#30674)
glorv Dec 14, 2021
950a274
golangci-lint: support durationcheck (#30027)
wangggong Dec 14, 2021
6c0fcea
executor: fix data race on IndexHashJoin.cancelFunc (#30701)
XuHuaiyu Dec 14, 2021
813f6ef
sessionctx/variable: change tidb_store_limit to global only (#30522)
morgo Dec 15, 2021
0d0805d
statistics: remove reassignment of Handle.pool in NewHandle (#30675)
xuyifangreeneyes Dec 15, 2021
93b0a58
br: fix some unstable unit test cases. (#30716)
3pointer Dec 15, 2021
22418cd
bindinfo: fix the comment typo (#30616)
zhangjinpeng87 Dec 15, 2021
04a9618
server: support decoding prepared string args to character_set_client…
tangenta Dec 15, 2021
3fe9263
expression: fix enum type join binary get wrong result (#30445)
sylzd Dec 15, 2021
64f7309
cmd/explaintest: fix wrong result comparison for explain test (#30717)
xuyifangreeneyes Dec 15, 2021
91ceec5
parallel create tables in br
fengou1 Dec 15, 2021
87dbcc2
metrics: fix copr-cache metrics (#30712)
jackysp Dec 15, 2021
2e79433
test: merge executor's serial tests to other tests (#30711)
tangenta Dec 15, 2021
0c7528a
statistics: avoid deadlock when create/drop extended stats and analyz…
time-and-fate Dec 15, 2021
14aca77
ddl: add batch create table api
xhebox Oct 12, 2021
73a7b8a
ddl: add unit tests
xhebox Oct 12, 2021
dee6c35
ddl: fix fmt
xhebox Oct 12, 2021
5b46f1b
ddl: typo
xhebox Oct 18, 2021
88a0e3f
ddl: fix tests
xhebox Oct 19, 2021
5c50048
ddl: rename to BatchCreateTableWithInfo
xhebox Oct 20, 2021
d35fc31
ddl: trace the error
xhebox Oct 20, 2021
f43fa0f
ddl: comments
xhebox Oct 20, 2021
7348348
ddl: cancle the job right
xhebox Oct 20, 2021
ad5812e
ddl: cancel the job right 2
xhebox Oct 25, 2021
1b70b8b
ddl: report error if entry too large
xhebox Oct 26, 2021
05aa57c
ddl: report error when table is duplicated
xhebox Oct 27, 2021
e4582a7
ddl: go fmt
xhebox Oct 27, 2021
7913c49
infoschema: improve batch memory perf
xhebox Oct 27, 2021
84bdeaf
ddl: retain ID
xhebox Oct 29, 2021
d660e48
sessionctx: fix the value of analyze_version when upgrading 4.x to 5.…
winoros Dec 15, 2021
bd0b779
ddl: reduce log frequency
xhebox Dec 15, 2021
c5e7cb8
ddl: fix tests
xhebox Dec 15, 2021
05b9960
server: disable socket listener for `basicHTTPHandlerTestSuite` (#30680)
bb7133 Dec 16, 2021
af259fa
planner: support the plan cache aware of bindings (#30169)
Reminiscent Dec 16, 2021
5d62c2a
planner: fix early set of plan's statisticsTable (#30754)
chrysan Dec 16, 2021
6eb11b3
*: implement renew write lock lease for cached table (#30206)
tiancaiamao Dec 16, 2021
bb8774b
*: Modify placement rule index to reserve some indexes for future wor…
lcwangchao Dec 16, 2021
8cf847a
executor: add an unit test case for unreasonable invoking Close (#30696)
XuHuaiyu Dec 16, 2021
86ed4c4
planner: fix wrong subquery's coercibility (#30750)
wjhuang2016 Dec 16, 2021
4069b10
executor: add more testcases for index merge (#30497)
guo-shaoge Dec 16, 2021
eed16a6
server: add grpc server config for a suitable behavior (#30774)
zhongzc Dec 16, 2021
43caa02
config, charset: make charset config not affected by collation config…
xiongjiwei Dec 16, 2021
5eac82b
lightning: emit tidb log by change FilterCore to only allow matched p…
glorv Dec 16, 2021
d208b62
topsql: a centralized place to generate tipb report data (#30781)
zhongzc Dec 16, 2021
fa10cd1
planner: add trace for partition pruning (#30546)
Yisaer Dec 16, 2021
ae5638c
planner: refine collation handling for between (#30793)
wjhuang2016 Dec 16, 2021
1e5e869
test: merge serial tests in bindinfo, expression, parser and statisti…
tangenta Dec 16, 2021
83af272
br: update log description for split check (#30763)
3pointer Dec 16, 2021
daf525a
*: replace compareDatum by compare, range part (#30710)
wjhuang2016 Dec 16, 2021
ad740a6
*: placement policy ref will be converted to direct options when reco…
lcwangchao Dec 16, 2021
c75ea85
ddl: handle the incorrect number of placement followers (#30715)
sylzd Dec 16, 2021
a6fc5c6
ddl: revert "ddl: remove unnecessary locking when adding an index" (#…
wjhuang2016 Dec 16, 2021
d0fc70e
br/pkg/task: migrate test-infra to testify (#30605)
tisonkun Dec 17, 2021
8e11e03
*: fix the flen type datetime for union/case-when/control-funcs (#30588)
bestwoody Dec 17, 2021
321d307
types, util: clean up compareDatum (#30815)
wjhuang2016 Dec 17, 2021
1cf2a6d
ddl: add helper function to set and query TiFlash's sync status (#30473)
CalvinNeo Dec 17, 2021
93f21b9
dumpling: fix more dumpling log level query template (#30176)
lichunzhu Dec 17, 2021
dd95dd6
parser: support `admin flush plan_cache` (#30747)
Reminiscent Dec 17, 2021
c0888f5
topsql: support multiple datasinks (#30808)
zhongzc Dec 17, 2021
778e188
br: update permission, so tikv can write to folder when backup to loc…
fengou1 Dec 17, 2021
866c551
session: fix bootstrap to only persist global variables (#30593)
morgo Dec 19, 2021
1721706
docs/design: update collation compatibility issues in charsets doc (#…
zimulala Dec 19, 2021
24d970f
executor: improve SET sysvar=DEFAULT handling (#29680)
morgo Dec 19, 2021
e1fb2f5
br: add error handling for group context cancel when restore file is …
fengou1 Dec 20, 2021
e3c56b7
executor: buildWindow cannot call typeInfer twice (#30773)
fzhedu Dec 20, 2021
ab35db1
*: refactor encoding and uniform usages (#30288)
tangenta Dec 20, 2021
9220700
lightning: optimize region split check logic (#30428)
glorv Dec 20, 2021
c44630e
br: ignore mock directory when gcov in br (#30586)
joccau Dec 20, 2021
b9d9f19
*: forbid set tiflash replica count for a placement table (#30844)
lcwangchao Dec 20, 2021
23c71f1
execute: don't transform charset in internal sql (#30843)
Defined2014 Dec 20, 2021
b27a2d7
planner: update PlanBuilder.windowSpecs when building subquery (#30878)
xuyifangreeneyes Dec 20, 2021
b09c63b
br: fix S3 backup endpoint suffix (#30530)
tongtongyin Dec 20, 2021
eb6c89d
lightning: make pre-check output message clearer (#30439)
glorv Dec 20, 2021
87ab28e
expression: wrap to_binary and from_binary for cast function's argume…
xiongjiwei Dec 20, 2021
66d7673
executor: fix bug when using IndexMerge in transaction (#30719)
guo-shaoge Dec 21, 2021
cbe7492
ddl: migrate test-infra to testify for ddl/foreign_key_test.go (#30853)
Mini256 Dec 21, 2021
f1e5877
expression: fix wrong retType for reverse function (#30829)
wjhuang2016 Dec 21, 2021
06c1e8c
planner: support trace topn push down (#30800)
Yisaer Dec 21, 2021
497bc0f
fix conflict
fengou1 Dec 21, 2021
77b4e40
github: add issue requirement to pull request template (#30817)
zhangyangyu Dec 21, 2021
ced6a21
fix merge issue
fengou1 Dec 21, 2021
fe1aaf2
topsql: introduce stmtstats and sql execution count (#30277)
mornyx Dec 21, 2021
a8a858b
topsql: add pubsub datasink (#30860)
zhongzc Dec 21, 2021
2b7ce8e
executor: fix the incorrect untouch used in optimistic transactions (…
cfzjywxk Dec 21, 2021
55a38cb
expression, cmd: let crc32() support gbk (#30900)
Defined2014 Dec 21, 2021
feee7c2
server: Add uptime status var and statistics (#29790)
dveeden Dec 21, 2021
e12342b
br: error log optimization (#29640)
fengou1 Dec 21, 2021
416617e
planner: fix wrong collation when rewrite in condition (#30492)
wjhuang2016 Dec 21, 2021
63d23f8
planner: add extractor for tikv_region_peers (#30656)
IcePigZDB Dec 21, 2021
501fc52
fix issue that loss table restore
fengou1 Dec 22, 2021
3934157
lightning: add back table empty check and add a switch config (#30887)
glorv Dec 22, 2021
3bd732f
br: improve backoff unit test (#30892)
fengou1 Dec 22, 2021
529ce88
*: add TxnManager to manage txn in session (#30574)
lcwangchao Dec 22, 2021
46e67db
Makefile: add `t.Parallel` check to ensure tests are run in serial (#…
tangenta Dec 22, 2021
17bd4dd
refactoring code
fengou1 Dec 22, 2021
4115494
refactoring code
fengou1 Dec 22, 2021
9d1e29d
placement: remove isolationlevel (#30859)
xhebox Dec 22, 2021
beb5451
planner: revise the optimize trace output (#30882)
Yisaer Dec 22, 2021
9063d3b
table: set the datum collation correctly in CastValue() (#30931)
tangenta Dec 22, 2021
1f6d2dd
*: Use TxnManager.GetTxnInfoSchema() to get the txn infoschema (#30934)
lcwangchao Dec 22, 2021
d543b60
parser: add IsValid() to Encoding to speed up string validation for U…
tangenta Dec 22, 2021
713e699
planner: rename pstmtPlanCacheXX to PlanCacheXX (#30909)
Reminiscent Dec 22, 2021
2fb260f
table/tables: make CI TestCacheTableBasicReadAndWrite more stable (#3…
tiancaiamao Dec 22, 2021
efb5330
restore: use new ScatterRegions API (#30899)
YuJuncen Dec 22, 2021
b53f349
*: when placement conflicts with tiflash, cancel the job (#30945)
lcwangchao Dec 22, 2021
ec55c38
Makefile,tools: make CI great again! (#30828)
tiancaiamao Dec 23, 2021
dfc25ff
br/pkg/membuf: remove global buffer pool (#29934)
sleepymole Dec 23, 2021
b9eb9f6
ddl: add format error for incorrect dict syntax in the placement rule…
hawkingrei Dec 23, 2021
7121bf0
planner: fix index merge plan when expr cannot be pushed to tikv (#30…
guo-shaoge Dec 23, 2021
d2ed2ae
executor: display 'show create table' and INFOSCHEMA for cached table…
tiancaiamao Dec 23, 2021
693946b
br: extend the timeout for scan region since 3 seconds is not enough …
fengou1 Dec 23, 2021
0d899cd
planner: remove bindSQL from planCacheKey to planCacheValue (#30916)
Reminiscent Dec 23, 2021
df58e6c
execution: refine precision of cast as decimal in agg func (#30805)
dragonly Dec 23, 2021
dfaabf4
*: fix data race in the tikv_client (#30964)
hawkingrei Dec 23, 2021
586eed9
ddl: migrate test-infra to testify for ddl/db_partition_test.go (#30952)
MiaoMiaoGarden Dec 23, 2021
e24493f
planner: fix `AccessPath.TableFilters` got modified unexpectedly (#30…
time-and-fate Dec 23, 2021
4dc385c
test: merge serial tests in ddl, infoschema, session, store, table, t…
tangenta Dec 23, 2021
404895c
executor: fix the returned field count of the prepare statement (#30981)
tiancaiamao Dec 23, 2021
6e6db1f
binlog: allow multiple ddl targets (#30904)
hicqu Dec 24, 2021
30c5f5b
planner: trace predicate push down (#30902)
Yisaer Dec 24, 2021
93d28b9
placement: give default 2 followers for non-sugar syntax (#31000)
xhebox Dec 24, 2021
42cf333
flatten the json output (#30905)
Yisaer Dec 24, 2021
3de1384
test: control log level with environment variables (#30871)
tangenta Dec 24, 2021
ab821eb
planner: add usage of paging copr in optimizer (#30536)
you06 Dec 24, 2021
9ad0096
test: merge serial tests in cmd, planner, server, util (#31003)
tangenta Dec 24, 2021
76aae0d
planner: change predicateColumnCollector to columnStatsUsageCollector…
xuyifangreeneyes Dec 25, 2021
5ea46ea
executor: migrate test-infra to testify for distsql_test.go (#31023)
znhh6018 Dec 26, 2021
6d971dc
Merge branch 'br_ddl' into merge_ddl
fengou1 Dec 26, 2021
cb4da54
remote uncessary package errors
fengou1 Sep 28, 2021
f677a58
reused the retry code from lightning
fengou1 Sep 29, 2021
afb61f3
refactoring retryable
fengou1 Oct 7, 2021
4ac9368
ddl: add batch create table api
xhebox Oct 12, 2021
79424ba
ddl: add unit tests
xhebox Oct 12, 2021
1dab65a
ddl: fix fmt
xhebox Oct 12, 2021
608b3bf
br ddl code
fengou1 Oct 27, 2021
a460ca2
parallel create tables in br
fengou1 Dec 15, 2021
44b5e6f
ddl: add batch create table api
xhebox Oct 12, 2021
ecc3abc
ddl: add unit tests
xhebox Oct 12, 2021
8bb0b00
ddl: fix fmt
xhebox Oct 12, 2021
4dba2ba
ddl: typo
xhebox Oct 18, 2021
5c77213
ddl: fix tests
xhebox Oct 19, 2021
ba18d94
ddl: rename to BatchCreateTableWithInfo
xhebox Oct 20, 2021
f5cc598
ddl: trace the error
xhebox Oct 20, 2021
64229c6
ddl: comments
xhebox Oct 20, 2021
57b528d
ddl: cancle the job right
xhebox Oct 20, 2021
b493b9d
ddl: cancel the job right 2
xhebox Oct 25, 2021
e11349d
ddl: report error if entry too large
xhebox Oct 26, 2021
9e1adb8
ddl: report error when table is duplicated
xhebox Oct 27, 2021
3044bec
ddl: go fmt
xhebox Oct 27, 2021
b044171
infoschema: improve batch memory perf
xhebox Oct 27, 2021
745ad90
ddl: retain ID
xhebox Oct 29, 2021
8716356
ddl: reduce log frequency
xhebox Dec 15, 2021
2e6504f
ddl: fix tests
xhebox Dec 15, 2021
6d2320d
ddl: remove retainID from the interface
xhebox Dec 22, 2021
5a0bd46
ddl: fix tests
xhebox Dec 22, 2021
779071b
executor: fix rebasing problem
xhebox Dec 27, 2021
b2b0a12
merge from tidb batch ddl
fengou1 Dec 27, 2021
94b56a1
Merge branch 'br_ddl' into br_ddl
fengou1 Dec 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ ignore:
- "executor/seqtest/.*"
- "metrics/.*"
- "expression/generator/.*"
- "br/pkg/mock/.*"

10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ PR Title Format:
-->

### What problem does this PR solve?
<!--

Please create an issue first to describe the problem.

There MUST be one line starting with "Issue Number: " and
linking the relevant issues via the "close" or "ref".

For more info, check https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/contribute-code.html#referring-to-an-issue.

-->

Issue Number: close #xxx

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ coverage.out
*.iml
*.swp
*.log
*.test.bin
tags
profile.coverprofile
explain_test
Expand Down
50 changes: 23 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dev: checklist check explaintest devgotest gogenerate br_unit_test test_part_par
# Install the check tools.
check-setup:tools/bin/revive tools/bin/goword

check: fmt unconvert lint tidy testSuite check-static vet errdoc
check: fmt check-parallel unconvert lint tidy testSuite check-static vet errdoc

fmt:
@echo "gofmt (simplify)"
Expand Down Expand Up @@ -75,6 +75,13 @@ testSuite:
@echo "testSuite"
./tools/check/check_testSuite.sh

check-parallel:
# Make sure no tests are run in parallel to prevent possible unstable tests.
# See https://github.com/pingcap/tidb/pull/30692.
@! find . -name "*_test.go" -not -path "./vendor/*" -print0 | \
xargs -0 grep -F -n "t.Parallel()" || \
! echo "Error: all the go tests should be run in serial."

clean: failpoint-disable
$(GO) clean -i ./...

Expand Down Expand Up @@ -119,30 +126,23 @@ devgotest: failpoint-enable
$(GOTEST) -ldflags '$(TEST_LDFLAGS)' $(EXTRA_TEST_ARGS) -cover $(PACKAGES_TIDB_TESTS) -check.p true > gotest.log || { $(FAILPOINT_DISABLE); grep -v '^\([[]20\|PASS:\|ok \)' 'gotest.log'; exit 1; }
@$(FAILPOINT_DISABLE)

ut: failpoint-enable tools/bin/ut
tools/bin/ut $(X);
@$(FAILPOINT_DISABLE)

gotest: failpoint-enable
@echo "Running in native mode."
@export log_level=info; export TZ='Asia/Shanghai'; \
$(GOTEST) -ldflags '$(TEST_LDFLAGS)' $(EXTRA_TEST_ARGS) -timeout 20m -cover $(PACKAGES_TIDB_TESTS) -coverprofile=coverage.txt -check.p true > gotest.log || { $(FAILPOINT_DISABLE); cat 'gotest.log'; exit 1; }
@$(FAILPOINT_DISABLE)

gotest_in_verify_ci_part_1: failpoint-enable tools/bin/gotestsum tools/bin/gocov tools/bin/gocov-xml
@echo "Running gotest_in_verify_ci_part_1."
gotest_in_verify_ci: failpoint-enable tools/bin/gotestsum
@echo "Running gotest_in_verify_ci"
@mkdir -p $(TEST_COVERAGE_DIR)
@export log_level=info; export TZ='Asia/Shanghai'; \
CGO_ENABLED=1 tools/bin/gotestsum --junitfile "$(TEST_COVERAGE_DIR)/tidb-junit-report.xml" -- -v -p $(P) --race \
@export TZ='Asia/Shanghai'; \
CGO_ENABLED=1 tools/bin/gotestsum --junitfile "$(TEST_COVERAGE_DIR)/tidb-junit-report.xml" -- -v -p $(P) \
-ldflags '$(TEST_LDFLAGS)' $(EXTRA_TEST_ARGS) -coverprofile="$(TEST_COVERAGE_DIR)/tidb_cov.unit_test.out" \
$(PACKAGES_TIDB_TESTS_EXPENSIVE) -check.p true || { $(FAILPOINT_DISABLE); exit 1; }
tools/bin/gocov convert "$(TEST_COVERAGE_DIR)/tidb_cov.unit_test.out" | tools/bin/gocov-xml > "$(TEST_COVERAGE_DIR)/tidb-coverage.xml"
@$(FAILPOINT_DISABLE)

gotest_in_verify_ci_part_2: failpoint-enable tools/bin/gotestsum tools/bin/gocov tools/bin/gocov-xml
@echo "Running gotest_in_verify_ci_part_2."
@mkdir -p $(TEST_COVERAGE_DIR)
@export log_level=info; export TZ='Asia/Shanghai'; \
CGO_ENABLED=1 tools/bin/gotestsum --junitfile "$(TEST_COVERAGE_DIR)/tidb-junit-report.xml" -- -v -p $(P) --race \
-ldflags '$(TEST_LDFLAGS)' $(EXTRA_TEST_ARGS) -coverprofile="$(TEST_COVERAGE_DIR)/tidb_cov.unit_test.out" \
$(PACKAGES_TIDB_TESTS_OTHERS) -check.p true || { $(FAILPOINT_DISABLE); exit 1; }
tools/bin/gocov convert "$(TEST_COVERAGE_DIR)/tidb_cov.unit_test.out" | tools/bin/gocov-xml > "$(TEST_COVERAGE_DIR)/tidb-coverage.xml"
$(PACKAGES_TIDB_TESTS) -check.p true || { $(FAILPOINT_DISABLE); exit 1; }
@$(FAILPOINT_DISABLE)

race: failpoint-enable
Expand Down Expand Up @@ -213,6 +213,10 @@ failpoint-disable: tools/bin/failpoint-ctl
# Restoring gofail failpoints...
@$(FAILPOINT_DISABLE)

tools/bin/ut: tools/check/ut.go
cd tools/check; \
$(GO) build -o ../bin/ut ut.go

tools/bin/megacheck: tools/check/go.mod
cd tools/check; \
$(GO) build -o ../bin/megacheck honnef.co/go/tools/cmd/megacheck
Expand Down Expand Up @@ -326,13 +330,12 @@ br_unit_test:
$(GOTEST) $(RACE_FLAG) -ldflags '$(LDFLAGS)' -tags leak $(ARGS) -coverprofile=coverage.txt || ( make failpoint-disable && exit 1 )
@make failpoint-disable
br_unit_test_in_verify_ci: export ARGS=$$($(BR_PACKAGES))
br_unit_test_in_verify_ci: tools/bin/gotestsum tools/bin/gocov tools/bin/gocov-xml
br_unit_test_in_verify_ci: tools/bin/gotestsum
@make failpoint-enable
@export TZ='Asia/Shanghai';
@mkdir -p $(TEST_COVERAGE_DIR)
CGO_ENABLED=1 tools/bin/gotestsum --junitfile "$(TEST_COVERAGE_DIR)/br-junit-report.xml" -- $(RACE_FLAG) -ldflags '$(LDFLAGS)' \
-tags leak $(ARGS) -coverprofile="$(TEST_COVERAGE_DIR)/br_cov.unit_test.out" || ( make failpoint-disable && exit 1 )
tools/bin/gocov convert "$(TEST_COVERAGE_DIR)/br_cov.unit_test.out" | tools/bin/gocov-xml > "$(TEST_COVERAGE_DIR)/br-coverage.xml"
@make failpoint-disable

br_integration_test: br_bins build_br build_for_br_integration_test
Expand Down Expand Up @@ -392,11 +395,10 @@ dumpling_unit_test: failpoint-enable
$(DUMPLING_GOTEST) $(RACE_FLAG) -coverprofile=coverage.txt -covermode=atomic -tags leak $(DUMPLING_ARGS) || ( make failpoint-disable && exit 1 )
@make failpoint-disable
dumpling_unit_test_in_verify_ci: export DUMPLING_ARGS=$$($(DUMPLING_PACKAGES))
dumpling_unit_test_in_verify_ci: failpoint-enable tools/bin/gotestsum tools/bin/gocov tools/bin/gocov-xml
dumpling_unit_test_in_verify_ci: failpoint-enable tools/bin/gotestsum
@mkdir -p $(TEST_COVERAGE_DIR)
CGO_ENABLED=1 tools/bin/gotestsum --junitfile "$(TEST_COVERAGE_DIR)/dumpling-junit-report.xml" -- -tags leak $(DUMPLING_ARGS) \
$(RACE_FLAG) -coverprofile="$(TEST_COVERAGE_DIR)/dumpling_cov.unit_test.out" || ( make failpoint-disable && exit 1 )
tools/bin/gocov convert "$(TEST_COVERAGE_DIR)/dumpling_cov.unit_test.out" | tools/bin/gocov-xml > "$(TEST_COVERAGE_DIR)/dumpling-coverage.xml"
@make failpoint-disable

dumpling_integration_test: dumpling_bins failpoint-enable build_dumpling
Expand All @@ -420,9 +422,3 @@ dumpling_bins:

tools/bin/gotestsum: tools/check/go.mod
cd tools/check && $(GO) build -o ../bin/gotestsum gotest.tools/gotestsum

tools/bin/gocov: tools/check/go.mod
cd tools/check && $(GO) build -o ../bin/gocov github.com/axw/gocov/gocov

tools/bin/gocov-xml: tools/check/go.mod
cd tools/check && $(GO) build -o ../bin/gocov-xml github.com/AlekSi/gocov-xml
3 changes: 0 additions & 3 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ MAC := "Darwin"

PACKAGE_LIST := go list ./...
PACKAGE_LIST_TIDB_TESTS := go list ./... | grep -vE "github.com\/pingcap\/tidb\/br|github.com\/pingcap\/tidb\/cmd|github.com\/pingcap\/tidb\/dumpling"
PACKAGE_LIST_TEST_OTHERS := go list ./... | grep -vE "github.com\/pingcap\/tidb\/br|github.com\/pingcap\/tidb\/cmd|github.com\/pingcap\/tidb\/dumpling|github.com\/pingcap\/tidb\/executor|github.com\/pingcap\/tidb\/cmd|github.com\/pingcap\/tidb\/ddl"
PACKAGES ?= $$($(PACKAGE_LIST))
PACKAGES_TIDB_TESTS ?= $$($(PACKAGE_LIST_TIDB_TESTS))
PACKAGES_TIDB_TESTS_EXPENSIVE ?= "github.com/pingcap/tidb/executor" "github.com/pingcap/tidb/ddl"
PACKAGES_TIDB_TESTS_OTHERS ?= $$($(PACKAGE_LIST_TEST_OTHERS))
PACKAGE_DIRECTORIES := $(PACKAGE_LIST) | sed 's|github.com/pingcap/$(PROJECT)/||'
PACKAGE_DIRECTORIES_TIDB_TESTS := $(PACKAGE_LIST_TIDB_TESTS) | sed 's|github.com/pingcap/$(PROJECT)/||'
FILES := $$(find $$($(PACKAGE_DIRECTORIES)) -name "*.go")
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions bindinfo/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (h *BindHandle) Update(fullLoad bool) (err error) {
}

exec := h.sctx.Context.(sqlexec.RestrictedSQLExecutor)
stmt, err := exec.ParseWithParams(context.TODO(), `SELECT original_sql, bind_sql, default_db, status, create_time, update_time, charset, collation, source
stmt, err := exec.ParseWithParamsInternal(context.TODO(), `SELECT original_sql, bind_sql, default_db, status, create_time, update_time, charset, collation, source
FROM mysql.bind_info WHERE update_time > %? ORDER BY update_time, create_time`, updateTime)
if err != nil {
return err
Expand Down Expand Up @@ -697,7 +697,7 @@ func (h *BindHandle) extractCaptureFilterFromStorage() (filter *captureFilter) {
tables: make(map[stmtctx.TableEntry]struct{}),
}
exec := h.sctx.Context.(sqlexec.RestrictedSQLExecutor)
stmt, err := exec.ParseWithParams(context.TODO(), `SELECT filter_type, filter_value FROM mysql.capture_plan_baselines_blacklist order by filter_type`)
stmt, err := exec.ParseWithParamsInternal(context.TODO(), `SELECT filter_type, filter_value FROM mysql.capture_plan_baselines_blacklist order by filter_type`)
if err != nil {
logutil.BgLogger().Warn("[sql-bind] failed to parse query for mysql.capture_plan_baselines_blacklist load", zap.Error(err))
return
Expand Down Expand Up @@ -923,7 +923,7 @@ func (h *BindHandle) SaveEvolveTasksToStore() {
}

func getEvolveParameters(ctx sessionctx.Context) (time.Duration, time.Time, time.Time, error) {
stmt, err := ctx.(sqlexec.RestrictedSQLExecutor).ParseWithParams(
stmt, err := ctx.(sqlexec.RestrictedSQLExecutor).ParseWithParamsInternal(
context.TODO(),
"SELECT variable_name, variable_value FROM mysql.global_variables WHERE variable_name IN (%?, %?, %?)",
variable.TiDBEvolvePlanTaskMaxTime,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion bindinfo/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
)

func TestMain(m *testing.M) {
testbridge.WorkaroundGoCheckFlags()
testbridge.SetupForCommonTest()
opts := []goleak.Option{
goleak.IgnoreTopFunction("go.etcd.io/etcd/pkg/logutil.(*MergeLogger).outputLoop"),
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 7 additions & 1 deletion br/pkg/backup/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,13 @@ func (bc *Client) BackupRanges(
elctx := logutil.ContextWithField(ectx, logutil.RedactAny("range-sn", id))
err := bc.BackupRange(elctx, sk, ek, req, metaWriter, progressCallBack)
if err != nil {
return errors.Trace(err)
// The error due to context cancel, stack trace is meaningless, the stack shall be suspended (also clear)
if errors.Cause(err) == context.Canceled {
return errors.SuspendStack(err)
} else {
return errors.Trace(err)
}

}
return nil
})
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/conn/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ func TestMain(m *testing.M) {
goleak.IgnoreTopFunction("go.etcd.io/etcd/pkg/logutil.(*MergeLogger).outputLoop"),
goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"),
}
testbridge.WorkaroundGoCheckFlags()
testbridge.SetupForCommonTest()
goleak.VerifyTestMain(m, opts...)
}
4 changes: 2 additions & 2 deletions br/pkg/gluetidb/glue.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (gs *tidbSession) CreateDatabase(ctx context.Context, schema *model.DBInfo)
if len(schema.Charset) == 0 {
schema.Charset = mysql.DefaultCharset
}
return d.CreateSchemaWithInfo(gs.se, schema, ddl.OnExistIgnore, true)
return d.CreateSchemaWithInfo(gs.se, schema, ddl.OnExistIgnore)
}

// CreateTable implements glue.Session.
Expand Down Expand Up @@ -188,7 +188,7 @@ func (gs *tidbSession) CreateTable(ctx context.Context, dbName model.CIStr, tabl
newPartition.Definitions = append([]model.PartitionDefinition{}, table.Partition.Definitions...)
table.Partition = &newPartition
}
return d.CreateTableWithInfo(gs.se, dbName, table, ddl.OnExistIgnore, true)
return d.CreateTableWithInfo(gs.se, dbName, table, ddl.OnExistIgnore)
}

// Close implements glue.Session.
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/kv/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ import (
)

func TestMain(m *testing.M) {
testbridge.WorkaroundGoCheckFlags()
testbridge.SetupForCommonTest()
goleak.VerifyTestMain(m)
}
2 changes: 0 additions & 2 deletions br/pkg/lightning/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ import (
"github.com/pingcap/failpoint"
"github.com/pingcap/tidb/br/pkg/lightning/backend/kv"
"github.com/pingcap/tidb/br/pkg/lightning/checkpoints"
"github.com/pingcap/tidb/br/pkg/lightning/config"
"github.com/pingcap/tidb/br/pkg/lightning/log"
"github.com/pingcap/tidb/br/pkg/lightning/metric"
"github.com/pingcap/tidb/br/pkg/lightning/mydump"
"github.com/pingcap/tidb/br/pkg/utils"
"github.com/pingcap/tidb/parser/model"
"github.com/pingcap/tidb/table"
"go.uber.org/zap"
)
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/backend/local/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ func (e *Engine) loadEngineMeta() error {
jsonBytes, closer, err := e.db.Get(engineMetaKey)
if err != nil {
if err == pebble.ErrNotFound {
log.L().Debug("local db missing engine meta", zap.Stringer("uuid", e.UUID), zap.Error(err))
log.L().Debug("local db missing engine meta", zap.Stringer("uuid", e.UUID), log.ShortError(err))
return nil
}
return err
Expand Down
25 changes: 17 additions & 8 deletions br/pkg/lightning/backend/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ const (
gRPCBackOffMaxDelay = 10 * time.Minute

// See: https://github.com/tikv/tikv/blob/e030a0aae9622f3774df89c62f21b2171a72a69e/etc/config-template.toml#L360
regionMaxKeyCount = 1_440_000
// lower the max-key-count to avoid tikv trigger region auto split
regionMaxKeyCount = 1_280_000
defaultRegionSplitSize = 96 * units.MiB

propRangeIndex = "tikv.range_index"
Expand Down Expand Up @@ -149,9 +150,9 @@ type local struct {
duplicateDetection bool
duplicateDB *pebble.DB
errorMgr *errormanager.ErrorManager
}

var bufferPool = membuf.NewPool(1024, manual.Allocator{})
bufferPool *membuf.Pool
}

func openDuplicateDB(storeDir string) (*pebble.DB, error) {
dbPath := filepath.Join(storeDir, duplicateDBName)
Expand Down Expand Up @@ -243,6 +244,8 @@ func NewLocalBackend(
checkTiKVAvaliable: cfg.App.CheckRequirements,
duplicateDB: duplicateDB,
errorMgr: errorMgr,

bufferPool: membuf.NewPool(membuf.WithAllocator(manual.Allocator{})),
}
local.conns = common.NewGRPCConns()
if err = local.checkMultiIngestSupport(ctx); err != nil {
Expand Down Expand Up @@ -422,6 +425,7 @@ func (local *local) Close() {
engine.unlock()
}
local.conns.Close()
local.bufferPool.Destroy()

if local.duplicateDB != nil {
// Check whether there are duplicates.
Expand Down Expand Up @@ -775,14 +779,19 @@ func (local *local) WriteToTiKV(
requests = append(requests, req)
}

bytesBuf := bufferPool.NewBuffer()
bytesBuf := local.bufferPool.NewBuffer()
defer bytesBuf.Destroy()
pairs := make([]*sst.Pair, 0, local.batchWriteKVPairs)
count := 0
size := int64(0)
totalCount := int64(0)
firstLoop := true
regionMaxSize := regionSplitSize * 4 / 3
// if region-split-size <= 96MiB, we bump the threshold a bit to avoid too many retry split
// because the range-properties is not 100% accurate
regionMaxSize := regionSplitSize
if regionSplitSize <= defaultRegionSplitSize {
regionMaxSize = regionSplitSize * 4 / 3
}

for iter.First(); iter.Valid(); iter.Next() {
size += int64(len(iter.Key()) + len(iter.Value()))
Expand Down Expand Up @@ -1658,14 +1667,14 @@ func (local *local) LocalWriter(ctx context.Context, cfg *backend.LocalWriterCon
return nil, errors.Errorf("could not find engine for %s", engineUUID.String())
}
engine := e.(*Engine)
return openLocalWriter(cfg, engine, local.localWriterMemCacheSize)
return openLocalWriter(cfg, engine, local.localWriterMemCacheSize, local.bufferPool.NewBuffer())
}

func openLocalWriter(cfg *backend.LocalWriterConfig, engine *Engine, cacheSize int64) (*Writer, error) {
func openLocalWriter(cfg *backend.LocalWriterConfig, engine *Engine, cacheSize int64, kvBuffer *membuf.Buffer) (*Writer, error) {
w := &Writer{
engine: engine,
memtableSizeLimit: cacheSize,
kvBuffer: bufferPool.NewBuffer(),
kvBuffer: kvBuffer,
isKVSorted: cfg.IsKVSorted,
isWriteBatchSorted: true,
}
Expand Down
6 changes: 5 additions & 1 deletion br/pkg/lightning/backend/local/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import (
"github.com/pingcap/tidb/br/pkg/lightning/backend/kv"
"github.com/pingcap/tidb/br/pkg/lightning/common"
"github.com/pingcap/tidb/br/pkg/lightning/mydump"
"github.com/pingcap/tidb/br/pkg/membuf"
"github.com/pingcap/tidb/br/pkg/mock"
"github.com/pingcap/tidb/br/pkg/pdutil"
"github.com/pingcap/tidb/br/pkg/restore"
Expand Down Expand Up @@ -357,7 +358,10 @@ func testLocalWriter(c *C, needSort bool, partitialSort bool) {
f.wg.Add(1)
go f.ingestSSTLoop()
sorted := needSort && !partitialSort
w, err := openLocalWriter(&backend.LocalWriterConfig{IsKVSorted: sorted}, f, 1024)
pool := membuf.NewPool()
defer pool.Destroy()
kvBuffer := pool.NewBuffer()
w, err := openLocalWriter(&backend.LocalWriterConfig{IsKVSorted: sorted}, f, 1024, kvBuffer)
c.Assert(err, IsNil)

ctx := context.Background()
Expand Down
5 changes: 5 additions & 0 deletions br/pkg/lightning/backend/local/localhelper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ func newTestClient(
}
}

// ScatterRegions scatters regions in a batch.
func (c *testClient) ScatterRegions(ctx context.Context, regionInfo []*restore.RegionInfo) error {
return nil
}

func (c *testClient) GetAllRegions() map[uint64]*restore.RegionInfo {
c.mu.RLock()
defer c.mu.RUnlock()
Expand Down
7 changes: 6 additions & 1 deletion br/pkg/lightning/common/storage_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@ import (
"syscall"

"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
"golang.org/x/sys/unix"
)

// GetStorageSize gets storage's capacity and available size
func GetStorageSize(dir string) (size StorageSize, err error) {
var stat unix.Statfs_t
failpoint.Inject("GetStorageSize", func(val failpoint.Value) {
injectedSize := val.(int)
failpoint.Return(StorageSize{Capacity: uint64(injectedSize), Available: uint64(injectedSize)}, nil)
})

var stat unix.Statfs_t
err = unix.Statfs(dir, &stat)
if err != nil {
return size, errors.Annotatef(err, "cannot get disk capacity at %s", dir)
Expand Down
Loading