Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle expiration of storage groups #1225

Closed
cthulhu-rider opened this issue Mar 10, 2022 · 1 comment · Fixed by #1402
Closed

Handle expiration of storage groups #1225

cthulhu-rider opened this issue Mar 10, 2022 · 1 comment · Fixed by #1402
Assignees
Labels
neofs-cli NeoFS CLI application issues neofs-ir Inner Ring node application issues neofs-storage Storage node application issues U3 Regular
Milestone

Comments

@cthulhu-rider
Copy link
Contributor

cthulhu-rider commented Mar 10, 2022

Overview

Storage groups have limited lifetime in NeoFS. All system parts should handle SG expiration: storage nodes shouldn't store expired STORAGE_GROUP objects, inner ring nodes should not perform data audit of them.

Inner ring

Data audit uses SGSource primitive to get list of storage groups to audit data for. The implementation selects objects from the container. We need to complicate some of the components with the logic which excludes expired storage groups.

I propose to have a component that allows you to select storage groups in a container:

type StorageGroup struct {
	Descriptor storagegroup.StorageGroup

	ExpiresAfter uint64 // epoch
}

type StorageGroupSource interface {
	Iterate(container cid.ID, handle func(StorageGroup)) error
}

// implements StorageGroupSource via NeoFS API protocol.
type neofsContainerClient struct {
	// wraps NeoFS SDK client
}

// StorageGroupSource mediator which excludes expired storage groups.
type aliveStorageGroups struct {
	// wraps base StorageGroupSource with network state
}

The data auditing component will use this interface to sequentially process storage groups.

Storage node

For these network members, storage group lifetimes are only relevant for garbage collection. Based on the fact that the SG descriptor is embedded in the binary structure of the object, and the expiration mechanism is the same as other types of objects, STORAGE_GROUP objects do not require additional logic to be processed by GC implementation. Within the framework of this task, it is only possible to double-check this fact.

NeoFS CLI

User interface should print expiration date in epochs. Seems like it is already implemented

cmd.Printf("Expiration epoch: %d\n", sg.ExpirationEpoch())

I'd pay attention on the approach of storage group descriptor decoding

err = sg.Unmarshal(buf.Bytes())

Since expiration is written in object attribute it's not enough to decode the object payload. I propose to create a function which links Object and StorageGroup types:

// StorageGroupFromObject reads StorageGroup from the Object instance.
func ReadStorageGroupFromObject(sg *storagegroup.StorageGroup, obj object.Object)

May be we also need a way to select alive storage groups only in storagegroup command.

@cthulhu-rider cthulhu-rider added triage neofs-cli NeoFS CLI application issues neofs-ir Inner Ring node application issues neofs-storage Storage node application issues blocked Can't be done because of something labels Mar 10, 2022
@alexvanin
Copy link
Contributor

PoC is not blocked, but it should be merged after API update.

@carpawell carpawell self-assigned this Mar 31, 2022
@cthulhu-rider cthulhu-rider added the U3 Regular label Apr 25, 2022
@carpawell carpawell removed the blocked Can't be done because of something label Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
neofs-cli NeoFS CLI application issues neofs-ir Inner Ring node application issues neofs-storage Storage node application issues U3 Regular
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants