diff --git a/Makefile b/Makefile index 0c5c3a37e..507a6afdd 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ help: ## print this help getdeps: ## fetch necessary dependencies @mkdir -p ${GOPATH}/bin @echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin - @echo "Installing msgp" && go install -v github.com/tinylib/msgp@v1.1.7-0.20211026165309-e818a1881b0e + @echo "Installing msgp" && go install -v github.com/tinylib/msgp@f3635b96e4838a6c773babb65ef35297fe5fe2f9 @echo "Installing stringer" && go install -v golang.org/x/tools/cmd/stringer@latest crosscompile: ## cross compile minio diff --git a/cmd/data-usage-cache_gen.go b/cmd/data-usage-cache_gen.go index 69424fe7c..2c3e250c8 100644 --- a/cmd/data-usage-cache_gen.go +++ b/cmd/data-usage-cache_gen.go @@ -651,6 +651,7 @@ func (z *dataUsageCacheInfo) EncodeMsg(en *msgp.Writer) (err error) { // omitempty: check for empty values zb0001Len := uint32(5) var zb0001Mask uint8 /* 5 bits */ + _ = zb0001Mask if z.BloomFilter == nil { zb0001Len-- zb0001Mask |= 0x10 @@ -724,6 +725,7 @@ func (z *dataUsageCacheInfo) MarshalMsg(b []byte) (o []byte, err error) { // omitempty: check for empty values zb0001Len := uint32(5) var zb0001Mask uint8 /* 5 bits */ + _ = zb0001Mask if z.BloomFilter == nil { zb0001Len-- zb0001Mask |= 0x10 @@ -1652,6 +1654,7 @@ func (z *dataUsageEntry) EncodeMsg(en *msgp.Writer) (err error) { // omitempty: check for empty values zb0001Len := uint32(8) var zb0001Mask uint8 /* 8 bits */ + _ = zb0001Mask if z.ReplicationStats == nil { zb0001Len-- zb0001Mask |= 0x20 @@ -1782,6 +1785,7 @@ func (z *dataUsageEntry) MarshalMsg(b []byte) (o []byte, err error) { // omitempty: check for empty values zb0001Len := uint32(8) var zb0001Mask uint8 /* 8 bits */ + _ = zb0001Mask if z.ReplicationStats == nil { zb0001Len-- zb0001Mask |= 0x20 @@ -2774,6 +2778,7 @@ func (z *replicationAllStats) EncodeMsg(en *msgp.Writer) (err error) { // omitempty: check for empty values zb0001Len := uint32(2) var zb0001Mask uint8 /* 2 bits */ + _ = zb0001Mask if z.Targets == nil { zb0001Len-- zb0001Mask |= 0x1 @@ -2835,6 +2840,7 @@ func (z *replicationAllStats) MarshalMsg(b []byte) (o []byte, err error) { // omitempty: check for empty values zb0001Len := uint32(2) var zb0001Mask uint8 /* 2 bits */ + _ = zb0001Mask if z.Targets == nil { zb0001Len-- zb0001Mask |= 0x1 diff --git a/cmd/erasure-healing.go b/cmd/erasure-healing.go index 7e95dd66c..a43a5bcd3 100644 --- a/cmd/erasure-healing.go +++ b/cmd/erasure-healing.go @@ -33,6 +33,15 @@ import ( const reservedMetadataPrefixLowerDataShardFix = ReservedMetadataPrefixLower + "data-shard-fix" +//go:generate stringer -type=healingMetric -trimprefix=healingMetric $GOFILE + +type healingMetric uint8 + +const ( + healingMetricBucket healingMetric = iota + healingMetricObject +) + // AcceptableDelta returns 'true' if the fi.DiskMTime is under // acceptable delta of "delta" duration with maxTime. // @@ -84,7 +93,7 @@ func (er erasureObjects) healBucket(ctx context.Context, storageDisks []StorageA if globalTrace.NumSubscribers(madmin.TraceHealing) > 0 { startTime := time.Now() defer func() { - healTrace("heal.checkBucket", startTime, bucket, "", "", opts, err, &res) + healTrace(healingMetricBucket, startTime, bucket, "", "", opts, err, &res) }() } @@ -295,7 +304,7 @@ func (er erasureObjects) healObject(ctx context.Context, bucket string, object s if globalTrace.NumSubscribers(madmin.TraceHealing) > 0 { startTime := time.Now() defer func() { - healTrace("heal.checkVersion", startTime, bucket, object, versionID, opts, err, &result) + healTrace(healingMetricObject, startTime, bucket, object, versionID, opts, err, &result) }() } // Initialize heal result object @@ -1013,18 +1022,18 @@ func (er erasureObjects) HealObject(ctx context.Context, bucket, object, version } // healTrace sends healing results to trace output. -func healTrace(funcName string, startTime time.Time, bucket, object, versionID string, opts madmin.HealOpts, err error, result *madmin.HealResultItem) { +func healTrace(funcName healingMetric, startTime time.Time, bucket, object, versionID string, opts madmin.HealOpts, err error, result *madmin.HealResultItem) { tr := madmin.TraceInfo{ TraceType: madmin.TraceHealing, Time: startTime, NodeName: globalLocalNodeName, - FuncName: funcName, + FuncName: "heal." + funcName.String(), Duration: time.Since(startTime), Message: fmt.Sprintf("dry:%v, rm:%v, recreate:%v mode:%v", opts.DryRun, opts.Remove, opts.Recreate, opts.ScanMode), - Path: fmt.Sprintf("%s/%s", bucket, object), + Path: pathJoin(bucket, decodeDirObject(object)), } if versionID != "" && versionID != "null" { - tr.Path += " v-" + versionID + tr.Path += " v=" + versionID } if err != nil { tr.Error = err.Error() diff --git a/cmd/healingmetric_string.go b/cmd/healingmetric_string.go new file mode 100644 index 000000000..d940d67ef --- /dev/null +++ b/cmd/healingmetric_string.go @@ -0,0 +1,24 @@ +// Code generated by "stringer -type=healingMetric -trimprefix=healingMetric erasure-healing.go"; DO NOT EDIT. + +package cmd + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[healingMetricBucket-0] + _ = x[healingMetricObject-1] +} + +const _healingMetric_name = "BucketObject" + +var _healingMetric_index = [...]uint8{0, 6, 12} + +func (i healingMetric) String() string { + if i >= healingMetric(len(_healingMetric_index)-1) { + return "healingMetric(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _healingMetric_name[_healingMetric_index[i]:_healingMetric_index[i+1]] +} diff --git a/cmd/xl-storage-format-v1_gen.go b/cmd/xl-storage-format-v1_gen.go index d2024d5fa..c25d01263 100644 --- a/cmd/xl-storage-format-v1_gen.go +++ b/cmd/xl-storage-format-v1_gen.go @@ -651,6 +651,7 @@ func (z *ObjectPartInfo) EncodeMsg(en *msgp.Writer) (err error) { // omitempty: check for empty values zb0001Len := uint32(7) var zb0001Mask uint8 /* 7 bits */ + _ = zb0001Mask if z.Index == nil { zb0001Len-- zb0001Mask |= 0x20 @@ -762,6 +763,7 @@ func (z *ObjectPartInfo) MarshalMsg(b []byte) (o []byte, err error) { // omitempty: check for empty values zb0001Len := uint32(7) var zb0001Mask uint8 /* 7 bits */ + _ = zb0001Mask if z.Index == nil { zb0001Len-- zb0001Mask |= 0x20 diff --git a/cmd/xl-storage-format-v2_gen.go b/cmd/xl-storage-format-v2_gen.go index bea45f9e1..1813fde66 100644 --- a/cmd/xl-storage-format-v2_gen.go +++ b/cmd/xl-storage-format-v2_gen.go @@ -343,6 +343,7 @@ func (z *xlMetaDataDirDecoder) EncodeMsg(en *msgp.Writer) (err error) { // omitempty: check for empty values zb0001Len := uint32(1) var zb0001Mask uint8 /* 1 bits */ + _ = zb0001Mask if z.ObjectV2 == nil { zb0001Len-- zb0001Mask |= 0x1 @@ -389,6 +390,7 @@ func (z *xlMetaDataDirDecoder) MarshalMsg(b []byte) (o []byte, err error) { // omitempty: check for empty values zb0001Len := uint32(1) var zb0001Mask uint8 /* 1 bits */ + _ = zb0001Mask if z.ObjectV2 == nil { zb0001Len-- zb0001Mask |= 0x1 @@ -572,6 +574,7 @@ func (z *xlMetaV2DeleteMarker) EncodeMsg(en *msgp.Writer) (err error) { // omitempty: check for empty values zb0001Len := uint32(3) var zb0001Mask uint8 /* 3 bits */ + _ = zb0001Mask if z.MetaSys == nil { zb0001Len-- zb0001Mask |= 0x4 @@ -637,6 +640,7 @@ func (z *xlMetaV2DeleteMarker) MarshalMsg(b []byte) (o []byte, err error) { // omitempty: check for empty values zb0001Len := uint32(3) var zb0001Mask uint8 /* 3 bits */ + _ = zb0001Mask if z.MetaSys == nil { zb0001Len-- zb0001Mask |= 0x4 @@ -1060,6 +1064,7 @@ func (z *xlMetaV2Object) EncodeMsg(en *msgp.Writer) (err error) { // omitempty: check for empty values zb0001Len := uint32(18) var zb0001Mask uint32 /* 18 bits */ + _ = zb0001Mask if z.PartIndices == nil { zb0001Len-- zb0001Mask |= 0x2000 @@ -1357,6 +1362,7 @@ func (z *xlMetaV2Object) MarshalMsg(b []byte) (o []byte, err error) { // omitempty: check for empty values zb0001Len := uint32(18) var zb0001Mask uint32 /* 18 bits */ + _ = zb0001Mask if z.PartIndices == nil { zb0001Len-- zb0001Mask |= 0x2000 @@ -1890,6 +1896,7 @@ func (z *xlMetaV2Version) EncodeMsg(en *msgp.Writer) (err error) { // omitempty: check for empty values zb0001Len := uint32(5) var zb0001Mask uint8 /* 5 bits */ + _ = zb0001Mask if z.ObjectV1 == nil { zb0001Len-- zb0001Mask |= 0x2 @@ -1996,6 +2003,7 @@ func (z *xlMetaV2Version) MarshalMsg(b []byte) (o []byte, err error) { // omitempty: check for empty values zb0001Len := uint32(5) var zb0001Mask uint8 /* 5 bits */ + _ = zb0001Mask if z.ObjectV1 == nil { zb0001Len-- zb0001Mask |= 0x2