Skip to content

Commit 14375f1

Browse files
committed
replicator: Copy object from the local storage without decoding
Signed-off-by: Leonard Lyubich <[email protected]>
1 parent 42cf34f commit 14375f1

File tree

23 files changed

+1658
-51
lines changed

23 files changed

+1658
-51
lines changed

cmd/blobovnicza-to-peapod/blobovniczatree/get.go

+7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ package blobovniczatree
22

33
import (
44
"fmt"
5+
"io"
56
"path/filepath"
67

78
"github.com/nspcc-dev/neofs-node/cmd/blobovnicza-to-peapod/blobovnicza"
89
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/blobstor/common"
910
"github.com/nspcc-dev/neofs-node/pkg/local_object_storage/util/logicerr"
1011
apistatus "github.com/nspcc-dev/neofs-sdk-go/client/status"
1112
objectSDK "github.com/nspcc-dev/neofs-sdk-go/object"
13+
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
1214
"go.uber.org/zap"
1315
)
1416

@@ -141,3 +143,8 @@ func (b *Blobovniczas) getObject(blz *blobovnicza.Blobovnicza, prm blobovnicza.G
141143

142144
return common.GetRes{Object: obj, RawData: data}, nil
143145
}
146+
147+
func (b *Blobovniczas) OpenObjectStream(objAddr oid.Address) (io.ReadSeekCloser, error) {
148+
// FIXME
149+
panic("OpenObjectStream must not be called on Blobovniczas")
150+
}

cmd/neofs-node/config/replicator/config.go

+6
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,9 @@ func PutTimeout(c *config.Config) time.Duration {
3131
func PoolSize(c *config.Config) int {
3232
return int(config.IntSafe(c.Sub(subsection), "pool_size"))
3333
}
34+
35+
// UseSingleMessageBuffer returns value of the boolean
36+
// 'use_single_message_buffer' config parameter from 'replicator' section.
37+
func UseSingleMessageBuffer(c *config.Config) bool {
38+
return config.BoolSafe(c.Sub(subsection), "use_single_message_buffer")
39+
}

cmd/neofs-node/config/replicator/config_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ func TestReplicatorSection(t *testing.T) {
1616

1717
require.Equal(t, replicatorconfig.PutTimeoutDefault, replicatorconfig.PutTimeout(empty))
1818
require.Equal(t, 0, replicatorconfig.PoolSize(empty))
19+
require.Equal(t, false, replicatorconfig.UseSingleMessageBuffer(empty))
1920
})
2021

2122
const path = "../../../../config/example/node"
2223

2324
var fileConfigTest = func(c *config.Config) {
2425
require.Equal(t, 15*time.Second, replicatorconfig.PutTimeout(c))
2526
require.Equal(t, 10, replicatorconfig.PoolSize(c))
27+
require.Equal(t, true, replicatorconfig.UseSingleMessageBuffer(c))
2628
}
2729

2830
configtest.ForEachFileType(path, fileConfigTest)

cmd/neofs-node/object.go

+1
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ func initObjectService(c *cfg) {
187187
replicator.WithRemoteSender(
188188
putsvc.NewRemoteSender(keyStorage, (*coreClientConstructor)(clientConstructor)),
189189
),
190+
replicator.CopyBinaryObjectWithSingleBuffer(replicatorconfig.UseSingleMessageBuffer(c.appCfg)),
190191
)
191192

192193
c.policer = policer.New(

config/example/node.env

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ NEOFS_POLICER_MAX_WORKERS=21
8484
# Replicator section
8585
NEOFS_REPLICATOR_PUT_TIMEOUT=15s
8686
NEOFS_REPLICATOR_POOL_SIZE=10
87+
NEOFS_REPLICATOR_USE_SINGLE_MESSAGE_BUFFER=true
8788

8889
# Object service section
8990
NEOFS_OBJECT_DELETE_TOMBSTONE_LIFETIME=10

config/example/node.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@
118118
},
119119
"replicator": {
120120
"pool_size": 10,
121-
"put_timeout": "15s"
121+
"put_timeout": "15s",
122+
"use_single_message_buffer": true
122123
},
123124
"object": {
124125
"delete": {

config/example/node.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ policer:
107107
replicator:
108108
put_timeout: 15s # timeout for the Replicator PUT remote operation (defaults to 1m)
109109
pool_size: 10 # maximum amount of concurrent replications
110+
use_single_message_buffer: true # EXPERIMENTAL: whether single message buffer should be allocated
111+
# when packing binary object into messages for replication to the particular remote storage node
110112

111113
object:
112114
delete:

go.mod

+6-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ require (
1717
github.com/nspcc-dev/hrw/v2 v2.0.0-20231115095647-bf62f4ad0a43
1818
github.com/nspcc-dev/locode-db v0.4.1-0.20231120112844-64febbb63ce3
1919
github.com/nspcc-dev/neo-go v0.103.1
20-
github.com/nspcc-dev/neofs-api-go/v2 v2.14.0
20+
github.com/nspcc-dev/neofs-api-go/v2 v2.14.1-0.20231123104744-7947b4a6cb95
2121
github.com/nspcc-dev/neofs-contract v0.18.0
22-
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.11.0.20231113180740-3b24af0410c0
22+
github.com/nspcc-dev/neofs-sdk-go v1.0.0-rc.11.0.20231123110011-e760e7dbab39
2323
github.com/nspcc-dev/tzhash v1.7.1
2424
github.com/olekukonko/tablewriter v0.0.5
2525
github.com/panjf2000/ants/v2 v2.8.2
@@ -50,7 +50,7 @@ require (
5050
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
5151
github.com/fsnotify/fsnotify v1.6.0 // indirect
5252
github.com/golang/protobuf v1.5.3 // indirect
53-
github.com/golang/snappy v0.0.3 // indirect
53+
github.com/golang/snappy v0.0.4 // indirect
5454
github.com/google/go-querystring v1.1.0 // indirect
5555
github.com/gorilla/websocket v1.4.2 // indirect
5656
github.com/hashicorp/golang-lru v1.0.2 // indirect
@@ -74,6 +74,7 @@ require (
7474
github.com/nats-io/nuid v1.0.1 // indirect
7575
github.com/nspcc-dev/dbft v0.0.0-20230515113611-25db6ba61d5c // indirect
7676
github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 // indirect
77+
github.com/nspcc-dev/hrw v1.0.9 // indirect
7778
github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20231020160724-c3955f87d1b5 // indirect
7879
github.com/nspcc-dev/neofs-crypto v0.4.0 // indirect
7980
github.com/nspcc-dev/rfc6979 v0.2.0 // indirect
@@ -110,3 +111,5 @@ retract (
110111
v1.22.1 // Contains retraction only.
111112
v1.22.0 // Published accidentally.
112113
)
114+
115+
replace google.golang.org/grpc => github.com/cthulhu-rider/grpc-go v0.0.0-20231123095204-ced09a8c28ff

0 commit comments

Comments
 (0)