[#1403] engine: Iterate all shards while seaching for an object
Some checks failed
DCO action / DCO (pull_request) Successful in 1m21s
Tests and linters / Run gofumpt (pull_request) Successful in 1m22s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m36s
Vulncheck / Vulncheck (pull_request) Successful in 2m29s
Build / Build Components (pull_request) Successful in 2m42s
Tests and linters / Staticcheck (pull_request) Successful in 2m31s
Tests and linters / Lint (pull_request) Successful in 3m14s
Tests and linters / gopls check (pull_request) Successful in 3m21s
Tests and linters / Tests (pull_request) Failing after 3m36s
Tests and linters / Tests with -race (pull_request) Failing after 5m10s
Some checks failed
DCO action / DCO (pull_request) Successful in 1m21s
Tests and linters / Run gofumpt (pull_request) Successful in 1m22s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m36s
Vulncheck / Vulncheck (pull_request) Successful in 2m29s
Build / Build Components (pull_request) Successful in 2m42s
Tests and linters / Staticcheck (pull_request) Successful in 2m31s
Tests and linters / Lint (pull_request) Successful in 3m14s
Tests and linters / gopls check (pull_request) Successful in 3m21s
Tests and linters / Tests (pull_request) Failing after 3m36s
Tests and linters / Tests with -race (pull_request) Failing after 5m10s
Before, when searching for an object, we iterated over shards and stopped right after we found the object. Currently, we need to itarate over all shards, because, when the object and its GC mark are stored separately, we could find the object earlier than its GC mark. Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
parent
abbae690d5
commit
c4fca96dd1
1 changed files with 8 additions and 1 deletions
|
@ -94,6 +94,10 @@ func (e *StorageEngine) get(ctx context.Context, prm GetPrm) (GetRes, error) {
|
||||||
return GetRes{}, errNotFound
|
return GetRes{}, errNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if client.IsErrObjectAlreadyRemoved(it.OutError) {
|
||||||
|
return GetRes{}, it.OutError
|
||||||
|
}
|
||||||
|
|
||||||
if it.Object == nil {
|
if it.Object == nil {
|
||||||
if !it.HasDegraded && it.ShardWithMeta.Shard == nil || !client.IsErrObjectNotFound(it.OutError) {
|
if !it.HasDegraded && it.ShardWithMeta.Shard == nil || !client.IsErrObjectNotFound(it.OutError) {
|
||||||
return GetRes{}, it.OutError
|
return GetRes{}, it.OutError
|
||||||
|
@ -146,7 +150,10 @@ func (i *getShardIterator) tryGetWithMeta(ctx context.Context) {
|
||||||
res, err := sh.Get(ctx, i.ShardPrm)
|
res, err := sh.Get(ctx, i.ShardPrm)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
i.Object = res.Object()
|
i.Object = res.Object()
|
||||||
return true
|
// Keep iterating over shards because the object's GC mark can be
|
||||||
|
// stored on another shard. For more information, please refer to
|
||||||
|
// https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls/1403.
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if res.HasMeta() {
|
if res.HasMeta() {
|
||||||
|
|
Loading…
Reference in a new issue