From 74ec71446f873c771476218e56ad220450cc40b4 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 20 Dec 2022 16:15:15 +0300 Subject: [PATCH] [#2167] shard: Do not use write-cache by default in `Head` Both `meta` and `write-cache` are expected to have a fast underlying disk, so it does not seem like an optimisation. Moreover, `write-cache`'s `Head` is a `Get` with payload cutting, it _must_ use more memory for no reason (`meta` was created for such requests). Also, `write-cache` does not allow performing any "meta" relations checks (such as locking, tombstoning). Signed-off-by: Pavel Karpy --- CHANGELOG.md | 1 + pkg/local_object_storage/shard/head.go | 19 ------------------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 932e3116c..7bee2e25b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ Changelog for NeoFS Node - Tree service now synchronizes with container nodes in a random order (#2127) - Pilorama no longer tries to apply already applied operations (#2161) - Use `sync.Pool` in Object.PUT service (#2139) +- Shard uses metabase for `HEAD` requests by default, not write-cache (#2167) ### Fixed - Open FSTree in sync mode by default (#1992) diff --git a/pkg/local_object_storage/shard/head.go b/pkg/local_object_storage/shard/head.go index 3136e99ce..0e51da737 100644 --- a/pkg/local_object_storage/shard/head.go +++ b/pkg/local_object_storage/shard/head.go @@ -1,8 +1,6 @@ package shard import ( - "fmt" - meta "github.com/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase" objectSDK "github.com/TrueCloudLab/frostfs-sdk-go/object" oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id" @@ -46,23 +44,6 @@ func (r HeadRes) Object() *objectSDK.Object { // Returns an error of type apistatus.ObjectAlreadyRemoved if the requested object has been marked as removed in shard. // Returns the object.ErrObjectIsExpired if the object is presented but already expired. func (s *Shard) Head(prm HeadPrm) (HeadRes, error) { - // object can be saved in write-cache (if enabled) or in metabase - - if s.hasWriteCache() { - // try to read header from write-cache - header, err := s.writeCache.Head(prm.addr) - if err == nil { - return HeadRes{ - obj: header, - }, nil - } else if !IsErrNotFound(err) { - // in this case we think that object is presented in write-cache, but corrupted - return HeadRes{}, fmt.Errorf("could not read header from write-cache: %w", err) - } - - // otherwise object seems to be flushed to metabase - } - var obj *objectSDK.Object var err error if s.GetMode().NoMetabase() {