[#1] Add frostfs backend #1

Merged
alexvanin merged 1 commit from KurlesHS/restic:feature/add-frostfs-support into tcl/master 2024-12-18 12:58:00 +00:00
Member

Signed-off-by: Aleksey Kravchenko al.kravchenko@yadro.com

Signed-off-by: Aleksey Kravchenko <al.kravchenko@yadro.com>
KurlesHS added 1 commit 2024-12-10 13:13:32 +00:00
[#XX] Add frostfs backend
Some checks failed
test / lint (pull_request) Failing after 3m19s
test / Cross Compile for subset 2/3 (pull_request) Failing after 4m57s
test / docker (pull_request) Failing after 6m11s
test / Linux Go 1.19.x (pull_request) Failing after 7m7s
test / Linux Go 1.20.x (pull_request) Failing after 8m48s
test / Cross Compile for subset 0/3 (pull_request) Successful in 9m52s
test / Cross Compile for subset 1/3 (pull_request) Successful in 10m37s
test / Linux Go 1.21.x (pull_request) Failing after 13m4s
test / Linux Go 1.22.x (pull_request) Failing after 13m3s
test / Linux (race) Go 1.22.x (pull_request) Failing after 15m33s
test / Windows Go 1.22.x (pull_request) Has been cancelled
test / macOS Go 1.22.x (pull_request) Has been cancelled
test / Analyze results (pull_request) Has been cancelled
f9c3130c1b
Signed-off-by: Aleksey Kravchenko <al.kravchenko@yadro.com>
KurlesHS force-pushed feature/add-frostfs-support from f9c3130c1b to 0eda218df2 2024-12-10 13:14:55 +00:00 Compare
KurlesHS changed title from [#XX] Add frostfs backend to [#1] Add frostfs backend 2024-12-10 13:15:10 +00:00
KurlesHS self-assigned this 2024-12-10 13:40:08 +00:00
KurlesHS requested review from storage-services-committers 2024-12-10 13:43:13 +00:00
KurlesHS requested review from storage-services-developers 2024-12-10 13:43:14 +00:00
alexvanin reviewed 2024-12-11 14:49:34 +00:00
@ -0,0 +93,4 @@
return nil // nil is valid value
}
func (b *Backend) Test(ctx context.Context, h backend.Handle) (bool, error) {
Owner

Maybe we can simplify Test function. If I understand correctly, Test is called to check if connection to the backend is active. Correct me if I am wrong.

To perform healthcheck we can call NetmapSnapshot. Searches are quite expensive, so it would be nice to avoid them if we can.

Maybe we can simplify `Test` function. If I understand correctly, `Test` is called to check if connection to the backend is active. Correct me if I am wrong. To perform healthcheck we can call [NetmapSnapshot](https://git.frostfs.info/TrueCloudLab/frostfs-sdk-go/src/commit/d86cf85b391ecfbcaffba2eba1c92c94f494795d/pool/pool.go#L3149). Searches are quite expensive, so it would be nice to avoid them if we can.
Author
Member

Moreover, in this version of restic, we can simplify it even more by completely removing this method, since its definition has been removed from the backend.Backend intreface.

But in the original implementation, this method was used to check for the presence of a specific file.

Moreover, in this version of restic, we can simplify it even more by completely removing this method, since its definition has been removed from the `backend.Backend` intreface. But in the original implementation, this method was used to check for the presence of a specific file.
Owner

Let's remove all unused methods including Test.

Let's remove all unused methods including `Test`.
alexvanin marked this conversation as resolved
@ -0,0 +312,4 @@
return strings.Contains(err.Error(), "not found")
}
func (b *Backend) Delete(ctx context.Context) error {
Owner

Can you provide some details when this call happens? As far as I see, container ID is provided by restic config. So it feels a bit wrong to delete this container in runtime somehow.

Can you provide some details when this call happens? As far as I see, container ID is provided by restic config. So it feels a bit wrong to delete this container in runtime somehow.
Author
Member

This method is used in two other methods, and these methods are not called anywhere else. I looked into the s3 backend implementation of this method: all archive files are deleted there, but the bucket itself is not deleted. I can do the same in the FrostFS backend.

This method is used in two other methods, and these methods are not called anywhere else. I looked into the s3 backend implementation of this method: all archive files are deleted there, but the bucket itself is not deleted. I can do the same in the FrostFS backend.
Owner

Can you elaborate what is arhive object that S3 removes in Delete method?

Maybe we decided to optimize clean-up stage with this code in the past. S3 protocol does not allow to remove bucket until all objects are removed. FrostFS allows to remove container.

If it is not called at all, I guess we can keep current implementation for now.

Can you elaborate what is _arhive_ object that S3 removes in `Delete` method? Maybe we decided to optimize clean-up stage with this code in the past. S3 protocol does not allow to remove bucket until all objects are removed. FrostFS allows to remove container. If it is not called at all, I guess we can keep current implementation for now.
Author
Member

Can you elaborate what is arhive object that S3 removes in Delete method?

If I understood the question correctly, the s3 backend, when executing the Delete method, deletes all files generated within the backup from the package, after which there are no files left in it. The bucket itself is not deleted. The implementation of this method is shown below:

// Delete remove all restic keys in the bucket. It will not remove the bucket itself.
func (be *Backend) Delete(ctx context.Context) error {
	return util.DefaultDelete(ctx, be)
}

The util.DefaultDelete function accepts an interface implementing a particular backend as input and deletes all backup files generated by this backend.

Under the hood, util.DefaultDelete reads the list of files from the "config" file, deletes these files, and then also deletes the aforementioned "config" file

So we can implement our Delete method in the same way as it is done in s3 backend.

Maybe we decided to optimize clean-up stage with this code in the past. S3 protocol does not allow to remove bucket until all objects are removed. FrostFS allows to remove container.

If it is not called at all, I guess we can keep current implementation for now.

Or we can leave the current implementation.

> Can you elaborate what is _arhive_ object that S3 removes in `Delete` method? If I understood the question correctly, the s3 backend, when executing the Delete method, deletes all files generated within the backup from the package, after which there are no files left in it. The bucket itself is not deleted. The implementation of this method is shown below: ``` // Delete remove all restic keys in the bucket. It will not remove the bucket itself. func (be *Backend) Delete(ctx context.Context) error { return util.DefaultDelete(ctx, be) } ``` The util.DefaultDelete function accepts an interface implementing a particular backend as input and deletes all backup files generated by this backend. Under the hood, util.DefaultDelete reads the list of files from the "config" file, deletes these files, and then also deletes the aforementioned "config" file So we can implement our Delete method in the same way as it is done in s3 backend. > Maybe we decided to optimize clean-up stage with this code in the past. S3 protocol does not allow to remove bucket until all objects are removed. FrostFS allows to remove container. > > If it is not called at all, I guess we can keep current implementation for now. Or we can leave the current implementation.
alexvanin marked this conversation as resolved
alexvanin requested changes 2024-12-13 11:45:58 +00:00
Dismissed
alexvanin left a comment
Owner

Remove unused Test backend function and check if there are any more function that are unused.

Remove unused `Test` backend function and check if there are any more function that are unused.
KurlesHS force-pushed feature/add-frostfs-support from 0eda218df2 to 6939e0353f 2024-12-13 13:49:01 +00:00 Compare
dkirillov reviewed 2024-12-16 14:38:45 +00:00
@ -0,0 +78,4 @@
func findContainerID(ctx context.Context, client *pool.Pool, owner user.ID, containerName string) (cid.ID, error) {
var prm pool.PrmContainerList
prm.SetOwnerID(owner)
Member

It's better not to use deprecated methods (the same in line 90)

prm := pool.PrmContainerList{OwnerID: owner}
It's better not to use deprecated methods (the same in line 90) ```golang prm := pool.PrmContainerList{OwnerID: owner} ```
KurlesHS marked this conversation as resolved
Member

@alexvanin I forget what is our policy about tests (in CI check) in this repo?

@alexvanin I forget what is our policy about tests (in CI check) in this repo?
Owner

@alexvanin I forget what is our policy about tests (in CI check) in this repo?

We will update CI pipelines for .forgejo but in different issue as we done in TrueCloudLab/distribution#6

> @alexvanin I forget what is our policy about tests (in CI check) in this repo? We will update CI pipelines for .forgejo but in different issue as we done in https://git.frostfs.info/TrueCloudLab/distribution/issues/6
KurlesHS force-pushed feature/add-frostfs-support from 6939e0353f to ca638bd459 2024-12-17 08:06:59 +00:00 Compare
alexvanin approved these changes 2024-12-18 12:39:16 +00:00
alexvanin merged commit ca638bd459 into tcl/master 2024-12-18 12:58:00 +00:00
alexvanin referenced this pull request from a commit 2024-12-18 12:58:01 +00:00
alexvanin deleted branch feature/add-frostfs-support 2024-12-18 12:58:08 +00:00
Sign in to join this conversation.
No description provided.