Skip to content

Commit

Permalink
revert some change
Browse files Browse the repository at this point in the history
  • Loading branch information
D3Hunter committed Mar 12, 2024
1 parent 6bf8152 commit 38d64d7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion pkg/disttask/framework/taskexecutor/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ go_library(
"//pkg/metrics",
"//pkg/util",
"//pkg/util/backoff",
"//pkg/util/cgroup",
"//pkg/util/cpu",
"//pkg/util/gctuner",
"//pkg/util/intest",
Expand Down
4 changes: 1 addition & 3 deletions pkg/disttask/framework/taskexecutor/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"github.com/pingcap/tidb/pkg/metrics"
tidbutil "github.com/pingcap/tidb/pkg/util"
"github.com/pingcap/tidb/pkg/util/backoff"
"github.com/pingcap/tidb/pkg/util/cgroup"
"github.com/pingcap/tidb/pkg/util/cpu"
"github.com/pingcap/tidb/pkg/util/intest"
"github.com/pingcap/tidb/pkg/util/memory"
Expand Down Expand Up @@ -92,8 +91,7 @@ func NewManager(ctx context.Context, id string, taskTable TaskTable) (*Manager,
if totalCPU <= 0 || totalMem <= 0 {
return nil, errors.Errorf("invalid cpu or memory, cpu: %d, memory: %d", totalCPU, totalMem)
}
logger.Info("build task executor manager", zap.Bool("in-container", cgroup.InContainer()),
zap.Int("total-cpu", totalCPU),
logger.Info("build task executor manager", zap.Int("total-cpu", totalCPU),
zap.String("total-mem", units.BytesSize(float64(totalMem))))
m := &Manager{
id: id,
Expand Down
5 changes: 3 additions & 2 deletions pkg/util/cgroup/cgroup_cpu_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ func inContainer(path string) bool {
lines := strings.Split(string(v), "\n")
for _, line := range lines {
v := strings.Split(line, " ")
// check mount point is on overlay or not, v[8] means `filesystem type`.
// check mount point of root dir is on overlay or not.
// v[4] means `mount point`, v[8] means `filesystem type`.
// see details from https://man7.org/linux/man-pages/man5/proc.5.html
// TODO: enhance this check, as overlay is not the only storage driver for container.
if len(v) > 8 && v[8] == "overlay" {
if len(v) > 8 && v[4] == "/" && v[8] == "overlay" {
log.Info(fmt.Sprintf("TiDB runs in a container, mount info: %s", line))
return true
}
Expand Down

0 comments on commit 38d64d7

Please sign in to comment.