[#1086] engine: Do not use metabase if shard looks bad
All checks were successful
DCO action / DCO (pull_request) Successful in 1m45s
Build / Build Components (1.21) (pull_request) Successful in 2m41s
Build / Build Components (1.20) (pull_request) Successful in 3m27s
Vulncheck / Vulncheck (pull_request) Successful in 3m55s
Tests and linters / Staticcheck (pull_request) Successful in 6m5s
Tests and linters / gopls check (pull_request) Successful in 6m20s
Tests and linters / Lint (pull_request) Successful in 7m15s
Tests and linters / Tests (1.21) (pull_request) Successful in 9m41s
Tests and linters / Tests (1.20) (pull_request) Successful in 9m58s
Tests and linters / Tests with -race (pull_request) Successful in 9m48s
All checks were successful
DCO action / DCO (pull_request) Successful in 1m45s
Build / Build Components (1.21) (pull_request) Successful in 2m41s
Build / Build Components (1.20) (pull_request) Successful in 3m27s
Vulncheck / Vulncheck (pull_request) Successful in 3m55s
Tests and linters / Staticcheck (pull_request) Successful in 6m5s
Tests and linters / gopls check (pull_request) Successful in 6m20s
Tests and linters / Lint (pull_request) Successful in 7m15s
Tests and linters / Tests (1.21) (pull_request) Successful in 9m41s
Tests and linters / Tests (1.20) (pull_request) Successful in 9m58s
Tests and linters / Tests with -race (pull_request) Successful in 9m48s
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
c5a9657bbe
commit
6479e25eb3
2 changed files with 6 additions and 3 deletions
|
@ -85,6 +85,7 @@ func (e *StorageEngine) head(ctx context.Context, prm HeadPrm) (HeadRes, error)
|
||||||
shPrm.SetRaw(prm.raw)
|
shPrm.SetRaw(prm.raw)
|
||||||
|
|
||||||
e.iterateOverSortedShards(prm.addr, func(_ int, sh hashedShard) (stop bool) {
|
e.iterateOverSortedShards(prm.addr, func(_ int, sh hashedShard) (stop bool) {
|
||||||
|
shPrm.ShardLooksBad = sh.errorCount.Load() >= e.errorsThreshold
|
||||||
res, err := sh.Head(ctx, shPrm)
|
res, err := sh.Head(ctx, shPrm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch {
|
switch {
|
||||||
|
|
|
@ -13,8 +13,9 @@ import (
|
||||||
|
|
||||||
// HeadPrm groups the parameters of Head operation.
|
// HeadPrm groups the parameters of Head operation.
|
||||||
type HeadPrm struct {
|
type HeadPrm struct {
|
||||||
addr oid.Address
|
addr oid.Address
|
||||||
raw bool
|
raw bool
|
||||||
|
ShardLooksBad bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// HeadRes groups the resulting values of Head operation.
|
// HeadRes groups the resulting values of Head operation.
|
||||||
|
@ -59,7 +60,8 @@ func (s *Shard) Head(ctx context.Context, prm HeadPrm) (HeadRes, error) {
|
||||||
|
|
||||||
var obj *objectSDK.Object
|
var obj *objectSDK.Object
|
||||||
var err error
|
var err error
|
||||||
if s.GetMode().NoMetabase() {
|
mode := s.GetMode()
|
||||||
|
if mode.NoMetabase() || (mode.ReadOnly() && prm.ShardLooksBad) {
|
||||||
var getPrm GetPrm
|
var getPrm GetPrm
|
||||||
getPrm.SetAddress(prm.addr)
|
getPrm.SetAddress(prm.addr)
|
||||||
getPrm.SetIgnoreMeta(true)
|
getPrm.SetIgnoreMeta(true)
|
||||||
|
|
Loading…
Reference in a new issue