[#1] Add frostfs backend #1

Open
KurlesHS wants to merge 1 commit from KurlesHS/restic:feature/add-frostfs-support into tcl/master
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`.
@ -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
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
Some checks failed
test / docker (pull_request) Failing after 1m59s
test / Cross Compile for subset 2/3 (pull_request) Failing after 4m22s
test / Linux Go 1.20.x (pull_request) Failing after 4m28s
test / lint (pull_request) Failing after 4m33s
test / Linux Go 1.19.x (pull_request) Failing after 7m9s
test / Linux Go 1.22.x (pull_request) Failing after 8m43s
test / Linux Go 1.21.x (pull_request) Failing after 9m5s
test / Cross Compile for subset 0/3 (pull_request) Successful in 10m38s
test / Linux (race) Go 1.22.x (pull_request) Failing after 10m59s
test / Cross Compile for subset 1/3 (pull_request) Successful in 12m24s
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
This pull request doesn't have enough approvals yet. 0 of 1 approvals granted.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u feature/add-frostfs-support:KurlesHS-feature/add-frostfs-support
git checkout KurlesHS-feature/add-frostfs-support
Sign in to join this conversation.
No description provided.