satellite/audit: Add piece hash verified to log messages (#3204)

This commit is contained in:
littleskunk 2019-10-08 12:51:57 +02:00 committed by GitHub
parent 37491d0d32
commit c009543236
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,7 +122,10 @@ func (verifier *Verifier) Verify(ctx context.Context, path storj.Path, skip map[
// the skip list // the skip list
offlineNodes = getOfflineNodes(pointer, orderLimits, skip) offlineNodes = getOfflineNodes(pointer, orderLimits, skip)
if len(offlineNodes) > 0 { if len(offlineNodes) > 0 {
verifier.log.Debug("Verify: order limits not created for some nodes (offline/disqualified)", zap.String("Segment Path", path), zap.Strings("Node IDs", offlineNodes.Strings())) verifier.log.Debug("Verify: order limits not created for some nodes (offline/disqualified)",
zap.Bool("Piece Hash Verified", pointer.PieceHashesVerified),
zap.String("Segment Path", path),
zap.Strings("Node IDs", offlineNodes.Strings()))
} }
shares, err := verifier.DownloadShares(ctx, orderLimits, privateKey, randomIndex, shareSize) shares, err := verifier.DownloadShares(ctx, orderLimits, privateKey, randomIndex, shareSize)
@ -149,37 +152,61 @@ func (verifier *Verifier) Verify(ctx context.Context, path storj.Path, skip map[
if errs.Is(share.Error, context.DeadlineExceeded) { if errs.Is(share.Error, context.DeadlineExceeded) {
// dial timeout // dial timeout
offlineNodes = append(offlineNodes, share.NodeID) offlineNodes = append(offlineNodes, share.NodeID)
verifier.log.Debug("Verify: dial timeout (offline)", zap.String("Segment Path", path), zap.Stringer("Node ID", share.NodeID), zap.Error(share.Error)) verifier.log.Debug("Verify: dial timeout (offline)",
zap.Bool("Piece Hash Verified", pointer.PieceHashesVerified),
zap.String("Segment Path", path),
zap.Stringer("Node ID", share.NodeID),
zap.Error(share.Error))
continue continue
} }
if errs2.IsRPC(share.Error, rpcstatus.Unknown) { if errs2.IsRPC(share.Error, rpcstatus.Unknown) {
// dial failed -- offline node // dial failed -- offline node
offlineNodes = append(offlineNodes, share.NodeID) offlineNodes = append(offlineNodes, share.NodeID)
verifier.log.Debug("Verify: dial failed (offline)", zap.String("Segment Path", path), zap.Stringer("Node ID", share.NodeID), zap.Error(share.Error)) verifier.log.Debug("Verify: dial failed (offline)",
zap.Bool("Piece Hash Verified", pointer.PieceHashesVerified),
zap.String("Segment Path", path),
zap.Stringer("Node ID", share.NodeID),
zap.Error(share.Error))
continue continue
} }
// unknown transport error // unknown transport error
containedNodes[pieceNum] = share.NodeID containedNodes[pieceNum] = share.NodeID
verifier.log.Debug("Verify: unknown transport error (contained)", zap.String("Segment Path", path), zap.Stringer("Node ID", share.NodeID), zap.Error(share.Error)) verifier.log.Debug("Verify: unknown transport error (contained)",
zap.Bool("Piece Hash Verified", pointer.PieceHashesVerified),
zap.String("Segment Path", path),
zap.Stringer("Node ID", share.NodeID),
zap.Error(share.Error))
} }
if errs2.IsRPC(share.Error, rpcstatus.NotFound) { if errs2.IsRPC(share.Error, rpcstatus.NotFound) {
// missing share // missing share
failedNodes = append(failedNodes, share.NodeID) failedNodes = append(failedNodes, share.NodeID)
verifier.log.Debug("Verify: piece not found (audit failed)", zap.String("Segment Path", path), zap.Stringer("Node ID", share.NodeID), zap.Error(share.Error)) verifier.log.Debug("Verify: piece not found (audit failed)",
zap.Bool("Piece Hash Verified", pointer.PieceHashesVerified),
zap.String("Segment Path", path),
zap.Stringer("Node ID", share.NodeID),
zap.Error(share.Error))
continue continue
} }
if errs2.IsRPC(share.Error, rpcstatus.DeadlineExceeded) { if errs2.IsRPC(share.Error, rpcstatus.DeadlineExceeded) {
// dial successful, but download timed out // dial successful, but download timed out
containedNodes[pieceNum] = share.NodeID containedNodes[pieceNum] = share.NodeID
verifier.log.Debug("Verify: download timeout (contained)", zap.String("Segment Path", path), zap.Stringer("Node ID", share.NodeID), zap.Error(share.Error)) verifier.log.Debug("Verify: download timeout (contained)",
zap.Bool("Piece Hash Verified", pointer.PieceHashesVerified),
zap.String("Segment Path", path),
zap.Stringer("Node ID", share.NodeID),
zap.Error(share.Error))
continue continue
} }
// unknown error // unknown error
containedNodes[pieceNum] = share.NodeID containedNodes[pieceNum] = share.NodeID
verifier.log.Debug("Verify: unknown error (contained)", zap.String("Segment Path", path), zap.Stringer("Node ID", share.NodeID), zap.Error(share.Error)) verifier.log.Debug("Verify: unknown error (contained)",
zap.Bool("Piece Hash Verified", pointer.PieceHashesVerified),
zap.String("Segment Path", path),
zap.Stringer("Node ID", share.NodeID),
zap.Error(share.Error))
} }
required := int(pointer.Remote.Redundancy.GetMinReq()) required := int(pointer.Remote.Redundancy.GetMinReq())