forked from TrueCloudLab/frostfs-node
[#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 <p.karpy@yadro.com>
This commit is contained in:
parent
1608fd1c07
commit
74ec71446f
2 changed files with 1 additions and 19 deletions
|
@ -27,6 +27,7 @@ Changelog for NeoFS Node
|
||||||
- Tree service now synchronizes with container nodes in a random order (#2127)
|
- Tree service now synchronizes with container nodes in a random order (#2127)
|
||||||
- Pilorama no longer tries to apply already applied operations (#2161)
|
- Pilorama no longer tries to apply already applied operations (#2161)
|
||||||
- Use `sync.Pool` in Object.PUT service (#2139)
|
- Use `sync.Pool` in Object.PUT service (#2139)
|
||||||
|
- Shard uses metabase for `HEAD` requests by default, not write-cache (#2167)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Open FSTree in sync mode by default (#1992)
|
- Open FSTree in sync mode by default (#1992)
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package shard
|
package shard
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
meta "github.com/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
|
meta "github.com/TrueCloudLab/frostfs-node/pkg/local_object_storage/metabase"
|
||||||
objectSDK "github.com/TrueCloudLab/frostfs-sdk-go/object"
|
objectSDK "github.com/TrueCloudLab/frostfs-sdk-go/object"
|
||||||
oid "github.com/TrueCloudLab/frostfs-sdk-go/object/id"
|
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 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.
|
// Returns the object.ErrObjectIsExpired if the object is presented but already expired.
|
||||||
func (s *Shard) Head(prm HeadPrm) (HeadRes, error) {
|
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 obj *objectSDK.Object
|
||||||
var err error
|
var err error
|
||||||
if s.GetMode().NoMetabase() {
|
if s.GetMode().NoMetabase() {
|
||||||
|
|
Loading…
Reference in a new issue