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

storage-users: Add config option for graceful shutdown timeout #6840

Merged
merged 7 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/coreos/go-oidc/v3 v3.6.0
github.com/cs3org/go-cs3apis v0.0.0-20230516150832-730ac860c71d
github.com/cs3org/reva/v2 v2.15.0
github.com/cs3org/reva/v2 v2.15.1-0.20230718140539-0af2a07c7fd9
github.com/disintegration/imaging v1.6.2
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e
github.com/egirna/icap-client v0.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,8 @@ github.com/crewjam/httperr v0.2.0 h1:b2BfXR8U3AlIHwNeFFvZ+BV1LFvKLlzMjzaTnZMybNo
github.com/crewjam/httperr v0.2.0/go.mod h1:Jlz+Sg/XqBQhyMjdDiC+GNNRzZTD7x39Gu3pglZ5oH4=
github.com/crewjam/saml v0.4.13 h1:TYHggH/hwP7eArqiXSJUvtOPNzQDyQ7vwmwEqlFWhMc=
github.com/crewjam/saml v0.4.13/go.mod h1:igEejV+fihTIlHXYP8zOec3V5A8y3lws5bQBFsTm4gA=
github.com/cs3org/reva/v2 v2.15.0 h1:saU2Heig/HswkNdDHh2Jttmhsn0nfTkvaYbXUspcNOM=
github.com/cs3org/reva/v2 v2.15.0/go.mod h1:4z5EQghS2LhSWZWocH51Dw9VAs16No1zSFvFgQtgS7w=
github.com/cs3org/reva/v2 v2.15.1-0.20230718140539-0af2a07c7fd9 h1:ycV7H1siLmMiRmc9kaS0WonysHYUT7irvH4FDDAghqQ=
github.com/cs3org/reva/v2 v2.15.1-0.20230718140539-0af2a07c7fd9/go.mod h1:4z5EQghS2LhSWZWocH51Dw9VAs16No1zSFvFgQtgS7w=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
Expand Down
12 changes: 12 additions & 0 deletions services/storage-users/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@

Starting with ocis version 3.0.0, the default backend for metadata switched to messagepack. If the setting `STORAGE_USERS_OCIS_METADATA_BACKEND` has not been defined manually, the backend will be migrated to `messagepack` automatically. Though still possible to manually configure `xattrs`, this setting should not be used anymore as it will be removed in a later version.

## Graceful Shutdown

Starting with Infinite Scale version 3.1, you can define a graceful shutdown period for the `storage-users` service.

IMPORTANT: The graceful shtutdown period is only applicapable if the `storage-users` service runs as stand-alone service. It does not apply if the `storage-users` service runs as part of the single binary or as single Docker environment. To build an environment where the `storage-users` service runs as a stand alone service, you must start two instances, one _without_ the `storage-users` service and one _only with_ the the `storage-users` service. Note that the instances configured must be able to communicate on the same network.
mmattel marked this conversation as resolved.
Show resolved Hide resolved

When hard stopping Infinite Scale, it is possible that not all data from the decomposedfs (metadata) has been written down to the storage. Such a hard stop may result in an inconsistent decomposedfs. To mitigate that situation, the following things have been implemented:
mmattel marked this conversation as resolved.
Show resolved Hide resolved

* With the value of the environment variable `STORAGE_USERS_GRACEFUL_SHUTDOWN_TIMEOUT`, the `storage-users` service will delay its shutdown giving it time to finalize writing down necessary data. This delay can be necessary if there is a lot of data to be written and/or if storage access/thruput is slow. Though it should not occur but in case you would recieve an error log entry because of not being able to write down data in time, you must increase the default value.

Check warning on line 17 in services/storage-users/README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

services/storage-users/README.md#L17

[list-item-indent] Incorrect list-item indent: add 2 spaces
mmattel marked this conversation as resolved.
Show resolved Hide resolved
mmattel marked this conversation as resolved.
Show resolved Hide resolved

