Add registry import command line tool #160
No reviewers
TrueCloudLab/storage-core-developers
Labels
No labels
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/xk6-frostfs#160
Loading…
Reference in a new issue
No description provided.
Delete branch "elebedeva/xk6-frostfs:feat/registry-importer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Close #154
Currently, objects created in preset are never deleted. k6 deletes only objects from registry, if registry file is not provided k6 delete load fails.
Added command line tool to import objects created in preset into registry so k6 can delete them normally.
Signed-off-by: Ekaterina Lebedeva ekaterina.lebedeva@yadro.com
@ -0,0 +19,4 @@
func runCmd(cmd *cobra.Command, args []string) error {
if len(args) < 2 {
return fmt.Errorf("expected at least two non-flag argumets: paths to the registry and to the pregenerated file, got: %s", args)
Args: cobra.ExactArgs(1),
Please, see the validation above, it can be done simpler.
Fixed!
@ -0,0 +20,4 @@
}
func init() {
cobra.AddTemplateFunc("runtimeVersion", runtime.Version)
Will it look
xk6-registry runtimeVersion
in CLI?It's used in the template of
--version
.Looks like this:
@ -0,0 +1,32 @@
package importer
Why have you put it in
cmd/xk6-registry/importer/
but not incmd/xk6-registry-importer/
as it is done forxk6-registry-exporter
?How to build it with
make bin/*
?import
is a subcommand ofxk6-registry
commandline tool. Later we can movexk6-registry-exporter
functionality to the subcommandexport
ofxk6-registry
so that we have one tool to work with registry instead of many.fa240302de
to64df65a2e4
@ -23,1 +20,3 @@
OID string `json:"oid"`
Bucket string `json:"bucket"`
Object string `json:"object"`
Container string `json:"container"`
This struct should not have been touched in this PR.
If we need to unmarshal registry, let's do it with a separate struct.
Also, preset should be handled in the cmd itself, not
internal/registry
package.64df65a2e4
to4cd50c8c03
@ -0,0 +34,4 @@
for _, obj := range pregenInfo.Objects {
if obj.Bucket != "" {
err = o.AddObject("", "", obj.Bucket, obj.Object, "")
Please, check if
AddObject
usesDB.Batch()
. In this case we are effectively limited byMaxBatchDelay
(10ms or 20ms).Not important for preset (100 containers * 10 objects each = 1 second to process), but worth a comment somewhere.
It does.
Do you mean the comment in the code?
Yes, near the loop -- it is the first thing we will try if we need to speed up things.
@ -0,0 +38,4 @@
} else {
err = o.AddObject(obj.Container, obj.Object, "", "", "")
}
if err != nil {
Is this command idempotent. I.e. if we fail (no space on disk) on the object A, it would be both in preset and registry.
What will happen if we run this command again?
The command is not idempotent. If we run it again after the object was put in registry, the registry will have two entities representing this object.
4cd50c8c03
to6d3ecb6528