From 7ebceacac653656f025e08513e2dbf3b0ce0e082 Mon Sep 17 00:00:00 2001 From: Anis Eleuch Date: Sat, 12 Oct 2024 23:10:19 +0100 Subject: [PATCH] heal: Fix deep scan failing to heal objects (#117) The verify file handler response format was changed from gob to msgp since two months but we forgot updating the verify handler client. VerifyFile is only called during a heal deep scan (bitrot check). HealObject() will fail in that case and will mark all disks corrupted and will return early (as unrecoverable object but it will also not be removed) It is a bit rare for HealObject to be called with a deep scan flag. It is called when a HealObject with a normal scan (e.g. new drive healing) detects a bitrot corruption, therefore healing objects with a detected bitrot corruption will fail. --- cmd/storage-rest-client.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/storage-rest-client.go b/cmd/storage-rest-client.go index cc0a60485..2f0b8c6f5 100644 --- a/cmd/storage-rest-client.go +++ b/cmd/storage-rest-client.go @@ -20,7 +20,6 @@ package cmd import ( "bytes" "context" - "encoding/gob" "encoding/hex" "errors" "fmt" @@ -842,12 +841,16 @@ func (client *storageRESTClient) VerifyFile(ctx context.Context, volume, path st return nil, toStorageErr(err) } - verifyResp := &CheckPartsResp{} - if err = gob.NewDecoder(respReader).Decode(verifyResp); err != nil { + dec := msgpNewReader(respReader) + defer readMsgpReaderPoolPut(dec) + + verifyResp := CheckPartsResp{} + err = verifyResp.DecodeMsg(dec) + if err != nil { return nil, toStorageErr(err) } - return verifyResp, nil + return &verifyResp, nil } func (client *storageRESTClient) DeleteBulk(ctx context.Context, volume string, paths ...string) (err error) {