* If a shutdown error has been logged, the command line maintenance tool [Inspect and Manipulate Node Metadata](https://doc.owncloud.com/ocis/next/maintenance/commands/commands.html#inspect-and-manipulate-node-metadata) can help to fix the issue. Please contact support for details.

Check warning on line 19 in services/storage-users/README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

services/storage-users/README.md#L19

[list-item-indent] Incorrect list-item indent: add 2 spaces
mmattel marked this conversation as resolved.
Show resolved Hide resolved

## CLI Commands

### Manage Unfinished Uploads
Expand Down
3 changes: 2 additions & 1 deletion services/storage-users/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ type Config struct {
TokenManager *TokenManager `yaml:"token_manager"`
Reva *shared.Reva `yaml:"reva"`

SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"STORAGE_USERS_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."`
SkipUserGroupsInToken bool `yaml:"skip_user_groups_in_token" env:"STORAGE_USERS_SKIP_USER_GROUPS_IN_TOKEN" desc:"Disables the loading of user's group memberships from the reva access token."`
GracefulShutdownTimeout int `yaml:"graceful_shutdown_timeout" env:"STORAGE_USERS_GRACEFUL_SHUTDOWN_TIMEOUT" desc:"The number of seconds to wait for the 'storage-users' service to shutdown cleanly before exiting with an error that gets logged. Note: This setting is only applicable when running the 'storage-users' service as a standalone service. See the text description for more details."`

Driver string `yaml:"driver" env:"STORAGE_USERS_DRIVER" desc:"The storage driver which should be used by the service. Defaults to 'ocis', Supported values are: 'ocis', 's3ng' and 'owncloudsql'. The 'ocis' driver stores all data (blob and meta data) in an POSIX compliant volume. The 's3ng' driver stores metadata in a POSIX compliant volume and uploads blobs to the s3 bucket."`
Drivers Drivers `yaml:"drivers"`
Expand Down
13 changes: 7 additions & 6 deletions services/storage-users/pkg/config/defaults/defaultconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ func DefaultConfig() *config.Config {
Service: config.Service{
Name: "storage-users",
},
Reva: shared.DefaultRevaConfig(),
DataServerURL: "http://localhost:9158/data",
DataGatewayURL: "https://localhost:9200/data",
TransferExpires: 86400,
UploadExpiration: 24 * 60 * 60,
Driver: "ocis",
Reva: shared.DefaultRevaConfig(),
DataServerURL: "http://localhost:9158/data",
DataGatewayURL: "https://localhost:9200/data",
TransferExpires: 86400,
UploadExpiration: 24 * 60 * 60,
GracefulShutdownTimeout: 30,
Driver: "ocis",
Drivers: config.Drivers{
OwnCloudSQL: config.OwnCloudSQLDriver{
Root: filepath.Join(defaults.BaseDataPath(), "storage", "owncloud"),
Expand Down
12 changes: 7 additions & 5 deletions services/storage-users/pkg/revaconfig/config.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Package revaconfig contains the config for the reva service
package revaconfig

import (
Expand All @@ -10,11 +11,12 @@ import (
func StorageUsersConfigFromStruct(cfg *config.Config) map[string]interface{} {
rcfg := map[string]interface{}{
"core": map[string]interface{}{
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_exporter": cfg.Tracing.Type,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": cfg.Service.Name,
"tracing_enabled": cfg.Tracing.Enabled,
"tracing_exporter": cfg.Tracing.Type,
"tracing_endpoint": cfg.Tracing.Endpoint,
"tracing_collector": cfg.Tracing.Collector,
"tracing_service_name": cfg.Service.Name,
"graceful_shutdown_timeout": cfg.GracefulShutdownTimeout,
},
"shared": map[string]interface{}{
"jwt_secret": cfg.TokenManager.JWTSecret,
Expand Down
115 changes: 70 additions & 45 deletions vendor/github.com/cs3org/reva/v2/cmd/revad/internal/grace/grace.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions vendor/github.com/cs3org/reva/v2/cmd/revad/runtime/runtime.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1
github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1
github.com/cs3org/go-cs3apis/cs3/tx/v1beta1
github.com/cs3org/go-cs3apis/cs3/types/v1beta1
# github.com/cs3org/reva/v2 v2.15.0
# github.com/cs3org/reva/v2 v2.15.1-0.20230718140539-0af2a07c7fd9
## explicit; go 1.20
github.com/cs3org/reva/v2/cmd/revad/internal/grace
github.com/cs3org/reva/v2/cmd/revad/runtime
Expand Down