[#2246] node: Allow to configure tombsone lifetime

Currently, DELETE service sets tombstone expiration epoch to
`current epoch + 5`. This works less than ideal in private networks
where an epoch can be e.g. 10 minutes. In this case, after a node is
unavailable for more than 1 hour, already deleted objects have a chance
to reappear.

After this commit tombstone lifetime can be configured.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-02-08 17:28:38 +03:00 committed by fyrchik
parent 6fd88a036f
commit 351fdd9fa2
9 changed files with 44 additions and 6 deletions

View file

@ -9,6 +9,7 @@ Changelog for FrostFS Node
- New `frostfs_node_object_container_size` metric for tracking size of reqular objects in a container (#2116) - New `frostfs_node_object_container_size` metric for tracking size of reqular objects in a container (#2116)
- New `frostfs_node_object_payload_size` metric for tracking size of reqular objects on a single shard (#1794) - New `frostfs_node_object_payload_size` metric for tracking size of reqular objects on a single shard (#1794)
- Add command `frostfs-adm morph netmap-candidates` (#1889) - Add command `frostfs-adm morph netmap-candidates` (#1889)
- `object.delete.tombstone_lifetime` config parameter to set tombstone lifetime in the DELETE service (#2246)
### Changed ### Changed
- Change `frostfs_node_engine_container_size` to counting sizes of logical objects - Change `frostfs_node_engine_container_size` to counting sizes of logical objects
@ -46,7 +47,13 @@ Changelog for FrostFS Node
- Minimum go version to v1.18 - Minimum go version to v1.18
### Updating from v0.35.0 ### Updating from v0.35.0
<<<<<<< HEAD
You need to change configuration environment variables to `FROSTFS_*` if you use any. You need to change configuration environment variables to `FROSTFS_*` if you use any.
||||||| parent of 00afc576d ([#2246] node: Allow to configure tombsone lifetime)
=======
New config field `object.delete.tombstone_lifetime` allows to set tombstone lifetime
more appropriate for a specific deployment.
>>>>>>> 00afc576d ([#2246] node: Allow to configure tombsone lifetime)
## [0.35.0] - 2022-12-28 - Sindo (신도, 信島) ## [0.35.0] - 2022-12-28 - Sindo (신도, 信島)

View file

@ -472,6 +472,8 @@ type cfgObject struct {
pool cfgObjectRoutines pool cfgObjectRoutines
cfgLocalStorage cfgLocalStorage cfgLocalStorage cfgLocalStorage
tombstoneLifetime uint64
} }
type cfgNotifications struct { type cfgNotifications struct {
@ -598,7 +600,8 @@ func initCfg(appCfg *config.Config) *cfg {
proxyScriptHash: contractsconfig.Proxy(appCfg), proxyScriptHash: contractsconfig.Proxy(appCfg),
} }
c.cfgObject = cfgObject{ c.cfgObject = cfgObject{
pool: initObjectPool(appCfg), pool: initObjectPool(appCfg),
tombstoneLifetime: objectconfig.TombstoneLifetime(appCfg),
} }
c.cfgReputation = cfgReputation{ c.cfgReputation = cfgReputation{
scriptHash: contractsconfig.Reputation(appCfg), scriptHash: contractsconfig.Reputation(appCfg),

View file

@ -14,12 +14,14 @@ func TestObjectSection(t *testing.T) {
empty := configtest.EmptyConfig() empty := configtest.EmptyConfig()
require.Equal(t, objectconfig.PutPoolSizeDefault, objectconfig.Put(empty).PoolSizeRemote()) require.Equal(t, objectconfig.PutPoolSizeDefault, objectconfig.Put(empty).PoolSizeRemote())
require.EqualValues(t, objectconfig.DefaultTombstoneLifetime, objectconfig.TombstoneLifetime(empty))
}) })
const path = "../../../../config/example/node" const path = "../../../../config/example/node"
var fileConfigTest = func(c *config.Config) { var fileConfigTest = func(c *config.Config) {
require.Equal(t, 100, objectconfig.Put(c).PoolSizeRemote()) require.Equal(t, 100, objectconfig.Put(c).PoolSizeRemote())
require.EqualValues(t, 10, objectconfig.TombstoneLifetime(c))
} }
configtest.ForEachFileType(path, fileConfigTest) configtest.ForEachFileType(path, fileConfigTest)

View file

@ -0,0 +1,19 @@
package objectconfig
import "github.com/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
const (
deleteSubsection = "delete"
// DefaultTombstoneLifetime is the default value of tombstone lifetime in epochs.
DefaultTombstoneLifetime = 5
)
// TombstoneLifetime returns the value of `tombstone_lifetime` config parameter.
func TombstoneLifetime(c *config.Config) uint64 {
ts := config.UintSafe(c.Sub(subsection).Sub(deleteSubsection), "tombstone_lifetime")
if ts <= 0 {
return DefaultTombstoneLifetime
}
return ts
}

View file

@ -316,7 +316,7 @@ func initObjectService(c *cfg) {
deletesvc.WithPutService(sPut), deletesvc.WithPutService(sPut),
deletesvc.WithNetworkInfo(&delNetInfo{ deletesvc.WithNetworkInfo(&delNetInfo{
State: c.cfgNetmap.state, State: c.cfgNetmap.state,
tsLifetime: 5, tsLifetime: c.cfgObject.tombstoneLifetime,
cfg: c, cfg: c,
}), }),

View file

@ -85,6 +85,7 @@ FROSTFS_REPLICATOR_POOL_SIZE=10
# Object service section # Object service section
FROSTFS_OBJECT_PUT_POOL_SIZE_REMOTE=100 FROSTFS_OBJECT_PUT_POOL_SIZE_REMOTE=100
FROSTFS_OBJECT_DELETE_TOMBSTONE_LIFETIME=10
# Storage engine section # Storage engine section
FROSTFS_STORAGE_SHARD_POOL_SIZE=15 FROSTFS_STORAGE_SHARD_POOL_SIZE=15

View file

@ -128,6 +128,9 @@
"put_timeout": "15s" "put_timeout": "15s"
}, },
"object": { "object": {
"delete": {
"tombstone_lifetime": 10
},
"put": { "put": {
"pool_size_remote": 100 "pool_size_remote": 100
} }

View file

@ -107,6 +107,8 @@ replicator:
pool_size: 10 # maximum amount of concurrent replications pool_size: 10 # maximum amount of concurrent replications
object: object:
delete:
tombstone_lifetime: 10 # tombstone "local" lifetime in epochs
put: put:
pool_size_remote: 100 # number of async workers for remote PUT operations pool_size_remote: 100 # number of async workers for remote PUT operations

View file

@ -415,7 +415,7 @@ replicator:
| `pool_size` | `int` | Equal to `object.put.pool_size_remote` | Maximum amount of concurrent replications. | | `pool_size` | `int` | Equal to `object.put.pool_size_remote` | Maximum amount of concurrent replications. |
# `object` section # `object` section
Contains pool sizes for object operations with remote nodes. Contains object-service related parameters.
```yaml ```yaml
object: object:
@ -423,6 +423,7 @@ object:
pool_size_remote: 100 pool_size_remote: 100
``` ```
| Parameter | Type | Default value | Description | | Parameter | Type | Default value | Description |
|------------------------|-------|---------------|------------------------------------------------------------------------------------------------| |-----------------------------|-------|---------------|------------------------------------------------------------------------------------------------|
| `put.pool_size_remote` | `int` | `10` | Max pool size for performing remote `PUT` operations. Used by Policer and Replicator services. | | `delete.tombstone_lifetime` | `int` | `5` | Tombstone lifetime for removed objects in epochs. |
| `put.pool_size_remote` | `int` | `10` | Max pool size for performing remote `PUT` operations. Used by Policer and Replicator services. |