mirror of https://github.com/minio/minio.git
add _MINIO_SERVER_DEBUG env for enabling debug messages (#11128)
This commit is contained in:
parent
7c9ef76f66
commit
f714840da7
|
@ -25,6 +25,7 @@ import (
|
||||||
|
|
||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
"github.com/minio/minio/cmd/logger"
|
"github.com/minio/minio/cmd/logger"
|
||||||
|
"github.com/minio/minio/pkg/console"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -140,6 +141,10 @@ wait:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if serverDebugLog {
|
||||||
|
console.Debugf("disk check timer fired, attempting to heal %d drives\n", len(healDisks))
|
||||||
|
}
|
||||||
|
|
||||||
// heal only if new disks found.
|
// heal only if new disks found.
|
||||||
for _, endpoint := range healDisks {
|
for _, endpoint := range healDisks {
|
||||||
disk, format, err := connectEndpoint(endpoint)
|
disk, format, err := connectEndpoint(endpoint)
|
||||||
|
|
|
@ -30,6 +30,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/fatih/color"
|
||||||
dns2 "github.com/miekg/dns"
|
dns2 "github.com/miekg/dns"
|
||||||
"github.com/minio/cli"
|
"github.com/minio/cli"
|
||||||
"github.com/minio/minio-go/v7/pkg/set"
|
"github.com/minio/minio-go/v7/pkg/set"
|
||||||
|
@ -38,9 +39,13 @@ import (
|
||||||
"github.com/minio/minio/cmd/logger"
|
"github.com/minio/minio/cmd/logger"
|
||||||
"github.com/minio/minio/pkg/auth"
|
"github.com/minio/minio/pkg/auth"
|
||||||
"github.com/minio/minio/pkg/certs"
|
"github.com/minio/minio/pkg/certs"
|
||||||
|
"github.com/minio/minio/pkg/console"
|
||||||
"github.com/minio/minio/pkg/env"
|
"github.com/minio/minio/pkg/env"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// serverDebugLog will enable debug printing
|
||||||
|
var serverDebugLog = env.Get("_MINIO_SERVER_DEBUG", config.EnableOff) == config.EnableOn
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
logger.Init(GOPATH, GOROOT)
|
logger.Init(GOPATH, GOROOT)
|
||||||
logger.RegisterError(config.FmtError)
|
logger.RegisterError(config.FmtError)
|
||||||
|
@ -53,6 +58,8 @@ func init() {
|
||||||
globalReplicationState = newReplicationState()
|
globalReplicationState = newReplicationState()
|
||||||
globalTransitionState = newTransitionState()
|
globalTransitionState = newTransitionState()
|
||||||
|
|
||||||
|
console.SetColor("Debug", color.New())
|
||||||
|
|
||||||
gob.Register(StorageErr(""))
|
gob.Register(StorageErr(""))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ import (
|
||||||
"github.com/minio/minio/pkg/bucket/lifecycle"
|
"github.com/minio/minio/pkg/bucket/lifecycle"
|
||||||
"github.com/minio/minio/pkg/bucket/replication"
|
"github.com/minio/minio/pkg/bucket/replication"
|
||||||
"github.com/minio/minio/pkg/color"
|
"github.com/minio/minio/pkg/color"
|
||||||
|
"github.com/minio/minio/pkg/console"
|
||||||
"github.com/minio/minio/pkg/env"
|
"github.com/minio/minio/pkg/env"
|
||||||
"github.com/minio/minio/pkg/event"
|
"github.com/minio/minio/pkg/event"
|
||||||
"github.com/minio/minio/pkg/hash"
|
"github.com/minio/minio/pkg/hash"
|
||||||
|
@ -110,6 +111,10 @@ func runDataCrawler(ctx context.Context, objAPI ObjectLayer) {
|
||||||
// Reset the timer for next cycle.
|
// Reset the timer for next cycle.
|
||||||
crawlTimer.Reset(dataCrawlStartDelay)
|
crawlTimer.Reset(dataCrawlStartDelay)
|
||||||
|
|
||||||
|
if intDataUpdateTracker.debug {
|
||||||
|
console.Debugln("starting crawler cycle")
|
||||||
|
}
|
||||||
|
|
||||||
// Wait before starting next cycle and wait on startup.
|
// Wait before starting next cycle and wait on startup.
|
||||||
results := make(chan DataUsageInfo, 1)
|
results := make(chan DataUsageInfo, 1)
|
||||||
go storeDataUsageInBackend(ctx, objAPI, results)
|
go storeDataUsageInBackend(ctx, objAPI, results)
|
||||||
|
|
|
@ -79,7 +79,7 @@ func newDataUpdateTracker() *dataUpdateTracker {
|
||||||
Current: dataUpdateFilter{
|
Current: dataUpdateFilter{
|
||||||
idx: 1,
|
idx: 1,
|
||||||
},
|
},
|
||||||
debug: env.Get(envDataUsageCrawlDebug, config.EnableOff) == config.EnableOn,
|
debug: env.Get(envDataUsageCrawlDebug, config.EnableOff) == config.EnableOn || serverDebugLog,
|
||||||
input: make(chan string, dataUpdateTrackerQueueSize),
|
input: make(chan string, dataUpdateTrackerQueueSize),
|
||||||
save: make(chan struct{}, 1),
|
save: make(chan struct{}, 1),
|
||||||
saveExited: make(chan struct{}),
|
saveExited: make(chan struct{}),
|
||||||
|
|
|
@ -34,6 +34,7 @@ import (
|
||||||
"github.com/minio/minio-go/v7/pkg/tags"
|
"github.com/minio/minio-go/v7/pkg/tags"
|
||||||
"github.com/minio/minio/cmd/logger"
|
"github.com/minio/minio/cmd/logger"
|
||||||
"github.com/minio/minio/pkg/bpool"
|
"github.com/minio/minio/pkg/bpool"
|
||||||
|
"github.com/minio/minio/pkg/console"
|
||||||
"github.com/minio/minio/pkg/dsync"
|
"github.com/minio/minio/pkg/dsync"
|
||||||
"github.com/minio/minio/pkg/madmin"
|
"github.com/minio/minio/pkg/madmin"
|
||||||
"github.com/minio/minio/pkg/sync/errgroup"
|
"github.com/minio/minio/pkg/sync/errgroup"
|
||||||
|
@ -281,6 +282,10 @@ func (s *erasureSets) monitorAndConnectEndpoints(ctx context.Context, monitorInt
|
||||||
// Reset the timer once fired for required interval.
|
// Reset the timer once fired for required interval.
|
||||||
monitor.Reset(monitorInterval)
|
monitor.Reset(monitorInterval)
|
||||||
|
|
||||||
|
if serverDebugLog {
|
||||||
|
console.Debugln("running disk monitoring")
|
||||||
|
}
|
||||||
|
|
||||||
s.connectDisks()
|
s.connectDisks()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,8 +74,8 @@ func newBucketMetacache(bucket string, cleanup bool) *bucketMetacache {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *bucketMetacache) debugf(format string, data ...interface{}) {
|
func (b *bucketMetacache) debugf(format string, data ...interface{}) {
|
||||||
if metacacheDebug {
|
if serverDebugLog {
|
||||||
console.Debugf(format, data...)
|
console.Debugf(format+"\n", data...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,13 +125,13 @@ func (o listPathOptions) newMetacache() metacache {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *listPathOptions) debugf(format string, data ...interface{}) {
|
func (o *listPathOptions) debugf(format string, data ...interface{}) {
|
||||||
if metacacheDebug {
|
if serverDebugLog {
|
||||||
console.Debugf(format, data...)
|
console.Debugf(format, data...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *listPathOptions) debugln(data ...interface{}) {
|
func (o *listPathOptions) debugln(data ...interface{}) {
|
||||||
if metacacheDebug {
|
if serverDebugLog {
|
||||||
console.Debugln(data...)
|
console.Debugln(data...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,6 @@ const (
|
||||||
// Enabling this will make cache sharing more likely and cause less IO,
|
// Enabling this will make cache sharing more likely and cause less IO,
|
||||||
// but may cause additional latency to some calls.
|
// but may cause additional latency to some calls.
|
||||||
metacacheSharePrefix = false
|
metacacheSharePrefix = false
|
||||||
|
|
||||||
// metacacheDebug will enable debug printing
|
|
||||||
metacacheDebug = false
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate msgp -file $GOFILE -unexported
|
//go:generate msgp -file $GOFILE -unexported
|
||||||
|
|
|
@ -30,9 +30,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// DebugPrint enables/disables console debug printing.
|
|
||||||
DebugPrint = false
|
|
||||||
|
|
||||||
// Used by the caller to print multiple lines atomically. Exposed by Lock/Unlock methods.
|
// Used by the caller to print multiple lines atomically. Exposed by Lock/Unlock methods.
|
||||||
publicMutex sync.Mutex
|
publicMutex sync.Mutex
|
||||||
|
|
||||||
|
@ -112,23 +109,17 @@ var (
|
||||||
// Debug prints a debug message without a new line
|
// Debug prints a debug message without a new line
|
||||||
// Debug prints a debug message.
|
// Debug prints a debug message.
|
||||||
Debug = func(data ...interface{}) {
|
Debug = func(data ...interface{}) {
|
||||||
if DebugPrint {
|
consolePrint("Debug", Theme["Debug"], data...)
|
||||||
consolePrint("Debug", Theme["Debug"], data...)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debugf prints a debug message with a new line.
|
// Debugf prints a debug message with a new line.
|
||||||
Debugf = func(format string, data ...interface{}) {
|
Debugf = func(format string, data ...interface{}) {
|
||||||
if DebugPrint {
|
consolePrintf("Debug", Theme["Debug"], format, data...)
|
||||||
consolePrintf("Debug", Theme["Debug"], format, data...)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debugln prints a debug message with a new line.
|
// Debugln prints a debug message with a new line.
|
||||||
Debugln = func(data ...interface{}) {
|
Debugln = func(data ...interface{}) {
|
||||||
if DebugPrint {
|
consolePrintln("Debug", Theme["Debug"], data...)
|
||||||
consolePrintln("Debug", Theme["Debug"], data...)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Colorize prints message in a colorized form, dictated by the corresponding tag argument.
|
// Colorize prints message in a colorized form, dictated by the corresponding tag argument.
|
||||||
|
|
Loading…
Reference in New Issue