Skip to content

Commit

Permalink
domain: support extract plan task handle (#41600)
Browse files Browse the repository at this point in the history
* Revert "parser: support plan change capture collect stmt (#41478)"

This reverts commit 301a024.

* support extract worker

support extract worker

support extract worker

fix lint

fix lint

add test

add test

* add test

add test

* add test

* add test

* address the comment
  • Loading branch information
Yisaer authored Feb 22, 2023
1 parent 4bf298f commit 484aa03
Show file tree
Hide file tree
Showing 14 changed files with 734 additions and 370 deletions.
4 changes: 4 additions & 0 deletions domain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ go_library(
"domain.go",
"domain_sysvars.go",
"domainctx.go",
"extract.go",
"historical_stats.go",
"optimize_trace.go",
"plan_replayer.go",
Expand Down Expand Up @@ -99,6 +100,7 @@ go_test(
"domain_test.go",
"domain_utils_test.go",
"domainctx_test.go",
"extract_test.go",
"main_test.go",
"plan_replayer_handle_test.go",
"plan_replayer_test.go",
Expand All @@ -119,6 +121,7 @@ go_test(
"//kv",
"//metrics",
"//parser/ast",
"//parser/auth",
"//parser/model",
"//parser/terror",
"//server",
Expand All @@ -130,6 +133,7 @@ go_test(
"//util",
"//util/mock",
"//util/replayer",
"//util/stmtsummary/v2:stmtsummary",
"@com_github_ngaut_pools//:pools",
"@com_github_pingcap_errors//:errors",
"@com_github_pingcap_failpoint//:failpoint",
Expand Down
11 changes: 11 additions & 0 deletions domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ type Domain struct {
indexUsageSyncLease time.Duration
dumpFileGcChecker *dumpFileGcChecker
planReplayerHandle *planReplayerHandle
extractTaskHandle *extractHandle
expiredTimeStamp4PC types.Time
logBackupAdvancer *daemon.OwnerDaemon
historicalStatsWorker *HistoricalStatsWorker
Expand Down Expand Up @@ -1750,6 +1751,11 @@ func (do *Domain) SetupDumpFileGCChecker(ctx sessionctx.Context) {
do.dumpFileGcChecker.planReplayerTaskStatus = do.planReplayerHandle.status
}

// SetupExtractHandle setups extract handler
func (do *Domain) SetupExtractHandle(sctxs []sessionctx.Context) {
do.extractTaskHandle = NewExtractHandler(sctxs)
}

var planReplayerHandleLease atomic.Uint64

func init() {
Expand Down Expand Up @@ -1813,6 +1819,11 @@ func (do *Domain) GetPlanReplayerHandle() *planReplayerHandle {
return do.planReplayerHandle
}

// GetExtractHandle returns extract handle
func (do *Domain) GetExtractHandle() *extractHandle {
return do.extractTaskHandle
}

// DumpFileGcCheckerLoop creates a goroutine that handles `exit` and `gc`.
func (do *Domain) DumpFileGcCheckerLoop() {
do.wg.Run(func() {
Expand Down
Loading

0 comments on commit 484aa03

Please sign in to comment.