Browse Source

ReadNeedleMeta recovery panic occurred (#3883)

ReadNeedleMeta panic occurred
https://github.com/seaweedfs/seaweedfs/issues/3882
pull/3895/head
Konstantin Lebedev 2 years ago
committed by GitHub
parent
commit
452202f35b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      weed/storage/needle/needle_read_page.go

6
weed/storage/needle/needle_read_page.go

@ -1,6 +1,7 @@
package needle package needle
import ( import (
"fmt"
"github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/storage/backend" "github.com/seaweedfs/seaweedfs/weed/storage/backend"
. "github.com/seaweedfs/seaweedfs/weed/storage/types" . "github.com/seaweedfs/seaweedfs/weed/storage/types"
@ -30,6 +31,11 @@ func (n *Needle) ReadNeedleData(r backend.BackendStorageFile, volumeOffset int64
// ReadNeedleMeta fills all metadata except the n.Data // ReadNeedleMeta fills all metadata except the n.Data
func (n *Needle) ReadNeedleMeta(r backend.BackendStorageFile, offset int64, size Size, version Version) (err error) { func (n *Needle) ReadNeedleMeta(r backend.BackendStorageFile, offset int64, size Size, version Version) (err error) {
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("panic occurred: %+v", r)
}
}()
bytes := make([]byte, NeedleHeaderSize+DataSizeSize) bytes := make([]byte, NeedleHeaderSize+DataSizeSize)

Loading…
Cancel
Save