X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/90d84d8578b760b493ac76b22c42bc284868bc0c..73d113eab7fef74d9519be5236e89b48aeb2eab2:/services/keepstore/command.go diff --git a/services/keepstore/command.go b/services/keepstore/command.go index df279687d0..2a426936ed 100644 --- a/services/keepstore/command.go +++ b/services/keepstore/command.go @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: AGPL-3.0 -package main +package keepstore import ( "context" @@ -15,12 +15,12 @@ import ( "os" "sync" - "git.curoverse.com/arvados.git/lib/config" - "git.curoverse.com/arvados.git/lib/service" - "git.curoverse.com/arvados.git/sdk/go/arvados" - "git.curoverse.com/arvados.git/sdk/go/arvadosclient" - "git.curoverse.com/arvados.git/sdk/go/ctxlog" - "git.curoverse.com/arvados.git/sdk/go/keepclient" + "git.arvados.org/arvados.git/lib/config" + "git.arvados.org/arvados.git/lib/service" + "git.arvados.org/arvados.git/sdk/go/arvados" + "git.arvados.org/arvados.git/sdk/go/arvadosclient" + "git.arvados.org/arvados.git/sdk/go/ctxlog" + "git.arvados.org/arvados.git/sdk/go/keepclient" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" ) @@ -30,10 +30,6 @@ var ( Command = service.Command(arvados.ServiceNameKeepstore, newHandlerOrErrorHandler) ) -func main() { - os.Exit(runCommand(os.Args[0], os.Args[1:], os.Stdin, os.Stdout, os.Stderr)) -} - func runCommand(prog string, args []string, stdin io.Reader, stdout, stderr io.Writer) int { args, ok := convertKeepstoreFlagsToServiceFlags(args, ctxlog.FromContext(context.Background())) if !ok { @@ -48,7 +44,7 @@ func runCommand(prog string, args []string, stdin io.Reader, stdout, stderr io.W func convertKeepstoreFlagsToServiceFlags(args []string, lgr logrus.FieldLogger) ([]string, bool) { flags := flag.NewFlagSet("", flag.ContinueOnError) flags.String("listen", "", "Services.Keepstore.InternalURLs") - flags.Int("max-buffers", 0, "API.MaxKeepBlockBuffers") + flags.Int("max-buffers", 0, "API.MaxKeepBlobBuffers") flags.Int("max-requests", 0, "API.MaxConcurrentRequests") flags.Bool("never-delete", false, "Collections.BlobTrash") flags.Bool("enforce-permissions", false, "Collections.BlobSigning") @@ -72,8 +68,8 @@ func convertKeepstoreFlagsToServiceFlags(args []string, lgr logrus.FieldLogger) flags.String("s3-bucket-volume", "", "Volumes.*.DriverParameters.Bucket") flags.String("s3-region", "", "Volumes.*.DriverParameters.Region") flags.String("s3-endpoint", "", "Volumes.*.DriverParameters.Endpoint") - flags.String("s3-access-key-file", "", "Volumes.*.DriverParameters.AccessKey") - flags.String("s3-secret-key-file", "", "Volumes.*.DriverParameters.SecretKey") + flags.String("s3-access-key-file", "", "Volumes.*.DriverParameters.AccessKeyID") + flags.String("s3-secret-key-file", "", "Volumes.*.DriverParameters.SecretAccessKey") flags.String("s3-race-window", "", "Volumes.*.DriverParameters.RaceWindow") flags.String("s3-replication", "", "Volumes.*.Replication") flags.String("s3-unsafe-delete", "", "Volumes.*.DriverParameters.UnsafeDelete") @@ -132,6 +128,10 @@ func (h *handler) CheckHealth() error { return h.err } +func (h *handler) Done() <-chan struct{} { + return nil +} + func newHandlerOrErrorHandler(ctx context.Context, cluster *arvados.Cluster, token string, reg *prometheus.Registry) service.Handler { var h handler serviceURL, ok := service.URLFromContext(ctx) @@ -148,14 +148,13 @@ func newHandlerOrErrorHandler(ctx context.Context, cluster *arvados.Cluster, tok func (h *handler) setup(ctx context.Context, cluster *arvados.Cluster, token string, reg *prometheus.Registry, serviceURL arvados.URL) error { h.Cluster = cluster h.Logger = ctxlog.FromContext(ctx) - if h.Cluster.API.MaxKeepBlockBuffers <= 0 { - return fmt.Errorf("MaxBuffers must be greater than zero") + if h.Cluster.API.MaxKeepBlobBuffers <= 0 { + return fmt.Errorf("API.MaxKeepBlobBuffers must be greater than zero") } - bufs = newBufferPool(h.Logger, h.Cluster.API.MaxKeepBlockBuffers, BlockSize) + bufs = newBufferPool(h.Logger, h.Cluster.API.MaxKeepBlobBuffers, BlockSize) - if h.Cluster.API.MaxConcurrentRequests < 1 { - h.Cluster.API.MaxConcurrentRequests = h.Cluster.API.MaxKeepBlockBuffers * 2 - h.Logger.Warnf("MaxRequests <1 or not specified; defaulting to MaxKeepBlockBuffers * 2 == %d", h.Cluster.API.MaxConcurrentRequests) + if h.Cluster.API.MaxConcurrentRequests > 0 && h.Cluster.API.MaxConcurrentRequests < h.Cluster.API.MaxKeepBlobBuffers { + h.Logger.Warnf("Possible configuration mistake: not useful to set API.MaxKeepBlobBuffers (%d) higher than API.MaxConcurrentRequests (%d)", h.Cluster.API.MaxKeepBlobBuffers, h.Cluster.API.MaxConcurrentRequests) } if h.Cluster.Collections.BlobSigningKey != "" { @@ -190,7 +189,7 @@ func (h *handler) setup(ctx context.Context, cluster *arvados.Cluster, token str // Initialize the trashq and workers h.trashq = NewWorkQueue() for i := 0; i < 1 || i < h.Cluster.Collections.BlobTrashConcurrency; i++ { - go RunTrashWorker(h.volmgr, h.Cluster, h.trashq) + go RunTrashWorker(h.volmgr, h.Logger, h.Cluster, h.trashq) } // Set up routes and metrics