forked from TrueCloudLab/frostfs-node
[#176] shard: Get rid of using the global RW lock
In previous implementation each shard operation locked RW shard mutex. With this approach RW operations were executed one-by-one and blocked the execution of RO operations. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
9ab371aafb
commit
df558cbe6b
6 changed files with 0 additions and 20 deletions
|
@ -31,9 +31,6 @@ func (p *DeletePrm) WithAddress(addr *objectSDK.Address) *DeletePrm {
|
|||
// Returns any error encountered that did not allow to completely
|
||||
// mark the object to delete.
|
||||
func (s *Shard) Delete(prm *DeletePrm) (*DeleteRes, error) {
|
||||
s.mtx.Lock()
|
||||
defer s.mtx.Unlock()
|
||||
|
||||
// mark object to delete in metabase
|
||||
if err := s.metaBase.Delete(prm.addr); err != nil {
|
||||
s.log.Warn("could not mark object to delete in metabase",
|
||||
|
|
|
@ -33,9 +33,6 @@ func (p *ExistsRes) Exists() bool {
|
|||
// Returns any error encountered that does not allow to
|
||||
// unambiguously determine the presence of an object.
|
||||
func (s *Shard) Exists(prm *ExistsPrm) (*ExistsRes, error) {
|
||||
s.mtx.RLock()
|
||||
defer s.mtx.RUnlock()
|
||||
|
||||
// FIXME: implement me
|
||||
return &ExistsRes{
|
||||
ex: false,
|
||||
|
|
|
@ -71,9 +71,6 @@ func (r *GetRes) Object() *object.Object {
|
|||
//
|
||||
// Returns ErrObjectNotFound if requested object is missing in shard.
|
||||
func (s *Shard) Get(prm *GetPrm) (*GetRes, error) {
|
||||
s.mtx.RLock()
|
||||
defer s.mtx.RUnlock()
|
||||
|
||||
if prm.ln < 0 {
|
||||
// try to read from WriteCache
|
||||
// TODO: implement
|
||||
|
|
|
@ -28,9 +28,6 @@ func (p *PutPrm) WithObject(obj *object.Object) *PutPrm {
|
|||
// Returns any error encountered that
|
||||
// did not allow to completely save the object.
|
||||
func (s *Shard) Put(prm *PutPrm) (*PutRes, error) {
|
||||
s.mtx.Lock()
|
||||
defer s.mtx.Unlock()
|
||||
|
||||
// check object existence
|
||||
ex, err := s.metaBase.Exists(prm.obj.Address())
|
||||
if err != nil {
|
||||
|
|
|
@ -34,9 +34,6 @@ func (r *SelectRes) AddressList() []*objectSDK.Address {
|
|||
// Returns any error encountered that
|
||||
// did not allow to completely select the objects.
|
||||
func (s *Shard) Select(prm *SelectPrm) (*SelectRes, error) {
|
||||
s.mtx.RLock()
|
||||
defer s.mtx.RUnlock()
|
||||
|
||||
addrList, err := s.metaBase.Select(prm.filters)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not select objects from metabase")
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package shard
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor"
|
||||
meta "github.com/nspcc-dev/neofs-node/pkg/local_object_storage/metabase"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
|
||||
|
@ -12,8 +10,6 @@ import (
|
|||
type Shard struct {
|
||||
*cfg
|
||||
|
||||
mtx *sync.RWMutex
|
||||
|
||||
weight WeightValues
|
||||
|
||||
blobStor *blobstor.BlobStor
|
||||
|
@ -48,7 +44,6 @@ func New(opts ...Option) *Shard {
|
|||
|
||||
return &Shard{
|
||||
cfg: c,
|
||||
mtx: new(sync.RWMutex),
|
||||
blobStor: blobstor.New(c.blobOpts...),
|
||||
metaBase: meta.NewDB(c.metaOpts...),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue