Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
- `pkg/executor/explain_unit_test.go` - executor: Tests explain analyze invoke next and close.
- `pkg/executor/explainfor_test.go` - executor: Tests explain for.
- `pkg/executor/grant_test.go` - executor: Tests grant global.
- `pkg/executor/historical_stats_test.go` - executor: Tests record history stats after analyze.
- `pkg/executor/hot_regions_history_table_test.go` - executor: Tests TiDB hot regions history.
- `pkg/executor/import_into_test.go` - executor: Tests security enhanced mode.
- `pkg/executor/infoschema_cluster_table_test.go` - executor: Tests skip empty IP nodes for TiDB-type coprocessor.
Expand Down Expand Up @@ -393,7 +392,7 @@

### Tests
- `pkg/executor/test/planreplayer/main_test.go` - Configures default goleak settings and registers testdata.
- `pkg/executor/test/planreplayer/plan_replayer_test.go` - executor/test/planreplayer: Tests plan replayer.
- `pkg/executor/test/planreplayer/plan_replayer_test.go` - executor/test/planreplayer: Tests plan replayer dump, load, capture, and legacy syntax rejection.

## pkg/executor/test/seqtest

Expand Down
2 changes: 1 addition & 1 deletion br/pkg/restore/snap_client/pipeline_items.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ func (buffer *statsMetaItemBuffer) saveMetaToStorageWithRetry(
) error {
state := utils.InitialRetryState(8, 500*time.Millisecond, 500*time.Millisecond)
err := utils.WithRetry(ctx, func() error {
if err := statsHandler.SaveMetaToStorage("br restore", false, metaUpdates...); err != nil {
if err := statsHandler.SaveMetaToStorage(false, metaUpdates...); err != nil {
log.Error("failed to save meta to storage", zap.Error(err))
return errors.Trace(err)
}
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/restore/snap_client/pipeline_items_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ type mockStatsReadWriter struct {
rows map[int64]int64
}

func (m *mockStatsReadWriter) SaveMetaToStorage(_ string, _ bool, metaUpdates ...statstypes.MetaUpdate) (err error) {
func (m *mockStatsReadWriter) SaveMetaToStorage(_ bool, metaUpdates ...statstypes.MetaUpdate) (err error) {
for _, metaUpdate := range metaUpdates {
m.rows[metaUpdate.PhysicalID] += metaUpdate.Count
}
Expand Down
34 changes: 12 additions & 22 deletions docs/tidb_http_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -609,17 +609,7 @@ timezone.*
curl http://{TiDBIP}:10080/stats/dump/{db}/{table}
```

30. Get statistics data of specific table and timestamp.

```shell
curl http://{TiDBIP}:10080/stats/dump/{db}/{table}/{yyyyMMddHHmmss}
```

```shell
curl http://{TiDBIP}:10080/stats/dump/{db}/{table}/{yyyy-MM-dd HH:mm:ss}
```

31. Resume the binlog writing when Pump is recovered.
30. Resume the binlog writing when Pump is recovered.

```shell
curl http://{TiDBIP}:10080/binlog/recover
Expand All @@ -646,28 +636,28 @@ timezone.*
- op=reset: reset `SkippedCommitterCounter` to 0 to avoid the problem that `SkippedCommitterCounter` is not cleared due to some unusual cases.
- op=status: Get the current status of binlog recovery.

32. Enable/disable async commit feature
31. Enable/disable async commit feature

```shell
curl -X POST -d "tidb_enable_async_commit=1" http://{TiDBIP}:10080/settings
curl -X POST -d "tidb_enable_async_commit=0" http://{TiDBIP}:10080/settings
```

33. Enable/disable one-phase commit feature
32. Enable/disable one-phase commit feature

```shell
curl -X POST -d "tidb_enable_1pc=1" http://{TiDBIP}:10080/settings
curl -X POST -d "tidb_enable_1pc=0" http://{TiDBIP}:10080/settings
```

34. Enable/disable the mutation checker
33. Enable/disable the mutation checker

```shell
curl -X POST -d "tidb_enable_mutation_checker=1" http://{TiDBIP}:10080/settings
curl -X POST -d "tidb_enable_mutation_checker=0" http://{TiDBIP}:10080/settings
```

35. Get/Set the size of the Ballast Object
34. Get/Set the size of the Ballast Object

```shell
# get current size of the ballast object
Expand All @@ -676,33 +666,33 @@ timezone.*
curl -v -X POST -d "2147483648" http://{TiDBIP}:10080/debug/ballast-object-sz
```

36. Set deadlock history table capacity
35. Set deadlock history table capacity

```shell
curl -X POST -d "deadlock_history_capacity={number}" http://{TiDBIP}:10080/settings
```

37. Set whether deadlock history (`DEADLOCKS`) collect retryable deadlocks
36. Set whether deadlock history (`DEADLOCKS`) collect retryable deadlocks

```shell
curl -X POST -d "deadlock_history_collect_retryable={bool_val}" http://{TiDBIP}:10080/settings
```

38. Set transaction_id to digest mapping minimum duration threshold, only transactions which last longer than this threshold will be collected into `TRX_SUMMARY`.
37. Set transaction_id to digest mapping minimum duration threshold, only transactions which last longer than this threshold will be collected into `TRX_SUMMARY`.

```shell
curl -X POST -d "transaction_id_digest_min_duration={number}" http://{TiDBIP}:10080/settings
```

Unit of duration here is ms.

39. Set transaction summary table (`TRX_SUMMARY`) capacity
38. Set transaction summary table (`TRX_SUMMARY`) capacity

```shell
curl -X POST -d "transaction_summary_capacity={number}" http://{TiDBIP}:10080/settings
```

40. The commands are used to handle smooth upgrade mode(refer to the [TiDB Smooth Upgrade](https://github.com/pingcap/docs/blob/4aa0b1d5078617cc06bd1957c5c93e86efb4668d/smooth-upgrade-tidb.md) for details) operations. We can send these upgrade operations to the cluster. The operations here include `start`, `finish` and `show`.
39. The commands are used to handle smooth upgrade mode(refer to the [TiDB Smooth Upgrade](https://github.com/pingcap/docs/blob/4aa0b1d5078617cc06bd1957c5c93e86efb4668d/smooth-upgrade-tidb.md) for details) operations. We can send these upgrade operations to the cluster. The operations here include `start`, `finish` and `show`.

```shell
curl -X POST http://{TiDBIP}:10080/upgrade/{op}
Expand All @@ -713,7 +703,7 @@ timezone.*
"success!"
```

41. Set split & scatter regions concurrency before ingest, and ingest request concurrency. Value ranges:
40. Set split & scatter regions concurrency before ingest, and ingest request concurrency. Value ranges:
- `max-batch-split-ranges`: `[1, 9223372036854775807]`, default `2048`
- `max-split-ranges-per-sec`: `[0, 9223372036854775807]`, default `0` (no limit)
- `max-ingest-per-sec`: `[0, 9223372036854775807]`, default `0` (no limit)
Expand All @@ -733,7 +723,7 @@ timezone.*
curl http://{TiDBIP}:10080/ingest/max-ingest-inflight -X POST -d "{\"value\": 2}"
```

42. Get TiDB transaction GC states:
41. Get TiDB transaction GC states:

```shell
curl http://{TiDBIP}:10080/txn-gc-states
Expand Down
2 changes: 1 addition & 1 deletion pkg/bindinfo/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ go_test(
],
flaky = True,
race = "on",
shard_count = 25,
shard_count = 26,
deps = [
"//pkg/bindinfo",
"//pkg/domain",
Expand Down
1 change: 0 additions & 1 deletion pkg/domain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ go_library(
"domain_sysvars.go",
"domainctx.go",
"extract.go",
"historical_stats.go",
"optimize_trace.go",
"plan_replayer.go",
"plan_replayer_dump.go",
Expand Down
61 changes: 4 additions & 57 deletions pkg/domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,10 @@ type Domain struct {
expiredTimeStamp types.Time
}

brOwnerMgr owner.Manager
logBackupAdvancer *daemon.OwnerDaemon
historicalStatsWorker *HistoricalStatsWorker
ttlJobManager atomic.Pointer[ttlworker.JobManager]
runawayManager *runaway.Manager
brOwnerMgr owner.Manager
logBackupAdvancer *daemon.OwnerDaemon
ttlJobManager atomic.Pointer[ttlworker.JobManager]
runawayManager *runaway.Manager
// resourceGroupsController can be changed via `SetResourceGroupsController`
// in unit test.
resourceGroupsController atomic.Pointer[rmclient.ResourceGroupsController]
Expand Down Expand Up @@ -1757,14 +1756,6 @@ func (do *Domain) GetRUVersion() rmclient.RUVersion {
return rmclient.DefaultRUVersion
}

// SetupHistoricalStatsWorker setups worker
func (do *Domain) SetupHistoricalStatsWorker(ctx sessionctx.Context) {
do.historicalStatsWorker = &HistoricalStatsWorker{
tblCH: make(chan int64, 16),
sctx: ctx,
}
}

// SetupDumpFileGCChecker setup sctx
func (do *Domain) SetupDumpFileGCChecker(ctx sessionctx.Context) {
do.dumpFileGcChecker.setupSctx(ctx)
Expand All @@ -1780,19 +1771,13 @@ var planReplayerHandleLease atomic.Uint64

func init() {
planReplayerHandleLease.Store(uint64(10 * time.Second))
enableDumpHistoricalStats.Store(true)
}

// DisablePlanReplayerBackgroundJob4Test disable plan replayer handle for test
func DisablePlanReplayerBackgroundJob4Test() {
planReplayerHandleLease.Store(0)
}

// DisableDumpHistoricalStats4Test disable historical dump worker for test
func DisableDumpHistoricalStats4Test() {
enableDumpHistoricalStats.Store(false)
}

// StartPlanReplayerHandle start plan replayer handle job
func (do *Domain) StartPlanReplayerHandle() {
lease := planReplayerHandleLease.Load()
Expand Down Expand Up @@ -1873,44 +1858,6 @@ func (do *Domain) DumpFileGcCheckerLoop() {
}, "dumpFileGcChecker")
}

// GetHistoricalStatsWorker gets historical workers
func (do *Domain) GetHistoricalStatsWorker() *HistoricalStatsWorker {
return do.historicalStatsWorker
}

// EnableDumpHistoricalStats used to control whether enable dump stats for unit test
var enableDumpHistoricalStats atomic.Bool

// StartHistoricalStatsWorker start historical workers running
func (do *Domain) StartHistoricalStatsWorker() {
if !enableDumpHistoricalStats.Load() {
return
}
do.wg.Run(func() {
logutil.BgLogger().Info("HistoricalStatsWorker started")
defer func() {
logutil.BgLogger().Info("HistoricalStatsWorker exited.")
}()
defer util.Recover(metrics.LabelDomain, "HistoricalStatsWorkerLoop", nil, false)

for {
select {
case <-do.exit:
close(do.historicalStatsWorker.tblCH)
return
case tblID, ok := <-do.historicalStatsWorker.tblCH:
if !ok {
return
}
err := do.historicalStatsWorker.DumpHistoricalStats(tblID, do.StatsHandle())
if err != nil {
logutil.BgLogger().Warn("dump historical stats failed", zap.Error(err), zap.Int64("tableID", tblID))
}
}
}
}, "HistoricalStatsWorker")
}

// StatsHandle returns the statistic handle.
func (do *Domain) StatsHandle() *handle.Handle {
return do.statsHandle.Load()
Expand Down
2 changes: 1 addition & 1 deletion pkg/domain/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ func (w *extractWorker) dumpExtractPlanPackage(ctx context.Context, task *Extrac
}
// Dump stats
if !task.SkipStats {
if _, err = dumpStats(zw, p.tables, GetDomain(w.sctx), 0); err != nil {
if err = dumpStats(zw, p.tables, GetDomain(w.sctx)); err != nil {
return "", err
}
}
Expand Down
100 changes: 0 additions & 100 deletions pkg/domain/historical_stats.go

This file was deleted.

6 changes: 0 additions & 6 deletions pkg/domain/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ import (

// domain metrics vars
var (
GenerateHistoricalStatsSuccessCounter prometheus.Counter
GenerateHistoricalStatsFailedCounter prometheus.Counter

PlanReplayerDumpTaskSuccess prometheus.Counter
PlanReplayerDumpTaskFailed prometheus.Counter

Expand All @@ -39,9 +36,6 @@ func init() {

// InitMetricsVars init domain metrics vars.
func InitMetricsVars() {
GenerateHistoricalStatsSuccessCounter = metrics.HistoricalStatsCounter.WithLabelValues("generate", "success")
GenerateHistoricalStatsFailedCounter = metrics.HistoricalStatsCounter.WithLabelValues("generate", "fail")

PlanReplayerDumpTaskSuccess = metrics.PlanReplayerTaskCounter.WithLabelValues("dump", "success")
PlanReplayerDumpTaskFailed = metrics.PlanReplayerTaskCounter.WithLabelValues("dump", "fail")

Expand Down
Loading
Loading