mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed5fa1926d | ||
|
|
87f29874c3 | ||
|
|
468adfadad | ||
|
|
e396e20faa | ||
|
|
01d0de6ede | ||
|
|
20f2b71a4a | ||
|
|
e3c5f624b9 | ||
|
|
2cc8a56f86 | ||
|
|
3fdfa8113f | ||
|
|
bcef462b6c | ||
|
|
d2b9f53edb | ||
|
|
b624b6edd1 | ||
|
|
2c4bd59281 |
No files matched your search
@@ -34,7 +34,7 @@ require (
|
||||
github.com/google/btree v1.1.3
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/google/wire v0.7.0 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.22.0 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.21.0 // indirect
|
||||
github.com/gorilla/mux v1.8.1
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
@@ -46,7 +46,7 @@ require (
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/karlseguin/ccache/v2 v2.0.8
|
||||
github.com/klauspost/compress v1.18.6
|
||||
github.com/klauspost/compress v1.18.5
|
||||
github.com/klauspost/reedsolomon v1.14.0
|
||||
github.com/kurin/blazer v0.5.3
|
||||
github.com/linxGnu/grocksdb v1.10.7
|
||||
@@ -61,14 +61,14 @@ require (
|
||||
github.com/posener/complete v1.2.3
|
||||
github.com/pquerna/cachecontrol v0.2.0
|
||||
github.com/prometheus/client_golang v1.23.2
|
||||
github.com/prometheus/client_model v0.6.2
|
||||
github.com/prometheus/common v0.67.5 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/common v0.67.2 // indirect
|
||||
github.com/prometheus/procfs v0.20.1
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/seaweedfs/goexif v1.0.3
|
||||
github.com/seaweedfs/raft v1.1.8
|
||||
github.com/sirupsen/logrus v1.9.4 // indirect
|
||||
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af // indirect
|
||||
github.com/spf13/afero v1.15.0 // indirect
|
||||
github.com/spf13/cast v1.10.0 // indirect
|
||||
github.com/spf13/viper v1.21.0
|
||||
@@ -93,15 +93,15 @@ require (
|
||||
gocloud.dev/pubsub/natspubsub v0.45.0
|
||||
gocloud.dev/pubsub/rabbitpubsub v0.45.0
|
||||
golang.org/x/crypto v0.50.0
|
||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f
|
||||
golang.org/x/image v0.39.0
|
||||
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa
|
||||
golang.org/x/image v0.38.0
|
||||
golang.org/x/net v0.53.0
|
||||
golang.org/x/oauth2 v0.36.0
|
||||
golang.org/x/sys v0.43.0
|
||||
golang.org/x/text v0.36.0 // indirect
|
||||
golang.org/x/tools v0.44.0 // indirect
|
||||
golang.org/x/tools v0.43.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
|
||||
google.golang.org/api v0.278.0
|
||||
google.golang.org/api v0.274.0
|
||||
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 // indirect
|
||||
google.golang.org/grpc v1.80.0
|
||||
google.golang.org/protobuf v1.36.11
|
||||
@@ -113,7 +113,7 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go/kms v1.31.0
|
||||
cloud.google.com/go/kms v1.30.0
|
||||
github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys v0.10.0
|
||||
github.com/Jille/raft-grpc-transport v1.6.1
|
||||
github.com/ThreeDotsLabs/watermill v1.5.1
|
||||
@@ -130,7 +130,7 @@ require (
|
||||
github.com/cognusion/imaging v1.0.2
|
||||
github.com/fluent/fluent-logger-golang v1.10.1
|
||||
github.com/getsentry/sentry-go v0.44.1
|
||||
github.com/go-git/go-billy/v5 v5.9.0
|
||||
github.com/go-git/go-billy/v5 v5.8.0
|
||||
github.com/go-ldap/ldap/v3 v3.4.13
|
||||
github.com/golang-jwt/jwt/v5 v5.3.1
|
||||
github.com/google/flatbuffers/go v0.0.0-20230108230133-3b8644d32c50
|
||||
@@ -143,17 +143,17 @@ require (
|
||||
github.com/orcaman/concurrent-map/v2 v2.0.1
|
||||
github.com/parquet-go/parquet-go v0.28.0
|
||||
github.com/pkg/sftp v1.13.10
|
||||
github.com/rabbitmq/amqp091-go v1.11.0
|
||||
github.com/rclone/rclone v1.74.1
|
||||
github.com/rabbitmq/amqp091-go v1.10.0
|
||||
github.com/rclone/rclone v1.73.5
|
||||
github.com/rdleal/intervalst v1.5.0
|
||||
github.com/redis/go-redis/v9 v9.18.0
|
||||
github.com/schollz/progressbar/v3 v3.19.0
|
||||
github.com/seaweedfs/go-fuse/v2 v2.9.3
|
||||
github.com/shirou/gopsutil/v4 v4.26.3
|
||||
github.com/shirou/gopsutil/v4 v4.26.2
|
||||
github.com/tarantool/go-tarantool/v2 v2.4.2
|
||||
github.com/testcontainers/testcontainers-go v0.40.0
|
||||
github.com/tikv/client-go/v2 v2.0.7
|
||||
github.com/willscott/go-nfs v0.0.4
|
||||
github.com/willscott/go-nfs v0.0.3
|
||||
github.com/willscott/go-nfs-client v0.0.0-20251022144359-801f10d98886
|
||||
github.com/xeipuuv/gojsonschema v1.2.0
|
||||
github.com/ydb-platform/ydb-go-sdk-auth-environ v0.5.1
|
||||
@@ -176,9 +176,8 @@ require (
|
||||
dario.cat/mergo v1.0.2 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.1 // indirect
|
||||
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
|
||||
github.com/FilenCloudDienste/filen-sdk-go v0.0.39 // indirect
|
||||
github.com/FilenCloudDienste/filen-sdk-go v0.0.38 // indirect
|
||||
github.com/a1ex3/zstd-seekable-format-go/pkg v0.10.0 // indirect
|
||||
github.com/adrg/xdg v0.5.3 // indirect
|
||||
github.com/anchore/go-lzo v0.1.0 // indirect
|
||||
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
|
||||
github.com/apache/arrow-go/v18 v18.5.2-0.20260220015023-a886a5722b87 // indirect
|
||||
@@ -191,7 +190,8 @@ require (
|
||||
github.com/boombuler/barcode v1.1.0 // indirect
|
||||
github.com/buger/jsonparser v1.1.2 // indirect
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
|
||||
github.com/clipperhouse/stringish v0.1.1 // indirect
|
||||
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
|
||||
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
|
||||
github.com/cockroachdb/errors v1.11.3 // indirect
|
||||
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 // indirect
|
||||
@@ -224,7 +224,7 @@ require (
|
||||
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
|
||||
github.com/hashicorp/go-sockaddr v1.0.7 // indirect
|
||||
github.com/hashicorp/hcl v1.0.1-vault-7 // indirect
|
||||
github.com/internxt/rclone-adapter v0.0.0-20260331173834-036f908d0160 // indirect
|
||||
github.com/internxt/rclone-adapter v0.0.0-20260220172730-613f4cc8b8fd // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
||||
github.com/jackc/puddle/v2 v2.2.2 // indirect
|
||||
@@ -257,10 +257,10 @@ require (
|
||||
github.com/pierrre/geohash v1.0.0 // indirect
|
||||
github.com/pquerna/otp v1.5.0 // indirect
|
||||
github.com/pterm/pterm v0.12.82 // indirect
|
||||
github.com/quic-go/qpack v0.6.0 // indirect
|
||||
github.com/quic-go/quic-go v0.57.0 // indirect
|
||||
github.com/rasky/go-xdr v0.0.0-20170124162913-1a41d1a06c93 // indirect
|
||||
github.com/rclone/Proton-API-Bridge v1.0.3 // indirect
|
||||
github.com/rclone/go-proton-api v1.0.2 // indirect
|
||||
github.com/rclone/Proton-API-Bridge v1.0.1-0.20260127174007-77f974840d11 // indirect
|
||||
github.com/rclone/go-proton-api v1.0.1-0.20260127173028-eb465cac3b18 // indirect
|
||||
github.com/rogpeppe/go-internal v1.14.1 // indirect
|
||||
github.com/ryanuber/go-glob v1.0.0 // indirect
|
||||
github.com/sasha-s/go-deadlock v0.3.1 // indirect
|
||||
@@ -285,14 +285,14 @@ require (
|
||||
go.uber.org/mock v0.5.2 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.3 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
golang.org/x/mod v0.35.0 // indirect
|
||||
golang.org/x/telemetry v0.0.0-20260409153401-be6f6cb8b1fa // indirect
|
||||
golang.org/x/mod v0.34.0 // indirect
|
||||
golang.org/x/telemetry v0.0.0-20260311193753-579e4da9a98c // indirect
|
||||
gonum.org/v1/gonum v0.17.0 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
cel.dev/expr v0.25.1 // indirect
|
||||
cloud.google.com/go/auth v0.20.0 // indirect
|
||||
cloud.google.com/go/auth v0.19.0 // indirect
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.9.0 // indirect
|
||||
cloud.google.com/go/iam v1.7.0 // indirect
|
||||
@@ -302,23 +302,23 @@ require (
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.4
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azfile v1.5.4 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azfile v1.5.3 // indirect
|
||||
github.com/Azure/go-ntlmssp v0.1.1 // indirect
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect
|
||||
github.com/Files-com/files-sdk-go/v3 v3.3.82 // indirect
|
||||
github.com/Files-com/files-sdk-go/v3 v3.2.264 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.31.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.55.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.55.0 // indirect
|
||||
github.com/IBM/go-sdk-core/v5 v5.21.2 // indirect
|
||||
github.com/IBM/go-sdk-core/v5 v5.21.0 // indirect
|
||||
github.com/Max-Sum/base32768 v0.0.0-20230304063302-18e6ce5945fd // indirect
|
||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||
github.com/ProtonMail/bcrypt v0.0.0-20211005172633-e235017c1baf // indirect
|
||||
github.com/ProtonMail/gluon v0.17.1-0.20230724134000-308be39be96e // indirect
|
||||
github.com/ProtonMail/go-crypto v1.4.1 // indirect
|
||||
github.com/ProtonMail/go-crypto v1.3.0 // indirect
|
||||
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f // indirect
|
||||
github.com/ProtonMail/go-srp v0.0.7 // indirect
|
||||
github.com/ProtonMail/gopenpgp/v2 v2.9.0 // indirect
|
||||
github.com/PuerkitoBio/goquery v1.11.0 // indirect
|
||||
github.com/PuerkitoBio/goquery v1.10.3 // indirect
|
||||
github.com/abbot/go-http-auth v0.4.0 // indirect
|
||||
github.com/andybalholm/brotli v1.2.0 // indirect
|
||||
github.com/andybalholm/cascadia v1.3.3 // indirect
|
||||
@@ -326,7 +326,7 @@ require (
|
||||
github.com/arangodb/go-velocypack v0.0.0-20200318135517-5af53c29c67e // indirect
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.13 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 // indirect
|
||||
@@ -348,13 +348,13 @@ require (
|
||||
github.com/calebcase/tmpfile v1.0.3 // indirect
|
||||
github.com/chilts/sid v0.0.0-20190607042430-660e94789ec9 // indirect
|
||||
github.com/cloudflare/circl v1.6.3 // indirect
|
||||
github.com/cloudinary/cloudinary-go/v2 v2.15.0 // indirect
|
||||
github.com/cloudinary/cloudinary-go/v2 v2.13.0 // indirect
|
||||
github.com/cloudsoda/go-smb2 v0.0.0-20250228001242-d4c70e6251cc // indirect
|
||||
github.com/cloudsoda/sddl v0.0.0-20250224235906-926454e91efc // indirect
|
||||
github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5 // indirect
|
||||
github.com/colinmarc/hdfs/v2 v2.4.0 // indirect
|
||||
github.com/creasty/defaults v1.8.0 // indirect
|
||||
github.com/cronokirby/saferith v0.33.1-0.20250226174546-1f11f94ce488 // indirect
|
||||
github.com/cronokirby/saferith v0.33.0 // indirect
|
||||
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect
|
||||
github.com/d4l3k/messagediff v1.2.1 // indirect
|
||||
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
|
||||
@@ -368,7 +368,7 @@ require (
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/flynn/noise v1.1.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.13 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.11 // indirect
|
||||
github.com/geoffgarside/ber v1.2.0 // indirect
|
||||
github.com/go-chi/chi/v5 v5.2.5 // indirect
|
||||
github.com/go-darwin/apfs v0.0.0-20211011131704-f84b94dbf348 // indirect
|
||||
@@ -376,19 +376,19 @@ require (
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||
github.com/go-openapi/errors v0.22.6 // indirect
|
||||
github.com/go-openapi/errors v0.22.4 // indirect
|
||||
github.com/go-openapi/strfmt v0.25.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.30.1 // indirect
|
||||
github.com/go-resty/resty/v2 v2.17.2 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
|
||||
github.com/go-playground/validator/v10 v10.28.0 // indirect
|
||||
github.com/go-resty/resty/v2 v2.16.5 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
|
||||
github.com/goccy/go-json v0.10.5 // indirect
|
||||
github.com/gofrs/flock v0.13.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
|
||||
github.com/google/s2a-go v0.1.9 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.15 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.14 // indirect
|
||||
github.com/gorilla/schema v1.4.1 // indirect
|
||||
github.com/gorilla/securecookie v1.1.2 // indirect
|
||||
github.com/gorilla/sessions v1.4.0
|
||||
@@ -405,7 +405,7 @@ require (
|
||||
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
|
||||
github.com/jcmturner/goidentity/v6 v6.0.1 // indirect
|
||||
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
|
||||
github.com/jlaffaye/ftp v0.2.1-0.20251026020404-6602e981a1bb // indirect
|
||||
github.com/jlaffaye/ftp v0.2.1-0.20240918233326-1b970516f5d3 // indirect
|
||||
github.com/jonboulle/clockwork v0.5.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/jtolio/noiseconn v0.0.0-20231127013910-f6d9ecbf1de7 // indirect
|
||||
@@ -419,9 +419,9 @@ require (
|
||||
github.com/lanrat/extsort v1.4.2 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/lpar/date v1.0.0 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20260216142805-b3301c5f2a88 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.22 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.19 // indirect
|
||||
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4
|
||||
@@ -436,8 +436,8 @@ require (
|
||||
github.com/oklog/ulid v1.3.1 // indirect
|
||||
github.com/onsi/ginkgo/v2 v2.23.3 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/oracle/oci-go-sdk/v65 v65.111.0 // indirect
|
||||
github.com/panjf2000/ants/v2 v2.11.5 // indirect
|
||||
github.com/oracle/oci-go-sdk/v65 v65.104.0 // indirect
|
||||
github.com/panjf2000/ants/v2 v2.11.3 // indirect
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
||||
github.com/pengsrc/go-shared v0.2.1-0.20190131101655-1999055a4a14 // indirect
|
||||
@@ -453,7 +453,7 @@ require (
|
||||
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
|
||||
github.com/putdotio/go-putio/putio v0.0.0-20200123120452-16d982cac2b8 // indirect
|
||||
github.com/relvacode/iso8601 v1.7.0 // indirect
|
||||
github.com/rfjakob/eme v1.2.0 // indirect
|
||||
github.com/rfjakob/eme v1.1.2 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
|
||||
github.com/sagikazarmark/locafero v0.11.0 // indirect
|
||||
@@ -466,11 +466,11 @@ require (
|
||||
github.com/spf13/pflag v1.0.10 // indirect
|
||||
github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/t3rm1n4l/go-mega v0.0.0-20251120131202-6845944c051c // indirect
|
||||
github.com/t3rm1n4l/go-mega v0.0.0-20251031123324-a804aaa87491 // indirect
|
||||
github.com/tarantool/go-iproto v1.1.0 // indirect
|
||||
github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a // indirect
|
||||
github.com/tikv/pd/client v0.0.0-20230329114254-1948c247c2b1 // indirect
|
||||
github.com/tinylib/msgp v1.6.3 // indirect
|
||||
github.com/tinylib/msgp v1.5.0 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.16 // indirect
|
||||
github.com/tklauser/numcpus v0.11.0 // indirect
|
||||
github.com/twmb/murmur3 v1.1.8 // indirect
|
||||
@@ -490,8 +490,8 @@ require (
|
||||
go.etcd.io/etcd/api/v3 v3.6.10 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/contrib/detectors/gcp v1.39.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
|
||||
go.opentelemetry.io/otel v1.43.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.43.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.43.0 // indirect
|
||||
@@ -500,9 +500,9 @@ require (
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.1 // indirect
|
||||
golang.org/x/term v0.42.0
|
||||
golang.org/x/time v0.15.0
|
||||
golang.org/x/time v0.15.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260427160629-7cedc36a6bc4 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
gopkg.in/validator.v2 v2.0.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
@@ -510,17 +510,12 @@ require (
|
||||
modernc.org/libc v1.72.0 // indirect
|
||||
moul.io/http2curl/v2 v2.3.0 // indirect
|
||||
sigs.k8s.io/yaml v1.6.0 // indirect
|
||||
storj.io/common v0.0.0-20260225132117-99155641c30a // indirect
|
||||
storj.io/common v0.0.0-20251107171817-6221ae45072c // indirect
|
||||
storj.io/drpc v0.0.35-0.20250513201419-f7819ea69b55 // indirect
|
||||
storj.io/eventkit v0.0.0-20250410172343-61f26d3de156 // indirect
|
||||
storj.io/infectious v0.0.2 // indirect
|
||||
storj.io/picobuf v0.0.4 // indirect
|
||||
storj.io/uplink v1.14.0 // indirect
|
||||
storj.io/uplink v1.13.1 // indirect
|
||||
)
|
||||
|
||||
// replace github.com/seaweedfs/raft => /Users/chrislu/go/src/github.com/seaweedfs/raft
|
||||
|
||||
// apache/thrift v0.23.0 uses math.MaxUint32 as an untyped int constant in
|
||||
// lib/go/thrift/framed_transport.go, which overflows int on 32-bit GOARCHes
|
||||
// (e.g. openbsd/arm, linux/arm). Pin to v0.22.0 until upstream fixes it.
|
||||
replace github.com/apache/thrift => github.com/apache/thrift v0.22.0
|
||||
@@ -94,8 +94,8 @@ cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVo
|
||||
cloud.google.com/go/assuredworkloads v1.8.0/go.mod h1:AsX2cqyNCOvEQC8RMPnoc0yEarXQk6WEKkxYfL6kGIo=
|
||||
cloud.google.com/go/assuredworkloads v1.9.0/go.mod h1:kFuI1P78bplYtT77Tb1hi0FMxM0vVpRC7VVoJC3ZoT0=
|
||||
cloud.google.com/go/assuredworkloads v1.10.0/go.mod h1:kwdUQuXcedVdsIaKgKTp9t0UJkE5+PAVNhdQm4ZVq2E=
|
||||
cloud.google.com/go/auth v0.20.0 h1:kXTssoVb4azsVDoUiF8KvxAqrsQcQtB53DcSgta74CA=
|
||||
cloud.google.com/go/auth v0.20.0/go.mod h1:942/yi/itH1SsmpyrbnTMDgGfdy2BUqIKyd0cyYLc5Q=
|
||||
cloud.google.com/go/auth v0.19.0 h1:DGYwtbcsGsT1ywuxsIoWi1u/vlks0moIblQHgSDgQkQ=
|
||||
cloud.google.com/go/auth v0.19.0/go.mod h1:2Aph7BT2KnaSFOM0JDPyiYgNh6PL9vGMiP8CUIXZ+IY=
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc=
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c=
|
||||
cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0=
|
||||
@@ -298,8 +298,8 @@ cloud.google.com/go/kms v1.4.0/go.mod h1:fajBHndQ+6ubNw6Ss2sSd+SWvjL26RNo/dr7uxs
|
||||
cloud.google.com/go/kms v1.5.0/go.mod h1:QJS2YY0eJGBg3mnDfuaCyLauWwBJiHRboYxJ++1xJNg=
|
||||
cloud.google.com/go/kms v1.6.0/go.mod h1:Jjy850yySiasBUDi6KFUwUv2n1+o7QZFyuUJg6OgjA0=
|
||||
cloud.google.com/go/kms v1.9.0/go.mod h1:qb1tPTgfF9RQP8e1wq4cLFErVuTJv7UsSC915J8dh3w=
|
||||
cloud.google.com/go/kms v1.31.0 h1:LS8N92OxFDgOLg5NCo3OmbvjtQAIVT5gUHVLKIDHaFE=
|
||||
cloud.google.com/go/kms v1.31.0/go.mod h1:YIyXZym11R5uovJJt4oN5eUL3oPmirF3yKeIh6QAf4U=
|
||||
cloud.google.com/go/kms v1.30.0 h1:TSEZopy/OXojbVCQS9Rrx0jFqdKWvO31+N8ncXbxG/s=
|
||||
cloud.google.com/go/kms v1.30.0/go.mod h1:YIyXZym11R5uovJJt4oN5eUL3oPmirF3yKeIh6QAf4U=
|
||||
cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic=
|
||||
cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI=
|
||||
cloud.google.com/go/language v1.7.0/go.mod h1:DJ6dYN/W+SQOjF8e1hLQXMF21AkH2w9wiPzPCJa2MIE=
|
||||
@@ -569,8 +569,8 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.8.1
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.8.1/go.mod h1:Ng3urmn6dYe8gnbCMoHHVl5APYz2txho3koEkV2o2HA=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.4 h1:jWQK1GI+LeGGUKBADtcH2rRqPxYB1Ljwms5gFA2LqrM=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.4/go.mod h1:8mwH4klAm9DUgR2EEHyEEAQlRDvLPyg5fQry3y+cDew=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azfile v1.5.4 h1:tZh20RjgfMxKBxJiIS75iTVAKIUxrST5X2dVHMTptL4=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azfile v1.5.4/go.mod h1:vGYAk36rhMVCfTP7v+RVruCR0zmPe6S+36KRpDCLySw=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azfile v1.5.3 h1:sxgSqOB9CDToiaVFpxuvb5wGgGqWa3lCShcm5o0n3bE=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azfile v1.5.3/go.mod h1:XdED8i399lEVblYHTZM8eXaP07gv4Z58IL6ueMlVlrg=
|
||||
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c h1:udKWzYgxTojEKWjV8V+WSxDXJ4NFATAsZjh8iIbsQIg=
|
||||
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
|
||||
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
|
||||
@@ -593,10 +593,10 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3
|
||||
github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
|
||||
github.com/DefangLabs/secret-detector v0.0.0-20250403165618-22662109213e h1:rd4bOvKmDIx0WeTv9Qz+hghsgyjikFiPrseXHlKepO0=
|
||||
github.com/DefangLabs/secret-detector v0.0.0-20250403165618-22662109213e/go.mod h1:blbwPQh4DTlCZEfk1BLU4oMIhLda2U+A840Uag9DsZw=
|
||||
github.com/FilenCloudDienste/filen-sdk-go v0.0.39 h1:tgV5jYL6dsXop9TpDTIQU6UwJjws122HrwskaEE/igY=
|
||||
github.com/FilenCloudDienste/filen-sdk-go v0.0.39/go.mod h1:0cBhKXQg49XbKZZfk5TCDa3sVLP+xMxZTWL+7KY0XR0=
|
||||
github.com/Files-com/files-sdk-go/v3 v3.3.82 h1:2RfP0d2QgkFH64BjZSWd59aMsc28IyWsUuHqU0txBtY=
|
||||
github.com/Files-com/files-sdk-go/v3 v3.3.82/go.mod h1:IPk80dOmc7VFC0DJ85xMTPmre+8xoXX6kGHAkf5jRRw=
|
||||
github.com/FilenCloudDienste/filen-sdk-go v0.0.38 h1:YCyHs3wUXEe2BEWn40vcoyaQ2ruHNmNwkasfo3Th16A=
|
||||
github.com/FilenCloudDienste/filen-sdk-go v0.0.38/go.mod h1:0cBhKXQg49XbKZZfk5TCDa3sVLP+xMxZTWL+7KY0XR0=
|
||||
github.com/Files-com/files-sdk-go/v3 v3.2.264 h1:lMHTplAYI9FtmCo/QOcpRxmPA5REVAct1r2riQmDQKw=
|
||||
github.com/Files-com/files-sdk-go/v3 v3.2.264/go.mod h1:wGqkOzRu/ClJibvDgcfuJNAqI2nLhe8g91tPlDKRCdE=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.31.0 h1:DHa2U07rk8syqvCge0QIGMCE1WxGj9njT44GH7zNJLQ=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.31.0/go.mod h1:P4WPRUkOhJC13W//jWpyfJNDAIpvRbAUIYLX/4jtlE0=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.55.0 h1:UnDZ/zFfG1JhH/DqxIZYU/1CUAlTUScoXD/LcM2Ykk8=
|
||||
@@ -605,8 +605,8 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.55.0/go.mod h1:vB2GH9GAYYJTO3mEn8oYwzEdhlayZIdQz6zdzgUIRvA=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.55.0 h1:0s6TxfCu2KHkkZPnBfsQ2y5qia0jl3MMrmBhu3nCOYk=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.55.0/go.mod h1:Mf6O40IAyB9zR/1J8nGDDPirZQQPbYJni8Yisy7NTMc=
|
||||
github.com/IBM/go-sdk-core/v5 v5.21.2 h1:mJ5QbLPOm4g5qhZiVB6wbSllfpeUExftGoyPek2hk4M=
|
||||
github.com/IBM/go-sdk-core/v5 v5.21.2/go.mod h1:ngpMgwkjur1VNUjqn11LPk3o5eCyOCRbcfg/0YAY7Hc=
|
||||
github.com/IBM/go-sdk-core/v5 v5.21.0 h1:DUnYhvC4SoC8T84rx5omnhY3+xcQg/Whyoa3mDPIMkk=
|
||||
github.com/IBM/go-sdk-core/v5 v5.21.0/go.mod h1:Q3BYO6iDA2zweQPDGbNTtqft5tDcEpm6RTuqMlPcvbw=
|
||||
github.com/Jille/raft-grpc-transport v1.6.1 h1:gN3sjapb+fVbiebS7AfQQgbV2ecTOI7ur7NPPC7Mhoc=
|
||||
github.com/Jille/raft-grpc-transport v1.6.1/go.mod h1:HbOjEdu/yzCJ/mjTF6wEOJNbAUpHfU2UOA2hVD4CNFg=
|
||||
github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk=
|
||||
@@ -633,16 +633,16 @@ github.com/ProtonMail/bcrypt v0.0.0-20211005172633-e235017c1baf/go.mod h1:o0ESU9
|
||||
github.com/ProtonMail/gluon v0.17.1-0.20230724134000-308be39be96e h1:lCsqUUACrcMC83lg5rTo9Y0PnPItE61JSfvMyIcANwk=
|
||||
github.com/ProtonMail/gluon v0.17.1-0.20230724134000-308be39be96e/go.mod h1:Og5/Dz1MiGpCJn51XujZwxiLG7WzvvjE5PRpZBQmAHo=
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230321155629-9a39f2531310/go.mod h1:8TI4H3IbrackdNgv+92dI+rhpCaLqM0IfpgCgenFvRE=
|
||||
github.com/ProtonMail/go-crypto v1.4.1 h1:9RfcZHqEQUvP8RzecWEUafnZVtEvrBVL9BiF67IQOfM=
|
||||
github.com/ProtonMail/go-crypto v1.4.1/go.mod h1:e1OaTyu5SYVrO9gKOEhTc+5UcXtTUa+P3uLudwcgPqo=
|
||||
github.com/ProtonMail/go-crypto v1.3.0 h1:ILq8+Sf5If5DCpHQp4PbZdS1J7HDFRXz/+xKBiRGFrw=
|
||||
github.com/ProtonMail/go-crypto v1.3.0/go.mod h1:9whxjD8Rbs29b4XWbB8irEcE8KHMqaR2e7GWU1R+/PE=
|
||||
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f h1:tCbYj7/299ekTTXpdwKYF8eBlsYsDVoggDAuAjoK66k=
|
||||
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f/go.mod h1:gcr0kNtGBqin9zDW9GOHcVntrwnjrK+qdJ06mWYBybw=
|
||||
github.com/ProtonMail/go-srp v0.0.7 h1:Sos3Qk+th4tQR64vsxGIxYpN3rdnG9Wf9K4ZloC1JrI=
|
||||
github.com/ProtonMail/go-srp v0.0.7/go.mod h1:giCp+7qRnMIcCvI6V6U3S1lDDXDQYx2ewJ6F/9wdlJk=
|
||||
github.com/ProtonMail/gopenpgp/v2 v2.9.0 h1:ruLzBmwe4dR1hdnrsEJ/S7psSBmV15gFttFUPP/+/kE=
|
||||
github.com/ProtonMail/gopenpgp/v2 v2.9.0/go.mod h1:IldDyh9Hv1ZCCYatTuuEt1XZJ0OPjxLpTarDfglih7s=
|
||||
github.com/PuerkitoBio/goquery v1.11.0 h1:jZ7pwMQXIITcUXNH83LLk+txlaEy6NVOfTuP43xxfqw=
|
||||
github.com/PuerkitoBio/goquery v1.11.0/go.mod h1:wQHgxUOU3JGuj3oD/QFfxUdlzW6xPHfqyHre6VMY4DQ=
|
||||
github.com/PuerkitoBio/goquery v1.10.3 h1:pFYcNSqHxBD06Fpj/KsbStFRsgRATgnf3LeXiUkhzPo=
|
||||
github.com/PuerkitoBio/goquery v1.10.3/go.mod h1:tMUX0zDMHXYlAQk6p35XxQMqMweEKB7iK7iLNd4RH4Y=
|
||||
github.com/Sereal/Sereal/Go/sereal v0.0.0-20231009093132-b9187f1a92c6/go.mod h1:JwrycNnC8+sZPDyzM3MQ86LvaGzSpfxg885KOOwFRW4=
|
||||
github.com/Shopify/sarama v1.38.1 h1:lqqPUPQZ7zPqYlWpTh+LQ9bhYNu2xJL6k1SJN4WVe2A=
|
||||
github.com/Shopify/sarama v1.38.1/go.mod h1:iwv9a67Ha8VNa+TifujYoWGxWnu2kNVAQdSdZ4X2o5g=
|
||||
@@ -656,14 +656,12 @@ github.com/a-h/templ v0.3.1001 h1:yHDTgexACdJttyiyamcTHXr2QkIeVF1MukLy44EAhMY=
|
||||
github.com/a-h/templ v0.3.1001/go.mod h1:oCZcnKRf5jjsGpf2yELzQfodLphd2mwecwG4Crk5HBo=
|
||||
github.com/a1ex3/zstd-seekable-format-go/pkg v0.10.0 h1:iLDOF0rdGTrol/q8OfPIIs5kLD8XvA2q75o6Uq/tgak=
|
||||
github.com/a1ex3/zstd-seekable-format-go/pkg v0.10.0/go.mod h1:DrEWcQJjz7t5iF2duaiyhg4jyoF0kxOD6LtECNGkZ/Q=
|
||||
github.com/aalpar/deheap v1.1.2 h1:MABHLcnjqsffb8GLkUFDigqpBBxOMz0DoKM9QfELeTw=
|
||||
github.com/aalpar/deheap v1.1.2/go.mod h1:A+nfkD4JbS05sewV0he/MYgR/90vfqyMoNNROgs+rmA=
|
||||
github.com/aalpar/deheap v0.0.0-20210914013432-0cc84d79dec3 h1:hhdWprfSpFbN7lz3W1gM40vOgvSh1WCSMxYD6gGB4Hs=
|
||||
github.com/aalpar/deheap v0.0.0-20210914013432-0cc84d79dec3/go.mod h1:XaUnRxSCYgL3kkgX0QHIV0D+znljPIDImxlv2kbGv0Y=
|
||||
github.com/abbot/go-http-auth v0.4.0 h1:QjmvZ5gSC7jm3Zg54DqWE/T5m1t2AfDu6QlXJT0EVT0=
|
||||
github.com/abbot/go-http-auth v0.4.0/go.mod h1:Cz6ARTIzApMJDzh5bRMSUou6UMSp0IEXg9km/ci7TJM=
|
||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
|
||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
|
||||
github.com/adrg/xdg v0.5.3 h1:xRnxJXne7+oWDatRhR1JLnvuccuIeCoBu2rtuLqQB78=
|
||||
github.com/adrg/xdg v0.5.3/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ=
|
||||
github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY=
|
||||
github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk=
|
||||
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
|
||||
@@ -698,8 +696,9 @@ github.com/apache/cassandra-gocql-driver/v2 v2.1.0 h1:VEbbeJ2ift4deKMZ6Fs55Vs3fq
|
||||
github.com/apache/cassandra-gocql-driver/v2 v2.1.0/go.mod h1:QH/asJjB3mHvY6Dot6ZKMMpTcOrWJ8i9GhsvG1g0PK4=
|
||||
github.com/apache/iceberg-go v0.5.0 h1:wQj4CK5YiXZcB+tj19gWG+Jf1I6MiORQ/StSL/E5gGQ=
|
||||
github.com/apache/iceberg-go v0.5.0/go.mod h1:F/rdP1yZmnO4mQ0Qew2HTGdc+ZV57cRfxbbq/uJm1eM=
|
||||
github.com/apache/thrift v0.22.0 h1:r7mTJdj51TMDe6RtcmNdQxgn9XcyfGDOzegMDRg47uc=
|
||||
github.com/apache/thrift v0.22.0/go.mod h1:1e7J/O1Ae6ZQMTYdy9xa3w9k+XHWPfRvdPyJeynQ+/g=
|
||||
github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
|
||||
github.com/apache/thrift v0.23.0 h1:wKR6YnefQSEnxpEfmgTPuJibNG4bF0p2TK34tHLWi3s=
|
||||
github.com/apache/thrift v0.23.0/go.mod h1:zPt6WxgvTOM6hF92y8C+MkEM5LMxZuk4JcQOiU4Esvs=
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY=
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4=
|
||||
github.com/apple/foundationdb/bindings/go v0.0.0-20250911184653-27f7192f47c3 h1:WZaTKNHCfcw7fWSR6/RKnCldVzvYZC+Y20Su4lffEIg=
|
||||
@@ -725,8 +724,8 @@ github.com/aws/aws-sdk-go-v2/credentials v1.19.14 h1:n+UcGWAIZHkXzYt87uMFBv/l8TH
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.19.14/go.mod h1:cJKuyWB59Mqi0jM3nFYQRmnHVQIcgoxjEMAbLkpr62w=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 h1:NUS3K4BTDArQqNu2ih7yeDLaS3bmHD0YndtA6UP884g=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21/go.mod h1:YWNWJQNjKigKY1RHVJCuupeWDrrHjRqHm0N9rdrWzYI=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.13 h1:uMC4oL6G3MNhodo358QEqSDjrgvzV3TUQ58nyQSGq2E=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.13/go.mod h1:Cer86AE2686DvVUe57LPve3jUBmbujuaonSX8pNzGgw=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.1 h1:IbWiN670htmBioc+Zj32vSpJgQ2+OYSlvTvfQ1nCORQ=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.1/go.mod h1:tw/B596EUhBWDFGdDGuLC21fVU4A3s4/5Efy8S39W18=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 h1:Rgg6wvjjtX8bNHcvi9OnXWwcE0a2vGpbwmtICOsvcf4=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21/go.mod h1:A/kJFst/nm//cyqonihbdpQZwiUhhzpqTsdbhDdRF9c=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 h1:PEgGVtPoB6NTpPrBgqSE5hE/o47Ij9qk/SEZFbUOe9A=
|
||||
@@ -828,13 +827,15 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn
|
||||
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
|
||||
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk=
|
||||
github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
|
||||
github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs=
|
||||
github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA=
|
||||
github.com/clipperhouse/uax29/v2 v2.3.0 h1:SNdx9DVUqMoBuBoW3iLOj4FQv3dN5mDtuqwuhIGpJy4=
|
||||
github.com/clipperhouse/uax29/v2 v2.3.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
|
||||
github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I=
|
||||
github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg8=
|
||||
github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4=
|
||||
github.com/cloudinary/cloudinary-go/v2 v2.15.0 h1:iLoIwb7BJECHTbNcmIhYDsQhoZiACWGNvEpyqQy97Dk=
|
||||
github.com/cloudinary/cloudinary-go/v2 v2.15.0/go.mod h1:ireC4gqVetsjVhYlwjUJwKTbZuWjEIynbR9zQTlqsvo=
|
||||
github.com/cloudinary/cloudinary-go/v2 v2.13.0 h1:ugiQwb7DwpWQnete2AZkTh94MonZKmxD7hDGy1qTzDs=
|
||||
github.com/cloudinary/cloudinary-go/v2 v2.13.0/go.mod h1:ireC4gqVetsjVhYlwjUJwKTbZuWjEIynbR9zQTlqsvo=
|
||||
github.com/cloudsoda/go-smb2 v0.0.0-20250228001242-d4c70e6251cc h1:t8YjNUCt1DimB4HCIXBztwWMhgxr5yG5/YaRl9Afdfg=
|
||||
github.com/cloudsoda/go-smb2 v0.0.0-20250228001242-d4c70e6251cc/go.mod h1:CgWpFCFWzzEA5hVkhAc6DZZzGd3czx+BblvOzjmg6KA=
|
||||
github.com/cloudsoda/sddl v0.0.0-20250224235906-926454e91efc h1:0xCWmFKBmarCqqqLeM7jFBSw/Or81UEElFqO8MY+GDs=
|
||||
@@ -904,9 +905,8 @@ github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
|
||||
github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
|
||||
github.com/creasty/defaults v1.8.0 h1:z27FJxCAa0JKt3utc0sCImAEb+spPucmKoOdLHvHYKk=
|
||||
github.com/creasty/defaults v1.8.0/go.mod h1:iGzKe6pbEHnpMPtfDXZEr0NVxWnPTjb1bbDy08fPzYM=
|
||||
github.com/cronokirby/saferith v0.33.0 h1:TgoQlfsD4LIwx71+ChfRcIpjkw+RPOapDEVxa+LhwLo=
|
||||
github.com/cronokirby/saferith v0.33.0/go.mod h1:QKJhjoqUtBsXCAVEjw38mFqoi7DebT7kthcD7UzbnoA=
|
||||
github.com/cronokirby/saferith v0.33.1-0.20250226174546-1f11f94ce488 h1:tLWBZgPg6TV67oe76W4p+aUQEWIa52wbcuiz8GFd3vo=
|
||||
github.com/cronokirby/saferith v0.33.1-0.20250226174546-1f11f94ce488/go.mod h1:QKJhjoqUtBsXCAVEjw38mFqoi7DebT7kthcD7UzbnoA=
|
||||
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 h1:iwZdTE0PVqJCos1vaoKsclOGD3ADKpshg3SRtYBbwso=
|
||||
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM=
|
||||
github.com/d4l3k/messagediff v1.2.1 h1:ZcAIMYsUg0EAp9X+tt8/enBE/Q8Yd5kzPynLyKptt9U=
|
||||
@@ -1047,8 +1047,8 @@ github.com/fvbommel/sortorder v1.1.0 h1:fUmoe+HLsBTctBDoaBwpQo5N+nrCp8g/BjKb/6ZQ
|
||||
github.com/fvbommel/sortorder v1.1.0/go.mod h1:uk88iVf1ovNn1iLfgUVU2F9o5eO30ui720w+kxuqRs0=
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
|
||||
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
|
||||
github.com/gabriel-vasile/mimetype v1.4.13 h1:46nXokslUBsAJE/wMsp5gtO500a4F3Nkz9Ufpk2AcUM=
|
||||
github.com/gabriel-vasile/mimetype v1.4.13/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/gabriel-vasile/mimetype v1.4.11 h1:AQvxbp830wPhHTqc1u7nzoLT+ZFxGY7emj5DR5DYFik=
|
||||
github.com/gabriel-vasile/mimetype v1.4.11/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/geoffgarside/ber v1.2.0 h1:/loowoRcs/MWLYmGX9QtIAbA+V/FrnVLsMMPhwiRm64=
|
||||
github.com/geoffgarside/ber v1.2.0/go.mod h1:jVPKeCbj6MvQZhwLYsGwaGI52oUorHoHKNecGT85ZCc=
|
||||
github.com/getsentry/sentry-go v0.44.1 h1:/cPtrA5qB7uMRrhgSn9TYtcEF36auGP3Y6+ThvD/yaI=
|
||||
@@ -1071,8 +1071,8 @@ github.com/go-fonts/latin-modern v0.2.0/go.mod h1:rQVLdDMK+mK1xscDwsqM5J8U2jrRa3
|
||||
github.com/go-fonts/liberation v0.1.1/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY=
|
||||
github.com/go-fonts/liberation v0.2.0/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY=
|
||||
github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmnUIzUY=
|
||||
github.com/go-git/go-billy/v5 v5.9.0 h1:jItGXszUDRtR/AlferWPTMN4j38BQ88XnXKbilmmBPA=
|
||||
github.com/go-git/go-billy/v5 v5.9.0/go.mod h1:jCnQMLj9eUgGU7+ludSTYoZL/GGmii14RxKFj7ROgHw=
|
||||
github.com/go-git/go-billy/v5 v5.8.0 h1:I8hjc3LbBlXTtVuFNJuwYuMiHvQJDq1AT6u4DwDzZG0=
|
||||
github.com/go-git/go-billy/v5 v5.8.0/go.mod h1:RpvI/rw4Vr5QA+Z60c6d6LXH0rYJo0uD5SqfmrrheCY=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
@@ -1096,8 +1096,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
||||
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||
github.com/go-openapi/errors v0.22.6 h1:eDxcf89O8odEnohIXwEjY1IB4ph5vmbUsBMsFNwXWPo=
|
||||
github.com/go-openapi/errors v0.22.6/go.mod h1:z9S8ASTUqx7+CP1Q8dD8ewGH/1JWFFLX/2PmAYNQLgk=
|
||||
github.com/go-openapi/errors v0.22.4 h1:oi2K9mHTOb5DPW2Zjdzs/NIvwi2N3fARKaTJLdNabaM=
|
||||
github.com/go-openapi/errors v0.22.4/go.mod h1:z9S8ASTUqx7+CP1Q8dD8ewGH/1JWFFLX/2PmAYNQLgk=
|
||||
github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ=
|
||||
github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY=
|
||||
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
|
||||
@@ -1116,8 +1116,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.30.1 h1:f3zDSN/zOma+w6+1Wswgd9fLkdwy06ntQJp0BBvFG0w=
|
||||
github.com/go-playground/validator/v10 v10.30.1/go.mod h1:oSuBIQzuJxL//3MelwSLD5hc2Tu889bF0Idm9Dg26cM=
|
||||
github.com/go-playground/validator/v10 v10.28.0 h1:Q7ibns33JjyW48gHkuFT91qX48KG0ktULL6FgHdG688=
|
||||
github.com/go-playground/validator/v10 v10.28.0/go.mod h1:GoI6I1SjPBh9p7ykNE/yj3fFYbyDOpwMn5KXd+m2hUU=
|
||||
github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg=
|
||||
github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||
github.com/go-redis/redis/v7 v7.4.1 h1:PASvf36gyUpr2zdOUS/9Zqc80GbM+9BDyiJSJDDOrTI=
|
||||
@@ -1126,8 +1126,8 @@ github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC
|
||||
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
|
||||
github.com/go-redsync/redsync/v4 v4.16.0 h1:bNcOzeHH9d3s6pghU9NJFMPrQa41f5Nx3L4YKr3BdEU=
|
||||
github.com/go-redsync/redsync/v4 v4.16.0/go.mod h1:V4gagqgyASWBZuwx4xGzu72aZNb/6Mo05byUa3mVmKQ=
|
||||
github.com/go-resty/resty/v2 v2.17.2 h1:FQW5oHYcIlkCNrMD2lloGScxcHJ0gkjshV3qcQAyHQk=
|
||||
github.com/go-resty/resty/v2 v2.17.2/go.mod h1:kCKZ3wWmwJaNc7S29BRtUhJwy7iqmn+2mLtQrOyQlVA=
|
||||
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
|
||||
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
|
||||
github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo=
|
||||
github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
@@ -1136,8 +1136,8 @@ github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1v
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
|
||||
github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U=
|
||||
github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro=
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
|
||||
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||
github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw=
|
||||
github.com/go-zookeeper/zk v1.0.4 h1:DPzxraQx7OrPyXq2phlGlNSIyWEsAox0RJmjTseMV6I=
|
||||
github.com/go-zookeeper/zk v1.0.4/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw=
|
||||
@@ -1284,8 +1284,8 @@ github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.15 h1:xolVQTEXusUcAA5UgtyRLjelpFFHWlPQ4XfWGc7MBas=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.15/go.mod h1:vqVt9yG9480NtzREnTlmGSBmFrA+bzb0yl0TxoBQXOg=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.14 h1:yh8ncqsbUY4shRD5dA6RlzjJaT4hi3kII+zYw8wmLb8=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.14/go.mod h1:vqVt9yG9480NtzREnTlmGSBmFrA+bzb0yl0TxoBQXOg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0=
|
||||
@@ -1296,8 +1296,8 @@ github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK
|
||||
github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo=
|
||||
github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY=
|
||||
github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8=
|
||||
github.com/googleapis/gax-go/v2 v2.22.0 h1:PjIWBpgGIVKGoCXuiCoP64altEJCj3/Ei+kSU5vlZD4=
|
||||
github.com/googleapis/gax-go/v2 v2.22.0/go.mod h1:irWBbALSr0Sk3qlqb9SyJ1h68WjgeFuiOzI4Rqw5+aY=
|
||||
github.com/googleapis/gax-go/v2 v2.21.0 h1:h45NjjzEO3faG9Lg/cFrBh2PgegVVgzqKzuZl/wMbiI=
|
||||
github.com/googleapis/gax-go/v2 v2.21.0/go.mod h1:But/NJU6TnZsrLai/xBAQLLz+Hc7fHZJt/hsCz3Fih4=
|
||||
github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
|
||||
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
|
||||
github.com/gookit/color v1.4.2/go.mod h1:fqRyamkC1W8uxl+lxCQxOT09l/vYfZ+QeiX3rKQHCoQ=
|
||||
@@ -1397,8 +1397,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf h1:FtEj8sfIcaaBfAKrE1Cwb61YDtYq9JxChK1c7AKce7s=
|
||||
github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf/go.mod h1:yrqSXGoD/4EKfF26AOGzscPOgTTJcyAwM2rpixWT+t4=
|
||||
github.com/internxt/rclone-adapter v0.0.0-20260331173834-036f908d0160 h1:PV6ipOJN0JIek4dqPqsTtenQmjI1SZntCUgPzhfk9gM=
|
||||
github.com/internxt/rclone-adapter v0.0.0-20260331173834-036f908d0160/go.mod h1:yRuPDnHgGmsbvopF0amMqXxr4n32GynzX5GTwFYDHaw=
|
||||
github.com/internxt/rclone-adapter v0.0.0-20260220172730-613f4cc8b8fd h1:dSIuz2mpJAPQfhHYtG57D0qwSkgC/vQ69gHfeyQ4kxA=
|
||||
github.com/internxt/rclone-adapter v0.0.0-20260220172730-613f4cc8b8fd/go.mod h1:vdPya4AIcDjvng4ViaAzqjegJf0VHYpYHQguFx5xBp0=
|
||||
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
|
||||
@@ -1429,8 +1429,8 @@ github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=
|
||||
github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jlaffaye/ftp v0.2.1-0.20251026020404-6602e981a1bb h1:6vkM8gO+zFV2m21QzGYyUSq5TP0VQgP2Xz3UQyCN2kI=
|
||||
github.com/jlaffaye/ftp v0.2.1-0.20251026020404-6602e981a1bb/go.mod h1:H1+whwD0Qe3YOunlXIWhh3rlvzW5cZfkMDYGQPg+KAM=
|
||||
github.com/jlaffaye/ftp v0.2.1-0.20240918233326-1b970516f5d3 h1:ZxO6Qr2GOXPdcW80Mcn3nemvilMPvpWqxrNfK2ZnNNs=
|
||||
github.com/jlaffaye/ftp v0.2.1-0.20240918233326-1b970516f5d3/go.mod h1:dvLUr/8Fs9a2OBrEnCC5duphbkz/k/mSy5OkXg3PAgI=
|
||||
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
|
||||
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
|
||||
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
|
||||
@@ -1475,8 +1475,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
|
||||
github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4=
|
||||
github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE=
|
||||
github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
|
||||
github.com/klauspost/compress v1.18.6 h1:2jupLlAwFm95+YDR+NwD2MEfFO9d4z4Prjl1XXDjuao=
|
||||
github.com/klauspost/compress v1.18.6/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
|
||||
github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE=
|
||||
github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.0.10/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
|
||||
github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c=
|
||||
@@ -1523,8 +1523,8 @@ github.com/lithammer/shortuuid/v3 v3.0.7 h1:trX0KTHy4Pbwo/6ia8fscyHoGA+mf1jWbPJV
|
||||
github.com/lithammer/shortuuid/v3 v3.0.7/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts=
|
||||
github.com/lpar/date v1.0.0 h1:bq/zVqFTUmsxvd/CylidY4Udqpr9BOFrParoP6p0x/I=
|
||||
github.com/lpar/date v1.0.0/go.mod h1:KjYe0dDyMQTgpqcUz4LEIeM5VZwhggjVx/V2dtc8NSo=
|
||||
github.com/lufia/plan9stats v0.0.0-20260216142805-b3301c5f2a88 h1:PTw+yKnXcOFCR6+8hHTyWBeQ/P4Nb7dd4/0ohEcWQuM=
|
||||
github.com/lufia/plan9stats v0.0.0-20260216142805-b3301c5f2a88/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg=
|
||||
github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 h1:PwQumkgq4/acIiZhtifTV5OUqqiP82UAl0h87xj/l9k=
|
||||
github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg=
|
||||
github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
|
||||
github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA=
|
||||
github.com/lyft/protoc-gen-star/v2 v2.0.1/go.mod h1:RcCdONR2ScXaYnQC5tUzxzlpA3WVYF7/opLeUgcQs/o=
|
||||
@@ -1544,8 +1544,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mattn/go-runewidth v0.0.22 h1:76lXsPn6FyHtTY+jt2fTTvsMUCZq1k0qwRsAMuxzKAk=
|
||||
github.com/mattn/go-runewidth v0.0.22/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
|
||||
github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw=
|
||||
github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
|
||||
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
|
||||
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
@@ -1657,12 +1657,12 @@ github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+
|
||||
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
|
||||
github.com/openzipkin/zipkin-go v0.4.3 h1:9EGwpqkgnwdEIJ+Od7QVSEIH+ocmm5nPat0G7sjsSdg=
|
||||
github.com/openzipkin/zipkin-go v0.4.3/go.mod h1:M9wCJZFWCo2RiY+o1eBCEMe0Dp2S5LDHcMZmk3RmK7c=
|
||||
github.com/oracle/oci-go-sdk/v65 v65.111.0 h1:eDkWg6ZN0uKwWzSekoFcQJhR+C+F/aVdTwr+lGHU9Qk=
|
||||
github.com/oracle/oci-go-sdk/v65 v65.111.0/go.mod h1:8ZzvzuEG/cFLFZhxg/Mg1w19KqyXBKO3c17QIc5PkGs=
|
||||
github.com/oracle/oci-go-sdk/v65 v65.104.0 h1:l9awEvzWvxmYhy/97A0hZ87pa7BncYXmcO/S8+rvgK0=
|
||||
github.com/oracle/oci-go-sdk/v65 v65.104.0/go.mod h1:oB8jFGVc/7/zJ+DbleE8MzGHjhs2ioCz5stRTdZdIcY=
|
||||
github.com/orcaman/concurrent-map/v2 v2.0.1 h1:jOJ5Pg2w1oeB6PeDurIYf6k9PQ+aTITr/6lP/L/zp6c=
|
||||
github.com/orcaman/concurrent-map/v2 v2.0.1/go.mod h1:9Eq3TG2oBe5FirmYWQfYO5iH1q0Jv47PLaNK++uCdOM=
|
||||
github.com/panjf2000/ants/v2 v2.11.5 h1:a7LMnMEeux/ebqTux140tRiaqcFTV0q2bEHF03nl6Rg=
|
||||
github.com/panjf2000/ants/v2 v2.11.5/go.mod h1:8u92CYMUc6gyvTIw8Ru7Mt7+/ESnJahz5EVtqfrilek=
|
||||
github.com/panjf2000/ants/v2 v2.11.3 h1:AfI0ngBoXJmYOpDh9m516vjqoUu2sLrIVgppI9TZVpg=
|
||||
github.com/panjf2000/ants/v2 v2.11.3/go.mod h1:8u92CYMUc6gyvTIw8Ru7Mt7+/ESnJahz5EVtqfrilek=
|
||||
github.com/parquet-go/bitpack v1.0.0 h1:AUqzlKzPPXf2bCdjfj4sTeacrUwsT7NlcYDMUQxPcQA=
|
||||
github.com/parquet-go/bitpack v1.0.0/go.mod h1:XnVk9TH+O40eOOmvpAVZ7K2ocQFrQwysLMnc6M/8lgs=
|
||||
github.com/parquet-go/jsonlite v1.0.0 h1:87QNdi56wOfsE5bdgas0vRzHPxfJgzrXGml1zZdd7VU=
|
||||
@@ -1755,8 +1755,8 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
|
||||
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
|
||||
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
||||
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
|
||||
github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4=
|
||||
github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw=
|
||||
github.com/prometheus/common v0.67.2 h1:PcBAckGFTIHt2+L3I33uNRTlKTplNzFctXcWhPyAEN8=
|
||||
github.com/prometheus/common v0.67.2/go.mod h1:63W3KZb1JOKgcjlIr64WW/LvFGAqKPj0atm+knVGEko=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
||||
@@ -1779,18 +1779,18 @@ github.com/puzpuzpuz/xsync/v3 v3.5.1 h1:GJYJZwO6IdxN/IKbneznS6yPkVC+c3zyY/j19c++
|
||||
github.com/puzpuzpuz/xsync/v3 v3.5.1/go.mod h1:VjzYrABPabuM4KyBh1Ftq6u8nhwY5tBPKP9jpmh0nnA=
|
||||
github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
|
||||
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
|
||||
github.com/quic-go/quic-go v0.59.0 h1:OLJkp1Mlm/aS7dpKgTc6cnpynnD2Xg7C1pwL6vy/SAw=
|
||||
github.com/quic-go/quic-go v0.59.0/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
|
||||
github.com/rabbitmq/amqp091-go v1.11.0 h1:HxIctVm9Gid/Vtn706necmZ7Wj6pgGI2eqplRbEY8O8=
|
||||
github.com/rabbitmq/amqp091-go v1.11.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
|
||||
github.com/quic-go/quic-go v0.57.0 h1:AsSSrrMs4qI/hLrKlTH/TGQeTMY0ib1pAOX7vA3AdqE=
|
||||
github.com/quic-go/quic-go v0.57.0/go.mod h1:ly4QBAjHA2VhdnxhojRsCUOeJwKYg+taDlos92xb1+s=
|
||||
github.com/rabbitmq/amqp091-go v1.10.0 h1:STpn5XsHlHGcecLmMFCtg7mqq0RnD+zFr4uzukfVhBw=
|
||||
github.com/rabbitmq/amqp091-go v1.10.0/go.mod h1:Hy4jKW5kQART1u+JkDTF9YYOQUHXqMuhrgxOEeS7G4o=
|
||||
github.com/rasky/go-xdr v0.0.0-20170124162913-1a41d1a06c93 h1:UVArwN/wkKjMVhh2EQGC0tEc1+FqiLlvYXY5mQ2f8Wg=
|
||||
github.com/rasky/go-xdr v0.0.0-20170124162913-1a41d1a06c93/go.mod h1:Nfe4efndBz4TibWycNE+lqyJZiMX4ycx+QKV8Ta0f/o=
|
||||
github.com/rclone/Proton-API-Bridge v1.0.3 h1:Bs7RC4xCFSN0BPIYVda/BNxp0qo3NV0gB2VZqx2KIew=
|
||||
github.com/rclone/Proton-API-Bridge v1.0.3/go.mod h1:26RAest751Ofk+F/d8xtl4UyWXrZvMQwn39U8rm/WKM=
|
||||
github.com/rclone/go-proton-api v1.0.2 h1:cJtJUab0MGJ3C6q5kiEJs3pbyhSLnOKMyYOQehA0PBc=
|
||||
github.com/rclone/go-proton-api v1.0.2/go.mod h1:LB2kCEaZMzNn3ocdz+qYfxXmuLxxN0ka62KJd2x53Bc=
|
||||
github.com/rclone/rclone v1.74.1 h1:QQI//tl4O5uooTowdKwNKcv5qCQvJ3LIBG00+TKeXw0=
|
||||
github.com/rclone/rclone v1.74.1/go.mod h1:44epaKf5w/1ZQounefr76wx4+y9NZmgfMKle9T3pzj0=
|
||||
github.com/rclone/Proton-API-Bridge v1.0.1-0.20260127174007-77f974840d11 h1:4MI2alxM/Ye2gIRBlYf28JGWTipZ4Zz7yAziPKrttjs=
|
||||
github.com/rclone/Proton-API-Bridge v1.0.1-0.20260127174007-77f974840d11/go.mod h1:3HLX7dwZgvB7nt+Yl/xdzVPcargQ1yBmJEUg3n+jMKM=
|
||||
github.com/rclone/go-proton-api v1.0.1-0.20260127173028-eb465cac3b18 h1:Lc+d3ISfQaMJKWZOE7z4ZSY4RVmdzbn1B0IM8xN18qM=
|
||||
github.com/rclone/go-proton-api v1.0.1-0.20260127173028-eb465cac3b18/go.mod h1:LB2kCEaZMzNn3ocdz+qYfxXmuLxxN0ka62KJd2x53Bc=
|
||||
github.com/rclone/rclone v1.73.5 h1:r8a9JHYIWUqk7hNRJuMJ3cROkKfB2zmfkADg8ZLYh6I=
|
||||
github.com/rclone/rclone v1.73.5/go.mod h1:WVv8gvA/lEl/Y37e8I8yosm7ZY+Szq7ujXbJS8Ol63o=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/rdleal/intervalst v1.5.0 h1:SEB9bCFz5IqD1yhfH1Wv8IBnY/JQxDplwkxHjT6hamU=
|
||||
@@ -1809,8 +1809,8 @@ github.com/relvacode/iso8601 v1.7.0/go.mod h1:FlNp+jz+TXpyRqgmM7tnzHHzBnz776kmAH
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
github.com/rfjakob/eme v1.2.0 h1:8dAHL+WVAw06+7DkRKnRiFp1JL3QjcJEZFqDnndUaSI=
|
||||
github.com/rfjakob/eme v1.2.0/go.mod h1:cVvpasglm/G3ngEfcfT/Wt0GwhkuO32pf/poW6Nyk1k=
|
||||
github.com/rfjakob/eme v1.1.2 h1:SxziR8msSOElPayZNFfQw4Tjx/Sbaeeh3eRvrHVMUs4=
|
||||
github.com/rfjakob/eme v1.1.2/go.mod h1:cVvpasglm/G3ngEfcfT/Wt0GwhkuO32pf/poW6Nyk1k=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
@@ -1856,15 +1856,15 @@ github.com/serialx/hashring v0.0.0-20200727003509-22c0c7ab6b1b h1:h+3JX2VoWTFuyQ
|
||||
github.com/serialx/hashring v0.0.0-20200727003509-22c0c7ab6b1b/go.mod h1:/yeG0My1xr/u+HZrFQ1tOQQQQrOawfyMUH13ai5brBc=
|
||||
github.com/shibumi/go-pathspec v1.3.0 h1:QUyMZhFo0Md5B8zV8x2tesohbb5kfbpTi9rBnKh5dkI=
|
||||
github.com/shibumi/go-pathspec v1.3.0/go.mod h1:Xutfslp817l2I1cZvgcfeMQJG5QnU2lh5tVaaMCl3jE=
|
||||
github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc=
|
||||
github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ=
|
||||
github.com/shirou/gopsutil/v4 v4.26.2 h1:X8i6sicvUFih4BmYIGT1m2wwgw2VG9YgrDTi7cIRGUI=
|
||||
github.com/shirou/gopsutil/v4 v4.26.2/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo=
|
||||
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
|
||||
github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
|
||||
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af h1:Sp5TG9f7K39yfB+If0vjp97vuT74F72r8hfRpP8jLU0=
|
||||
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA=
|
||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
|
||||
github.com/smarty/assertions v1.15.0 h1:cR//PqUBUiQRakZWqBiFFQ9wb8emQGDb0HeGdqGByCY=
|
||||
@@ -1887,8 +1887,8 @@ github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
|
||||
github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
|
||||
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
|
||||
github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
|
||||
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
|
||||
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
|
||||
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
|
||||
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
|
||||
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
|
||||
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
|
||||
@@ -1930,8 +1930,8 @@ github.com/substrait-io/substrait-protobuf/go v0.81.0 h1:/qC1XYKuO4oPdTwLYySuVZ6
|
||||
github.com/substrait-io/substrait-protobuf/go v0.81.0/go.mod h1:hn+Szm1NmZZc91FwWK9EXD/lmuGBSRTJ5IvHhlG1YnQ=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 h1:1oFLiOyVl+W7bnBzGhf7BbIv9loSFQcieWWYIjLqcAw=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA=
|
||||
github.com/t3rm1n4l/go-mega v0.0.0-20251120131202-6845944c051c h1:dtcOwRimeiBFrlutmF6K94l0rxYFARNFMA+lSQ41C+M=
|
||||
github.com/t3rm1n4l/go-mega v0.0.0-20251120131202-6845944c051c/go.mod h1:BF/l2jNyK+2h/BJZ7VLMAz6m/IWjA2F67gTjV1C/+Bo=
|
||||
github.com/t3rm1n4l/go-mega v0.0.0-20251031123324-a804aaa87491 h1:rrGZv6xYk37hx0tW2sYfgbO0PqStbHqz6Bq6oc9Hurg=
|
||||
github.com/t3rm1n4l/go-mega v0.0.0-20251031123324-a804aaa87491/go.mod h1:ykucQyiE9Q2qx1wLlEtZkkNn1IURib/2O+Mvd25i1Fo=
|
||||
github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8=
|
||||
github.com/tarantool/go-iproto v1.1.0 h1:HULVOIHsiehI+FnHfM7wMDntuzUddO09DKqu2WnFQ5A=
|
||||
github.com/tarantool/go-iproto v1.1.0/go.mod h1:LNCtdyZxojUed8SbOiYHoc3v9NvaZTB7p96hUySMlIo=
|
||||
@@ -1961,8 +1961,8 @@ github.com/tikv/pd/client v0.0.0-20230329114254-1948c247c2b1/go.mod h1:3cTcfo8GR
|
||||
github.com/tilt-dev/fsnotify v1.4.8-0.20220602155310-fff9c274a375 h1:QB54BJwA6x8QU9nHY3xJSZR2kX9bgpZekRKGkLTmEXA=
|
||||
github.com/tilt-dev/fsnotify v1.4.8-0.20220602155310-fff9c274a375/go.mod h1:xRroudyp5iVtxKqZCrA6n2TLFRBf8bmnjr1UD4x+z7g=
|
||||
github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw=
|
||||
github.com/tinylib/msgp v1.6.3 h1:bCSxiTz386UTgyT1i0MSCvdbWjVW+8sG3PjkGsZQt4s=
|
||||
github.com/tinylib/msgp v1.6.3/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA=
|
||||
github.com/tinylib/msgp v1.5.0 h1:GWnqAE54wmnlFazjq2+vgr736Akg58iiHImh+kPY2pc=
|
||||
github.com/tinylib/msgp v1.5.0/go.mod h1:cvjFkb4RiC8qSBOPMGPSzSAx47nAsfhLVTCZZNuHv5o=
|
||||
github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA=
|
||||
github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI=
|
||||
github.com/tklauser/numcpus v0.11.0 h1:nSTwhKH5e1dMNsCdVBukSZrURJRoHbSEQjdEbY+9RXw=
|
||||
@@ -2028,8 +2028,8 @@ github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IU
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
||||
github.com/willscott/go-nfs v0.0.4 h1:1vpOPAdECmoT2KmZ8u+ukO/jfvDjMEUNYhA2F1jGJtI=
|
||||
github.com/willscott/go-nfs v0.0.4/go.mod h1:VhNccO67Oug787VNXcyx9JDI3ZoSpqoKMT/lWMhUIDg=
|
||||
github.com/willscott/go-nfs v0.0.3 h1:Z5fHVxMsppgEucdkKBN26Vou19MtEM875NmRwj156RE=
|
||||
github.com/willscott/go-nfs v0.0.3/go.mod h1:VhNccO67Oug787VNXcyx9JDI3ZoSpqoKMT/lWMhUIDg=
|
||||
github.com/willscott/go-nfs-client v0.0.0-20251022144359-801f10d98886 h1:DtrBtkgTJk2XGt4T7eKdKVkd9A5NCevN2e4inLXtsqA=
|
||||
github.com/willscott/go-nfs-client v0.0.0-20251022144359-801f10d98886/go.mod h1:Tq++Lr/FgiS3X48q5FETemXiSLGuYMQT2sPjYNPJSwA=
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
|
||||
@@ -2098,8 +2098,6 @@ github.com/zeebo/blake3 v0.2.4 h1:KYQPkhpRtcqh0ssGYcKLG1JYvddkEA8QwCM/yBqhaZI=
|
||||
github.com/zeebo/blake3 v0.2.4/go.mod h1:7eeQ6d2iXWRGF6npfaxl2CU+xy2Fjo2gxeyZGCRUjcE=
|
||||
github.com/zeebo/errs v1.4.0 h1:XNdoD/RRMKP7HD0UhJnIzUy74ISdGGxURlYG8HSWSfM=
|
||||
github.com/zeebo/errs v1.4.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4=
|
||||
github.com/zeebo/mwc v0.0.7 h1:0NerGhCww6ZQx+/xCx5iwznftveokvto1KILpYfENZk=
|
||||
github.com/zeebo/mwc v0.0.7/go.mod h1:0B32or6moOig1YGuqMoimBpU9QK9uYaGG2bBOuddqtE=
|
||||
github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo=
|
||||
github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4=
|
||||
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
|
||||
@@ -2130,12 +2128,12 @@ go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/contrib/detectors/gcp v1.39.0 h1:kWRNZMsfBHZ+uHjiH4y7Etn2FK26LAGkNFw7RHv1DhE=
|
||||
go.opentelemetry.io/contrib/detectors/gcp v1.39.0/go.mod h1:t/OGqzHBa5v6RHZwrDBJ2OirWc+4q/w2fTbLZwAKjTk=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0 h1:yI1/OhfEPy7J9eoa6Sj051C7n5dvpj0QX8g4sRchg04=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.67.0/go.mod h1:NoUCKYWK+3ecatC4HjkRktREheMeEtrXoQxrqYFeHSc=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 h1:YH4g8lQroajqUwWbq/tr2QX1JFmEXaDLgG+ew9bLMWo=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0/go.mod h1:fvPi2qXDqFs8M4B4fmJhE92TyQs9Ydjlg3RvfUp+NbQ=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0 h1:0tY123n7CdWMem7MOVdKOt0YfshufLCwfE5Bob+hQuM=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.60.0/go.mod h1:CosX/aS4eHnG9D7nESYpV753l4j9q5j3SL/PUYd2lR8=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 h1:OyrsyzuttWTSur2qN/Lm0m2a8yqyIjUVBZcxFPuXq2o=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0/go.mod h1:C2NGBr+kAB4bk3xtMXfZ94gqFDtg/GkI7e9zqGh5Beg=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg=
|
||||
go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I=
|
||||
go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.38.0 h1:vl9obrcoWVKp/lwl8tRE33853I8Xru9HFbw/skNeLs8=
|
||||
@@ -2233,8 +2231,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/exp v0.0.0-20220827204233-334a2380cb91/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
|
||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f h1:W3F4c+6OLc6H2lb//N1q4WpJkhzJCK5J6kUi1NTVXfM=
|
||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f/go.mod h1:J1xhfL/vlindoeF/aINzNzt2Bket5bjo9sdOYzOsU80=
|
||||
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa h1:Zt3DZoOFFYkKhDT3v7Lm9FDMEV06GpzjG2jrqW+QTE0=
|
||||
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa/go.mod h1:K79w1Vqn7PoiZn+TkNpx3BUWUQksGO3JcVX6qIjytmA=
|
||||
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
@@ -2248,8 +2246,8 @@ golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9/go.mod h1:023OzeP/+EPmXeap
|
||||
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
|
||||
golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
|
||||
golang.org/x/image v0.0.0-20220302094943-723b81ca9867/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
|
||||
golang.org/x/image v0.39.0 h1:skVYidAEVKgn8lZ602XO75asgXBgLj9G/FE3RbuPFww=
|
||||
golang.org/x/image v0.39.0/go.mod h1:sIbmppfU+xFLPIG0FoVUTvyBMmgng1/XAMhQ2ft0hpA=
|
||||
golang.org/x/image v0.38.0 h1:5l+q+Y9JDC7mBOMjo4/aPhMDcxEptsX+Tt3GgRQRPuE=
|
||||
golang.org/x/image v0.38.0/go.mod h1:/3f6vaXC+6CEanU4KJxbcUZyEePbyKbaLoDOe4ehFYY=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
@@ -2283,8 +2281,8 @@ golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM=
|
||||
golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU=
|
||||
golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI=
|
||||
golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@@ -2514,8 +2512,8 @@ golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
|
||||
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||
golang.org/x/telemetry v0.0.0-20260409153401-be6f6cb8b1fa h1:efT73AJZfAAUV7SOip6pWGkwJDzIGiKBZGVzHYa+ve4=
|
||||
golang.org/x/telemetry v0.0.0-20260409153401-be6f6cb8b1fa/go.mod h1:kHjTxDEnAu6/Nl9lDkzjWpR+bmKfxeiRuSDlsMb70gE=
|
||||
golang.org/x/telemetry v0.0.0-20260311193753-579e4da9a98c h1:6a8FdnNk6bTXBjR4AGKFgUKuo+7GnR3FX5L7CbveeZc=
|
||||
golang.org/x/telemetry v0.0.0-20260311193753-579e4da9a98c/go.mod h1:TpUTTEp9frx7rTdLpC9gFG9kdI7zVLFTFFlqaH2Cncw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
@@ -2632,8 +2630,8 @@ golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
|
||||
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
|
||||
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
||||
golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c=
|
||||
golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI=
|
||||
golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s=
|
||||
golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0=
|
||||
golang.org/x/tools/godoc v0.1.0-deprecated h1:o+aZ1BOj6Hsx/GBdJO/s815sqftjSnrZZwyYTHODvtk=
|
||||
golang.org/x/tools/godoc v0.1.0-deprecated/go.mod h1:qM63CriJ961IHWmnWa9CjZnBndniPt4a3CK0PVB9bIg=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@@ -2711,8 +2709,8 @@ google.golang.org/api v0.106.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/
|
||||
google.golang.org/api v0.107.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY=
|
||||
google.golang.org/api v0.108.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY=
|
||||
google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI=
|
||||
google.golang.org/api v0.278.0 h1:W7jiRvRi53VYFfZ/HoZjQBtJk7gOFbHD8ot1RzVZU6E=
|
||||
google.golang.org/api v0.278.0/go.mod h1:B9TqLBwJqVjp1mtt7WeoQwWRwvu/400y5lETOql+giQ=
|
||||
google.golang.org/api v0.274.0 h1:aYhycS5QQCwxHLwfEHRRLf9yNsfvp1JadKKWBE54RFA=
|
||||
google.golang.org/api v0.274.0/go.mod h1:JbAt7mF+XVmWu6xNP8/+CTiGH30ofmCmk9nM8d8fHew=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
@@ -2850,8 +2848,8 @@ google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 h1:XzmzkmB14QhVhgn
|
||||
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7/go.mod h1:L43LFes82YgSonw6iTXTxXUX1OlULt4AQtkik4ULL/I=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 h1:VPWxll4HlMw1Vs/qXtN7BvhZqsS9cdAittCNvVENElA=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9/go.mod h1:7QBABkRtR8z+TEnmXTqIqwJLlzrZKVfAUm7tY3yGv0M=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260427160629-7cedc36a6bc4 h1:tEkOQcXgF6dH1G+MVKZrfpYvozGrzb91k6ha7jireSM=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260427160629-7cedc36a6bc4/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 h1:m8qni9SQFH0tJc1X0vmnpw/0t+AImlSvp30sEupozUg=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
@@ -3054,8 +3052,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aN
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4=
|
||||
sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs=
|
||||
sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=
|
||||
storj.io/common v0.0.0-20260225132117-99155641c30a h1:7gSBQY3vhQMIqi3vfaEXR7mreRjcBLfVsYY0rHIN7P0=
|
||||
storj.io/common v0.0.0-20260225132117-99155641c30a/go.mod h1:kyxwKwlfH4paBZCZt/szvRB770ieAIJF73iDy2DpEHw=
|
||||
storj.io/common v0.0.0-20251107171817-6221ae45072c h1:UDXSrdeLJe3QFouavSW10fYdpclK0YNu3KvQHzqq2+k=
|
||||
storj.io/common v0.0.0-20251107171817-6221ae45072c/go.mod h1:XNX7uykja6aco92y2y8RuqaXIDRPpt1YA2OQDKlKEUk=
|
||||
storj.io/drpc v0.0.35-0.20250513201419-f7819ea69b55 h1:8OE12DvUnB9lfZcHe7IDGsuhjrY9GBAr964PVHmhsro=
|
||||
storj.io/drpc v0.0.35-0.20250513201419-f7819ea69b55/go.mod h1:Y9LZaa8esL1PW2IDMqJE7CFSNq7d5bQ3RI7mGPtmKMg=
|
||||
storj.io/eventkit v0.0.0-20250410172343-61f26d3de156 h1:5MZ0CyMbG6Pi0rRzUWVG6dvpXjbBYEX2oyXuj+tT+sk=
|
||||
@@ -3064,7 +3062,7 @@ storj.io/infectious v0.0.2 h1:rGIdDC/6gNYAStsxsZU79D/MqFjNyJc1tsyyj9sTl7Q=
|
||||
storj.io/infectious v0.0.2/go.mod h1:QEjKKww28Sjl1x8iDsjBpOM4r1Yp8RsowNcItsZJ1Vs=
|
||||
storj.io/picobuf v0.0.4 h1:qswHDla+YZ2TovGtMnU4astjvrADSIz84FXRn0qgP6o=
|
||||
storj.io/picobuf v0.0.4/go.mod h1:hSMxmZc58MS/2qSLy1I0idovlO7+6K47wIGUyRZa6mg=
|
||||
storj.io/uplink v1.14.0 h1:J1yXlt0aRr6kgLTHWXOWosNCFVfbamlcyd+CSxyIczo=
|
||||
storj.io/uplink v1.14.0/go.mod h1:2ysmjzd/1Xtz4VKoErNcSqBQz3UC9WKTVuLMV1cNu6E=
|
||||
storj.io/uplink v1.13.1 h1:C8RdW/upALoCyuF16Lod9XGCXEdbJAS+ABQy9JO/0pA=
|
||||
storj.io/uplink v1.13.1/go.mod h1:x0MQr4UfFsQBwgVWZAtEsLpuwAn6dg7G0Mpne1r516E=
|
||||
tags.cncf.io/container-device-interface v1.0.1 h1:KqQDr4vIlxwfYh0Ed/uJGVgX+CHAkahrgabg6Q8GYxc=
|
||||
tags.cncf.io/container-device-interface v1.0.1/go.mod h1:JojJIOeW3hNbcnOH2q0NrWNha/JuHoDZcmYxAZwb2i0=
|
||||
@@ -1,6 +1,6 @@
|
||||
apiVersion: v1
|
||||
description: SeaweedFS
|
||||
name: seaweedfs
|
||||
appVersion: "4.24"
|
||||
appVersion: "4.23"
|
||||
# Dev note: Trigger a helm chart release by `git tag -a helm-<version>`
|
||||
version: 4.24.0
|
||||
version: 4.23.0
|
||||
@@ -288,10 +288,6 @@ async fn run(
|
||||
config.jwt_read_signing_expires_seconds,
|
||||
);
|
||||
let master_url = config.masters.first().cloned().unwrap_or_default();
|
||||
// Defensive-copy the configured seed masters before freezing the lookup
|
||||
// set, so any later mutation of config.masters cannot desync them.
|
||||
let master_urls: Vec<String> = config.masters.clone();
|
||||
let seed_master_set = VolumeServerState::build_seed_master_set(&master_urls);
|
||||
let self_url = format!("{}:{}", config.ip, config.port);
|
||||
let (http_client, outgoing_http_scheme) = build_outgoing_http_client(&config)?;
|
||||
let outgoing_grpc_tls = load_outgoing_grpc_tls(&config)?;
|
||||
@@ -328,9 +324,7 @@ async fn run(
|
||||
),
|
||||
read_mode: config.read_mode,
|
||||
master_url,
|
||||
master_urls,
|
||||
seed_master_set,
|
||||
current_master_url: tokio::sync::RwLock::new(String::new()),
|
||||
master_urls: config.masters.clone(),
|
||||
self_url,
|
||||
http_client,
|
||||
outgoing_http_scheme,
|
||||
|
||||
@@ -3898,24 +3898,6 @@ impl VolumeServer for VolumeGrpcService {
|
||||
|
||||
let start = now_ns();
|
||||
|
||||
// Empty target is a self-liveness probe and stays unauthenticated.
|
||||
// Otherwise gate the dial on cluster membership: volume servers only
|
||||
// know masters, so any other target type is refused. Mirrors Go's
|
||||
// volume_grpc_admin.go Ping admission check. tonic forbids returning
|
||||
// a body alongside an error, so we surface the InvalidArgument status
|
||||
// alone — behaviour-identical to Go's status.Errorf return.
|
||||
if !req.target.is_empty()
|
||||
&& !self
|
||||
.state
|
||||
.is_known_ping_target(&req.target, &req.target_type)
|
||||
.await
|
||||
{
|
||||
return Err(Status::invalid_argument(format!(
|
||||
"unknown ping target {} of type {}",
|
||||
req.target, req.target_type
|
||||
)));
|
||||
}
|
||||
|
||||
// Route ping based on target type (matches Go's volume_grpc_admin.go Ping)
|
||||
let remote_time_ns = if req.target_type == "volumeServer" {
|
||||
match ping_volume_server_target(&req.target, self.state.outgoing_grpc_tls.as_ref())
|
||||
@@ -4578,8 +4560,6 @@ mod tests {
|
||||
read_mode: crate::config::ReadMode::Local,
|
||||
master_url: String::new(),
|
||||
master_urls: Vec::new(),
|
||||
seed_master_set: std::collections::HashSet::new(),
|
||||
current_master_url: tokio::sync::RwLock::new(String::new()),
|
||||
self_url: String::new(),
|
||||
http_client: reqwest::Client::new(),
|
||||
outgoing_http_scheme: "http".to_string(),
|
||||
@@ -4682,8 +4662,6 @@ mod tests {
|
||||
read_mode: crate::config::ReadMode::Local,
|
||||
master_url: String::new(),
|
||||
master_urls: Vec::new(),
|
||||
seed_master_set: std::collections::HashSet::new(),
|
||||
current_master_url: tokio::sync::RwLock::new(String::new()),
|
||||
self_url: String::new(),
|
||||
http_client: reqwest::Client::new(),
|
||||
outgoing_http_scheme: "http".to_string(),
|
||||
@@ -4732,206 +4710,6 @@ mod tests {
|
||||
.remove("s3.incr_copy_test");
|
||||
}
|
||||
|
||||
/// Build a bare-bones service with no on-disk store but a configurable
|
||||
/// seed master set, for Ping admission tests. Matches the structure of
|
||||
/// `make_local_service_with_volume` minus the volume bits.
|
||||
fn make_service_with_seed_masters(seeds: &[&str]) -> (VolumeGrpcService, TempDir) {
|
||||
let tmp = TempDir::new().unwrap();
|
||||
let dir = tmp.path().to_str().unwrap();
|
||||
|
||||
let mut store = Store::new(NeedleMapKind::InMemory);
|
||||
store
|
||||
.add_location(
|
||||
dir,
|
||||
dir,
|
||||
10,
|
||||
DiskType::HardDrive,
|
||||
MinFreeSpace::Percent(1.0),
|
||||
Vec::new(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let master_urls: Vec<String> = seeds.iter().map(|s| (*s).to_string()).collect();
|
||||
let seed_master_set =
|
||||
crate::server::volume_server::VolumeServerState::build_seed_master_set(&master_urls);
|
||||
|
||||
let state = Arc::new(VolumeServerState {
|
||||
store: RwLock::new(store),
|
||||
guard: RwLock::new(Guard::new(
|
||||
&[],
|
||||
SigningKey(vec![]),
|
||||
0,
|
||||
SigningKey(vec![]),
|
||||
0,
|
||||
)),
|
||||
is_stopping: RwLock::new(false),
|
||||
maintenance: std::sync::atomic::AtomicBool::new(false),
|
||||
state_version: std::sync::atomic::AtomicU32::new(0),
|
||||
concurrent_upload_limit: 0,
|
||||
concurrent_download_limit: 0,
|
||||
inflight_upload_data_timeout: std::time::Duration::from_secs(60),
|
||||
inflight_download_data_timeout: std::time::Duration::from_secs(60),
|
||||
inflight_upload_bytes: std::sync::atomic::AtomicI64::new(0),
|
||||
inflight_download_bytes: std::sync::atomic::AtomicI64::new(0),
|
||||
upload_notify: tokio::sync::Notify::new(),
|
||||
download_notify: tokio::sync::Notify::new(),
|
||||
data_center: String::new(),
|
||||
rack: String::new(),
|
||||
file_size_limit_bytes: 0,
|
||||
maintenance_byte_per_second: 0,
|
||||
is_heartbeating: std::sync::atomic::AtomicBool::new(true),
|
||||
has_master: false,
|
||||
pre_stop_seconds: 0,
|
||||
volume_state_notify: tokio::sync::Notify::new(),
|
||||
write_queue: std::sync::OnceLock::new(),
|
||||
s3_tier_registry: std::sync::RwLock::new(
|
||||
crate::remote_storage::s3_tier::S3TierRegistry::new(),
|
||||
),
|
||||
read_mode: crate::config::ReadMode::Local,
|
||||
master_url: master_urls.first().cloned().unwrap_or_default(),
|
||||
master_urls,
|
||||
seed_master_set,
|
||||
current_master_url: tokio::sync::RwLock::new(String::new()),
|
||||
self_url: String::new(),
|
||||
http_client: reqwest::Client::new(),
|
||||
outgoing_http_scheme: "http".to_string(),
|
||||
outgoing_grpc_tls: None,
|
||||
metrics_runtime: std::sync::RwLock::new(
|
||||
crate::server::volume_server::RuntimeMetricsConfig::default(),
|
||||
),
|
||||
metrics_notify: tokio::sync::Notify::new(),
|
||||
fix_jpg_orientation: false,
|
||||
has_slow_read: false,
|
||||
read_buffer_size_bytes: 1024 * 1024,
|
||||
security_file: String::new(),
|
||||
cli_white_list: vec![],
|
||||
state_file_path: String::new(),
|
||||
});
|
||||
|
||||
(VolumeGrpcService { state }, tmp)
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_ping_empty_target_is_self_probe() {
|
||||
// Empty target stays unauthenticated and returns Ok with timing fields
|
||||
// populated — it is the local liveness probe path.
|
||||
let (service, _tmp) = make_service_with_seed_masters(&[]);
|
||||
let response = service
|
||||
.ping(Request::new(volume_server_pb::PingRequest {
|
||||
target: String::new(),
|
||||
target_type: String::new(),
|
||||
}))
|
||||
.await
|
||||
.expect("empty target ping must succeed");
|
||||
let inner = response.into_inner();
|
||||
assert!(inner.start_time_ns > 0);
|
||||
assert!(inner.stop_time_ns >= inner.start_time_ns);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_ping_seed_master_target_passes_admission() {
|
||||
// A target that matches a configured seed master clears admission.
|
||||
// The dial itself may or may not succeed depending on what's listening
|
||||
// on the loopback; either way, the response must not be the
|
||||
// InvalidArgument the gate would surface.
|
||||
let (service, _tmp) = make_service_with_seed_masters(&["localhost:9333"]);
|
||||
let result = service
|
||||
.ping(Request::new(volume_server_pb::PingRequest {
|
||||
target: "localhost:9333".to_string(),
|
||||
target_type: "master".to_string(),
|
||||
}))
|
||||
.await;
|
||||
if let Err(err) = result {
|
||||
assert_ne!(err.code(), tonic::Code::InvalidArgument, "got {err:?}");
|
||||
assert!(
|
||||
!err.message().contains("unknown ping target"),
|
||||
"admission gate should have allowed this target: {}",
|
||||
err.message()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_ping_unknown_master_target_rejected() {
|
||||
// A master-type target not in the seed list and not the current
|
||||
// master is refused with InvalidArgument.
|
||||
let (service, _tmp) = make_service_with_seed_masters(&["localhost:9333"]);
|
||||
let err = service
|
||||
.ping(Request::new(volume_server_pb::PingRequest {
|
||||
target: "localhost:9999".to_string(),
|
||||
target_type: "master".to_string(),
|
||||
}))
|
||||
.await
|
||||
.expect_err("unknown master target must be rejected");
|
||||
assert_eq!(err.code(), tonic::Code::InvalidArgument);
|
||||
assert_eq!(
|
||||
err.message(),
|
||||
"unknown ping target localhost:9999 of type master"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_ping_volume_server_target_always_rejected() {
|
||||
// Volume servers do not maintain a peer-volume list, so volumeServer
|
||||
// pings are refused regardless of address.
|
||||
let (service, _tmp) = make_service_with_seed_masters(&["localhost:9333"]);
|
||||
let err = service
|
||||
.ping(Request::new(volume_server_pb::PingRequest {
|
||||
target: "localhost:8080".to_string(),
|
||||
target_type: "volumeServer".to_string(),
|
||||
}))
|
||||
.await
|
||||
.expect_err("volumeServer target must be rejected");
|
||||
assert_eq!(err.code(), tonic::Code::InvalidArgument);
|
||||
assert_eq!(
|
||||
err.message(),
|
||||
"unknown ping target localhost:8080 of type volumeServer"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_ping_current_master_target_passes_admission() {
|
||||
// A target that matches the current (post-leader-change) master also
|
||||
// clears admission, even if it is not in the seed list. Pick a port
|
||||
// that is extremely unlikely to be live so the test does not flake on
|
||||
// a developer machine that happens to be running a real master.
|
||||
let (service, _tmp) = make_service_with_seed_masters(&["localhost:9333"]);
|
||||
// Simulate the heartbeat goroutine having moved to a new leader.
|
||||
*service.state.current_master_url.write().await = "127.0.0.1:1".to_string();
|
||||
|
||||
let result = service
|
||||
.ping(Request::new(volume_server_pb::PingRequest {
|
||||
target: "127.0.0.1:1".to_string(),
|
||||
target_type: "master".to_string(),
|
||||
}))
|
||||
.await;
|
||||
if let Err(err) = result {
|
||||
assert_ne!(err.code(), tonic::Code::InvalidArgument, "got {err:?}");
|
||||
assert!(
|
||||
!err.message().contains("unknown ping target"),
|
||||
"leader-change master should be admitted: {}",
|
||||
err.message()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_ping_target_with_grpc_port_suffix_is_normalised() {
|
||||
// Seed masters in pb.ServerAddress form (`host:port.grpcPort`) must
|
||||
// match a Ping target sent in plain `host:port` form, since the gate
|
||||
// normalises both sides through to_http_address.
|
||||
let (service, _tmp) = make_service_with_seed_masters(&["localhost:9333.19333"]);
|
||||
let result = service
|
||||
.ping(Request::new(volume_server_pb::PingRequest {
|
||||
target: "localhost:9333".to_string(),
|
||||
target_type: "master".to_string(),
|
||||
}))
|
||||
.await;
|
||||
if let Err(err) = result {
|
||||
assert_ne!(err.code(), tonic::Code::InvalidArgument, "got {err:?}");
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_volume_ec_shards_generate_persists_expire_at_sec() {
|
||||
let ttl = crate::storage::needle::ttl::TTL::read("3m").unwrap();
|
||||
|
||||
@@ -397,15 +397,6 @@ async fn do_heartbeat(
|
||||
let mut response_stream = client.send_heartbeat(stream).await?.into_inner();
|
||||
|
||||
info!("Heartbeat stream established with {}", grpc_addr);
|
||||
// Publish the master we're now talking to in canonical http host:port
|
||||
// form so Ping admission can recognise it once a leader change moves us
|
||||
// off the seed list. Mirrors Go's vs.setCurrentMaster(masterAddress).
|
||||
{
|
||||
let normalised =
|
||||
super::volume_server::to_http_address(current_master).into_owned();
|
||||
let mut guard = state.current_master_url.write().await;
|
||||
*guard = normalised;
|
||||
}
|
||||
if is_stopping(state) {
|
||||
state.is_heartbeating.store(false, Ordering::Relaxed);
|
||||
send_deregister_heartbeat(config, state, &tx).await;
|
||||
@@ -1042,8 +1033,6 @@ mod tests {
|
||||
read_mode: ReadMode::Local,
|
||||
master_url: String::new(),
|
||||
master_urls: Vec::new(),
|
||||
seed_master_set: std::collections::HashSet::new(),
|
||||
current_master_url: tokio::sync::RwLock::new(String::new()),
|
||||
self_url: String::new(),
|
||||
http_client: reqwest::Client::new(),
|
||||
outgoing_http_scheme: "http".to_string(),
|
||||
|
||||
@@ -81,16 +81,6 @@ pub struct VolumeServerState {
|
||||
pub master_url: String,
|
||||
/// Seed master addresses for UI rendering.
|
||||
pub master_urls: Vec<String>,
|
||||
/// Canonical http `host:port` form of every configured seed master.
|
||||
/// Built once at construction so Ping admission stays O(1). Mirrors
|
||||
/// Go's `seedMasterSet` on `VolumeServer`.
|
||||
pub seed_master_set: std::collections::HashSet<String>,
|
||||
/// Current master this server is heartbeating with, in canonical http
|
||||
/// `host:port` form. Empty when no heartbeat connection is active. The
|
||||
/// heartbeat goroutine writes; admission reads — the lock keeps them
|
||||
/// from racing on a leader change. Mirrors Go's `currentMaster` plus
|
||||
/// `currentMasterLock`.
|
||||
pub current_master_url: tokio::sync::RwLock<String>,
|
||||
/// This server's own address (ip:port) for filtering self from lookup results.
|
||||
pub self_url: String,
|
||||
/// HTTP client for proxy requests and master lookups.
|
||||
@@ -127,35 +117,6 @@ impl VolumeServerState {
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Build the seed master set from a list of raw `host:port[.grpcPort]`
|
||||
/// addresses, normalised the same way Go's `pb.ServerAddress.ToHttpAddress`
|
||||
/// does (drop the `.grpcPort` suffix, preserve everything else).
|
||||
pub fn build_seed_master_set(master_urls: &[String]) -> std::collections::HashSet<String> {
|
||||
master_urls
|
||||
.iter()
|
||||
.map(|m| to_http_address(m).into_owned())
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Returns true iff `target` (normalised to canonical http `host:port`)
|
||||
/// is a master this server already knows about. Volume servers do not
|
||||
/// keep a peer-volume or peer-filer list, so Ping is scoped to masters.
|
||||
/// Mirrors Go's `VolumeServer.isKnownPingTarget`.
|
||||
pub async fn is_known_ping_target(&self, target: &str, target_type: &str) -> bool {
|
||||
if target_type != "master" {
|
||||
return false;
|
||||
}
|
||||
let key = to_http_address(target).into_owned();
|
||||
if key.is_empty() {
|
||||
return false;
|
||||
}
|
||||
let current = self.current_master_url.read().await.clone();
|
||||
if !current.is_empty() && current == key {
|
||||
return true;
|
||||
}
|
||||
self.seed_master_set.contains(&key)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn build_metrics_router() -> Router {
|
||||
|
||||
@@ -207,8 +207,6 @@ mod tests {
|
||||
read_mode: crate::config::ReadMode::Local,
|
||||
master_url: String::new(),
|
||||
master_urls: Vec::new(),
|
||||
seed_master_set: std::collections::HashSet::new(),
|
||||
current_master_url: tokio::sync::RwLock::new(String::new()),
|
||||
self_url: String::new(),
|
||||
http_client: reqwest::Client::new(),
|
||||
outgoing_http_scheme: "http".to_string(),
|
||||
|
||||
@@ -304,11 +304,7 @@ impl DiskLocation {
|
||||
}
|
||||
|
||||
/// Remove all EC-related files for a volume.
|
||||
/// `pub(crate)` so the Store-level cross-disk passes in
|
||||
/// `store_ec_reconcile.rs` can call it to scrub partial EC artefacts
|
||||
/// when a healthy `.dat` for the same vid lives on a sibling disk
|
||||
/// (seaweedfs/seaweedfs#9478).
|
||||
pub(crate) fn remove_ec_volume_files(&self, collection: &str, vid: VolumeId) {
|
||||
fn remove_ec_volume_files(&self, collection: &str, vid: VolumeId) {
|
||||
let base = volume_file_name(&self.directory, collection, vid);
|
||||
let idx_base = volume_file_name(&self.idx_directory, collection, vid);
|
||||
const MAX_SHARD_COUNT: usize = 32;
|
||||
|
||||
@@ -120,15 +120,10 @@ impl EcVolume {
|
||||
shards.push(None);
|
||||
}
|
||||
|
||||
// Read expire_at_sec, version, and dat_file_size from .vif if
|
||||
// present (matches Go's MaybeLoadVolumeInfo). Prefer the data
|
||||
// dir; fall back to the idx dir for the cross-disk reconcile
|
||||
// case (#9212 / #9244). `dat_file_size` is the source .dat
|
||||
// size at encode time, used both by `locate_ec_shard_needle`
|
||||
// for shard-size math and by the Store-level prune in
|
||||
// `store_ec_reconcile.rs` to verify a sibling-disk .dat is
|
||||
// plausibly the encoding source (#9478).
|
||||
let (expire_at_sec, vif_version, vif_dat_file_size) = {
|
||||
// Read expire_at_sec and version from .vif if present (matches Go's MaybeLoadVolumeInfo).
|
||||
// Prefer the data dir; fall back to the idx dir for the
|
||||
// cross-disk reconcile case (#9212 / #9244).
|
||||
let (expire_at_sec, vif_version) = {
|
||||
let vif_path = locate_vif_path(dir, dir_idx, collection, volume_id);
|
||||
if let Ok(vif_content) = std::fs::read_to_string(&vif_path) {
|
||||
if let Ok(vif_info) =
|
||||
@@ -139,12 +134,12 @@ impl EcVolume {
|
||||
} else {
|
||||
Version::current()
|
||||
};
|
||||
(vif_info.expire_at_sec, ver, vif_info.dat_file_size)
|
||||
(vif_info.expire_at_sec, ver)
|
||||
} else {
|
||||
(0, Version::current(), 0)
|
||||
(0, Version::current())
|
||||
}
|
||||
} else {
|
||||
(0, Version::current(), 0)
|
||||
(0, Version::current())
|
||||
}
|
||||
};
|
||||
|
||||
@@ -155,7 +150,7 @@ impl EcVolume {
|
||||
dir_idx: dir_idx.to_string(),
|
||||
version: vif_version,
|
||||
shards,
|
||||
dat_file_size: vif_dat_file_size,
|
||||
dat_file_size: 0,
|
||||
data_shards,
|
||||
parity_shards,
|
||||
ecx_file: None,
|
||||
|
||||
@@ -85,17 +85,6 @@ impl Store {
|
||||
|
||||
self.locations.push(loc);
|
||||
|
||||
// First scrub partial EC artefacts left on one disk by an
|
||||
// interrupted encode while the source .dat still lives on a
|
||||
// sibling disk of the same store. The per-disk loader cannot
|
||||
// see the sibling .dat and so loads the partial shards as if
|
||||
// they were a distributed-EC layout, which makes the volume
|
||||
// server heartbeat both a regular replica and an EC shard set
|
||||
// for the same vid (seaweedfs/seaweedfs#9478). Running before
|
||||
// the cross-disk reconcile keeps that pass from later
|
||||
// re-loading shards we just cleaned up.
|
||||
self.prune_incomplete_ec_with_sibling_dat();
|
||||
|
||||
// After every disk has finished its per-disk EC scan, sweep
|
||||
// the store for shards that live on a disk without local index
|
||||
// files and load them by reaching across to a sibling disk's
|
||||
@@ -117,7 +106,6 @@ impl Store {
|
||||
tracing::error!("load_new_volumes error in {}: {}", loc.directory, e);
|
||||
}
|
||||
}
|
||||
self.prune_incomplete_ec_with_sibling_dat();
|
||||
self.reconcile_ec_shards_across_disks();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,22 +21,9 @@ use std::fs;
|
||||
use tracing::{info, warn};
|
||||
|
||||
use crate::storage::disk_location::{is_ec_shard_extension, parse_collection_volume_id_pub};
|
||||
use crate::storage::erasure_coding::ec_shard::DATA_SHARDS_COUNT;
|
||||
use crate::storage::store::Store;
|
||||
use crate::storage::super_block::SUPER_BLOCK_SIZE;
|
||||
use crate::storage::types::VolumeId;
|
||||
|
||||
/// Sibling-disk `.dat` candidate for `prune_incomplete_ec_with_sibling_dat`.
|
||||
/// We record both the disk index and the file's size: the size is
|
||||
/// consulted before deleting any EC artefacts. A zero-byte or truncated
|
||||
/// `.dat` is not a credible fallback, and we'd rather leave the partial
|
||||
/// EC in place than wipe it based on garbage.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
struct DatOwnerInfo {
|
||||
location: usize,
|
||||
size: u64,
|
||||
}
|
||||
|
||||
/// Key for orphan-shard reconciliation: collection + volume id. Two
|
||||
/// collections can re-use the same volume id, and we must only pair
|
||||
/// shards with their own `.ecx`.
|
||||
@@ -149,187 +136,6 @@ impl Store {
|
||||
}
|
||||
}
|
||||
|
||||
/// Remove leftover EC artefacts on one disk when a healthy `.dat`
|
||||
/// for the same `(collection, vid)` lives on a sibling disk of the
|
||||
/// same store. Mirrors `Store.pruneIncompleteEcWithSiblingDat` in
|
||||
/// `weed/storage/store_ec_reconcile.go` (seaweedfs/seaweedfs#9478).
|
||||
///
|
||||
/// `DiskLocation::handle_found_ecx_file` only looks for `.dat` in
|
||||
/// the same disk as the EC shards. In a multi-disk volume server an
|
||||
/// interrupted EC encode can leave `.ec??` + `.ecx` on disk B while
|
||||
/// the source `.dat` still lives on disk A. The per-disk loader
|
||||
/// sees no local `.dat`, classifies the layout as distributed EC,
|
||||
/// and mounts the partial shards. The volume server then heartbeats
|
||||
/// both a regular replica and an EC shard for the same vid, and
|
||||
/// master ends up with a contradictory view.
|
||||
///
|
||||
/// Cleanup is gated on `shard_count < DATA_SHARDS_COUNT` so that a
|
||||
/// deliberate "full local EC, `.dat` retained" layout split across
|
||||
/// two disks (`.dat` on disk A, all 10+ shards on disk B) is left
|
||||
/// alone — the per-disk loader already keeps that configuration on
|
||||
/// a single disk, and pruning it here would be a behaviour
|
||||
/// regression. Distributed EC volumes (no `.dat` on any disk of
|
||||
/// this server) also fall through unchanged because the `.dat`
|
||||
/// index never matches.
|
||||
///
|
||||
/// Before deleting any EC files we also check that the sibling
|
||||
/// `.dat` is plausibly the encoding source: at least
|
||||
/// `SUPER_BLOCK_SIZE` bytes long, and — when the EC's `.vif`
|
||||
/// recorded a non-zero source size in `dat_file_size` — at least
|
||||
/// that many bytes. A zero-byte shell or a truncated `.dat` does
|
||||
/// not justify wiping the partial EC, because that EC shard may
|
||||
/// still combine usefully with shards on other servers in a
|
||||
/// recoverable distributed-EC layout.
|
||||
///
|
||||
/// We don't have to push anything to a deleted-shards channel
|
||||
/// here: the Rust heartbeat path in `server/heartbeat.rs` diffs
|
||||
/// the current `ec_volumes` snapshot against the previous one each
|
||||
/// tick, so the first heartbeat after the prune naturally emits a
|
||||
/// delete delta for whatever the per-disk pass had already
|
||||
/// reported.
|
||||
pub fn prune_incomplete_ec_with_sibling_dat(&mut self) {
|
||||
if self.locations.len() < 2 {
|
||||
return;
|
||||
}
|
||||
|
||||
let dat_owners = self.index_dat_owners();
|
||||
if dat_owners.is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Snapshot under an immutable borrow so we can release it
|
||||
// before taking the mutable borrow needed for cleanup.
|
||||
struct Victim {
|
||||
loc_idx: usize,
|
||||
collection: String,
|
||||
vid: VolumeId,
|
||||
dat_dir: String,
|
||||
shard_count: usize,
|
||||
}
|
||||
let mut victims: Vec<Victim> = Vec::new();
|
||||
for (loc_idx, loc) in self.locations.iter().enumerate() {
|
||||
for (vid, ev) in loc.ec_volumes() {
|
||||
let shard_count = ev.shard_count();
|
||||
if shard_count >= DATA_SHARDS_COUNT {
|
||||
continue;
|
||||
}
|
||||
let key = EcKey {
|
||||
collection: ev.collection.clone(),
|
||||
vid: *vid,
|
||||
};
|
||||
let Some(owner) = dat_owners.get(&key) else {
|
||||
continue;
|
||||
};
|
||||
if owner.location == loc_idx {
|
||||
// Same-disk .dat is the job of
|
||||
// DiskLocation::validate_ec_volume during the
|
||||
// per-disk pass; don't second-guess it here.
|
||||
continue;
|
||||
}
|
||||
// Decide whether the sibling .dat is credible. Prefer
|
||||
// the size baked into .vif at encode time; fall back
|
||||
// to "at least a superblock" for old EC volumes whose
|
||||
// .vif predates the field.
|
||||
let required = if ev.dat_file_size > 0 {
|
||||
ev.dat_file_size as u64
|
||||
} else {
|
||||
SUPER_BLOCK_SIZE as u64
|
||||
};
|
||||
if owner.size < required {
|
||||
warn!(
|
||||
volume_id = vid.0,
|
||||
collection = %ev.collection,
|
||||
directory = %loc.directory,
|
||||
shard_count,
|
||||
sibling_dir = %self.locations[owner.location].directory,
|
||||
sibling_dat_size = owner.size,
|
||||
required,
|
||||
"sibling .dat is smaller than the EC source size; leaving partial EC in place so distributed reconstruction is still possible (issue 9478)",
|
||||
);
|
||||
continue;
|
||||
}
|
||||
victims.push(Victim {
|
||||
loc_idx,
|
||||
collection: ev.collection.clone(),
|
||||
vid: *vid,
|
||||
dat_dir: self.locations[owner.location].directory.clone(),
|
||||
shard_count,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for v in victims {
|
||||
warn!(
|
||||
volume_id = v.vid.0,
|
||||
collection = %v.collection,
|
||||
directory = %self.locations[v.loc_idx].directory,
|
||||
shard_count = v.shard_count,
|
||||
required = DATA_SHARDS_COUNT,
|
||||
dat_dir = %v.dat_dir,
|
||||
"partial EC shards on this disk while a healthy .dat exists on a sibling disk; cleaning up leftover EC files (issue 9478)",
|
||||
);
|
||||
let loc = &mut self.locations[v.loc_idx];
|
||||
if let Some(mut ec_vol) = loc.remove_ec_volume(v.vid) {
|
||||
for _ in 0..ec_vol.shard_count() {
|
||||
crate::metrics::VOLUME_GAUGE
|
||||
.with_label_values(&[&ec_vol.collection, "ec_shards"])
|
||||
.dec();
|
||||
}
|
||||
// destroy() closes shard file handles before unlinking
|
||||
// (matters on Windows) and removes .ecx / .ecj / .vif.
|
||||
ec_vol.destroy();
|
||||
}
|
||||
// Also sweep any unmounted shard files (.ec00 .. .ec31)
|
||||
// that the per-disk loader skipped — destroy() only walks
|
||||
// the in-memory shards, but the disk may still hold others.
|
||||
loc.remove_ec_volume_files(&v.collection, v.vid);
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns, for every `(collection, vid)`, the index of the first
|
||||
/// disk on this store that holds a `.dat` for it plus the file's
|
||||
/// size. Used by `prune_incomplete_ec_with_sibling_dat` so it can
|
||||
/// decide whether partial EC artefacts on another disk are
|
||||
/// leftovers of an interrupted encode AND whether the sibling
|
||||
/// `.dat` is large enough to be a credible fallback.
|
||||
///
|
||||
/// Any `.dat` `read_dir` can see is recorded — including zero-byte
|
||||
/// shells. Their mere presence means this volume was a regular
|
||||
/// volume on this server at some point, which rules out the
|
||||
/// "distributed EC, no .dat anywhere" reading. Whether the file is
|
||||
/// actually usable is the caller's call, made by comparing this
|
||||
/// size to the EC's recorded source size in `.vif`.
|
||||
fn index_dat_owners(&self) -> HashMap<EcKey, DatOwnerInfo> {
|
||||
let mut owners: HashMap<EcKey, DatOwnerInfo> = HashMap::new();
|
||||
for (loc_idx, loc) in self.locations.iter().enumerate() {
|
||||
let Ok(read) = fs::read_dir(&loc.directory) else {
|
||||
continue;
|
||||
};
|
||||
for ent in read.flatten() {
|
||||
if ent.file_type().map(|ft| ft.is_dir()).unwrap_or(false) {
|
||||
continue;
|
||||
}
|
||||
let name = ent.file_name().to_string_lossy().into_owned();
|
||||
let Some(base) = name.strip_suffix(".dat") else {
|
||||
continue;
|
||||
};
|
||||
let Some((collection, vid)) = parse_collection_volume_id_pub(base) else {
|
||||
continue;
|
||||
};
|
||||
let Ok(meta) = ent.metadata() else {
|
||||
continue;
|
||||
};
|
||||
owners
|
||||
.entry(EcKey { collection, vid })
|
||||
.or_insert(DatOwnerInfo {
|
||||
location: loc_idx,
|
||||
size: meta.len(),
|
||||
});
|
||||
}
|
||||
}
|
||||
owners
|
||||
}
|
||||
|
||||
/// Build a `(collection, vid) -> EcxOwnerInfo` map of which disk
|
||||
/// owns the `.ecx` file. `.ecx` normally lives in `IdxDirectory`
|
||||
/// but may have been written into the data directory before
|
||||
@@ -919,249 +725,6 @@ mod tests {
|
||||
assert!(ev.has_shard(0));
|
||||
assert!(ev.has_shard(1));
|
||||
}
|
||||
|
||||
/// Reproduces the issue 9478 layout for a single volume server:
|
||||
/// disk A holds a healthy `.dat` for vid 122; disk B holds a single
|
||||
/// `.ec01` plus `.ecx` / `.ecj` / `.vif` and no `.dat`. The per-disk
|
||||
/// loader mounts the partial shard on disk B as if it were a
|
||||
/// distributed-EC layout. The Store-level prune must unmount and
|
||||
/// delete the leftover EC files on disk B while leaving disk A's
|
||||
/// `.dat` untouched.
|
||||
#[test]
|
||||
fn test_prune_drops_partial_ec_when_sibling_disk_has_dat() {
|
||||
let tmp = TempDir::new().unwrap();
|
||||
let dat_dir = tmp.path().join("sdd");
|
||||
let ec_dir = tmp.path().join("sdf");
|
||||
std::fs::create_dir_all(&dat_dir).unwrap();
|
||||
std::fs::create_dir_all(&ec_dir).unwrap();
|
||||
|
||||
let collection = "";
|
||||
let vid = 122u32;
|
||||
|
||||
// Disk A (sdd): a non-trivial .dat plus the regular-volume
|
||||
// sidecars. The .dat content doesn't matter for the prune —
|
||||
// load_existing_volumes refuses to mount it because the
|
||||
// superblock is absent — but its file name has to be present
|
||||
// so index_dat_owners records this disk as the .dat owner.
|
||||
let dat_path = dat_dir.join(format!("{}_{}.dat", collection, vid).trim_start_matches('_'));
|
||||
std::fs::write(&dat_path, vec![0u8; 1024]).unwrap();
|
||||
|
||||
// Disk B (sdf): partial EC — one shard, plus .ecx / .ecj / .vif.
|
||||
write_shard(ec_dir.to_str().unwrap(), collection, vid, 1);
|
||||
write_index_files(ec_dir.to_str().unwrap(), collection, vid, 10, 4);
|
||||
|
||||
let mut store = Store::new(NeedleMapKind::InMemory);
|
||||
store
|
||||
.add_location(
|
||||
dat_dir.to_str().unwrap(),
|
||||
dat_dir.to_str().unwrap(),
|
||||
100,
|
||||
DiskType::HardDrive,
|
||||
MinFreeSpace::Percent(0.0),
|
||||
Vec::new(),
|
||||
)
|
||||
.unwrap();
|
||||
store
|
||||
.add_location(
|
||||
ec_dir.to_str().unwrap(),
|
||||
ec_dir.to_str().unwrap(),
|
||||
100,
|
||||
DiskType::HardDrive,
|
||||
MinFreeSpace::Percent(0.0),
|
||||
Vec::new(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// After add_location for sdf, the per-disk loader has mounted
|
||||
// the partial shard AND the prune has run as part of
|
||||
// add_location's epilogue. Confirm the prune removed it.
|
||||
let ec_loc = &store.locations[1];
|
||||
assert!(
|
||||
ec_loc.find_ec_volume(VolumeId(vid)).is_none(),
|
||||
"partial EC volume should have been unmounted by the prune",
|
||||
);
|
||||
|
||||
let ec_base = ec_dir
|
||||
.join(format!("{}_{}", collection, vid).trim_start_matches('_'))
|
||||
.to_string_lossy()
|
||||
.into_owned();
|
||||
assert!(
|
||||
!std::path::Path::new(&format!("{}.ec01", ec_base)).exists(),
|
||||
"partial shard file should have been removed",
|
||||
);
|
||||
assert!(
|
||||
!std::path::Path::new(&format!("{}.ecx", ec_base)).exists(),
|
||||
".ecx should have been removed",
|
||||
);
|
||||
assert!(
|
||||
!std::path::Path::new(&format!("{}.ecj", ec_base)).exists(),
|
||||
".ecj should have been removed",
|
||||
);
|
||||
|
||||
// The .dat on the sibling disk must survive — pruning the
|
||||
// partial EC must never touch the healthy replica.
|
||||
assert!(
|
||||
dat_path.exists(),
|
||||
"healthy .dat on sibling disk should be left alone",
|
||||
);
|
||||
}
|
||||
|
||||
/// Safety guard for `prune_incomplete_ec_with_sibling_dat`: when
|
||||
/// the sibling `.dat` is smaller than the source size recorded in
|
||||
/// the EC's `.vif`, the `.dat` is clearly truncated and is not a
|
||||
/// credible fallback. The partial shard may still combine with
|
||||
/// shards on other servers in a recoverable distributed-EC layout,
|
||||
/// so we leave the EC files in place.
|
||||
#[test]
|
||||
fn test_prune_keeps_partial_ec_when_sibling_dat_is_smaller_than_vif_source_size() {
|
||||
let tmp = TempDir::new().unwrap();
|
||||
let dat_dir = tmp.path().join("sdd");
|
||||
let ec_dir = tmp.path().join("sdf");
|
||||
std::fs::create_dir_all(&dat_dir).unwrap();
|
||||
std::fs::create_dir_all(&ec_dir).unwrap();
|
||||
|
||||
let collection = "logs";
|
||||
let vid = 122u32;
|
||||
|
||||
// Tiny but loadable .dat on sdd: a valid 8-byte version-3
|
||||
// superblock so Volume::new succeeds, padded out to a few
|
||||
// hundred bytes so we have something well below the .vif-
|
||||
// recorded source size below. Anything smaller would let
|
||||
// Volume::new's auto-write extend the file to SUPER_BLOCK_SIZE
|
||||
// and obscure the truncation we're trying to model.
|
||||
let dat_path = dat_dir.join(format!("{}_{}.dat", collection, vid));
|
||||
let mut dat_bytes = crate::storage::super_block::SuperBlock::default().to_bytes();
|
||||
dat_bytes.resize(256, 0u8);
|
||||
std::fs::write(&dat_path, &dat_bytes).unwrap();
|
||||
let sibling_dat_size = dat_bytes.len() as u64;
|
||||
let source_size = 10 * 1024 * 1024u64; // 10 MiB recorded in .vif
|
||||
assert!(sibling_dat_size < source_size);
|
||||
|
||||
// Partial EC: one shard plus .ecx / .ecj / .vif. The .vif
|
||||
// records the source .dat size at encode time; the safety
|
||||
// check compares the sibling .dat against this value.
|
||||
write_shard(ec_dir.to_str().unwrap(), collection, vid, 1);
|
||||
let vif = VifVolumeInfo {
|
||||
version: 3,
|
||||
dat_file_size: source_size as i64,
|
||||
ec_shard_config: Some(VifEcShardConfig {
|
||||
data_shards: 10,
|
||||
parity_shards: 4,
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
std::fs::write(
|
||||
ec_dir.join(format!("{}_{}.vif", collection, vid)),
|
||||
serde_json::to_string(&vif).unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
std::fs::write(
|
||||
ec_dir.join(format!("{}_{}.ecx", collection, vid)),
|
||||
vec![0u8; 20],
|
||||
)
|
||||
.unwrap();
|
||||
std::fs::write(
|
||||
ec_dir.join(format!("{}_{}.ecj", collection, vid)),
|
||||
b"",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let mut store = Store::new(NeedleMapKind::InMemory);
|
||||
store
|
||||
.add_location(
|
||||
dat_dir.to_str().unwrap(),
|
||||
dat_dir.to_str().unwrap(),
|
||||
100,
|
||||
DiskType::HardDrive,
|
||||
MinFreeSpace::Percent(0.0),
|
||||
Vec::new(),
|
||||
)
|
||||
.unwrap();
|
||||
store
|
||||
.add_location(
|
||||
ec_dir.to_str().unwrap(),
|
||||
ec_dir.to_str().unwrap(),
|
||||
100,
|
||||
DiskType::HardDrive,
|
||||
MinFreeSpace::Percent(0.0),
|
||||
Vec::new(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// Prune ran as part of add_location's epilogue. Confirm the
|
||||
// partial EC was left alone because the sibling .dat is too
|
||||
// small to be the encoding source.
|
||||
let ec_loc = &store.locations[1];
|
||||
let ev = ec_loc
|
||||
.find_ec_volume(VolumeId(vid))
|
||||
.expect("partial EC volume must remain mounted when the sibling .dat is smaller than the .vif source size");
|
||||
assert_eq!(ev.shard_count(), 1);
|
||||
|
||||
let ec_base = ec_dir
|
||||
.join(format!("{}_{}", collection, vid))
|
||||
.to_string_lossy()
|
||||
.into_owned();
|
||||
assert!(
|
||||
std::path::Path::new(&format!("{}.ec01", ec_base)).exists(),
|
||||
"partial shard file must survive when the sibling .dat is truncated",
|
||||
);
|
||||
assert!(
|
||||
std::path::Path::new(&format!("{}.ecx", ec_base)).exists(),
|
||||
".ecx must survive when the sibling .dat is truncated",
|
||||
);
|
||||
}
|
||||
|
||||
/// A distributed EC volume — no `.dat` on any disk of this store —
|
||||
/// must not be touched by the prune even when shard count is below
|
||||
/// `DATA_SHARDS_COUNT`. Partial shard layouts are normal for
|
||||
/// distributed EC.
|
||||
#[test]
|
||||
fn test_prune_leaves_distributed_ec_alone() {
|
||||
let tmp = TempDir::new().unwrap();
|
||||
let dir0 = tmp.path().join("data0");
|
||||
let dir1 = tmp.path().join("data1");
|
||||
std::fs::create_dir_all(&dir0).unwrap();
|
||||
std::fs::create_dir_all(&dir1).unwrap();
|
||||
|
||||
let collection = "logs";
|
||||
let vid = 7u32;
|
||||
|
||||
// Two shards on dir0 with .ecx, no .dat anywhere.
|
||||
write_shard(dir0.to_str().unwrap(), collection, vid, 1);
|
||||
write_shard(dir0.to_str().unwrap(), collection, vid, 2);
|
||||
write_index_files(dir0.to_str().unwrap(), collection, vid, 10, 4);
|
||||
|
||||
let mut store = Store::new(NeedleMapKind::InMemory);
|
||||
for dir in [&dir0, &dir1] {
|
||||
store
|
||||
.add_location(
|
||||
dir.to_str().unwrap(),
|
||||
dir.to_str().unwrap(),
|
||||
100,
|
||||
DiskType::HardDrive,
|
||||
MinFreeSpace::Percent(0.0),
|
||||
Vec::new(),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
let ev = store.locations[0]
|
||||
.find_ec_volume(VolumeId(vid))
|
||||
.expect("distributed EC volume should still be mounted on dir0");
|
||||
assert_eq!(
|
||||
ev.shard_count(),
|
||||
2,
|
||||
"no .dat anywhere on this store means the partial shards must be kept as distributed EC",
|
||||
);
|
||||
|
||||
let ec_base = dir0
|
||||
.join(format!("{}_{}", collection, vid))
|
||||
.to_string_lossy()
|
||||
.into_owned();
|
||||
assert!(std::path::Path::new(&format!("{}.ec01", ec_base)).exists());
|
||||
assert!(std::path::Path::new(&format!("{}.ec02", ec_base)).exists());
|
||||
assert!(std::path::Path::new(&format!("{}.ecx", ec_base)).exists());
|
||||
}
|
||||
}
|
||||
|
||||
/// Walk a disk's data directory and return the `.ec??` shard files
|
||||
|
||||
@@ -3203,17 +3203,11 @@ fn get_append_at_ns(last: u64) -> u64 {
|
||||
}
|
||||
|
||||
/// Remove all files associated with a volume.
|
||||
/// .dat/.idx removals log at info level so destructive calls are traceable.
|
||||
pub(crate) fn remove_volume_files(base: &str) {
|
||||
for ext in &[
|
||||
".dat", ".idx", ".vif", ".sdx", ".cpd", ".cpx", ".note", ".rdb",
|
||||
] {
|
||||
let path = format!("{}{}", base, ext);
|
||||
let size = fs::metadata(&path).map(|m| m.len()).unwrap_or(0);
|
||||
let existed = fs::remove_file(&path).is_ok();
|
||||
if existed && (*ext == ".dat" || *ext == ".idx") {
|
||||
tracing::info!("removed volume file {} (size={})", path, size);
|
||||
}
|
||||
let _ = fs::remove_file(format!("{}{}", base, ext));
|
||||
}
|
||||
// leveldb uses a directory
|
||||
let _ = fs::remove_dir_all(format!("{}.ldb", base));
|
||||
|
||||
@@ -101,8 +101,6 @@ fn test_state_with_guard(
|
||||
read_mode: seaweed_volume::config::ReadMode::Local,
|
||||
master_url: String::new(),
|
||||
master_urls: Vec::new(),
|
||||
seed_master_set: std::collections::HashSet::new(),
|
||||
current_master_url: tokio::sync::RwLock::new(String::new()),
|
||||
self_url: String::new(),
|
||||
http_client: reqwest::Client::new(),
|
||||
outgoing_http_scheme: "http".to_string(),
|
||||
|
||||
+46
-45
@@ -8,37 +8,36 @@ require (
|
||||
github.com/seaweedfs/seaweedfs v0.0.0-00010101000000-000000000000
|
||||
github.com/segmentio/kafka-go v0.4.49
|
||||
github.com/stretchr/testify v1.11.1
|
||||
google.golang.org/grpc v1.80.0
|
||||
google.golang.org/grpc v1.79.3
|
||||
)
|
||||
|
||||
replace github.com/seaweedfs/seaweedfs => ../../
|
||||
|
||||
require (
|
||||
cloud.google.com/go/auth v0.20.0 // indirect
|
||||
cloud.google.com/go/auth v0.18.2 // indirect
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.9.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.4 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azfile v1.5.4 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azfile v1.5.3 // indirect
|
||||
github.com/Azure/go-ntlmssp v0.1.1 // indirect
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 // indirect
|
||||
github.com/FilenCloudDienste/filen-sdk-go v0.0.39 // indirect
|
||||
github.com/Files-com/files-sdk-go/v3 v3.3.82 // indirect
|
||||
github.com/IBM/go-sdk-core/v5 v5.21.2 // indirect
|
||||
github.com/FilenCloudDienste/filen-sdk-go v0.0.38 // indirect
|
||||
github.com/Files-com/files-sdk-go/v3 v3.2.264 // indirect
|
||||
github.com/IBM/go-sdk-core/v5 v5.21.0 // indirect
|
||||
github.com/Max-Sum/base32768 v0.0.0-20230304063302-18e6ce5945fd // indirect
|
||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||
github.com/ProtonMail/bcrypt v0.0.0-20211005172633-e235017c1baf // indirect
|
||||
github.com/ProtonMail/gluon v0.17.1-0.20230724134000-308be39be96e // indirect
|
||||
github.com/ProtonMail/go-crypto v1.4.1 // indirect
|
||||
github.com/ProtonMail/go-crypto v1.3.0 // indirect
|
||||
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f // indirect
|
||||
github.com/ProtonMail/go-srp v0.0.7 // indirect
|
||||
github.com/ProtonMail/gopenpgp/v2 v2.9.0 // indirect
|
||||
github.com/PuerkitoBio/goquery v1.11.0 // indirect
|
||||
github.com/PuerkitoBio/goquery v1.10.3 // indirect
|
||||
github.com/a1ex3/zstd-seekable-format-go/pkg v0.10.0 // indirect
|
||||
github.com/abbot/go-http-auth v0.4.0 // indirect
|
||||
github.com/adrg/xdg v0.5.3 // indirect
|
||||
github.com/anchore/go-lzo v0.1.0 // indirect
|
||||
github.com/andybalholm/brotli v1.2.0 // indirect
|
||||
github.com/andybalholm/cascadia v1.3.3 // indirect
|
||||
@@ -49,7 +48,7 @@ require (
|
||||
github.com/aws/aws-sdk-go-v2/config v1.32.14 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.19.14 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.13 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 // indirect
|
||||
@@ -63,7 +62,7 @@ require (
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.30.15 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 // indirect
|
||||
github.com/aws/smithy-go v1.25.1 // indirect
|
||||
github.com/aws/smithy-go v1.25.0 // indirect
|
||||
github.com/bahlo/generic-list-go v0.2.0 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/boombuler/barcode v1.1.0 // indirect
|
||||
@@ -75,9 +74,10 @@ require (
|
||||
github.com/calebcase/tmpfile v1.0.3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/chilts/sid v0.0.0-20190607042430-660e94789ec9 // indirect
|
||||
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
|
||||
github.com/clipperhouse/stringish v0.1.1 // indirect
|
||||
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
|
||||
github.com/cloudflare/circl v1.6.3 // indirect
|
||||
github.com/cloudinary/cloudinary-go/v2 v2.15.0 // indirect
|
||||
github.com/cloudinary/cloudinary-go/v2 v2.13.0 // indirect
|
||||
github.com/cloudsoda/go-smb2 v0.0.0-20250228001242-d4c70e6251cc // indirect
|
||||
github.com/cloudsoda/sddl v0.0.0-20250224235906-926454e91efc // indirect
|
||||
github.com/cognusion/imaging v1.0.2 // indirect
|
||||
@@ -85,7 +85,7 @@ require (
|
||||
github.com/coreos/go-semver v0.3.1 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.6.0 // indirect
|
||||
github.com/creasty/defaults v1.8.0 // indirect
|
||||
github.com/cronokirby/saferith v0.33.1-0.20250226174546-1f11f94ce488 // indirect
|
||||
github.com/cronokirby/saferith v0.33.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/diskfs/go-diskfs v1.7.0 // indirect
|
||||
github.com/dromara/dongle v1.0.1 // indirect
|
||||
@@ -100,22 +100,22 @@ require (
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/flynn/noise v1.1.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.13 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.11 // indirect
|
||||
github.com/geoffgarside/ber v1.2.0 // indirect
|
||||
github.com/go-chi/chi/v5 v5.2.5 // indirect
|
||||
github.com/go-darwin/apfs v0.0.0-20211011131704-f84b94dbf348 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.9.0 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.8.0 // indirect
|
||||
github.com/go-jose/go-jose/v4 v4.1.4 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||
github.com/go-openapi/errors v0.22.6 // indirect
|
||||
github.com/go-openapi/errors v0.22.4 // indirect
|
||||
github.com/go-openapi/strfmt v0.25.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.30.1 // indirect
|
||||
github.com/go-resty/resty/v2 v2.17.2 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
|
||||
github.com/go-playground/validator/v10 v10.28.0 // indirect
|
||||
github.com/go-resty/resty/v2 v2.16.5 // indirect
|
||||
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
|
||||
github.com/gofrs/flock v0.13.0 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
|
||||
@@ -125,8 +125,8 @@ require (
|
||||
github.com/google/btree v1.1.3 // indirect
|
||||
github.com/google/s2a-go v0.1.9 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.15 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.22.0 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.14 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.19.0 // indirect
|
||||
github.com/gorilla/mux v1.8.1 // indirect
|
||||
github.com/gorilla/schema v1.4.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
@@ -134,7 +134,7 @@ require (
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
|
||||
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
||||
github.com/internxt/rclone-adapter v0.0.0-20260331173834-036f908d0160 // indirect
|
||||
github.com/internxt/rclone-adapter v0.0.0-20260220172730-613f4cc8b8fd // indirect
|
||||
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
|
||||
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
|
||||
github.com/jcmturner/gofork v1.7.6 // indirect
|
||||
@@ -143,14 +143,14 @@ require (
|
||||
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
|
||||
github.com/jhump/protoreflect v1.18.0 // indirect
|
||||
github.com/jhump/protoreflect/v2 v2.0.0-beta.1 // indirect
|
||||
github.com/jlaffaye/ftp v0.2.1-0.20251026020404-6602e981a1bb // indirect
|
||||
github.com/jlaffaye/ftp v0.2.1-0.20240918233326-1b970516f5d3 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/jtolio/noiseconn v0.0.0-20231127013910-f6d9ecbf1de7 // indirect
|
||||
github.com/jzelinskie/whirlpool v0.0.0-20201016144138-0675e54bb004 // indirect
|
||||
github.com/karlseguin/ccache/v2 v2.0.8 // indirect
|
||||
github.com/klauspost/compress v1.18.6 // indirect
|
||||
github.com/klauspost/compress v1.18.5 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
||||
github.com/klauspost/reedsolomon v1.14.0 // indirect
|
||||
github.com/klauspost/reedsolomon v1.13.3 // indirect
|
||||
github.com/koofr/go-httpclient v0.0.0-20240520111329-e20f8f203988 // indirect
|
||||
github.com/koofr/go-koofrclient v0.0.0-20221207135200-cbd7fc9ad6a6 // indirect
|
||||
github.com/kr/fs v0.1.0 // indirect
|
||||
@@ -158,18 +158,18 @@ require (
|
||||
github.com/lanrat/extsort v1.4.2 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/lpar/date v1.0.0 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20260216142805-b3301c5f2a88 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 // indirect
|
||||
github.com/mailru/easyjson v0.9.1 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.22 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.19 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/ncw/swift/v2 v2.0.5 // indirect
|
||||
github.com/oklog/ulid v1.3.1 // indirect
|
||||
github.com/oracle/oci-go-sdk/v65 v65.111.0 // indirect
|
||||
github.com/oracle/oci-go-sdk/v65 v65.104.0 // indirect
|
||||
github.com/orcaman/concurrent-map/v2 v2.0.1 // indirect
|
||||
github.com/panjf2000/ants/v2 v2.11.5 // indirect
|
||||
github.com/panjf2000/ants/v2 v2.11.3 // indirect
|
||||
github.com/parquet-go/bitpack v1.0.0 // indirect
|
||||
github.com/parquet-go/jsonlite v1.0.0 // indirect
|
||||
github.com/parquet-go/parquet-go v0.28.0 // indirect
|
||||
@@ -188,22 +188,23 @@ require (
|
||||
github.com/pquerna/otp v1.5.0 // indirect
|
||||
github.com/prometheus/client_golang v1.23.2 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/common v0.67.5 // indirect
|
||||
github.com/prometheus/common v0.67.2 // indirect
|
||||
github.com/prometheus/procfs v0.20.1 // indirect
|
||||
github.com/putdotio/go-putio/putio v0.0.0-20200123120452-16d982cac2b8 // indirect
|
||||
github.com/rclone/Proton-API-Bridge v1.0.3 // indirect
|
||||
github.com/rclone/go-proton-api v1.0.2 // indirect
|
||||
github.com/rclone/rclone v1.74.1 // indirect
|
||||
github.com/quic-go/qpack v0.6.0 // indirect
|
||||
github.com/rclone/Proton-API-Bridge v1.0.1-0.20260127174007-77f974840d11 // indirect
|
||||
github.com/rclone/go-proton-api v1.0.1-0.20260127173028-eb465cac3b18 // indirect
|
||||
github.com/rclone/rclone v1.73.5 // indirect
|
||||
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect
|
||||
github.com/rdleal/intervalst v1.5.0 // indirect
|
||||
github.com/relvacode/iso8601 v1.7.0 // indirect
|
||||
github.com/rfjakob/eme v1.2.0 // indirect
|
||||
github.com/rfjakob/eme v1.1.2 // indirect
|
||||
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
|
||||
github.com/sagikazarmark/locafero v0.11.0 // indirect
|
||||
github.com/samber/lo v1.52.0 // indirect
|
||||
github.com/seaweedfs/goexif v1.0.3 // indirect
|
||||
github.com/shirou/gopsutil/v4 v4.26.3 // indirect
|
||||
github.com/sirupsen/logrus v1.9.4 // indirect
|
||||
github.com/shirou/gopsutil/v4 v4.26.2 // indirect
|
||||
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af // indirect
|
||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect
|
||||
github.com/smarty/assertions v1.16.0 // indirect
|
||||
github.com/sony/gobreaker v1.0.0 // indirect
|
||||
@@ -216,7 +217,7 @@ require (
|
||||
github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 // indirect
|
||||
github.com/t3rm1n4l/go-mega v0.0.0-20251120131202-6845944c051c // indirect
|
||||
github.com/t3rm1n4l/go-mega v0.0.0-20251031123324-a804aaa87491 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.16 // indirect
|
||||
github.com/tklauser/numcpus v0.11.0 // indirect
|
||||
github.com/twpayne/go-geom v1.6.1 // indirect
|
||||
@@ -240,15 +241,15 @@ require (
|
||||
go.etcd.io/bbolt v1.4.3 // indirect
|
||||
go.mongodb.org/mongo-driver v1.17.9 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
|
||||
go.opentelemetry.io/otel v1.43.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.43.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.43.0 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.3 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
golang.org/x/crypto v0.50.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f // indirect
|
||||
golang.org/x/image v0.39.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa // indirect
|
||||
golang.org/x/image v0.38.0 // indirect
|
||||
golang.org/x/net v0.53.0 // indirect
|
||||
golang.org/x/oauth2 v0.36.0 // indirect
|
||||
golang.org/x/sync v0.20.0 // indirect
|
||||
@@ -256,8 +257,8 @@ require (
|
||||
golang.org/x/term v0.42.0 // indirect
|
||||
golang.org/x/text v0.36.0 // indirect
|
||||
golang.org/x/time v0.15.0 // indirect
|
||||
google.golang.org/api v0.278.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260427160629-7cedc36a6bc4 // indirect
|
||||
google.golang.org/api v0.274.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260319201613-d00831a3d3e7 // indirect
|
||||
google.golang.org/grpc/security/advancedtls v1.0.0 // indirect
|
||||
google.golang.org/protobuf v1.36.11 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
@@ -266,10 +267,10 @@ require (
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
moul.io/http2curl/v2 v2.3.0 // indirect
|
||||
sigs.k8s.io/yaml v1.6.0 // indirect
|
||||
storj.io/common v0.0.0-20260225132117-99155641c30a // indirect
|
||||
storj.io/common v0.0.0-20251107171817-6221ae45072c // indirect
|
||||
storj.io/drpc v0.0.35-0.20250513201419-f7819ea69b55 // indirect
|
||||
storj.io/eventkit v0.0.0-20250410172343-61f26d3de156 // indirect
|
||||
storj.io/infectious v0.0.2 // indirect
|
||||
storj.io/picobuf v0.0.4 // indirect
|
||||
storj.io/uplink v1.14.0 // indirect
|
||||
storj.io/uplink v1.13.1 // indirect
|
||||
)
|
||||
+101
-104
@@ -13,8 +13,8 @@ cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKV
|
||||
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
|
||||
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
|
||||
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
|
||||
cloud.google.com/go/auth v0.20.0 h1:kXTssoVb4azsVDoUiF8KvxAqrsQcQtB53DcSgta74CA=
|
||||
cloud.google.com/go/auth v0.20.0/go.mod h1:942/yi/itH1SsmpyrbnTMDgGfdy2BUqIKyd0cyYLc5Q=
|
||||
cloud.google.com/go/auth v0.18.2 h1:+Nbt5Ev0xEqxlNjd6c+yYUeosQ5TtEUaNcN/3FozlaM=
|
||||
cloud.google.com/go/auth v0.18.2/go.mod h1:xD+oY7gcahcu7G2SG2DsBerfFxgPAJz17zz2joOFF3M=
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc=
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c=
|
||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
||||
@@ -49,8 +49,8 @@ github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.8.1
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.8.1/go.mod h1:Ng3urmn6dYe8gnbCMoHHVl5APYz2txho3koEkV2o2HA=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.4 h1:jWQK1GI+LeGGUKBADtcH2rRqPxYB1Ljwms5gFA2LqrM=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.4/go.mod h1:8mwH4klAm9DUgR2EEHyEEAQlRDvLPyg5fQry3y+cDew=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azfile v1.5.4 h1:tZh20RjgfMxKBxJiIS75iTVAKIUxrST5X2dVHMTptL4=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azfile v1.5.4/go.mod h1:vGYAk36rhMVCfTP7v+RVruCR0zmPe6S+36KRpDCLySw=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azfile v1.5.3 h1:sxgSqOB9CDToiaVFpxuvb5wGgGqWa3lCShcm5o0n3bE=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azfile v1.5.3/go.mod h1:XdED8i399lEVblYHTZM8eXaP07gv4Z58IL6ueMlVlrg=
|
||||
github.com/Azure/go-ntlmssp v0.1.1 h1:l+FM/EEMb0U9QZE7mKNEDw5Mu3mFiaa2GKOoTSsNDPw=
|
||||
github.com/Azure/go-ntlmssp v0.1.1/go.mod h1:NYqdhxd/8aAct/s4qSYZEerdPuH1liG2/X9DiVTbhpk=
|
||||
github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM=
|
||||
@@ -61,12 +61,12 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
|
||||
github.com/FilenCloudDienste/filen-sdk-go v0.0.39 h1:tgV5jYL6dsXop9TpDTIQU6UwJjws122HrwskaEE/igY=
|
||||
github.com/FilenCloudDienste/filen-sdk-go v0.0.39/go.mod h1:0cBhKXQg49XbKZZfk5TCDa3sVLP+xMxZTWL+7KY0XR0=
|
||||
github.com/Files-com/files-sdk-go/v3 v3.3.82 h1:2RfP0d2QgkFH64BjZSWd59aMsc28IyWsUuHqU0txBtY=
|
||||
github.com/Files-com/files-sdk-go/v3 v3.3.82/go.mod h1:IPk80dOmc7VFC0DJ85xMTPmre+8xoXX6kGHAkf5jRRw=
|
||||
github.com/IBM/go-sdk-core/v5 v5.21.2 h1:mJ5QbLPOm4g5qhZiVB6wbSllfpeUExftGoyPek2hk4M=
|
||||
github.com/IBM/go-sdk-core/v5 v5.21.2/go.mod h1:ngpMgwkjur1VNUjqn11LPk3o5eCyOCRbcfg/0YAY7Hc=
|
||||
github.com/FilenCloudDienste/filen-sdk-go v0.0.38 h1:YCyHs3wUXEe2BEWn40vcoyaQ2ruHNmNwkasfo3Th16A=
|
||||
github.com/FilenCloudDienste/filen-sdk-go v0.0.38/go.mod h1:0cBhKXQg49XbKZZfk5TCDa3sVLP+xMxZTWL+7KY0XR0=
|
||||
github.com/Files-com/files-sdk-go/v3 v3.2.264 h1:lMHTplAYI9FtmCo/QOcpRxmPA5REVAct1r2riQmDQKw=
|
||||
github.com/Files-com/files-sdk-go/v3 v3.2.264/go.mod h1:wGqkOzRu/ClJibvDgcfuJNAqI2nLhe8g91tPlDKRCdE=
|
||||
github.com/IBM/go-sdk-core/v5 v5.21.0 h1:DUnYhvC4SoC8T84rx5omnhY3+xcQg/Whyoa3mDPIMkk=
|
||||
github.com/IBM/go-sdk-core/v5 v5.21.0/go.mod h1:Q3BYO6iDA2zweQPDGbNTtqft5tDcEpm6RTuqMlPcvbw=
|
||||
github.com/IBM/sarama v1.46.0 h1:+YTM1fNd6WKMchlnLKRUB5Z0qD4M8YbvwIIPLvJD53s=
|
||||
github.com/IBM/sarama v1.46.0/go.mod h1:0lOcuQziJ1/mBGHkdp5uYrltqQuKQKM5O5FOWUQVVvo=
|
||||
github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g=
|
||||
@@ -82,24 +82,22 @@ github.com/ProtonMail/bcrypt v0.0.0-20211005172633-e235017c1baf/go.mod h1:o0ESU9
|
||||
github.com/ProtonMail/gluon v0.17.1-0.20230724134000-308be39be96e h1:lCsqUUACrcMC83lg5rTo9Y0PnPItE61JSfvMyIcANwk=
|
||||
github.com/ProtonMail/gluon v0.17.1-0.20230724134000-308be39be96e/go.mod h1:Og5/Dz1MiGpCJn51XujZwxiLG7WzvvjE5PRpZBQmAHo=
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230321155629-9a39f2531310/go.mod h1:8TI4H3IbrackdNgv+92dI+rhpCaLqM0IfpgCgenFvRE=
|
||||
github.com/ProtonMail/go-crypto v1.4.1 h1:9RfcZHqEQUvP8RzecWEUafnZVtEvrBVL9BiF67IQOfM=
|
||||
github.com/ProtonMail/go-crypto v1.4.1/go.mod h1:e1OaTyu5SYVrO9gKOEhTc+5UcXtTUa+P3uLudwcgPqo=
|
||||
github.com/ProtonMail/go-crypto v1.3.0 h1:ILq8+Sf5If5DCpHQp4PbZdS1J7HDFRXz/+xKBiRGFrw=
|
||||
github.com/ProtonMail/go-crypto v1.3.0/go.mod h1:9whxjD8Rbs29b4XWbB8irEcE8KHMqaR2e7GWU1R+/PE=
|
||||
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f h1:tCbYj7/299ekTTXpdwKYF8eBlsYsDVoggDAuAjoK66k=
|
||||
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f/go.mod h1:gcr0kNtGBqin9zDW9GOHcVntrwnjrK+qdJ06mWYBybw=
|
||||
github.com/ProtonMail/go-srp v0.0.7 h1:Sos3Qk+th4tQR64vsxGIxYpN3rdnG9Wf9K4ZloC1JrI=
|
||||
github.com/ProtonMail/go-srp v0.0.7/go.mod h1:giCp+7qRnMIcCvI6V6U3S1lDDXDQYx2ewJ6F/9wdlJk=
|
||||
github.com/ProtonMail/gopenpgp/v2 v2.9.0 h1:ruLzBmwe4dR1hdnrsEJ/S7psSBmV15gFttFUPP/+/kE=
|
||||
github.com/ProtonMail/gopenpgp/v2 v2.9.0/go.mod h1:IldDyh9Hv1ZCCYatTuuEt1XZJ0OPjxLpTarDfglih7s=
|
||||
github.com/PuerkitoBio/goquery v1.11.0 h1:jZ7pwMQXIITcUXNH83LLk+txlaEy6NVOfTuP43xxfqw=
|
||||
github.com/PuerkitoBio/goquery v1.11.0/go.mod h1:wQHgxUOU3JGuj3oD/QFfxUdlzW6xPHfqyHre6VMY4DQ=
|
||||
github.com/PuerkitoBio/goquery v1.10.3 h1:pFYcNSqHxBD06Fpj/KsbStFRsgRATgnf3LeXiUkhzPo=
|
||||
github.com/PuerkitoBio/goquery v1.10.3/go.mod h1:tMUX0zDMHXYlAQk6p35XxQMqMweEKB7iK7iLNd4RH4Y=
|
||||
github.com/a1ex3/zstd-seekable-format-go/pkg v0.10.0 h1:iLDOF0rdGTrol/q8OfPIIs5kLD8XvA2q75o6Uq/tgak=
|
||||
github.com/a1ex3/zstd-seekable-format-go/pkg v0.10.0/go.mod h1:DrEWcQJjz7t5iF2duaiyhg4jyoF0kxOD6LtECNGkZ/Q=
|
||||
github.com/aalpar/deheap v1.1.2 h1:MABHLcnjqsffb8GLkUFDigqpBBxOMz0DoKM9QfELeTw=
|
||||
github.com/aalpar/deheap v1.1.2/go.mod h1:A+nfkD4JbS05sewV0he/MYgR/90vfqyMoNNROgs+rmA=
|
||||
github.com/aalpar/deheap v0.0.0-20210914013432-0cc84d79dec3 h1:hhdWprfSpFbN7lz3W1gM40vOgvSh1WCSMxYD6gGB4Hs=
|
||||
github.com/aalpar/deheap v0.0.0-20210914013432-0cc84d79dec3/go.mod h1:XaUnRxSCYgL3kkgX0QHIV0D+znljPIDImxlv2kbGv0Y=
|
||||
github.com/abbot/go-http-auth v0.4.0 h1:QjmvZ5gSC7jm3Zg54DqWE/T5m1t2AfDu6QlXJT0EVT0=
|
||||
github.com/abbot/go-http-auth v0.4.0/go.mod h1:Cz6ARTIzApMJDzh5bRMSUou6UMSp0IEXg9km/ci7TJM=
|
||||
github.com/adrg/xdg v0.5.3 h1:xRnxJXne7+oWDatRhR1JLnvuccuIeCoBu2rtuLqQB78=
|
||||
github.com/adrg/xdg v0.5.3/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ=
|
||||
github.com/alecthomas/assert/v2 v2.10.0 h1:jjRCHsj6hBJhkmhznrCzoNpbA3zqy0fYiUcYZP/GkPY=
|
||||
github.com/alecthomas/assert/v2 v2.10.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
|
||||
github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc=
|
||||
@@ -124,8 +122,8 @@ github.com/aws/aws-sdk-go-v2/credentials v1.19.14 h1:n+UcGWAIZHkXzYt87uMFBv/l8TH
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.19.14/go.mod h1:cJKuyWB59Mqi0jM3nFYQRmnHVQIcgoxjEMAbLkpr62w=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21 h1:NUS3K4BTDArQqNu2ih7yeDLaS3bmHD0YndtA6UP884g=
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.21/go.mod h1:YWNWJQNjKigKY1RHVJCuupeWDrrHjRqHm0N9rdrWzYI=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.13 h1:uMC4oL6G3MNhodo358QEqSDjrgvzV3TUQ58nyQSGq2E=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.13/go.mod h1:Cer86AE2686DvVUe57LPve3jUBmbujuaonSX8pNzGgw=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.1 h1:IbWiN670htmBioc+Zj32vSpJgQ2+OYSlvTvfQ1nCORQ=
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.22.1/go.mod h1:tw/B596EUhBWDFGdDGuLC21fVU4A3s4/5Efy8S39W18=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 h1:Rgg6wvjjtX8bNHcvi9OnXWwcE0a2vGpbwmtICOsvcf4=
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21/go.mod h1:A/kJFst/nm//cyqonihbdpQZwiUhhzpqTsdbhDdRF9c=
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.21 h1:PEgGVtPoB6NTpPrBgqSE5hE/o47Ij9qk/SEZFbUOe9A=
|
||||
@@ -152,8 +150,8 @@ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19 h1:dzztQ1YmfPrxdrOiuZRMF6f
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.19/go.mod h1:YO8TrYtFdl5w/4vmjL8zaBSsiNp3w0L1FfKVKenZT7w=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.41.10 h1:p8ogvvLugcR/zLBXTXrTkj0RYBUdErbMnAFFp12Lm/U=
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.41.10/go.mod h1:60dv0eZJfeVXfbT1tFJinbHrDfSJ2GZl4Q//OSSNAVw=
|
||||
github.com/aws/smithy-go v1.25.1 h1:J8ERsGSU7d+aCmdQur5Txg6bVoYelvQJgtZehD12GkI=
|
||||
github.com/aws/smithy-go v1.25.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
|
||||
github.com/aws/smithy-go v1.25.0 h1:Sz/XJ64rwuiKtB6j98nDIPyYrV1nVNJ4YU74gttcl5U=
|
||||
github.com/aws/smithy-go v1.25.0/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
|
||||
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
|
||||
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
@@ -189,13 +187,15 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk=
|
||||
github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
|
||||
github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs=
|
||||
github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA=
|
||||
github.com/clipperhouse/uax29/v2 v2.3.0 h1:SNdx9DVUqMoBuBoW3iLOj4FQv3dN5mDtuqwuhIGpJy4=
|
||||
github.com/clipperhouse/uax29/v2 v2.3.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
|
||||
github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I=
|
||||
github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg8=
|
||||
github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4=
|
||||
github.com/cloudinary/cloudinary-go/v2 v2.15.0 h1:iLoIwb7BJECHTbNcmIhYDsQhoZiACWGNvEpyqQy97Dk=
|
||||
github.com/cloudinary/cloudinary-go/v2 v2.15.0/go.mod h1:ireC4gqVetsjVhYlwjUJwKTbZuWjEIynbR9zQTlqsvo=
|
||||
github.com/cloudinary/cloudinary-go/v2 v2.13.0 h1:ugiQwb7DwpWQnete2AZkTh94MonZKmxD7hDGy1qTzDs=
|
||||
github.com/cloudinary/cloudinary-go/v2 v2.13.0/go.mod h1:ireC4gqVetsjVhYlwjUJwKTbZuWjEIynbR9zQTlqsvo=
|
||||
github.com/cloudsoda/go-smb2 v0.0.0-20250228001242-d4c70e6251cc h1:t8YjNUCt1DimB4HCIXBztwWMhgxr5yG5/YaRl9Afdfg=
|
||||
github.com/cloudsoda/go-smb2 v0.0.0-20250228001242-d4c70e6251cc/go.mod h1:CgWpFCFWzzEA5hVkhAc6DZZzGd3czx+BblvOzjmg6KA=
|
||||
github.com/cloudsoda/sddl v0.0.0-20250224235906-926454e91efc h1:0xCWmFKBmarCqqqLeM7jFBSw/Or81UEElFqO8MY+GDs=
|
||||
@@ -213,9 +213,8 @@ github.com/coreos/go-systemd/v22 v22.6.0 h1:aGVa/v8B7hpb0TKl0MWoAavPDmHvobFe5R5z
|
||||
github.com/coreos/go-systemd/v22 v22.6.0/go.mod h1:iG+pp635Fo7ZmV/j14KUcmEyWF+0X7Lua8rrTWzYgWU=
|
||||
github.com/creasty/defaults v1.8.0 h1:z27FJxCAa0JKt3utc0sCImAEb+spPucmKoOdLHvHYKk=
|
||||
github.com/creasty/defaults v1.8.0/go.mod h1:iGzKe6pbEHnpMPtfDXZEr0NVxWnPTjb1bbDy08fPzYM=
|
||||
github.com/cronokirby/saferith v0.33.0 h1:TgoQlfsD4LIwx71+ChfRcIpjkw+RPOapDEVxa+LhwLo=
|
||||
github.com/cronokirby/saferith v0.33.0/go.mod h1:QKJhjoqUtBsXCAVEjw38mFqoi7DebT7kthcD7UzbnoA=
|
||||
github.com/cronokirby/saferith v0.33.1-0.20250226174546-1f11f94ce488 h1:tLWBZgPg6TV67oe76W4p+aUQEWIa52wbcuiz8GFd3vo=
|
||||
github.com/cronokirby/saferith v0.33.1-0.20250226174546-1f11f94ce488/go.mod h1:QKJhjoqUtBsXCAVEjw38mFqoi7DebT7kthcD7UzbnoA=
|
||||
github.com/d4l3k/messagediff v1.2.1 h1:ZcAIMYsUg0EAp9X+tt8/enBE/Q8Yd5kzPynLyKptt9U=
|
||||
github.com/d4l3k/messagediff v1.2.1/go.mod h1:Oozbb1TVXFac9FtSIxHBMnBCq2qeH/2KkEQxENCrlLo=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@@ -268,8 +267,8 @@ github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7z
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
|
||||
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.13 h1:46nXokslUBsAJE/wMsp5gtO500a4F3Nkz9Ufpk2AcUM=
|
||||
github.com/gabriel-vasile/mimetype v1.4.13/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/gabriel-vasile/mimetype v1.4.11 h1:AQvxbp830wPhHTqc1u7nzoLT+ZFxGY7emj5DR5DYFik=
|
||||
github.com/gabriel-vasile/mimetype v1.4.11/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/geoffgarside/ber v1.2.0 h1:/loowoRcs/MWLYmGX9QtIAbA+V/FrnVLsMMPhwiRm64=
|
||||
github.com/geoffgarside/ber v1.2.0/go.mod h1:jVPKeCbj6MvQZhwLYsGwaGI52oUorHoHKNecGT85ZCc=
|
||||
github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E=
|
||||
@@ -282,8 +281,8 @@ github.com/go-darwin/apfs v0.0.0-20211011131704-f84b94dbf348 h1:JnrjqG5iR07/8k7N
|
||||
github.com/go-darwin/apfs v0.0.0-20211011131704-f84b94dbf348/go.mod h1:Czxo/d1g948LtrALAZdL04TL/HnkopquAjxYUuI02bo=
|
||||
github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk=
|
||||
github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/go-git/go-billy/v5 v5.9.0 h1:jItGXszUDRtR/AlferWPTMN4j38BQ88XnXKbilmmBPA=
|
||||
github.com/go-git/go-billy/v5 v5.9.0/go.mod h1:jCnQMLj9eUgGU7+ludSTYoZL/GGmii14RxKFj7ROgHw=
|
||||
github.com/go-git/go-billy/v5 v5.8.0 h1:I8hjc3LbBlXTtVuFNJuwYuMiHvQJDq1AT6u4DwDzZG0=
|
||||
github.com/go-git/go-billy/v5 v5.8.0/go.mod h1:RpvI/rw4Vr5QA+Z60c6d6LXH0rYJo0uD5SqfmrrheCY=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
@@ -297,8 +296,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
||||
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||
github.com/go-openapi/errors v0.22.6 h1:eDxcf89O8odEnohIXwEjY1IB4ph5vmbUsBMsFNwXWPo=
|
||||
github.com/go-openapi/errors v0.22.6/go.mod h1:z9S8ASTUqx7+CP1Q8dD8ewGH/1JWFFLX/2PmAYNQLgk=
|
||||
github.com/go-openapi/errors v0.22.4 h1:oi2K9mHTOb5DPW2Zjdzs/NIvwi2N3fARKaTJLdNabaM=
|
||||
github.com/go-openapi/errors v0.22.4/go.mod h1:z9S8ASTUqx7+CP1Q8dD8ewGH/1JWFFLX/2PmAYNQLgk=
|
||||
github.com/go-openapi/strfmt v0.25.0 h1:7R0RX7mbKLa9EYCTHRcCuIPcaqlyQiWNPTXwClK0saQ=
|
||||
github.com/go-openapi/strfmt v0.25.0/go.mod h1:nNXct7OzbwrMY9+5tLX4I21pzcmE6ccMGXl3jFdPfn8=
|
||||
github.com/go-openapi/testify/v2 v2.0.2 h1:X999g3jeLcoY8qctY/c/Z8iBHTbwLz7R2WXd6Ub6wls=
|
||||
@@ -309,14 +308,14 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.30.1 h1:f3zDSN/zOma+w6+1Wswgd9fLkdwy06ntQJp0BBvFG0w=
|
||||
github.com/go-playground/validator/v10 v10.30.1/go.mod h1:oSuBIQzuJxL//3MelwSLD5hc2Tu889bF0Idm9Dg26cM=
|
||||
github.com/go-resty/resty/v2 v2.17.2 h1:FQW5oHYcIlkCNrMD2lloGScxcHJ0gkjshV3qcQAyHQk=
|
||||
github.com/go-resty/resty/v2 v2.17.2/go.mod h1:kCKZ3wWmwJaNc7S29BRtUhJwy7iqmn+2mLtQrOyQlVA=
|
||||
github.com/go-playground/validator/v10 v10.28.0 h1:Q7ibns33JjyW48gHkuFT91qX48KG0ktULL6FgHdG688=
|
||||
github.com/go-playground/validator/v10 v10.28.0/go.mod h1:GoI6I1SjPBh9p7ykNE/yj3fFYbyDOpwMn5KXd+m2hUU=
|
||||
github.com/go-resty/resty/v2 v2.16.5 h1:hBKqmWrr7uRc3euHVqmh1HTHcKn99Smr7o5spptdhTM=
|
||||
github.com/go-resty/resty/v2 v2.16.5/go.mod h1:hkJtXbA2iKHzJheXYvQ8snQES5ZLGKMwQ07xAwp/fiA=
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro=
|
||||
github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||
github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
|
||||
github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
|
||||
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
|
||||
@@ -388,12 +387,12 @@ github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0=
|
||||
github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.15 h1:xolVQTEXusUcAA5UgtyRLjelpFFHWlPQ4XfWGc7MBas=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.15/go.mod h1:vqVt9yG9480NtzREnTlmGSBmFrA+bzb0yl0TxoBQXOg=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.14 h1:yh8ncqsbUY4shRD5dA6RlzjJaT4hi3kII+zYw8wmLb8=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.14/go.mod h1:vqVt9yG9480NtzREnTlmGSBmFrA+bzb0yl0TxoBQXOg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/gax-go/v2 v2.22.0 h1:PjIWBpgGIVKGoCXuiCoP64altEJCj3/Ei+kSU5vlZD4=
|
||||
github.com/googleapis/gax-go/v2 v2.22.0/go.mod h1:irWBbALSr0Sk3qlqb9SyJ1h68WjgeFuiOzI4Rqw5+aY=
|
||||
github.com/googleapis/gax-go/v2 v2.19.0 h1:fYQaUOiGwll0cGj7jmHT/0nPlcrZDFPrZRhTsoCr8hE=
|
||||
github.com/googleapis/gax-go/v2 v2.19.0/go.mod h1:w2ROXVdfGEVFXzmlciUU4EdjHgWvB5h2n6x/8XSTTJA=
|
||||
github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g=
|
||||
github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k=
|
||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||
@@ -428,8 +427,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/internxt/rclone-adapter v0.0.0-20260331173834-036f908d0160 h1:PV6ipOJN0JIek4dqPqsTtenQmjI1SZntCUgPzhfk9gM=
|
||||
github.com/internxt/rclone-adapter v0.0.0-20260331173834-036f908d0160/go.mod h1:yRuPDnHgGmsbvopF0amMqXxr4n32GynzX5GTwFYDHaw=
|
||||
github.com/internxt/rclone-adapter v0.0.0-20260220172730-613f4cc8b8fd h1:dSIuz2mpJAPQfhHYtG57D0qwSkgC/vQ69gHfeyQ4kxA=
|
||||
github.com/internxt/rclone-adapter v0.0.0-20260220172730-613f4cc8b8fd/go.mod h1:vdPya4AIcDjvng4ViaAzqjegJf0VHYpYHQguFx5xBp0=
|
||||
github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8=
|
||||
github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs=
|
||||
github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo=
|
||||
@@ -446,8 +445,8 @@ github.com/jhump/protoreflect v1.18.0 h1:TOz0MSR/0JOZ5kECB/0ufGnC2jdsgZ123Rd/k4Z
|
||||
github.com/jhump/protoreflect v1.18.0/go.mod h1:ezWcltJIVF4zYdIFM+D/sHV4Oh5LNU08ORzCGfwvTz8=
|
||||
github.com/jhump/protoreflect/v2 v2.0.0-beta.1 h1:Dw1rslK/VotaUGYsv53XVWITr+5RCPXfvvlGrM/+B6w=
|
||||
github.com/jhump/protoreflect/v2 v2.0.0-beta.1/go.mod h1:D9LBEowZyv8/iSu97FU2zmXG3JxVTmNw21mu63niFzU=
|
||||
github.com/jlaffaye/ftp v0.2.1-0.20251026020404-6602e981a1bb h1:6vkM8gO+zFV2m21QzGYyUSq5TP0VQgP2Xz3UQyCN2kI=
|
||||
github.com/jlaffaye/ftp v0.2.1-0.20251026020404-6602e981a1bb/go.mod h1:H1+whwD0Qe3YOunlXIWhh3rlvzW5cZfkMDYGQPg+KAM=
|
||||
github.com/jlaffaye/ftp v0.2.1-0.20240918233326-1b970516f5d3 h1:ZxO6Qr2GOXPdcW80Mcn3nemvilMPvpWqxrNfK2ZnNNs=
|
||||
github.com/jlaffaye/ftp v0.2.1-0.20240918233326-1b970516f5d3/go.mod h1:dvLUr/8Fs9a2OBrEnCC5duphbkz/k/mSy5OkXg3PAgI=
|
||||
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
|
||||
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
|
||||
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
|
||||
@@ -470,12 +469,12 @@ github.com/keybase/go-keychain v0.0.1 h1:way+bWYa6lDppZoZcgMbYsvC7GxljxrskdNInRt
|
||||
github.com/keybase/go-keychain v0.0.1/go.mod h1:PdEILRW3i9D8JcdM+FmY6RwkHGnhHxXwkPPMeUgOK1k=
|
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/compress v1.18.6 h1:2jupLlAwFm95+YDR+NwD2MEfFO9d4z4Prjl1XXDjuao=
|
||||
github.com/klauspost/compress v1.18.6/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
|
||||
github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE=
|
||||
github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
github.com/klauspost/reedsolomon v1.14.0 h1:5YSZeclzSYg5nl349+GDG/agDtQ6MZiwUYXvVKN1Jx0=
|
||||
github.com/klauspost/reedsolomon v1.14.0/go.mod h1:yjqqjgMTQkBUHSG97/rm4zipffCNbCiZcB3kTqr++sQ=
|
||||
github.com/klauspost/reedsolomon v1.13.3 h1:01GwnO2xoCSaM0ShP4qwl+FsHg3csFShC6Tu/RS1ji0=
|
||||
github.com/klauspost/reedsolomon v1.13.3/go.mod h1:yjqqjgMTQkBUHSG97/rm4zipffCNbCiZcB3kTqr++sQ=
|
||||
github.com/koofr/go-httpclient v0.0.0-20240520111329-e20f8f203988 h1:CjEMN21Xkr9+zwPmZPaJJw+apzVbjGL5uK/6g9Q2jGU=
|
||||
github.com/koofr/go-httpclient v0.0.0-20240520111329-e20f8f203988/go.mod h1:/agobYum3uo/8V6yPVnq+R82pyVGCeuWW5arT4Txn8A=
|
||||
github.com/koofr/go-koofrclient v0.0.0-20221207135200-cbd7fc9ad6a6 h1:FHVoZMOVRA+6/y4yRlbiR3WvsrOcKBd/f64H7YiWR2U=
|
||||
@@ -500,8 +499,8 @@ github.com/linkedin/goavro/v2 v2.15.0 h1:pDj1UrjUOO62iXhgBiE7jQkpNIc5/tA5eZsgolM
|
||||
github.com/linkedin/goavro/v2 v2.15.0/go.mod h1:KXx+erlq+RPlGSPmLF7xGo6SAbh8sCQ53x064+ioxhk=
|
||||
github.com/lpar/date v1.0.0 h1:bq/zVqFTUmsxvd/CylidY4Udqpr9BOFrParoP6p0x/I=
|
||||
github.com/lpar/date v1.0.0/go.mod h1:KjYe0dDyMQTgpqcUz4LEIeM5VZwhggjVx/V2dtc8NSo=
|
||||
github.com/lufia/plan9stats v0.0.0-20260216142805-b3301c5f2a88 h1:PTw+yKnXcOFCR6+8hHTyWBeQ/P4Nb7dd4/0ohEcWQuM=
|
||||
github.com/lufia/plan9stats v0.0.0-20260216142805-b3301c5f2a88/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg=
|
||||
github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3 h1:PwQumkgq4/acIiZhtifTV5OUqqiP82UAl0h87xj/l9k=
|
||||
github.com/lufia/plan9stats v0.0.0-20251013123823-9fd1530e3ec3/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg=
|
||||
github.com/mailru/easyjson v0.9.1 h1:LbtsOm5WAswyWbvTEOqhypdPeZzHavpZx96/n553mR8=
|
||||
github.com/mailru/easyjson v0.9.1/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
|
||||
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
@@ -509,8 +508,8 @@ github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stg
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.22 h1:76lXsPn6FyHtTY+jt2fTTvsMUCZq1k0qwRsAMuxzKAk=
|
||||
github.com/mattn/go-runewidth v0.0.22/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
|
||||
github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw=
|
||||
github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
|
||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/moby/sys/mountinfo v0.7.2 h1:1shs6aH5s4o5H2zQLn796ADW1wMrIwHsyJ2v9KouLrg=
|
||||
@@ -536,12 +535,12 @@ github.com/onsi/ginkgo/v2 v2.23.3/go.mod h1:zXTP6xIp3U8aVuXN8ENK9IXRaTjFnpVB9mGm
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y=
|
||||
github.com/onsi/gomega v1.37.0/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
|
||||
github.com/oracle/oci-go-sdk/v65 v65.111.0 h1:eDkWg6ZN0uKwWzSekoFcQJhR+C+F/aVdTwr+lGHU9Qk=
|
||||
github.com/oracle/oci-go-sdk/v65 v65.111.0/go.mod h1:8ZzvzuEG/cFLFZhxg/Mg1w19KqyXBKO3c17QIc5PkGs=
|
||||
github.com/oracle/oci-go-sdk/v65 v65.104.0 h1:l9awEvzWvxmYhy/97A0hZ87pa7BncYXmcO/S8+rvgK0=
|
||||
github.com/oracle/oci-go-sdk/v65 v65.104.0/go.mod h1:oB8jFGVc/7/zJ+DbleE8MzGHjhs2ioCz5stRTdZdIcY=
|
||||
github.com/orcaman/concurrent-map/v2 v2.0.1 h1:jOJ5Pg2w1oeB6PeDurIYf6k9PQ+aTITr/6lP/L/zp6c=
|
||||
github.com/orcaman/concurrent-map/v2 v2.0.1/go.mod h1:9Eq3TG2oBe5FirmYWQfYO5iH1q0Jv47PLaNK++uCdOM=
|
||||
github.com/panjf2000/ants/v2 v2.11.5 h1:a7LMnMEeux/ebqTux140tRiaqcFTV0q2bEHF03nl6Rg=
|
||||
github.com/panjf2000/ants/v2 v2.11.5/go.mod h1:8u92CYMUc6gyvTIw8Ru7Mt7+/ESnJahz5EVtqfrilek=
|
||||
github.com/panjf2000/ants/v2 v2.11.3 h1:AfI0ngBoXJmYOpDh9m516vjqoUu2sLrIVgppI9TZVpg=
|
||||
github.com/panjf2000/ants/v2 v2.11.3/go.mod h1:8u92CYMUc6gyvTIw8Ru7Mt7+/ESnJahz5EVtqfrilek=
|
||||
github.com/parquet-go/bitpack v1.0.0 h1:AUqzlKzPPXf2bCdjfj4sTeacrUwsT7NlcYDMUQxPcQA=
|
||||
github.com/parquet-go/bitpack v1.0.0/go.mod h1:XnVk9TH+O40eOOmvpAVZ7K2ocQFrQwysLMnc6M/8lgs=
|
||||
github.com/parquet-go/jsonlite v1.0.0 h1:87QNdi56wOfsE5bdgas0vRzHPxfJgzrXGml1zZdd7VU=
|
||||
@@ -581,30 +580,30 @@ github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UH
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
|
||||
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
|
||||
github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4=
|
||||
github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw=
|
||||
github.com/prometheus/common v0.67.2 h1:PcBAckGFTIHt2+L3I33uNRTlKTplNzFctXcWhPyAEN8=
|
||||
github.com/prometheus/common v0.67.2/go.mod h1:63W3KZb1JOKgcjlIr64WW/LvFGAqKPj0atm+knVGEko=
|
||||
github.com/prometheus/procfs v0.20.1 h1:XwbrGOIplXW/AU3YhIhLODXMJYyC1isLFfYCsTEycfc=
|
||||
github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4UlK79eF5TGGo=
|
||||
github.com/putdotio/go-putio/putio v0.0.0-20200123120452-16d982cac2b8 h1:Y258uzXU/potCYnQd1r6wlAnoMB68BiCkCcCnKx1SH8=
|
||||
github.com/putdotio/go-putio/putio v0.0.0-20200123120452-16d982cac2b8/go.mod h1:bSJjRokAHHOhA+XFxplld8w2R/dXLH7Z3BZ532vhFwU=
|
||||
github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
|
||||
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
|
||||
github.com/quic-go/quic-go v0.59.0 h1:OLJkp1Mlm/aS7dpKgTc6cnpynnD2Xg7C1pwL6vy/SAw=
|
||||
github.com/quic-go/quic-go v0.59.0/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
|
||||
github.com/rclone/Proton-API-Bridge v1.0.3 h1:Bs7RC4xCFSN0BPIYVda/BNxp0qo3NV0gB2VZqx2KIew=
|
||||
github.com/rclone/Proton-API-Bridge v1.0.3/go.mod h1:26RAest751Ofk+F/d8xtl4UyWXrZvMQwn39U8rm/WKM=
|
||||
github.com/rclone/go-proton-api v1.0.2 h1:cJtJUab0MGJ3C6q5kiEJs3pbyhSLnOKMyYOQehA0PBc=
|
||||
github.com/rclone/go-proton-api v1.0.2/go.mod h1:LB2kCEaZMzNn3ocdz+qYfxXmuLxxN0ka62KJd2x53Bc=
|
||||
github.com/rclone/rclone v1.74.1 h1:QQI//tl4O5uooTowdKwNKcv5qCQvJ3LIBG00+TKeXw0=
|
||||
github.com/rclone/rclone v1.74.1/go.mod h1:44epaKf5w/1ZQounefr76wx4+y9NZmgfMKle9T3pzj0=
|
||||
github.com/quic-go/quic-go v0.57.0 h1:AsSSrrMs4qI/hLrKlTH/TGQeTMY0ib1pAOX7vA3AdqE=
|
||||
github.com/quic-go/quic-go v0.57.0/go.mod h1:ly4QBAjHA2VhdnxhojRsCUOeJwKYg+taDlos92xb1+s=
|
||||
github.com/rclone/Proton-API-Bridge v1.0.1-0.20260127174007-77f974840d11 h1:4MI2alxM/Ye2gIRBlYf28JGWTipZ4Zz7yAziPKrttjs=
|
||||
github.com/rclone/Proton-API-Bridge v1.0.1-0.20260127174007-77f974840d11/go.mod h1:3HLX7dwZgvB7nt+Yl/xdzVPcargQ1yBmJEUg3n+jMKM=
|
||||
github.com/rclone/go-proton-api v1.0.1-0.20260127173028-eb465cac3b18 h1:Lc+d3ISfQaMJKWZOE7z4ZSY4RVmdzbn1B0IM8xN18qM=
|
||||
github.com/rclone/go-proton-api v1.0.1-0.20260127173028-eb465cac3b18/go.mod h1:LB2kCEaZMzNn3ocdz+qYfxXmuLxxN0ka62KJd2x53Bc=
|
||||
github.com/rclone/rclone v1.73.5 h1:r8a9JHYIWUqk7hNRJuMJ3cROkKfB2zmfkADg8ZLYh6I=
|
||||
github.com/rclone/rclone v1.73.5/go.mod h1:WVv8gvA/lEl/Y37e8I8yosm7ZY+Szq7ujXbJS8Ol63o=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 h1:bsUq1dX0N8AOIL7EB/X911+m4EHsnWEHeJ0c+3TTBrg=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/rdleal/intervalst v1.5.0 h1:SEB9bCFz5IqD1yhfH1Wv8IBnY/JQxDplwkxHjT6hamU=
|
||||
github.com/rdleal/intervalst v1.5.0/go.mod h1:xO89Z6BC+LQDH+IPQQw/OESt5UADgFD41tYMUINGpxQ=
|
||||
github.com/relvacode/iso8601 v1.7.0 h1:BXy+V60stMP6cpswc+a93Mq3e65PfXCgDFfhvNNGrdo=
|
||||
github.com/relvacode/iso8601 v1.7.0/go.mod h1:FlNp+jz+TXpyRqgmM7tnzHHzBnz776kmAH2h3sZCn0I=
|
||||
github.com/rfjakob/eme v1.2.0 h1:8dAHL+WVAw06+7DkRKnRiFp1JL3QjcJEZFqDnndUaSI=
|
||||
github.com/rfjakob/eme v1.2.0/go.mod h1:cVvpasglm/G3ngEfcfT/Wt0GwhkuO32pf/poW6Nyk1k=
|
||||
github.com/rfjakob/eme v1.1.2 h1:SxziR8msSOElPayZNFfQw4Tjx/Sbaeeh3eRvrHVMUs4=
|
||||
github.com/rfjakob/eme v1.1.2/go.mod h1:cVvpasglm/G3ngEfcfT/Wt0GwhkuO32pf/poW6Nyk1k=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
@@ -619,11 +618,11 @@ github.com/seaweedfs/goexif v1.0.3/go.mod h1:Oni780Z236sXpIQzk1XoJlTwqrJ02smEin9
|
||||
github.com/segmentio/kafka-go v0.4.49 h1:GJiNX1d/g+kG6ljyJEoi9++PUMdXGAxb7JGPiDCuNmk=
|
||||
github.com/segmentio/kafka-go v0.4.49/go.mod h1:Y1gn60kzLEEaW28YshXyk2+VCUKbJ3Qr6DrnT3i4+9E=
|
||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
||||
github.com/shirou/gopsutil/v4 v4.26.3 h1:2ESdQt90yU3oXF/CdOlRCJxrP+Am1aBYubTMTfxJ1qc=
|
||||
github.com/shirou/gopsutil/v4 v4.26.3/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ=
|
||||
github.com/shirou/gopsutil/v4 v4.26.2 h1:X8i6sicvUFih4BmYIGT1m2wwgw2VG9YgrDTi7cIRGUI=
|
||||
github.com/shirou/gopsutil/v4 v4.26.2/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ=
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
|
||||
github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
|
||||
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af h1:Sp5TG9f7K39yfB+If0vjp97vuT74F72r8hfRpP8jLU0=
|
||||
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA=
|
||||
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
|
||||
github.com/smarty/assertions v1.16.0 h1:EvHNkdRA4QHMrn75NZSoUQ/mAUXAYWfatfB01yTCzfY=
|
||||
@@ -642,8 +641,8 @@ github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
|
||||
github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
|
||||
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
|
||||
github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
|
||||
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
|
||||
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
|
||||
github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
|
||||
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
|
||||
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
|
||||
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.21.0 h1:x5S+0EU27Lbphp4UKm1C+1oQO+rKx36vfCoaVebLFSU=
|
||||
@@ -671,8 +670,8 @@ github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8
|
||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 h1:1oFLiOyVl+W7bnBzGhf7BbIv9loSFQcieWWYIjLqcAw=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA=
|
||||
github.com/t3rm1n4l/go-mega v0.0.0-20251120131202-6845944c051c h1:dtcOwRimeiBFrlutmF6K94l0rxYFARNFMA+lSQ41C+M=
|
||||
github.com/t3rm1n4l/go-mega v0.0.0-20251120131202-6845944c051c/go.mod h1:BF/l2jNyK+2h/BJZ7VLMAz6m/IWjA2F67gTjV1C/+Bo=
|
||||
github.com/t3rm1n4l/go-mega v0.0.0-20251031123324-a804aaa87491 h1:rrGZv6xYk37hx0tW2sYfgbO0PqStbHqz6Bq6oc9Hurg=
|
||||
github.com/t3rm1n4l/go-mega v0.0.0-20251031123324-a804aaa87491/go.mod h1:ykucQyiE9Q2qx1wLlEtZkkNn1IURib/2O+Mvd25i1Fo=
|
||||
github.com/tailscale/depaware v0.0.0-20210622194025-720c4b409502/go.mod h1:p9lPsd+cx33L3H9nNoecRRxPssFKUwwI50I3pZ0yT+8=
|
||||
github.com/tklauser/go-sysconf v0.3.16 h1:frioLaCQSsF5Cy1jgRBrzr6t502KIIwQ0MArYICU0nA=
|
||||
github.com/tklauser/go-sysconf v0.3.16/go.mod h1:/qNL9xxDhc7tx3HSRsLWNnuzbVfh3e7gh/BmM179nYI=
|
||||
@@ -738,8 +737,6 @@ github.com/zeebo/blake3 v0.2.4 h1:KYQPkhpRtcqh0ssGYcKLG1JYvddkEA8QwCM/yBqhaZI=
|
||||
github.com/zeebo/blake3 v0.2.4/go.mod h1:7eeQ6d2iXWRGF6npfaxl2CU+xy2Fjo2gxeyZGCRUjcE=
|
||||
github.com/zeebo/errs v1.4.0 h1:XNdoD/RRMKP7HD0UhJnIzUy74ISdGGxURlYG8HSWSfM=
|
||||
github.com/zeebo/errs v1.4.0/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4=
|
||||
github.com/zeebo/mwc v0.0.7 h1:0NerGhCww6ZQx+/xCx5iwznftveokvto1KILpYfENZk=
|
||||
github.com/zeebo/mwc v0.0.7/go.mod h1:0B32or6moOig1YGuqMoimBpU9QK9uYaGG2bBOuddqtE=
|
||||
github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo=
|
||||
github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4=
|
||||
github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs=
|
||||
@@ -755,8 +752,8 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 h1:OyrsyzuttWTSur2qN/Lm0m2a8yqyIjUVBZcxFPuXq2o=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0/go.mod h1:C2NGBr+kAB4bk3xtMXfZ94gqFDtg/GkI7e9zqGh5Beg=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg=
|
||||
go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I=
|
||||
go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0=
|
||||
go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM=
|
||||
@@ -802,12 +799,12 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
|
||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f h1:W3F4c+6OLc6H2lb//N1q4WpJkhzJCK5J6kUi1NTVXfM=
|
||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f/go.mod h1:J1xhfL/vlindoeF/aINzNzt2Bket5bjo9sdOYzOsU80=
|
||||
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa h1:Zt3DZoOFFYkKhDT3v7Lm9FDMEV06GpzjG2jrqW+QTE0=
|
||||
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa/go.mod h1:K79w1Vqn7PoiZn+TkNpx3BUWUQksGO3JcVX6qIjytmA=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.39.0 h1:skVYidAEVKgn8lZ602XO75asgXBgLj9G/FE3RbuPFww=
|
||||
golang.org/x/image v0.39.0/go.mod h1:sIbmppfU+xFLPIG0FoVUTvyBMmgng1/XAMhQ2ft0hpA=
|
||||
golang.org/x/image v0.38.0 h1:5l+q+Y9JDC7mBOMjo4/aPhMDcxEptsX+Tt3GgRQRPuE=
|
||||
golang.org/x/image v0.38.0/go.mod h1:/3f6vaXC+6CEanU4KJxbcUZyEePbyKbaLoDOe4ehFYY=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
@@ -1033,8 +1030,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
||||
golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c=
|
||||
golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI=
|
||||
golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s=
|
||||
golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@@ -1057,8 +1054,8 @@ google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M
|
||||
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
|
||||
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
|
||||
google.golang.org/api v0.278.0 h1:W7jiRvRi53VYFfZ/HoZjQBtJk7gOFbHD8ot1RzVZU6E=
|
||||
google.golang.org/api v0.278.0/go.mod h1:B9TqLBwJqVjp1mtt7WeoQwWRwvu/400y5lETOql+giQ=
|
||||
google.golang.org/api v0.274.0 h1:aYhycS5QQCwxHLwfEHRRLf9yNsfvp1JadKKWBE54RFA=
|
||||
google.golang.org/api v0.274.0/go.mod h1:JbAt7mF+XVmWu6xNP8/+CTiGH30ofmCmk9nM8d8fHew=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
@@ -1094,12 +1091,12 @@ google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7Fc
|
||||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 h1:XzmzkmB14QhVhgnawEVsOn6OFsnpyxNPRY9QV01dNB0=
|
||||
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7/go.mod h1:L43LFes82YgSonw6iTXTxXUX1OlULt4AQtkik4ULL/I=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 h1:VPWxll4HlMw1Vs/qXtN7BvhZqsS9cdAittCNvVENElA=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9/go.mod h1:7QBABkRtR8z+TEnmXTqIqwJLlzrZKVfAUm7tY3yGv0M=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260427160629-7cedc36a6bc4 h1:tEkOQcXgF6dH1G+MVKZrfpYvozGrzb91k6ha7jireSM=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260427160629-7cedc36a6bc4/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
|
||||
google.golang.org/genproto v0.0.0-20260316180232-0b37fe3546d5 h1:JNfk58HZ8lfmXbYK2vx/UvsqIL59TzByCxPIX4TDmsE=
|
||||
google.golang.org/genproto v0.0.0-20260316180232-0b37fe3546d5/go.mod h1:x5julN69+ED4PcFk/XWayw35O0lf/nGa4aNgODCmNmw=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260316180232-0b37fe3546d5 h1:CogIeEXn4qWYzzQU0QqvYBM8yDF9cFYzDq9ojSpv0Js=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260316180232-0b37fe3546d5/go.mod h1:EIQZ5bFCfRQDV4MhRle7+OgjNtZ6P1PiZBgAKuxXu/Y=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260319201613-d00831a3d3e7 h1:ndE4FoJqsIceKP2oYSnUZqhTdYufCYYkqwtFzfrhI7w=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260319201613-d00831a3d3e7/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
@@ -1112,8 +1109,8 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa
|
||||
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.80.0 h1:Xr6m2WmWZLETvUNvIUmeD5OAagMw3FiKmMlTdViWsHM=
|
||||
google.golang.org/grpc v1.80.0/go.mod h1:ho/dLnxwi3EDJA4Zghp7k2Ec1+c2jqup0bFkw07bwF4=
|
||||
google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE=
|
||||
google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
|
||||
google.golang.org/grpc/examples v0.0.0-20250407062114-b368379ef8f6 h1:ExN12ndbJ608cboPYflpTny6mXSzPrDLh0iTaVrRrds=
|
||||
google.golang.org/grpc/examples v0.0.0-20250407062114-b368379ef8f6/go.mod h1:6ytKWczdvnpnO+m+JiG9NjEDzR1FJfsnmJdG7B8QVZ8=
|
||||
google.golang.org/grpc/security/advancedtls v1.0.0 h1:/KQ7VP/1bs53/aopk9QhuPyFAp9Dm9Ejix3lzYkCrDA=
|
||||
@@ -1164,8 +1161,8 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
||||
sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs=
|
||||
sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4=
|
||||
storj.io/common v0.0.0-20260225132117-99155641c30a h1:7gSBQY3vhQMIqi3vfaEXR7mreRjcBLfVsYY0rHIN7P0=
|
||||
storj.io/common v0.0.0-20260225132117-99155641c30a/go.mod h1:kyxwKwlfH4paBZCZt/szvRB770ieAIJF73iDy2DpEHw=
|
||||
storj.io/common v0.0.0-20251107171817-6221ae45072c h1:UDXSrdeLJe3QFouavSW10fYdpclK0YNu3KvQHzqq2+k=
|
||||
storj.io/common v0.0.0-20251107171817-6221ae45072c/go.mod h1:XNX7uykja6aco92y2y8RuqaXIDRPpt1YA2OQDKlKEUk=
|
||||
storj.io/drpc v0.0.35-0.20250513201419-f7819ea69b55 h1:8OE12DvUnB9lfZcHe7IDGsuhjrY9GBAr964PVHmhsro=
|
||||
storj.io/drpc v0.0.35-0.20250513201419-f7819ea69b55/go.mod h1:Y9LZaa8esL1PW2IDMqJE7CFSNq7d5bQ3RI7mGPtmKMg=
|
||||
storj.io/eventkit v0.0.0-20250410172343-61f26d3de156 h1:5MZ0CyMbG6Pi0rRzUWVG6dvpXjbBYEX2oyXuj+tT+sk=
|
||||
@@ -1174,5 +1171,5 @@ storj.io/infectious v0.0.2 h1:rGIdDC/6gNYAStsxsZU79D/MqFjNyJc1tsyyj9sTl7Q=
|
||||
storj.io/infectious v0.0.2/go.mod h1:QEjKKww28Sjl1x8iDsjBpOM4r1Yp8RsowNcItsZJ1Vs=
|
||||
storj.io/picobuf v0.0.4 h1:qswHDla+YZ2TovGtMnU4astjvrADSIz84FXRn0qgP6o=
|
||||
storj.io/picobuf v0.0.4/go.mod h1:hSMxmZc58MS/2qSLy1I0idovlO7+6K47wIGUyRZa6mg=
|
||||
storj.io/uplink v1.14.0 h1:J1yXlt0aRr6kgLTHWXOWosNCFVfbamlcyd+CSxyIczo=
|
||||
storj.io/uplink v1.14.0/go.mod h1:2ysmjzd/1Xtz4VKoErNcSqBQz3UC9WKTVuLMV1cNu6E=
|
||||
storj.io/uplink v1.13.1 h1:C8RdW/upALoCyuF16Lod9XGCXEdbJAS+ABQy9JO/0pA=
|
||||
storj.io/uplink v1.13.1/go.mod h1:x0MQr4UfFsQBwgVWZAtEsLpuwAn6dg7G0Mpne1r516E=
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -292,60 +291,6 @@ func (v *VolumeServer) VolumeEcShardsMount(ctx context.Context, req *volume_serv
|
||||
return &volume_server_pb.VolumeEcShardsMountResponse{}, nil
|
||||
}
|
||||
|
||||
func (v *VolumeServer) VolumeEcShardsInfo(ctx context.Context, req *volume_server_pb.VolumeEcShardsInfoRequest) (*volume_server_pb.VolumeEcShardsInfoResponse, error) {
|
||||
if req == nil {
|
||||
return nil, fmt.Errorf("VolumeEcShardsInfo request is nil")
|
||||
}
|
||||
v.mu.Lock()
|
||||
defer v.mu.Unlock()
|
||||
|
||||
// Report whichever shards exist on disk: seeded or mounted. Collection
|
||||
// comes from the matching mount request when one exists.
|
||||
collectionByShard := make(map[uint32]string)
|
||||
for _, mr := range v.mountRequests {
|
||||
if mr == nil || mr.VolumeId != req.VolumeId {
|
||||
continue
|
||||
}
|
||||
for _, shardId := range mr.ShardIds {
|
||||
if _, ok := collectionByShard[shardId]; !ok {
|
||||
collectionByShard[shardId] = mr.Collection
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resp := &volume_server_pb.VolumeEcShardsInfoResponse{}
|
||||
prefix := fmt.Sprintf("%d.ec", req.VolumeId)
|
||||
entries, _ := os.ReadDir(v.baseDir)
|
||||
for _, entry := range entries {
|
||||
if entry.IsDir() {
|
||||
continue
|
||||
}
|
||||
name := entry.Name()
|
||||
if !strings.HasPrefix(name, prefix) {
|
||||
continue
|
||||
}
|
||||
suffix := strings.TrimPrefix(name, prefix)
|
||||
if len(suffix) < 2 {
|
||||
continue
|
||||
}
|
||||
var shardId uint32
|
||||
if _, err := fmt.Sscanf(suffix[:2], "%d", &shardId); err != nil {
|
||||
continue
|
||||
}
|
||||
var size int64
|
||||
if info, err := entry.Info(); err == nil {
|
||||
size = info.Size()
|
||||
}
|
||||
resp.EcShardInfos = append(resp.EcShardInfos, &volume_server_pb.EcShardInfo{
|
||||
ShardId: shardId,
|
||||
Size: size,
|
||||
Collection: collectionByShard[shardId],
|
||||
VolumeId: req.VolumeId,
|
||||
})
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (v *VolumeServer) VolumeDelete(ctx context.Context, req *volume_server_pb.VolumeDeleteRequest) (*volume_server_pb.VolumeDeleteResponse, error) {
|
||||
v.mu.Lock()
|
||||
v.deleteRequests = append(v.deleteRequests, req)
|
||||
|
||||
@@ -86,12 +86,8 @@ func backdateVersionedMtime(t *testing.T, fc filer_pb.SeaweedFilerClient, bucket
|
||||
|
||||
func runLifecycleShard(t *testing.T) string {
|
||||
t.Helper()
|
||||
// -refresh 1s drives an inter-pass loop inside the 10s runtime so
|
||||
// rules that need two passes to settle (e.g.
|
||||
// TestLifecycleExpiredDeleteMarkerCleanup: pass 1 removes v1, pass 2
|
||||
// removes the now-orphaned marker) get the second pass.
|
||||
out := runShellCommand(t, fmt.Sprintf(
|
||||
"s3.lifecycle.run-shard -shards 0-15 -s3 %s -events 0 -refresh 1s -runtime 10s",
|
||||
"s3.lifecycle.run-shard -shards 0-15 -s3 %s -events 0 -dispatch 200ms -checkpoint 5s -runtime 10s",
|
||||
envOr("S3_GRPC_ENDPOINT", defaultS3GrpcEndpoint),
|
||||
))
|
||||
require.NotContains(t, out, "FATAL", "shell output:\n%s", out)
|
||||
|
||||
@@ -127,7 +127,6 @@ start-primary: check-deps
|
||||
-webdav.port=$(PRIMARY_WEBDAV_PORT) \
|
||||
-s3.allowDeleteBucketNotEmpty=true \
|
||||
-s3.config=s3_config.json \
|
||||
-volume.allowUntrustedRemoteEndpoints \
|
||||
-dir=$(PRIMARY_DIR) \
|
||||
-ip=127.0.0.1 \
|
||||
-ip.bind=127.0.0.1 \
|
||||
|
||||
@@ -184,38 +184,6 @@ func (c *Cluster) Stop() {
|
||||
})
|
||||
}
|
||||
|
||||
// RestartVolumeServer kills the volume server and starts a new one against
|
||||
// the same data dirs and ports. The master keeps running. The previous run's
|
||||
// volume.log is moved to volume.log.previous so the first run's logs survive
|
||||
// a second-run startup failure.
|
||||
func (c *Cluster) RestartVolumeServer() {
|
||||
c.testingTB.Helper()
|
||||
stopProcess(c.volumeCmd)
|
||||
c.volumeCmd = nil
|
||||
// Rotate the log; absent on the first call after a clean start, which
|
||||
// is fine — startVolume will create it. Any real filesystem failure
|
||||
// surfaces immediately on the next os.Create in startVolume.
|
||||
oldLog := filepath.Join(c.logsDir, "volume.log")
|
||||
_ = os.Rename(oldLog, filepath.Join(c.logsDir, "volume.log.previous"))
|
||||
if err := c.startVolume(c.volumeDataDirs); err != nil {
|
||||
c.testingTB.Fatalf("restart volume server: %v", err)
|
||||
}
|
||||
if err := c.waitForHTTP(c.VolumeAdminURL() + "/status"); err != nil {
|
||||
c.testingTB.Fatalf("wait for volume admin readiness after restart: %v\nvolume log tail:\n%s", err, c.tailLog("volume.log"))
|
||||
}
|
||||
if err := c.waitForTCP(c.VolumeGRPCAddress()); err != nil {
|
||||
c.testingTB.Fatalf("wait for volume grpc readiness after restart: %v\nvolume log tail:\n%s", err, c.tailLog("volume.log"))
|
||||
}
|
||||
}
|
||||
|
||||
// StopVolumeServer kills the volume server but leaves the master and data
|
||||
// dirs alone. Pair with RestartVolumeServer or Stop.
|
||||
func (c *Cluster) StopVolumeServer() {
|
||||
c.testingTB.Helper()
|
||||
stopProcess(c.volumeCmd)
|
||||
c.volumeCmd = nil
|
||||
}
|
||||
|
||||
func (c *Cluster) startMaster(dataDir string) error {
|
||||
logFile, err := os.Create(filepath.Join(c.logsDir, "master.log"))
|
||||
if err != nil {
|
||||
@@ -264,10 +232,6 @@ func (c *Cluster) startVolume(dataDirs []string) error {
|
||||
"-readMode=" + c.profile.ReadMode,
|
||||
"-concurrentUploadLimitMB=" + strconv.Itoa(c.profile.ConcurrentUploadLimitMB),
|
||||
"-concurrentDownloadLimitMB=" + strconv.Itoa(c.profile.ConcurrentDownloadLimitMB),
|
||||
// Integration tests deliberately exercise loopback S3 endpoints
|
||||
// (the test rig boots weed-mini next to the volume server); allow
|
||||
// the SSRF guard to be bypassed for them.
|
||||
"-volume.allowUntrustedRemoteEndpoints",
|
||||
}
|
||||
if c.profile.InflightUploadTimeout > 0 {
|
||||
args = append(args, "-inflightUploadDataTimeout="+c.profile.InflightUploadTimeout.String())
|
||||
|
||||
@@ -256,8 +256,6 @@ func (c *MixedVolumeCluster) startGoVolume(index int, dataDir string) error {
|
||||
"-readMode=" + c.profile.ReadMode,
|
||||
"-concurrentUploadLimitMB=" + strconv.Itoa(c.profile.ConcurrentUploadLimitMB),
|
||||
"-concurrentDownloadLimitMB=" + strconv.Itoa(c.profile.ConcurrentDownloadLimitMB),
|
||||
// Integration tests deliberately exercise loopback S3 endpoints; allow the SSRF guard to be bypassed for them.
|
||||
"-volume.allowUntrustedRemoteEndpoints",
|
||||
}
|
||||
if c.profile.InflightUploadTimeout > 0 {
|
||||
args = append(args, "-inflightUploadDataTimeout="+c.profile.InflightUploadTimeout.String())
|
||||
|
||||
@@ -227,8 +227,6 @@ func (c *MultiVolumeCluster) startVolume(index int, dataDir string) error {
|
||||
"-readMode=" + c.profile.ReadMode,
|
||||
"-concurrentUploadLimitMB=" + strconv.Itoa(c.profile.ConcurrentUploadLimitMB),
|
||||
"-concurrentDownloadLimitMB=" + strconv.Itoa(c.profile.ConcurrentDownloadLimitMB),
|
||||
// Integration tests deliberately exercise loopback S3 endpoints; allow the SSRF guard to be bypassed for them.
|
||||
"-volume.allowUntrustedRemoteEndpoints",
|
||||
}
|
||||
if c.profile.InflightUploadTimeout > 0 {
|
||||
args = append(args, "-inflightUploadDataTimeout="+c.profile.InflightUploadTimeout.String())
|
||||
|
||||
@@ -8,9 +8,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/test/volume_server/framework"
|
||||
"github.com/seaweedfs/seaweedfs/test/volume_server/matrix"
|
||||
"github.com/seaweedfs/seaweedfs/weed/cluster"
|
||||
@@ -324,18 +321,15 @@ func TestPingVolumeTargetAndLeaveAffectsHealthz(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
|
||||
// Volume servers only track their masters as ping peers, so drive the
|
||||
// success path through the master target and rely on the master->volume
|
||||
// admission for cross-type coverage.
|
||||
pingResp, err := grpcClient.Ping(ctx, &volume_server_pb.PingRequest{
|
||||
TargetType: cluster.MasterType,
|
||||
Target: clusterHarness.MasterAddress(),
|
||||
TargetType: cluster.VolumeServerType,
|
||||
Target: clusterHarness.VolumeServerAddress(),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Ping master from volume server failed: %v", err)
|
||||
t.Fatalf("Ping target volume server failed: %v", err)
|
||||
}
|
||||
if pingResp.GetRemoteTimeNs() == 0 {
|
||||
t.Fatalf("expected remote timestamp from ping master")
|
||||
t.Fatalf("expected remote timestamp from ping target volume server")
|
||||
}
|
||||
|
||||
if _, err = grpcClient.VolumeServerLeave(ctx, &volume_server_pb.VolumeServerLeaveRequest{}); err != nil {
|
||||
@@ -405,21 +399,20 @@ func TestPingUnknownAndUnreachableTargetPaths(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
|
||||
// The volume server gates Ping on a known peer list. Unknown target types
|
||||
// and addresses outside that list are rejected with InvalidArgument
|
||||
// before any outbound dial is attempted.
|
||||
_, err := grpcClient.Ping(ctx, &volume_server_pb.PingRequest{
|
||||
unknownResp, err := grpcClient.Ping(ctx, &volume_server_pb.PingRequest{
|
||||
TargetType: "unknown-type",
|
||||
Target: "127.0.0.1:12345",
|
||||
})
|
||||
if err == nil {
|
||||
t.Fatalf("Ping unknown target type should be rejected by admission")
|
||||
if err != nil {
|
||||
t.Fatalf("Ping unknown target type should not return grpc error, got: %v", err)
|
||||
}
|
||||
if got := status.Code(err); got != codes.InvalidArgument {
|
||||
t.Fatalf("Ping unknown target type expected InvalidArgument, got %s: %v", got, err)
|
||||
if unknownResp.GetRemoteTimeNs() != 0 {
|
||||
t.Fatalf("Ping unknown target type expected remote_time_ns=0, got %d", unknownResp.GetRemoteTimeNs())
|
||||
}
|
||||
if unknownResp.GetStopTimeNs() < unknownResp.GetStartTimeNs() {
|
||||
t.Fatalf("Ping unknown target type expected stop_time_ns >= start_time_ns")
|
||||
}
|
||||
|
||||
// Empty target stays as an unauthenticated self-liveness probe.
|
||||
emptyTargetResp, err := grpcClient.Ping(ctx, &volume_server_pb.PingRequest{})
|
||||
if err != nil {
|
||||
t.Fatalf("Ping empty target should not return grpc error, got: %v", err)
|
||||
@@ -431,30 +424,26 @@ func TestPingUnknownAndUnreachableTargetPaths(t *testing.T) {
|
||||
t.Fatalf("Ping empty target expected stop_time_ns >= start_time_ns")
|
||||
}
|
||||
|
||||
// 127.0.0.1:1 is not in the seed/current master set, so admission rejects
|
||||
// the call before it can reach the network.
|
||||
_, err = grpcClient.Ping(ctx, &volume_server_pb.PingRequest{
|
||||
TargetType: cluster.MasterType,
|
||||
Target: "127.0.0.1:1",
|
||||
})
|
||||
if err == nil {
|
||||
t.Fatalf("Ping master target should be rejected when not in the known-peer set")
|
||||
t.Fatalf("Ping master target should fail when target is unreachable")
|
||||
}
|
||||
if got := status.Code(err); got != codes.InvalidArgument {
|
||||
t.Fatalf("Ping unknown master expected InvalidArgument, got %s: %v", got, err)
|
||||
if !strings.Contains(err.Error(), "ping master") {
|
||||
t.Fatalf("Ping master unreachable error mismatch: %v", err)
|
||||
}
|
||||
|
||||
// Volume servers do not carry a peer-filer list at all; any filer target
|
||||
// is rejected at admission regardless of reachability.
|
||||
_, err = grpcClient.Ping(ctx, &volume_server_pb.PingRequest{
|
||||
TargetType: cluster.FilerType,
|
||||
Target: "127.0.0.1:1",
|
||||
})
|
||||
if err == nil {
|
||||
t.Fatalf("Ping filer target should be rejected by admission")
|
||||
t.Fatalf("Ping filer target should fail when target is unreachable")
|
||||
}
|
||||
if got := status.Code(err); got != codes.InvalidArgument {
|
||||
t.Fatalf("Ping filer expected InvalidArgument, got %s: %v", got, err)
|
||||
if !strings.Contains(err.Error(), "ping filer") {
|
||||
t.Fatalf("Ping filer unreachable error mismatch: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,10 +479,6 @@ func TestPingFilerTargetSuccess(t *testing.T) {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
|
||||
// Volume servers do not maintain a peer-filer index, so drive the
|
||||
// filer-presence success path through the volume server's master peer:
|
||||
// reaching that master in a filer-bearing cluster is sufficient signal
|
||||
// that filer joined the cluster without breaking volume-server ping.
|
||||
clusterHarness := framework.StartSingleVolumeClusterWithFiler(t, matrix.P1())
|
||||
conn, grpcClient := framework.DialVolumeServer(t, clusterHarness.VolumeGRPCAddress())
|
||||
defer conn.Close()
|
||||
@@ -502,16 +487,16 @@ func TestPingFilerTargetSuccess(t *testing.T) {
|
||||
defer cancel()
|
||||
|
||||
resp, err := grpcClient.Ping(ctx, &volume_server_pb.PingRequest{
|
||||
TargetType: cluster.MasterType,
|
||||
Target: clusterHarness.MasterAddress(),
|
||||
TargetType: cluster.FilerType,
|
||||
Target: clusterHarness.FilerServerAddress(),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Ping master from filer-bearing cluster failed: %v", err)
|
||||
t.Fatalf("Ping filer target success path failed: %v", err)
|
||||
}
|
||||
if resp.GetRemoteTimeNs() == 0 {
|
||||
t.Fatalf("Ping master expected non-zero remote time")
|
||||
t.Fatalf("Ping filer target expected non-zero remote time")
|
||||
}
|
||||
if resp.GetStopTimeNs() < resp.GetStartTimeNs() {
|
||||
t.Fatalf("Ping master expected stop >= start, got start=%d stop=%d", resp.GetStartTimeNs(), resp.GetStopTimeNs())
|
||||
t.Fatalf("Ping filer target expected stop >= start, got start=%d stop=%d", resp.GetStartTimeNs(), resp.GetStopTimeNs())
|
||||
}
|
||||
}
|
||||
@@ -1,487 +0,0 @@
|
||||
package volume_server_grpc_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/test/volume_server/framework"
|
||||
"github.com/seaweedfs/seaweedfs/test/volume_server/matrix"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/storage/erasure_coding"
|
||||
)
|
||||
|
||||
// TestEcLifecycleAcrossMultipleDisks drives encode, mount, read, drop-dat,
|
||||
// cross-disk redistribute + restart + reconcile, blob delete, and rebuild on
|
||||
// a 2-disk volume server.
|
||||
func TestEcLifecycleAcrossMultipleDisks(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
|
||||
const (
|
||||
dataDirCount = 2
|
||||
volumeID = uint32(9500)
|
||||
collection = "ec-multi-disk"
|
||||
)
|
||||
|
||||
clusterHarness := framework.StartSingleVolumeClusterWithDataDirs(t, matrix.P1(), dataDirCount)
|
||||
dataDirs := clusterHarness.VolumeDataDirs()
|
||||
if len(dataDirs) != dataDirCount {
|
||||
t.Fatalf("expected %d data dirs, got %d: %v", dataDirCount, len(dataDirs), dataDirs)
|
||||
}
|
||||
|
||||
conn, grpcClient := framework.DialVolumeServer(t, clusterHarness.VolumeGRPCAddress())
|
||||
defer conn.Close()
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
|
||||
defer cancel()
|
||||
|
||||
framework.AllocateVolume(t, grpcClient, volumeID, collection)
|
||||
|
||||
// populate
|
||||
type needleSpec struct {
|
||||
fid string
|
||||
payload []byte
|
||||
}
|
||||
needles := []needleSpec{
|
||||
{framework.NewFileID(volumeID, 9501, 0xAA000001), bytesOfLen(11, 0xA1)},
|
||||
{framework.NewFileID(volumeID, 9502, 0xAA000002), bytesOfLen(1024, 0xA2)},
|
||||
{framework.NewFileID(volumeID, 9503, 0xAA000003), bytesOfLen(63*1024+17, 0xA3)},
|
||||
{framework.NewFileID(volumeID, 9504, 0xAA000004), bytesOfLen(2, 0xA4)},
|
||||
{framework.NewFileID(volumeID, 9505, 0xAA000005), bytesOfLen(513*1024, 0xA5)},
|
||||
}
|
||||
httpClient := framework.NewHTTPClient()
|
||||
for _, n := range needles {
|
||||
resp := framework.UploadBytes(t, httpClient, clusterHarness.VolumeAdminURL(), n.fid, n.payload)
|
||||
_ = framework.ReadAllAndClose(t, resp)
|
||||
if resp.StatusCode != http.StatusCreated {
|
||||
t.Fatalf("upload %s expected 201, got %d", n.fid, resp.StatusCode)
|
||||
}
|
||||
}
|
||||
|
||||
// encode — every shard lands on the .dat's disk
|
||||
if _, err := grpcClient.VolumeEcShardsGenerate(ctx, &volume_server_pb.VolumeEcShardsGenerateRequest{
|
||||
VolumeId: volumeID,
|
||||
Collection: collection,
|
||||
}); err != nil {
|
||||
t.Fatalf("VolumeEcShardsGenerate: %v", err)
|
||||
}
|
||||
postGenerateLayout := scanShardLayout(t, dataDirs, collection, volumeID)
|
||||
if len(postGenerateLayout[0]) != erasure_coding.TotalShardsCount {
|
||||
t.Fatalf("post-generate: expected all %d shards on disk 0, got per-disk layout %v",
|
||||
erasure_coding.TotalShardsCount, postGenerateLayout)
|
||||
}
|
||||
if len(postGenerateLayout[1]) != 0 {
|
||||
t.Fatalf("post-generate: disk 1 should be empty, got %v", postGenerateLayout[1])
|
||||
}
|
||||
// .ecj is created lazily on first EC delete
|
||||
for _, side := range []string{".ecx", ".vif"} {
|
||||
if !fileExistsIn(dataDirs[0], collection, volumeID, side) {
|
||||
t.Fatalf("post-generate: expected %s on disk 0", side)
|
||||
}
|
||||
}
|
||||
|
||||
// mount + read via EC
|
||||
if _, err := grpcClient.VolumeEcShardsMount(ctx, &volume_server_pb.VolumeEcShardsMountRequest{
|
||||
VolumeId: volumeID,
|
||||
Collection: collection,
|
||||
ShardIds: dataShardIds(),
|
||||
}); err != nil {
|
||||
t.Fatalf("VolumeEcShardsMount data shards: %v", err)
|
||||
}
|
||||
for _, n := range needles {
|
||||
verifyHTTPRead(t, httpClient, clusterHarness.VolumeAdminURL(), n.fid, n.payload, "after-mount")
|
||||
}
|
||||
|
||||
// drop the original volume so EC shards are the only source
|
||||
if _, err := grpcClient.VolumeDelete(ctx, &volume_server_pb.VolumeDeleteRequest{
|
||||
VolumeId: volumeID,
|
||||
}); err != nil {
|
||||
t.Fatalf("VolumeDelete (drop .dat): %v", err)
|
||||
}
|
||||
if fileExistsIn(dataDirs[0], collection, volumeID, ".dat") {
|
||||
t.Fatalf("VolumeDelete left .dat in place on disk 0")
|
||||
}
|
||||
for _, n := range needles {
|
||||
verifyHTTPRead(t, httpClient, clusterHarness.VolumeAdminURL(), n.fid, n.payload, "after-dat-delete")
|
||||
}
|
||||
|
||||
// move half the shards onto disk 1, leaving .ecx on disk 0
|
||||
clusterHarness.StopVolumeServer()
|
||||
const splitAt = 7
|
||||
for shard := 0; shard < splitAt; shard++ {
|
||||
movedFile(t, dataDirs[0], dataDirs[1], collection, volumeID, erasure_coding.ToExt(shard))
|
||||
}
|
||||
postMoveLayout := scanShardLayout(t, dataDirs, collection, volumeID)
|
||||
if len(postMoveLayout[0]) != erasure_coding.TotalShardsCount-splitAt {
|
||||
t.Fatalf("post-move: expected %d shards on disk 0, got %v", erasure_coding.TotalShardsCount-splitAt, postMoveLayout[0])
|
||||
}
|
||||
if len(postMoveLayout[1]) != splitAt {
|
||||
t.Fatalf("post-move: expected %d shards on disk 1, got %v", splitAt, postMoveLayout[1])
|
||||
}
|
||||
if !fileExistsIn(dataDirs[0], collection, volumeID, ".ecx") {
|
||||
t.Fatalf("post-move: .ecx must stay on disk 0 to exercise the cross-disk reconcile path")
|
||||
}
|
||||
if fileExistsIn(dataDirs[1], collection, volumeID, ".ecx") {
|
||||
t.Fatalf("post-move: .ecx leaked onto disk 1; reconcile path would not be exercised")
|
||||
}
|
||||
|
||||
clusterHarness.RestartVolumeServer()
|
||||
conn2, grpcClient2 := framework.DialVolumeServer(t, clusterHarness.VolumeGRPCAddress())
|
||||
defer conn2.Close()
|
||||
|
||||
// VolumeEcShardsInfo only sees one disk's EcVolume; filesystem layout is
|
||||
// the ground truth for the whole-store shard count.
|
||||
postReconcileLayout := scanShardLayout(t, dataDirs, collection, volumeID)
|
||||
if got, want := totalShardsInLayout(postReconcileLayout), erasure_coding.TotalShardsCount; got != want {
|
||||
t.Fatalf("post-reconcile: total shards on disk mismatch: got %d, want %d (layout=%v)", got, want, postReconcileLayout)
|
||||
}
|
||||
if got, want := len(postReconcileLayout[0]), erasure_coding.TotalShardsCount-splitAt; got != want {
|
||||
t.Fatalf("post-reconcile: disk 0 shard count drift: got %d, want %d (layout=%v)", got, want, postReconcileLayout)
|
||||
}
|
||||
if got, want := len(postReconcileLayout[1]), splitAt; got != want {
|
||||
t.Fatalf("post-reconcile: disk 1 shard count drift: got %d, want %d (layout=%v)", got, want, postReconcileLayout)
|
||||
}
|
||||
if _, err := grpcClient2.VolumeEcShardsInfo(ctx, &volume_server_pb.VolumeEcShardsInfoRequest{
|
||||
VolumeId: volumeID,
|
||||
}); err != nil {
|
||||
t.Fatalf("VolumeEcShardsInfo after redistribute restart: %v", err)
|
||||
}
|
||||
for _, n := range needles {
|
||||
verifyHTTPRead(t, httpClient, clusterHarness.VolumeAdminURL(), n.fid, n.payload, "after-cross-disk-reconcile")
|
||||
}
|
||||
|
||||
// blob delete on a cross-disk layout
|
||||
deletedNeedle := needles[2]
|
||||
deleteReq, err := http.NewRequest(http.MethodDelete, clusterHarness.VolumeAdminURL()+"/"+deletedNeedle.fid, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("build delete request: %v", err)
|
||||
}
|
||||
deleteResp := framework.DoRequest(t, httpClient, deleteReq)
|
||||
_ = framework.ReadAllAndClose(t, deleteResp)
|
||||
if deleteResp.StatusCode != http.StatusAccepted {
|
||||
t.Fatalf("HTTP DELETE %s expected 202, got %d", deletedNeedle.fid, deleteResp.StatusCode)
|
||||
}
|
||||
readResp := framework.ReadBytes(t, httpClient, clusterHarness.VolumeAdminURL(), deletedNeedle.fid)
|
||||
_ = framework.ReadAllAndClose(t, readResp)
|
||||
if readResp.StatusCode == http.StatusOK {
|
||||
t.Fatalf("HTTP GET on deleted EC needle expected non-200, got %d", readResp.StatusCode)
|
||||
}
|
||||
for _, n := range needles {
|
||||
if n.fid == deletedNeedle.fid {
|
||||
continue
|
||||
}
|
||||
verifyHTTPRead(t, httpClient, clusterHarness.VolumeAdminURL(), n.fid, n.payload, "after-blob-delete")
|
||||
}
|
||||
|
||||
// rebuild a shard whose inputs are split across two disks
|
||||
clusterHarness.StopVolumeServer()
|
||||
const repairTargetShard = 9 // sits on disk 0 after the split
|
||||
shardPath := filepath.Join(dataDirs[0], shardFileName(collection, volumeID, repairTargetShard))
|
||||
if _, statErr := os.Stat(shardPath); statErr != nil {
|
||||
t.Fatalf("repair setup: shard %d not on disk 0 (%s): %v", repairTargetShard, shardPath, statErr)
|
||||
}
|
||||
if err := os.Remove(shardPath); err != nil {
|
||||
t.Fatalf("repair setup: remove shard %d on disk 0: %v", repairTargetShard, err)
|
||||
}
|
||||
clusterHarness.RestartVolumeServer()
|
||||
conn3, grpcClient3 := framework.DialVolumeServer(t, clusterHarness.VolumeGRPCAddress())
|
||||
defer conn3.Close()
|
||||
|
||||
rebuildResp, err := grpcClient3.VolumeEcShardsRebuild(ctx, &volume_server_pb.VolumeEcShardsRebuildRequest{
|
||||
VolumeId: volumeID,
|
||||
Collection: collection,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("VolumeEcShardsRebuild after cross-disk shard loss: %v", err)
|
||||
}
|
||||
if !containsUint32(rebuildResp.GetRebuiltShardIds(), repairTargetShard) {
|
||||
t.Fatalf("VolumeEcShardsRebuild expected to rebuild shard %d, got %v",
|
||||
repairTargetShard, rebuildResp.GetRebuiltShardIds())
|
||||
}
|
||||
if _, statErr := os.Stat(shardPath); statErr != nil {
|
||||
t.Fatalf("rebuild did not restore shard %d on disk 0 (%s): %v", repairTargetShard, shardPath, statErr)
|
||||
}
|
||||
|
||||
if _, err := grpcClient3.VolumeEcShardsMount(ctx, &volume_server_pb.VolumeEcShardsMountRequest{
|
||||
VolumeId: volumeID,
|
||||
Collection: collection,
|
||||
ShardIds: []uint32{repairTargetShard},
|
||||
}); err != nil {
|
||||
t.Fatalf("VolumeEcShardsMount rebuilt shard %d: %v", repairTargetShard, err)
|
||||
}
|
||||
for _, n := range needles {
|
||||
if n.fid == deletedNeedle.fid {
|
||||
continue
|
||||
}
|
||||
verifyHTTPRead(t, httpClient, clusterHarness.VolumeAdminURL(), n.fid, n.payload, "after-repair")
|
||||
}
|
||||
}
|
||||
|
||||
// TestEcPartialShardsOnSiblingDiskCleanedUpOnRestart seeds a healthy .dat on
|
||||
// disk 0, plants the on-disk footprint of an interrupted EC encode on disk 1
|
||||
// (one shard plus .ecx / .ecj / .vif, no .dat), and asserts the startup prune
|
||||
// wipes disk 1 without touching disk 0.
|
||||
func TestEcPartialShardsOnSiblingDiskCleanedUpOnRestart(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
|
||||
const (
|
||||
dataDirCount = 2
|
||||
volumeID = uint32(9501)
|
||||
collection = "ec-9478"
|
||||
partialShard = 1
|
||||
)
|
||||
|
||||
clusterHarness := framework.StartSingleVolumeClusterWithDataDirs(t, matrix.P1(), dataDirCount)
|
||||
dataDirs := clusterHarness.VolumeDataDirs()
|
||||
if len(dataDirs) != dataDirCount {
|
||||
t.Fatalf("expected %d data dirs, got %d: %v", dataDirCount, len(dataDirs), dataDirs)
|
||||
}
|
||||
|
||||
conn, grpcClient := framework.DialVolumeServer(t, clusterHarness.VolumeGRPCAddress())
|
||||
defer conn.Close()
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
framework.AllocateVolume(t, grpcClient, volumeID, collection)
|
||||
|
||||
httpClient := framework.NewHTTPClient()
|
||||
needleFid := framework.NewFileID(volumeID, 7777, 0xCAFEBABE)
|
||||
needlePayload := bytesOfLen(4096, 0xC7)
|
||||
upResp := framework.UploadBytes(t, httpClient, clusterHarness.VolumeAdminURL(), needleFid, needlePayload)
|
||||
_ = framework.ReadAllAndClose(t, upResp)
|
||||
if upResp.StatusCode != http.StatusCreated {
|
||||
t.Fatalf("seed upload expected 201, got %d", upResp.StatusCode)
|
||||
}
|
||||
|
||||
datPath := filepath.Join(dataDirs[0], datFileName(collection, volumeID))
|
||||
datInfo, err := os.Stat(datPath)
|
||||
if err != nil {
|
||||
t.Fatalf("seed setup: .dat must exist on disk 0 (%s): %v", datPath, err)
|
||||
}
|
||||
// prune's size guard refuses cleanup if the sibling .dat looks truncated
|
||||
if datInfo.Size() == 0 {
|
||||
t.Fatalf("seed setup: .dat on disk 0 is zero bytes")
|
||||
}
|
||||
|
||||
clusterHarness.StopVolumeServer()
|
||||
plantPartialEc(t, dataDirs[1], collection, volumeID, partialShard, datInfo.Size())
|
||||
|
||||
preRestartLayout := scanShardLayout(t, dataDirs, collection, volumeID)
|
||||
if len(preRestartLayout[0]) != 0 {
|
||||
t.Fatalf("seed setup: disk 0 should hold no EC shards before restart, got %v", preRestartLayout[0])
|
||||
}
|
||||
if len(preRestartLayout[1]) != 1 {
|
||||
t.Fatalf("seed setup: disk 1 should hold exactly one planted shard, got %v", preRestartLayout[1])
|
||||
}
|
||||
|
||||
clusterHarness.RestartVolumeServer()
|
||||
|
||||
conn2, grpcClient2 := framework.DialVolumeServer(t, clusterHarness.VolumeGRPCAddress())
|
||||
defer conn2.Close()
|
||||
|
||||
// the volume admin port answers before the startup prune finishes
|
||||
postPruneLayout := waitForLayout(t, dataDirs, collection, volumeID, func(layout map[int][]int) bool {
|
||||
return len(layout[1]) == 0
|
||||
}, 10*time.Second)
|
||||
|
||||
if len(postPruneLayout[1]) != 0 {
|
||||
t.Fatalf("partial EC shards survived restart on disk 1: %v", postPruneLayout[1])
|
||||
}
|
||||
// .vif is intentionally left behind: with no .ecx / shard to anchor it,
|
||||
// the next startup ignores it.
|
||||
for _, side := range []string{".ecx", ".ecj"} {
|
||||
if fileExistsIn(dataDirs[1], collection, volumeID, side) {
|
||||
t.Fatalf("%s survived prune on disk 1", side)
|
||||
}
|
||||
}
|
||||
if !fileExistsIn(dataDirs[0], collection, volumeID, ".dat") {
|
||||
t.Fatalf("prune wiped the healthy .dat on disk 0")
|
||||
}
|
||||
if !fileExistsIn(dataDirs[0], collection, volumeID, ".idx") {
|
||||
t.Fatalf("prune wiped the healthy .idx on disk 0")
|
||||
}
|
||||
if _, err = grpcClient2.VolumeEcShardsInfo(ctx, &volume_server_pb.VolumeEcShardsInfoRequest{
|
||||
VolumeId: volumeID,
|
||||
}); err == nil {
|
||||
t.Fatalf("VolumeEcShardsInfo returned success after prune; the partial EC mount should be gone")
|
||||
}
|
||||
verifyHTTPRead(t, httpClient, clusterHarness.VolumeAdminURL(), needleFid, needlePayload, "after-prune")
|
||||
}
|
||||
|
||||
func bytesOfLen(n int, seed byte) []byte {
|
||||
out := make([]byte, n)
|
||||
for i := range out {
|
||||
out[i] = byte(int(seed) + i*31)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func dataShardIds() []uint32 {
|
||||
ids := make([]uint32, erasure_coding.DataShardsCount)
|
||||
for i := range ids {
|
||||
ids[i] = uint32(i)
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
func datFileName(collection string, volumeID uint32) string {
|
||||
if collection == "" {
|
||||
return fmt.Sprintf("%d.dat", volumeID)
|
||||
}
|
||||
return fmt.Sprintf("%s_%d.dat", collection, volumeID)
|
||||
}
|
||||
|
||||
func shardFileName(collection string, volumeID uint32, shardID int) string {
|
||||
if collection == "" {
|
||||
return fmt.Sprintf("%d%s", volumeID, erasure_coding.ToExt(shardID))
|
||||
}
|
||||
return fmt.Sprintf("%s_%d%s", collection, volumeID, erasure_coding.ToExt(shardID))
|
||||
}
|
||||
|
||||
func sideFileName(collection string, volumeID uint32, ext string) string {
|
||||
if collection == "" {
|
||||
return fmt.Sprintf("%d%s", volumeID, ext)
|
||||
}
|
||||
return fmt.Sprintf("%s_%d%s", collection, volumeID, ext)
|
||||
}
|
||||
|
||||
func fileExistsIn(dir, collection string, volumeID uint32, ext string) bool {
|
||||
_, err := os.Stat(filepath.Join(dir, sideFileName(collection, volumeID, ext)))
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func scanShardLayout(t testing.TB, dataDirs []string, collection string, volumeID uint32) map[int][]int {
|
||||
t.Helper()
|
||||
out := make(map[int][]int, len(dataDirs))
|
||||
for diskIdx, dir := range dataDirs {
|
||||
out[diskIdx] = nil
|
||||
for shard := 0; shard < erasure_coding.TotalShardsCount; shard++ {
|
||||
if _, err := os.Stat(filepath.Join(dir, shardFileName(collection, volumeID, shard))); err == nil {
|
||||
out[diskIdx] = append(out[diskIdx], shard)
|
||||
}
|
||||
}
|
||||
sort.Ints(out[diskIdx])
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func waitForLayout(t testing.TB, dataDirs []string, collection string, volumeID uint32, pred func(map[int][]int) bool, timeout time.Duration) map[int][]int {
|
||||
t.Helper()
|
||||
deadline := time.Now().Add(timeout)
|
||||
var layout map[int][]int
|
||||
for time.Now().Before(deadline) {
|
||||
layout = scanShardLayout(t, dataDirs, collection, volumeID)
|
||||
if pred(layout) {
|
||||
return layout
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
return layout
|
||||
}
|
||||
|
||||
func movedFile(t testing.TB, fromDir, toDir, collection string, volumeID uint32, ext string) {
|
||||
t.Helper()
|
||||
name := sideFileName(collection, volumeID, ext)
|
||||
src := filepath.Join(fromDir, name)
|
||||
dst := filepath.Join(toDir, name)
|
||||
if err := os.Rename(src, dst); err != nil {
|
||||
t.Fatalf("move %s → %s: %v", src, dst, err)
|
||||
}
|
||||
}
|
||||
|
||||
func totalShardsInLayout(layout map[int][]int) int {
|
||||
n := 0
|
||||
for _, ids := range layout {
|
||||
n += len(ids)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func containsUint32(s []uint32, v uint32) bool {
|
||||
for _, x := range s {
|
||||
if x == v {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func verifyHTTPRead(t testing.TB, client *http.Client, base, fid string, want []byte, stage string) {
|
||||
t.Helper()
|
||||
resp := framework.ReadBytes(t, client, base, fid)
|
||||
body := framework.ReadAllAndClose(t, resp)
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
t.Fatalf("[%s] GET %s expected 200, got %d", stage, fid, resp.StatusCode)
|
||||
}
|
||||
if len(body) != len(want) {
|
||||
t.Fatalf("[%s] GET %s size mismatch: got %d, want %d", stage, fid, len(body), len(want))
|
||||
}
|
||||
for i := range want {
|
||||
if body[i] != want[i] {
|
||||
t.Fatalf("[%s] GET %s byte %d mismatch: got %d, want %d", stage, fid, i, body[i], want[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// plantPartialEc writes the footprint of an interrupted EC encode (one shard
|
||||
// sized for datFileSize, plus .ecx / .ecj / .vif, no .dat) into dir.
|
||||
func plantPartialEc(t testing.TB, dir, collection string, volumeID uint32, shardID int, datFileSize int64) {
|
||||
t.Helper()
|
||||
shardPath := filepath.Join(dir, shardFileName(collection, volumeID, shardID))
|
||||
if f, err := os.Create(shardPath); err == nil {
|
||||
expectedShardSize := plantedShardSize(datFileSize)
|
||||
if err := f.Truncate(expectedShardSize); err != nil {
|
||||
f.Close()
|
||||
t.Fatalf("truncate planted shard: %v", err)
|
||||
}
|
||||
f.Close()
|
||||
} else {
|
||||
t.Fatalf("create planted shard %s: %v", shardPath, err)
|
||||
}
|
||||
for _, side := range []struct {
|
||||
ext string
|
||||
content []byte
|
||||
}{
|
||||
{".ecx", []byte("dummy ecx")},
|
||||
{".ecj", nil},
|
||||
{".vif", nil},
|
||||
} {
|
||||
p := filepath.Join(dir, sideFileName(collection, volumeID, side.ext))
|
||||
f, err := os.Create(p)
|
||||
if err != nil {
|
||||
t.Fatalf("create planted %s: %v", side.ext, err)
|
||||
}
|
||||
if side.content != nil {
|
||||
if _, err := f.Write(side.content); err != nil {
|
||||
f.Close()
|
||||
t.Fatalf("write planted %s: %v", side.ext, err)
|
||||
}
|
||||
}
|
||||
f.Close()
|
||||
}
|
||||
}
|
||||
|
||||
// mirrors calculateExpectedShardSize in weed/storage/disk_location_ec.go
|
||||
func plantedShardSize(datFileSize int64) int64 {
|
||||
const dataShards = int64(erasure_coding.DataShardsCount)
|
||||
largeBatch := int64(erasure_coding.ErasureCodingLargeBlockSize) * dataShards
|
||||
numLarge := datFileSize / largeBatch
|
||||
shardSize := numLarge * int64(erasure_coding.ErasureCodingLargeBlockSize)
|
||||
remaining := datFileSize - numLarge*largeBatch
|
||||
if remaining > 0 {
|
||||
smallBatch := int64(erasure_coding.ErasureCodingSmallBlockSize) * dataShards
|
||||
numSmall := (remaining + smallBatch - 1) / smallBatch
|
||||
shardSize += numSmall * int64(erasure_coding.ErasureCodingSmallBlockSize)
|
||||
}
|
||||
return shardSize
|
||||
}
|
||||
@@ -138,38 +138,6 @@ func (cluster *Cluster) ListClusterNode(filerGroup FilerGroupName, nodeType stri
|
||||
return
|
||||
}
|
||||
|
||||
// IsKnownNode reports whether address is currently registered under nodeType
|
||||
// in any filer group. The lookup is intentionally group-agnostic because callers
|
||||
// (e.g. Ping admission) only know the target address, not the group it joined.
|
||||
func (cluster *Cluster) IsKnownNode(nodeType string, address pb.ServerAddress) bool {
|
||||
var groups *ClusterNodeGroups
|
||||
switch nodeType {
|
||||
case FilerType:
|
||||
groups = cluster.filerGroups
|
||||
case BrokerType:
|
||||
groups = cluster.brokerGroups
|
||||
case S3Type:
|
||||
groups = cluster.s3Groups
|
||||
default:
|
||||
return false
|
||||
}
|
||||
groups.RLock()
|
||||
defer groups.RUnlock()
|
||||
for _, members := range groups.groupMembers {
|
||||
if _, found := members.members[address]; found {
|
||||
return true
|
||||
}
|
||||
// fall back to a port-tolerant comparison so callers that omit the
|
||||
// grpc-port suffix still match a registered peer
|
||||
for stored := range members.members {
|
||||
if stored.Equals(address) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func buildClusterNodeUpdateMessage(isAdd bool, filerGroup FilerGroupName, nodeType string, address pb.ServerAddress) (result []*master_pb.KeepConnectedResponse) {
|
||||
result = append(result, &master_pb.KeepConnectedResponse{
|
||||
ClusterNodeUpdate: &master_pb.ClusterNodeUpdate{
|
||||
|
||||
@@ -39,28 +39,3 @@ func TestConcurrentAddRemoveNodes(t *testing.T) {
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
func TestIsKnownNode(t *testing.T) {
|
||||
c := NewCluster()
|
||||
filer := pb.ServerAddress("10.0.0.20:8888")
|
||||
c.AddClusterNode("", FilerType, "dc1", "rack1", filer, "test")
|
||||
|
||||
if !c.IsKnownNode(FilerType, filer) {
|
||||
t.Fatalf("registered filer %s should be known", filer)
|
||||
}
|
||||
if c.IsKnownNode(VolumeServerType, filer) {
|
||||
t.Fatalf("filer address must not be accepted as a volume server target")
|
||||
}
|
||||
if c.IsKnownNode(FilerType, pb.ServerAddress("127.0.0.1:1")) {
|
||||
t.Fatalf("unregistered low-port target must be rejected")
|
||||
}
|
||||
if c.IsKnownNode(FilerType, pb.ServerAddress("127.0.0.1:65000")) {
|
||||
t.Fatalf("unregistered high-port target must be rejected")
|
||||
}
|
||||
if c.IsKnownNode(FilerType, pb.ServerAddress("example.com:443")) {
|
||||
t.Fatalf("unrelated host must be rejected")
|
||||
}
|
||||
if c.IsKnownNode("garbage", filer) {
|
||||
t.Fatalf("unknown node type must be rejected")
|
||||
}
|
||||
}
|
||||
+4
-15
@@ -431,22 +431,11 @@ func (fo *FilerOptions) startFiler() {
|
||||
grpcS := pb.NewGrpcServer(security.LoadServerTLS(util.GetViper(), "grpc.filer"))
|
||||
filer_pb.RegisterSeaweedFilerServer(grpcS, fs)
|
||||
|
||||
// Register IAM gRPC service only when both a credential manager and an
|
||||
// admin signing key are configured. The IAM RPCs can create users and
|
||||
// mint access keys; mounting them on an unauthenticated listener would
|
||||
// hand any caller that can reach the gRPC port S3-admin equivalent power.
|
||||
// Operators who relied on the unauthenticated path must now set
|
||||
// jwt.filer_signing.key in security.toml and attach a Bearer token signed
|
||||
// with that key on every IAM call.
|
||||
// Register IAM gRPC service if credential manager is available
|
||||
if credentialManager != nil {
|
||||
adminSigningKey := security.SigningKey(util.GetViper().GetString("jwt.filer_signing.key"))
|
||||
if len(adminSigningKey) == 0 {
|
||||
glog.Warningf("IAM gRPC service NOT registered on filer: jwt.filer_signing.key is empty in security.toml; configure it to enable IAM administration")
|
||||
} else {
|
||||
iamGrpcServer := weed_server.NewIamGrpcServer(credentialManager, adminSigningKey)
|
||||
iam_pb.RegisterSeaweedIdentityAccessManagementServer(grpcS, iamGrpcServer)
|
||||
glog.V(0).Info("Registered IAM gRPC service on filer (admin Bearer token required)")
|
||||
}
|
||||
iamGrpcServer := weed_server.NewIamGrpcServer(credentialManager)
|
||||
iam_pb.RegisterSeaweedIdentityAccessManagementServer(grpcS, iamGrpcServer)
|
||||
glog.V(0).Info("Registered IAM gRPC service on filer")
|
||||
}
|
||||
|
||||
reflection.Register(grpcS)
|
||||
|
||||
@@ -346,7 +346,6 @@ func initMiniVolumeFlags() {
|
||||
miniOptions.v.inflightDownloadDataTimeout = cmdMini.Flag.Duration("volume.inflightDownloadDataTimeout", 60*time.Second, "inflight download data wait timeout")
|
||||
miniOptions.v.hasSlowRead = cmdMini.Flag.Bool("volume.hasSlowRead", true, "if true, prevents slow reads from blocking other requests")
|
||||
miniOptions.v.readBufferSizeMB = cmdMini.Flag.Int("volume.readBufferSizeMB", 4, "read buffer size in MB")
|
||||
miniOptions.v.allowUntrustedRemoteEndpoints = cmdMini.Flag.Bool("volume.allowUntrustedRemoteEndpoints", false, "if true, FetchAndWriteNeedle accepts arbitrary remote S3 endpoints including loopback / link-local hosts. Default rejects internal / metadata endpoints.")
|
||||
miniOptions.v.preStopSeconds = cmdMini.Flag.Int("volume.preStopSeconds", 1, "number of seconds between stop send heartbeats and stop volume server (default: 1 for mini)")
|
||||
}
|
||||
|
||||
|
||||
@@ -44,11 +44,6 @@ expires_after_seconds = 10 # seconds
|
||||
# - f.e. the S3 API Shim generates the JWT
|
||||
# - the Filer server validates the JWT on writing
|
||||
# NOTE: This key is ALSO used as a fallback signing key for S3 STS if s3.iam.config does not specify a signingKey.
|
||||
# NOTE: This key is ALSO required to mount the IAM gRPC service (CreateUser,
|
||||
# PutPolicy, CreateAccessKey, ...) on the filer. The filer refuses to
|
||||
# register that service when the key is empty, and every IAM RPC must
|
||||
# carry a Bearer token signed with this key in its "authorization"
|
||||
# gRPC metadata. Mint such a token with security.GenJwtForFilerAdmin.
|
||||
# the jwt defaults to expire after 10 seconds.
|
||||
[jwt.filer_signing]
|
||||
key = ""
|
||||
|
||||
@@ -155,7 +155,6 @@ func init() {
|
||||
|
||||
serverOptions.v.hasSlowRead = cmdServer.Flag.Bool("volume.hasSlowRead", true, "<experimental> if true, this prevents slow reads from blocking other requests, but large file read P99 latency will increase.")
|
||||
serverOptions.v.readBufferSizeMB = cmdServer.Flag.Int("volume.readBufferSizeMB", 4, "<experimental> larger values can optimize query performance but will increase some memory usage,Use with hasSlowRead normally")
|
||||
serverOptions.v.allowUntrustedRemoteEndpoints = cmdServer.Flag.Bool("volume.allowUntrustedRemoteEndpoints", false, "if true, FetchAndWriteNeedle accepts arbitrary remote S3 endpoints including loopback / link-local hosts. Default rejects internal / metadata endpoints.")
|
||||
|
||||
s3Options.port = cmdServer.Flag.Int("s3.port", 8333, "s3 server http listen port")
|
||||
s3Options.portHttps = cmdServer.Flag.Int("s3.port.https", 0, "s3 server https listen port")
|
||||
|
||||
+7
-10
@@ -70,14 +70,13 @@ type VolumeServerOptions struct {
|
||||
metricsHttpPort *int
|
||||
metricsHttpIp *string
|
||||
// pulseSeconds *int
|
||||
inflightUploadDataTimeout *time.Duration
|
||||
inflightDownloadDataTimeout *time.Duration
|
||||
hasSlowRead *bool
|
||||
readBufferSizeMB *int
|
||||
ldbTimeout *int64
|
||||
allowUntrustedRemoteEndpoints *bool
|
||||
debug *bool
|
||||
debugPort *int
|
||||
inflightUploadDataTimeout *time.Duration
|
||||
inflightDownloadDataTimeout *time.Duration
|
||||
hasSlowRead *bool
|
||||
readBufferSizeMB *int
|
||||
ldbTimeout *int64
|
||||
debug *bool
|
||||
debugPort *int
|
||||
// shutdownCtx, when non-nil, tells startVolumeServer to shut down once the
|
||||
// ctx is cancelled. Used by integration tests and by weed mini; nil for
|
||||
// standalone weed volume.
|
||||
@@ -121,7 +120,6 @@ func init() {
|
||||
v.inflightDownloadDataTimeout = cmdVolume.Flag.Duration("inflightDownloadDataTimeout", 60*time.Second, "inflight download data wait timeout of volume servers")
|
||||
v.hasSlowRead = cmdVolume.Flag.Bool("hasSlowRead", true, "<experimental> if true, this prevents slow reads from blocking other requests, but large file read P99 latency will increase.")
|
||||
v.readBufferSizeMB = cmdVolume.Flag.Int("readBufferSizeMB", 4, "<experimental> larger values can optimize query performance but will increase some memory usage,Use with hasSlowRead normally.")
|
||||
v.allowUntrustedRemoteEndpoints = cmdVolume.Flag.Bool("volume.allowUntrustedRemoteEndpoints", false, "if true, FetchAndWriteNeedle accepts arbitrary remote S3 endpoints including loopback / link-local hosts. Default rejects internal / metadata endpoints.")
|
||||
v.debug = cmdVolume.Flag.Bool("debug", false, "serves runtime profiling data via pprof on the port specified by -debug.port")
|
||||
v.debugPort = cmdVolume.Flag.Int("debug.port", 6060, "http port for debugging")
|
||||
}
|
||||
@@ -304,7 +302,6 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, v
|
||||
*v.hasSlowRead,
|
||||
*v.readBufferSizeMB,
|
||||
*v.ldbTimeout,
|
||||
*v.allowUntrustedRemoteEndpoints,
|
||||
)
|
||||
// starting grpc server
|
||||
grpcS := v.startGrpcService(volumeServer)
|
||||
|
||||
@@ -87,23 +87,6 @@ func (ma *MetaAggregator) HasRemotePeers() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// HasPeer reports whether address is currently a tracked filer peer (or this
|
||||
// filer's own address). Callers use this to gate operations on known cluster
|
||||
// members.
|
||||
func (ma *MetaAggregator) HasPeer(address pb.ServerAddress) bool {
|
||||
if address == ma.self || address.Equals(ma.self) {
|
||||
return true
|
||||
}
|
||||
ma.peerChansLock.Lock()
|
||||
defer ma.peerChansLock.Unlock()
|
||||
for peer := range ma.peerChans {
|
||||
if peer == address || peer.Equals(address) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (ma *MetaAggregator) loopSubscribeToOneFiler(f *Filer, self pb.ServerAddress, peer pb.ServerAddress, startFrom time.Time, stopChan chan struct{}) {
|
||||
lastTsNs := startFrom.UnixNano()
|
||||
for {
|
||||
|
||||
@@ -63,46 +63,27 @@ func (b *MessageQueueBroker) ConfigureTopic(ctx context.Context, request *mq_pb.
|
||||
schemaChanged = true
|
||||
}
|
||||
|
||||
// Check if retention needs to be updated. Callers that do not want to
|
||||
// touch retention send Retention=nil; we only consider it a change
|
||||
// when the request supplies a non-nil Retention that differs from
|
||||
// the stored value.
|
||||
retentionChanged := request.Retention != nil && !proto.Equal(request.Retention, resp.Retention)
|
||||
|
||||
if !schemaChanged && !retentionChanged {
|
||||
if !schemaChanged {
|
||||
glog.V(0).Infof("existing topic partitions %d: %+v", len(resp.BrokerPartitionAssignments), resp.BrokerPartitionAssignments)
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
if schemaChanged {
|
||||
resp.MessageRecordType = request.MessageRecordType
|
||||
resp.KeyColumns = request.KeyColumns
|
||||
resp.SchemaFormat = request.SchemaFormat
|
||||
}
|
||||
if retentionChanged {
|
||||
resp.Retention = request.Retention
|
||||
}
|
||||
// Update schema in existing configuration
|
||||
resp.MessageRecordType = request.MessageRecordType
|
||||
resp.KeyColumns = request.KeyColumns
|
||||
resp.SchemaFormat = request.SchemaFormat
|
||||
|
||||
if err := b.fca.SaveTopicConfToFiler(t, resp); err != nil {
|
||||
return nil, fmt.Errorf("update topic conf: %w", err)
|
||||
return nil, fmt.Errorf("update topic schemas: %w", err)
|
||||
}
|
||||
|
||||
// Invalidate topic cache since we just updated the topic
|
||||
b.invalidateTopicCache(t)
|
||||
|
||||
glog.V(0).Infof("updated topic %s (schema=%v retention=%v)", request.Topic, schemaChanged, retentionChanged)
|
||||
glog.V(0).Infof("updated schemas for topic %s", request.Topic)
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// Capture the prior retention before we overwrite resp so partition-count
|
||||
// changes (or first-time creates that hit this path after a partial
|
||||
// readErr) don't accidentally clear an existing retention configuration
|
||||
// when the request omits Retention.
|
||||
var prevRetention *mq_pb.TopicRetention
|
||||
if resp != nil {
|
||||
prevRetention = resp.Retention
|
||||
}
|
||||
|
||||
if resp != nil && len(resp.BrokerPartitionAssignments) > 0 {
|
||||
if cancelErr := b.assignTopicPartitionsToBrokers(ctx, request.Topic, resp.BrokerPartitionAssignments, false); cancelErr != nil {
|
||||
glog.V(1).Infof("cancel old topic %s partitions assignments %v : %v", request.Topic, resp.BrokerPartitionAssignments, cancelErr)
|
||||
@@ -117,11 +98,7 @@ func (b *MessageQueueBroker) ConfigureTopic(ctx context.Context, request *mq_pb.
|
||||
resp.MessageRecordType = request.MessageRecordType
|
||||
resp.KeyColumns = request.KeyColumns
|
||||
resp.SchemaFormat = request.SchemaFormat
|
||||
if request.Retention != nil {
|
||||
resp.Retention = request.Retention
|
||||
} else {
|
||||
resp.Retention = prevRetention
|
||||
}
|
||||
resp.Retention = request.Retention
|
||||
|
||||
// save the topic configuration on filer
|
||||
if err := b.fca.SaveTopicConfToFiler(t, resp); err != nil {
|
||||
|
||||
@@ -519,6 +519,23 @@ func (h *Handler) parseLeaveGroupRequest(data []byte, apiVersion uint16) (*Leave
|
||||
return req, nil
|
||||
}
|
||||
|
||||
func (h *Handler) buildHeartbeatResponse(response HeartbeatResponse) []byte {
|
||||
result := make([]byte, 0, 12)
|
||||
|
||||
// NOTE: Correlation ID is handled by writeResponseWithCorrelationID
|
||||
// Do NOT include it in the response body
|
||||
|
||||
// Error code (2 bytes)
|
||||
errorCodeBytes := make([]byte, 2)
|
||||
binary.BigEndian.PutUint16(errorCodeBytes, uint16(response.ErrorCode))
|
||||
result = append(result, errorCodeBytes...)
|
||||
|
||||
// Throttle time (4 bytes, 0 = no throttling)
|
||||
result = append(result, 0, 0, 0, 0)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func (h *Handler) buildHeartbeatResponseV(response HeartbeatResponse, apiVersion uint16) []byte {
|
||||
isFlexible := IsFlexibleVersion(12, apiVersion) // Heartbeat API key = 12
|
||||
result := make([]byte, 0, 16)
|
||||
@@ -700,6 +717,15 @@ func (h *Handler) buildLeaveGroupFullResponse(response LeaveGroupResponse) []byt
|
||||
return result
|
||||
}
|
||||
|
||||
func (h *Handler) buildHeartbeatErrorResponse(correlationID uint32, errorCode int16) []byte {
|
||||
response := HeartbeatResponse{
|
||||
CorrelationID: correlationID,
|
||||
ErrorCode: errorCode,
|
||||
}
|
||||
|
||||
return h.buildHeartbeatResponse(response)
|
||||
}
|
||||
|
||||
func (h *Handler) buildHeartbeatErrorResponseV(correlationID uint32, errorCode int16, apiVersion uint16) []byte {
|
||||
response := HeartbeatResponse{
|
||||
CorrelationID: correlationID,
|
||||
|
||||
@@ -286,6 +286,8 @@ type Handler struct {
|
||||
inferredRecordTypes map[string]*schema_pb.RecordType
|
||||
inferredRecordTypesMu sync.RWMutex
|
||||
|
||||
filerClient filer_pb.SeaweedFilerClient
|
||||
|
||||
// SMQ broker addresses discovered from masters for Metadata responses
|
||||
smqBrokerAddresses []string
|
||||
|
||||
|
||||
@@ -98,6 +98,16 @@ func TestOffsetFetchAfterCommit(t *testing.T) {
|
||||
t.Skip("Integration test - requires mock broker setup")
|
||||
|
||||
t.Run("FetchAfterCommit", func(t *testing.T) {
|
||||
type FetchRequest struct {
|
||||
partition int32
|
||||
offset int64
|
||||
}
|
||||
|
||||
type FetchResponse struct {
|
||||
records []byte
|
||||
nextOffset int64
|
||||
}
|
||||
|
||||
// Simulate: Commit offset 163, then fetch offset 164
|
||||
committedOffset := int64(163)
|
||||
nextFetchOffset := committedOffset + 1
|
||||
@@ -203,8 +213,10 @@ func TestLongPollWithOffsetCommit(t *testing.T) {
|
||||
// Critical: long-poll duration should NOT be reported as throttleTimeMs
|
||||
// This was bug 8969b4509
|
||||
|
||||
const maxWaitTime = 5 * time.Second
|
||||
|
||||
// Simulate long-poll wait (no data available)
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
time.Sleep(100 * time.Millisecond) // Broker waits up to maxWaitTime
|
||||
|
||||
// throttleTimeMs should be 0 (NOT elapsed duration!)
|
||||
throttleTimeMs := int32(0) // CORRECT
|
||||
|
||||
@@ -100,6 +100,16 @@ func TestCurrentTestingApproach(t *testing.T) {
|
||||
t.Log(" This is why JoinGroup issue wasn't caught by unit tests")
|
||||
}
|
||||
|
||||
// parseCompactArray is a helper that would be needed for field-level testing
|
||||
func parseCompactArray(data []byte) int {
|
||||
// Compact array encoding: varint length (length+1 for non-null, 0 for null)
|
||||
length := int(data[0])
|
||||
if length == 0 {
|
||||
return -1 // null
|
||||
}
|
||||
return length - 1 // actual length
|
||||
}
|
||||
|
||||
// Example of a REAL field-level test we could write
|
||||
func TestMetadataResponseHasBrokers(t *testing.T) {
|
||||
t.Skip("Example of what a real field-level test would look like")
|
||||
|
||||
@@ -36,14 +36,6 @@ func (s s3RemoteStorageMaker) HasBucket() bool {
|
||||
}
|
||||
|
||||
func (s s3RemoteStorageMaker) Make(conf *remote_pb.RemoteConf) (remote_storage.RemoteStorageClient, error) {
|
||||
return MakeWithHTTPClient(conf, nil)
|
||||
}
|
||||
|
||||
// MakeWithHTTPClient builds an s3 remote storage client using the supplied
|
||||
// *http.Client (or the AWS SDK default when nil). Callers that need to pin
|
||||
// the dial path against DNS rebinding can pass a client whose transport has
|
||||
// a guarded DialContext.
|
||||
func MakeWithHTTPClient(conf *remote_pb.RemoteConf, httpClient *http.Client) (remote_storage.RemoteStorageClient, error) {
|
||||
client := &s3RemoteStorageClient{
|
||||
supportTagging: true,
|
||||
conf: conf,
|
||||
@@ -54,9 +46,6 @@ func MakeWithHTTPClient(conf *remote_pb.RemoteConf, httpClient *http.Client) (re
|
||||
S3ForcePathStyle: aws.Bool(conf.S3ForcePathStyle),
|
||||
S3DisableContentMD5Validation: aws.Bool(true),
|
||||
}
|
||||
if httpClient != nil {
|
||||
config.HTTPClient = httpClient
|
||||
}
|
||||
if conf.S3AccessKey != "" && conf.S3SecretKey != "" {
|
||||
config.Credentials = credentials.NewStaticCredentials(conf.S3AccessKey, conf.S3SecretKey, "")
|
||||
} else if conf.S3AccessKey == "" && conf.S3SecretKey == "" {
|
||||
|
||||
@@ -77,7 +77,7 @@ func (s3a *S3ApiServer) lifecycleDispatch(ctx context.Context, req *s3_lifecycle
|
||||
return done(), nil
|
||||
case s3_constants.VersioningSuspended:
|
||||
// Best-effort null delete; NotFound is benign.
|
||||
if err := s3a.deleteSpecificObjectVersion(ctx, req.Bucket, req.ObjectPath, "null", metadataOnly); err != nil {
|
||||
if err := s3a.deleteSpecificObjectVersion(req.Bucket, req.ObjectPath, "null", metadataOnly); err != nil {
|
||||
if !errors.Is(err, filer_pb.ErrNotFound) && !errors.Is(err, ErrVersionNotFound) {
|
||||
return retryLater("TRANSPORT_ERROR: deleteNullVersion: " + err.Error()), nil
|
||||
}
|
||||
@@ -133,7 +133,7 @@ func (s3a *S3ApiServer) lifecycleDispatch(ctx context.Context, req *s3_lifecycle
|
||||
return outcome, err
|
||||
}
|
||||
}
|
||||
if err := s3a.deleteSpecificObjectVersion(ctx, req.Bucket, req.ObjectPath, req.VersionId, metadataOnly); err != nil {
|
||||
if err := s3a.deleteSpecificObjectVersion(req.Bucket, req.ObjectPath, req.VersionId, metadataOnly); err != nil {
|
||||
if errors.Is(err, filer_pb.ErrNotFound) || errors.Is(err, ErrVersionNotFound) || errors.Is(err, ErrObjectNotFound) {
|
||||
return noopResolved("NOT_FOUND_AT_DELETE"), nil
|
||||
}
|
||||
|
||||
@@ -772,6 +772,7 @@ func (s3a *S3ApiServer) GetObjectHandler(w http.ResponseWriter, r *http.Request)
|
||||
return
|
||||
}
|
||||
if objectEntryForSSE == nil {
|
||||
// Not found, return error early to avoid another lookup in proxyToFiler
|
||||
s3err.WriteErrorResponse(w, r, s3err.ErrNoSuchKey)
|
||||
return
|
||||
}
|
||||
@@ -2273,6 +2274,7 @@ func (s3a *S3ApiServer) HeadObjectHandler(w http.ResponseWriter, r *http.Request
|
||||
return
|
||||
}
|
||||
if objectEntryForSSE == nil {
|
||||
// Not found, return error early to avoid another lookup in proxyToFiler
|
||||
s3err.WriteErrorResponse(w, r, s3err.ErrNoSuchKey)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ func (s3a *S3ApiServer) deleteVersionedObject(r *http.Request, bucket, object, v
|
||||
glog.V(2).Infof("deleteVersionedObject: object lock check failed for %s/%s version %s: %v", bucket, object, versionId, err)
|
||||
return result, s3err.ErrAccessDenied
|
||||
}
|
||||
if err := s3a.deleteSpecificObjectVersion(r.Context(), bucket, object, versionId, false); err != nil {
|
||||
if err := s3a.deleteSpecificObjectVersion(bucket, object, versionId, false); err != nil {
|
||||
glog.Errorf("deleteVersionedObject: failed to delete specific version %s for %s/%s: %v", versionId, bucket, object, err)
|
||||
return result, s3err.ErrInternalError
|
||||
}
|
||||
@@ -148,7 +148,7 @@ func (s3a *S3ApiServer) deleteVersionedObject(r *http.Request, bucket, object, v
|
||||
glog.V(2).Infof("deleteVersionedObject: object lock check failed for %s/%s null version: %v", bucket, object, err)
|
||||
return result, s3err.ErrAccessDenied
|
||||
}
|
||||
if err := s3a.deleteSpecificObjectVersion(r.Context(), bucket, object, "null", false); err != nil {
|
||||
if err := s3a.deleteSpecificObjectVersion(bucket, object, "null", false); err != nil {
|
||||
glog.Errorf("deleteVersionedObject: failed to delete null version for %s/%s: %v", bucket, object, err)
|
||||
return result, s3err.ErrInternalError
|
||||
}
|
||||
@@ -256,7 +256,6 @@ func (s3a *S3ApiServer) DeleteObjectHandler(w http.ResponseWriter, r *http.Reque
|
||||
if auditLog != nil {
|
||||
auditLog.Key = strings.TrimPrefix(object, "/")
|
||||
s3err.PostAccessLog(*auditLog)
|
||||
s3err.MarkAuditLogged(r)
|
||||
}
|
||||
|
||||
stats_collect.RecordBucketActiveTime(bucket)
|
||||
@@ -405,7 +404,6 @@ func (s3a *S3ApiServer) DeleteMultipleObjectsHandler(w http.ResponseWriter, r *h
|
||||
if auditLog != nil {
|
||||
auditLog.Key = object.Key
|
||||
s3err.PostAccessLog(*auditLog)
|
||||
s3err.MarkAuditLogged(r)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ package s3api
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
@@ -1000,7 +999,7 @@ func (s3a *S3ApiServer) getSpecificObjectVersion(bucket, object, versionId strin
|
||||
// metadataOnly=true skips per-chunk DeleteFile RPCs at the filer; only
|
||||
// pass true when the live entry's Attributes.TtlSec > 0 so the volume
|
||||
// reclaims chunks on its own.
|
||||
func (s3a *S3ApiServer) deleteSpecificObjectVersion(ctx context.Context, bucket, object, versionId string, metadataOnly bool) error {
|
||||
func (s3a *S3ApiServer) deleteSpecificObjectVersion(bucket, object, versionId string, metadataOnly bool) error {
|
||||
// Normalize object path to ensure consistency with toFilerPath behavior
|
||||
normalizedObject := s3_constants.NormalizeObjectKey(object)
|
||||
|
||||
@@ -1045,28 +1044,6 @@ func (s3a *S3ApiServer) deleteSpecificObjectVersion(ctx context.Context, bucket,
|
||||
}
|
||||
}
|
||||
|
||||
// Option 1: when deleting the current latest, repoint the .versions/
|
||||
// pointer BEFORE removing the blob. A failure between the two steps
|
||||
// then leaves a recoverable orphan blob (the pointer is already
|
||||
// consistent, GETs serve the prior version or NoSuchKey correctly)
|
||||
// instead of a dangling pointer (which forces every subsequent GET
|
||||
// through the 10-retry self-heal path and returns NoSuchKey for
|
||||
// objects whose latest version was singleton).
|
||||
var (
|
||||
prePointerRolled bool
|
||||
preWasSingleton bool
|
||||
)
|
||||
if isLatestVersion {
|
||||
rolled, singleton, prepErr := s3a.repointLatestBeforeDeletion(ctx, bucket, normalizedObject, versionId)
|
||||
if prepErr != nil {
|
||||
// Surface to the client so they can retry the DELETE. The
|
||||
// blob has NOT been removed yet, so retrying is safe.
|
||||
return fmt.Errorf("failed to repoint latest version before deleting %s: %w", versionId, prepErr)
|
||||
}
|
||||
prePointerRolled = rolled
|
||||
preWasSingleton = singleton
|
||||
}
|
||||
|
||||
// Attempt to delete the version file
|
||||
// Note: We don't check if the file exists first to avoid race conditions
|
||||
// The deletion operation should be idempotent
|
||||
@@ -1082,264 +1059,25 @@ func (s3a *S3ApiServer) deleteSpecificObjectVersion(ctx context.Context, bucket,
|
||||
return fmt.Errorf("failed to delete version %s: %v", versionId, deleteErr)
|
||||
}
|
||||
|
||||
switch {
|
||||
case isLatestVersion && prePointerRolled && preWasSingleton:
|
||||
// Pre-roll cleared a singleton pointer. The blob is now gone,
|
||||
// so the .versions/ directory should be empty — try to tear it
|
||||
// down. Non-recursive: any orphan from older code paths leaves
|
||||
// the directory in place for the empty-folder cleaner or our
|
||||
// reconciler to handle.
|
||||
if rmErr := s3a.rm(s3a.bucketDir(bucket), normalizedObject+s3_constants.VersionsFolder, true, false); rmErr != nil {
|
||||
glog.V(2).Infof("deleteSpecificObjectVersion: deferring .versions/ teardown for %s/%s: %v", bucket, normalizedObject, rmErr)
|
||||
}
|
||||
case isLatestVersion && !prePointerRolled:
|
||||
// Multi-version case where another version still exists, or the
|
||||
// pre-step decided the pointer was no longer ours to roll. Run
|
||||
// the post-deletion reconciliation: it updates the pointer to
|
||||
// the new latest and tears down .versions/ when nothing remains.
|
||||
if err := s3a.updateLatestVersionAfterDeletion(ctx, bucket, normalizedObject); err != nil {
|
||||
// Option 2: surface this so the operator sees the load-bearing
|
||||
// failure, and queue the path for the reconciler to retry off
|
||||
// the hot path. The blob delete already succeeded, so we don't
|
||||
// want to fail the client request (Veeam et al. treat 5xx on
|
||||
// DELETE as a hard storage error) — but we MUST drive the
|
||||
// pointer to consistency, otherwise the next read pays the
|
||||
// self-heal cost.
|
||||
versioningHealErrorf("produced", "bucket=%s key=%s reason=update_after_delete_failed err=%v queued_for_reconciler=true", bucket, normalizedObject, err)
|
||||
if s3a.versionsHealQueue != nil {
|
||||
s3a.versionsHealQueue.Enqueue(bucket, normalizedObject)
|
||||
}
|
||||
// If we deleted the latest version, update the .versions directory metadata to point to the new latest
|
||||
if isLatestVersion {
|
||||
err := s3a.updateLatestVersionAfterDeletion(bucket, normalizedObject)
|
||||
if err != nil {
|
||||
glog.Warningf("deleteSpecificObjectVersion: failed to update latest version after deletion: %v", err)
|
||||
// Don't return error since the deletion was successful
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// repointLatestBeforeDeletion is the "option 1" pre-step for deleting a
|
||||
// version that the .versions/ pointer currently names. It scans the
|
||||
// directory to find the next-newest version excluding the one about to
|
||||
// be deleted, and either repoints to it (multi-version case) or clears
|
||||
// the pointer entirely (single-version case). When this returns rolled
|
||||
// = true the caller should NOT run updateLatestVersionAfterDeletion
|
||||
// after the blob rm — the pointer is already consistent.
|
||||
//
|
||||
// wasSingleton = true indicates the caller cleared a singleton pointer.
|
||||
// After the caller's blob rm completes, deleteSpecificObjectVersion is
|
||||
// expected to run the post-deletion .versions/ teardown so the now-empty
|
||||
// directory entry is removed; doing that teardown inside this function
|
||||
// (i.e. before the blob rm) always fails with "non-empty folder" because
|
||||
// the blob is still present.
|
||||
//
|
||||
// When this returns rolled = false the .versions/ pointer was not in
|
||||
// sync with the caller's view (some concurrent writer changed it) and
|
||||
// the current deletion is no longer touching the latest; the caller
|
||||
// proceeds with the historical multi-step path which will re-snapshot
|
||||
// the state inside updateLatestVersionAfterDeletion.
|
||||
//
|
||||
// All load-bearing filer ops here are wrapped in retryFilerOp so the
|
||||
// pre-roll matches the resilience of the post-roll path; without this,
|
||||
// a transient filer hiccup during the pre-step would cause the caller
|
||||
// to fall back to the legacy non-atomic flow.
|
||||
func (s3a *S3ApiServer) repointLatestBeforeDeletion(ctx context.Context, bucket, normalizedObject, versionIdToDelete string) (rolled bool, wasSingleton bool, err error) {
|
||||
bucketDir := s3a.bucketDir(bucket)
|
||||
versionsObjectPath := normalizedObject + s3_constants.VersionsFolder
|
||||
versionsDir := bucketDir + "/" + versionsObjectPath
|
||||
|
||||
// Find the chronologically newest *other* version (excluding the
|
||||
// one we're about to delete). For singleton objects this returns
|
||||
// nil; for multi-version it returns the previous version.
|
||||
var (
|
||||
newLatestEntry *filer_pb.Entry
|
||||
newLatestVersionId string
|
||||
newLatestVersionFile string
|
||||
newLatestIsDeleteMark bool
|
||||
startFrom string
|
||||
)
|
||||
for {
|
||||
var (
|
||||
entries []*filer_pb.Entry
|
||||
isLast bool
|
||||
)
|
||||
if listErr := retryFilerOp(ctx, "repointLatestBeforeDeletion.list", func() error {
|
||||
var lerr error
|
||||
entries, isLast, lerr = s3a.list(versionsDir, "", startFrom, false, filer.PaginationSize)
|
||||
return lerr
|
||||
}); listErr != nil {
|
||||
return false, false, fmt.Errorf("list %s: %w", versionsDir, listErr)
|
||||
}
|
||||
for _, entry := range entries {
|
||||
if entry == nil || entry.Extended == nil {
|
||||
continue
|
||||
}
|
||||
vidBytes, ok := entry.Extended[s3_constants.ExtVersionIdKey]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
vid := string(vidBytes)
|
||||
if vid == versionIdToDelete {
|
||||
continue
|
||||
}
|
||||
if newLatestVersionId == "" || compareVersionIds(vid, newLatestVersionId) < 0 {
|
||||
newLatestEntry = entry
|
||||
newLatestVersionId = vid
|
||||
newLatestVersionFile = entry.Name
|
||||
newLatestIsDeleteMark = string(entry.Extended[s3_constants.ExtDeleteMarkerKey]) == "true"
|
||||
}
|
||||
}
|
||||
if isLast || len(entries) == 0 {
|
||||
break
|
||||
}
|
||||
startFrom = entries[len(entries)-1].Name
|
||||
}
|
||||
|
||||
// Re-fetch the .versions/ entry so the CAS persist below sees the
|
||||
// most recent Extended state. Distinguish NotFound (directory
|
||||
// already gone — vacuous consistency, skip the post-step) from
|
||||
// transient errors (must surface so the caller aborts before the
|
||||
// blob rm — otherwise we'd remove the blob without having updated
|
||||
// the pointer, reproducing the very dangling-state this PR fixes).
|
||||
var versionsEntry *filer_pb.Entry
|
||||
if getErr := retryFilerOp(ctx, "repointLatestBeforeDeletion.getEntry", func() error {
|
||||
var gerr error
|
||||
versionsEntry, gerr = s3a.getEntry(bucketDir, versionsObjectPath)
|
||||
return gerr
|
||||
}); getErr != nil {
|
||||
if errors.Is(getErr, filer_pb.ErrNotFound) || status.Code(getErr) == codes.NotFound {
|
||||
// Directory already gone. Pointer is vacuously consistent.
|
||||
return true, false, nil
|
||||
}
|
||||
return false, false, fmt.Errorf("read .versions entry: %w", getErr)
|
||||
}
|
||||
if versionsEntry.Extended == nil {
|
||||
return false, false, nil
|
||||
}
|
||||
currentLatestIdBytes, hasCurrent := versionsEntry.Extended[s3_constants.ExtLatestVersionIdKey]
|
||||
if !hasCurrent || string(currentLatestIdBytes) != versionIdToDelete {
|
||||
// A concurrent writer already moved the pointer; our delete is
|
||||
// no longer the latest. Caller falls back to the existing path.
|
||||
return false, false, nil
|
||||
}
|
||||
|
||||
if newLatestEntry != nil {
|
||||
// Multi-version: repoint to the prior latest.
|
||||
versionsEntry.Extended[s3_constants.ExtLatestVersionIdKey] = []byte(newLatestVersionId)
|
||||
versionsEntry.Extended[s3_constants.ExtLatestVersionFileNameKey] = []byte(newLatestVersionFile)
|
||||
setCachedListMetadata(versionsEntry, newLatestEntry)
|
||||
glog.V(2).Infof("repointLatestBeforeDeletion: %s/%s pre-roll to %s (deleteMarker=%v) before deleting %s", bucket, normalizedObject, newLatestVersionId, newLatestIsDeleteMark, versionIdToDelete)
|
||||
} else {
|
||||
// Singleton: clear the pointer fields. The blob rm and the
|
||||
// post-rm .versions/ teardown follow in the caller; if those
|
||||
// fail halfway through, the pointer is already absent so
|
||||
// reads fall through to a clean NoSuchKey without entering the
|
||||
// 10-retry stale-pointer self-heal path.
|
||||
delete(versionsEntry.Extended, s3_constants.ExtLatestVersionIdKey)
|
||||
delete(versionsEntry.Extended, s3_constants.ExtLatestVersionFileNameKey)
|
||||
clearCachedVersionMetadata(versionsEntry.Extended)
|
||||
glog.V(2).Infof("repointLatestBeforeDeletion: %s/%s clearing singleton pointer before deleting %s", bucket, normalizedObject, versionIdToDelete)
|
||||
}
|
||||
|
||||
if mkErr := retryFilerOp(ctx, "repointLatestBeforeDeletion.mkFile", func() error {
|
||||
return s3a.mkFile(bucketDir, versionsObjectPath, versionsEntry.Chunks, func(updatedEntry *filer_pb.Entry) {
|
||||
updatedEntry.Extended = versionsEntry.Extended
|
||||
updatedEntry.Attributes = versionsEntry.Attributes
|
||||
updatedEntry.Chunks = versionsEntry.Chunks
|
||||
})
|
||||
}); mkErr != nil {
|
||||
return false, false, fmt.Errorf("persist repointed pointer: %w", mkErr)
|
||||
}
|
||||
|
||||
return true, newLatestEntry == nil, nil
|
||||
}
|
||||
|
||||
// retryAttempts and retryStep tune the bounded retries used when the
|
||||
// load-bearing filer ops in updateLatestVersionAfterDeletion fail with
|
||||
// transient errors. Doubled per attempt, capped at retryCap. Total
|
||||
// worst-case wall time ≈ 6.3s before propagating.
|
||||
const (
|
||||
updateLatestRetryAttempts = 6
|
||||
updateLatestRetryStep = 100 * time.Millisecond
|
||||
updateLatestRetryCap = 2 * time.Second
|
||||
)
|
||||
|
||||
// isRetryableFilerErr reports whether err is worth retrying through
|
||||
// retryFilerOp. Terminal conditions return false so the caller surfaces
|
||||
// them immediately without the backoff delay or the retry-budget
|
||||
// wrapper:
|
||||
//
|
||||
// - NotFound: the entry genuinely doesn't exist. Retrying won't make
|
||||
// it appear, and callers (e.g. repointLatestBeforeDeletion) want
|
||||
// to act on this directly.
|
||||
// - context.Canceled / DeadlineExceeded: the request was aborted by
|
||||
// the client or hit a deadline. Continuing to retry just delays
|
||||
// the failure return.
|
||||
//
|
||||
// Everything else (gRPC Unavailable, transient network errors, filer
|
||||
// overload signals, etc.) is treated as retryable.
|
||||
func isRetryableFilerErr(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
if errors.Is(err, filer_pb.ErrNotFound) || status.Code(err) == codes.NotFound {
|
||||
return false
|
||||
}
|
||||
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func retryFilerOp(ctx context.Context, name string, fn func() error) error {
|
||||
var lastErr error
|
||||
backoff := updateLatestRetryStep
|
||||
for attempt := 1; attempt <= updateLatestRetryAttempts; attempt++ {
|
||||
err := fn()
|
||||
if err == nil {
|
||||
if attempt > 1 {
|
||||
glog.V(1).Infof("retryFilerOp: %s succeeded on attempt %d", name, attempt)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if !isRetryableFilerErr(err) {
|
||||
// Terminal — return raw so callers can errors.Is /
|
||||
// status.Code on the unwrapped error and avoid the
|
||||
// retry-budget delay.
|
||||
return err
|
||||
}
|
||||
lastErr = err
|
||||
if attempt == updateLatestRetryAttempts {
|
||||
break
|
||||
}
|
||||
// Context-aware backoff so a server shutdown / client
|
||||
// disconnect cancels the worst-case ~6.3s retry budget
|
||||
// immediately instead of blocking the goroutine.
|
||||
timer := time.NewTimer(backoff)
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
timer.Stop()
|
||||
return ctx.Err()
|
||||
case <-timer.C:
|
||||
}
|
||||
backoff *= 2
|
||||
if backoff > updateLatestRetryCap {
|
||||
backoff = updateLatestRetryCap
|
||||
}
|
||||
}
|
||||
return fmt.Errorf("%s exhausted %d retries: %w", name, updateLatestRetryAttempts, lastErr)
|
||||
}
|
||||
|
||||
// updateLatestVersionAfterDeletion finds the new latest version after deleting
|
||||
// the current latest. The pointer may refer to a delete marker: if a delete
|
||||
// marker is chronologically newer than the most recent remaining content
|
||||
// version, S3 semantics treat the object as deleted and the pointer must
|
||||
// reflect that. Restricting the scan to content versions here would resurrect
|
||||
// the object by promoting an older content version over a newer delete marker.
|
||||
//
|
||||
// All load-bearing filer interactions (list, getEntry, mkFile, rm) are
|
||||
// retried with bounded backoff. The function now returns a non-nil error
|
||||
// when those retries are exhausted; the caller is expected to surface the
|
||||
// failure (log + enqueue for the reconciler) instead of swallowing it,
|
||||
// which was the historic behaviour that left dangling pointers in place.
|
||||
func (s3a *S3ApiServer) updateLatestVersionAfterDeletion(ctx context.Context, bucket, object string) error {
|
||||
func (s3a *S3ApiServer) updateLatestVersionAfterDeletion(bucket, object string) error {
|
||||
bucketDir := s3a.bucketDir(bucket)
|
||||
versionsObjectPath := object + s3_constants.VersionsFolder
|
||||
versionsDir := bucketDir + "/" + versionsObjectPath
|
||||
@@ -1350,35 +1088,19 @@ func (s3a *S3ApiServer) updateLatestVersionAfterDeletion(ctx context.Context, bu
|
||||
// A single-shot list would miss the true latest for old-format (raw
|
||||
// timestamp) version ids when the directory exceeds one page, since filer
|
||||
// order is lexicographic-ascending = oldest-first for that format.
|
||||
//
|
||||
// orphanSamples captures up to orphanSampleCap names that DID appear in
|
||||
// the listing but lacked the version-id extended attribute. These are
|
||||
// the smoking-gun diagnostic for the "scanned N>0 but no valid latest"
|
||||
// anomaly — they're either filer-listing stale entries (just-deleted
|
||||
// records still indexed) or residual stubs from interrupted writes.
|
||||
const orphanSampleCap = 8
|
||||
var (
|
||||
latestVersionEntry *filer_pb.Entry
|
||||
latestVersionId string
|
||||
latestVersionFileName string
|
||||
latestIsDeleteMarker bool
|
||||
totalEntries int
|
||||
orphanCount int
|
||||
orphanSamples []string
|
||||
startFrom string
|
||||
)
|
||||
for {
|
||||
var (
|
||||
entries []*filer_pb.Entry
|
||||
isLast bool
|
||||
)
|
||||
if err := retryFilerOp(ctx, "updateLatestVersionAfterDeletion.list", func() error {
|
||||
var listErr error
|
||||
entries, isLast, listErr = s3a.list(versionsDir, "", startFrom, false, filer.PaginationSize)
|
||||
return listErr
|
||||
}); err != nil {
|
||||
entries, isLast, err := s3a.list(versionsDir, "", startFrom, false, filer.PaginationSize)
|
||||
if err != nil {
|
||||
glog.Errorf("updateLatestVersionAfterDeletion: failed to list versions in %s: %v", versionsDir, err)
|
||||
return fmt.Errorf("failed to list versions: %w", err)
|
||||
return fmt.Errorf("failed to list versions: %v", err)
|
||||
}
|
||||
totalEntries += len(entries)
|
||||
if pageEntry, pageId, pageFile, pageDM := selectLatestVersion(entries); pageEntry != nil {
|
||||
@@ -1389,55 +1111,18 @@ func (s3a *S3ApiServer) updateLatestVersionAfterDeletion(ctx context.Context, bu
|
||||
latestIsDeleteMarker = pageDM
|
||||
}
|
||||
}
|
||||
// Sample orphan entries (those without ExtVersionIdKey) for
|
||||
// post-scan diagnostics. selectLatestVersion already filters them
|
||||
// out for the latest-pick; we collect names separately so the
|
||||
// anomaly warning has something concrete to point at.
|
||||
for _, e := range entries {
|
||||
if e == nil {
|
||||
continue
|
||||
}
|
||||
if e.Extended != nil {
|
||||
if _, ok := e.Extended[s3_constants.ExtVersionIdKey]; ok {
|
||||
continue
|
||||
}
|
||||
}
|
||||
orphanCount++
|
||||
if len(orphanSamples) < orphanSampleCap {
|
||||
orphanSamples = append(orphanSamples, e.Name)
|
||||
}
|
||||
}
|
||||
if isLast || len(entries) == 0 {
|
||||
break
|
||||
}
|
||||
startFrom = entries[len(entries)-1].Name
|
||||
}
|
||||
|
||||
if totalEntries > 0 && latestVersionEntry == nil {
|
||||
// The scan saw entries but none were valid version blobs. This is
|
||||
// the listing-after-rm timing anomaly: a just-deleted record is
|
||||
// still indexed in the parent's listing but its extended attrs
|
||||
// either weren't loaded or the entry itself is mid-removal. The
|
||||
// caller will now fall through to the .versions/ teardown +
|
||||
// pointer clear, but operators tracking stranded-state production
|
||||
// should see this event.
|
||||
samplesSummary := "(none)"
|
||||
if len(orphanSamples) > 0 {
|
||||
samplesSummary = strings.Join(orphanSamples, ",")
|
||||
}
|
||||
versioningHealWarningf("anomaly", "bucket=%s key=%s scanned=%d orphan_count=%d orphan_samples=%s reason=listing_has_entries_but_none_have_version_id", bucket, object, totalEntries, orphanCount, samplesSummary)
|
||||
} else {
|
||||
glog.V(1).Infof("updateLatestVersionAfterDeletion: scanned %d entries in %s", totalEntries, versionsDir)
|
||||
}
|
||||
glog.V(1).Infof("updateLatestVersionAfterDeletion: scanned %d entries in %s", totalEntries, versionsDir)
|
||||
|
||||
// Update the .versions directory metadata
|
||||
var versionsEntry *filer_pb.Entry
|
||||
if err := retryFilerOp(ctx, "updateLatestVersionAfterDeletion.getEntry", func() error {
|
||||
var getErr error
|
||||
versionsEntry, getErr = s3a.getEntry(bucketDir, versionsObjectPath)
|
||||
return getErr
|
||||
}); err != nil {
|
||||
return fmt.Errorf("failed to get .versions directory: %w", err)
|
||||
versionsEntry, err := s3a.getEntry(bucketDir, versionsObjectPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get .versions directory: %v", err)
|
||||
}
|
||||
|
||||
if versionsEntry.Extended == nil {
|
||||
@@ -1452,14 +1137,13 @@ func (s3a *S3ApiServer) updateLatestVersionAfterDeletion(ctx context.Context, bu
|
||||
setCachedListMetadata(versionsEntry, latestVersionEntry)
|
||||
|
||||
glog.V(2).Infof("updateLatestVersionAfterDeletion: new latest version for %s/%s is %s (deleteMarker=%v)", bucket, object, latestVersionId, latestIsDeleteMarker)
|
||||
if err := retryFilerOp(ctx, "updateLatestVersionAfterDeletion.mkFile", func() error {
|
||||
return s3a.mkFile(bucketDir, versionsObjectPath, versionsEntry.Chunks, func(updatedEntry *filer_pb.Entry) {
|
||||
updatedEntry.Extended = versionsEntry.Extended
|
||||
updatedEntry.Attributes = versionsEntry.Attributes
|
||||
updatedEntry.Chunks = versionsEntry.Chunks
|
||||
})
|
||||
}); err != nil {
|
||||
return fmt.Errorf("failed to update .versions directory metadata: %w", err)
|
||||
err = s3a.mkFile(bucketDir, versionsObjectPath, versionsEntry.Chunks, func(updatedEntry *filer_pb.Entry) {
|
||||
updatedEntry.Extended = versionsEntry.Extended
|
||||
updatedEntry.Attributes = versionsEntry.Attributes
|
||||
updatedEntry.Chunks = versionsEntry.Chunks
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update .versions directory metadata: %v", err)
|
||||
}
|
||||
} else {
|
||||
// No version-tagged entries remain - try to delete the .versions
|
||||
@@ -1477,41 +1161,12 @@ func (s3a *S3ApiServer) updateLatestVersionAfterDeletion(ctx context.Context, bu
|
||||
// object is correctly absent.
|
||||
glog.V(2).Infof("updateLatestVersionAfterDeletion: no versions left for %s/%s, deleting .versions directory", bucket, object)
|
||||
|
||||
rmErr := s3a.rm(bucketDir, versionsObjectPath, true, false)
|
||||
if rmErr == nil {
|
||||
err = s3a.rm(bucketDir, versionsObjectPath, true, false)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
// Two ways rm can fail here: "non-empty folder" (orphan entries
|
||||
// blocking the teardown — fall through to pointer clear) and a
|
||||
// transient filer error (worth retrying). Distinguish by the
|
||||
// canonical error substring; if we can't tell, treat as transient.
|
||||
if strings.Contains(rmErr.Error(), filer.MsgFailDelNonEmptyFolder) {
|
||||
glog.V(2).Infof("updateLatestVersionAfterDeletion: .versions/ for %s/%s still has orphan entries: %v", bucket, object, rmErr)
|
||||
s3a.clearStaleLatestVersionPointer(bucket, object, bucketDir, versionsObjectPath, versionsEntry, "updateLatestVersionAfterDeletion")
|
||||
return nil
|
||||
}
|
||||
// Transient — retry the rm a few times before giving up. Even
|
||||
// if it ultimately fails, we still clear the stale pointer so
|
||||
// readers get a clean miss; the directory can be tidied by the
|
||||
// reconciler later.
|
||||
retryErr := retryFilerOp(ctx, "updateLatestVersionAfterDeletion.rm", func() error {
|
||||
return s3a.rm(bucketDir, versionsObjectPath, true, false)
|
||||
})
|
||||
if retryErr == nil {
|
||||
return nil
|
||||
}
|
||||
if strings.Contains(retryErr.Error(), filer.MsgFailDelNonEmptyFolder) {
|
||||
s3a.clearStaleLatestVersionPointer(bucket, object, bucketDir, versionsObjectPath, versionsEntry, "updateLatestVersionAfterDeletion")
|
||||
return nil
|
||||
}
|
||||
versioningHealWarningf("teardown_failed", "bucket=%s key=%s err=%v (fell through to clearStale)", bucket, object, retryErr)
|
||||
if s3a.clearStaleLatestVersionPointer(bucket, object, bucketDir, versionsObjectPath, versionsEntry, "updateLatestVersionAfterDeletion") {
|
||||
// Pointer is consistent again; reader will get NoSuchKey via
|
||||
// the clean-miss path. Don't emit `produced` or enqueue the
|
||||
// reconciler — there's no stranded state left to heal.
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("delete .versions directory: %w", retryErr)
|
||||
glog.Warningf("updateLatestVersionAfterDeletion: failed to delete .versions directory for %s/%s: %v", bucket, object, err)
|
||||
s3a.clearStaleLatestVersionPointer(bucket, object, bucketDir, versionsObjectPath, versionsEntry, "updateLatestVersionAfterDeletion")
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -1538,19 +1193,9 @@ func (s3a *S3ApiServer) updateLatestVersionAfterDeletion(ctx context.Context, bu
|
||||
//
|
||||
// caller is the source-function name used in log lines so operators can
|
||||
// trace which path ran the clear.
|
||||
//
|
||||
// Returns cleared=true ONLY when this function successfully removed the
|
||||
// pointer (or the second branch — pointer no longer present — left the
|
||||
// directory in the intended clean-miss state, which counts as
|
||||
// already-clear). Concurrent-writer aborts, re-scan errors, and CAS
|
||||
// mismatches return false so callers that hit a transient teardown
|
||||
// failure still emit `produced` and enqueue for the reconciler; a
|
||||
// successful clear lets the caller short-circuit and return nil since
|
||||
// the pointer is consistent and the next reader gets NoSuchKey via the
|
||||
// clean-miss path.
|
||||
func (s3a *S3ApiServer) clearStaleLatestVersionPointer(bucket, object, bucketDir, versionsObjectPath string, versionsEntry *filer_pb.Entry, caller string) (cleared bool) {
|
||||
func (s3a *S3ApiServer) clearStaleLatestVersionPointer(bucket, object, bucketDir, versionsObjectPath string, versionsEntry *filer_pb.Entry, caller string) {
|
||||
if versionsEntry == nil || versionsEntry.Extended == nil {
|
||||
return false
|
||||
return
|
||||
}
|
||||
observedStaleId := string(versionsEntry.Extended[s3_constants.ExtLatestVersionIdKey])
|
||||
versionsDir := bucketDir + "/" + versionsObjectPath
|
||||
@@ -1560,11 +1205,11 @@ func (s3a *S3ApiServer) clearStaleLatestVersionPointer(bucket, object, bucketDir
|
||||
entries, isLast, listErr := s3a.list(versionsDir, "", startFrom, false, filer.PaginationSize)
|
||||
if listErr != nil {
|
||||
glog.Warningf("%s: re-scan failed for %s/%s, leaving pointer untouched: %v", caller, bucket, object, listErr)
|
||||
return false
|
||||
return
|
||||
}
|
||||
if pageEntry, _, _, _ := selectLatestVersion(entries); pageEntry != nil {
|
||||
glog.V(1).Infof("%s: skipping pointer clear for %s/%s, concurrent writer added a tagged version", caller, bucket, object)
|
||||
return false
|
||||
return
|
||||
}
|
||||
if isLast || len(entries) == 0 {
|
||||
break
|
||||
@@ -1574,22 +1219,20 @@ func (s3a *S3ApiServer) clearStaleLatestVersionPointer(bucket, object, bucketDir
|
||||
|
||||
liveEntry, err := s3a.getEntry(bucketDir, versionsObjectPath)
|
||||
if err != nil {
|
||||
// Directory was concurrently removed - reader will get NoSuchKey
|
||||
// via the clean-miss path; pointer is effectively cleared.
|
||||
return true
|
||||
// Directory was concurrently removed - nothing to clear.
|
||||
return
|
||||
}
|
||||
if liveEntry.Extended == nil {
|
||||
return true
|
||||
return
|
||||
}
|
||||
currentIdBytes, hasId := liveEntry.Extended[s3_constants.ExtLatestVersionIdKey]
|
||||
_, hasFile := liveEntry.Extended[s3_constants.ExtLatestVersionFileNameKey]
|
||||
if !hasId && !hasFile {
|
||||
// Already cleared by another path.
|
||||
return true
|
||||
return
|
||||
}
|
||||
if observedStaleId != "" && string(currentIdBytes) != observedStaleId {
|
||||
glog.V(1).Infof("%s: skipping pointer clear for %s/%s, live pointer changed (observed=%s, current=%s)", caller, bucket, object, observedStaleId, string(currentIdBytes))
|
||||
return false
|
||||
return
|
||||
}
|
||||
|
||||
delete(liveEntry.Extended, s3_constants.ExtLatestVersionIdKey)
|
||||
@@ -1600,11 +1243,10 @@ func (s3a *S3ApiServer) clearStaleLatestVersionPointer(bucket, object, bucketDir
|
||||
updatedEntry.Attributes = liveEntry.Attributes
|
||||
updatedEntry.Chunks = liveEntry.Chunks
|
||||
}); mkErr != nil {
|
||||
versioningHealWarningf("clear_failed", "bucket=%s key=%s caller=%s err=%v", bucket, object, caller, mkErr)
|
||||
return false
|
||||
glog.Warningf("%s: failed to clear stale pointer for %s/%s: %v", caller, bucket, object, mkErr)
|
||||
return
|
||||
}
|
||||
versioningHealInfof("healed", "bucket=%s key=%s mode=pointer_cleared caller=%s (orphan entries remain in .versions directory)", bucket, object, caller)
|
||||
return true
|
||||
glog.V(1).Infof("%s: cleared stale latest-version pointer for %s/%s (orphan entries remain in .versions directory)", caller, bucket, object)
|
||||
}
|
||||
|
||||
// ListObjectVersionsHandler handles the list object versions request
|
||||
@@ -1815,7 +1457,7 @@ func (s3a *S3ApiServer) healStaleLatestVersionPointer(bucket, normalizedObject s
|
||||
versionsObjectPath := normalizedObject + s3_constants.VersionsFolder
|
||||
versionsDir := bucketDir + "/" + versionsObjectPath
|
||||
|
||||
versioningHealWarningf("surfaced", "bucket=%s key=%s missing_file=%s rescanning=%s", bucket, normalizedObject, stalePointerFile, versionsDir)
|
||||
glog.Warningf("healStaleLatestVersionPointer: stale pointer for %s/%s - version file %q missing, rescanning %s", bucket, normalizedObject, stalePointerFile, versionsDir)
|
||||
|
||||
// Paginate through all version entries and keep a running best candidate.
|
||||
// A single-shot list would miss the true latest when old-format (raw
|
||||
@@ -1882,9 +1524,9 @@ func (s3a *S3ApiServer) healStaleLatestVersionPointer(bucket, normalizedObject s
|
||||
// Persisting the repair is best-effort. Surface a warning but still
|
||||
// return the rescanned entry so the read succeeds; a subsequent write
|
||||
// on the object will persist a fresh pointer.
|
||||
versioningHealWarningf("heal_persist_failed", "bucket=%s key=%s err=%v (returning rescanned entry)", bucket, normalizedObject, mkErr)
|
||||
glog.Warningf("healStaleLatestVersionPointer: failed to persist repaired pointer for %s/%s: %v (returning rescanned entry)", bucket, normalizedObject, mkErr)
|
||||
} else {
|
||||
versioningHealInfof("healed", "bucket=%s key=%s mode=pointer_repaired new_version=%s file=%s delete_marker=%v", bucket, normalizedObject, latestVersionId, latestVersionFileName, isDeleteMarker)
|
||||
glog.V(1).Infof("healStaleLatestVersionPointer: repaired pointer for %s/%s to version %s (file %s, deleteMarker=%v)", bucket, normalizedObject, latestVersionId, latestVersionFileName, isDeleteMarker)
|
||||
}
|
||||
return latestEntry, nil
|
||||
}
|
||||
|
||||
@@ -101,9 +101,6 @@ type S3ApiServer struct {
|
||||
// teardown waits on context.Background() fetches. The chunkCache field
|
||||
// is nil in this commit; a follow-up wires in an in-memory chunk cache.
|
||||
readerCache *filer.ReaderCache
|
||||
|
||||
versionsHealQueue *versionsHealQueue
|
||||
versionsReconcilerStop func()
|
||||
}
|
||||
|
||||
type objectWriteLock interface {
|
||||
@@ -384,17 +381,10 @@ func NewS3ApiServerWithStore(router *mux.Router, option *S3ApiServerOption, expl
|
||||
// Start bucket size metrics collection in background
|
||||
go s3ApiServer.startBucketSizeMetricsLoop(context.Background())
|
||||
|
||||
// Start the versioning reconciler that drains stranded .versions/
|
||||
// pointer-to-missing-file states without waiting for a client GET.
|
||||
s3ApiServer.versionsReconcilerStop = s3ApiServer.startVersioningReconciler()
|
||||
|
||||
return s3ApiServer, nil
|
||||
}
|
||||
|
||||
func (s3a *S3ApiServer) Shutdown() {
|
||||
if s3a.versionsReconcilerStop != nil {
|
||||
s3a.versionsReconcilerStop()
|
||||
}
|
||||
if s3a.iam != nil {
|
||||
s3a.iam.Shutdown()
|
||||
}
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
package s3api
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// TestVersioningHealLogPrefix verifies that the prefix helpers attach a
|
||||
// consistent grep-able tag plus an event= field. The exact format is
|
||||
// load-bearing — operators / log aggregators may match on it.
|
||||
func TestVersioningHealLogPrefix(t *testing.T) {
|
||||
// glog writes to os.Stderr via internal sinks; we can intercept by
|
||||
// installing a custom output via the flag. Simpler: just verify the
|
||||
// public functions don't panic and that the format strings work.
|
||||
// Behavioural check is via reading what gets formatted.
|
||||
|
||||
// glog formatting is private; verify the format-string assembly by
|
||||
// reproducing what the helper does. If the helper's prefix or layout
|
||||
// drifts, this test fails first.
|
||||
var buf bytes.Buffer
|
||||
want := "[versioning-heal] event=enqueue bucket=b key=k queue_depth=1"
|
||||
buf.WriteString("[versioning-heal] event=enqueue ")
|
||||
buf.WriteString("bucket=b key=k queue_depth=1")
|
||||
assert.Equal(t, want, buf.String(), "documenting the exact wire format the prefix helpers produce")
|
||||
}
|
||||
|
||||
// TestVersioningHealInfof_FormatStringSafe confirms that passing a value
|
||||
// containing a percent sign doesn't trigger a double-format bug.
|
||||
func TestVersioningHealInfof_FormatStringSafe(t *testing.T) {
|
||||
// The helpers Sprintf the inner format first, then wrap. Make sure
|
||||
// that a stray %s inside the rendered string doesn't get re-interpreted
|
||||
// when the outer Infof runs.
|
||||
//
|
||||
// Trigger flag init so glog is wired before logging in tests.
|
||||
_ = flag.Lookup("v")
|
||||
|
||||
// We can't easily capture stderr without disrupting other tests, so
|
||||
// this is a smoke test: no panic, no extra format interpretation.
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
t.Fatalf("versioningHealInfof panicked on percent-containing arg: %v", r)
|
||||
}
|
||||
}()
|
||||
|
||||
versioningHealInfof("smoke", "bucket=%s key=%s err=%v", "a-bucket", "obj-with-%s-percent", "100%")
|
||||
|
||||
// If we reach here without panic, the helper's two-stage format is
|
||||
// well-behaved. Also assert the constant prefix value as a sanity
|
||||
// check against accidental rename.
|
||||
assert.True(t, strings.HasPrefix(versioningHealLogPrefix, "[versioning-heal]"))
|
||||
}
|
||||
|
||||
// TestSanitizeHealArg pins the field-escape behavior the heal helpers
|
||||
// rely on. A bucket name or object key containing whitespace, control
|
||||
// chars, quotes, or backslashes must not leak into the log line as a
|
||||
// raw token, otherwise a user-controlled key could spoof extra event=
|
||||
// or bucket= fields and split one heal event across multiple lines.
|
||||
func TestSanitizeHealArg(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
in interface{}
|
||||
want interface{}
|
||||
}{
|
||||
// Safe values pass through unchanged so common log output stays
|
||||
// human-readable.
|
||||
{"plain string", "bucket-name", "bucket-name"},
|
||||
{"underscored", "obj_key_v2", "obj_key_v2"},
|
||||
{"slashed key", "a/b/c", "a/b/c"},
|
||||
// Anything that could split the field separator gets quoted.
|
||||
{"space", "with space", `"with space"`},
|
||||
{"newline", "line1\nline2", `"line1\nline2"`},
|
||||
{"carriage return", "a\rb", `"a\rb"`},
|
||||
{"tab", "a\tb", `"a\tb"`},
|
||||
{"quote", `a"b`, `"a\"b"`},
|
||||
{"backslash", `a\b`, `"a\\b"`},
|
||||
{"control char (DEL)", "a\x7fb", `"a\x7fb"`},
|
||||
{"event= injection attempt", "key event=fake bucket=", `"key event=fake bucket="`},
|
||||
// Errors are stringified and the same rules apply.
|
||||
{"error with newline", errors.New("rpc failed\nattacker=here"), `"rpc failed\nattacker=here"`},
|
||||
{"error plain", errors.New("simple"), "simple"},
|
||||
// Nil and non-string types are passed through verbatim — fmt
|
||||
// will render them, and they can't carry log-injection payload.
|
||||
{"nil arg", nil, nil},
|
||||
{"int arg", 42, 42},
|
||||
{"bool arg", true, true},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
got := sanitizeHealArg(tc.in)
|
||||
assert.Equal(t, tc.want, got)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestVersioningHealInfof_KeyWithWhitespaceStaysOneField confirms the
|
||||
// end-to-end format: when a caller passes a malicious key, the
|
||||
// fmt.Sprintf substitution sees the quoted form, so the rendered line
|
||||
// keeps the key inside a single token and operators can still parse
|
||||
// bucket=… key=… as distinct fields.
|
||||
func TestVersioningHealInfof_KeyWithWhitespaceStaysOneField(t *testing.T) {
|
||||
// The helpers go through glog so we can't capture the final byte
|
||||
// stream here without disrupting other tests; reproduce the
|
||||
// substitution to assert the wire shape.
|
||||
args := sanitizeHealArgs([]interface{}{"bk", "key with space event=spoof"})
|
||||
line := fmt.Sprintf("bucket=%s key=%s", args...)
|
||||
assert.Equal(t, `bucket=bk key="key with space event=spoof"`, line)
|
||||
// Confirm `grep ' event=' would NOT match the spoofed event tag
|
||||
// because the entire malicious value is wrapped in quotes.
|
||||
assert.NotContains(t, strings.SplitN(line, " ", 3)[2], "event=spoof key=")
|
||||
}
|
||||
|
||||
// TestVersioningHealEventVocabulary is a documentation test that lists
|
||||
// the events the codebase emits. If you add or rename an event, update
|
||||
// the canonical list in s3api_versioning_reconciler.go and this test
|
||||
// together; downstream log dashboards depend on this vocabulary.
|
||||
func TestVersioningHealEventVocabulary(t *testing.T) {
|
||||
known := []string{
|
||||
"produced", "surfaced", "healed", "enqueue",
|
||||
"drain", "retry", "gave_up", "anomaly",
|
||||
"clear_failed", "heal_persist_failed", "teardown_failed",
|
||||
"queue_full",
|
||||
}
|
||||
// Just assert the list itself stays explicit and non-empty.
|
||||
assert.NotEmpty(t, known)
|
||||
for _, e := range known {
|
||||
assert.NotContains(t, e, " ", "event names should be space-free for grep parsing")
|
||||
assert.NotContains(t, e, "=", "event names must not collide with key=value separators")
|
||||
}
|
||||
_ = glog.V(0) // keep the glog import meaningful in case the helper signatures evolve
|
||||
}
|
||||
@@ -1,288 +0,0 @@
|
||||
package s3api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// versioningHealLogPrefix is the grep-able tag every line in the .versions/
|
||||
// pointer recovery lifecycle carries. Operators correlating produced /
|
||||
// surfaced / drained / gave-up events can pull a single stream across
|
||||
// hosts with `grep '\[versioning-heal\]'`. Keep this constant — log
|
||||
// aggregators (Loki, Splunk, journalctl filters) may match on it.
|
||||
const versioningHealLogPrefix = "[versioning-heal]"
|
||||
|
||||
// versioningHealInfof / Warningf / Errorf emit a log line stamped with
|
||||
// the grep prefix and an event tag. Use event names from a small fixed
|
||||
// vocabulary so dashboards can aggregate by event:
|
||||
//
|
||||
// event=produced — stranded state was created (or would have been before this PR's fixes)
|
||||
// event=surfaced — read-path heal triggered for an already-stranded key
|
||||
// event=healed — pointer was successfully repaired or cleared
|
||||
// event=enqueue — reconciler queued a candidate
|
||||
// event=drain — reconciler successfully drained a candidate
|
||||
// event=retry — reconciler attempt failed, will retry
|
||||
// event=gave_up — reconciler exhausted retries on a candidate
|
||||
// event=anomaly — listing-after-rm inconsistency detected
|
||||
// event=summary — periodic heartbeat (counters + queue depth)
|
||||
//
|
||||
// All string/error arguments are sanitized so user-controlled bucket
|
||||
// names, object keys, filenames, and error text can't split the line
|
||||
// into multiple grep tokens or inject fake event=/bucket=/key= fields.
|
||||
// Safe values pass through unchanged; anything containing whitespace,
|
||||
// quotes, control chars, or backslashes is replaced with its
|
||||
// strconv.Quote form so the field boundary stays one space.
|
||||
func versioningHealInfof(event, format string, args ...interface{}) {
|
||||
glog.Infof("%s event=%s %s", versioningHealLogPrefix, event, fmt.Sprintf(format, sanitizeHealArgs(args)...))
|
||||
}
|
||||
|
||||
func versioningHealWarningf(event, format string, args ...interface{}) {
|
||||
glog.Warningf("%s event=%s %s", versioningHealLogPrefix, event, fmt.Sprintf(format, sanitizeHealArgs(args)...))
|
||||
}
|
||||
|
||||
func versioningHealErrorf(event, format string, args ...interface{}) {
|
||||
glog.Errorf("%s event=%s %s", versioningHealLogPrefix, event, fmt.Sprintf(format, sanitizeHealArgs(args)...))
|
||||
}
|
||||
|
||||
// sanitizeHealArgs walks args and replaces string/error values that
|
||||
// would break the single-space field separator (whitespace, newlines,
|
||||
// control chars, quotes, backslashes) with their strconv.Quote form.
|
||||
// Non-string args are returned untouched.
|
||||
func sanitizeHealArgs(args []interface{}) []interface{} {
|
||||
out := make([]interface{}, len(args))
|
||||
for i, v := range args {
|
||||
out[i] = sanitizeHealArg(v)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func sanitizeHealArg(v interface{}) interface{} {
|
||||
var s string
|
||||
switch t := v.(type) {
|
||||
case nil:
|
||||
return v
|
||||
case string:
|
||||
s = t
|
||||
case error:
|
||||
s = t.Error()
|
||||
default:
|
||||
return v
|
||||
}
|
||||
if !needsHealQuote(s) {
|
||||
return s
|
||||
}
|
||||
return strconv.Quote(s)
|
||||
}
|
||||
|
||||
func needsHealQuote(s string) bool {
|
||||
for _, r := range s {
|
||||
if r == ' ' || r == '\t' || r == '\n' || r == '\r' || r == '"' || r == '\\' || r < 0x20 || r == 0x7f {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Background reconciler for .versions/ directories whose latest-version
|
||||
// pointer references a missing file. The inline delete path
|
||||
// (deleteSpecificObjectVersion -> updateLatestVersionAfterDeletion) can
|
||||
// leave this state behind if the second step (pointer update / dir rm)
|
||||
// fails after the first (blob rm) succeeded. Read-path self-heal already
|
||||
// recovers on the next GET, but that surfaces NoSuchKey to the client.
|
||||
// The reconciler drains stranded entries proactively so a passing health
|
||||
// check or an idle key gets repaired without waiting for a client read.
|
||||
|
||||
const (
|
||||
versionsHealQueueCapacity = 4096
|
||||
versionsHealPollInterval = 5 * time.Second
|
||||
versionsHealMaxRetries = 6
|
||||
versionsHealBaseBackoff = 200 * time.Millisecond
|
||||
versionsHealMaxBackoff = 30 * time.Second
|
||||
)
|
||||
|
||||
type versionsHealCandidate struct {
|
||||
bucket string
|
||||
object string
|
||||
enqueued time.Time
|
||||
attempts int
|
||||
nextRetry time.Time
|
||||
}
|
||||
|
||||
type versionsHealQueue struct {
|
||||
mu sync.Mutex
|
||||
pending map[string]*versionsHealCandidate
|
||||
}
|
||||
|
||||
func newVersionsHealQueue() *versionsHealQueue {
|
||||
return &versionsHealQueue{
|
||||
pending: make(map[string]*versionsHealCandidate),
|
||||
}
|
||||
}
|
||||
|
||||
func versionsHealKey(bucket, object string) string {
|
||||
return bucket + "/" + object
|
||||
}
|
||||
|
||||
// Enqueue records that bucket/object's .versions/ directory may be in a
|
||||
// stranded state and needs the reconciler to verify and heal it. Bounded
|
||||
// by versionsHealQueueCapacity so a stuck filer can't grow the map
|
||||
// without limit; on overflow we drop the newest candidate (the heal will
|
||||
// run on the next read or the next delete-failure for that key).
|
||||
func (q *versionsHealQueue) Enqueue(bucket, object string) {
|
||||
q.mu.Lock()
|
||||
defer q.mu.Unlock()
|
||||
key := versionsHealKey(bucket, object)
|
||||
if _, ok := q.pending[key]; ok {
|
||||
return
|
||||
}
|
||||
if len(q.pending) >= versionsHealQueueCapacity {
|
||||
versioningHealWarningf("queue_full", "bucket=%s key=%s capacity=%d (candidate dropped; read-path heal still covers it)", bucket, object, versionsHealQueueCapacity)
|
||||
return
|
||||
}
|
||||
q.pending[key] = &versionsHealCandidate{
|
||||
bucket: bucket,
|
||||
object: object,
|
||||
enqueued: time.Now(),
|
||||
nextRetry: time.Now(),
|
||||
}
|
||||
versioningHealInfof("enqueue", "bucket=%s key=%s queue_depth=%d", bucket, object, len(q.pending))
|
||||
}
|
||||
|
||||
// popReady returns candidates whose nextRetry is in the past, removing
|
||||
// them from the queue. Callers reinsert via requeue() if the heal failed.
|
||||
func (q *versionsHealQueue) popReady(now time.Time) []*versionsHealCandidate {
|
||||
q.mu.Lock()
|
||||
defer q.mu.Unlock()
|
||||
var out []*versionsHealCandidate
|
||||
for k, c := range q.pending {
|
||||
if !c.nextRetry.After(now) {
|
||||
out = append(out, c)
|
||||
delete(q.pending, k)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// requeue re-inserts a candidate with an updated retry schedule. Drops
|
||||
// candidates that have hit the attempt cap so they don't loop forever
|
||||
// against a deterministically broken state; the read-path heal remains
|
||||
// as a last-resort safety net.
|
||||
func (q *versionsHealQueue) requeue(c *versionsHealCandidate, backoff time.Duration) {
|
||||
if c.attempts >= versionsHealMaxRetries {
|
||||
versioningHealWarningf("gave_up", "bucket=%s key=%s attempts=%d (read-path heal will still recover)", c.bucket, c.object, c.attempts)
|
||||
return
|
||||
}
|
||||
q.mu.Lock()
|
||||
defer q.mu.Unlock()
|
||||
c.nextRetry = time.Now().Add(backoff)
|
||||
q.pending[versionsHealKey(c.bucket, c.object)] = c
|
||||
}
|
||||
|
||||
// Len returns the current queued size. Used in tests and by metrics.
|
||||
func (q *versionsHealQueue) Len() int {
|
||||
q.mu.Lock()
|
||||
defer q.mu.Unlock()
|
||||
return len(q.pending)
|
||||
}
|
||||
|
||||
// startVersioningReconciler launches the background worker. Returns a
|
||||
// stop function that the server's Shutdown calls to cancel the loop.
|
||||
func (s3a *S3ApiServer) startVersioningReconciler() (stop func()) {
|
||||
if s3a.versionsHealQueue == nil {
|
||||
s3a.versionsHealQueue = newVersionsHealQueue()
|
||||
}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
go s3a.runVersioningReconciler(ctx)
|
||||
return cancel
|
||||
}
|
||||
|
||||
func (s3a *S3ApiServer) runVersioningReconciler(ctx context.Context) {
|
||||
ticker := time.NewTicker(versionsHealPollInterval)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-ticker.C:
|
||||
s3a.drainVersionsHealQueue()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s3a *S3ApiServer) drainVersionsHealQueue() {
|
||||
q := s3a.versionsHealQueue
|
||||
if q == nil {
|
||||
return
|
||||
}
|
||||
ready := q.popReady(time.Now())
|
||||
for _, c := range ready {
|
||||
c.attempts++
|
||||
if err := s3a.healVersionsPointer(c.bucket, c.object); err != nil {
|
||||
backoff := versionsHealBaseBackoff << uint(c.attempts-1)
|
||||
if backoff > versionsHealMaxBackoff {
|
||||
backoff = versionsHealMaxBackoff
|
||||
}
|
||||
versioningHealInfof("retry", "bucket=%s key=%s attempt=%d retry_in=%v err=%v", c.bucket, c.object, c.attempts, backoff, err)
|
||||
q.requeue(c, backoff)
|
||||
continue
|
||||
}
|
||||
versioningHealInfof("drain", "bucket=%s key=%s attempts=%d queued_for=%v", c.bucket, c.object, c.attempts, time.Since(c.enqueued))
|
||||
}
|
||||
}
|
||||
|
||||
// healVersionsPointer reads the .versions directory entry for the given
|
||||
// object and, if its latest-version pointer references a file that does
|
||||
// not exist, invokes the same self-heal path used by the read flow. A
|
||||
// genuinely-missing .versions directory or an already-consistent pointer
|
||||
// is treated as success — the candidate either healed itself via another
|
||||
// path or was never in trouble.
|
||||
//
|
||||
// Transient errors from the filer (timeout, brief unreachability) are
|
||||
// returned so the reconciler retries with backoff rather than silently
|
||||
// evicting the candidate. Swallowing them as "no stranded state" would
|
||||
// defeat the reconciler for exactly the failure modes the PR targets.
|
||||
func (s3a *S3ApiServer) healVersionsPointer(bucket, object string) error {
|
||||
bucketDir := s3a.bucketDir(bucket)
|
||||
versionsObjectPath := object + s3_constants.VersionsFolder
|
||||
versionsEntry, err := s3a.getEntry(bucketDir, versionsObjectPath)
|
||||
if err != nil {
|
||||
if errors.Is(err, filer_pb.ErrNotFound) || status.Code(err) == codes.NotFound {
|
||||
// Directory is gone — no stranded state to heal.
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("read .versions entry %s/%s: %w", bucket, object, err)
|
||||
}
|
||||
if versionsEntry == nil || versionsEntry.Extended == nil {
|
||||
return nil
|
||||
}
|
||||
fileBytes, hasFile := versionsEntry.Extended[s3_constants.ExtLatestVersionFileNameKey]
|
||||
if !hasFile || len(fileBytes) == 0 {
|
||||
// No pointer => no stranded state.
|
||||
return nil
|
||||
}
|
||||
latestFile := string(fileBytes)
|
||||
if _, probeErr := s3a.getEntry(bucketDir+"/"+versionsObjectPath, latestFile); probeErr == nil {
|
||||
// Pointer is consistent.
|
||||
return nil
|
||||
} else if !errors.Is(probeErr, filer_pb.ErrNotFound) && status.Code(probeErr) != codes.NotFound {
|
||||
// Transient — surface so the reconciler retries with backoff
|
||||
// rather than invoking heal on a possibly-incomplete listing
|
||||
// (which could rewrite the pointer to an older version).
|
||||
return fmt.Errorf("probe latest version %s/%s/%s: %w", bucket, object, latestFile, probeErr)
|
||||
}
|
||||
// Reuse the read-path heal so behaviour stays identical: it will
|
||||
// repair the pointer to the newest remaining version, or clear it
|
||||
// when nothing valid remains.
|
||||
_, healErr := s3a.healStaleLatestVersionPointer(bucket, object, versionsEntry, latestFile)
|
||||
return healErr
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
package s3api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// TestVersionsHealQueue_DedupOnEnqueue ensures multiple enqueues of the
|
||||
// same bucket/object collapse into a single pending entry, so a hot
|
||||
// failure path doesn't bloat the queue.
|
||||
func TestVersionsHealQueue_DedupOnEnqueue(t *testing.T) {
|
||||
q := newVersionsHealQueue()
|
||||
for i := 0; i < 5; i++ {
|
||||
q.Enqueue("b", "obj")
|
||||
}
|
||||
assert.Equal(t, 1, q.Len(), "duplicate enqueues collapse")
|
||||
}
|
||||
|
||||
// TestVersionsHealQueue_CapacityCap ensures the queue refuses growth
|
||||
// past the static cap and logs at V(1) instead of OOM-ing.
|
||||
func TestVersionsHealQueue_CapacityCap(t *testing.T) {
|
||||
q := newVersionsHealQueue()
|
||||
for i := 0; i < versionsHealQueueCapacity+50; i++ {
|
||||
q.Enqueue("b", string(rune(i)))
|
||||
}
|
||||
assert.Equal(t, versionsHealQueueCapacity, q.Len(), "queue clamps at capacity")
|
||||
}
|
||||
|
||||
// TestVersionsHealQueue_PopReadyOnlyDueItems checks that nextRetry
|
||||
// gating keeps not-yet-ready candidates in the queue.
|
||||
func TestVersionsHealQueue_PopReadyOnlyDueItems(t *testing.T) {
|
||||
q := newVersionsHealQueue()
|
||||
q.Enqueue("b", "due")
|
||||
|
||||
// Inject a deferred candidate directly so we control its nextRetry.
|
||||
q.pending[versionsHealKey("b", "later")] = &versionsHealCandidate{
|
||||
bucket: "b",
|
||||
object: "later",
|
||||
enqueued: time.Now(),
|
||||
nextRetry: time.Now().Add(10 * time.Minute),
|
||||
}
|
||||
|
||||
due := q.popReady(time.Now())
|
||||
require.Len(t, due, 1, "only the due candidate pops")
|
||||
assert.Equal(t, "due", due[0].object)
|
||||
assert.Equal(t, 1, q.Len(), "deferred candidate still queued")
|
||||
}
|
||||
|
||||
// TestVersionsHealQueue_RequeueWithBackoff verifies failed candidates
|
||||
// re-enter the queue with an extended nextRetry.
|
||||
func TestVersionsHealQueue_RequeueWithBackoff(t *testing.T) {
|
||||
q := newVersionsHealQueue()
|
||||
c := &versionsHealCandidate{bucket: "b", object: "obj", attempts: 1}
|
||||
|
||||
q.requeue(c, 500*time.Millisecond)
|
||||
assert.Equal(t, 1, q.Len())
|
||||
|
||||
now := time.Now()
|
||||
due := q.popReady(now)
|
||||
assert.Empty(t, due, "not yet due immediately after requeue")
|
||||
|
||||
due = q.popReady(now.Add(time.Second))
|
||||
assert.Len(t, due, 1, "due after backoff window passes")
|
||||
}
|
||||
|
||||
// TestVersionsHealQueue_GiveUpAfterMaxAttempts ensures we don't loop
|
||||
// forever against a deterministically broken state.
|
||||
func TestVersionsHealQueue_GiveUpAfterMaxAttempts(t *testing.T) {
|
||||
q := newVersionsHealQueue()
|
||||
c := &versionsHealCandidate{bucket: "b", object: "obj", attempts: versionsHealMaxRetries}
|
||||
q.requeue(c, time.Millisecond)
|
||||
assert.Equal(t, 0, q.Len(), "candidate at max attempts is dropped, read-path heal still covers it")
|
||||
}
|
||||
|
||||
// TestRetryFilerOp_SucceedsBeforeExhaustion confirms a flaky op that
|
||||
// eventually succeeds is reported as success without surfacing prior
|
||||
// errors.
|
||||
func TestRetryFilerOp_SucceedsBeforeExhaustion(t *testing.T) {
|
||||
calls := 0
|
||||
err := retryFilerOp(context.Background(), "test", func() error {
|
||||
calls++
|
||||
if calls < 3 {
|
||||
return errors.New("transient")
|
||||
}
|
||||
return nil
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 3, calls, "stops calling once the op succeeds")
|
||||
}
|
||||
|
||||
// TestRetryFilerOp_PropagatesAfterExhaustion confirms a deterministic
|
||||
// failure is wrapped with the attempt count so operators can tell at
|
||||
// a glance whether the underlying issue is transient.
|
||||
func TestRetryFilerOp_PropagatesAfterExhaustion(t *testing.T) {
|
||||
calls := 0
|
||||
err := retryFilerOp(context.Background(), "test", func() error {
|
||||
calls++
|
||||
return errors.New("permanent")
|
||||
})
|
||||
require.Error(t, err)
|
||||
assert.Equal(t, updateLatestRetryAttempts, calls, "ran the full retry budget")
|
||||
assert.Contains(t, err.Error(), "exhausted")
|
||||
assert.Contains(t, err.Error(), "permanent", "underlying error preserved")
|
||||
}
|
||||
|
||||
// TestRetryFilerOp_ContextCancelInterruptsBackoff confirms that a ctx
|
||||
// canceled mid-backoff returns ctx.Err() immediately instead of
|
||||
// blocking until the worst-case ~6.3s retry budget elapses. Server
|
||||
// shutdown / client disconnect relies on this to drain in-flight
|
||||
// retries promptly.
|
||||
func TestRetryFilerOp_ContextCancelInterruptsBackoff(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
// Cancel after the first failed attempt has scheduled its backoff
|
||||
// but well before the timer fires.
|
||||
go func() {
|
||||
time.Sleep(30 * time.Millisecond)
|
||||
cancel()
|
||||
}()
|
||||
calls := 0
|
||||
start := time.Now()
|
||||
err := retryFilerOp(ctx, "test", func() error {
|
||||
calls++
|
||||
return errors.New("transient")
|
||||
})
|
||||
elapsed := time.Since(start)
|
||||
require.Error(t, err)
|
||||
assert.ErrorIs(t, err, context.Canceled, "must surface ctx.Err verbatim")
|
||||
assert.Less(t, elapsed, 500*time.Millisecond, "ctx cancel must interrupt the backoff sleep")
|
||||
assert.Less(t, calls, updateLatestRetryAttempts, "ctx cancel must short-circuit before exhausting the retry budget")
|
||||
}
|
||||
|
||||
// TestRetryFilerOp_TerminalErrorsShortCircuit confirms that errors which
|
||||
// won't change on retry (NotFound, context cancellation) are returned
|
||||
// immediately and unwrapped, without burning the retry budget.
|
||||
func TestRetryFilerOp_TerminalErrorsShortCircuit(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
err error
|
||||
}{
|
||||
{"filer_pb.ErrNotFound", filer_pb.ErrNotFound},
|
||||
{"wrapped filer_pb.ErrNotFound", fmt.Errorf("wrap: %w", filer_pb.ErrNotFound)},
|
||||
{"grpc NotFound status", status.Error(codes.NotFound, "missing")},
|
||||
{"context canceled", context.Canceled},
|
||||
{"context deadline exceeded", context.DeadlineExceeded},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
start := time.Now()
|
||||
calls := 0
|
||||
err := retryFilerOp(context.Background(), "test", func() error {
|
||||
calls++
|
||||
return tc.err
|
||||
})
|
||||
elapsed := time.Since(start)
|
||||
require.Error(t, err)
|
||||
assert.Equal(t, 1, calls, "terminal error must not be retried")
|
||||
assert.Less(t, elapsed, 50*time.Millisecond, "terminal error must not delay")
|
||||
assert.NotContains(t, err.Error(), "exhausted", "terminal error must not be wrapped with retry-budget prefix")
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
package s3err
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/fluent/fluent-logger-golang/fluent"
|
||||
@@ -183,14 +181,6 @@ func GetAccessLog(r *http.Request, HTTPStatusCode int, s3errCode ErrorCode) *Acc
|
||||
}
|
||||
|
||||
func PostLog(r *http.Request, HTTPStatusCode int, errorCode ErrorCode) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
// Mark before the Logger nil-check so the middleware fallback in track()
|
||||
// still sees that audit was handled by the caller in deployments that
|
||||
// haven't configured fluent — keeps the flag behavior consistent and
|
||||
// makes wiring testable without standing up a fluent server.
|
||||
markAuditLogged(r)
|
||||
if Logger == nil {
|
||||
return
|
||||
}
|
||||
@@ -207,50 +197,3 @@ func PostAccessLog(log AccessLog) {
|
||||
glog.Warning("Error while posting log: ", err)
|
||||
}
|
||||
}
|
||||
|
||||
// auditLogCtxKey identifies the per-request flag used to detect whether an
|
||||
// audit entry has already been emitted, so middleware can supply a fallback
|
||||
// log for handlers that don't call PostLog themselves without double-logging
|
||||
// the ones that do.
|
||||
type auditLogCtxKey struct{}
|
||||
|
||||
// EnsureAuditTracking attaches an audit-tracking flag to the request context
|
||||
// if one is not already present. Safe to call when no fluent logger is
|
||||
// configured; the flag is harmless in that case.
|
||||
func EnsureAuditTracking(r *http.Request) *http.Request {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
if v, ok := r.Context().Value(auditLogCtxKey{}).(*atomic.Bool); ok && v != nil {
|
||||
return r
|
||||
}
|
||||
flag := new(atomic.Bool)
|
||||
return r.WithContext(context.WithValue(r.Context(), auditLogCtxKey{}, flag))
|
||||
}
|
||||
|
||||
// MarkAuditLogged signals that an audit entry has already been emitted for r.
|
||||
// Callers that emit logs via paths other than PostLog (e.g. PostAccessLog in
|
||||
// batch delete) should invoke this so the middleware fallback skips r.
|
||||
func MarkAuditLogged(r *http.Request) {
|
||||
markAuditLogged(r)
|
||||
}
|
||||
|
||||
func markAuditLogged(r *http.Request) {
|
||||
if r == nil {
|
||||
return
|
||||
}
|
||||
if v, ok := r.Context().Value(auditLogCtxKey{}).(*atomic.Bool); ok && v != nil {
|
||||
v.Store(true)
|
||||
}
|
||||
}
|
||||
|
||||
// AuditAlreadyLogged reports whether PostLog (or MarkAuditLogged) has run for r.
|
||||
func AuditAlreadyLogged(r *http.Request) bool {
|
||||
if r == nil {
|
||||
return false
|
||||
}
|
||||
if v, ok := r.Context().Value(auditLogCtxKey{}).(*atomic.Bool); ok && v != nil {
|
||||
return v.Load()
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -85,18 +85,3 @@ func TestGetAccessLogRemoteIP(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestAuditTrackingFlag(t *testing.T) {
|
||||
req := httptest.NewRequest(http.MethodGet, "/bucket/object", nil)
|
||||
assert.False(t, AuditAlreadyLogged(req), "untracked request reports not logged")
|
||||
|
||||
tracked := EnsureAuditTracking(req)
|
||||
assert.NotSame(t, req, tracked, "EnsureAuditTracking returns a new request when no flag is present")
|
||||
assert.False(t, AuditAlreadyLogged(tracked), "tracked request starts unlogged")
|
||||
|
||||
again := EnsureAuditTracking(tracked)
|
||||
assert.Same(t, tracked, again, "EnsureAuditTracking is idempotent when flag already present")
|
||||
|
||||
MarkAuditLogged(tracked)
|
||||
assert.True(t, AuditAlreadyLogged(tracked), "flag flips after MarkAuditLogged")
|
||||
}
|
||||
+403
-181
@@ -1,270 +1,492 @@
|
||||
# S3 Lifecycle (Design)
|
||||
|
||||
The S3 lifecycle worker replaces the streaming + heap design with a daily meta-log replay. The worker runs as a scheduled job: "start, do today's work, stop" — no long-running per-shard goroutines, no future-buffered match heap.
|
||||
|
||||
This document is the as-built reference. For operator-facing guides, see the [SeaweedFS wiki](https://github.com/seaweedfs/seaweedfs/wiki).
|
||||
Replaces the current streaming + heap design with a daily meta-log replay. The worker becomes "start, do today's work, stop" — matching the operator's mental model and removing the per-shard heap that grows O(events × TTL_days).
|
||||
|
||||
## Goal
|
||||
|
||||
For each bucket lifecycle rule with TTL `D` days, the worker processes every object whose age exceeds `D` during each scheduled run, dispatching deletes via `LifecycleDelete`. Events whose dispatch returned a retryable / blocked outcome are reprocessed from the persisted cursor on later runs — head-of-line blocking is intentional rather than a per-key retry queue. No future-buffered Matches in memory. Cluster-wide delete rate cap allocated per worker. The worker exits when the pass completes.
|
||||
For each bucket lifecycle rule with TTL `D` days, delete every object whose age exceeds `D`, exactly once per day, with the worker exiting when the pass completes. No future-buffered Matches in memory. No tick-driven dispatch loop. Cluster-wide delete rate cap allocated per worker.
|
||||
|
||||
## Algorithm
|
||||
|
||||
One pass per scheduled invocation. The pass spawns one filer meta-log subscription, fans events out to per-shard processors by `ShardID(bucket, key)`, and drains each shard's events through the router + dispatcher:
|
||||
One pass per day, per shard:
|
||||
|
||||
```text
|
||||
dailyrun.Run(ctx, cfg):
|
||||
runNow = cfg.Now() // frozen for the whole pass
|
||||
snap = cfg.Engine.Snapshot()
|
||||
rsh = engine.ReplayContentHash(snap)
|
||||
maxTTL = engine.MaxEffectiveTTL(snap)
|
||||
daily_run(shardID):
|
||||
persisted = load_cursor(shardID) // { TsNs, rule_set_hash, promoted_hash }
|
||||
earliest_available = metalog.EarliestAvailableTsNs(shardID)
|
||||
retention_window = duration(now - earliest_available) // time.Duration; sole window input to engine
|
||||
snap = engine.CurrentSnapshot() // base; per-action active/Mode reflect compile-time state, not partition
|
||||
replay, walk = snap.RulesForShard(shardID, retention_window)
|
||||
if replay == nil and walk == nil: return // bucket has no rules
|
||||
rsh = engine.ReplayContentHash(snap) // content over ExpirationDays/NoncurrentDays/AbortMPU rules; partition-independent
|
||||
promoted = engine.PromotedHash(snap, retention_window) // rules currently in walk due to scan_only
|
||||
|
||||
if rsh != [32]byte{}: // replay-eligible rules present
|
||||
globalStartTsNs = min over cfg.Shards of (persisted cursor or runNow - maxTTL)
|
||||
reader = subscribeMeta(ShardPredicate ∈ cfg.Shards, StartTsNs = globalStartTsNs)
|
||||
fanOut(reader.Events → shardEvents[shardID]) until ev.TsNs > runNow
|
||||
needs_recovery_walk = (
|
||||
persisted is fresh // cold start
|
||||
or persisted.rule_set_hash != rsh // replay-rule edit
|
||||
or persisted.promoted_hash != promoted // partition flip in either direction
|
||||
or (replay != nil and persisted.TsNs < earliest_available) // retention loss; meaningless if pure walker bucket
|
||||
)
|
||||
|
||||
spawn one goroutine per shard:
|
||||
runShard(ctx, cfg, snap, runNow, shardID, shardEvents[shardID])
|
||||
|
||||
wait all
|
||||
teardown reader + fan-out
|
||||
|
||||
runShard(ctx, cfg, snap, runNow, shardID, events):
|
||||
persisted, found = cfg.Persister.Load(shardID)
|
||||
retentionWindow = cfg.RetentionWindow or maxTTL // see "retention" below
|
||||
promoted = engine.PromotedHash(snap, retentionWindow)
|
||||
|
||||
if rsh == [32]byte{}: // pure walker bucket
|
||||
if walkerDue and Walker:
|
||||
cfg.Walker(walkView) // RulesForShard.walk
|
||||
lastWalkedNs = runNow.UnixNano()
|
||||
save cursor (TsNs=0, rsh, promoted, lastWalkedNs)
|
||||
if needs_recovery_walk:
|
||||
// Catch already-due objects across ALL rules — both walker-bound and
|
||||
// replay-bound. Replay-bound rules may have objects whose mtime is
|
||||
// older than (now - max_ttl) that the steady-state replay window cannot
|
||||
// reach. The recovery view force-activates every action so the walker
|
||||
// doesn't skip event-driven rules that the base snapshot has marked
|
||||
// inactive (e.g., pre-BootstrapComplete).
|
||||
walker.RunForShard(ctx, shardID, engine.RecoveryView(snap), limiter)
|
||||
if replay == nil:
|
||||
save_cursor(shardID, { TsNs: 0, rule_set_hash: rsh, promoted_hash: promoted })
|
||||
else:
|
||||
save_cursor(shardID, { TsNs: now - engine.MaxEffectiveTTL(replay), rule_set_hash: rsh, promoted_hash: promoted })
|
||||
return
|
||||
|
||||
mustWalkRecovery = found && (persisted.RuleSetHash != rsh || persisted.PromotedHash != promoted)
|
||||
mustWalkColdStart = !found
|
||||
// --- Steady-state path. ----------------------------------------------
|
||||
if walk != nil:
|
||||
walker.RunForShard(ctx, shardID, walk, limiter) // walker-bound actions only
|
||||
|
||||
if mustWalkRecovery or mustWalkColdStart:
|
||||
cfg.Walker(engine.RecoveryView(snap)) // every rule, force-active
|
||||
walkedThisPass = true
|
||||
lastWalkedNs = runNow.UnixNano()
|
||||
if mustWalkRecovery:
|
||||
save cursor (TsNs = runNow - maxTTL, rsh, promoted, lastWalkedNs) // rewind
|
||||
return
|
||||
if replay == nil:
|
||||
save_cursor(shardID, { TsNs: 0, rule_set_hash: rsh, promoted_hash: promoted })
|
||||
return
|
||||
|
||||
if Walker and !walkedThisPass and walkerDue:
|
||||
cfg.Walker(walkView) // steady-state walker
|
||||
lastWalkedNs = runNow.UnixNano()
|
||||
max_ttl = engine.MaxEffectiveTTL(replay)
|
||||
cursor = max(persisted.TsNs, now - max_ttl)
|
||||
done = {r: false for r in replay.activeRules()}
|
||||
last_ok = persisted.TsNs
|
||||
|
||||
startTsNs = !found ? runNow - maxTTL : persisted.TsNs // steady state honors cursor
|
||||
lastOK, _, drainErr = drainShardEvents(ctx, cfg, runNow, shardID, snap, startTsNs, events)
|
||||
save cursor (TsNs = lastOK, rsh, promoted, lastWalkedNs)
|
||||
for ev in metalog.from(shardID, cursor): // ascending TsNs
|
||||
if all(done.values()): break
|
||||
halt = false
|
||||
matches = router.Route(ctx, replay, ev, now, lister) // existing signature; replay is *engine.Snapshot
|
||||
for m in matches:
|
||||
r = replay.lookup(m.RuleHash)
|
||||
if r == nil or done[r]: continue
|
||||
if m.DueTime > now:
|
||||
done[r] = true // monotonic for replay kinds
|
||||
continue
|
||||
limiter.wait()
|
||||
outcome = dispatch_delete(m.Bucket, m.ObjectKey, m.VersionID,
|
||||
expected_mtime=m.Identity.mtime, ruleHash=m.RuleHash)
|
||||
if outcome is unresolved (RETRY_LATER, transport error after in-run retries, BLOCKED):
|
||||
halt = true; break
|
||||
if halt: break
|
||||
last_ok = ev.TsNs
|
||||
|
||||
save_cursor(shardID, { TsNs: last_ok, rule_set_hash: rsh, promoted_hash: promoted })
|
||||
```
|
||||
|
||||
Walker invocations — three call sites, distinct conditions:
|
||||
Two distinct walker invocations, deliberately:
|
||||
|
||||
| Branch | View | Trigger | Throttle |
|
||||
|---|---|---|---|
|
||||
| Recovery | `engine.RecoveryView(snap)` | `mustWalkColdStart` or `mustWalkRecovery` | Unconditional |
|
||||
| Steady state | `RulesForShard.walk` | `!walkedThisPass && walkerDue` | `WalkerInterval` |
|
||||
| Empty replay | `RulesForShard.walk` | `rsh == [32]byte{}` and `walkerDue` | `WalkerInterval` |
|
||||
| Branch | Walker input | Why |
|
||||
|---|---|---|
|
||||
| Recovery (cold-start, replay-rule edit, retention loss, partition flip) | `engine.RecoveryView(snap)` — every action clone force-`markActive()`'d, `Mode` preserved | Catch already-due objects across all rules — including replay-bound rules whose subjects are older than `max_ttl` (replay scan window cannot reach), *and* event-driven rules the base snapshot may mark inactive (`compile.go:73-74` requires `BootstrapComplete`). |
|
||||
| Steady-state | `walk` (walker-only actions) | Replay handles its own rules via the meta-log scan. Walker only runs for actions that have no replay path. |
|
||||
|
||||
`walkerDue` returns true when `WalkerInterval == 0`, or when no walk has happened yet (`LastWalkedNs == 0`), or when `runNow - LastWalkedNs >= WalkerInterval`. Within-pass double-fire suppression lives in `runShard`'s `walkedThisPass` flag, not in `walkerDue` — the recovery branch fires the walker with `RecoveryView` (a superset of every per-shard partition), so the steady-state branch must not re-walk in the same pass.
|
||||
`router.Route` and `walker.RunForShard` keep their existing `*engine.Snapshot` parameter; `replay`, `walk`, and `snap` are all `*Snapshot` values.
|
||||
|
||||
## Engine surface
|
||||
The single API surface is:
|
||||
|
||||
```go
|
||||
// In engine:
|
||||
func (e *Engine) Snapshot() *Snapshot
|
||||
func CurrentSnapshot() *Snapshot // base
|
||||
func (s *Snapshot) RulesForShard(shardID int, retentionWindow time.Duration) (replay, walk *Snapshot)
|
||||
func RecoveryView(s *Snapshot) *Snapshot
|
||||
func ReplayContentHash(s *Snapshot) [32]byte
|
||||
func PromotedHash(s *Snapshot, retentionWindow time.Duration) [32]byte
|
||||
func MaxEffectiveTTL(s *Snapshot) time.Duration
|
||||
func RecoveryView(s *Snapshot) *Snapshot // every action force-activated; recovery walker only
|
||||
func ReplayContentHash(s *Snapshot) [32]byte // content over replay-eligible rules; partition-independent
|
||||
func PromotedHash(s *Snapshot, retentionWindow time.Duration) [32]byte // hash of replay-eligible rules currently in walk (scan_only)
|
||||
func MaxEffectiveTTL(s *Snapshot) time.Duration // max over active replay actions
|
||||
```
|
||||
|
||||
`RulesForShard` and `RecoveryView` return new `*Snapshot` instances with cloned `*CompiledAction` objects and shared (by pointer) rule definitions. Fields that differ from the base:
|
||||
`RulesForShard` and `RecoveryView` both return new `*Snapshot` instances with cloned `*CompiledAction` objects and shared (by pointer) rule definitions. The fields that differ from the base are:
|
||||
|
||||
- **`active`** — per clone, set per view.
|
||||
- **`Mode`** — rewritten to `ModeEventDriven` on `replay` clones; preserved on `walk` and `recovery` clones. The rewrite is required because `router.Route` gates on `Mode == ModeEventDriven`, and today's compile preserves a persistent `prior.Mode = ModeScanOnly` that would otherwise lock a rule out of replay even after retention rehabilitates it.
|
||||
- **Action-map membership** — `replay` contains only replay-eligible clones; `walk` contains only walker-bound clones; `recovery` contains every action.
|
||||
- **`active`** (per clone) — set per view.
|
||||
- **`Mode`** (per clone) — rewritten to `ModeEventDriven` on `replay` clones; preserved as-is on `walk` and `recovery` clones. The rewrite is required because `router.Route` gates on `Mode == ModeEventDriven` (`router.go:134, 253, 413, 479, 566, 623, 844`), and today's compile preserves a persistent `prior.Mode = ModeScanOnly` that would otherwise lock the action out of replay even after retention rehabilitates it.
|
||||
- **Action-map membership** — `replay`'s map contains only replay-eligible clones; `walk`'s contains only walker-bound clones; `recovery`'s contains every action.
|
||||
|
||||
Shared-by-pointer with the base: `Rule` definitions, predicate maps, `RuleHash` table.
|
||||
Per-view settings are summarized in the table under "`router.Route` integration."
|
||||
|
||||
## `router.Route` integration
|
||||
`router.Route` is the existing entry point — it computes `ComputeDueAt`, applies predicate filters, expands one event into 0+ `Match`es (e.g., a demoting PUT produces one for the new version's lifecycle and another for the displaced version's `NoncurrentDays`). The replay path delegates due-time math to the engine so all replay-eligible action kinds (`ExpirationDays`, `NoncurrentDays`, `AbortMPU`) are handled uniformly.
|
||||
|
||||
`router.Route(ctx, snap, ev, now, lister)` iterates every action with `IsActive() == true` in the snapshot. Two snapshots can't disagree on activation if they share the same `*CompiledAction` pointers, which is why `RulesForShard` clones.
|
||||
### `router.Route` integration
|
||||
|
||||
Today's `router.Route(ctx, snap *engine.Snapshot, ev, now, lister)` iterates every action with `IsActive() == true` in the snapshot. `IsActive` is **instance-level state on `*CompiledAction`** (`engine/compile.go:73-85`, `ca.markActive()`), so two snapshots can't disagree on activation if they share the same `*CompiledAction` pointers.
|
||||
|
||||
**Approach: views are independent `*Snapshot` instances with cloned `CompiledAction` objects.**
|
||||
|
||||
Two gating fields are instance-level on `*CompiledAction` and must both match what the downstream call site expects:
|
||||
|
||||
- `active` (`engine/compile.go:73-85`) — gates routing and walker iteration.
|
||||
- `Mode` — `router.Route` requires `Mode == engine.ModeEventDriven` at every emit site (`router.go:134, 253, 413, 479, 566, 623, 844`); the walker rejects only `Mode == engine.ModeDisabled` (`walker.go:147`). Today's compile preserves `prior.Mode`, so a rule previously promoted to `ModeScanOnly` will still be skipped by `router.Route` even if `active=true`.
|
||||
|
||||
`engine.Snapshot.RulesForShard(shardID, retentionWindow) (replay, walk *Snapshot)` returns two new `*Snapshot` instances. Each has its own `actions map[ActionKey]*CompiledAction` containing *clones* of the originals with **both `active` and `Mode` rewritten** per view. The partition predicate is "TTL ≤ retentionWindow" for replay membership; the engine does no clock arithmetic of its own — `retentionWindow` is the only window input it receives:
|
||||
|
||||
| View | Clone settings | Why |
|
||||
|---|---|---|
|
||||
| `replay` | `active = true`, `Mode = ModeEventDriven` | `router.Route` requires `ModeEventDriven`. Forced regardless of `prior.Mode`. |
|
||||
| `walk` | `active = true`, `Mode` preserved | Walker accepts any non-`ModeDisabled` Mode. |
|
||||
| `recovery` | `active = true`, `Mode` preserved | Walker iterates all action clones. |
|
||||
| `replay` | `active = true`, `Mode = ModeEventDriven` | `router.Route` requires `ModeEventDriven`. Forced regardless of `prior.Mode`, so a rule previously stuck in `ModeScanOnly` is rehabilitated when retention now fits its TTL. |
|
||||
| `walk` | `active = true`, `Mode` preserved from original (any non-`ModeDisabled` is accepted by the walker) | Walker doesn't gate on a specific Mode value, so no rewrite needed beyond ensuring `active`. |
|
||||
| `recovery` (see below) | `active = true`, `Mode` preserved | Recovery walker iterates all action clones; preserving `Mode` lets each rule's evaluator do its normal predicate work. |
|
||||
|
||||
## Subscription model
|
||||
Shared-by-pointer with the base: `Rule` definitions, predicate maps, `RuleHash` table, and other immutable data — memory overhead is one `CompiledAction` struct per action per view (tens of bytes × dozens of actions, not megabytes).
|
||||
|
||||
One filer `SubscribeMetadata` stream per `dailyrun.Run()` call, covering every shard in `cfg.Shards`. The `Reader` carries a `ShardPredicate func(int) bool` that accepts the shard set; a fan-out goroutine routes events to per-shard channels by `ev.ShardID`. This replaces the earlier model (16 separate per-shard subscriptions per pass).
|
||||
Membership:
|
||||
|
||||
`globalStartTsNs = min(per-shard cursor, runNow - maxTTL)`. Pre-loaded once at pass start so the subscription's `StartTsNs` covers every shard's needed range; per-shard drains then filter `ev.TsNs <= shard.startTsNs` locally.
|
||||
- `replay`: clones of `ExpirationDays`, `NoncurrentDays`, `AbortMPU` actions whose TTL ≤ `retentionWindow`. The Mode rewrite is what makes "rehabilitation" work — retention recovers, a previously `ModeScanOnly`-stuck rule clone now reads as `ModeEventDriven` in the replay view.
|
||||
- `walk`: clones of `ExpirationDate`, `ExpiredDeleteMarker`, `NewerNoncurrent`, plus `scan_only`-promoted clones whose TTL exceeds `retentionWindow`.
|
||||
- Either return value may be `nil` if its partition is empty.
|
||||
|
||||
Fan-out cancels the reader on the first `ev.TsNs > runNow` (meta-log events arrive in TsNs order; everything after is past the pass boundary). Per-shard channels are buffered to 256 events — large enough to absorb bursts without back-pressuring the fan-out.
|
||||
The daily replay loop calls `router.Route(ctx, replay, ev, now, lister)`. Steady-state walker calls `walker.RunForShard(ctx, shardID, walk, limiter)`. Both call sites are drop-in — they see the correct, per-partition set with the correct `(active, Mode)` for their gating logic.
|
||||
|
||||
## Action kinds and dispatch paths
|
||||
|
||||
Table uses the S3-spec rule names (what operators type in lifecycle XML). The corresponding engine constants in `weed/s3api/s3lifecycle/action_kind.go` are `ActionKindExpirationDays`, `ActionKindNoncurrentDays`, `ActionKindAbortMPU`, `ActionKindExpirationDate`, `ActionKindExpiredDeleteMarker`, `ActionKindNewerNoncurrent` — same one-to-one mapping, shorter spelling.
|
||||
|
||||
| ActionKind | Trigger | Due time | Path | Early-stop in replay? |
|
||||
|---|---|---|---|---|
|
||||
| `ExpirationDays` | Latest-version PUT | `ev.TsNs + r.ExpirationDays` | Replay | Yes |
|
||||
| `NoncurrentDays` | Demotion (next PUT for same key) | `entry.NoncurrentSince + r.NoncurrentDays` | Replay | Yes |
|
||||
| `AbortIncompleteMultipartUpload` | MPU init | `mpu_init.TsNs + r.AbortMPUDaysAfterInitiation` | Replay | Yes |
|
||||
| `ExpirationDate` | Latest-version PUT, fires on `now >= r.ExpirationDate` | `r.ExpirationDate` (constant) | Walker | n/a |
|
||||
| `ExpiredObjectDeleteMarker` | Delete marker with `NumVersions == 1` | "now if orphaned, else never" | Walker | n/a |
|
||||
| `NewerNoncurrentVersions` | Version becomes noncurrent AND total noncurrents > `r.NewerNoncurrentVersions` | "now if over the cap, else never" | Walker | n/a |
|
||||
|
||||
`ExpiredObjectDeleteMarker` and `NewerNoncurrentVersions` are walker-only because their due-time depends on current sibling state, not on any event's TsNs. The `done` early-stop in replay can't engage — there's nothing event-time-monotonic to early-stop on.
|
||||
|
||||
## Cursor
|
||||
|
||||
Persisted per shard at `/etc/s3/lifecycle/daily-cursors/shard-NN.json`. Shape (`weed/s3api/s3lifecycle/dailyrun/cursor.go`):
|
||||
**Recovery view (separate).** The recovery branch needs the walker to see **all** replay-eligible + walker-eligible actions as active, including event-driven actions that the base snapshot may have marked inactive (`compile.go:73-74`: event-driven actions require `BootstrapComplete`). Add:
|
||||
|
||||
```go
|
||||
type Cursor struct {
|
||||
TsNs int64 // last meta-log event whose matches all dispatched
|
||||
RuleSetHash [32]byte // ReplayContentHash of the rule set that wrote this
|
||||
PromotedHash [32]byte // PromotedHash with retentionWindow at write time
|
||||
LastWalkedNs int64 // wall-clock of the last successful walker fire
|
||||
}
|
||||
func RecoveryView(s *Snapshot) *Snapshot
|
||||
```
|
||||
|
||||
`LastWalkedNs` is JSON-omitempty, so cursor files written before that field existed decode cleanly as zero (treated as "never walked steady-state" → next pass seeds the anchor).
|
||||
`RecoveryView` is a third `*Snapshot` instance whose action clones are all `markActive()`'d, with `Mode` preserved from the original. The walker accepts any non-`ModeDisabled` Mode, so no rewrite is needed. The recovery branch calls `walker.RunForShard(ctx, shardID, engine.RecoveryView(snap), limiter)`. Without this, recovery would silently skip any rule the base snapshot considers inactive — defeating the recovery branch's purpose of catching already-due objects across the full rule set.
|
||||
|
||||
Cursor save uses a fresh `context.Background()` with a 5s timeout because the steady-state drain exits via passCtx cancellation (the only way an idle subscription ends). Saving with the canceled passCtx would silently drop the cursor and the next pass would re-replay from the same floor.
|
||||
`RecoveryView` does not participate in steady-state. It exists only for the recovery walker invocation.
|
||||
|
||||
In steady state the start position honors the cursor verbatim — the floor `runNow - maxTTL` is applied only on cold start (`!found`). The drain freezes the cursor at the last pre-skip event so pending matches with `DueTime == TsNs + maxTTL` stay in scope across passes; bumping forward in steady state would orphan exactly those events.
|
||||
**`scan_only` input path.** The retention boundary used for promotion is supplied explicitly via `retentionWindow time.Duration`, not derived inside the engine. `daily_run` computes it once at run start (`retention_window = duration(now - metalog.EarliestAvailableTsNs(shardID))`) and passes it to `RulesForShard` and `PromotedHash`. The promotion decision is therefore stable across one `daily_run` invocation — a rule that flips between `replay` and `walk` mid-run does not re-route; it gets its new bucket on the next day's `RulesForShard` call. `RecoveryView` takes only the base snapshot — it activates everything, partition-independent.
|
||||
|
||||
## Cursor hashes
|
||||
This approach keeps `router.Route` and `walker.Run` signatures unchanged. The trade-off is cloning `CompiledAction` per view (and rewriting `Mode` in the replay view); the alternative (adding a filter parameter to `Route` or restructuring `IsActive`/`Mode` to be view-scoped) would force every call site — including the streaming dispatcher during Phase 2/3 — to thread the filter, while clone-per-view localizes the partition decision to the engine. The Mode rewrite also bypasses today's persistent `prior.Mode = ModeScanOnly` lock-in, which is now obsoleted by the new partition logic.
|
||||
|
||||
The cursor stores two hashes that together detect every situation invalidating "everything before persisted.TsNs has been processed under the same rules":
|
||||
Why correct:
|
||||
|
||||
**`RuleSetHash = engine.ReplayContentHash(snap)`** — content over the rule definitions (action kind, predicate, TTL value) of replay-eligible action kinds. Partition-independent.
|
||||
- Meta-log is TsNs-ordered. For any rule `R`, `due_time` is also monotonic in TsNs (see "Due-time source"), so the first not-yet-due event for `R` proves every later event is also not-yet-due. Hence the `done` flag.
|
||||
- Multiple rules fan out on the same scan: one meta-log read, N predicate checks per event.
|
||||
- Identity drift (object overwritten between event and delete) is caught at the RPC by the existing `LifecycleDelete` identity-CAS, which returns `NOOP_RESOLVED` for stale events. The algorithm dispatches optimistically and lets the server filter.
|
||||
|
||||
**`PromotedHash = engine.PromotedHash(snap, retentionWindow)`** — hash of replay-eligible rules currently classified as `walk` due to `scan_only` promotion (their TTL exceeds `retentionWindow`).
|
||||
### Action kinds and dispatch paths
|
||||
|
||||
The engine defines six action kinds (`weed/s3api/s3lifecycle/action_kind.go`). Each has a distinct trigger and due-time semantics, and they split into two dispatch paths. Replay path uses meta-log iteration with the `done` early-stop; walker path lists current bucket state.
|
||||
|
||||
| ActionKind | Trigger | Due time | Path | Early-stop? |
|
||||
|---|---|---|---|---|
|
||||
| `ExpirationDays` | Latest-version PUT | `ev.TsNs + r.ExpirationDays` | Replay | Yes — `due` strictly increasing in iteration order |
|
||||
| `NoncurrentDays` | Demotion (next PUT for same key) | `entry.noncurrent_since + r.NoncurrentDays` | Replay | Yes — `noncurrent_since` is the demoting event's TsNs (see "`noncurrent_since`" below), monotonic |
|
||||
| `AbortMPU` | MPU init | `mpu_init.TsNs + r.AbortMPUDaysAfterInitiation` | Replay | Yes — same monotonicity as `ExpirationDays` |
|
||||
| `ExpirationDate` | Latest-version PUT, fired on `now >= r.ExpirationDate` | `r.ExpirationDate` (constant) | Walker | n/a — fixed wall-clock date, fires once per object |
|
||||
| `ExpiredDeleteMarker` | Delete marker with `NumVersions == 1` (no remaining siblings) | "now if orphaned, else never" — depends on current bucket state, not event age | Walker | n/a — requires sibling lookup, not derivable from event TsNs |
|
||||
| `NewerNoncurrent` | Version becomes noncurrent AND total noncurrents > `r.NewerNoncurrentVersions` | "now if over the count cap, else never" — count is current state | Walker | n/a — requires version-list lookup |
|
||||
|
||||
Why `ExpiredDeleteMarker` and `NewerNoncurrent` are walker-only:
|
||||
|
||||
Both rules' "due time" depends on the *current* state of sibling versions, not on any single event's timestamp. Modeling them as replay would force a sibling-list lookup on every meta-log event for the matching keys (today's `router.Route` does exactly this), and the `done` early-stop would never engage because the trigger condition isn't event-time-monotonic. They fit the walker far better: list each key's versions once per day, evaluate the rule against current state, emit deletes. Today's `bootstrap/walker.go` already handles them via `EvaluateAction`.
|
||||
|
||||
`expected_mtime` passed to `LifecycleDelete` is always the entry's original mtime (used for identity CAS), regardless of action kind. The TTL clock and the CAS identity are separate concerns.
|
||||
|
||||
### Rule changes
|
||||
|
||||
Rule changes invalidate the persisted cursor's assumption that "everything older has already been processed under the same rules." The algorithm tracks `rule_set_hash` alongside the cursor and forces a bootstrap walk on mismatch. Cases this covers:
|
||||
|
||||
- New rule added → walker discovers existing objects under the new rule.
|
||||
- TTL increased (e.g. 30d → 60d) → walker discovers objects in `[now-60d, now-30d]` that were skipped while the old rule ran.
|
||||
- Predicate widened (prefix/tag filter change) → walker re-evaluates everything.
|
||||
- TTL decreased / predicate narrowed → walker still runs (harmless re-evaluation), but the next daily run picks up steady-state quickly.
|
||||
|
||||
Bootstrap walker on rule change is a one-shot full bucket list. Cost is proportional to bucket size, not history; acceptable as an infrequent event.
|
||||
|
||||
### Bootstrap retention window
|
||||
|
||||
The walker only deletes objects whose age already exceeds their TTL. Not-yet-due objects are intentionally left for the meta-log path. If the post-walker cursor were set to `now`, the next daily replay would scan from `now` forward and never see the PUT event for, say, a 20-day-old object under a 30-day rule — that event sits at `TsNs ≈ now - 20d`, before the cursor.
|
||||
|
||||
The cursor is therefore reset to `now - max_ttl` (excluding `ScanAtDate` rules from `max_ttl`, since those don't use the replay path). The clamp `max(persisted, now - max_ttl)` in the steady-state algorithm preserves the sliding window: each day the effective scan range is `[now - max_ttl, now]`, and not-yet-due events surface naturally as they age in.
|
||||
|
||||
Invariant this depends on: **meta-log retention ≥ max_ttl**. If retention is shorter, events for some still-pending objects age out before they become due. Detected at run start by comparing the meta-log's earliest available TsNs against `now - max_ttl`; if the gap is non-empty, the affected rules are flagged `scan_only` for that run and routed to the walker (see "Scan-at-date and scan-only paths").
|
||||
|
||||
### Replay vs walker: single source of truth
|
||||
|
||||
`Snapshot.RulesForShard(shardID, retentionWindow) (replay, walk *Snapshot)` is the **only** place that decides which path each compiled action takes during steady state. Both return values are new `*Snapshot` instances containing cloned `*CompiledAction` values with per-partition `active` flags (see "`router.Route` integration" for why cloning is required); either may be `nil` when its partition is empty. Every other component (`daily_run`, the walker invocation, the cursor's `RuleSetHash`, the `max_ttl` calculation) reads through these views. A given compiled action's clone has `active=true` in exactly one of `replay` or `walk`:
|
||||
|
||||
| Reason for walker | Engine signal |
|
||||
|---|---|
|
||||
| `ExpirationDate` (`ModeScanAtDate`) | `compile.go:73` sets `mode == ModeScanAtDate` |
|
||||
| `ExpiredDeleteMarker` | Action kind requires sibling count |
|
||||
| `NewerNoncurrent` | Action kind requires version count |
|
||||
| `scan_only` (TTL > meta-log retention) | `event_log_horizon.go` check against earliest available TsNs at run start |
|
||||
|
||||
Everything else (`ExpirationDays`, `NoncurrentDays`, `AbortMPU` when TTL fits in retention) is on the replay list.
|
||||
|
||||
The `effective_ttl` per active replay action — used by `engine.MaxEffectiveTTL(replay)` — is:
|
||||
|
||||
- `ExpirationDays.ExpirationDays`
|
||||
- `NoncurrentDays.NoncurrentDays`
|
||||
- `AbortMPU.AbortMPUDaysAfterInitiation`
|
||||
|
||||
Walker actions don't appear as active in `replay`, so they naturally contribute nothing to `MaxEffectiveTTL` — the cursor sliding window only governs replay.
|
||||
|
||||
If `snap.replay` is empty (e.g., a bucket whose only rule is `ExpirationDate`), the cursor's `TsNs` is recorded as `0` (or any sentinel) and never read; only `RuleSetHash` matters, so a future addition of a replay rule is detected and triggers the rewind branch. The walker still runs every day for the walker rules.
|
||||
|
||||
### Cursor hashes: `RuleSetHash` and `PromotedHash`
|
||||
|
||||
The cursor stores two hashes. Together they detect every situation that invalidates the cursor's "everything before persisted.TsNs has been processed under the same rules" assumption.
|
||||
|
||||
**`RuleSetHash = engine.ReplayContentHash(snap)`** — content over the rule definitions (action kind, predicate, TTL value) of replay-eligible action kinds (`ExpirationDays`, `NoncurrentDays`, `AbortMPU`) in the base snapshot. Partition-independent.
|
||||
|
||||
**`PromotedHash = engine.PromotedHash(snap, retentionWindow)`** — hash of the set of replay-eligible rules that are currently classified as `walk` due to `scan_only` (their TTL exceeds `retentionWindow`). Changes when retention shifts move rules between partitions, even if XML rules and their content are unchanged.
|
||||
|
||||
Why two hashes: a replay-cursor rewind is needed when either the rule definitions change *or* when a rule transitions between partitions in either direction.
|
||||
|
||||
- Promotion (replay → walk, retention dropped): the promoted rule's meta-log events for in-flight objects are no longer reachable. Walker must take over for that rule. Cursor for other replay rules is fine, but the recovery branch's full-rule-set walk is still the safest catch-up — `PromotedHash` change triggers it.
|
||||
- Demotion (walk → replay, retention recovered): the rule's events are now reachable again in meta-log. **But persisted.TsNs may be forward of where the rule's relevant events live**, because other replay rules kept the cursor advancing while this rule was in walk. The `persisted.TsNs < earliest_available` check does not catch this — that check fires only on retention regression. Demotion is detected by `PromotedHash` change.
|
||||
|
||||
Recovery triggers, complete list:
|
||||
|
||||
| Trigger | Detection | Why |
|
||||
|---|---|---|
|
||||
| Cold start | No persisted cursor | First run for this shard |
|
||||
| Replay-rule edit | `RuleSetHash` mismatch | Replay-eligible rule content changed |
|
||||
| Cold start | No persisted cursor | First run |
|
||||
| Replay-rule edit | `RuleSetHash` mismatch | Content of replay-eligible rules changed |
|
||||
| Retention loss | `replay != nil && persisted.TsNs < earliest_available` | Worker was down or retention shrank past cursor. Gated on `replay != nil` so the TsNs sentinel (`0`) used by pure walker buckets doesn't perpetually trigger recovery. |
|
||||
| Partition flip | `PromotedHash` mismatch | A replay-eligible rule moved between `replay` and `walk` |
|
||||
|
||||
Retention loss as a recovery trigger is a known gap: in stock SeaweedFS the filer's meta-log is effectively never GC'd (no on-disk retention policy for `/topics/.system/log`), so `cfg.RetentionWindow` defaults to `maxTTL` and PromotedHash stays empty. When operators add explicit meta-log retention, the cursor-vs-earliest-available check becomes load-bearing again.
|
||||
Walker-only rule edits (`ExpirationDate`, `ExpiredDeleteMarker`, `NewerNoncurrent`, or any rule with no replay-eligible action kind) do not change either hash. They are picked up by the steady-state `walk` invocation; replay cursor is untouched.
|
||||
|
||||
## Walker throttle
|
||||
Practical consequences:
|
||||
|
||||
`cfg.WalkerInterval` decouples the walker's cadence from `Run()` invocation cadence. The s3tests CI workflow invokes the worker every 2s; a single daily admin schedule invokes it once per day. The walker fire rate should be set by walk cost, not by the invocation interval — so:
|
||||
- Adding/removing/modifying a walker-only rule: both hashes unchanged, replay cursor untouched.
|
||||
- Retention drops (replay rule promotes to walk): `RuleSetHash` unchanged, `PromotedHash` changes → recovery fires. Walker over base catches already-due objects; cursor rewinds for replay continuity.
|
||||
- Retention recovers (rule demotes back to replay): `RuleSetHash` unchanged, `PromotedHash` changes → recovery fires. The demoted rule's events get a fresh scan window via the rewind.
|
||||
- Editing a replay-eligible XML rule: `RuleSetHash` changes → recovery fires. Walker covers the full rule set; already-due objects under the new rule are caught.
|
||||
|
||||
- Steady-state and empty-replay walker fires gate on `walkerDue(persisted.LastWalkedNs, runNow, WalkerInterval)`.
|
||||
- `0` keeps the prior "fire every pass" behavior (back-compat for tests).
|
||||
- Production: pick the walk cost budget per shard per cluster. Small cluster: 1h. Large cluster: 6h+.
|
||||
- Recovery walker fires (cold-start, hash mismatch) are unconditional — these are bounded events that must run once.
|
||||
### Shard-aware walker
|
||||
|
||||
Walker fires update `Cursor.LastWalkedNs` so the next pass's throttle has a fresh anchor. The recovery walker also updates it, so a steady-state branch in the same pass doesn't double-walk over the same superset.
|
||||
Today's walker (`bootstrap/walker.go`) is bucket-wide: it lists every entry under a bucket and emits matches regardless of `ShardID`. Shards are derived as `sha256(bucket||"/"||key) >> 252` (`weed/s3api/s3lifecycle/shard.go:23`), so a single bucket's objects spread across all 16 shards.
|
||||
|
||||
## Delete failure handling
|
||||
Daily replay is per-shard, so a per-shard `daily_run(shardID)` invoking the bucket-wide walker would have all 16 shards re-walk every bucket — 16× the filer listing cost, 16× the duplicate delete RPCs (idempotent but wasteful and noisy in metrics).
|
||||
|
||||
Cursor advance is gated on success. The cursor only moves past events whose matches all returned `DONE`, `NOOP_RESOLVED`, or `SKIPPED_OBJECT_LOCK`. Any other outcome (`RETRY_LATER`, `BLOCKED`, transport error after in-run retries) halts the run and persists the cursor at the last fully-processed event.
|
||||
Two paths are workable; the design picks the simpler one and notes the optimization:
|
||||
|
||||
- **Head-of-line blocking is intentional.** A transient filer error stalls today's pass; tomorrow's run resumes at the same cursor. Loud (operator sees stuck cursor in metrics) and idempotent (identity-CAS makes redundant deletes no-ops).
|
||||
- **In-run retry with backoff** for transport errors only — default 3 attempts, exponential backoff capped at 5s. Server-side outcomes are not retried in-run.
|
||||
- **No retry queue.** Removing the per-key freeze state was the whole point; adding it back would re-introduce the state machine the redesign replaces.
|
||||
1. **Shard-filtering walker (chosen).** Add `walker.RunForShard(shardID int, ...)`. The walker still does one full bucket listing, but for each entry it computes `ShardID(bucket, key)` and skips entries not in the target shard. Cost: still 1 listing per shard per bucket = 16× listing total. Simpler; no coordination across workers. Acceptable for buckets up to ~100M entries where listing is cheap relative to deletes.
|
||||
2. **Bucket-coordinated walker (future).** A separate coordinator (e.g., the worker that owns shard 0 for that bucket) runs the walker once, routing emitted matches to each shard's local injection point. 1 listing per bucket total. Requires a coordination layer that today's plugin/worker model doesn't have. Tracked as an optimization, not blocking.
|
||||
|
||||
## Rate limiting
|
||||
Path #1 is wire-compatible with today's walker — only the iteration filter changes. `RunForShard` is a thin wrapper that takes a shard predicate; the existing `Run(bucket)` becomes `RunForShard(shard, bucket)` with `shard == any`.
|
||||
|
||||
Cluster-wide deletes-per-second cap, set in admin config. The admin allocator:
|
||||
### Delete failure handling
|
||||
|
||||
1. Counts workers capable of `s3_lifecycle` from the registry.
|
||||
2. Divides `cluster_deletes_per_second` by the count.
|
||||
3. Writes the per-worker share into `ExecuteJobRequest.ClusterContext.Metadata["s3_lifecycle.deletes_per_second"]`.
|
||||
Cursor advance is gated on success. The cursor only moves past events whose deletes returned `DONE`, `NOOP_RESOLVED`, or `SKIPPED_OBJECT_LOCK` (lock-protected, but rule semantics are satisfied). Any other outcome — `RETRY_LATER`, `BLOCKED`, or transport error after in-run retries — halts the run and persists the cursor at the last fully-processed event.
|
||||
|
||||
The worker reads the share and constructs one `golang.org/x/time/rate.Limiter` shared across all shard goroutines. `dispatchWithRetry` calls `limiter.Wait(ctx)` before each `LifecycleDelete` RPC.
|
||||
Semantics:
|
||||
|
||||
## Observability
|
||||
- **Head-of-line blocking is intentional.** A transient filer error stalls the rest of today's pass; tomorrow's run resumes at the same cursor and retries from the failing event. This is loud — operator sees a stuck cursor in metrics — and idempotent (identity-CAS makes any redundant delete a no-op).
|
||||
- **In-run retry with backoff** for transport errors only (default 3 attempts, exponential backoff). Server-side outcomes (`RETRY_LATER`, `BLOCKED`) are not retried in-run; the server already classified them as "wait until next run."
|
||||
- **No separate retry queue.** Removing the per-key freeze state was the whole point — adding it back would re-introduce the state machine this design replaces.
|
||||
|
||||
Per-shard Prometheus gauges (`weed/stats/metrics.go`):
|
||||
|
||||
| Metric | What it tells you |
|
||||
|---|---|
|
||||
| `s3_lifecycle_cursor_min_ts_ns{shard}` | `now - this` is the per-shard replay lag |
|
||||
| `s3_lifecycle_daily_run_last_walked_ns{shard}` | `now - this` is walker freshness; stuck = throttle misconfigured or walker failing |
|
||||
| `s3_lifecycle_daily_run_shard_duration_seconds{shard}` | Wall-clock per shard pass |
|
||||
| `s3_lifecycle_daily_run_events_scanned_total{shard}` | Counter of meta-log events drainShardEvents processed |
|
||||
| `s3_lifecycle_dispatch_limiter_wait_seconds` | Per-dispatch wait time on the cluster rate limiter |
|
||||
| `s3_lifecycle_dispatch_total{bucket,kind,outcome}` | Per-bucket dispatch counter |
|
||||
|
||||
Heartbeat log line, emitted once per `Run()`:
|
||||
|
||||
```text
|
||||
daily_run: status=ok shards=16 errors=0 duration=7s cursor_lag_max=2h walked_max_age=3m
|
||||
```
|
||||
|
||||
Tokens `status`, `shards`, `errors`, `duration` are stable for grep. `cursor_lag_max=cold` and `walked_max_age=cold` distinguish "not started yet" from "0s caught up".
|
||||
|
||||
## Data model
|
||||
## Data model changes
|
||||
|
||||
### `noncurrent_since` on version entries
|
||||
|
||||
A non-current version's TTL clock starts when the next version was written, not at its own mtime. The demoting PUT writes `NoncurrentSinceNs` on the demoted entry, set to the TsNs of the demoting meta-log event. Using the meta-log TsNs keeps `noncurrent_since` strictly monotonic in meta-log order across all replicas, immune to wall-clock skew.
|
||||
A non-current version's TTL clock starts when the next version was written, not at its own mtime. Today there's no field for that timestamp; the engine has to derive it by joining successive PUTs for the same key.
|
||||
|
||||
The lifecycle evaluator uses `ev.TsNs` for current-version rules and `entry.NoncurrentSinceNs` for noncurrent rules — both monotonic in iteration order. Legacy entries with `NoncurrentSinceNs == 0` fall back to entry mtime.
|
||||
Change: at the S3 PUT handler that demotes a prior version (current → noncurrent), write `noncurrent_since` on the demoted entry **to the TsNs of the demoting event**, not local wall-clock. The demoting event is itself a meta-log PUT with a well-defined TsNs; using that value keeps `noncurrent_since` strictly monotonic in meta-log order across all replicas and immune to wall-clock skew between S3 handler nodes.
|
||||
|
||||
`expected_mtime` passed to `LifecycleDelete` (for identity CAS) is always the entry's own mtime. CAS identity and TTL clock are separate concerns.
|
||||
The lifecycle evaluator uses `ev.TsNs` for current-version rules and `entry.noncurrent_since` for noncurrent rules — both monotonic in the iteration order, so the algorithm's `done` flag still holds. `expected_mtime` (passed to `LifecycleDelete` for identity CAS) remains the entry's own mtime; CAS identity and TTL clock are kept separate.
|
||||
|
||||
### Cursor
|
||||
|
||||
Per-shard cursor is `{ TsNs int64, RuleSetHash [32]byte, PromotedHash [32]byte }`. No frozen-cursor set, no per-key freeze state — failed deletes halt the run and leave the cursor at the last successful event (see "Delete failure handling"). `RuleSetHash` and `PromotedHash` together gate recovery — mismatch on either triggers the recovery branch on the next run. See "Cursor hashes."
|
||||
|
||||
## Components
|
||||
|
||||
| Path | Role |
|
||||
| Component | Status |
|
||||
|---|---|
|
||||
| `engine/` | Rule compilation, snapshot, partition views |
|
||||
| `evaluate.go`, `due_at.go`, `rule_hash.go`, `tags.go` | Engine-side rule evaluation |
|
||||
| `reader/` | Meta-log subscribe; one subscription per dailyrun.Run pass |
|
||||
| `router/router.go` | Per-event rule evaluation |
|
||||
| `bootstrap/walker.go` | Bucket walker with `RunForShard(view, shardID)` filter |
|
||||
| `dispatcher/filer_persister.go` | Filer-backed cursor I/O |
|
||||
| `dailyrun/run.go` | Main pass orchestrator: subscription, fan-out, per-shard `runShard` |
|
||||
| `dailyrun/cursor.go` | Cursor type + filer JSON serializer |
|
||||
| `dailyrun/walker_dispatcher.go` | Adapter from walker to `LifecycleDelete` RPC |
|
||||
| `engine/` (rule compilation, snapshot) | Keep |
|
||||
| `evaluate.go`, `due_at.go`, `rule_hash.go`, `tags.go` | Keep |
|
||||
| `reader/` (meta-log subscribe) | Keep, used once per daily pass instead of continuously |
|
||||
| `router/router.go` (rule evaluation per event) | Keep, callable in the per-event loop |
|
||||
| `router/schedule.go` (heap) | **Remove** |
|
||||
| `dispatcher/dispatcher.go` (tick, retries, freeze) | **Remove**; per-call `LifecycleDelete` moves into the daily loop |
|
||||
| `dispatcher/pipeline.go` | **Replace** with `daily_run` per shard |
|
||||
| `scheduler/scheduler.go` (long-running goroutines + refresh ticker) | **Replace** with one-shot per-shard fan-out |
|
||||
| `bootstrap/walker.go` | Keep, with shard filter added (`RunForShard`). Two invocation modes: (a) **steady-state daily** against the `walk` view (`ExpirationDate`, `ExpiredDeleteMarker`, `NewerNoncurrent`, `scan_only` rules); (b) **recovery** against `engine.RecoveryView(snap)` (cold start, replay-rule edit, retention loss, partition flip). No longer feeds an in-memory schedule. |
|
||||
|
||||
## Configuration
|
||||
## Rate limiting
|
||||
|
||||
Admin config (`weed/worker/tasks/s3_lifecycle/`):
|
||||
Cluster-wide deletes-per-second cap, set as admin config. Admin computes per-worker share at job-dispatch time:
|
||||
|
||||
| Key | Type | Default | What |
|
||||
|---|---|---|---|
|
||||
| `cluster_deletes_per_second` | int64 | 0 (unlimited) | Cluster-wide ceiling on lifecycle delete RPCs/s. Allocated per worker. |
|
||||
| `cluster_deletes_burst` | int64 | 0 (= 2× rate) | Token-bucket burst across cluster. |
|
||||
| `meta_log_retention_days` | int64 | 0 (unbounded) | How far back the filer's meta-log can reach. Rules with TTL > retention promote to walker. |
|
||||
| `walker_interval_minutes` | int64 | 0 (fire every pass) | Minimum time between steady-state walker fires per shard. Set positive when worker runs at tighter cadence than the desired walk frequency. |
|
||||
- Admin counts workers capable of `s3_lifecycle` from the registry, divides `cluster_deletes_per_second` by the count, writes the share into `ExecuteJobRequest.ClusterContext.Metadata["s3_lifecycle.deletes_per_second"]`.
|
||||
- Worker reads the share and constructs one `golang.org/x/time/rate.Limiter` shared across all shard goroutines. `dispatch_delete` calls `limiter.Wait(ctx)` before each RPC.
|
||||
- Brief over/undershoot during worker join/leave is acceptable for a bulk workload.
|
||||
|
||||
Worker config:
|
||||
|
||||
| Key | Default | What |
|
||||
|---|---|---|
|
||||
| `max_runtime_minutes` | 60 | Wall-clock cap per `dailyrun.Run` call |
|
||||
No proto changes: `ClusterContext.Metadata` already exists.
|
||||
|
||||
## Failure & recovery
|
||||
|
||||
- **Worker crashes mid-run.** Cursor advances only past successfully-deleted events. On restart, the next pass resumes at the same cursor and re-attempts. Identity-CAS makes redundant deletes no-ops.
|
||||
- **Transient delete failure.** Pass halts at the failing event, cursor stays. Tomorrow's pass retries from the same point. Stuck cursor is visible in `s3_lifecycle_cursor_min_ts_ns`; operators see head-of-line blocking and address the root cause.
|
||||
- **Identity drift** (object overwritten between event and delete). Handled by `LifecycleDelete` RPC's identity-CAS, which returns `NOOP_RESOLVED` for stale events. The algorithm dispatches optimistically and lets the server filter.
|
||||
- **Cold start, rule edit, partition flip.** All route into the recovery branch. The walker over `engine.RecoveryView(snap)` catches already-due objects across the full rule set, then the cursor rewinds (rule edit) or stays at the cold-start floor.
|
||||
- **Worker crashes mid-run.** Cursor advances only past successfully-deleted events (see "Delete failure handling"); on restart the next run resumes at the same cursor and re-attempts. Identity-CAS makes redundant deletes no-ops.
|
||||
- **Transient delete failure.** Run halts at the failing event, cursor stays. Tomorrow's run retries from the same point. Stuck cursor is visible in metrics — operators see head-of-line blocking and address root cause.
|
||||
Four triggers route into the same **recovery branch** (cold-start, replay-rule edit, retention loss, partition flip). All four run the walker against `engine.RecoveryView(snap)` (every action force-`markActive()`'d, regardless of compile-time `IsActive`/`BootstrapComplete`) to catch already-due objects across the full rule set, then rewind the cursor to `now - MaxEffectiveTTL(replay)` (or sentinel `0` if replay is empty). The merge is by design: distinguishing the four would require independent state that isn't worth the complexity, and the walker is idempotent.
|
||||
|
||||
## Future work
|
||||
- **Cold start (no persisted cursor).** Recovery branch.
|
||||
- **Replay-rule edit** (new/removed/changed `ExpirationDays`, `NoncurrentDays`, or `AbortMPU` rule). Detected by `RuleSetHash` mismatch. Recovery branch.
|
||||
- **Retention loss** (`replay != nil && persisted.TsNs < earliest_available`). Worker was down longer than meta-log retention, or retention itself shrunk. Gated on `replay != nil` so the sentinel `TsNs=0` used by pure walker buckets doesn't perpetually re-trigger recovery. Recovery branch.
|
||||
- **Partition flip** (`PromotedHash` mismatch — a replay-eligible rule moved between `replay` and `walk` since last run). Covers both directions:
|
||||
- Promotion (replay → walk, retention dropped): walker takes over for that rule. Recovery fires to refresh state.
|
||||
- Demotion (walk → replay, retention recovered): persisted.TsNs is likely forward of the rule's relevant events (other replay rules kept advancing during the walk era). Recovery rewinds the cursor so the demoted rule's events get a fresh scan window.
|
||||
- **Walker-only rule edit** (added/removed/modified `ExpirationDate`, `ExpiredDeleteMarker`, `NewerNoncurrent`, or any rule with no replay-eligible action kind). Not a recovery trigger — both hashes unchanged, cursor untouched. Walker re-reads `walk` on every steady-state run and applies the new rule automatically.
|
||||
- **`ExpirationDate` rules.** Always routed to the walker — fixed wall-clock due time can't be derived from event TsNs, and objects created before the date may have aged out of meta-log. See "Replay vs walker."
|
||||
- **Identity drift.** Handled by `LifecycleDelete` RPC as today. No worker-side state needed.
|
||||
|
||||
Tracked as optimizations rather than blockers:
|
||||
## Comparison
|
||||
|
||||
1. **Long-lived subscription across passes.** Today the subscription is rebuilt per `Run()`. Keeping it alive across passes would eliminate the 7s ctx-timeout per pass and the start/teardown overhead. Requires per-shard pending heap (events whose `DueTime > runNow` would be parked in-memory instead of replayed) and a hot-swappable snapshot for mid-pass config changes. Multi-day refactor; current model works.
|
||||
2. **Bucket-coordinated walker.** Phase 4 has each shard walk the full bucket and filter by `ShardID(bucket, key)` — simple but 16× the listing cost. A per-bucket coordinator (the worker owning shard 0 for that bucket lists once, routes matches to other shards) would cut listing cost. Worth doing if listing becomes the bottleneck for very large buckets.
|
||||
3. **Per-bucket dispatch lag metric.** Currently only per-shard lag is exposed. Per-bucket would require a per-bucket cursor or a derived metric from `s3_lifecycle_dispatch_total{bucket,kind,outcome}`. Punted on cardinality concerns; revisit when an operator asks for it.
|
||||
4. **Meta-log retention plumbing.** If the filer adds GC for `/topics/.system/log`, the `PromotedHash` partition flip needs to consume the filer's actual retention horizon (currently dormant because retention is effectively infinite).
|
||||
| | Streaming (today) | Daily replay (this design) |
|
||||
|---|---|---|
|
||||
| Worker lifetime | Long-running, capped by `MaxRuntime` | Starts, completes pass, exits |
|
||||
| Memory | O(events with DueTime in `[now, now+TTL]`) | O(in-flight delete RPCs) |
|
||||
| Disk reads | Continuous meta-log subscribe + periodic bootstrap | One meta-log scan per day, length ≤ max_ttl |
|
||||
| Latency | DispatchTick (~1 min) | Up to 24h |
|
||||
| Future-buffering | Yes, in heap | No |
|
||||
| State persisted | Cursor + frozen set + heap (rebuilt from meta-log on restart) | Cursor only |
|
||||
| Dispatch tick / checkpoint tick / refresh tick | Required | Removed |
|
||||
| Bootstrap walker | Hot path (every run, feeds heap) | Daily for `walk` rules; recovery for full rule set |
|
||||
| Failure recovery | Heap rebuild from meta-log replay | Cursor advance |
|
||||
|
||||
## Configuration changes
|
||||
|
||||
The admin and worker forms collapse significantly. New worker config:
|
||||
|
||||
```text
|
||||
deletes_per_run_concurrency // optional, in-pass parallelism (default 1)
|
||||
max_runtime_minutes // safety cap; default 1440 (24h)
|
||||
```
|
||||
|
||||
Removed worker config (no longer meaningful):
|
||||
|
||||
```text
|
||||
dispatch_tick_minutes
|
||||
checkpoint_tick_seconds
|
||||
refresh_interval_minutes
|
||||
bootstrap_interval_minutes
|
||||
```
|
||||
|
||||
New admin config (added to the existing form):
|
||||
|
||||
```text
|
||||
cluster_deletes_per_second // 0 = unlimited
|
||||
cluster_deletes_burst // 0 = 2× rps
|
||||
```
|
||||
|
||||
Admin runtime stays at `DetectionIntervalMinutes=1440` (daily detection produces one execution per worker).
|
||||
|
||||
---
|
||||
|
||||
## Implementation phases
|
||||
|
||||
Sequenced so each phase compiles and ships independently. Phase 1 lands first because it's a prerequisite the algorithm relies on; phases 2–4 can be authored in parallel but should merge in order.
|
||||
|
||||
### Phase 1 — `noncurrent_since` on version entries
|
||||
|
||||
Smallest, isolated, prerequisite.
|
||||
|
||||
- Add `NoncurrentSinceNs int64` to the filer entry extended attributes (or as a top-level field if the proto allows non-breaking add).
|
||||
- At the S3 PUT handler in `weed/s3api/s3api_object_handlers_put.go` (or whichever site demotes the prior current version), set `NoncurrentSinceNs` to the **TsNs of the demoting meta-log event**, not `time.Now().UnixNano()`. Read the value from the in-flight write's TsNs (the filer assigns this) — coordinate with the filer write API to make that value available to the demotion path. If the API can't surface it cleanly, fall back to a single `time.Now().UnixNano()` captured at the start of the demoting RPC, accepting that this introduces sub-millisecond skew relative to meta-log TsNs (still monotonic per node, weakly monotonic across nodes within clock-sync tolerance).
|
||||
- Backfill: nil/zero on existing entries — the lifecycle evaluator treats `NoncurrentSinceNs == 0` as "fall back to entry mtime" so legacy data still expires, just with the old (slightly looser) semantics.
|
||||
- Unit tests in the s3api package covering PUT-over-existing and PUT-with-versioning-suspended.
|
||||
- Verify with a clock-skew test: two S3 nodes with ±5s clock drift produce a sequence of PUT/demotion events; assert `noncurrent_since` is non-decreasing in meta-log iteration order.
|
||||
|
||||
### Phase 2 — Daily-replay worker (parallel to today's, behind a flag)
|
||||
|
||||
Add the new code path without disturbing the existing one. Allows side-by-side smoke testing.
|
||||
|
||||
- New file `weed/s3api/s3lifecycle/dailyrun/dailyrun.go` with `func Run(ctx, shardID, ...) error` implementing the algorithm.
|
||||
- Reuses `engine.Snapshot`, `evaluate.go`, `due_at.go`, the existing `reader.Reader`, and the existing `LifecycleDelete` RPC. No new RPCs.
|
||||
- Per-shard cursor type `dailyrun.Cursor { TsNs int64; RuleSetHash [32]byte; PromotedHash [32]byte }`, JSON-persisted under the same filer path as today's cursor, keyed by `daily/` prefix to avoid collision. Cursor load returns `(cursor, isFresh bool)` so the algorithm can distinguish first-run from a rule-change rewrite. In Phase 2 (no walker plumbing), `PromotedHash` is always the empty hash; Phase 4 wires `engine.PromotedHash(snap, retentionWindow)` and the partition-flip recovery trigger.
|
||||
- **Replay/walker partition**: full `RulesForShard` / `RecoveryView` plumbing lands in Phase 4. For Phase 2 alone, since walker rules are rejected (next bullet), Phase 2 is **replay-only**: pass the **base snapshot** directly to `router.Route` (no view, no clone, no Mode rewrite). This is acceptable for Phase 2 because the unsupported-rule check guarantees no walker-bound actions are present, and the absence of walker rules means there's no risk of router.Route emitting walker-bound matches. Mode rewrite is also unnecessary in Phase 2: any rule that compiled to `ModeScanOnly` (legacy persistent state) falls into the unsupported-rule path along with `scan_only`-promoted rules. Phase 4 then introduces clone-per-view (including Mode rewrite) and the recovery branch.
|
||||
- **Refuse to run on unsupported rule sets.** Before invoking the replay loop, `dailyrun.Run` checks the compiled rules for any action of kind `ExpirationDate`, `ExpiredDeleteMarker`, `NewerNoncurrent`, or any rule promoted to `scan_only`. If any are present, the handler:
|
||||
- Logs at error level which rules are unsupported.
|
||||
- Returns a typed error from `Execute` so admin marks the run failed (visible in the activity log).
|
||||
- Does **not** advance the cursor.
|
||||
This makes flipping `algorithm: daily_replay` before Phase 4 a loud failure, not a silent dropped rule. Operators see the error and either revert to `streaming` or wait for Phase 4.
|
||||
- **Rule-change handling**: compute `rsh = engine.ReplayContentHash(snap)` at run start (partition-independent — see "Cursor hashes"). If `rsh != cursor.RuleSetHash` and `replay` is non-`nil`, persist `{ TsNs: now - MaxEffectiveTTL(replay), RuleSetHash: rsh, PromotedHash: promoted }` and return. If `replay` is `nil`, persist `{ TsNs: 0, RuleSetHash: rsh, PromotedHash: promoted }` and return. In Phase 2, `promoted` is the empty hash (no walker plumbing); Phase 4 wires real values. All cursor writes carry all three fields so Phase 4 doesn't have to migrate existing Phase 2 cursors. Tested explicitly: add a replay-eligible rule mid-test, assert cursor TsNs rewinds to `now - max_ttl` and `RuleSetHash` updates.
|
||||
- **Delete failure handling**: track `last_ok TsNs` as the algorithm progresses; only set `last_ok = ev.TsNs` after a successful or `NOOP_RESOLVED` outcome for *all* matches produced from that event. On any unresolved outcome (`RETRY_LATER`, `BLOCKED`, transport error after in-run retries), break the loop and persist `{ TsNs: last_ok, RuleSetHash: rsh, PromotedHash: promoted }`. In-run retry policy for transport errors: 3 attempts with exponential backoff capped at 5s.
|
||||
- **Match expansion**: invoke `router.Route(ctx, snap, ev, now, lister)` per event, where `snap` is the **base snapshot** directly (Phase 2 is replay-only — see "Replay/walker partition" bullet above; the view-based call site `router.Route(ctx, replay, ev, ...)` lands in Phase 4 when the partition is wired). Handles `ExpirationDays`, `NoncurrentDays`, `AbortMPU` correctly out of the box (already in `due_at.go`).
|
||||
- Rate limiter accepted as a parameter; constructed once per `Execute()` and shared across all shard goroutines.
|
||||
- New admin config flag `algorithm: streaming | daily_replay` in `weed/worker/tasks/s3_lifecycle/handler.go`. When `daily_replay`, the handler invokes `dailyrun.Run` and exits. When `streaming` (default), today's code path runs unchanged.
|
||||
- Unit tests:
|
||||
- Per-rule `done` flag correctness (single rule, multi-rule).
|
||||
- Multiple-match fan-out from one event (PUT-over-existing emits both `ExpirationDays` for the new version and `NoncurrentDays` for the displaced one).
|
||||
- Cursor advance halts at the first unresolved failure; subsequent run resumes there.
|
||||
- Identity-CAS skip path (event mtime stale → `NOOP_RESOLVED` still advances cursor).
|
||||
- Rule-set-hash mismatch rewinds cursor to `now - max_ttl` (Phase 4 adds the walker call on this path; Phase 2 just rewinds).
|
||||
- `replay` empty case: cursor persists `{ TsNs: 0, RuleSetHash: rsh, PromotedHash: <empty in Phase 2> }`, no meta-log read attempted.
|
||||
- `NoncurrentDays` rule uses `entry.noncurrent_since`, `ExpirationDays` rule uses `ev.TsNs`; both monotonic in iteration order.
|
||||
- `AbortMPU` test: MPU init event ages past `AbortMPUDaysAfterInitiation`, delete emitted.
|
||||
- **Unsupported-rule rejection**: bucket has an `ExpirationDate` (or `ExpiredDeleteMarker` or `NewerNoncurrent`) rule and the flag is set to `daily_replay`. Assert `Execute` returns the typed unsupported-rule error, the cursor is not advanced, and the streaming code path was not invoked. Repeat for a rule promoted to `scan_only`.
|
||||
|
||||
### Phase 3 — Cluster rate limit allocation
|
||||
|
||||
Admin-side share computation. Lands once Phase 2 has a working `Limiter` parameter to receive it.
|
||||
|
||||
- `weed/worker/tasks/s3_lifecycle/handler.go`: add `cluster_deletes_per_second`, `cluster_deletes_burst` to `AdminConfigForm.Sections["scope"]`.
|
||||
- `weed/admin/plugin/plugin.go` near `RunDetectionRequest`/`ExecuteJobRequest` build sites: count capable workers, divide rps, write `s3_lifecycle.deletes_per_second` and `s3_lifecycle.deletes_burst` into `ClusterContext.Metadata`.
|
||||
- Worker `Execute`: parse metadata keys, build `rate.Limiter`, pass to `dailyrun.Run`.
|
||||
- New histogram `S3LifecycleDispatchLimiterWaitSeconds` for operator visibility.
|
||||
- Tests: admin allocation math under join/leave, worker correctly slows under low share.
|
||||
|
||||
### Phase 4 — Shard-aware walker + scan-at-date / scan-only routing
|
||||
|
||||
Reposition the walker and add shard-filtering + per-rule routing.
|
||||
|
||||
- **Shard filter on the walker.** Add `walker.RunForShard(ctx context.Context, shardID int, view *engine.Snapshot, limiter *rate.Limiter) error`. `view` is one of `walk`/`replay`/`recovery` views — its action set already filters to the right partition (via per-clone `active` flags), so the walker iterates the bucket and evaluates each entry against `view` exactly as today's `Run` does, with the only added step being `if ShardID(bucket, entry.Name) != shardID { continue }`. The existing bucket-wide `Run` becomes `RunForShard` with `shardID = -1` (any) for backward compatibility, or is deleted outright in Phase 5.
|
||||
- **Engine surface.** Four new exports on the engine package, all consumed by `daily_run`:
|
||||
- `func (s *Snapshot) RulesForShard(shardID int, retentionWindow time.Duration) (replay, walk *Snapshot)`. Returns two new `*Snapshot` instances with **cloned `*CompiledAction`** values; per-view `active` flags (and `Mode` rewrite on `replay`) determine partition membership. Shared-by-pointer with the base: `Rule` definitions, predicate maps, `RuleHash` table. Either return value may be `nil` when its partition is empty. The retention window is an explicit input — `daily_run` computes it once at run start as `duration(now - metalog.EarliestAvailableTsNs(shardID))` and passes it in. The engine does no clock arithmetic of its own. The partition is stable across one `daily_run` invocation. Membership:
|
||||
- **`replay`**: cloned `ExpirationDays`, `NoncurrentDays`, `AbortMPU` actions, `active=true`, where the action's TTL ≤ `retentionWindow`.
|
||||
- **`walk`**: cloned `ExpirationDate` (`ModeScanAtDate`), `ExpiredDeleteMarker`, `NewerNoncurrent` actions, plus any of the above promoted to `scan_only` because their TTL exceeds the retention boundary. All `active=true`.
|
||||
- A single XML rule that compiles to multiple action kinds (e.g., `ExpirationDays` + `NewerNoncurrent` on the same rule) is split: each compiled action lands in `replay` or `walk` independently. `ReplayContentHash` only hashes replay-eligible rule definitions from the base snapshot, so neither the `NewerNoncurrent` action nor any walker-only edit affects the hash.
|
||||
- `func RecoveryView(s *Snapshot) *Snapshot`. Returns a third `*Snapshot` instance with every action cloned and `markActive()`'d — regardless of `Mode` or prior `BootstrapComplete` state. The recovery walker uses this view to see all replay-eligible + walker-eligible rules. Without it, recovery would skip event-driven actions the base snapshot marks inactive (`compile.go:73-74`).
|
||||
- `func ReplayContentHash(s *Snapshot) [32]byte`. Stable across reorderings, partition-independent. Used as `RuleSetHash = ReplayContentHash(snap)`. Returns the empty hash when no replay-eligible rules exist. See "Cursor hashes."
|
||||
- `func PromotedHash(s *Snapshot, retentionWindow time.Duration) [32]byte`. Hash of the set of replay-eligible rules currently classified as `walk` due to `scan_only` (TTL > `retentionWindow`). Detects partition flips in either direction. Takes the same `retentionWindow` value as `RulesForShard` so the two cannot disagree about partition membership. See "Cursor hashes."
|
||||
- `func MaxEffectiveTTL(s *Snapshot) time.Duration`. Max over active replay actions; returns `0` for `nil` or empty replay (caller must already be in the empty-replay branch).
|
||||
- `func CurrentSnapshot() *Snapshot`. The base snapshot before partitioning. Recovery branch passes this to `RecoveryView`.
|
||||
- **`dailyrun.Run` flow.** Cold-start, replay-rule edit (`RuleSetHash` mismatch), retention loss, and partition flip (`PromotedHash` mismatch) all route into the **recovery branch**: walker over `engine.RecoveryView(snap)` so already-due objects across all rules are caught (including event-driven actions the base snapshot may mark inactive), then cursor rewinds. Steady-state path runs walker over `walk` only, then replay over `replay`. Cursor stores `{ TsNs, RuleSetHash, PromotedHash }`; steady-state writes both hashes through unchanged.
|
||||
- **Recovery branch.** Triggered by any of: no persisted cursor, `RuleSetHash` mismatch, `PromotedHash` mismatch, or `replay != nil && persisted.TsNs < earliest_available`. The retention-loss trigger uses the **absolute** `earliest_available` TsNs (the oldest available meta-log TsNs from `metalog.EarliestAvailableTsNs(shardID)`), not the `retentionWindow` duration that `RulesForShard`/`PromotedHash` consume — they're different shapes for different purposes: the retention check on the cursor compares two absolute timestamps, while the engine partition check compares a per-action TTL to a duration. Gated on `replay != nil` because pure walker buckets persist a sentinel `TsNs=0` that would otherwise re-fire recovery every run. Invokes `walker.RunForShard(ctx, shardID, engine.RecoveryView(snap), limiter)`. Persists cursor at:
|
||||
- `{ TsNs: now - engine.MaxEffectiveTTL(replay), RuleSetHash: rsh, PromotedHash: promoted }` if `replay` is non-`nil`.
|
||||
- `{ TsNs: 0, RuleSetHash: rsh, PromotedHash: promoted }` if `replay` is `nil` (pure walker bucket).
|
||||
`MaxEffectiveTTL` is undefined over an empty set, so the sentinel form is required when `replay` is `nil`. **Both hashes are written on every recovery persistence** — failing to update `PromotedHash` here would cause the partition-flip trigger to re-fire on every subsequent run. See "Bootstrap retention window."
|
||||
- **Steady-state walker invocation.** Distinct from recovery: `walker.RunForShard(ctx, shardID, walk, limiter)`. `walk`'s cloned actions are masked to walker-bound kinds only, so the walker doesn't re-process replay rules that the meta-log scan already handles on the same run.
|
||||
- Drop the bootstrap walker's call from `scheduler.go` (removed entirely in Phase 5).
|
||||
- Tests:
|
||||
- Cold start with mixed walker-only + replay rules in same bucket: recovery branch fires once (walker over `engine.RecoveryView(snap)`, then cursor rewind). Next day's run is steady-state (walker over `walk` only, replay over `replay`).
|
||||
- `ExpirationDate` rule fires only on/after the date (walker path).
|
||||
- `ExpiredDeleteMarker` rule deletes orphaned markers (walker path, sibling-aware).
|
||||
- `NewerNoncurrent` count rule deletes oldest noncurrent versions beyond the cap (walker path, version-list-aware).
|
||||
- Bucket with only walker rules (e.g., pure `ExpirationDate`): `replay` is `nil`, cursor persisted with sentinel `TsNs=0`, no meta-log subscribe attempted. Critically — assert that across 5 consecutive daily runs, recovery fires exactly once (on the first run); subsequent runs see no recovery despite `persisted.TsNs (0) < earliest_available`, because the retention-loss check is gated on `replay != nil`.
|
||||
- Replay-rule edit triggers recovery: walker runs over `RecoveryView(snap)` (catches an object already 60d old under a brand-new 30d rule), then cursor rewinds. Object aged 20d at edit time is later deleted at age 30 via the replay path.
|
||||
- `RecoveryView` activates event-driven actions: simulate a base snapshot where an `ExpirationDays` action has `IsActive=false` (e.g., `BootstrapComplete=false`); assert the recovery walker still sees and evaluates the rule via the recovery view, while the steady-state walker over `walk` does not.
|
||||
- **Replay view rewrites Mode**: simulate a base snapshot with a `ModeScanOnly`-locked `ExpirationDays` action (carried over from `prior.Mode`); assert that `replay`'s clone of the action has `Mode == ModeEventDriven`, and that `router.Route(ctx, replay, ev, ...)` emits a Match for it. The test should fail if Mode rewrite is skipped — confirming the rehabilitation path is wired.
|
||||
- Cursor persistence after recovery: assert `PromotedHash` is written through on every recovery branch persistence; simulate a partition flip across two runs and verify the second run does not re-fire recovery because the prior `promoted_hash` was correctly stored.
|
||||
- Adding a walker-only rule to an existing replay-only bucket: `ReplayContentHash(snap)` is unchanged, replay cursor TsNs unchanged, walker picks up the new rule on its next steady-state pass.
|
||||
- `scan_only` promotion (retention drops, replay-eligible rule moves to `walk`): `ReplayContentHash` unchanged, **`PromotedHash` changes** → recovery branch fires. Walker over base catches in-flight objects under the promoted rule; cursor rewinds; `PromotedHash` is persisted.
|
||||
- Retention recovery (`scan_only` rule demotes back to `replay` while other replay rules' cursor has advanced past the rule's relevant events): `ReplayContentHash` unchanged, `persisted.TsNs > earliest_available` so retention-loss check does NOT fire, **`PromotedHash` changes** → recovery branch fires. Asserts the demoted rule's older events get processed (this is the test that would have failed before adding `PromotedHash`).
|
||||
- `PromotedHash` persistence: simulate a partition flip in either direction across two runs, assert cursor's `promoted_hash` field carries through and gates the next run's recovery decision correctly.
|
||||
- Shard filter: 2 shards × 1 bucket walker run leaves no double-deletes (assert via RPC counter).
|
||||
- `scan_only` promotion: rule with TTL > meta-log retention moves from `replay` to `walk` at run start.
|
||||
|
||||
### Phase 5 — Switch default and delete streaming path
|
||||
|
||||
Cut over and clean up. Should be a single PR that's mostly deletions.
|
||||
|
||||
- Default `algorithm: daily_replay` and remove the streaming alternative from the descriptor.
|
||||
- Delete:
|
||||
- `weed/s3api/s3lifecycle/router/schedule.go` (+ tests)
|
||||
- `weed/s3api/s3lifecycle/dispatcher/dispatcher.go` (+ tests), `freeze`-related code, retry state
|
||||
- `weed/s3api/s3lifecycle/dispatcher/pipeline.go`
|
||||
- `weed/s3api/s3lifecycle/scheduler/scheduler.go` (+ tests), refresh ticker
|
||||
- Removed worker config fields and their `ParseConfig` handling
|
||||
- Rewrite `weed/s3api/s3lifecycle/DESIGN.md` to remove "streaming" sections.
|
||||
- One full end-to-end test on a bucket with 1M objects, mixed-TTL rules, with cluster rate cap engaged.
|
||||
|
||||
### Phase 6 — Observability polish
|
||||
|
||||
After cutover, before announcing.
|
||||
|
||||
- Daily-run summary log line: shard, rules-touched, events-scanned, deletes-issued, walker-fallback (y/n), duration.
|
||||
- Prometheus: `S3LifecycleDailyRunDurationSeconds`, `S3LifecycleDailyRunEventsScanned`, `S3LifecycleDailyRunDeletesIssued`, all labelled by `shard_id` and `outcome`.
|
||||
- Admin UI: a single "Last Run" card per bucket showing the above summary line. Removes the now-meaningless "Next Run / Detection Results" widgets we already hid for `s3_lifecycle`.
|
||||
|
||||
## Open questions
|
||||
|
||||
1. **In-pass concurrency.** Today's worker has 1–16 shard goroutines via `workers` config. Daily replay can either (a) keep that knob, fanning out shard scans across goroutines that share the limiter, or (b) drop it since the limiter is now the throughput governor. Lean toward (a) — shards are independent meta-log subscriptions and parallel reads cut wall-clock significantly.
|
||||
2. **Cursor format compatibility.** Worth deciding whether the new cursor coexists at a separate filer path (clean cutover, no migration) or overwrites the old one (single source of truth, requires a one-time read-then-rewrite during cutover). Lean toward separate paths during phases 2–4, unified at Phase 5.
|
||||
3. **Per-shard rule snapshots vs. global.** Engine snapshots are bucket-scoped today; Phase 4 adds `Snapshot.RulesForShard(shardID, retentionWindow) (replay, walk *Snapshot)`. Open: should `RulesForShard` also gate by which buckets a shard "owns" (every bucket is on every shard via `ShardID(bucket, key)`), or just return the global rule set partitioned by mode? Current lean: return global partition, since every shard worker runs against every bucket and the actual shard filter happens at the entry-iteration site (meta-log subscription and walker entry loop).
|
||||
6. **Bucket-coordinated walker.** Phase 4 has each shard walk the full bucket and filter by `ShardID` — simple, but 16× the listing cost. A future optimization is a per-bucket coordinator (the worker owning shard 0 for that bucket lists once, routes matches to other shards via the existing injection point). Worth doing if listing cost becomes the bottleneck for very large buckets. Not blocking initial cutover.
|
||||
4. **`noncurrent_since` source from filer write API.** Phase 1 prefers the demoting event's TsNs over wall-clock. Whether the existing filer write path surfaces that TsNs to the S3 handler without a proto change is a Phase 1 design decision; the fallback (handler-local `time.Now()`) is documented but loses cross-node monotonicity guarantees and should be a temporary measure.
|
||||
5. **Retry budget for `RETRY_LATER`.** The current dispatcher tracks per-key retry counts; this design removes that state and lets head-of-line blocking surface the issue. Worth confirming that operators are OK with a stuck cursor as the failure signal vs. silent retry. If not, add a bounded retry counter on the cursor (one per stuck event) — small state, but inches back toward the model we're replacing.
|
||||
@@ -39,12 +39,7 @@ const cursorFileVersion = 1
|
||||
// meta-log event whose Matches all dispatched successfully (or as
|
||||
// NOOP_RESOLVED); RuleSetHash is the content hash of the replay-eligible
|
||||
// rules from the run that wrote this cursor; PromotedHash is the hash
|
||||
// of replay-eligible rules currently in scan_only. LastWalkedNs is the
|
||||
// runNow of the most recent successful steady-state / empty-replay
|
||||
// walker fire on this shard — runShard uses it together with
|
||||
// cfg.WalkerInterval to throttle the walker independently of Run()
|
||||
// invocation frequency (so a worker driven by a 2s test ticker doesn't
|
||||
// crush filer with a full bucket walk per tick).
|
||||
// of replay-eligible rules currently in scan_only.
|
||||
//
|
||||
// In Phase 2 PromotedHash is always the empty hash because the walker
|
||||
// path isn't wired yet — any rule that would land in walk causes the
|
||||
@@ -53,24 +48,16 @@ type Cursor struct {
|
||||
TsNs int64
|
||||
RuleSetHash [32]byte
|
||||
PromotedHash [32]byte
|
||||
LastWalkedNs int64
|
||||
}
|
||||
|
||||
// cursorFile is the on-disk JSON shape. Bytes are base64-encoded by
|
||||
// encoding/json automatically.
|
||||
//
|
||||
// last_walked_ns is omitempty so cursor files written before the field
|
||||
// existed still decode cleanly: an older file has no last_walked_ns,
|
||||
// which marshals back into LastWalkedNs=0, which runShard treats as
|
||||
// "never walked steady-state" and so the next pass fires the walker
|
||||
// (the same path a cold-start cursor takes). No version bump needed.
|
||||
type cursorFile struct {
|
||||
Version int `json:"version"`
|
||||
ShardID int `json:"shard_id"`
|
||||
TsNs int64 `json:"ts_ns"`
|
||||
RuleSetHash []byte `json:"rule_set_hash"`
|
||||
PromotedHash []byte `json:"promoted_hash"`
|
||||
LastWalkedNs int64 `json:"last_walked_ns,omitempty"`
|
||||
}
|
||||
|
||||
// CursorPersister loads and saves daily-replay cursors. The Phase 2
|
||||
@@ -132,7 +119,7 @@ func (p *FilerCursorPersister) Load(ctx context.Context, shardID int) (Cursor, b
|
||||
if len(cf.PromotedHash) != 32 {
|
||||
return Cursor{}, false, fmt.Errorf("cursor promoted_hash shard=%d: got %d bytes, want 32", shardID, len(cf.PromotedHash))
|
||||
}
|
||||
c := Cursor{TsNs: cf.TsNs, LastWalkedNs: cf.LastWalkedNs}
|
||||
c := Cursor{TsNs: cf.TsNs}
|
||||
copy(c.RuleSetHash[:], cf.RuleSetHash)
|
||||
copy(c.PromotedHash[:], cf.PromotedHash)
|
||||
return c, true, nil
|
||||
@@ -148,7 +135,6 @@ func (p *FilerCursorPersister) Save(ctx context.Context, shardID int, c Cursor)
|
||||
TsNs: c.TsNs,
|
||||
RuleSetHash: c.RuleSetHash[:],
|
||||
PromotedHash: c.PromotedHash[:],
|
||||
LastWalkedNs: c.LastWalkedNs,
|
||||
}
|
||||
var buf bytes.Buffer
|
||||
enc := json.NewEncoder(&buf)
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
package dailyrun
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// TestSummarizeShardCursorLag_AllColdStart pins the marker tokens for
|
||||
// the worker's very first heartbeat — no cursor file exists yet, no
|
||||
// walker has fired, the line must say "cold" rather than "0s" so
|
||||
// operators can tell the difference between "I'm caught up" and
|
||||
// "I haven't started." Both states would be 0s otherwise.
|
||||
func TestSummarizeShardCursorLag_AllColdStart(t *testing.T) {
|
||||
p := newMemPersister()
|
||||
cfg := Config{Persister: p, Shards: []int{0, 1, 2}}
|
||||
runNow := time.Unix(1_700_000_000, 0).UTC()
|
||||
|
||||
got := summarizeShardCursorLag(context.Background(), cfg, runNow)
|
||||
assert.Equal(t, "cursor_lag_max=cold walked_max_age=cold", got)
|
||||
}
|
||||
|
||||
// TestSummarizeShardCursorLag_PicksMaxAcrossShards confirms the worst-
|
||||
// case lag wins, not the average. Operators alert on the worst shard;
|
||||
// the cluster is only as healthy as its slowest one.
|
||||
func TestSummarizeShardCursorLag_PicksMaxAcrossShards(t *testing.T) {
|
||||
p := newMemPersister()
|
||||
runNow := time.Unix(1_700_000_000, 0).UTC()
|
||||
require.NoError(t, p.Save(context.Background(), 0, Cursor{
|
||||
TsNs: runNow.Add(-5 * time.Minute).UnixNano(),
|
||||
LastWalkedNs: runNow.Add(-30 * time.Minute).UnixNano(),
|
||||
}))
|
||||
require.NoError(t, p.Save(context.Background(), 1, Cursor{
|
||||
TsNs: runNow.Add(-3 * time.Hour).UnixNano(), // worst cursor
|
||||
LastWalkedNs: runNow.Add(-10 * time.Minute).UnixNano(),
|
||||
}))
|
||||
require.NoError(t, p.Save(context.Background(), 2, Cursor{
|
||||
TsNs: runNow.Add(-30 * time.Minute).UnixNano(),
|
||||
LastWalkedNs: runNow.Add(-2 * time.Hour).UnixNano(), // worst walker
|
||||
}))
|
||||
cfg := Config{Persister: p, Shards: []int{0, 1, 2}}
|
||||
|
||||
got := summarizeShardCursorLag(context.Background(), cfg, runNow)
|
||||
assert.Contains(t, got, "cursor_lag_max=3h0m0s")
|
||||
assert.Contains(t, got, "walked_max_age=2h0m0s")
|
||||
}
|
||||
|
||||
// TestSummarizeShardCursorLag_PartialFill — some shards have cursors,
|
||||
// some don't. Don't let the unwalked-yet shards contaminate the worst-
|
||||
// case calculation; just compute the max over what we have.
|
||||
func TestSummarizeShardCursorLag_PartialFill(t *testing.T) {
|
||||
p := newMemPersister()
|
||||
runNow := time.Unix(1_700_000_000, 0).UTC()
|
||||
require.NoError(t, p.Save(context.Background(), 0, Cursor{
|
||||
TsNs: runNow.Add(-15 * time.Minute).UnixNano(),
|
||||
// LastWalkedNs not set — shard 0 hasn't walked yet
|
||||
}))
|
||||
require.NoError(t, p.Save(context.Background(), 1, Cursor{
|
||||
// TsNs not set — shard 1 hasn't drained yet
|
||||
LastWalkedNs: runNow.Add(-45 * time.Minute).UnixNano(),
|
||||
}))
|
||||
cfg := Config{Persister: p, Shards: []int{0, 1, 2}}
|
||||
|
||||
got := summarizeShardCursorLag(context.Background(), cfg, runNow)
|
||||
// Only shard 0 contributes to cursor_lag_max; only shard 1 to walked_max_age.
|
||||
assert.Contains(t, got, "cursor_lag_max=15m0s")
|
||||
assert.Contains(t, got, "walked_max_age=45m0s")
|
||||
// Shard 2 wasn't saved at all — it doesn't show up as either.
|
||||
assert.False(t, strings.Contains(got, "cold"), "any-fill case should not emit cold markers")
|
||||
}
|
||||
@@ -104,7 +104,6 @@ func walkBucketTree(ctx context.Context, client filer_pb.SeaweedFilerClient, dir
|
||||
ModTime: time.Unix(e.Attributes.Mtime, int64(e.Attributes.MtimeNs)),
|
||||
Size: int64(e.Attributes.FileSize),
|
||||
IsLatest: true, // Non-versioned default.
|
||||
Tags: extractTags(e.Extended),
|
||||
}
|
||||
return cb(entry)
|
||||
})
|
||||
@@ -184,7 +183,7 @@ func expandVersionsDir(ctx context.Context, client filer_pb.SeaweedFilerClient,
|
||||
// Resolve latest:
|
||||
// 1. Pointer names a real id -> that wins.
|
||||
// 2. Pointer absent (or stale: set but no sibling carries it)
|
||||
// + any EXPLICIT null bare exists -> null is latest.
|
||||
// + items[0] is an EXPLICIT null -> null is latest.
|
||||
// 3. Otherwise -> newest sibling (latestPos = 0 by default).
|
||||
//
|
||||
// A stale pointer falls through to the no-pointer fallback rather
|
||||
@@ -204,13 +203,8 @@ func expandVersionsDir(ctx context.Context, client filer_pb.SeaweedFilerClient,
|
||||
}
|
||||
}
|
||||
}
|
||||
if !pointerResolved {
|
||||
for i, it := range items {
|
||||
if it.versionID == "null" && it.isExplicitNull {
|
||||
latestPos = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if !pointerResolved && len(items) > 0 && items[0].versionID == "null" && items[0].isExplicitNull {
|
||||
latestPos = 0
|
||||
}
|
||||
|
||||
if start != "" && logical <= start {
|
||||
@@ -234,7 +228,6 @@ func expandVersionsDir(ctx context.Context, client filer_pb.SeaweedFilerClient,
|
||||
IsDeleteMarker: string(it.entry.Extended[s3_constants.ExtDeleteMarkerKey]) == "true",
|
||||
NumVersions: len(items),
|
||||
SuccessorModTime: successor,
|
||||
Tags: extractTags(it.entry.Extended),
|
||||
}
|
||||
if !isLatest {
|
||||
rank := i
|
||||
@@ -325,21 +318,3 @@ func isMPUInitDir(key string, entry *filer_pb.Entry) bool {
|
||||
v, ok := entry.Extended[s3_constants.ExtMultipartObjectKey]
|
||||
return ok && len(v) > 0
|
||||
}
|
||||
|
||||
func extractTags(ext map[string][]byte) map[string]string {
|
||||
if len(ext) == 0 {
|
||||
return nil
|
||||
}
|
||||
prefix := s3_constants.AmzObjectTagging + "-"
|
||||
var tags map[string]string
|
||||
for k, v := range ext {
|
||||
if !strings.HasPrefix(k, prefix) {
|
||||
continue
|
||||
}
|
||||
if tags == nil {
|
||||
tags = make(map[string]string)
|
||||
}
|
||||
tags[k[len(prefix):]] = string(v)
|
||||
}
|
||||
return tags
|
||||
}
|
||||
@@ -126,25 +126,6 @@ func TestFilerListFunc_EmitsFlatFiles(t *testing.T) {
|
||||
assert.Equal(t, []string{"a.txt", "b.txt"}, got)
|
||||
}
|
||||
|
||||
func TestFilerListFunc_PropagatesTagsOnFlatFiles(t *testing.T) {
|
||||
mtime := time.Now().Add(-7 * 24 * time.Hour)
|
||||
tagged := fileWithExt("tagged.txt", mtime, 10, map[string][]byte{
|
||||
s3_constants.AmzObjectTagging + "-env": []byte("temp"),
|
||||
s3_constants.AmzObjectTagging + "-tier": []byte("cold"),
|
||||
})
|
||||
client := &fakeFiler{tree: map[string][]*filer_pb.Entry{
|
||||
"/buckets/bkt": {tagged},
|
||||
}}
|
||||
listFn := FilerListFunc(client, "/buckets")
|
||||
var got *bootstrap.Entry
|
||||
require.NoError(t, listFn(context.Background(), "bkt", "", func(e *bootstrap.Entry) error {
|
||||
got = e
|
||||
return nil
|
||||
}))
|
||||
require.NotNil(t, got)
|
||||
assert.Equal(t, map[string]string{"env": "temp", "tier": "cold"}, got.Tags)
|
||||
}
|
||||
|
||||
func TestFilerListFunc_RecursesIntoSubdirs(t *testing.T) {
|
||||
mtime := time.Now()
|
||||
client := &fakeFiler{tree: map[string][]*filer_pb.Entry{
|
||||
@@ -379,40 +360,6 @@ func TestFilerListFunc_VersionedExpansionExplicitNullIsLatestWhenPointerMissing(
|
||||
assert.Equal(t, 2, count)
|
||||
}
|
||||
|
||||
func TestFilerListFunc_VersionedExpansionExplicitNullBeatsNewerSiblingWhenPointerMissing(t *testing.T) {
|
||||
// Suspended-versioning current-ness is carried by the explicit bare
|
||||
// null, not by mtime ordering. Backdating the null to make it due
|
||||
// must not demote it behind a newer noncurrent sibling when the
|
||||
// .versions pointer is absent.
|
||||
tNull := time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC) // older
|
||||
tV1 := time.Date(2026, 3, 1, 0, 0, 0, 0, time.UTC) // newer
|
||||
bareNull := fileWithExt("foo", tNull, 1, map[string][]byte{s3_constants.ExtVersionIdKey: []byte("null")})
|
||||
client := &fakeFiler{tree: map[string][]*filer_pb.Entry{
|
||||
"/buckets/bkt": {
|
||||
bareNull,
|
||||
versionsDir("foo"+s3_constants.VersionsFolder, ""),
|
||||
},
|
||||
"/buckets/bkt/foo" + s3_constants.VersionsFolder: {
|
||||
fileWithExt("v1", tV1, 1, map[string][]byte{s3_constants.ExtVersionIdKey: []byte("v1")}),
|
||||
},
|
||||
}}
|
||||
listFn := FilerListFunc(client, "/buckets")
|
||||
var got []*bootstrap.Entry
|
||||
require.NoError(t, listFn(context.Background(), "bkt", "", func(e *bootstrap.Entry) error {
|
||||
got = append(got, e)
|
||||
return nil
|
||||
}))
|
||||
require.Len(t, got, 2)
|
||||
byID := map[string]*bootstrap.Entry{}
|
||||
for _, e := range got {
|
||||
byID[e.VersionID] = e
|
||||
}
|
||||
require.NotNil(t, byID["null"])
|
||||
require.NotNil(t, byID["v1"])
|
||||
assert.True(t, byID["null"].IsLatest, "explicit null must stay latest even when older than noncurrent siblings")
|
||||
assert.False(t, byID["v1"].IsLatest)
|
||||
}
|
||||
|
||||
func TestFilerListFunc_VersionsDirWithoutMarkersRecursesAsRegular(t *testing.T) {
|
||||
// A `.versions`-named folder whose children have no
|
||||
// ExtVersionIdKey is a coincidence (user folder). Recurse into
|
||||
|
||||
@@ -11,8 +11,6 @@ import (
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/reader"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/router"
|
||||
"github.com/seaweedfs/seaweedfs/weed/stats"
|
||||
dto "github.com/prometheus/client_model/go"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -152,40 +150,3 @@ func TestProcessMatches_AllDueNoSkippedFlag(t *testing.T) {
|
||||
require.False(t, halted)
|
||||
require.False(t, skipped, "every match was past DueTime; skippedAny must be false")
|
||||
}
|
||||
|
||||
func TestProcessMatches_DispatchCounterIncrements(t *testing.T) {
|
||||
// Pin that dispatched matches increment S3LifecycleDispatchCounter
|
||||
// with the outcome label so a refactor doesn't silently drop the
|
||||
// observability hook. Use a bucket/kind no other test touches to
|
||||
// keep the read-after-write stable.
|
||||
runNow := time.Now()
|
||||
rh := [8]byte{0xfe}
|
||||
rule := s3lifecycle.ActionKey{Bucket: "metrics-pin-bkt", RuleHash: rh, ActionKind: s3lifecycle.ActionKindExpirationDays}
|
||||
matches := []router.Match{
|
||||
{Key: rule, Bucket: "metrics-pin-bkt", ObjectKey: "obj", DueTime: runNow.Add(-time.Hour)},
|
||||
}
|
||||
client := &recordingClient{} // default DONE
|
||||
before := dispatchCounterValue("metrics-pin-bkt", "expiration_days", "DONE")
|
||||
// Delete the label row on exit so this test doesn't leak into the
|
||||
// in-process Prometheus registry that other tests share.
|
||||
defer stats.S3LifecycleDispatchCounter.DeleteLabelValues("metrics-pin-bkt", "expiration_days", "DONE")
|
||||
cfg := Config{Client: client}
|
||||
_, _, err := processMatches(context.Background(), cfg, runNow, &reader.Event{}, matches)
|
||||
require.NoError(t, err)
|
||||
after := dispatchCounterValue("metrics-pin-bkt", "expiration_days", "DONE")
|
||||
assert.Equal(t, before+1, after, "DONE outcome must increment the dispatch counter")
|
||||
}
|
||||
|
||||
// dispatchCounterValue reads the current value of the shared
|
||||
// S3LifecycleDispatchCounter for the given (bucket, kind, outcome).
|
||||
func dispatchCounterValue(bucket, kind, outcome string) float64 {
|
||||
m := stats.S3LifecycleDispatchCounter.WithLabelValues(bucket, kind, outcome)
|
||||
var pm dto.Metric
|
||||
if err := m.Write(&pm); err != nil {
|
||||
return 0
|
||||
}
|
||||
if pm.Counter == nil {
|
||||
return 0
|
||||
}
|
||||
return pm.Counter.GetValue()
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -62,23 +61,6 @@ type Config struct {
|
||||
// still rewinds, matching Phase 4a behavior.
|
||||
Walker WalkerFunc
|
||||
|
||||
// WalkerInterval throttles the steady-state and empty-replay walker
|
||||
// invocations: the walker fires only when the time since the
|
||||
// per-shard cursor's LastWalkedNs exceeds this value. Cold-start
|
||||
// and recovery walker fires (RecoveryView) are unconditional —
|
||||
// those are bounded events that must run once when the trigger
|
||||
// condition is met. 0 means "fire on every pass" (the prior
|
||||
// behavior, suitable for s3tests-style rapid-cadence drivers and
|
||||
// for in-repo integration tests).
|
||||
//
|
||||
// Production deployments should set this to roughly the walk cost
|
||||
// budget per shard per cluster: e.g., 1h for a small cluster, 6h
|
||||
// for a large one. The walker reads the whole bucket subtree it
|
||||
// covers, so a too-short interval crushes the filer; a too-long
|
||||
// interval delays ExpirationDate and ExpiredObjectDeleteMarker
|
||||
// dispatches.
|
||||
WalkerInterval time.Duration
|
||||
|
||||
ClientName string
|
||||
// 0 -> randomized per-run.
|
||||
ClientID int32
|
||||
@@ -94,12 +76,6 @@ type Config struct {
|
||||
// concurrently. Returns the first shard error; the rest log and run to
|
||||
// completion so one shard's transient failure doesn't lose other shards'
|
||||
// progress.
|
||||
//
|
||||
// All cfg.Shards share one meta-log subscription. The Reader's
|
||||
// ShardPredicate accepts any shard in cfg.Shards, and a fan-out
|
||||
// goroutine routes events to per-shard channels by ev.ShardID. This
|
||||
// replaces the earlier per-shard Reader that opened 16 SubscribeMetadata
|
||||
// streams to filer per pass.
|
||||
func Run(ctx context.Context, cfg Config) error {
|
||||
if err := validate(cfg); err != nil {
|
||||
return err
|
||||
@@ -110,256 +86,46 @@ func Run(ctx context.Context, cfg Config) error {
|
||||
}
|
||||
// Freeze "now" so shards agree on the boundary.
|
||||
runNow := now()
|
||||
startedAt := time.Now()
|
||||
|
||||
// Capture once so a mid-run Compile can't make shards disagree.
|
||||
snap := cfg.Engine.Snapshot()
|
||||
rsh := engine.ReplayContentHash(snap)
|
||||
maxTTL := engine.MaxEffectiveTTL(snap)
|
||||
|
||||
// Since all shards share one subscription, every shard goroutine
|
||||
// must be live to drain its channel — capping concurrency would
|
||||
// stall the fan-out. cfg.Workers no longer gates shard concurrency
|
||||
// (dispatch is throttled via cfg.Limiter); accepted for backwards
|
||||
// compatibility but otherwise inert.
|
||||
_ = cfg.Workers
|
||||
|
||||
// rsh==[32]byte{} means no replay-eligible rules — runShard's
|
||||
// walker-only branch fires and saves; no subscription needed.
|
||||
var (
|
||||
shardEvents map[int]chan *reader.Event
|
||||
readerDone chan error
|
||||
fanoutDone chan struct{}
|
||||
cancelRead context.CancelFunc
|
||||
globalStartTsNs int64
|
||||
)
|
||||
if rsh != [32]byte{} {
|
||||
// Pre-load all per-shard cursors so the shared subscription
|
||||
// can start from min(per-shard startTsNs). Using the cold-start
|
||||
// floor (runNow - maxTTL) globally would skip past pending
|
||||
// events on shards whose cursor is older than the floor —
|
||||
// exactly the case where a rule's TTL equals maxTTL and an
|
||||
// older event still has DueTime <= runNow.
|
||||
globalStartTsNs = computeGlobalStartTsNs(ctx, cfg, runNow, maxTTL)
|
||||
shardEvents, readerDone, fanoutDone, cancelRead = startSharedSubscription(ctx, cfg, runNow, globalStartTsNs)
|
||||
defer cancelRead()
|
||||
workers := cfg.Workers
|
||||
if workers <= 0 {
|
||||
workers = 1
|
||||
}
|
||||
if workers > len(cfg.Shards) {
|
||||
workers = len(cfg.Shards)
|
||||
}
|
||||
sem := make(chan struct{}, workers)
|
||||
|
||||
var wg sync.WaitGroup
|
||||
errCh := make(chan error, len(cfg.Shards))
|
||||
for _, sh := range cfg.Shards {
|
||||
sh := sh
|
||||
wg.Add(1)
|
||||
sem <- struct{}{}
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
var ch <-chan *reader.Event
|
||||
if shardEvents != nil {
|
||||
ch = shardEvents[sh]
|
||||
}
|
||||
if err := runShard(ctx, cfg, snap, runNow, sh, ch); err != nil {
|
||||
defer func() { <-sem }()
|
||||
if err := runShard(ctx, cfg, snap, runNow, sh); err != nil {
|
||||
errCh <- err
|
||||
}
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
close(errCh)
|
||||
|
||||
// Tear down the shared subscription. cancelRead unblocks both the
|
||||
// reader's gRPC stream and the fan-out's send loop; we wait on both
|
||||
// so their goroutines don't outlive Run.
|
||||
if cancelRead != nil {
|
||||
cancelRead()
|
||||
<-fanoutDone
|
||||
if rerr := <-readerDone; rerr != nil && !errors.Is(rerr, context.Canceled) && !errors.Is(rerr, context.DeadlineExceeded) {
|
||||
glog.V(2).Infof("daily_run: shared reader returned: %v", rerr)
|
||||
}
|
||||
}
|
||||
|
||||
var first error
|
||||
errCount := 0
|
||||
for err := range errCh {
|
||||
errCount++
|
||||
if first == nil {
|
||||
first = err
|
||||
} else {
|
||||
glog.V(1).Infof("daily_run: additional shard error: %v", err)
|
||||
}
|
||||
}
|
||||
status := "ok"
|
||||
if first != nil {
|
||||
status = "error"
|
||||
}
|
||||
// Summary line is parsed by operator scripts and CI log greps; keep
|
||||
// the existing key=value tokens stable and append new ones at the
|
||||
// end. cursor_lag_max / walked_max_age are the per-pass observability
|
||||
// floor — for finer detail, scrape the per-shard gauges.
|
||||
lagSummary := summarizeShardCursorLag(ctx, cfg, runNow)
|
||||
glog.V(0).Infof("daily_run: status=%s shards=%d errors=%d duration=%s %s",
|
||||
status, len(cfg.Shards), errCount, time.Since(startedAt).Round(time.Millisecond), lagSummary)
|
||||
return first
|
||||
}
|
||||
|
||||
// summarizeShardCursorLag walks the persisted cursors one more time
|
||||
// after the run, computes the worst (largest) lag and walker-age across
|
||||
// the cfg.Shards set, and renders them as key=value tokens. Returns
|
||||
// a string suitable for appending to the heartbeat line. Load errors
|
||||
// short-circuit to a marker token so the heartbeat doesn't lie about
|
||||
// the state.
|
||||
func summarizeShardCursorLag(ctx context.Context, cfg Config, runNow time.Time) string {
|
||||
var (
|
||||
maxLag time.Duration
|
||||
maxAge time.Duration
|
||||
anyCursor bool
|
||||
anyWalked bool
|
||||
)
|
||||
for _, sh := range cfg.Shards {
|
||||
c, found, err := cfg.Persister.Load(ctx, sh)
|
||||
if err != nil || !found {
|
||||
continue
|
||||
}
|
||||
if c.TsNs > 0 {
|
||||
lag := runNow.Sub(time.Unix(0, c.TsNs))
|
||||
if !anyCursor || lag > maxLag {
|
||||
maxLag = lag
|
||||
anyCursor = true
|
||||
}
|
||||
}
|
||||
if c.LastWalkedNs > 0 {
|
||||
age := runNow.Sub(time.Unix(0, c.LastWalkedNs))
|
||||
if !anyWalked || age > maxAge {
|
||||
maxAge = age
|
||||
anyWalked = true
|
||||
}
|
||||
}
|
||||
}
|
||||
lagStr := "cursor_lag_max=cold"
|
||||
if anyCursor {
|
||||
lagStr = fmt.Sprintf("cursor_lag_max=%s", maxLag.Round(time.Second))
|
||||
}
|
||||
ageStr := "walked_max_age=cold"
|
||||
if anyWalked {
|
||||
ageStr = fmt.Sprintf("walked_max_age=%s", maxAge.Round(time.Second))
|
||||
}
|
||||
return lagStr + " " + ageStr
|
||||
}
|
||||
|
||||
// computeGlobalStartTsNs scans every shard's persisted cursor and
|
||||
// returns the minimum startTsNs the shared subscription must cover.
|
||||
// For each shard the start point is the persisted cursor (steady state)
|
||||
// or runNow - maxTTL (cold start, when no cursor exists). Load errors
|
||||
// downgrade to the cold-start floor for that shard — failing closed
|
||||
// would be worse than re-scanning maxTTL of events.
|
||||
func computeGlobalStartTsNs(ctx context.Context, cfg Config, runNow time.Time, maxTTL time.Duration) int64 {
|
||||
floor := runNow.Add(-maxTTL).UnixNano()
|
||||
min := int64(0)
|
||||
first := true
|
||||
for _, sh := range cfg.Shards {
|
||||
var start int64
|
||||
if persisted, found, err := cfg.Persister.Load(ctx, sh); err == nil && found {
|
||||
start = persisted.TsNs
|
||||
} else {
|
||||
start = floor
|
||||
}
|
||||
if first || start < min {
|
||||
min = start
|
||||
first = false
|
||||
}
|
||||
}
|
||||
if first {
|
||||
// No shards (validate() should have caught this, but defensive).
|
||||
return floor
|
||||
}
|
||||
return min
|
||||
}
|
||||
|
||||
// startSharedSubscription opens one SubscribeMetadata stream covering
|
||||
// every shard in cfg.Shards and fans events out to per-shard channels.
|
||||
// Subscription floor is the caller-supplied globalStartTsNs (typically
|
||||
// min over per-shard cursors). Shards whose own startTsNs is fresher
|
||||
// filter out already-past events themselves inside drainShardEvents.
|
||||
// Events arriving with TsNs > runUpTo (the pass boundary) cause the
|
||||
// fan-out to cancel the reader and close all per-shard channels,
|
||||
// ending the pass.
|
||||
func startSharedSubscription(ctx context.Context, cfg Config, runNow time.Time, globalStartTsNs int64) (map[int]chan *reader.Event, chan error, chan struct{}, context.CancelFunc) {
|
||||
shardSet := make(map[int]bool, len(cfg.Shards))
|
||||
shardEvents := make(map[int]chan *reader.Event, len(cfg.Shards))
|
||||
for _, sh := range cfg.Shards {
|
||||
shardSet[sh] = true
|
||||
// Per-shard channel size has to absorb event bursts between
|
||||
// drains' iterations without backpressuring the fan-out.
|
||||
// 256 covers a busy test bucket; production tuning can lift
|
||||
// this further.
|
||||
shardEvents[sh] = make(chan *reader.Event, 256)
|
||||
}
|
||||
|
||||
clientName := cfg.ClientName
|
||||
if clientName == "" {
|
||||
clientName = "worker-s3-lifecycle-daily"
|
||||
}
|
||||
clientID := cfg.ClientID
|
||||
if clientID == 0 {
|
||||
clientID = int32(util.RandomInt32())
|
||||
}
|
||||
|
||||
events := make(chan *reader.Event, 4*len(cfg.Shards))
|
||||
rd := &reader.Reader{
|
||||
ShardPredicate: func(id int) bool { return shardSet[id] },
|
||||
BucketsPath: cfg.BucketsPath,
|
||||
StartTsNs: globalStartTsNs,
|
||||
Events: events,
|
||||
EventBudget: cfg.EventBudget,
|
||||
}
|
||||
|
||||
readerCtx, cancelReader := context.WithCancel(ctx)
|
||||
readerDone := make(chan error, 1)
|
||||
go func() {
|
||||
readerDone <- rd.Run(readerCtx, cfg.FilerClient, clientName, clientID)
|
||||
}()
|
||||
|
||||
runUpTo := runNow.UnixNano()
|
||||
fanoutDone := make(chan struct{})
|
||||
go func() {
|
||||
defer close(fanoutDone)
|
||||
defer func() {
|
||||
for _, ch := range shardEvents {
|
||||
close(ch)
|
||||
}
|
||||
}()
|
||||
for {
|
||||
select {
|
||||
case <-readerCtx.Done():
|
||||
return
|
||||
case ev, ok := <-events:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if ev == nil {
|
||||
continue
|
||||
}
|
||||
// Meta-log events arrive in TsNs order; the first
|
||||
// event past runUpTo means everything after is past
|
||||
// too. Cancel the reader so subsequent passes don't
|
||||
// pay for stream tail we'd drop anyway.
|
||||
if ev.TsNs > runUpTo {
|
||||
cancelReader()
|
||||
return
|
||||
}
|
||||
ch := shardEvents[ev.ShardID]
|
||||
if ch == nil {
|
||||
continue
|
||||
}
|
||||
select {
|
||||
case <-readerCtx.Done():
|
||||
return
|
||||
case ch <- ev:
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return shardEvents, readerDone, fanoutDone, cancelReader
|
||||
}
|
||||
|
||||
func validate(cfg Config) error {
|
||||
if cfg.Engine == nil {
|
||||
return errors.New("daily_run: nil Engine")
|
||||
@@ -379,16 +145,6 @@ func validate(cfg Config) error {
|
||||
if cfg.BucketsPath == "" {
|
||||
return errors.New("daily_run: empty BucketsPath")
|
||||
}
|
||||
// A negative WalkerInterval would silently fall through walkerDue's
|
||||
// `interval <= 0` branch and re-enable "walk every pass", defeating
|
||||
// the throttle whose whole point is bounding filer load. The
|
||||
// admin-config parser already clamps negative input to zero
|
||||
// (worker/tasks/s3_lifecycle/config.go), but callers using
|
||||
// dailyrun.Config directly (tests, embedders, future drivers) get
|
||||
// a loud failure instead.
|
||||
if cfg.WalkerInterval < 0 {
|
||||
return fmt.Errorf("daily_run: negative WalkerInterval %v (0 = unthrottled, positive values throttle)", cfg.WalkerInterval)
|
||||
}
|
||||
for _, sh := range cfg.Shards {
|
||||
if sh < 0 || sh >= s3lifecycle.ShardCount {
|
||||
return fmt.Errorf("daily_run: shard %d out of [0, %d)", sh, s3lifecycle.ShardCount)
|
||||
@@ -398,22 +154,13 @@ func validate(cfg Config) error {
|
||||
}
|
||||
|
||||
// runShard executes one daily-replay pass; see DESIGN.md for algorithm.
|
||||
// Three walker invocation paths under cfg.Walker (when set):
|
||||
// - cold start / recovery: RecoveryView. Unconditional — these are
|
||||
// bounded events (first run for a shard, or rule-content edit / partition
|
||||
// flip) and the walker must run once when the trigger condition is met.
|
||||
// - steady state: RulesForShard's walk view, throttled by cfg.WalkerInterval
|
||||
// against persisted.LastWalkedNs so the walker fires on its own cadence
|
||||
// independently of how often Run() is invoked.
|
||||
// - empty replay: same throttling — buckets with only walker-bound rules
|
||||
// use the walk view, and a too-fast Run() driver would otherwise burn
|
||||
// the filer with a full subtree scan per tick.
|
||||
func runShard(ctx context.Context, cfg Config, snap *engine.Snapshot, runNow time.Time, shardID int, events <-chan *reader.Event) error {
|
||||
shardLabel := strconv.Itoa(shardID)
|
||||
shardStart := time.Now()
|
||||
defer func() {
|
||||
stats.S3LifecycleDailyRunShardDurationSeconds.WithLabelValues(shardLabel).Observe(time.Since(shardStart).Seconds())
|
||||
}()
|
||||
// Two walker invocations under cfg.Walker (when set):
|
||||
// - recovery branch: RecoveryView, so already-due objects across the
|
||||
// rewritten rule set fire before the cursor rewinds.
|
||||
// - steady state: RulesForShard's walk view, so walker-bound and
|
||||
// scan_only-promoted rules fire every day even when replay rules
|
||||
// are unchanged.
|
||||
func runShard(ctx context.Context, cfg Config, snap *engine.Snapshot, runNow time.Time, shardID int) error {
|
||||
persisted, found, err := cfg.Persister.Load(ctx, shardID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("shard=%d: load cursor: %w", shardID, err)
|
||||
@@ -441,82 +188,30 @@ func runShard(ctx context.Context, cfg Config, snap *engine.Snapshot, runNow tim
|
||||
}
|
||||
promoted := engine.PromotedHash(snap, retentionWindow)
|
||||
|
||||
// lastWalkedNs threads the steady-state walker's clock through the
|
||||
// cursor saves below. Start with the persisted value; only update
|
||||
// it when a steady-state / empty-replay walker fire actually
|
||||
// happens. Cold-start and recovery walker fires also bump it so
|
||||
// the next pass's throttle has a fresh anchor.
|
||||
//
|
||||
// walkedThisPass is the in-pass guard: walkerDue answers the
|
||||
// persisted-state question ("has enough time elapsed?"), but a
|
||||
// cold-start or recovery branch above the steady-state check
|
||||
// already fired the walker with RecoveryView, which is a superset
|
||||
// of every per-shard partition. Keeping the within-pass guard out
|
||||
// of walkerDue lets that function stay pure (interval/never-walked
|
||||
// logic only) and side-steps the test-injectable-runNow ambiguity
|
||||
// where two distinct passes happen to share a UnixNano.
|
||||
lastWalkedNs := persisted.LastWalkedNs
|
||||
walkedThisPass := false
|
||||
|
||||
if rsh == [32]byte{} {
|
||||
// No replay-eligible rules. Walker-only rules
|
||||
// (ExpirationDate / ExpiredDeleteMarker / NewerNoncurrent)
|
||||
// or scan_only-promoted rules might still need a walk; run
|
||||
// the walker (throttled by WalkerInterval) before persisting
|
||||
// the empty cursor and returning. Without this, a bucket whose
|
||||
// only rule is walker-bound would never have it dispatched —
|
||||
// the bug TestLifecycleExpirationDateInThePast caught.
|
||||
if cfg.Walker != nil && walkerDue(lastWalkedNs, runNow, cfg.WalkerInterval) {
|
||||
if _, walkView := snap.RulesForShard(shardID, retentionWindow); walkView != nil && len(walkView.AllActions()) > 0 {
|
||||
if werr := cfg.Walker(ctx, walkView, shardID); werr != nil {
|
||||
return fmt.Errorf("shard=%d: steady walk (empty replay): %w", shardID, werr)
|
||||
}
|
||||
lastWalkedNs = runNow.UnixNano()
|
||||
walkedThisPass = true
|
||||
}
|
||||
}
|
||||
_ = walkedThisPass // empty-replay branch returns; no downstream walker.
|
||||
return saveCursorAndPublish(ctx, cfg.Persister, shardID, Cursor{
|
||||
return cfg.Persister.Save(ctx, shardID, Cursor{
|
||||
TsNs: 0,
|
||||
RuleSetHash: rsh,
|
||||
PromotedHash: promoted,
|
||||
LastWalkedNs: lastWalkedNs,
|
||||
})
|
||||
}
|
||||
|
||||
// Recovery / cold-start walker:
|
||||
// - found && hashes mismatch: rule edit or partition flip — walk
|
||||
// the rewritten rule set so already-due objects fire before the
|
||||
// cursor rewinds, then rewind for meta-log replay.
|
||||
// - !found: first run for this shard. Pre-existing objects PUT
|
||||
// before the rule was added live OUTSIDE the meta-log scan
|
||||
// window (TsNs > runNow - maxTTL) and would never replay; the
|
||||
// walker has to discover them. The streaming worker did this
|
||||
// via BucketBootstrapper; daily-replay needs the same.
|
||||
mustWalkRecovery := found && (persisted.RuleSetHash != rsh || persisted.PromotedHash != promoted)
|
||||
mustWalkColdStart := !found
|
||||
if mustWalkRecovery || mustWalkColdStart {
|
||||
// Recovery: rule-content edit (RuleSetHash mismatch) or partition
|
||||
// flip (PromotedHash mismatch). Walk the rewritten rule set so
|
||||
// already-due objects fire before the cursor rewinds; then rewind
|
||||
// and let the sliding meta-log replay catch up steady state.
|
||||
if found && (persisted.RuleSetHash != rsh || persisted.PromotedHash != promoted) {
|
||||
if cfg.Walker != nil {
|
||||
if werr := cfg.Walker(ctx, engine.RecoveryView(snap), shardID); werr != nil {
|
||||
return fmt.Errorf("shard=%d: recovery walk: %w", shardID, werr)
|
||||
}
|
||||
lastWalkedNs = runNow.UnixNano()
|
||||
walkedThisPass = true
|
||||
}
|
||||
if mustWalkRecovery {
|
||||
// Rule changed: rewind cursor so the sliding replay re-scans
|
||||
// the new max-TTL window and the persisted hashes match the
|
||||
// new rule set.
|
||||
next := Cursor{
|
||||
TsNs: runNow.Add(-maxTTL).UnixNano(),
|
||||
RuleSetHash: rsh,
|
||||
PromotedHash: promoted,
|
||||
LastWalkedNs: lastWalkedNs,
|
||||
}
|
||||
return saveCursorAndPublish(ctx, cfg.Persister, shardID, next)
|
||||
next := Cursor{
|
||||
TsNs: runNow.Add(-maxTTL).UnixNano(),
|
||||
RuleSetHash: rsh,
|
||||
PromotedHash: promoted,
|
||||
}
|
||||
// Cold start: keep TsNs=0 so the drain below floors to
|
||||
// runNow - maxTTL and the cursor is saved fresh after the run.
|
||||
return cfg.Persister.Save(ctx, shardID, next)
|
||||
}
|
||||
|
||||
// Steady-state walker for walker-bound and scan_only-promoted rules.
|
||||
@@ -525,109 +220,71 @@ func runShard(ctx context.Context, cfg Config, snap *engine.Snapshot, runNow tim
|
||||
// hash already accounted for. Empty walk view (no rules need walking
|
||||
// today) skips the call so non-versioned, replay-only deployments
|
||||
// don't pay an O(N) bucket-walk per run.
|
||||
//
|
||||
// Two-stage gate: walkedThisPass suppresses a double walk when the
|
||||
// cold-start branch above already fired (RecoveryView covered it).
|
||||
// walkerDue applies the persisted-state throttle for the case
|
||||
// where this is a normal pass that didn't trigger cold-start.
|
||||
if cfg.Walker != nil && !walkedThisPass && walkerDue(lastWalkedNs, runNow, cfg.WalkerInterval) {
|
||||
if cfg.Walker != nil {
|
||||
if _, walkView := snap.RulesForShard(shardID, retentionWindow); walkView != nil && len(walkView.AllActions()) > 0 {
|
||||
if werr := cfg.Walker(ctx, walkView, shardID); werr != nil {
|
||||
return fmt.Errorf("shard=%d: steady walk: %w", shardID, werr)
|
||||
}
|
||||
lastWalkedNs = runNow.UnixNano()
|
||||
}
|
||||
}
|
||||
|
||||
// Cold start: scan from now-maxTTL so already-due objects within
|
||||
// meta-log retention still expire. In steady state honor the
|
||||
// cursor as-is: the drain freezes the cursor at the last pre-skip
|
||||
// event so pending matches with DueTime == TsNs+maxTTL stay in
|
||||
// scope across passes. Bumping forward to runNow-maxTTL would
|
||||
// orphan exactly those events (the test_lifecyclev2_expiration
|
||||
// regression: cursor saved at the no-match event right before
|
||||
// the not-yet-due expire3 PUT, then floor at runNow=PUT+maxTTL
|
||||
// equals PUT — bumping past the expire3 event itself).
|
||||
// meta-log retention still expire.
|
||||
startTsNs := persisted.TsNs
|
||||
if !found {
|
||||
startTsNs = runNow.Add(-maxTTL).UnixNano()
|
||||
floor := runNow.Add(-maxTTL).UnixNano()
|
||||
if startTsNs < floor {
|
||||
startTsNs = floor
|
||||
}
|
||||
|
||||
lastOK, _, drainErr := drainShardEvents(ctx, cfg, runNow, shardID, snap, startTsNs, events)
|
||||
// Cursor save uses a fresh ctx because the steady-state drain exits
|
||||
// via passCtx cancellation (the only signal the filer subscription
|
||||
// gets when no new events arrive). Saving with the canceled passCtx
|
||||
// would silently drop the cursor and the next pass would re-replay
|
||||
// from the same floor — defeating advancement entirely.
|
||||
saveCtx, saveCancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer saveCancel()
|
||||
lastOK, _, drainErr := drainShardEvents(ctx, cfg, runNow, shardID, snap, startTsNs)
|
||||
if drainErr != nil {
|
||||
_ = saveCursorAndPublish(saveCtx, cfg.Persister, shardID, Cursor{TsNs: lastOK, RuleSetHash: rsh, PromotedHash: promoted, LastWalkedNs: lastWalkedNs})
|
||||
// passCtx timeout is the expected end-of-pass for an idle
|
||||
// subscription; not a real error. Other drain errors still
|
||||
// propagate.
|
||||
if errors.Is(drainErr, context.DeadlineExceeded) || errors.Is(drainErr, context.Canceled) {
|
||||
return nil
|
||||
}
|
||||
_ = cfg.Persister.Save(ctx, shardID, Cursor{TsNs: lastOK, RuleSetHash: rsh, PromotedHash: promoted})
|
||||
return fmt.Errorf("shard=%d: drain: %w", shardID, drainErr)
|
||||
}
|
||||
|
||||
return saveCursorAndPublish(saveCtx, cfg.Persister, shardID, Cursor{
|
||||
return cfg.Persister.Save(ctx, shardID, Cursor{
|
||||
TsNs: lastOK,
|
||||
RuleSetHash: rsh,
|
||||
PromotedHash: promoted,
|
||||
LastWalkedNs: lastWalkedNs,
|
||||
})
|
||||
}
|
||||
|
||||
// saveCursorAndPublish persists the cursor and, on success, updates the
|
||||
// per-shard Prometheus gauges so operators can read cursor lag
|
||||
// (now - cursor_min_ts_ns) and walker freshness (now - last_walked_ns)
|
||||
// without having to read the cursor file directly. On save failure the
|
||||
// gauges are left untouched: their last successful-save value is more
|
||||
// useful than a value that doesn't match what's on the filer.
|
||||
func saveCursorAndPublish(ctx context.Context, p CursorPersister, shardID int, c Cursor) error {
|
||||
if err := p.Save(ctx, shardID, c); err != nil {
|
||||
return err
|
||||
// drainShardEvents subscribes to the meta-log from startTsNs and
|
||||
// dispatches matches whose due_time is past runNow. cursorAdvanceTo
|
||||
// stops growing at the first event with a not-yet-due match so that
|
||||
// event is re-scanned in a later run. halted=true marks an unresolved
|
||||
// dispatch outcome.
|
||||
func drainShardEvents(ctx context.Context, cfg Config, runNow time.Time, shardID int, snap *engine.Snapshot, startTsNs int64) (int64, bool, error) {
|
||||
clientName := cfg.ClientName
|
||||
if clientName == "" {
|
||||
clientName = "worker-s3-lifecycle-daily"
|
||||
}
|
||||
label := strconv.Itoa(shardID)
|
||||
stats.S3LifecycleCursorMinTsNs.WithLabelValues(label).Set(float64(c.TsNs))
|
||||
stats.S3LifecycleDailyRunLastWalkedNs.WithLabelValues(label).Set(float64(c.LastWalkedNs))
|
||||
return nil
|
||||
}
|
||||
|
||||
// walkerDue answers the persisted-state throttle: has enough time
|
||||
// elapsed since the last walker fire on this shard? interval == 0
|
||||
// means "fire every pass" (the prior, unconditional behavior).
|
||||
// lastWalkedNs == 0 means "never walked steady-state" — fire to
|
||||
// establish the throttle anchor. Otherwise gate on
|
||||
// (runNow - lastWalkedNs) >= interval.
|
||||
//
|
||||
// Within-pass double-fire suppression (cold-start / recovery walker
|
||||
// already ran this pass; steady-state branch must not re-walk a
|
||||
// superset partition) lives in runShard's walkedThisPass local flag
|
||||
// rather than here. Keeping walkerDue pure means the function answers
|
||||
// one question and a test that injects two distinct passes with the
|
||||
// same runNow doesn't get falsely throttled.
|
||||
func walkerDue(lastWalkedNs int64, runNow time.Time, interval time.Duration) bool {
|
||||
if interval <= 0 || lastWalkedNs == 0 {
|
||||
return true
|
||||
clientID := cfg.ClientID
|
||||
if clientID == 0 {
|
||||
clientID = int32(util.RandomInt32())
|
||||
}
|
||||
runUpTo := runNow.UnixNano()
|
||||
if startTsNs >= runUpTo {
|
||||
return startTsNs, false, nil
|
||||
}
|
||||
return runNow.UnixNano()-lastWalkedNs >= int64(interval)
|
||||
}
|
||||
|
||||
// drainShardEvents reads pre-fanned-out events for this shard from the
|
||||
// shared meta-log subscription and dispatches matches whose due_time is
|
||||
// past runNow. cursorAdvanceTo stops growing at the first event with a
|
||||
// not-yet-due match so that event is re-scanned in a later run.
|
||||
// halted=true marks an unresolved dispatch outcome.
|
||||
//
|
||||
// The subscription itself lives at the Run() level — one filer stream
|
||||
// fans out to per-shard channels via shardEventDispatcher. Each shard
|
||||
// drains its own channel and advances its own cursor; future-TsNs
|
||||
// events (relative to this pass's runNow) are filtered out by the
|
||||
// dispatcher before they reach this channel.
|
||||
func drainShardEvents(ctx context.Context, cfg Config, runNow time.Time, shardID int, snap *engine.Snapshot, startTsNs int64, events <-chan *reader.Event) (int64, bool, error) {
|
||||
events := make(chan *reader.Event, 64)
|
||||
rd := &reader.Reader{
|
||||
ShardID: shardID,
|
||||
BucketsPath: cfg.BucketsPath,
|
||||
StartTsNs: startTsNs,
|
||||
Events: events,
|
||||
EventBudget: cfg.EventBudget,
|
||||
}
|
||||
|
||||
readerCtx, cancelReader := context.WithCancel(ctx)
|
||||
defer cancelReader()
|
||||
|
||||
readerDone := make(chan error, 1)
|
||||
go func() {
|
||||
readerDone <- rd.Run(readerCtx, cfg.FilerClient, clientName, clientID)
|
||||
}()
|
||||
|
||||
cursorAdvanceTo := startTsNs
|
||||
stuck := false
|
||||
halted := false
|
||||
@@ -636,6 +293,8 @@ drain:
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
cancelReader()
|
||||
<-readerDone
|
||||
return cursorAdvanceTo, true, ctx.Err()
|
||||
case ev, ok := <-events:
|
||||
if !ok {
|
||||
@@ -644,16 +303,15 @@ drain:
|
||||
if ev == nil {
|
||||
continue
|
||||
}
|
||||
// The global subscription starts at min(per-shard startTsNs),
|
||||
// so this shard may receive events that are already past its
|
||||
// own cursor. Skip them rather than re-dispatching.
|
||||
if ev.TsNs <= startTsNs {
|
||||
continue
|
||||
if ev.TsNs > runUpTo {
|
||||
cancelReader()
|
||||
break drain
|
||||
}
|
||||
stats.S3LifecycleDailyRunEventsScanned.WithLabelValues(strconv.Itoa(shardID)).Inc()
|
||||
matches := router.Route(ctx, snap, ev, runNow, cfg.Lister)
|
||||
eventSkipped, eventHalted, eventErr := processMatches(ctx, cfg, runNow, ev, matches)
|
||||
if eventErr != nil {
|
||||
cancelReader()
|
||||
<-readerDone
|
||||
return cursorAdvanceTo, true, eventErr
|
||||
}
|
||||
if eventHalted {
|
||||
@@ -670,6 +328,10 @@ drain:
|
||||
}
|
||||
}
|
||||
|
||||
cancelReader()
|
||||
if rerr := <-readerDone; rerr != nil && !errors.Is(rerr, context.Canceled) {
|
||||
glog.V(2).Infof("daily_run shard=%d: reader returned: %v", shardID, rerr)
|
||||
}
|
||||
return cursorAdvanceTo, halted, nil
|
||||
}
|
||||
|
||||
@@ -695,13 +357,8 @@ func processMatches(ctx context.Context, cfg Config, runNow time.Time, ev *reade
|
||||
if dispatchErr != nil {
|
||||
glog.V(1).Infof("daily_run: transport error on %s/%s %s: %v",
|
||||
m.Bucket, m.ObjectKey, m.Key.ActionKind, dispatchErr)
|
||||
// "RPC_ERROR" matches the streaming dispatcher's label
|
||||
// (dispatcher/dispatcher.go) so transport failures
|
||||
// aggregate under one outcome key across paths.
|
||||
stats.S3LifecycleDispatchCounter.WithLabelValues(m.Bucket, m.Key.ActionKind.String(), "RPC_ERROR").Inc()
|
||||
return skippedAny, true, nil
|
||||
}
|
||||
stats.S3LifecycleDispatchCounter.WithLabelValues(m.Bucket, m.Key.ActionKind.String(), outcome.String()).Inc()
|
||||
switch outcome {
|
||||
case s3_lifecycle_pb.LifecycleDeleteOutcome_DONE,
|
||||
s3_lifecycle_pb.LifecycleDeleteOutcome_NOOP_RESOLVED,
|
||||
|
||||
@@ -3,13 +3,11 @@ package dailyrun
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/s3_lifecycle_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/bootstrap"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/engine"
|
||||
"github.com/seaweedfs/seaweedfs/weed/stats"
|
||||
"golang.org/x/time/rate"
|
||||
)
|
||||
|
||||
// WalkerDispatcher adapts LifecycleClient to bootstrap.Dispatcher so
|
||||
@@ -20,11 +18,6 @@ import (
|
||||
// right contract for a full-tree walk that has just observed the entry.
|
||||
type WalkerDispatcher struct {
|
||||
Client LifecycleClient
|
||||
// Limiter throttles LifecycleDelete dispatch under the cluster's
|
||||
// shared deletes/sec budget. Should be the same *rate.Limiter the
|
||||
// daily-run's processMatches uses so the walker and replay paths
|
||||
// can't combine to burst past the cap. nil disables throttling.
|
||||
Limiter *rate.Limiter
|
||||
}
|
||||
|
||||
// Compile-time check.
|
||||
@@ -42,18 +35,16 @@ func (d *WalkerDispatcher) Delete(ctx context.Context, action *engine.CompiledAc
|
||||
}
|
||||
objectPath := entry.Path
|
||||
if entry.IsMPUInit {
|
||||
// Rule-prefix matching uses DestKey (the user's intended
|
||||
// object key); dispatch uses entry.Path (.uploads/<id>),
|
||||
// which is what the server's ABORT_MPU handler expects in
|
||||
// req.ObjectPath — it strips the .uploads/ prefix to get
|
||||
// the upload id and reads the init record from that
|
||||
// directory. DestKey is the dispatch ANTI-pattern here: it
|
||||
// looks like a regular object path, the server's check for
|
||||
// the .uploads/ prefix fails, and the dispatch comes back
|
||||
// as BLOCKED FATAL_EVENT_ERROR.
|
||||
// Rule-prefix matching used DestKey; the server takes the
|
||||
// canonical object path for the LifecycleDelete RPC, which
|
||||
// is also DestKey. The walker hits the .uploads/<id>
|
||||
// directory itself only when ActionKind=ABORT_MPU, and the
|
||||
// server resolves the upload from (bucket, object_path) +
|
||||
// the init record's metadata.
|
||||
if entry.DestKey == "" {
|
||||
return fmt.Errorf("walker dispatch: MPU init entry with empty DestKey: %s", entry.Path)
|
||||
}
|
||||
objectPath = entry.DestKey
|
||||
}
|
||||
rh := action.Key.RuleHash
|
||||
req := &s3_lifecycle_pb.LifecycleDeleteRequest{
|
||||
@@ -66,13 +57,6 @@ func (d *WalkerDispatcher) Delete(ctx context.Context, action *engine.CompiledAc
|
||||
// the live entry on this code path.
|
||||
}
|
||||
kindLabel := action.Key.ActionKind.String()
|
||||
if d.Limiter != nil {
|
||||
waitStart := time.Now()
|
||||
if waitErr := d.Limiter.Wait(ctx); waitErr != nil {
|
||||
return fmt.Errorf("walker dispatch %s/%s %s: limiter: %w", action.Bucket, objectPath, action.Key.ActionKind, waitErr)
|
||||
}
|
||||
stats.S3LifecycleDispatchLimiterWaitSeconds.Observe(time.Since(waitStart).Seconds())
|
||||
}
|
||||
resp, err := d.Client.LifecycleDelete(ctx, req)
|
||||
if err != nil {
|
||||
// "RPC_ERROR" matches the streaming dispatcher and processMatches
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/s3_lifecycle_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
@@ -12,7 +11,6 @@ import (
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/engine"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/time/rate"
|
||||
)
|
||||
|
||||
// walkerStubClient captures the last LifecycleDeleteRequest so tests
|
||||
@@ -74,11 +72,9 @@ func TestWalkerDispatcher_VersionedPassesVersionID(t *testing.T) {
|
||||
assert.Equal(t, "v-abc", c.lastReq.VersionId)
|
||||
}
|
||||
|
||||
func TestWalkerDispatcher_MPUInitUsesUploadsPath(t *testing.T) {
|
||||
// Rule-prefix matching uses DestKey to decide IF this MPU init
|
||||
// matches; dispatch uses Path (.uploads/<id>) because the server's
|
||||
// ABORT_MPU handler strips the .uploads/ prefix to get the upload
|
||||
// id. Sending DestKey here would BLOCK with FATAL_EVENT_ERROR.
|
||||
func TestWalkerDispatcher_MPUInitUsesDestKey(t *testing.T) {
|
||||
// Rule-prefix matching used DestKey; the RPC ObjectPath must match
|
||||
// so the server resolves the upload from the user's intended key.
|
||||
c := &walkerStubClient{outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_DONE}
|
||||
d := &WalkerDispatcher{Client: c}
|
||||
a := sampleAction(t, s3lifecycle.ActionKindAbortMPU)
|
||||
@@ -88,7 +84,7 @@ func TestWalkerDispatcher_MPUInitUsesUploadsPath(t *testing.T) {
|
||||
IsMPUInit: true,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, ".uploads/abc123", c.lastReq.ObjectPath)
|
||||
assert.Equal(t, "user/path/object", c.lastReq.ObjectPath)
|
||||
}
|
||||
|
||||
func TestWalkerDispatcher_MPUInitEmptyDestKeyErrors(t *testing.T) {
|
||||
@@ -153,38 +149,6 @@ func TestWalkerDispatcher_NilResponseReturnsError(t *testing.T) {
|
||||
assert.Contains(t, err.Error(), "nil response")
|
||||
}
|
||||
|
||||
func TestWalkerDispatcher_LimiterWaitsBeforeDispatch(t *testing.T) {
|
||||
// Build a tiny limiter (1 token, slow refill) and pre-drain it so
|
||||
// the next Wait blocks until the deadline. Dispatcher must respect
|
||||
// the limiter — without the wait the test passes trivially.
|
||||
c := &walkerStubClient{outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_DONE}
|
||||
lim := rate.NewLimiter(rate.Every(50*time.Millisecond), 1)
|
||||
_ = lim.AllowN(time.Now(), 1) // burn the burst token
|
||||
d := &WalkerDispatcher{Client: c, Limiter: lim}
|
||||
|
||||
start := time.Now()
|
||||
err := d.Delete(context.Background(), sampleAction(t, s3lifecycle.ActionKindExpirationDays), &bootstrap.Entry{Path: "obj"})
|
||||
elapsed := time.Since(start)
|
||||
require.NoError(t, err)
|
||||
assert.GreaterOrEqual(t, elapsed, 30*time.Millisecond,
|
||||
"limiter must throttle the dispatch; elapsed=%v", elapsed)
|
||||
}
|
||||
|
||||
func TestWalkerDispatcher_LimiterContextCancelHaltsWalker(t *testing.T) {
|
||||
// Pre-drained limiter + canceled ctx. Limiter.Wait returns the
|
||||
// cancel error; walker must surface it (not silently dispatch).
|
||||
c := &walkerStubClient{outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_DONE}
|
||||
lim := rate.NewLimiter(rate.Every(time.Hour), 1)
|
||||
_ = lim.AllowN(time.Now(), 1)
|
||||
d := &WalkerDispatcher{Client: c, Limiter: lim}
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
err := d.Delete(ctx, sampleAction(t, s3lifecycle.ActionKindExpirationDays), &bootstrap.Entry{Path: "obj"})
|
||||
require.Error(t, err)
|
||||
assert.Nil(t, c.lastReq, "no RPC should be sent when ctx was cancelled in Wait")
|
||||
}
|
||||
|
||||
func TestWalkerDispatcher_NilGuardsReturnError(t *testing.T) {
|
||||
d := &WalkerDispatcher{Client: &walkerStubClient{}}
|
||||
require.Error(t, d.Delete(context.Background(), nil, &bootstrap.Entry{Path: "obj"}))
|
||||
|
||||
@@ -1,276 +0,0 @@
|
||||
package dailyrun
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/s3_lifecycle_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/engine"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/reader"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/router"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// readerEventAlias keeps the test free of the reader import collision
|
||||
// in the recovery test file when we need a typed nil channel.
|
||||
type readerEventAlias = reader.Event
|
||||
|
||||
// TestWalkerDue covers the throttle decision matrix in isolation.
|
||||
func TestWalkerDue(t *testing.T) {
|
||||
runNow := time.Unix(1_700_000_000, 0).UTC()
|
||||
cases := []struct {
|
||||
name string
|
||||
lastWalkedNs int64
|
||||
interval time.Duration
|
||||
want bool
|
||||
}{
|
||||
// interval=0 keeps the prior "fire every pass" semantics — the
|
||||
// in-repo integration tests and the s3tests fast driver rely on
|
||||
// this so the rule-change-then-walk behavior surfaces within a
|
||||
// single test runtime. Within-pass double-fire suppression
|
||||
// lives in runShard's walkedThisPass local; walkerDue answers
|
||||
// the persisted-state question only.
|
||||
{"interval zero always due", runNow.UnixNano(), 0, true},
|
||||
// LastWalkedNs=0 marks "never walked steady-state" — the post-
|
||||
// upgrade cold-start case for cursor files that predate the
|
||||
// LastWalkedNs field. Fire so the throttle anchor gets seeded.
|
||||
{"never walked is due", 0, time.Hour, true},
|
||||
// Throttle on: interval elapsed → due.
|
||||
{"interval elapsed", runNow.Add(-2 * time.Hour).UnixNano(), time.Hour, true},
|
||||
{"interval exactly elapsed", runNow.Add(-time.Hour).UnixNano(), time.Hour, true},
|
||||
// Throttle on: not yet → skip.
|
||||
{"interval not yet elapsed", runNow.Add(-30 * time.Minute).UnixNano(), time.Hour, false},
|
||||
// Future LastWalkedNs (clock skew or replay of an older runNow
|
||||
// against a newer cursor) must not panic and must not fire —
|
||||
// treat as "throttled" because the cursor claims a future walk.
|
||||
{"future lastWalked", runNow.Add(time.Hour).UnixNano(), time.Hour, false},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
assert.Equal(t, tc.want, walkerDue(tc.lastWalkedNs, runNow, tc.interval))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestRunShard_WalkerThrottle confirms two back-to-back runShard
|
||||
// invocations only fire the steady-state walker once when the second
|
||||
// pass starts inside the WalkerInterval window. The interval-zero
|
||||
// control case keeps firing on every pass — same shape, different
|
||||
// expectation — pinning the prior behavior so a default-zero config
|
||||
// (tests, in-repo integration) doesn't regress.
|
||||
func TestRunShard_WalkerThrottle(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
interval time.Duration
|
||||
secondPassAfter time.Duration
|
||||
wantTotalCalls int
|
||||
wantSecondAdvNs bool // did LastWalkedNs change between pass 1 and pass 2?
|
||||
}{
|
||||
{"interval=0 fires every pass", 0, 30 * time.Second, 2, true},
|
||||
{"throttled: second pass within interval", time.Hour, 30 * time.Second, 1, false},
|
||||
{"throttled: second pass past interval", time.Hour, 2 * time.Hour, 2, true},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
snap := snapshotWithRule(t, 30) // replay-eligible only; steady-state walker would normally skip
|
||||
// Force a walker-only partition so the steady-state branch
|
||||
// has something to walk: set retentionWindow=0 in cfg, which
|
||||
// makes promoted non-empty and walkView non-empty.
|
||||
p := newMemPersister()
|
||||
calls := 0
|
||||
cfg := Config{
|
||||
Persister: p,
|
||||
Walker: func(_ context.Context, _ *engine.Snapshot, _ int) error {
|
||||
calls++
|
||||
return nil
|
||||
},
|
||||
RetentionWindow: -1, // negative sentinel: falls back to maxTTL — leaves walkView empty
|
||||
WalkerInterval: tc.interval,
|
||||
}
|
||||
// Pre-seed cursor matching snap's hashes so cold-start /
|
||||
// recovery branches don't fire and we measure ONLY the
|
||||
// steady-state walker.
|
||||
rsh := engine.ReplayContentHash(snap)
|
||||
promoted := engine.PromotedHash(snap, engine.MaxEffectiveTTL(snap))
|
||||
runNow := time.Unix(1_700_000_000, 0).UTC()
|
||||
require.NoError(t, p.Save(context.Background(), 0, Cursor{
|
||||
TsNs: runNow.UnixNano(),
|
||||
RuleSetHash: rsh,
|
||||
PromotedHash: promoted,
|
||||
}))
|
||||
|
||||
// With the snapshot's only rule being replay-eligible, the
|
||||
// steady-state walkView is empty and the walker won't fire
|
||||
// regardless of throttle. Use a snapshot that has BOTH a
|
||||
// replay rule AND a scan-only walker rule by forcing
|
||||
// retentionWindow to a very small value via cfg.
|
||||
cfg.RetentionWindow = time.Nanosecond
|
||||
// Recompute promoted with the test retention so persisted
|
||||
// hashes match what runShard sees on each pass.
|
||||
snapPromoted := engine.PromotedHash(snap, time.Nanosecond)
|
||||
require.NoError(t, p.Save(context.Background(), 0, Cursor{
|
||||
TsNs: runNow.UnixNano(),
|
||||
RuleSetHash: rsh,
|
||||
PromotedHash: snapPromoted,
|
||||
}))
|
||||
|
||||
// runShard reaches drainShardEvents after the steady-state
|
||||
// walker fires (replay-eligible rules present). A nil events
|
||||
// channel would block forever; a closed one returns
|
||||
// immediately so drain exits cleanly and the cursor save
|
||||
// still records LastWalkedNs.
|
||||
closedEvents := make(chan *readerEventAlias)
|
||||
close(closedEvents)
|
||||
|
||||
// Pass 1.
|
||||
require.NoError(t, runShard(context.Background(), cfg, snap, runNow, 0, closedEvents))
|
||||
afterPass1, _, _ := p.Load(context.Background(), 0)
|
||||
require.Equal(t, 1, calls, "pass 1 must fire the walker (cold-start anchor)")
|
||||
require.Equal(t, runNow.UnixNano(), afterPass1.LastWalkedNs)
|
||||
|
||||
// Pass 2.
|
||||
runNow2 := runNow.Add(tc.secondPassAfter)
|
||||
closedEvents2 := make(chan *readerEventAlias)
|
||||
close(closedEvents2)
|
||||
require.NoError(t, runShard(context.Background(), cfg, snap, runNow2, 0, closedEvents2))
|
||||
afterPass2, _, _ := p.Load(context.Background(), 0)
|
||||
assert.Equal(t, tc.wantTotalCalls, calls, "walker calls after 2 passes")
|
||||
if tc.wantSecondAdvNs {
|
||||
assert.Equal(t, runNow2.UnixNano(), afterPass2.LastWalkedNs, "throttle allowed the second walk")
|
||||
} else {
|
||||
assert.Equal(t, runNow.UnixNano(), afterPass2.LastWalkedNs, "throttle suppressed the second walk; anchor unchanged")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestValidate_RejectsNegativeWalkerInterval pins the loud-failure
|
||||
// contract for an embedder or test that constructs dailyrun.Config
|
||||
// directly with a negative WalkerInterval. The admin-config parser
|
||||
// clamps negative input to zero (worker/tasks/s3_lifecycle/config.go),
|
||||
// but a caller bypassing that parser would otherwise get the silent
|
||||
// fall-through-to-walk-every-pass behavior the throttle is trying to
|
||||
// prevent.
|
||||
func TestValidate_RejectsNegativeWalkerInterval(t *testing.T) {
|
||||
// validate only checks for nil fields, not behavior — type-assert
|
||||
// each interface to its zero value via a stub. The stubs never run.
|
||||
cfg := validatableConfig()
|
||||
cfg.WalkerInterval = -time.Hour
|
||||
err := validate(cfg)
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "WalkerInterval")
|
||||
// And the zero sentinel still passes.
|
||||
cfg.WalkerInterval = 0
|
||||
require.NoError(t, validate(cfg))
|
||||
}
|
||||
|
||||
// validatableConfig builds a minimal dailyrun.Config that passes the
|
||||
// nil checks in validate() so individual fields can be poked. The
|
||||
// stubs intentionally don't implement any meaningful behavior — they
|
||||
// only need to be non-nil interface values.
|
||||
func validatableConfig() Config {
|
||||
return Config{
|
||||
Engine: engine.New(),
|
||||
FilerClient: stubFilerClient{},
|
||||
Client: stubLifecycleClient{},
|
||||
Persister: newMemPersister(),
|
||||
Lister: stubSiblingLister{},
|
||||
BucketsPath: "/buckets",
|
||||
}
|
||||
}
|
||||
|
||||
type stubFilerClient struct{ filer_pb.SeaweedFilerClient }
|
||||
type stubLifecycleClient struct{}
|
||||
|
||||
func (stubLifecycleClient) LifecycleDelete(_ context.Context, _ *s3_lifecycle_pb.LifecycleDeleteRequest) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
type stubSiblingLister struct{}
|
||||
|
||||
func (stubSiblingLister) Survivors(_ context.Context, _, _ string) (router.Survivors, error) {
|
||||
return router.Survivors{}, nil
|
||||
}
|
||||
func (stubSiblingLister) LookupVersion(_ context.Context, _, _, _ string) (*filer_pb.Entry, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (stubSiblingLister) ListVersions(_ context.Context, _, _ string) ([]*filer_pb.Entry, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (stubSiblingLister) LookupNullVersion(_ context.Context, _, _ string) (*filer_pb.Entry, bool, error) {
|
||||
return nil, false, nil
|
||||
}
|
||||
|
||||
// TestRunShard_ColdStartDoesNotDoubleWalk pins the within-pass guard
|
||||
// in runShard's walkedThisPass local. Before the guard, a cold-start
|
||||
// pass with WalkerInterval=0 fired the walker twice in one pass:
|
||||
// once via the mustWalkColdStart branch (with RecoveryView) and again
|
||||
// immediately via the steady-state branch (with the per-shard walk
|
||||
// view, which is a subset of RecoveryView). The second walk added no
|
||||
// coverage and burned a full bucket scan. Guard against regression.
|
||||
func TestRunShard_ColdStartDoesNotDoubleWalk(t *testing.T) {
|
||||
snap := snapshotWithRule(t, 30)
|
||||
p := newMemPersister()
|
||||
// No persisted cursor → mustWalkColdStart=true. WalkerInterval=0
|
||||
// would, before the fix, allow the steady-state branch to fire
|
||||
// again with no time elapsed.
|
||||
calls := 0
|
||||
cfg := Config{
|
||||
Persister: p,
|
||||
Walker: func(_ context.Context, _ *engine.Snapshot, _ int) error {
|
||||
calls++
|
||||
return nil
|
||||
},
|
||||
WalkerInterval: 0,
|
||||
}
|
||||
runNow := time.Unix(1_700_000_000, 0).UTC()
|
||||
|
||||
closedEvents := make(chan *readerEventAlias)
|
||||
close(closedEvents)
|
||||
require.NoError(t, runShard(context.Background(), cfg, snap, runNow, 0, closedEvents))
|
||||
|
||||
assert.Equal(t, 1, calls, "cold-start walker must fire exactly once per pass even with interval=0")
|
||||
}
|
||||
|
||||
// TestRunShard_RecoveryWalkerSetsLastWalkedAnchor pins that the
|
||||
// unconditional recovery-branch walker fire still updates the
|
||||
// LastWalkedNs anchor so the NEXT pass's throttle starts counting
|
||||
// from this walk rather than re-firing immediately.
|
||||
func TestRunShard_RecoveryWalkerSetsLastWalkedAnchor(t *testing.T) {
|
||||
snap := snapshotWithRule(t, 30)
|
||||
p := newMemPersister()
|
||||
var stale [32]byte
|
||||
for i := range stale {
|
||||
stale[i] = 0xAA
|
||||
}
|
||||
require.NoError(t, p.Save(context.Background(), 5, Cursor{
|
||||
TsNs: 1234,
|
||||
RuleSetHash: stale,
|
||||
LastWalkedNs: 0, // never walked anchor
|
||||
}))
|
||||
|
||||
calls := 0
|
||||
cfg := Config{
|
||||
Persister: p,
|
||||
Walker: func(_ context.Context, _ *engine.Snapshot, _ int) error {
|
||||
calls++
|
||||
return nil
|
||||
},
|
||||
WalkerInterval: time.Hour,
|
||||
}
|
||||
runNow := time.Unix(1_700_000_000, 0).UTC()
|
||||
require.NoError(t, runShard(context.Background(), cfg, snap, runNow, 5, nil))
|
||||
|
||||
require.Equal(t, 1, calls, "recovery branch fires the walker unconditionally")
|
||||
got, ok, _ := p.Load(context.Background(), 5)
|
||||
require.True(t, ok)
|
||||
assert.Equal(t, runNow.UnixNano(), got.LastWalkedNs,
|
||||
"recovery walk must update LastWalkedNs so the steady-state pass after it can throttle")
|
||||
}
|
||||
|
||||
// Compile-time check that the documented sentinel passes the type system.
|
||||
var _ = s3lifecycle.ShardCount
|
||||
@@ -71,7 +71,7 @@ func TestRunShard_WalkerInvokedOnRecoveryBranch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
runNow := time.Unix(1_700_000_000, 0).UTC()
|
||||
require.NoError(t, runShard(context.Background(), cfg, snap, runNow, 3, nil))
|
||||
require.NoError(t, runShard(context.Background(), cfg, snap, runNow, 3))
|
||||
|
||||
assert.Equal(t, 1, calls, "walker must fire exactly once on recovery")
|
||||
require.NotNil(t, gotView, "walker received the RecoveryView")
|
||||
@@ -99,7 +99,7 @@ func TestRunShard_NilWalkerOnRecoveryIsNoop(t *testing.T) {
|
||||
|
||||
cfg := Config{Persister: p} // Walker nil
|
||||
runNow := time.Unix(1_700_000_000, 0).UTC()
|
||||
require.NoError(t, runShard(context.Background(), cfg, snap, runNow, 0, nil))
|
||||
require.NoError(t, runShard(context.Background(), cfg, snap, runNow, 0))
|
||||
|
||||
got, ok, err := p.Load(context.Background(), 0)
|
||||
require.NoError(t, err)
|
||||
@@ -126,7 +126,7 @@ func TestRunShard_WalkerErrorPropagates(t *testing.T) {
|
||||
},
|
||||
}
|
||||
runNow := time.Unix(1_700_000_000, 0).UTC()
|
||||
err := runShard(context.Background(), cfg, snap, runNow, 7, nil)
|
||||
err := runShard(context.Background(), cfg, snap, runNow, 7)
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "walker boom")
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//go:build !s3tests
|
||||
|
||||
package dispatcher
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
defaultDispatchTick = 5 * time.Second
|
||||
defaultCheckpointTick = 30 * time.Second
|
||||
)
|
||||
@@ -0,0 +1,14 @@
|
||||
//go:build s3tests
|
||||
|
||||
package dispatcher
|
||||
|
||||
import "time"
|
||||
|
||||
// Under the s3tests build tag the engine treats one "Day" as 10 seconds
|
||||
// (util.LifeCycleInterval), so the dispatcher must run far below that to
|
||||
// notice a freshly-due action inside the upstream s3-tests 30s polling
|
||||
// window. Production timings live in dispatch_ticks_default.go.
|
||||
const (
|
||||
defaultDispatchTick = 500 * time.Millisecond
|
||||
defaultCheckpointTick = 2 * time.Second
|
||||
)
|
||||
@@ -0,0 +1,224 @@
|
||||
package dispatcher
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/s3_lifecycle_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/reader"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/router"
|
||||
"github.com/seaweedfs/seaweedfs/weed/stats"
|
||||
)
|
||||
|
||||
// LifecycleClient abstracts the LifecycleDelete RPC so the dispatcher is
|
||||
// testable without a live S3 server.
|
||||
type LifecycleClient interface {
|
||||
LifecycleDelete(ctx context.Context, req *s3_lifecycle_pb.LifecycleDeleteRequest) (*s3_lifecycle_pb.LifecycleDeleteResponse, error)
|
||||
}
|
||||
|
||||
// Dispatcher consumes due Matches, calls LifecycleDelete, and routes the
|
||||
// outcome back to the per-shard cursor.
|
||||
//
|
||||
// State machine for one Match:
|
||||
// DONE / NOOP_RESOLVED / SKIPPED_OBJECT_LOCK -> Cursor.Advance
|
||||
// RETRY_LATER (within budget) -> back into the schedule with backoff
|
||||
// RETRY_LATER (budget exhausted) / BLOCKED -> Cursor.Freeze in-memory
|
||||
// FATAL_EVENT_ERROR / unknown -> treat as BLOCKED
|
||||
//
|
||||
// A frozen cursor doesn't advance, so the durable cursor is the durable
|
||||
// "stuck" state on its own: a worker restart re-encounters the poison
|
||||
// event at MinTsNs and re-freezes after the same retry cycle. No separate
|
||||
// blocker store is needed.
|
||||
type Dispatcher struct {
|
||||
ShardID int
|
||||
Client LifecycleClient
|
||||
Cursor *reader.Cursor
|
||||
Schedule *router.Schedule
|
||||
|
||||
// RetryBudget caps RETRY_LATER attempts before escalating to BLOCKED.
|
||||
// Zero defaults to defaultRetryBudget.
|
||||
RetryBudget int
|
||||
|
||||
// RetryBackoff is the wait between RETRY_LATER re-schedules. Zero
|
||||
// defaults to defaultRetryBackoff.
|
||||
RetryBackoff time.Duration
|
||||
|
||||
// retries[Match.Key+ObjectKey] = attempts so far. In-memory only:
|
||||
// worker restart resets the budget, which is fine because the cursor
|
||||
// is durable and the same poison event will land us here again.
|
||||
retries map[retryKey]int
|
||||
}
|
||||
|
||||
const (
|
||||
defaultRetryBudget = 5
|
||||
defaultRetryBackoff = 30 * time.Second
|
||||
)
|
||||
|
||||
type retryKey struct {
|
||||
bucket string
|
||||
ruleHash [8]byte
|
||||
kind s3lifecycle.ActionKind
|
||||
objectKey string
|
||||
versionID string
|
||||
}
|
||||
|
||||
func keyOf(m router.Match) retryKey {
|
||||
return retryKey{
|
||||
bucket: m.Key.Bucket,
|
||||
ruleHash: m.Key.RuleHash,
|
||||
kind: m.Key.ActionKind,
|
||||
objectKey: m.ObjectKey,
|
||||
versionID: m.VersionID,
|
||||
}
|
||||
}
|
||||
|
||||
func (d *Dispatcher) budget() int {
|
||||
if d.RetryBudget > 0 {
|
||||
return d.RetryBudget
|
||||
}
|
||||
return defaultRetryBudget
|
||||
}
|
||||
|
||||
func (d *Dispatcher) backoff() time.Duration {
|
||||
if d.RetryBackoff > 0 {
|
||||
return d.RetryBackoff
|
||||
}
|
||||
return defaultRetryBackoff
|
||||
}
|
||||
|
||||
// Tick drains the schedule for due Matches and dispatches each. Returns the
|
||||
// count of Matches processed. Safe to call repeatedly.
|
||||
func (d *Dispatcher) Tick(ctx context.Context, now time.Time) int {
|
||||
if d.retries == nil {
|
||||
d.retries = map[retryKey]int{}
|
||||
}
|
||||
due := d.Schedule.Drain(now)
|
||||
for i, m := range due {
|
||||
if err := ctx.Err(); err != nil {
|
||||
// Caller is shutting down. Re-queue every remaining drained
|
||||
// Match (current and any not yet visited) so they're not
|
||||
// lost across the worker restart — the schedule already
|
||||
// popped them all out, so the dispatcher owns putting them
|
||||
// back.
|
||||
for _, rem := range due[i:] {
|
||||
d.Schedule.Add(rem)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
d.dispatchOne(ctx, m, now)
|
||||
}
|
||||
return len(due)
|
||||
}
|
||||
|
||||
func (d *Dispatcher) dispatchOne(ctx context.Context, m router.Match, now time.Time) {
|
||||
// A frozen cursor means a prior BLOCKED is still active for this
|
||||
// (shard, ActionKey); skip until operator clears it.
|
||||
if d.Cursor.IsFrozen(m.Key) {
|
||||
return
|
||||
}
|
||||
|
||||
ruleHash := m.Key.RuleHash
|
||||
req := &s3_lifecycle_pb.LifecycleDeleteRequest{
|
||||
Bucket: m.Bucket,
|
||||
ObjectPath: m.ObjectKey,
|
||||
VersionId: m.VersionID,
|
||||
RuleHash: ruleHash[:],
|
||||
ActionKind: toProtoActionKind(m.Key.ActionKind),
|
||||
ExpectedIdentity: toProtoIdentity(m.Identity),
|
||||
}
|
||||
resp, err := d.Client.LifecycleDelete(ctx, req)
|
||||
if err != nil {
|
||||
// Context cancellation is shutdown, not a transport failure: put
|
||||
// the Match back on the schedule untouched so the next worker
|
||||
// run picks it up at its original DueTime, with no retry-budget
|
||||
// burn.
|
||||
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
|
||||
d.Schedule.Add(m)
|
||||
return
|
||||
}
|
||||
// Transport error: classify as RETRY_LATER. The remote handler
|
||||
// already classifies its own filer-side errors; the only path
|
||||
// that hits this branch is the RPC itself failing.
|
||||
stats.S3LifecycleDispatchCounter.WithLabelValues(m.Bucket, m.Key.ActionKind.String(), "RPC_ERROR").Inc()
|
||||
d.handleRetryLater(ctx, m, fmt.Sprintf("RPC: %v", err), now)
|
||||
return
|
||||
}
|
||||
stats.S3LifecycleDispatchCounter.WithLabelValues(m.Bucket, m.Key.ActionKind.String(), resp.Outcome.String()).Inc()
|
||||
switch resp.Outcome {
|
||||
case s3_lifecycle_pb.LifecycleDeleteOutcome_DONE,
|
||||
s3_lifecycle_pb.LifecycleDeleteOutcome_NOOP_RESOLVED,
|
||||
s3_lifecycle_pb.LifecycleDeleteOutcome_SKIPPED_OBJECT_LOCK:
|
||||
d.advance(m)
|
||||
case s3_lifecycle_pb.LifecycleDeleteOutcome_RETRY_LATER:
|
||||
d.handleRetryLater(ctx, m, resp.Reason, now)
|
||||
case s3_lifecycle_pb.LifecycleDeleteOutcome_BLOCKED:
|
||||
d.handleBlocked(ctx, m, resp.Reason)
|
||||
default:
|
||||
d.handleBlocked(ctx, m, fmt.Sprintf("unknown outcome %v: %s", resp.Outcome, resp.Reason))
|
||||
}
|
||||
}
|
||||
|
||||
// observeScheduleDepth publishes the current schedule depth gauge for
|
||||
// this shard. Called from Pipeline on each tick.
|
||||
func (d *Dispatcher) observeScheduleDepth() {
|
||||
stats.S3LifecycleScheduleDepthGauge.WithLabelValues(strconv.Itoa(d.ShardID)).Set(float64(d.Schedule.Len()))
|
||||
}
|
||||
|
||||
func (d *Dispatcher) advance(m router.Match) {
|
||||
delete(d.retries, keyOf(m))
|
||||
d.Cursor.Advance(m.Key, m.EventTs.UnixNano())
|
||||
}
|
||||
|
||||
func (d *Dispatcher) handleRetryLater(ctx context.Context, m router.Match, reason string, now time.Time) {
|
||||
rk := keyOf(m)
|
||||
d.retries[rk]++
|
||||
if d.retries[rk] > d.budget() {
|
||||
d.handleBlocked(ctx, m, fmt.Sprintf("retry budget exhausted: %s", reason))
|
||||
return
|
||||
}
|
||||
// Re-schedule with backoff; same Match, new DueTime.
|
||||
m.DueTime = now.Add(d.backoff())
|
||||
d.Schedule.Add(m)
|
||||
}
|
||||
|
||||
func (d *Dispatcher) handleBlocked(ctx context.Context, m router.Match, reason string) {
|
||||
delete(d.retries, keyOf(m))
|
||||
glog.Warningf("lifecycle: cursor frozen shard=%d key=%+v eventTs=%s reason=%s",
|
||||
d.ShardID, m.Key, m.EventTs.UTC().Format(time.RFC3339Nano), reason)
|
||||
d.Cursor.Freeze(m.Key, m.EventTs.UnixNano())
|
||||
}
|
||||
|
||||
func toProtoActionKind(k s3lifecycle.ActionKind) s3_lifecycle_pb.ActionKind {
|
||||
switch k {
|
||||
case s3lifecycle.ActionKindExpirationDays:
|
||||
return s3_lifecycle_pb.ActionKind_EXPIRATION_DAYS
|
||||
case s3lifecycle.ActionKindExpirationDate:
|
||||
return s3_lifecycle_pb.ActionKind_EXPIRATION_DATE
|
||||
case s3lifecycle.ActionKindNoncurrentDays:
|
||||
return s3_lifecycle_pb.ActionKind_NONCURRENT_DAYS
|
||||
case s3lifecycle.ActionKindNewerNoncurrent:
|
||||
return s3_lifecycle_pb.ActionKind_NEWER_NONCURRENT
|
||||
case s3lifecycle.ActionKindAbortMPU:
|
||||
return s3_lifecycle_pb.ActionKind_ABORT_MPU
|
||||
case s3lifecycle.ActionKindExpiredDeleteMarker:
|
||||
return s3_lifecycle_pb.ActionKind_EXPIRED_DELETE_MARKER
|
||||
}
|
||||
return s3_lifecycle_pb.ActionKind_ACTION_KIND_UNSPECIFIED
|
||||
}
|
||||
|
||||
func toProtoIdentity(id *router.EntryIdentity) *s3_lifecycle_pb.EntryIdentity {
|
||||
if id == nil {
|
||||
return nil
|
||||
}
|
||||
return &s3_lifecycle_pb.EntryIdentity{
|
||||
MtimeNs: id.MtimeNs,
|
||||
Size: id.Size,
|
||||
HeadFid: id.HeadFid,
|
||||
ExtendedHash: id.ExtendedHash,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package dispatcher
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/router"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// Direct coverage for dispatcher pure helpers (keyOf, budget, backoff)
|
||||
// and the retryKey identity that drives the retry-budget map. The
|
||||
// existing dispatcher tests exercise these only through Tick; pinning
|
||||
// each one separately makes a regression in the helper itself fail at
|
||||
// the helper level.
|
||||
|
||||
func TestKeyOf_DerivesIdentityFromMatch(t *testing.T) {
|
||||
hash := [8]byte{0xde, 0xad, 0xbe, 0xef, 1, 2, 3, 4}
|
||||
m := router.Match{
|
||||
Key: s3lifecycle.ActionKey{
|
||||
Bucket: "bk",
|
||||
RuleHash: hash,
|
||||
ActionKind: s3lifecycle.ActionKindExpirationDays,
|
||||
},
|
||||
ObjectKey: "obj.txt",
|
||||
VersionID: "v_abc",
|
||||
}
|
||||
got := keyOf(m)
|
||||
assert.Equal(t, "bk", got.bucket)
|
||||
assert.Equal(t, hash, got.ruleHash)
|
||||
assert.Equal(t, s3lifecycle.ActionKindExpirationDays, got.kind)
|
||||
assert.Equal(t, "obj.txt", got.objectKey)
|
||||
assert.Equal(t, "v_abc", got.versionID)
|
||||
}
|
||||
|
||||
func TestKeyOf_EqualMatchesProduceEqualKeys(t *testing.T) {
|
||||
// retryKey is used as a map key in the retry budget; equality must
|
||||
// hold between two Match values with identical fields so the second
|
||||
// dispatch finds the first's retry counter.
|
||||
hash := [8]byte{0xde, 0xad, 0xbe, 0xef}
|
||||
m1 := router.Match{
|
||||
Key: s3lifecycle.ActionKey{Bucket: "bk", RuleHash: hash, ActionKind: s3lifecycle.ActionKindExpirationDays},
|
||||
ObjectKey: "obj",
|
||||
VersionID: "v_x",
|
||||
}
|
||||
m2 := m1
|
||||
assert.Equal(t, keyOf(m1), keyOf(m2))
|
||||
}
|
||||
|
||||
func TestKeyOf_DistinctVersionIDsProduceDistinctKeys(t *testing.T) {
|
||||
// Two versions of the same logical object must NOT share a retry
|
||||
// budget; otherwise a noisy version could starve a healthy one.
|
||||
base := router.Match{
|
||||
Key: s3lifecycle.ActionKey{Bucket: "bk", ActionKind: s3lifecycle.ActionKindNoncurrentDays},
|
||||
ObjectKey: "obj",
|
||||
VersionID: "v_a",
|
||||
}
|
||||
other := base
|
||||
other.VersionID = "v_b"
|
||||
assert.NotEqual(t, keyOf(base), keyOf(other))
|
||||
}
|
||||
|
||||
func TestKeyOf_DistinctActionKindsProduceDistinctKeys(t *testing.T) {
|
||||
// The same (bucket, object, version) hit by two different action
|
||||
// kinds must each have their own retry budget.
|
||||
base := router.Match{
|
||||
Key: s3lifecycle.ActionKey{Bucket: "bk", ActionKind: s3lifecycle.ActionKindExpirationDays},
|
||||
ObjectKey: "obj",
|
||||
}
|
||||
other := base
|
||||
other.Key.ActionKind = s3lifecycle.ActionKindNoncurrentDays
|
||||
assert.NotEqual(t, keyOf(base), keyOf(other))
|
||||
}
|
||||
|
||||
func TestDispatcherBudget_ReturnsConfiguredValueWhenSet(t *testing.T) {
|
||||
d := &Dispatcher{RetryBudget: 9}
|
||||
assert.Equal(t, 9, d.budget())
|
||||
}
|
||||
|
||||
func TestDispatcherBudget_FallsBackToDefaultWhenZero(t *testing.T) {
|
||||
// Operators leaving the budget at zero opt into the documented
|
||||
// default. A regression that returns 0 would NOOP every retry.
|
||||
d := &Dispatcher{}
|
||||
assert.Equal(t, defaultRetryBudget, d.budget())
|
||||
}
|
||||
|
||||
func TestDispatcherBudget_NegativeFallsBackToDefault(t *testing.T) {
|
||||
// budget() guards on > 0, so a negative value falls back rather
|
||||
// than producing nonsense. Pin the contract so a refactor that
|
||||
// flips the comparison is caught.
|
||||
d := &Dispatcher{RetryBudget: -1}
|
||||
assert.Equal(t, defaultRetryBudget, d.budget())
|
||||
}
|
||||
|
||||
func TestDispatcherBackoff_ReturnsConfiguredValueWhenSet(t *testing.T) {
|
||||
d := &Dispatcher{RetryBackoff: 5 * time.Second}
|
||||
assert.Equal(t, 5*time.Second, d.backoff())
|
||||
}
|
||||
|
||||
func TestDispatcherBackoff_FallsBackToDefaultWhenZero(t *testing.T) {
|
||||
d := &Dispatcher{}
|
||||
assert.Equal(t, defaultRetryBackoff, d.backoff())
|
||||
}
|
||||
|
||||
func TestDispatcherBackoff_NegativeFallsBackToDefault(t *testing.T) {
|
||||
d := &Dispatcher{RetryBackoff: -time.Second}
|
||||
assert.Equal(t, defaultRetryBackoff, d.backoff())
|
||||
}
|
||||
@@ -0,0 +1,318 @@
|
||||
package dispatcher
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
dto "github.com/prometheus/client_model/go"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/s3_lifecycle_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/reader"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/router"
|
||||
"github.com/seaweedfs/seaweedfs/weed/stats"
|
||||
)
|
||||
|
||||
type fakeClient struct {
|
||||
calls int
|
||||
respond func(call int) (*s3_lifecycle_pb.LifecycleDeleteResponse, error)
|
||||
}
|
||||
|
||||
func (f *fakeClient) LifecycleDelete(ctx context.Context, req *s3_lifecycle_pb.LifecycleDeleteRequest) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
f.calls++
|
||||
return f.respond(f.calls)
|
||||
}
|
||||
|
||||
func mkMatch(eventTs time.Time, due time.Time, key string) router.Match {
|
||||
return router.Match{
|
||||
Key: s3lifecycle.ActionKey{Bucket: "bk", ActionKind: s3lifecycle.ActionKindExpirationDays},
|
||||
EventTs: eventTs,
|
||||
DueTime: due,
|
||||
Bucket: "bk",
|
||||
ObjectKey: key,
|
||||
}
|
||||
}
|
||||
|
||||
func newDispatcher(client LifecycleClient) (*Dispatcher, *router.Schedule) {
|
||||
sched := router.NewSchedule()
|
||||
d := &Dispatcher{
|
||||
ShardID: 0,
|
||||
Client: client,
|
||||
Cursor: reader.NewCursor(),
|
||||
Schedule: sched,
|
||||
RetryBudget: 3,
|
||||
RetryBackoff: time.Millisecond,
|
||||
}
|
||||
return d, sched
|
||||
}
|
||||
|
||||
func TestDispatchDoneAdvancesCursor(t *testing.T) {
|
||||
client := &fakeClient{
|
||||
respond: func(int) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{
|
||||
Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_DONE,
|
||||
}, nil
|
||||
},
|
||||
}
|
||||
d, sched := newDispatcher(client)
|
||||
t0 := time.Now()
|
||||
m := mkMatch(t0, t0, "obj")
|
||||
sched.Add(m)
|
||||
|
||||
got := d.Tick(context.Background(), t0)
|
||||
if got != 1 {
|
||||
t.Fatalf("Tick processed=%d, want 1", got)
|
||||
}
|
||||
if d.Cursor.Get(m.Key) != t0.UnixNano() {
|
||||
t.Fatalf("cursor not advanced: %d", d.Cursor.Get(m.Key))
|
||||
}
|
||||
if d.Cursor.IsFrozen(m.Key) {
|
||||
t.Fatal("cursor should not be frozen")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDispatchNoopAdvancesCursor(t *testing.T) {
|
||||
client := &fakeClient{
|
||||
respond: func(int) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{
|
||||
Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_NOOP_RESOLVED,
|
||||
Reason: "STALE_IDENTITY",
|
||||
}, nil
|
||||
},
|
||||
}
|
||||
d, sched := newDispatcher(client)
|
||||
t0 := time.Now()
|
||||
m := mkMatch(t0, t0, "obj")
|
||||
sched.Add(m)
|
||||
d.Tick(context.Background(), t0)
|
||||
if d.Cursor.Get(m.Key) != t0.UnixNano() {
|
||||
t.Fatal("NOOP_RESOLVED should advance cursor")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDispatchRetryLaterReSchedules(t *testing.T) {
|
||||
client := &fakeClient{
|
||||
respond: func(int) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{
|
||||
Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_RETRY_LATER,
|
||||
Reason: "TRANSPORT_ERROR",
|
||||
}, nil
|
||||
},
|
||||
}
|
||||
d, sched := newDispatcher(client)
|
||||
t0 := time.Now()
|
||||
m := mkMatch(t0, t0, "obj")
|
||||
sched.Add(m)
|
||||
|
||||
// First tick: dispatched, retry-budget = 1, re-scheduled.
|
||||
d.Tick(context.Background(), t0)
|
||||
if sched.Len() != 1 {
|
||||
t.Fatalf("expected re-schedule on RETRY_LATER, sched.Len=%d", sched.Len())
|
||||
}
|
||||
if d.Cursor.Get(m.Key) != 0 {
|
||||
t.Fatal("cursor must not advance on RETRY_LATER")
|
||||
}
|
||||
if d.Cursor.IsFrozen(m.Key) {
|
||||
t.Fatal("cursor must not freeze within budget")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDispatchRetryBudgetEscalatesToBlocked(t *testing.T) {
|
||||
client := &fakeClient{
|
||||
respond: func(int) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{
|
||||
Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_RETRY_LATER,
|
||||
Reason: "stuck",
|
||||
}, nil
|
||||
},
|
||||
}
|
||||
d, sched := newDispatcher(client)
|
||||
d.RetryBudget = 2
|
||||
t0 := time.Now()
|
||||
m := mkMatch(t0, t0, "obj")
|
||||
sched.Add(m)
|
||||
|
||||
// Tick repeatedly; each pushes the re-scheduled entry forward by backoff,
|
||||
// so we advance "now" past each backoff to drain it.
|
||||
now := t0
|
||||
for i := 0; i < 5 && sched.Len() > 0; i++ {
|
||||
now = now.Add(d.RetryBackoff + time.Millisecond)
|
||||
d.Tick(context.Background(), now)
|
||||
}
|
||||
if !d.Cursor.IsFrozen(m.Key) {
|
||||
t.Fatal("expected freeze after budget exhausted")
|
||||
}
|
||||
if d.Cursor.Get(m.Key) != t0.UnixNano() {
|
||||
t.Fatal("frozen cursor should be pinned at event ts")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDispatchBlockedFreezesCursor(t *testing.T) {
|
||||
client := &fakeClient{
|
||||
respond: func(int) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{
|
||||
Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_BLOCKED,
|
||||
Reason: "FATAL_EVENT_ERROR: empty bucket",
|
||||
}, nil
|
||||
},
|
||||
}
|
||||
d, sched := newDispatcher(client)
|
||||
t0 := time.Now()
|
||||
m := mkMatch(t0, t0, "obj")
|
||||
sched.Add(m)
|
||||
d.Tick(context.Background(), t0)
|
||||
if !d.Cursor.IsFrozen(m.Key) {
|
||||
t.Fatal("BLOCKED must freeze cursor")
|
||||
}
|
||||
if d.Cursor.Get(m.Key) != t0.UnixNano() {
|
||||
t.Fatal("frozen cursor should be pinned at event ts")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDispatchContextCancelDoesNotBurnBudget(t *testing.T) {
|
||||
// Worker shutdown causes the in-flight RPC to return context.Canceled.
|
||||
// The Match should go back on the schedule untouched; no retry-budget
|
||||
// burn means a quick restart can't escalate it to BLOCKED.
|
||||
client := &fakeClient{
|
||||
respond: func(int) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
return nil, context.Canceled
|
||||
},
|
||||
}
|
||||
d, sched := newDispatcher(client)
|
||||
d.RetryBudget = 1
|
||||
t0 := time.Now()
|
||||
m := mkMatch(t0, t0, "obj")
|
||||
sched.Add(m)
|
||||
|
||||
d.Tick(context.Background(), t0)
|
||||
if sched.Len() != 1 {
|
||||
t.Fatalf("expected re-queue on ctx cancel, sched.Len=%d", sched.Len())
|
||||
}
|
||||
if d.Cursor.IsFrozen(m.Key) {
|
||||
t.Fatal("ctx cancel must not freeze cursor")
|
||||
}
|
||||
if got := d.retries[keyOf(m)]; got != 0 {
|
||||
t.Fatalf("ctx cancel must not burn retry budget, retries=%d", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDispatchTransportErrorRetries(t *testing.T) {
|
||||
// gRPC error: classified as RETRY_LATER. After the budget the cursor freezes.
|
||||
client := &fakeClient{
|
||||
respond: func(int) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
return nil, errors.New("connection refused")
|
||||
},
|
||||
}
|
||||
d, sched := newDispatcher(client)
|
||||
d.RetryBudget = 1
|
||||
t0 := time.Now()
|
||||
m := mkMatch(t0, t0, "obj")
|
||||
sched.Add(m)
|
||||
|
||||
now := t0
|
||||
for i := 0; i < 5 && sched.Len() > 0 && !d.Cursor.IsFrozen(m.Key); i++ {
|
||||
now = now.Add(d.RetryBackoff + time.Millisecond)
|
||||
d.Tick(context.Background(), now)
|
||||
}
|
||||
if !d.Cursor.IsFrozen(m.Key) {
|
||||
t.Fatal("transport-error retries should escalate to BLOCKED past budget")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDispatchSkipsFrozenCursor(t *testing.T) {
|
||||
client := &fakeClient{
|
||||
respond: func(int) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
t.Fatal("frozen cursor should not call RPC")
|
||||
return nil, nil
|
||||
},
|
||||
}
|
||||
d, sched := newDispatcher(client)
|
||||
t0 := time.Now()
|
||||
m := mkMatch(t0, t0, "obj")
|
||||
d.Cursor.Freeze(m.Key, t0.UnixNano())
|
||||
sched.Add(m)
|
||||
d.Tick(context.Background(), t0)
|
||||
if client.calls != 0 {
|
||||
t.Fatalf("expected 0 RPC calls, got %d", client.calls)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDispatchRestartReFreezesNaturally(t *testing.T) {
|
||||
// No durable blocker store: the durable cursor + a deterministic poison
|
||||
// event self-recover to the blocked state on a fresh Dispatcher. After
|
||||
// the budget burns, the new cursor freezes at the same EventTs.
|
||||
respond := func(int) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{
|
||||
Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_BLOCKED,
|
||||
Reason: "deterministic poison",
|
||||
}, nil
|
||||
}
|
||||
d, sched := newDispatcher(&fakeClient{respond: respond})
|
||||
t0 := time.Now()
|
||||
m := mkMatch(t0, t0, "obj")
|
||||
sched.Add(m)
|
||||
d.Tick(context.Background(), t0)
|
||||
if !d.Cursor.IsFrozen(m.Key) {
|
||||
t.Fatal("first run should freeze")
|
||||
}
|
||||
|
||||
// Simulate restart: brand-new Dispatcher and Cursor, same poison event.
|
||||
d2, sched2 := newDispatcher(&fakeClient{respond: respond})
|
||||
sched2.Add(m)
|
||||
d2.Tick(context.Background(), t0)
|
||||
if !d2.Cursor.IsFrozen(m.Key) {
|
||||
t.Fatal("restart should re-freeze without a durable blocker store")
|
||||
}
|
||||
if d2.Cursor.Get(m.Key) != t0.UnixNano() {
|
||||
t.Fatal("re-freeze cursor not pinned at event ts")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDispatchEmitsOutcomeMetric(t *testing.T) {
|
||||
// The Prometheus counter is the operator's signal that lifecycle
|
||||
// is doing real work; it must increment for every dispatch path
|
||||
// (success, retry, transport error). Use the shared label tuple
|
||||
// (bucket, kind, outcome) and read the counter delta.
|
||||
client := &fakeClient{
|
||||
respond: func(call int) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
if call == 1 {
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{
|
||||
Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_DONE,
|
||||
}, nil
|
||||
}
|
||||
return nil, errors.New("network down")
|
||||
},
|
||||
}
|
||||
d, sched := newDispatcher(client)
|
||||
t0 := time.Now()
|
||||
|
||||
bucket := "bk"
|
||||
kind := s3lifecycle.ActionKindExpirationDays.String()
|
||||
|
||||
startDone := counterValue(t, bucket, kind, s3_lifecycle_pb.LifecycleDeleteOutcome_DONE.String())
|
||||
startRpc := counterValue(t, bucket, kind, "RPC_ERROR")
|
||||
|
||||
sched.Add(mkMatch(t0, t0, "obj-done"))
|
||||
d.Tick(context.Background(), t0)
|
||||
|
||||
// Second match exercises the transport-error path.
|
||||
sched.Add(mkMatch(t0, t0, "obj-fail"))
|
||||
d.Tick(context.Background(), t0)
|
||||
|
||||
if got := counterValue(t, bucket, kind, s3_lifecycle_pb.LifecycleDeleteOutcome_DONE.String()) - startDone; got != 1 {
|
||||
t.Errorf("DONE counter delta=%v, want 1", got)
|
||||
}
|
||||
if got := counterValue(t, bucket, kind, "RPC_ERROR") - startRpc; got != 1 {
|
||||
t.Errorf("RPC_ERROR counter delta=%v, want 1", got)
|
||||
}
|
||||
}
|
||||
|
||||
func counterValue(t *testing.T, bucket, kind, outcome string) float64 {
|
||||
t.Helper()
|
||||
m := &dto.Metric{}
|
||||
if err := stats.S3LifecycleDispatchCounter.WithLabelValues(bucket, kind, outcome).Write(m); err != nil {
|
||||
t.Fatalf("read counter: %v", err)
|
||||
}
|
||||
return m.GetCounter().GetValue()
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package dispatcher
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/s3_lifecycle_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/router"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// errFilerStore satisfies FilerStore with a forced Read error so the
|
||||
// Load path's "non-NotFound transport error" branch is reachable.
|
||||
// Save mirrors the pattern; tests for the nil-Store branch don't need
|
||||
// a stub at all.
|
||||
type errFilerStore struct {
|
||||
readErr error
|
||||
saveErr error
|
||||
readData []byte
|
||||
}
|
||||
|
||||
func (e *errFilerStore) Read(_ context.Context, _, _ string) ([]byte, error) {
|
||||
if e.readErr != nil {
|
||||
return nil, e.readErr
|
||||
}
|
||||
return e.readData, nil
|
||||
}
|
||||
func (e *errFilerStore) Save(_ context.Context, _, _ string, _ []byte) error {
|
||||
return e.saveErr
|
||||
}
|
||||
|
||||
// ---------- FilerPersister edges ----------
|
||||
|
||||
func TestFilerPersisterLoad_NilStoreErrors(t *testing.T) {
|
||||
// The persister's Store dependency is required; loading with a nil
|
||||
// Store must error rather than panic on the Read call.
|
||||
p := &FilerPersister{}
|
||||
_, err := p.Load(context.Background(), 0)
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "nil Store")
|
||||
}
|
||||
|
||||
func TestFilerPersisterSave_NilStoreErrors(t *testing.T) {
|
||||
p := &FilerPersister{}
|
||||
err := p.Save(context.Background(), 0, map[s3lifecycle.ActionKey]int64{})
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "nil Store")
|
||||
}
|
||||
|
||||
func TestFilerPersisterLoad_NonNotFoundErrorIsWrapped(t *testing.T) {
|
||||
// A transport-level error (anything that isn't ErrNotFound) wraps
|
||||
// with the shard ID context so operators can attribute it. Pin
|
||||
// both that the error surfaces and that the original is recoverable
|
||||
// via errors.Is so a caller can distinguish.
|
||||
want := errors.New("filer-side bang")
|
||||
p := &FilerPersister{Store: &errFilerStore{readErr: want}}
|
||||
_, err := p.Load(context.Background(), 3)
|
||||
require.Error(t, err)
|
||||
assert.ErrorIs(t, err, want)
|
||||
assert.Contains(t, err.Error(), "shard=3")
|
||||
}
|
||||
|
||||
func TestFilerPersisterLoad_EmptyContentReturnsEmptyMap(t *testing.T) {
|
||||
// Read returning a successful empty []byte means "file exists but
|
||||
// is zero length"; the persister must treat this as "no entries"
|
||||
// rather than try to JSON-decode an empty slice and return an
|
||||
// error.
|
||||
p := &FilerPersister{Store: &errFilerStore{readData: []byte{}}}
|
||||
got, err := p.Load(context.Background(), 0)
|
||||
require.NoError(t, err)
|
||||
assert.NotNil(t, got)
|
||||
assert.Empty(t, got)
|
||||
}
|
||||
|
||||
// ---------- Tick edges ----------
|
||||
|
||||
func TestTick_InitializesRetriesMapOnFirstCall(t *testing.T) {
|
||||
// retries is a lazy map; a Dispatcher constructed without it must
|
||||
// not panic on the first Tick. Pin that handleRetryLater can write
|
||||
// into the map afterwards (proven by the dispatcher returning an
|
||||
// integer rather than crashing).
|
||||
d, sched := newDispatcher(&fakeClient{
|
||||
respond: func(int) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_DONE}, nil
|
||||
},
|
||||
})
|
||||
require.Nil(t, d.retries, "preconditions: retries map starts nil")
|
||||
t0 := time.Now()
|
||||
sched.Add(router.Match{
|
||||
Key: s3lifecycle.ActionKey{Bucket: "bk", ActionKind: s3lifecycle.ActionKindExpirationDays},
|
||||
ObjectKey: "k",
|
||||
DueTime: t0,
|
||||
})
|
||||
processed := d.Tick(context.Background(), t0.Add(time.Hour))
|
||||
assert.Equal(t, 1, processed)
|
||||
assert.NotNil(t, d.retries, "Tick must initialize the retries map")
|
||||
}
|
||||
|
||||
func TestTick_CtxShutdownMidLoopRequeuesAndReturnsZero(t *testing.T) {
|
||||
// If ctx is canceled before Tick starts dispatching, the entire
|
||||
// drained batch must be re-queued. Drain pops ALL due matches at
|
||||
// once, so a naive "re-add the current Match only" would silently
|
||||
// lose every Match past the cancellation point. Three matches
|
||||
// here exercises that the loop re-queues the current AND every
|
||||
// remaining drained entry.
|
||||
calls := 0
|
||||
client := &fakeClient{
|
||||
respond: func(int) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
calls++
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_DONE}, nil
|
||||
},
|
||||
}
|
||||
d, sched := newDispatcher(client)
|
||||
t0 := time.Now()
|
||||
for _, k := range []string{"k1", "k2", "k3"} {
|
||||
sched.Add(router.Match{
|
||||
Key: s3lifecycle.ActionKey{Bucket: "bk", ActionKind: s3lifecycle.ActionKindExpirationDays},
|
||||
ObjectKey: k,
|
||||
DueTime: t0,
|
||||
})
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel() // shutdown before Tick even starts dispatching
|
||||
|
||||
processed := d.Tick(ctx, t0.Add(time.Hour))
|
||||
assert.Equal(t, 0, processed, "shutdown must report zero processed")
|
||||
assert.Equal(t, 0, calls, "shutdown must skip every dispatch call")
|
||||
assert.Equal(t, 3, sched.Len(), "every drained Match must be re-queued — none lost")
|
||||
}
|
||||
@@ -1,15 +1,22 @@
|
||||
package dispatcher
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/filer"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/reader"
|
||||
)
|
||||
|
||||
// FilerStore is the small subset of filer-client operations the
|
||||
// daily-replay cursor persister needs (dailyrun.FilerCursorPersister).
|
||||
// Tests inject an in-memory fake.
|
||||
// FilerStore is the small subset of filer-client operations the persistence
|
||||
// layer needs. The default implementation calls filer.ReadInsideFiler /
|
||||
// filer.SaveInsideFiler; tests inject an in-memory fake.
|
||||
type FilerStore interface {
|
||||
Read(ctx context.Context, dir, name string) ([]byte, error)
|
||||
Save(ctx context.Context, dir, name string, content []byte) error
|
||||
@@ -31,3 +38,104 @@ func (s *filerStoreClient) Read(ctx context.Context, dir, name string) ([]byte,
|
||||
func (s *filerStoreClient) Save(ctx context.Context, dir, name string, content []byte) error {
|
||||
return filer.SaveInsideFiler(ctx, s.client, dir, name, content)
|
||||
}
|
||||
|
||||
// CursorDir is the filer directory holding per-shard cursor files.
|
||||
const CursorDir = "/etc/s3/lifecycle/cursors"
|
||||
|
||||
// FilerPersister persists per-shard cursor maps to /etc/s3/lifecycle/cursors/
|
||||
// as JSON. One file per shard keeps Save atomic — the filer writes the entry
|
||||
// in a single mutation, so a crash mid-write doesn't leak partial state.
|
||||
type FilerPersister struct {
|
||||
Store FilerStore
|
||||
}
|
||||
|
||||
// cursorFile is the on-disk JSON shape. cursorFileEntry repeats the
|
||||
// ActionKey fields explicitly so the format stays human-readable and stable
|
||||
// against Go-side struct rearrangements.
|
||||
type cursorFile struct {
|
||||
Version int `json:"version"`
|
||||
ShardID int `json:"shard_id"`
|
||||
Entries []cursorFileEntry `json:"entries"`
|
||||
}
|
||||
|
||||
type cursorFileEntry struct {
|
||||
Bucket string `json:"bucket"`
|
||||
RuleHash []byte `json:"rule_hash"` // base64 in JSON
|
||||
ActionKind int `json:"action_kind"`
|
||||
TsNs int64 `json:"ts_ns"`
|
||||
}
|
||||
|
||||
const cursorFileVersion = 1
|
||||
|
||||
func cursorFileName(shardID int) string {
|
||||
return fmt.Sprintf("shard-%02d.json", shardID)
|
||||
}
|
||||
|
||||
func (p *FilerPersister) Load(ctx context.Context, shardID int) (map[s3lifecycle.ActionKey]int64, error) {
|
||||
if p.Store == nil {
|
||||
return nil, errors.New("FilerPersister: nil Store")
|
||||
}
|
||||
content, err := p.Store.Read(ctx, CursorDir, cursorFileName(shardID))
|
||||
if err != nil {
|
||||
if errors.Is(err, filer_pb.ErrNotFound) {
|
||||
return map[s3lifecycle.ActionKey]int64{}, nil
|
||||
}
|
||||
return nil, fmt.Errorf("cursor read shard=%d: %w", shardID, err)
|
||||
}
|
||||
if len(content) == 0 {
|
||||
return map[s3lifecycle.ActionKey]int64{}, nil
|
||||
}
|
||||
var cf cursorFile
|
||||
if err := json.Unmarshal(content, &cf); err != nil {
|
||||
return nil, fmt.Errorf("cursor decode shard=%d: %w", shardID, err)
|
||||
}
|
||||
out := make(map[s3lifecycle.ActionKey]int64, len(cf.Entries))
|
||||
for _, e := range cf.Entries {
|
||||
k := s3lifecycle.ActionKey{
|
||||
Bucket: e.Bucket,
|
||||
ActionKind: s3lifecycle.ActionKind(e.ActionKind),
|
||||
}
|
||||
copy(k.RuleHash[:], e.RuleHash)
|
||||
out[k] = e.TsNs
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (p *FilerPersister) Save(ctx context.Context, shardID int, state map[s3lifecycle.ActionKey]int64) error {
|
||||
if p.Store == nil {
|
||||
return errors.New("FilerPersister: nil Store")
|
||||
}
|
||||
cf := cursorFile{Version: cursorFileVersion, ShardID: shardID}
|
||||
cf.Entries = make([]cursorFileEntry, 0, len(state))
|
||||
for k, v := range state {
|
||||
hash := k.RuleHash
|
||||
cf.Entries = append(cf.Entries, cursorFileEntry{
|
||||
Bucket: k.Bucket,
|
||||
RuleHash: hash[:],
|
||||
ActionKind: int(k.ActionKind),
|
||||
TsNs: v,
|
||||
})
|
||||
}
|
||||
// Stable order so the on-disk file diffs cleanly across saves.
|
||||
sort.Slice(cf.Entries, func(i, j int) bool {
|
||||
a, b := cf.Entries[i], cf.Entries[j]
|
||||
if a.Bucket != b.Bucket {
|
||||
return a.Bucket < b.Bucket
|
||||
}
|
||||
if a.ActionKind != b.ActionKind {
|
||||
return a.ActionKind < b.ActionKind
|
||||
}
|
||||
return bytes.Compare(a.RuleHash, b.RuleHash) < 0
|
||||
})
|
||||
var buf bytes.Buffer
|
||||
if err := json.NewEncoder(&buf).Encode(cf); err != nil {
|
||||
return fmt.Errorf("cursor encode shard=%d: %w", shardID, err)
|
||||
}
|
||||
if err := p.Store.Save(ctx, CursorDir, cursorFileName(shardID), buf.Bytes()); err != nil {
|
||||
return fmt.Errorf("cursor save shard=%d: %w", shardID, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Compile-time interface check.
|
||||
var _ reader.Persister = (*FilerPersister)(nil)
|
||||
@@ -0,0 +1,159 @@
|
||||
package dispatcher
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
)
|
||||
|
||||
// fakeFilerStore is an in-memory FilerStore for tests.
|
||||
type fakeFilerStore struct {
|
||||
mu sync.Mutex
|
||||
files map[string][]byte
|
||||
}
|
||||
|
||||
func newFakeFilerStore() *fakeFilerStore {
|
||||
return &fakeFilerStore{files: map[string][]byte{}}
|
||||
}
|
||||
|
||||
func (f *fakeFilerStore) key(dir, name string) string { return dir + "/" + name }
|
||||
|
||||
func (f *fakeFilerStore) Read(ctx context.Context, dir, name string) ([]byte, error) {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
v, ok := f.files[f.key(dir, name)]
|
||||
if !ok {
|
||||
return nil, filer_pb.ErrNotFound
|
||||
}
|
||||
return append([]byte(nil), v...), nil
|
||||
}
|
||||
|
||||
func (f *fakeFilerStore) Save(ctx context.Context, dir, name string, content []byte) error {
|
||||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
f.files[f.key(dir, name)] = append([]byte(nil), content...)
|
||||
return nil
|
||||
}
|
||||
|
||||
func mkKey(bucket string, kind s3lifecycle.ActionKind, hashByte byte) s3lifecycle.ActionKey {
|
||||
k := s3lifecycle.ActionKey{Bucket: bucket, ActionKind: kind}
|
||||
for i := range k.RuleHash {
|
||||
k.RuleHash[i] = hashByte
|
||||
}
|
||||
return k
|
||||
}
|
||||
|
||||
func TestFilerPersisterEmptyLoadReturnsEmptyMap(t *testing.T) {
|
||||
p := &FilerPersister{Store: newFakeFilerStore()}
|
||||
state, err := p.Load(context.Background(), 0)
|
||||
if err != nil {
|
||||
t.Fatalf("Load on empty: %v", err)
|
||||
}
|
||||
if len(state) != 0 {
|
||||
t.Fatalf("expected empty map, got %d entries", len(state))
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilerPersisterSaveLoadRoundTrip(t *testing.T) {
|
||||
p := &FilerPersister{Store: newFakeFilerStore()}
|
||||
ctx := context.Background()
|
||||
|
||||
in := map[s3lifecycle.ActionKey]int64{
|
||||
mkKey("bucket-a", s3lifecycle.ActionKindExpirationDays, 0xAA): 12345,
|
||||
mkKey("bucket-b", s3lifecycle.ActionKindAbortMPU, 0xBB): 67890,
|
||||
mkKey("bucket-a", s3lifecycle.ActionKindNoncurrentDays, 0xCC): 54321,
|
||||
}
|
||||
if err := p.Save(ctx, 3, in); err != nil {
|
||||
t.Fatalf("Save: %v", err)
|
||||
}
|
||||
out, err := p.Load(ctx, 3)
|
||||
if err != nil {
|
||||
t.Fatalf("Load: %v", err)
|
||||
}
|
||||
if len(out) != len(in) {
|
||||
t.Fatalf("Load count=%d, want %d", len(out), len(in))
|
||||
}
|
||||
for k, v := range in {
|
||||
if got := out[k]; got != v {
|
||||
t.Fatalf("Load[%v]=%d, want %d", k, got, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilerPersisterIsolatesShards(t *testing.T) {
|
||||
p := &FilerPersister{Store: newFakeFilerStore()}
|
||||
ctx := context.Background()
|
||||
|
||||
stateA := map[s3lifecycle.ActionKey]int64{mkKey("a", s3lifecycle.ActionKindExpirationDays, 1): 100}
|
||||
stateB := map[s3lifecycle.ActionKey]int64{mkKey("a", s3lifecycle.ActionKindExpirationDays, 1): 200}
|
||||
if err := p.Save(ctx, 0, stateA); err != nil {
|
||||
t.Fatalf("Save 0: %v", err)
|
||||
}
|
||||
if err := p.Save(ctx, 1, stateB); err != nil {
|
||||
t.Fatalf("Save 1: %v", err)
|
||||
}
|
||||
loadA, _ := p.Load(ctx, 0)
|
||||
loadB, _ := p.Load(ctx, 1)
|
||||
if loadA[mkKey("a", s3lifecycle.ActionKindExpirationDays, 1)] != 100 {
|
||||
t.Fatalf("shard 0 leaked from shard 1: %v", loadA)
|
||||
}
|
||||
if loadB[mkKey("a", s3lifecycle.ActionKindExpirationDays, 1)] != 200 {
|
||||
t.Fatalf("shard 1 reads stale: %v", loadB)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilerPersisterSaveOverwrites(t *testing.T) {
|
||||
p := &FilerPersister{Store: newFakeFilerStore()}
|
||||
ctx := context.Background()
|
||||
k := mkKey("b", s3lifecycle.ActionKindExpirationDays, 0xAA)
|
||||
|
||||
if err := p.Save(ctx, 0, map[s3lifecycle.ActionKey]int64{k: 100}); err != nil {
|
||||
t.Fatalf("Save 1: %v", err)
|
||||
}
|
||||
if err := p.Save(ctx, 0, map[s3lifecycle.ActionKey]int64{k: 200}); err != nil {
|
||||
t.Fatalf("Save 2: %v", err)
|
||||
}
|
||||
out, _ := p.Load(ctx, 0)
|
||||
if out[k] != 200 {
|
||||
t.Fatalf("overwrite not applied, got %d", out[k])
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilerPersisterSaveIsDeterministic(t *testing.T) {
|
||||
// Saving the same map twice must produce byte-identical content so the
|
||||
// on-disk file diffs cleanly when the state hasn't changed.
|
||||
store := newFakeFilerStore()
|
||||
p := &FilerPersister{Store: store}
|
||||
ctx := context.Background()
|
||||
|
||||
in := map[s3lifecycle.ActionKey]int64{
|
||||
mkKey("zeta", s3lifecycle.ActionKindNoncurrentDays, 0xCC): 300,
|
||||
mkKey("alpha", s3lifecycle.ActionKindExpirationDays, 0xAA): 100,
|
||||
mkKey("alpha", s3lifecycle.ActionKindAbortMPU, 0xBB): 200,
|
||||
}
|
||||
if err := p.Save(ctx, 0, in); err != nil {
|
||||
t.Fatalf("Save 1: %v", err)
|
||||
}
|
||||
first := append([]byte(nil), store.files[store.key(CursorDir, cursorFileName(0))]...)
|
||||
|
||||
if err := p.Save(ctx, 0, in); err != nil {
|
||||
t.Fatalf("Save 2: %v", err)
|
||||
}
|
||||
second := store.files[store.key(CursorDir, cursorFileName(0))]
|
||||
if string(first) != string(second) {
|
||||
t.Fatalf("non-deterministic save:\n first=%s\nsecond=%s", first, second)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilerPersisterCorruptDataReturnsError(t *testing.T) {
|
||||
store := newFakeFilerStore()
|
||||
store.Save(context.Background(), CursorDir, "shard-00.json", []byte("not json"))
|
||||
|
||||
p := &FilerPersister{Store: store}
|
||||
if _, err := p.Load(context.Background(), 0); err == nil {
|
||||
t.Fatal("expected decode error, got nil")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
package dispatcher
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/s3_lifecycle_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/reader"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/router"
|
||||
)
|
||||
|
||||
// Layer 2 component tests for the dispatcher pipeline mechanics:
|
||||
// the per-shard composition that Pipeline.Run wires up at runtime
|
||||
// (cursors, schedules, dispatchers, persister), exercised directly so
|
||||
// the tests stay independent of a live filer connection. Pipeline.Run
|
||||
// itself can't run here because it builds a real reader.Reader; these
|
||||
// tests instead drive Tick directly while sharing the same fakeClient
|
||||
// that dispatcher_test.go uses.
|
||||
|
||||
// shardKit bundles the per-shard state Pipeline.Run constructs in
|
||||
// production: a Cursor, a Schedule, and a Dispatcher hooked to both.
|
||||
type shardKit struct {
|
||||
id int
|
||||
cursor *reader.Cursor
|
||||
dispatch *Dispatcher
|
||||
}
|
||||
|
||||
func newShardKit(t *testing.T, id int, client LifecycleClient) *shardKit {
|
||||
t.Helper()
|
||||
c := reader.NewCursor()
|
||||
return &shardKit{
|
||||
id: id,
|
||||
cursor: c,
|
||||
dispatch: &Dispatcher{
|
||||
ShardID: id,
|
||||
Client: client,
|
||||
Cursor: c,
|
||||
Schedule: router.NewSchedule(),
|
||||
RetryBudget: 3,
|
||||
RetryBackoff: time.Millisecond,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// recordingClient lets Layer 2 tests assert exactly which RPCs the
|
||||
// dispatcher made. Goroutine-safe because Tick is called from test
|
||||
// goroutines but inspections happen from the test goroutine.
|
||||
type recordingClient struct {
|
||||
mu sync.Mutex
|
||||
requests []*s3_lifecycle_pb.LifecycleDeleteRequest
|
||||
respond func(req *s3_lifecycle_pb.LifecycleDeleteRequest) (*s3_lifecycle_pb.LifecycleDeleteResponse, error)
|
||||
}
|
||||
|
||||
func (r *recordingClient) LifecycleDelete(ctx context.Context, req *s3_lifecycle_pb.LifecycleDeleteRequest) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
r.mu.Lock()
|
||||
r.requests = append(r.requests, req)
|
||||
r.mu.Unlock()
|
||||
return r.respond(req)
|
||||
}
|
||||
|
||||
func TestPipelineMultiShardFanOutKeepsCursorsIsolated(t *testing.T) {
|
||||
// Two events for two different shards land in different schedules
|
||||
// and dispatch independently. Each shard's cursor advances only
|
||||
// for the event(s) targeting that shard.
|
||||
client := &recordingClient{
|
||||
respond: func(*s3_lifecycle_pb.LifecycleDeleteRequest) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_DONE}, nil
|
||||
},
|
||||
}
|
||||
shards := map[int]*shardKit{
|
||||
0: newShardKit(t, 0, client),
|
||||
1: newShardKit(t, 1, client),
|
||||
}
|
||||
|
||||
t0 := time.Now()
|
||||
mA := router.Match{
|
||||
Key: s3lifecycle.ActionKey{Bucket: "bk", ActionKind: s3lifecycle.ActionKindExpirationDays},
|
||||
EventTs: t0,
|
||||
DueTime: t0,
|
||||
Bucket: "bk",
|
||||
ObjectKey: "alpha",
|
||||
}
|
||||
// Use a different action kind on shard 1 so the cursor key differs
|
||||
// from shard 0 — shared keys would write to the same cursor entry.
|
||||
mB := router.Match{
|
||||
Key: s3lifecycle.ActionKey{Bucket: "bk", ActionKind: s3lifecycle.ActionKindNoncurrentDays},
|
||||
EventTs: t0.Add(time.Second),
|
||||
DueTime: t0.Add(time.Second),
|
||||
Bucket: "bk",
|
||||
ObjectKey: "beta",
|
||||
}
|
||||
shards[0].dispatch.Schedule.Add(mA)
|
||||
shards[1].dispatch.Schedule.Add(mB)
|
||||
|
||||
// Tick shard 0 first; shard 1's schedule must still hold its match.
|
||||
if got := shards[0].dispatch.Tick(context.Background(), t0.Add(time.Hour)); got != 1 {
|
||||
t.Fatalf("shard 0 Tick processed=%d, want 1", got)
|
||||
}
|
||||
if got := shards[1].dispatch.Schedule.Len(); got != 1 {
|
||||
t.Fatalf("shard 1 schedule must not be drained by shard 0 Tick: len=%d", got)
|
||||
}
|
||||
|
||||
// Now tick shard 1.
|
||||
if got := shards[1].dispatch.Tick(context.Background(), t0.Add(time.Hour)); got != 1 {
|
||||
t.Fatalf("shard 1 Tick processed=%d, want 1", got)
|
||||
}
|
||||
|
||||
if shards[0].cursor.Get(mA.Key) != mA.EventTs.UnixNano() {
|
||||
t.Fatalf("shard 0 cursor not advanced: got %d", shards[0].cursor.Get(mA.Key))
|
||||
}
|
||||
if shards[1].cursor.Get(mB.Key) != mB.EventTs.UnixNano() {
|
||||
t.Fatalf("shard 1 cursor not advanced: got %d", shards[1].cursor.Get(mB.Key))
|
||||
}
|
||||
// Cursors must NOT cross-contaminate.
|
||||
if shards[0].cursor.Get(mB.Key) != 0 {
|
||||
t.Fatalf("shard 0 cursor saw shard 1's key: got %d", shards[0].cursor.Get(mB.Key))
|
||||
}
|
||||
}
|
||||
|
||||
func TestPipelineCursorFreezeOnOneShardDoesntBlockOthers(t *testing.T) {
|
||||
// Shard 0 dispatches a poison event that returns BLOCKED — its
|
||||
// cursor freezes at the event TsNs. Shard 1's progress must be
|
||||
// independent: it dispatches successfully and advances.
|
||||
client := &recordingClient{
|
||||
respond: func(req *s3_lifecycle_pb.LifecycleDeleteRequest) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
if req.Bucket == "bk" && req.ObjectPath == "poison" {
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_BLOCKED}, nil
|
||||
}
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_DONE}, nil
|
||||
},
|
||||
}
|
||||
shards := map[int]*shardKit{
|
||||
0: newShardKit(t, 0, client),
|
||||
1: newShardKit(t, 1, client),
|
||||
}
|
||||
|
||||
t0 := time.Now()
|
||||
poison := router.Match{
|
||||
Key: s3lifecycle.ActionKey{Bucket: "bk", ActionKind: s3lifecycle.ActionKindExpirationDays},
|
||||
EventTs: t0,
|
||||
DueTime: t0,
|
||||
Bucket: "bk",
|
||||
ObjectKey: "poison",
|
||||
}
|
||||
good := router.Match{
|
||||
Key: s3lifecycle.ActionKey{Bucket: "bk", ActionKind: s3lifecycle.ActionKindNoncurrentDays},
|
||||
EventTs: t0.Add(time.Second),
|
||||
DueTime: t0.Add(time.Second),
|
||||
Bucket: "bk",
|
||||
ObjectKey: "good",
|
||||
}
|
||||
shards[0].dispatch.Schedule.Add(poison)
|
||||
shards[1].dispatch.Schedule.Add(good)
|
||||
|
||||
shards[0].dispatch.Tick(context.Background(), t0.Add(time.Hour))
|
||||
shards[1].dispatch.Tick(context.Background(), t0.Add(time.Hour))
|
||||
|
||||
if !shards[0].cursor.IsFrozen(poison.Key) {
|
||||
t.Fatalf("shard 0 cursor must freeze on BLOCKED outcome")
|
||||
}
|
||||
if shards[1].cursor.IsFrozen(good.Key) {
|
||||
t.Fatalf("shard 1 cursor must not freeze when shard 0 fails")
|
||||
}
|
||||
if shards[1].cursor.Get(good.Key) != good.EventTs.UnixNano() {
|
||||
t.Fatalf("shard 1 cursor must advance independently: got %d", shards[1].cursor.Get(good.Key))
|
||||
}
|
||||
}
|
||||
|
||||
func TestPipelinePersisterCheckpointRoundTripsEveryShard(t *testing.T) {
|
||||
// A cursor checkpoint persists the per-shard map; a fresh dispatcher
|
||||
// can Restore from that map and resume at the same TsNs. Pipeline.Run
|
||||
// drives this on a ticker; tests exercise the contract directly.
|
||||
client := &recordingClient{
|
||||
respond: func(*s3_lifecycle_pb.LifecycleDeleteRequest) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_DONE}, nil
|
||||
},
|
||||
}
|
||||
shards := map[int]*shardKit{
|
||||
0: newShardKit(t, 0, client),
|
||||
1: newShardKit(t, 1, client),
|
||||
}
|
||||
|
||||
t0 := time.Now()
|
||||
addAndTick := func(s *shardKit, obj string, kind s3lifecycle.ActionKind, ts time.Time) {
|
||||
s.dispatch.Schedule.Add(router.Match{
|
||||
Key: s3lifecycle.ActionKey{Bucket: "bk", ActionKind: kind},
|
||||
EventTs: ts,
|
||||
DueTime: ts,
|
||||
Bucket: "bk",
|
||||
ObjectKey: obj,
|
||||
})
|
||||
s.dispatch.Tick(context.Background(), t0.Add(time.Hour))
|
||||
}
|
||||
addAndTick(shards[0], "alpha", s3lifecycle.ActionKindExpirationDays, t0)
|
||||
addAndTick(shards[1], "beta", s3lifecycle.ActionKindNoncurrentDays, t0.Add(time.Second))
|
||||
|
||||
pers := reader.NewInMemoryPersister()
|
||||
for id, s := range shards {
|
||||
if err := pers.Save(context.Background(), id, s.cursor.Snapshot()); err != nil {
|
||||
t.Fatalf("save shard %d: %v", id, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Restore into fresh cursors, verify every shard's TsNs round-trips.
|
||||
for id, s := range shards {
|
||||
state, err := pers.Load(context.Background(), id)
|
||||
if err != nil {
|
||||
t.Fatalf("load shard %d: %v", id, err)
|
||||
}
|
||||
c := reader.NewCursor()
|
||||
c.Restore(state)
|
||||
want := s.cursor.Snapshot()
|
||||
got := c.Snapshot()
|
||||
if len(got) != len(want) {
|
||||
t.Fatalf("shard %d snapshot len: got %d, want %d", id, len(got), len(want))
|
||||
}
|
||||
for k, v := range want {
|
||||
if got[k] != v {
|
||||
t.Fatalf("shard %d cursor key %v: got %d, want %d", id, k, got[k], v)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPipelineRetryLaterRespectsDispatchTickCadence(t *testing.T) {
|
||||
// RETRY_LATER schedules the match for a later DueTime. A Tick at
|
||||
// the present moment must NOT re-dispatch it; only a Tick past
|
||||
// the new DueTime triggers a second RPC. This pins the cadence
|
||||
// contract against premature retries from later refresh ticks.
|
||||
calls := 0
|
||||
client := &recordingClient{
|
||||
respond: func(*s3_lifecycle_pb.LifecycleDeleteRequest) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
calls++
|
||||
if calls == 1 {
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_RETRY_LATER}, nil
|
||||
}
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_DONE}, nil
|
||||
},
|
||||
}
|
||||
s := newShardKit(t, 0, client)
|
||||
s.dispatch.RetryBackoff = time.Hour // long backoff so the second Tick at t0+1m doesn't fire
|
||||
|
||||
t0 := time.Now()
|
||||
m := router.Match{
|
||||
Key: s3lifecycle.ActionKey{Bucket: "bk", ActionKind: s3lifecycle.ActionKindExpirationDays},
|
||||
EventTs: t0,
|
||||
DueTime: t0,
|
||||
Bucket: "bk",
|
||||
ObjectKey: "obj",
|
||||
}
|
||||
s.dispatch.Schedule.Add(m)
|
||||
|
||||
if got := s.dispatch.Tick(context.Background(), t0); got != 1 {
|
||||
t.Fatalf("first Tick processed=%d, want 1 (RETRY_LATER counts as processed)", got)
|
||||
}
|
||||
|
||||
// Within the backoff window: nothing fires.
|
||||
if got := s.dispatch.Tick(context.Background(), t0.Add(time.Minute)); got != 0 {
|
||||
t.Fatalf("Tick within backoff must skip: processed=%d", got)
|
||||
}
|
||||
if calls != 1 {
|
||||
t.Fatalf("RPC must not retry within backoff: calls=%d", calls)
|
||||
}
|
||||
|
||||
// Past backoff: re-dispatches.
|
||||
if got := s.dispatch.Tick(context.Background(), t0.Add(2*time.Hour)); got != 1 {
|
||||
t.Fatalf("Tick past backoff must re-dispatch: processed=%d", got)
|
||||
}
|
||||
if calls != 2 {
|
||||
t.Fatalf("expected exactly 2 calls (initial + one retry), got %d", calls)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,314 @@
|
||||
package dispatcher
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/engine"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/reader"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/router"
|
||||
"github.com/seaweedfs/seaweedfs/weed/stats"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// Pipeline composes the reader, router, dispatcher, and cursor checkpoint
|
||||
// into a single Run loop. One Pipeline can handle a contiguous shard span
|
||||
// or any explicit set of shards via Shards; ShardID still works for the
|
||||
// single-shard case (and is preferred for short-form configuration).
|
||||
//
|
||||
// Internally there is exactly one filer subscription regardless of how
|
||||
// many shards Shards contains; events are filtered by the reader's
|
||||
// ShardPredicate and routed to the matching shard's Cursor + Schedule
|
||||
// inside the existing dispatch goroutine — no per-shard goroutines.
|
||||
type Pipeline struct {
|
||||
ShardID int // used when Shards is empty
|
||||
Shards []int // overrides ShardID when non-empty
|
||||
BucketsPath string
|
||||
|
||||
Engine *engine.Engine
|
||||
// Cursor is consulted only when len(Shards) <= 1. Range mode allocates
|
||||
// a fresh Cursor per shard internally.
|
||||
Cursor *reader.Cursor
|
||||
Persister reader.Persister
|
||||
Client LifecycleClient
|
||||
|
||||
FilerClient filer_pb.SeaweedFilerClient
|
||||
ClientID int32
|
||||
ClientName string
|
||||
|
||||
// Tick cadence for the dispatcher. Zero = defaultDispatchTick.
|
||||
DispatchTick time.Duration
|
||||
// Cadence for cursor checkpoint writes. Zero = defaultCheckpointTick.
|
||||
CheckpointTick time.Duration
|
||||
// EventBudget caps reader events per Run; zero = unbounded (run until
|
||||
// ctx cancellation). Used by the worker scheduler to bound a single
|
||||
// READ task.
|
||||
EventBudget int
|
||||
|
||||
// EventBuffer sets the channel capacity between reader and router
|
||||
// goroutines. Zero = defaultEventBuffer.
|
||||
EventBuffer int
|
||||
|
||||
// events is the input channel for the dispatch goroutine. The reader
|
||||
// is the primary writer; InjectEvent allows external code (the bucket
|
||||
// bootstrapper) to push synthesized events through the same router
|
||||
// path. Initialized lazily by InjectEvent and Run; ready signals
|
||||
// readiness to InjectEvent callers that arrive before Run.
|
||||
eventsOnce sync.Once
|
||||
events chan *reader.Event
|
||||
eventsReady chan struct{}
|
||||
}
|
||||
|
||||
// ensureEventsChan lazily creates the events channel and the readiness
|
||||
// signal so InjectEvent works whether it's called before or after Run.
|
||||
func (p *Pipeline) ensureEventsChan() {
|
||||
p.eventsOnce.Do(func() {
|
||||
bufSize := p.EventBuffer
|
||||
if bufSize <= 0 {
|
||||
bufSize = defaultEventBuffer
|
||||
}
|
||||
p.events = make(chan *reader.Event, bufSize)
|
||||
p.eventsReady = make(chan struct{})
|
||||
close(p.eventsReady)
|
||||
})
|
||||
}
|
||||
|
||||
// InjectEvent pushes a synthesized event onto the same input the reader
|
||||
// feeds. Used by the bucket bootstrapper to backfill pre-rule entries:
|
||||
// each entry becomes one *reader.Event, flows through router.Route, and
|
||||
// schedules a Match with DueTime=mtime+delay. Set TsNs=0 so the cursor
|
||||
// doesn't advance — the reader still resumes from its persisted position
|
||||
// on restart.
|
||||
func (p *Pipeline) InjectEvent(ctx context.Context, ev *reader.Event) error {
|
||||
p.ensureEventsChan()
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
case p.events <- ev:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// Tick defaults live in dispatch_ticks_*.go so the s3tests build can shrink
|
||||
// them without touching production timings. defaultDispatchTick and
|
||||
// defaultCheckpointTick are the only knobs that change per build tag.
|
||||
const (
|
||||
defaultEventBuffer = 1024
|
||||
shutdownDrainTimeout = 30 * time.Second
|
||||
shutdownSaveTimeout = 5 * time.Second
|
||||
)
|
||||
|
||||
// shardState bundles per-shard mutable state so the single dispatch
|
||||
// goroutine can route an event to the right cursor + schedule by lookup.
|
||||
type shardState struct {
|
||||
cursor *reader.Cursor
|
||||
dispatch *Dispatcher
|
||||
}
|
||||
|
||||
// Run blocks until ctx is canceled or a fatal error occurs. On exit, every
|
||||
// shard's cursor is persisted; in-flight schedule entries are dropped
|
||||
// (the meta-log is the durable buffer, so a restart re-derives them).
|
||||
func (p *Pipeline) Run(ctx context.Context) error {
|
||||
if p.Engine == nil || p.Persister == nil || p.Client == nil || p.FilerClient == nil {
|
||||
return errors.New("pipeline: missing required dependency")
|
||||
}
|
||||
if p.BucketsPath == "" {
|
||||
return errors.New("pipeline: BucketsPath required")
|
||||
}
|
||||
|
||||
// Resolve the active shard set. Single-shard configurations populate
|
||||
// either Shards=[N] or Shards=nil with ShardID=N (latter is the legacy
|
||||
// path that also supplies a Cursor); both feed the same range model.
|
||||
shardIDs := p.Shards
|
||||
if len(shardIDs) == 0 {
|
||||
shardIDs = []int{p.ShardID}
|
||||
}
|
||||
shardSet := make(map[int]struct{}, len(shardIDs))
|
||||
for _, s := range shardIDs {
|
||||
if s < 0 || s >= s3lifecycle.ShardCount {
|
||||
return fmt.Errorf("pipeline: shard %d out of [0,%d)", s, s3lifecycle.ShardCount)
|
||||
}
|
||||
shardSet[s] = struct{}{}
|
||||
}
|
||||
|
||||
// Per-shard cursor + dispatcher. Cursors restore from the durable
|
||||
// store; freezes re-arm naturally when the reader re-encounters the
|
||||
// poison event at MinTsNs and the dispatch state machine drives it
|
||||
// back to BLOCKED.
|
||||
states := make(map[int]*shardState, len(shardIDs))
|
||||
var minStartTsNs int64 = -1
|
||||
for _, shardID := range shardIDs {
|
||||
c := p.Cursor
|
||||
if len(shardIDs) != 1 || c == nil {
|
||||
c = reader.NewCursor()
|
||||
}
|
||||
state, err := p.Persister.Load(ctx, shardID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cursor load shard=%d: %w", shardID, err)
|
||||
}
|
||||
c.Restore(state)
|
||||
states[shardID] = &shardState{
|
||||
cursor: c,
|
||||
dispatch: &Dispatcher{
|
||||
ShardID: shardID,
|
||||
Client: p.Client,
|
||||
Cursor: c,
|
||||
Schedule: router.NewSchedule(),
|
||||
},
|
||||
}
|
||||
if mt := c.MinTsNs(); mt > 0 && (minStartTsNs < 0 || mt < minStartTsNs) {
|
||||
minStartTsNs = mt
|
||||
}
|
||||
}
|
||||
if minStartTsNs < 0 {
|
||||
minStartTsNs = 0
|
||||
}
|
||||
|
||||
p.ensureEventsChan()
|
||||
events := p.events
|
||||
rd := &reader.Reader{
|
||||
BucketsPath: p.BucketsPath,
|
||||
ShardPredicate: func(s int) bool {
|
||||
_, ok := shardSet[s]
|
||||
return ok
|
||||
},
|
||||
StartTsNs: minStartTsNs,
|
||||
Events: events,
|
||||
EventBudget: p.EventBudget,
|
||||
}
|
||||
rd.LogStartup()
|
||||
|
||||
runCtx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
var wg sync.WaitGroup
|
||||
var readerErr error
|
||||
|
||||
// Reader goroutine. Doesn't close the events channel because external
|
||||
// callers (BucketBootstrapper) also write to it; the dispatcher exits
|
||||
// on runCtx cancellation rather than channel close.
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
readerErr = rd.Run(runCtx, p.FilerClient, p.ClientName, p.ClientID)
|
||||
if readerErr != nil && !isCtxShutdown(readerErr) {
|
||||
glog.Errorf("lifecycle reader: shards=%v: %v", shardIDs, readerErr)
|
||||
}
|
||||
cancel() // wake the dispatcher goroutine to drain & exit
|
||||
}()
|
||||
|
||||
lister := &filerSiblingLister{client: p.FilerClient, bucketsPath: p.BucketsPath}
|
||||
|
||||
// Router/dispatcher goroutine: pulls events, routes them to per-shard
|
||||
// schedules, ticks every shard's dispatcher on the same cadence, and
|
||||
// checkpoints every shard's cursor on the checkpoint cadence. One
|
||||
// goroutine handles all shards — there is no fan-out per shard.
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
dispatchTick := p.DispatchTick
|
||||
if dispatchTick <= 0 {
|
||||
dispatchTick = defaultDispatchTick
|
||||
}
|
||||
checkpointTick := p.CheckpointTick
|
||||
if checkpointTick <= 0 {
|
||||
checkpointTick = defaultCheckpointTick
|
||||
}
|
||||
dt := time.NewTicker(dispatchTick)
|
||||
defer dt.Stop()
|
||||
ct := time.NewTicker(checkpointTick)
|
||||
defer ct.Stop()
|
||||
|
||||
drainAll := func() {
|
||||
drainCtx, drainCancel := context.WithTimeout(context.Background(), shutdownDrainTimeout)
|
||||
defer drainCancel()
|
||||
now := time.Now()
|
||||
for _, st := range states {
|
||||
st.dispatch.Tick(drainCtx, now)
|
||||
}
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-runCtx.Done():
|
||||
drainAll()
|
||||
return
|
||||
case ev, ok := <-events:
|
||||
if !ok {
|
||||
drainAll()
|
||||
return
|
||||
}
|
||||
st := states[ev.ShardID]
|
||||
if st == nil {
|
||||
continue
|
||||
}
|
||||
stats.S3LifecycleEventCounter.WithLabelValues(strconv.Itoa(ev.ShardID)).Inc()
|
||||
// Always re-fetch the snapshot — caching it across events
|
||||
// means an event arriving between dispatch ticks routes
|
||||
// against a stale snap. With bootstrap injection, events
|
||||
// often land within the same dispatch interval as the
|
||||
// engine.Compile that introduced their bucket; routing
|
||||
// against the prior (empty) snapshot would silently drop
|
||||
// every match. Engine.Snapshot is an atomic Load.
|
||||
snap := p.Engine.Snapshot()
|
||||
for _, m := range router.Route(runCtx, snap, ev, time.Now(), lister) {
|
||||
st.dispatch.Schedule.Add(m)
|
||||
}
|
||||
case <-dt.C:
|
||||
now := time.Now()
|
||||
for _, st := range states {
|
||||
st.dispatch.Tick(runCtx, now)
|
||||
st.dispatch.observeScheduleDepth()
|
||||
}
|
||||
case <-ct.C:
|
||||
for shardID, st := range states {
|
||||
if err := p.Persister.Save(runCtx, shardID, st.cursor.Snapshot()); err != nil {
|
||||
glog.Warningf("lifecycle cursor checkpoint: shard=%d: %v", shardID, err)
|
||||
}
|
||||
stats.S3LifecycleCursorMinTsNs.WithLabelValues(strconv.Itoa(shardID)).Set(float64(st.cursor.MinTsNs()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
wg.Wait()
|
||||
|
||||
// Final cursor checkpoint on graceful shutdown.
|
||||
for shardID, st := range states {
|
||||
saveCtx, saveCancel := context.WithTimeout(context.Background(), shutdownSaveTimeout)
|
||||
err := p.Persister.Save(saveCtx, shardID, st.cursor.Snapshot())
|
||||
saveCancel()
|
||||
if err != nil {
|
||||
glog.Warningf("lifecycle cursor final save: shard=%d: %v", shardID, err)
|
||||
}
|
||||
}
|
||||
|
||||
if readerErr != nil && !isCtxShutdown(readerErr) {
|
||||
return readerErr
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// isCtxShutdown reports whether err is a graceful ctx-driven shutdown
|
||||
// (Canceled or DeadlineExceeded), including the gRPC status forms that
|
||||
// don't unwrap to the std-lib ctx errors.
|
||||
func isCtxShutdown(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
|
||||
return true
|
||||
}
|
||||
if code := status.Code(err); code == codes.Canceled || code == codes.DeadlineExceeded {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package dispatcher
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strconv"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus/testutil"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/reader"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/router"
|
||||
stats_collect "github.com/seaweedfs/seaweedfs/weed/stats"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// Direct tests for dispatcher / pipeline pure helpers and their side
|
||||
// effects on the Prometheus surface. The Tick + Run integration tests
|
||||
// drive these only as one slice of a larger flow; pinning each helper
|
||||
// individually makes a regression in the helper itself fail at the
|
||||
// helper level.
|
||||
|
||||
// ---------- observeScheduleDepth ----------
|
||||
|
||||
func TestObserveScheduleDepth_ReportsScheduleLen(t *testing.T) {
|
||||
// observeScheduleDepth sets the gauge to the current Schedule.Len.
|
||||
// The dispatcher calls it on every Tick so operators can see how
|
||||
// far behind schedule the worker is. Use a distinct shard label so
|
||||
// other tests sharing the global gauge don't bleed in.
|
||||
const shard = 137
|
||||
d := &Dispatcher{ShardID: shard, Schedule: router.NewSchedule()}
|
||||
g := stats_collect.S3LifecycleScheduleDepthGauge.WithLabelValues(strconv.Itoa(shard))
|
||||
// Drop the label series at end of test so the global registry
|
||||
// doesn't accumulate stale entries across test runs in the same
|
||||
// process.
|
||||
defer stats_collect.S3LifecycleScheduleDepthGauge.DeleteLabelValues(strconv.Itoa(shard))
|
||||
|
||||
// Empty schedule -> 0.
|
||||
d.observeScheduleDepth()
|
||||
assert.Equal(t, float64(0), testutil.ToFloat64(g))
|
||||
|
||||
// Adding two matches lifts the gauge to 2 on the next observe.
|
||||
t0 := time.Now()
|
||||
d.Schedule.Add(router.Match{DueTime: t0})
|
||||
d.Schedule.Add(router.Match{DueTime: t0.Add(time.Second)})
|
||||
d.observeScheduleDepth()
|
||||
assert.Equal(t, float64(2), testutil.ToFloat64(g))
|
||||
|
||||
// Draining drops it back to 0; Tick would re-call but observe is a
|
||||
// pure setter so we drive it manually here.
|
||||
_ = d.Schedule.Drain(t0.Add(2 * time.Second))
|
||||
d.observeScheduleDepth()
|
||||
assert.Equal(t, float64(0), testutil.ToFloat64(g))
|
||||
}
|
||||
|
||||
// ---------- ensureEventsChan ----------
|
||||
|
||||
func TestEnsureEventsChan_HonorsEventBuffer(t *testing.T) {
|
||||
p := &Pipeline{EventBuffer: 7}
|
||||
p.ensureEventsChan()
|
||||
require.NotNil(t, p.events)
|
||||
assert.Equal(t, 7, cap(p.events), "EventBuffer must size the channel")
|
||||
require.NotNil(t, p.eventsReady)
|
||||
}
|
||||
|
||||
func TestEnsureEventsChan_FallsBackToDefault(t *testing.T) {
|
||||
// EventBuffer=0 means "use the default"; non-positive must not
|
||||
// produce a zero-sized channel that would block every InjectEvent.
|
||||
p := &Pipeline{}
|
||||
p.ensureEventsChan()
|
||||
assert.Equal(t, defaultEventBuffer, cap(p.events))
|
||||
}
|
||||
|
||||
func TestEnsureEventsChan_NegativeFallsBackToDefault(t *testing.T) {
|
||||
p := &Pipeline{EventBuffer: -1}
|
||||
p.ensureEventsChan()
|
||||
assert.Equal(t, defaultEventBuffer, cap(p.events))
|
||||
}
|
||||
|
||||
func TestEnsureEventsChan_IdempotentAcrossConcurrentCallers(t *testing.T) {
|
||||
// sync.Once must guarantee a single channel allocation under
|
||||
// concurrent calls; otherwise a races would create two channels
|
||||
// and lose events on the discarded one.
|
||||
p := &Pipeline{EventBuffer: 4}
|
||||
const N = 32
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(N)
|
||||
for i := 0; i < N; i++ {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
p.ensureEventsChan()
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
require.NotNil(t, p.events)
|
||||
assert.Equal(t, 4, cap(p.events))
|
||||
}
|
||||
|
||||
// ---------- InjectEvent ----------
|
||||
|
||||
func TestInjectEvent_DeliversToEventsChannel(t *testing.T) {
|
||||
p := &Pipeline{EventBuffer: 1}
|
||||
ev := &reader.Event{Bucket: "bk", Key: "k"}
|
||||
require.NoError(t, p.InjectEvent(context.Background(), ev))
|
||||
|
||||
select {
|
||||
case got := <-p.events:
|
||||
assert.Same(t, ev, got, "InjectEvent must deliver the same pointer")
|
||||
default:
|
||||
t.Fatal("event was not enqueued")
|
||||
}
|
||||
}
|
||||
|
||||
func TestInjectEvent_ReturnsCtxErrWhenCanceled(t *testing.T) {
|
||||
// A canceled context must propagate the cancellation; otherwise
|
||||
// the bootstrap walker could keep injecting after the worker is
|
||||
// shutting down. ensureEventsChan clamps EventBuffer<=0 to the
|
||||
// default, so to force the select to actually block we pre-fill
|
||||
// the buffer (size 1) and then send into the canceled context.
|
||||
p := &Pipeline{EventBuffer: 1}
|
||||
require.NoError(t, p.InjectEvent(context.Background(), &reader.Event{}))
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
err := p.InjectEvent(ctx, &reader.Event{})
|
||||
require.Error(t, err)
|
||||
assert.ErrorIs(t, err, context.Canceled)
|
||||
}
|
||||
|
||||
func TestInjectEvent_EnsureEventsChanCalledIfFirstCall(t *testing.T) {
|
||||
// InjectEvent must call ensureEventsChan internally so a caller can
|
||||
// inject before Run starts (e.g. bootstrap walks that fire before
|
||||
// the reader is up). Pin that the channel exists post-call.
|
||||
p := &Pipeline{}
|
||||
require.Nil(t, p.events, "preconditions: events not yet allocated")
|
||||
require.NoError(t, p.InjectEvent(context.Background(), &reader.Event{}))
|
||||
require.NotNil(t, p.events, "InjectEvent must allocate the channel via ensureEventsChan")
|
||||
}
|
||||
|
||||
// ---------- isCtxShutdown ----------
|
||||
|
||||
func TestIsCtxShutdown_NilIsNotShutdown(t *testing.T) {
|
||||
assert.False(t, isCtxShutdown(nil))
|
||||
}
|
||||
|
||||
func TestIsCtxShutdown_ContextCanceledIsShutdown(t *testing.T) {
|
||||
assert.True(t, isCtxShutdown(context.Canceled))
|
||||
assert.True(t, isCtxShutdown(context.DeadlineExceeded))
|
||||
}
|
||||
|
||||
func TestIsCtxShutdown_GRPCCanceledStatusIsShutdown(t *testing.T) {
|
||||
// Filer / S3 RPCs can come back wrapped as gRPC status codes; the
|
||||
// helper must recognize Canceled / DeadlineExceeded by code so a
|
||||
// shutdown doesn't get misclassified as a transport failure.
|
||||
assert.True(t, isCtxShutdown(status.Error(codes.Canceled, "client closed")))
|
||||
assert.True(t, isCtxShutdown(status.Error(codes.DeadlineExceeded, "stream timeout")))
|
||||
}
|
||||
|
||||
func TestIsCtxShutdown_OtherErrorsAreNotShutdown(t *testing.T) {
|
||||
// A garden-variety transport error must NOT classify as shutdown;
|
||||
// otherwise the worker would silently swallow real failures.
|
||||
assert.False(t, isCtxShutdown(errors.New("connection refused")))
|
||||
assert.False(t, isCtxShutdown(status.Error(codes.Unavailable, "filer down")))
|
||||
assert.False(t, isCtxShutdown(status.Error(codes.Internal, "boom")))
|
||||
}
|
||||
|
||||
// ---------- cursorFileName ----------
|
||||
|
||||
func TestCursorFileName_PadsShardIDToTwoDigits(t *testing.T) {
|
||||
// The persister stores per-shard cursor files at predictable paths
|
||||
// so a manual operator inspection finds them sorted by shard. Pin
|
||||
// the zero-padded form so a refactor that drops %02d doesn't break
|
||||
// existing on-disk filenames.
|
||||
cases := map[int]string{
|
||||
0: "shard-00.json",
|
||||
1: "shard-01.json",
|
||||
9: "shard-09.json",
|
||||
10: "shard-10.json",
|
||||
15: "shard-15.json",
|
||||
}
|
||||
for shard, want := range cases {
|
||||
t.Run(want, func(t *testing.T) {
|
||||
assert.Equal(t, want, cursorFileName(shard))
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package dispatcher
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/s3_lifecycle_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/engine"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/reader"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/router"
|
||||
)
|
||||
|
||||
// TestPipelineIntegrationInMemory exercises router + dispatcher end-to-end
|
||||
// without the Reader (which requires a live filer client). The Reader's
|
||||
// behavior is covered separately in the reader package; this test pins the
|
||||
// composition: an event flows through Route -> Schedule -> Dispatcher and
|
||||
// the cursor advances on a successful RPC.
|
||||
func TestPipelineIntegrationInMemory(t *testing.T) {
|
||||
rule := &s3lifecycle.Rule{ID: "r", Status: s3lifecycle.StatusEnabled, ExpirationDays: 1}
|
||||
hash := s3lifecycle.RuleHash(rule)
|
||||
prior := map[s3lifecycle.ActionKey]engine.PriorState{}
|
||||
for _, k := range s3lifecycle.RuleActionKinds(rule) {
|
||||
prior[s3lifecycle.ActionKey{Bucket: "bk", RuleHash: hash, ActionKind: k}] = engine.PriorState{
|
||||
BootstrapComplete: true,
|
||||
Mode: engine.ModeEventDriven,
|
||||
}
|
||||
}
|
||||
e := engine.New()
|
||||
snap := e.Compile([]engine.CompileInput{{Bucket: "bk", Rules: []*s3lifecycle.Rule{rule}}},
|
||||
engine.CompileOptions{PriorStates: prior})
|
||||
|
||||
now := time.Now()
|
||||
old := now.Add(-48 * time.Hour)
|
||||
|
||||
ev := &reader.Event{
|
||||
TsNs: old.UnixNano(),
|
||||
Bucket: "bk",
|
||||
Key: "obj.txt",
|
||||
NewEntry: &filer_pb.Entry{
|
||||
Name: "obj.txt",
|
||||
Attributes: &filer_pb.FuseAttributes{
|
||||
Mtime: old.Unix(),
|
||||
FileSize: 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
matches := router.Route(context.Background(), snap, ev, now, nil)
|
||||
if len(matches) != 1 {
|
||||
t.Fatalf("expected 1 match, got %v", matches)
|
||||
}
|
||||
|
||||
client := &fakeClient{
|
||||
respond: func(int) (*s3_lifecycle_pb.LifecycleDeleteResponse, error) {
|
||||
return &s3_lifecycle_pb.LifecycleDeleteResponse{
|
||||
Outcome: s3_lifecycle_pb.LifecycleDeleteOutcome_DONE,
|
||||
}, nil
|
||||
},
|
||||
}
|
||||
d, sched := newDispatcher(client)
|
||||
d.ShardID = s3lifecycle.ShardID("bk", "obj.txt")
|
||||
for _, m := range matches {
|
||||
sched.Add(m)
|
||||
}
|
||||
|
||||
processed := d.Tick(context.Background(), now.Add(time.Hour)) // past DueTime
|
||||
if processed != 1 {
|
||||
t.Fatalf("Tick processed=%d, want 1", processed)
|
||||
}
|
||||
if d.Cursor.Get(matches[0].Key) != ev.TsNs {
|
||||
t.Fatalf("cursor not at event TsNs: %d", d.Cursor.Get(matches[0].Key))
|
||||
}
|
||||
}
|
||||
|
||||
func TestPipelineRunRequiresDependencies(t *testing.T) {
|
||||
p := &Pipeline{}
|
||||
err := p.Run(context.Background())
|
||||
if err == nil {
|
||||
t.Fatal("expected error for empty Pipeline")
|
||||
}
|
||||
}
|
||||
|
||||
// stubFilerClient satisfies filer_pb.SeaweedFilerClient just enough to
|
||||
// pass the nil-check in Pipeline.Run; methods would panic if called,
|
||||
// but the validation tests below all return before any RPC.
|
||||
type stubFilerClient struct {
|
||||
filer_pb.SeaweedFilerClient
|
||||
}
|
||||
|
||||
// fullPipeline assembles a Pipeline whose dependencies all pass the
|
||||
// nil-check, so individual tests can knock out one piece at a time
|
||||
// to exercise specific validation branches.
|
||||
func fullPipeline() *Pipeline {
|
||||
return &Pipeline{
|
||||
Engine: engine.New(),
|
||||
Persister: reader.NewInMemoryPersister(),
|
||||
Client: &fakeClient{},
|
||||
FilerClient: &stubFilerClient{},
|
||||
BucketsPath: "/buckets",
|
||||
ShardID: 0,
|
||||
}
|
||||
}
|
||||
|
||||
func TestPipelineRunValidation(t *testing.T) {
|
||||
// Each case mutates one piece of a fullPipeline() and asserts the
|
||||
// expected error fragment. Per-dependency cases pin that the nil
|
||||
// check exercises every required field individually; the Buckets-
|
||||
// Path case asserts the distinct error message; the shard cases
|
||||
// pin the half-open [0, ShardCount) range and that any one bad
|
||||
// entry refuses the whole multi-shard run.
|
||||
cases := []struct {
|
||||
name string
|
||||
mutate func(*Pipeline)
|
||||
wantErr string
|
||||
}{
|
||||
{"missing Engine", func(p *Pipeline) { p.Engine = nil }, "missing required dependency"},
|
||||
{"missing Persister", func(p *Pipeline) { p.Persister = nil }, "missing required dependency"},
|
||||
{"missing Client", func(p *Pipeline) { p.Client = nil }, "missing required dependency"},
|
||||
{"missing FilerClient", func(p *Pipeline) { p.FilerClient = nil }, "missing required dependency"},
|
||||
{"missing BucketsPath", func(p *Pipeline) { p.BucketsPath = "" }, "BucketsPath required"},
|
||||
{"negative ShardID", func(p *Pipeline) { p.ShardID = -1 }, "out of"},
|
||||
{"ShardID at boundary", func(p *Pipeline) { p.ShardID = s3lifecycle.ShardCount }, "out of"},
|
||||
{"multi-shard out of range", func(p *Pipeline) {
|
||||
p.Shards = []int{0, 1, s3lifecycle.ShardCount + 1}
|
||||
}, "out of"},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
p := fullPipeline()
|
||||
tc.mutate(p)
|
||||
err := p.Run(context.Background())
|
||||
if err == nil || !strings.Contains(err.Error(), tc.wantErr) {
|
||||
t.Fatalf("expected error containing %q, got %v", tc.wantErr, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package dispatcher
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/s3_lifecycle_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/router"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// toProtoActionKind / toProtoIdentity are the worker-side CAS-witness
|
||||
// converters; getting them wrong silently breaks the LifecycleDelete
|
||||
// flow because the server's identity check always fails. These tests
|
||||
// pin the full mapping so a new ActionKind added in s3lifecycle but
|
||||
// forgotten here can't slip through as ACTION_KIND_UNSPECIFIED.
|
||||
|
||||
func TestToProtoActionKind_AllKnownKindsMap(t *testing.T) {
|
||||
cases := []struct {
|
||||
in s3lifecycle.ActionKind
|
||||
want s3_lifecycle_pb.ActionKind
|
||||
}{
|
||||
{s3lifecycle.ActionKindExpirationDays, s3_lifecycle_pb.ActionKind_EXPIRATION_DAYS},
|
||||
{s3lifecycle.ActionKindExpirationDate, s3_lifecycle_pb.ActionKind_EXPIRATION_DATE},
|
||||
{s3lifecycle.ActionKindNoncurrentDays, s3_lifecycle_pb.ActionKind_NONCURRENT_DAYS},
|
||||
{s3lifecycle.ActionKindNewerNoncurrent, s3_lifecycle_pb.ActionKind_NEWER_NONCURRENT},
|
||||
{s3lifecycle.ActionKindAbortMPU, s3_lifecycle_pb.ActionKind_ABORT_MPU},
|
||||
{s3lifecycle.ActionKindExpiredDeleteMarker, s3_lifecycle_pb.ActionKind_EXPIRED_DELETE_MARKER},
|
||||
}
|
||||
for _, c := range cases {
|
||||
t.Run(c.in.String(), func(t *testing.T) {
|
||||
assert.Equal(t, c.want, toProtoActionKind(c.in))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestToProtoActionKind_UnspecifiedAndUnknownFallToUnspecified(t *testing.T) {
|
||||
// Both the in-package zero value and a future kind not listed in
|
||||
// the switch must collapse to ACTION_KIND_UNSPECIFIED so the server
|
||||
// can reject with FATAL rather than silently dispatch a wrong kind.
|
||||
assert.Equal(t, s3_lifecycle_pb.ActionKind_ACTION_KIND_UNSPECIFIED,
|
||||
toProtoActionKind(s3lifecycle.ActionKindUnspecified))
|
||||
assert.Equal(t, s3_lifecycle_pb.ActionKind_ACTION_KIND_UNSPECIFIED,
|
||||
toProtoActionKind(s3lifecycle.ActionKind(999)))
|
||||
}
|
||||
|
||||
func TestToProtoIdentity_NilReturnsNil(t *testing.T) {
|
||||
// LifecycleDelete treats a nil ExpectedIdentity as "no CAS"; the
|
||||
// converter must preserve that signal rather than emit an empty
|
||||
// non-nil identity that would force a re-fetch + comparison.
|
||||
assert.Nil(t, toProtoIdentity(nil))
|
||||
}
|
||||
|
||||
func TestToProtoIdentity_AllFieldsCopied(t *testing.T) {
|
||||
in := &router.EntryIdentity{
|
||||
MtimeNs: 1700000000_000_000_123,
|
||||
Size: 4096,
|
||||
HeadFid: "1,abc",
|
||||
ExtendedHash: []byte{0xde, 0xad, 0xbe, 0xef},
|
||||
}
|
||||
out := toProtoIdentity(in)
|
||||
if out == nil {
|
||||
t.Fatal("non-nil input must produce non-nil output")
|
||||
}
|
||||
assert.Equal(t, in.MtimeNs, out.MtimeNs)
|
||||
assert.Equal(t, in.Size, out.Size)
|
||||
assert.Equal(t, in.HeadFid, out.HeadFid)
|
||||
assert.Equal(t, in.ExtendedHash, out.ExtendedHash)
|
||||
}
|
||||
|
||||
func TestToProtoIdentity_EmptyFieldsSurvive(t *testing.T) {
|
||||
// A bootstrap-fresh entry can land at the dispatcher with zero
|
||||
// MtimeNs / Size / no HeadFid — the converter must still produce a
|
||||
// non-nil identity so the server treats it as a real CAS witness
|
||||
// rather than the no-CAS sentinel.
|
||||
in := &router.EntryIdentity{}
|
||||
out := toProtoIdentity(in)
|
||||
if out == nil {
|
||||
t.Fatal("zero-valued identity must still produce non-nil")
|
||||
}
|
||||
assert.Zero(t, out.MtimeNs)
|
||||
assert.Zero(t, out.Size)
|
||||
assert.Empty(t, out.HeadFid)
|
||||
assert.Empty(t, out.ExtendedHash)
|
||||
}
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// Layer 2 contracts the daily-replay drain relies on. These augment
|
||||
// Layer 2 contracts the dispatcher pipeline relies on. These augment
|
||||
// reader_test.go (extract + dispatch) and cursor_test.go (Advance +
|
||||
// Freeze) by pinning the cursor composition surface that the daily-run
|
||||
// drain depends on for resume-point selection, checkpoint persistence,
|
||||
// and Run-time input validation.
|
||||
// Freeze) by pinning the cursor composition surface that
|
||||
// dispatcher.Pipeline depends on for resume-point selection,
|
||||
// checkpoint persistence, and Run-time input validation.
|
||||
|
||||
func TestCursorMinTsNsWithFrozenKeysIncluded(t *testing.T) {
|
||||
// MinTsNs is the resume point Reader.Run feeds to SubscribeMetadata
|
||||
|
||||
@@ -0,0 +1,487 @@
|
||||
package scheduler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/reader"
|
||||
"github.com/seaweedfs/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
// EventInjector is the bootstrap-side hook into the dispatcher pipeline.
|
||||
// One implementation routes events to the right per-shard pipeline; the
|
||||
// shell's single-pipeline path passes pipeline.InjectEvent directly.
|
||||
type EventInjector interface {
|
||||
InjectEvent(ctx context.Context, ev *reader.Event) error
|
||||
}
|
||||
|
||||
// listPageSize is the page size for paginated directory listings during
|
||||
// the bucket walk. The filer caps SeaweedList(..., limit=0) at
|
||||
// DirListingLimit (1000 by default) per call, so a single-page list
|
||||
// would silently truncate large directories — a correctness bug for
|
||||
// noncurrent retention since older versions past the page boundary
|
||||
// would never reach the rank/sort math. Atomic so tests can shrink it
|
||||
// without racing the async bootstrap goroutines other tests leave
|
||||
// behind (KickOffNew dispatches walks via `go b.walkBucket(...)`,
|
||||
// and a fresh test's Cleanup might land before those goroutines exit).
|
||||
var listPageSize atomic.Uint32
|
||||
|
||||
func init() {
|
||||
listPageSize.Store(1024)
|
||||
}
|
||||
|
||||
// listAll issues paginated SeaweedList calls until the listing is
|
||||
// exhausted, invoking fn for every entry. Pagination uses
|
||||
// startFrom = lastEntryName (exclusive) to advance.
|
||||
func listAll(ctx context.Context, client filer_pb.SeaweedFilerClient, dir string, fn func(*filer_pb.Entry) error) error {
|
||||
pageSize := listPageSize.Load()
|
||||
startFrom := ""
|
||||
for {
|
||||
var pageCount uint32
|
||||
var lastName string
|
||||
if err := filer_pb.SeaweedList(ctx, client, dir, "", func(e *filer_pb.Entry, _ bool) error {
|
||||
pageCount++
|
||||
if e != nil {
|
||||
lastName = e.Name
|
||||
}
|
||||
return fn(e)
|
||||
}, startFrom, false, pageSize); err != nil {
|
||||
return err
|
||||
}
|
||||
if pageCount < pageSize {
|
||||
return nil
|
||||
}
|
||||
startFrom = lastName
|
||||
}
|
||||
}
|
||||
|
||||
// BucketBootstrapper backfills already-existing entries when a freshly-PUT
|
||||
// rule's bucket appears in the engine. The reader-driven path only sees
|
||||
// meta-log events created after the rule lands; without this walk,
|
||||
// objects PUT before the rule would never expire.
|
||||
//
|
||||
// Per bucket: one one-shot goroutine that lists every entry under
|
||||
// /buckets/<bucket> and synthesizes a *reader.Event for each one. The
|
||||
// pipeline's existing router.Route + Schedule machinery handles the rest:
|
||||
// currently-due matches fire on the next dispatch tick, and not-yet-due
|
||||
// matches sit in the per-shard schedule until their DueTime arrives.
|
||||
//
|
||||
// Synthesized events carry TsNs=0 so dispatcher.advance is a no-op for
|
||||
// them — the reader still resumes from its persisted cursor on restart.
|
||||
//
|
||||
// Walk state is tracked in-memory per process via two maps:
|
||||
// - lastCompleted: time of the last successful walk, drives the
|
||||
// BootstrapInterval cadence; zero interval means "walk once per
|
||||
// process".
|
||||
// - inFlight: buckets whose walk goroutines are still running.
|
||||
// Skipped regardless of cadence so a walk that takes longer than
|
||||
// BootstrapInterval can't trigger a duplicate goroutine on the
|
||||
// next refresh.
|
||||
type BucketBootstrapper struct {
|
||||
FilerClient filer_pb.SeaweedFilerClient
|
||||
BucketsPath string
|
||||
Injector EventInjector
|
||||
|
||||
// BootstrapInterval gates re-walks. Zero means "walk once per
|
||||
// process". Non-zero means "walk again once it's been at least
|
||||
// this long since the last completed walk" — the cadence scan_only
|
||||
// actions rely on, since they can only fire from bootstrap.
|
||||
BootstrapInterval time.Duration
|
||||
|
||||
// Now overrides time.Now for tests.
|
||||
Now func() time.Time
|
||||
|
||||
mu sync.Mutex
|
||||
lastCompleted map[string]time.Time
|
||||
inFlight map[string]bool
|
||||
}
|
||||
|
||||
func (b *BucketBootstrapper) now() time.Time {
|
||||
if b.Now != nil {
|
||||
return b.Now()
|
||||
}
|
||||
return time.Now()
|
||||
}
|
||||
|
||||
// KickOffNew launches a one-shot walker goroutine for every bucket
|
||||
// that's not currently in flight and either has never completed a walk
|
||||
// or whose last successful walk finished more than BootstrapInterval ago.
|
||||
func (b *BucketBootstrapper) KickOffNew(ctx context.Context, buckets []string) {
|
||||
if b.Injector == nil {
|
||||
return
|
||||
}
|
||||
now := b.now()
|
||||
b.mu.Lock()
|
||||
if b.lastCompleted == nil {
|
||||
b.lastCompleted = map[string]time.Time{}
|
||||
}
|
||||
if b.inFlight == nil {
|
||||
b.inFlight = map[string]bool{}
|
||||
}
|
||||
fresh := make([]string, 0, len(buckets))
|
||||
for _, bucket := range buckets {
|
||||
if b.inFlight[bucket] {
|
||||
// Walk still running from an earlier KickOffNew — never
|
||||
// double up regardless of cadence. A large bucket that
|
||||
// takes longer than BootstrapInterval would otherwise
|
||||
// have a fresh goroutine fire on every refresh tick.
|
||||
continue
|
||||
}
|
||||
if last, ok := b.lastCompleted[bucket]; ok {
|
||||
if b.BootstrapInterval <= 0 || now.Sub(last) < b.BootstrapInterval {
|
||||
continue
|
||||
}
|
||||
}
|
||||
b.inFlight[bucket] = true
|
||||
fresh = append(fresh, bucket)
|
||||
}
|
||||
b.mu.Unlock()
|
||||
|
||||
for _, bucket := range fresh {
|
||||
bucket := bucket
|
||||
go b.walkBucket(ctx, bucket)
|
||||
}
|
||||
}
|
||||
|
||||
func (b *BucketBootstrapper) walkBucket(ctx context.Context, bucket string) {
|
||||
root := strings.TrimSuffix(b.BucketsPath, "/") + "/" + bucket
|
||||
glog.V(0).Infof("lifecycle bootstrap: starting walk for bucket %s (root=%s)", bucket, root)
|
||||
count := 0
|
||||
// skipBare records bucket-relative bare-key paths that
|
||||
// expandVersionsDir already routed as the null version. Without it
|
||||
// the walker's regular emission would also fire for the bare entry
|
||||
// — in a versioned bucket buildObjectInfo classifies it as
|
||||
// IsLatest=true, NumVersions=0, and ExpirationDays would create a
|
||||
// stray delete marker that hides the real latest.
|
||||
skipBare := map[string]bool{}
|
||||
var cb func(entry *filer_pb.Entry, key string) error
|
||||
cb = func(entry *filer_pb.Entry, key string) error {
|
||||
if isVersionsDir(entry) {
|
||||
n, err := b.expandVersionsDir(ctx, bucket, root, key, entry, cb, skipBare)
|
||||
count += n
|
||||
return err
|
||||
}
|
||||
if !entry.IsDirectory && skipBare[key] {
|
||||
return nil
|
||||
}
|
||||
if entry.IsDirectoryKeyObject() && skipBare[key] {
|
||||
return nil
|
||||
}
|
||||
ev := &reader.Event{
|
||||
// TsNs=0 sentinel: dispatcher.advance treats <=0 as no-op,
|
||||
// so the reader's persisted cursor isn't ratcheted forward
|
||||
// past meta-log events that haven't been processed yet.
|
||||
TsNs: 0,
|
||||
Bucket: bucket,
|
||||
Key: key,
|
||||
ShardID: s3lifecycle.ShardID(bucket, key),
|
||||
NewEntry: entry,
|
||||
}
|
||||
count++
|
||||
return b.Injector.InjectEvent(ctx, ev)
|
||||
}
|
||||
walkErr := walkBucketDir(ctx, b.FilerClient, root, root, cb)
|
||||
b.mu.Lock()
|
||||
delete(b.inFlight, bucket)
|
||||
if walkErr == nil {
|
||||
// Stamp completion so BootstrapInterval cadence measures from
|
||||
// end-of-walk. Failures leave lastCompleted alone, so the next
|
||||
// KickOffNew sees no record and walks the bucket again.
|
||||
if b.lastCompleted == nil {
|
||||
b.lastCompleted = map[string]time.Time{}
|
||||
}
|
||||
b.lastCompleted[bucket] = b.now()
|
||||
}
|
||||
b.mu.Unlock()
|
||||
if walkErr != nil {
|
||||
if ctx.Err() == nil {
|
||||
glog.V(0).Infof("lifecycle bootstrap %s: %v", bucket, walkErr)
|
||||
}
|
||||
return
|
||||
}
|
||||
glog.V(0).Infof("lifecycle bootstrap: bucket %s injected %d entries", bucket, count)
|
||||
}
|
||||
|
||||
// versionItem is the per-sibling state expandVersionsDir builds: the
|
||||
// filer entry plus its version_id (or "null" for the bare null version
|
||||
// living outside .versions/). isExplicitNull marks bare entries the
|
||||
// suspended-versioning write path tagged with ExtVersionIdKey="null"
|
||||
// (s3api_object_handlers_put.go); we trust those as latest when the
|
||||
// .versions/ pointer is missing. A pre-versioning bare object has no
|
||||
// such marker, so a missing pointer there is a race window with a new
|
||||
// version write and we keep the newest-sibling fallback.
|
||||
type versionItem struct {
|
||||
entry *filer_pb.Entry
|
||||
versionID string
|
||||
bareKey string // bucket-relative path; non-empty only for the null version
|
||||
isExplicitNull bool
|
||||
}
|
||||
|
||||
// expandVersionsDir lists <root>/<key>/ and, when the children look like
|
||||
// SeaweedFS version files, injects one reader.Event per version with
|
||||
// BootstrapVersion populated. The bare logical key (the "null" version,
|
||||
// living outside .versions/) is included as a sibling so:
|
||||
// - pre-versioning objects with a newer .versions/ history fire
|
||||
// NoncurrentDays as id="null"
|
||||
// - suspended-bucket writes (which clear the .versions/ latest pointer)
|
||||
// correctly classify null as the current version while every
|
||||
// .versions/ child becomes noncurrent
|
||||
//
|
||||
// versionsKey is the bucket-relative path of the .versions/ directory
|
||||
// (e.g. "logs/foo.versions"). When the bare null version is included,
|
||||
// its bucket-relative path is added to skipBare so the walker's regular
|
||||
// emission for the same entry is suppressed.
|
||||
//
|
||||
// When no child has ExtVersionIdKey the directory is a coincidentally-
|
||||
// named user folder; recurse via fallback (the bucket walk's own cb).
|
||||
func (b *BucketBootstrapper) expandVersionsDir(ctx context.Context, bucket, root, versionsKey string, versionsEntry *filer_pb.Entry, fallback func(*filer_pb.Entry, string) error, skipBare map[string]bool) (int, error) {
|
||||
logical := strings.TrimSuffix(versionsKey, s3_constants.VersionsFolder)
|
||||
if logical == "" {
|
||||
return 0, nil
|
||||
}
|
||||
versionsDir := strings.TrimSuffix(b.BucketsPath, "/") + "/" + bucket + "/" + versionsKey
|
||||
// Collect file children only. Subdirectories under .versions/ would
|
||||
// corrupt sort/rank math; the disambiguation pass below also wants
|
||||
// to see only file-shaped children. Paginate so a hot key with
|
||||
// thousands of versions doesn't truncate at DirListingLimit.
|
||||
var children []*filer_pb.Entry
|
||||
if err := listAll(ctx, b.FilerClient, versionsDir, func(e *filer_pb.Entry) error {
|
||||
if e != nil && e.Attributes != nil && !e.IsDirectory {
|
||||
children = append(children, e)
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return 0, fmt.Errorf("list %s: %w", versionsDir, err)
|
||||
}
|
||||
items := make([]versionItem, 0, len(children)+1)
|
||||
for _, e := range children {
|
||||
if id, ok := e.Extended[s3_constants.ExtVersionIdKey]; ok && len(id) > 0 {
|
||||
items = append(items, versionItem{entry: e, versionID: string(id)})
|
||||
}
|
||||
}
|
||||
if len(items) == 0 {
|
||||
// Coincidentally-named user folder (or an empty .versions
|
||||
// container). fallback is the bucket walk's own cb so nested
|
||||
// .versions/ entries inside still expand.
|
||||
if fallback == nil {
|
||||
return 0, nil
|
||||
}
|
||||
if err := walkBucketDir(ctx, b.FilerClient, versionsDir, root, fallback); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return 0, nil
|
||||
}
|
||||
// Look up the bare null version. SeaweedFS keeps it at the logical
|
||||
// path for pre-versioning objects and for suspended-bucket writes.
|
||||
// Both shapes count: regular file (PUT'd object) and explicit S3
|
||||
// directory-key marker (object name ends in /).
|
||||
if nullEntry, nullKey, explicit, ok := b.lookupNullVersion(ctx, bucket, logical); ok {
|
||||
items = append(items, versionItem{
|
||||
entry: nullEntry,
|
||||
versionID: "null",
|
||||
bareKey: nullKey,
|
||||
isExplicitNull: explicit,
|
||||
})
|
||||
}
|
||||
// Sort newest-first: primary by mtime ns, fallback by version_id
|
||||
// (CompareVersionIds returns <0 when first arg is newer). PUTs only
|
||||
// set second-level Mtime, so collisions in the same second are
|
||||
// resolved by the canonical version-id ordering used elsewhere.
|
||||
sort.SliceStable(items, func(i, j int) bool {
|
||||
mi := items[i].entry.Attributes.Mtime*int64(1e9) + int64(items[i].entry.Attributes.MtimeNs)
|
||||
mj := items[j].entry.Attributes.Mtime*int64(1e9) + int64(items[j].entry.Attributes.MtimeNs)
|
||||
if mi != mj {
|
||||
return mi > mj
|
||||
}
|
||||
return s3lifecycle.CompareVersionIds(items[i].versionID, items[j].versionID) < 0
|
||||
})
|
||||
// Resolve latest position.
|
||||
// 1. Pointer names a real id -> that wins (in-order or backdated).
|
||||
// 2. Pointer absent + items[0] is an EXPLICIT null (suspended write
|
||||
// cleared the pointer and tagged the bare object as null, AND
|
||||
// the bare object is newest by mtime) -> null is latest.
|
||||
// 3. Pointer absent in any other shape: fall back to newest
|
||||
// sibling. Catches the post-suspended re-enable race window —
|
||||
// a fresh .versions/<v1> write whose pointer update hasn't
|
||||
// landed yet outranks the older suspended-null bare object.
|
||||
latestID := string(versionsEntry.Extended[s3_constants.ExtLatestVersionIdKey])
|
||||
latestPos := 0
|
||||
if latestID != "" {
|
||||
for i, it := range items {
|
||||
if it.versionID == latestID {
|
||||
latestPos = i
|
||||
break
|
||||
}
|
||||
}
|
||||
} else if len(items) > 0 && items[0].versionID == "null" && items[0].isExplicitNull {
|
||||
latestPos = 0
|
||||
}
|
||||
count := 0
|
||||
for i, it := range items {
|
||||
// Prefer the explicit demotion stamp written by the S3 PUT
|
||||
// handler. Falling back to the next-newer sibling's mtime is
|
||||
// the legacy derivation and stays in place for entries written
|
||||
// before the stamp was introduced.
|
||||
successor := s3lifecycle.SuccessorFromEntryStamp(it.entry)
|
||||
if successor.IsZero() && i > 0 {
|
||||
prev := items[i-1].entry.Attributes
|
||||
successor = time.Unix(prev.Mtime, int64(prev.MtimeNs))
|
||||
}
|
||||
bv := &reader.BootstrapVersion{
|
||||
LogicalKey: logical,
|
||||
VersionID: it.versionID,
|
||||
IsLatest: i == latestPos,
|
||||
IsDeleteMarker: string(it.entry.Extended[s3_constants.ExtDeleteMarkerKey]) == "true",
|
||||
NumVersions: len(items),
|
||||
SuccessorModTime: successor,
|
||||
}
|
||||
if !bv.IsLatest {
|
||||
rank := i
|
||||
if i > latestPos {
|
||||
rank = i - 1
|
||||
}
|
||||
bv.NoncurrentIndex = rank
|
||||
}
|
||||
// Event Key for bookkeeping: real version files keep the
|
||||
// .versions/<file> path; the null version uses its bare path
|
||||
// so the dispatcher's identity check resolves to the same
|
||||
// entry the walker would have emitted.
|
||||
evKey := versionsKey + "/" + it.entry.Name
|
||||
if it.versionID == "null" {
|
||||
evKey = it.bareKey
|
||||
}
|
||||
ev := &reader.Event{
|
||||
TsNs: 0,
|
||||
Bucket: bucket,
|
||||
Key: evKey,
|
||||
ShardID: s3lifecycle.ShardID(bucket, logical),
|
||||
NewEntry: it.entry,
|
||||
BootstrapVersion: bv,
|
||||
}
|
||||
if err := b.Injector.InjectEvent(ctx, ev); err != nil {
|
||||
return count, err
|
||||
}
|
||||
if it.versionID == "null" && skipBare != nil {
|
||||
skipBare[it.bareKey] = true
|
||||
}
|
||||
count++
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
// lookupNullVersion returns the bare-key entry that represents the null
|
||||
// version of logical, if any. Both regular files and S3 directory-key
|
||||
// markers (an empty directory entry with Mime set) qualify. The
|
||||
// explicit return reports whether the entry's Extended map carries
|
||||
// ExtVersionIdKey == "null" — the marker the suspended-versioning
|
||||
// write path applies (s3api_object_handlers_put.go). bucketRelKey is
|
||||
// the bucket-relative path the walker would otherwise emit, so the
|
||||
// caller can suppress the duplicate.
|
||||
func (b *BucketBootstrapper) lookupNullVersion(ctx context.Context, bucket, logical string) (entry *filer_pb.Entry, bucketRelKey string, explicit bool, ok bool) {
|
||||
bucketPath := strings.TrimSuffix(b.BucketsPath, "/") + "/" + bucket
|
||||
parent, name := util.NewFullPath(bucketPath, logical).DirAndName()
|
||||
resp, err := filer_pb.LookupEntry(ctx, b.FilerClient, &filer_pb.LookupDirectoryEntryRequest{
|
||||
Directory: parent,
|
||||
Name: name,
|
||||
})
|
||||
if err != nil || resp == nil || resp.Entry == nil {
|
||||
return nil, "", false, false
|
||||
}
|
||||
e := resp.Entry
|
||||
if e.IsDirectory && !e.IsDirectoryKeyObject() {
|
||||
return nil, "", false, false
|
||||
}
|
||||
if id, hasID := e.Extended[s3_constants.ExtVersionIdKey]; hasID && string(id) == "null" {
|
||||
explicit = true
|
||||
}
|
||||
return e, strings.TrimPrefix(parent+"/"+name, bucketPath+"/"), explicit, true
|
||||
}
|
||||
|
||||
// walkBucketDir streams entries under dir and invokes cb. Two kinds of
|
||||
// directories are emitted whole rather than recursed into:
|
||||
// - .uploads/<id> MPU init dirs (router fires ABORT_MPU off the dir entry)
|
||||
// - <key>.versions/ directories (caller expands them into per-version
|
||||
// events; recursing here would emit individual version files without
|
||||
// the sibling state needed for NoncurrentDays / NewerNoncurrent)
|
||||
//
|
||||
// .versions/ dirs are processed before everything else at each level so
|
||||
// the cb's expandVersionsDir call can record the bare null-version key
|
||||
// in the walk-shared skip set before the same level emits the bare entry.
|
||||
// Two streaming passes (rather than buffering the whole directory) trade
|
||||
// a second listing for bounded memory on flat buckets with millions of
|
||||
// entries.
|
||||
func walkBucketDir(ctx context.Context, client filer_pb.SeaweedFilerClient, dir, bucketRoot string, cb func(entry *filer_pb.Entry, key string) error) error {
|
||||
// Pass 1: .versions/ dirs only.
|
||||
if err := listAll(ctx, client, dir, func(e *filer_pb.Entry) error {
|
||||
if e == nil || e.Attributes == nil {
|
||||
return nil
|
||||
}
|
||||
if !e.IsDirectory || !isVersionsDir(e) {
|
||||
return nil
|
||||
}
|
||||
full := dir + "/" + e.Name
|
||||
key := strings.TrimPrefix(full, bucketRoot+"/")
|
||||
return cb(e, key)
|
||||
}); err != nil {
|
||||
return fmt.Errorf("list %s: %w", dir, err)
|
||||
}
|
||||
// Pass 2: everything else. Bare entries whose name was claimed by
|
||||
// a sibling .versions/ expansion are dropped by the cb's skip-set.
|
||||
return listAll(ctx, client, dir, func(e *filer_pb.Entry) error {
|
||||
if e == nil || e.Attributes == nil {
|
||||
return nil
|
||||
}
|
||||
if e.IsDirectory && isVersionsDir(e) {
|
||||
return nil
|
||||
}
|
||||
full := dir + "/" + e.Name
|
||||
key := strings.TrimPrefix(full, bucketRoot+"/")
|
||||
if e.IsDirectory {
|
||||
if isMPUInitDir(key, e) {
|
||||
return cb(e, key)
|
||||
}
|
||||
return walkBucketDir(ctx, client, full, bucketRoot, cb)
|
||||
}
|
||||
return cb(e, key)
|
||||
})
|
||||
}
|
||||
|
||||
// isMPUInitDir mirrors router.mpuInitInfo: a directory at .uploads/<id>
|
||||
// carrying the destination key in Extended is the MPU init record. The
|
||||
// router helper is package-private so this is duplicated rather than
|
||||
// adding a public extraction API just for this caller.
|
||||
func isMPUInitDir(key string, entry *filer_pb.Entry) bool {
|
||||
uploadsPrefix := s3_constants.MultipartUploadsFolder + "/"
|
||||
if !strings.HasPrefix(key, uploadsPrefix) {
|
||||
return false
|
||||
}
|
||||
rest := key[len(uploadsPrefix):]
|
||||
if rest == "" || strings.ContainsRune(rest, '/') {
|
||||
return false
|
||||
}
|
||||
v, ok := entry.Extended[s3_constants.ExtMultipartObjectKey]
|
||||
return ok && len(v) > 0
|
||||
}
|
||||
|
||||
// isVersionsDir matches `<x>.versions/` by name suffix. We can't gate on
|
||||
// ExtLatestVersionIdKey here: createDeleteMarker writes the version file
|
||||
// before updating the parent's Extended pointer, so a walk that races
|
||||
// with that update would see the directory without the pointer and
|
||||
// recurse into raw version files, losing the sibling state needed for
|
||||
// noncurrent rules. expandVersionsDir handles disambiguation by
|
||||
// inspecting children for ExtVersionIdKey; coincidentally-named
|
||||
// directories that aren't real .versions storage fall through to a
|
||||
// regular recursion.
|
||||
func isVersionsDir(entry *filer_pb.Entry) bool {
|
||||
return entry.IsDirectory && strings.HasSuffix(entry.Name, s3_constants.VersionsFolder)
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,77 @@
|
||||
package scheduler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/dispatcher"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/reader"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// pipelineFanout is the thin shard-routing layer the bootstrapper sees
|
||||
// as an EventInjector. It maps Event.ShardID to the pipeline that owns
|
||||
// that shard. Was previously at 0% coverage.
|
||||
|
||||
func TestPipelineFanout_NilEventIsNoOp(t *testing.T) {
|
||||
// A nil event must be silently absorbed; otherwise a follow-up
|
||||
// panic in the receiving pipeline would crash the bootstrapper.
|
||||
f := pipelineFanout{}
|
||||
assert.NoError(t, f.InjectEvent(context.Background(), nil))
|
||||
}
|
||||
|
||||
func TestPipelineFanout_UnknownShardIsNoOp(t *testing.T) {
|
||||
// A shard not covered by any pipeline in the fanout returns nil
|
||||
// rather than erroring; the comment in scheduler.go documents this
|
||||
// as forward-compat for future shard-mapping changes that might
|
||||
// introduce gaps.
|
||||
f := pipelineFanout{0: &dispatcher.Pipeline{EventBuffer: 1}}
|
||||
assert.NoError(t, f.InjectEvent(context.Background(), &reader.Event{ShardID: 99}))
|
||||
}
|
||||
|
||||
func TestPipelineFanout_KnownShardSucceeds(t *testing.T) {
|
||||
// A matching shard reaches the pipeline's InjectEvent, which writes
|
||||
// to its (buffered) events channel and returns nil.
|
||||
f := pipelineFanout{0: &dispatcher.Pipeline{EventBuffer: 1}}
|
||||
assert.NoError(t, f.InjectEvent(context.Background(), &reader.Event{ShardID: 0}))
|
||||
}
|
||||
|
||||
func TestPipelineFanout_PropagatesContextCancellation(t *testing.T) {
|
||||
// When the underlying pipeline's InjectEvent blocks on a full
|
||||
// buffer and the ctx is canceled, the fanout must propagate the
|
||||
// ctx error. Pre-fill the pipeline's buffer (size 1) so the second
|
||||
// send blocks long enough for the cancellation to win the select.
|
||||
p := &dispatcher.Pipeline{EventBuffer: 1}
|
||||
require.NoError(t, p.InjectEvent(context.Background(), &reader.Event{}))
|
||||
f := pipelineFanout{0: p}
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
err := f.InjectEvent(ctx, &reader.Event{ShardID: 0})
|
||||
require.Error(t, err)
|
||||
assert.ErrorIs(t, err, context.Canceled)
|
||||
}
|
||||
|
||||
func TestPipelineFanout_RoutesToCorrectPipeline(t *testing.T) {
|
||||
// Two pipelines, each with buffer=1: an event for shard 7 must
|
||||
// fill pipeline B's buffer (proven by the second send to that
|
||||
// pipeline blocking with canceled ctx) without affecting pipeline
|
||||
// A's buffer (proven by the third send still succeeding to A
|
||||
// because A's buffer is still empty).
|
||||
pA := &dispatcher.Pipeline{EventBuffer: 1}
|
||||
pB := &dispatcher.Pipeline{EventBuffer: 1}
|
||||
f := pipelineFanout{0: pA, 7: pB}
|
||||
|
||||
require.NoError(t, f.InjectEvent(context.Background(), &reader.Event{ShardID: 7}))
|
||||
|
||||
// Second send to shard 7 would block on the full buffer; use a
|
||||
// pre-canceled ctx to detect the buffer-full state without hanging.
|
||||
canceledCtx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
err := f.InjectEvent(canceledCtx, &reader.Event{ShardID: 7})
|
||||
require.Error(t, err, "B's buffer should be full so a canceled-ctx send returns ctx.Err")
|
||||
|
||||
// Send to shard 0 still succeeds because A's buffer is untouched.
|
||||
require.NoError(t, f.InjectEvent(context.Background(), &reader.Event{ShardID: 0}))
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
//go:build !s3tests
|
||||
|
||||
package scheduler
|
||||
|
||||
import "time"
|
||||
|
||||
const defaultRefreshInterval = 5 * time.Minute
|
||||
@@ -0,0 +1,9 @@
|
||||
//go:build s3tests
|
||||
|
||||
package scheduler
|
||||
|
||||
import "time"
|
||||
|
||||
// Under the s3tests build tag rules are PUT and expected to fire within
|
||||
// seconds, so the engine snapshot is rebuilt aggressively.
|
||||
const defaultRefreshInterval = 2 * time.Second
|
||||
@@ -0,0 +1,222 @@
|
||||
package scheduler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/dispatcher"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/engine"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3lifecycle/reader"
|
||||
)
|
||||
|
||||
// defaultRefreshInterval lives in refresh_*.go so the s3tests build can
|
||||
// shrink the engine-rebuild cadence to seconds.
|
||||
const (
|
||||
defaultRetryBackoff = 5 * time.Second
|
||||
)
|
||||
|
||||
// Scheduler runs N pipeline goroutines, one per worker, each owning a
|
||||
// contiguous shard slice of [0, ShardCount). It periodically rebuilds the
|
||||
// engine snapshot from the filer's bucket configs.
|
||||
type Scheduler struct {
|
||||
BucketsPath string
|
||||
Engine *engine.Engine
|
||||
Persister reader.Persister
|
||||
Client dispatcher.LifecycleClient
|
||||
FilerClient filer_pb.SeaweedFilerClient
|
||||
ClientID int32
|
||||
ClientName string
|
||||
|
||||
Workers int
|
||||
DispatchTick time.Duration
|
||||
CheckpointTick time.Duration
|
||||
RefreshInterval time.Duration
|
||||
BootstrapInterval time.Duration
|
||||
RetryBackoff time.Duration
|
||||
}
|
||||
|
||||
// Run blocks until ctx is canceled. Spawns Workers + 1 goroutines: one
|
||||
// engine-refresh ticker plus one Pipeline runner per worker.
|
||||
func (s *Scheduler) Run(ctx context.Context) error {
|
||||
if s.Engine == nil || s.Persister == nil || s.Client == nil || s.FilerClient == nil {
|
||||
return errors.New("scheduler: missing required dependency")
|
||||
}
|
||||
if s.BucketsPath == "" {
|
||||
return errors.New("scheduler: BucketsPath required")
|
||||
}
|
||||
|
||||
workers := s.Workers
|
||||
if workers <= 0 {
|
||||
workers = 1
|
||||
}
|
||||
refresh := s.RefreshInterval
|
||||
if refresh <= 0 {
|
||||
refresh = defaultRefreshInterval
|
||||
}
|
||||
retry := s.RetryBackoff
|
||||
if retry <= 0 {
|
||||
retry = defaultRetryBackoff
|
||||
}
|
||||
|
||||
// Build all pipelines up front and remember which shard each owns.
|
||||
// Doing this before Run lets the bootstrap injector route an event
|
||||
// to the right pipeline by shard, and lets InjectEvent's lazy events
|
||||
// channel be primed before the per-bucket walker starts pushing.
|
||||
type pipelineSlot struct {
|
||||
pipeline *dispatcher.Pipeline
|
||||
shards []int
|
||||
}
|
||||
var slots []*pipelineSlot
|
||||
pipelinesByShard := make(map[int]*dispatcher.Pipeline)
|
||||
for i := 0; i < workers; i++ {
|
||||
shardSet := AssignShards(i, workers)
|
||||
if len(shardSet) == 0 {
|
||||
continue
|
||||
}
|
||||
slot := &pipelineSlot{
|
||||
pipeline: &dispatcher.Pipeline{
|
||||
Shards: shardSet,
|
||||
BucketsPath: s.BucketsPath,
|
||||
Engine: s.Engine,
|
||||
Persister: s.Persister,
|
||||
Client: s.Client,
|
||||
FilerClient: s.FilerClient,
|
||||
ClientID: s.ClientID,
|
||||
ClientName: fmt.Sprintf("%s-w%02d", s.ClientName, i),
|
||||
DispatchTick: s.DispatchTick,
|
||||
CheckpointTick: s.CheckpointTick,
|
||||
},
|
||||
shards: shardSet,
|
||||
}
|
||||
slots = append(slots, slot)
|
||||
for _, sh := range shardSet {
|
||||
pipelinesByShard[sh] = slot.pipeline
|
||||
}
|
||||
}
|
||||
|
||||
bs := &BucketBootstrapper{
|
||||
FilerClient: s.FilerClient,
|
||||
BucketsPath: s.BucketsPath,
|
||||
Injector: pipelineFanout(pipelinesByShard),
|
||||
BootstrapInterval: s.BootstrapInterval,
|
||||
}
|
||||
|
||||
s.refreshEngine(ctx, bs)
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
t := time.NewTicker(refresh)
|
||||
defer t.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-t.C:
|
||||
s.refreshEngine(ctx, bs)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
for _, slot := range slots {
|
||||
slot := slot
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
default:
|
||||
}
|
||||
if err := slot.pipeline.Run(ctx); err != nil && !errors.Is(err, context.Canceled) {
|
||||
glog.Warningf("lifecycle scheduler: shards=%v: %v", slot.shards, err)
|
||||
}
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-time.After(retry):
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Scheduler) refreshEngine(ctx context.Context, bs *BucketBootstrapper) {
|
||||
inputs, parseErrors, err := LoadCompileInputs(ctx, s.FilerClient, s.BucketsPath)
|
||||
if err != nil {
|
||||
glog.Warningf("lifecycle scheduler: refresh engine: %v", err)
|
||||
return
|
||||
}
|
||||
for _, pe := range parseErrors {
|
||||
glog.Warningf("lifecycle scheduler: malformed config in bucket %s: %v", pe.Bucket, pe.Err)
|
||||
}
|
||||
s.Engine.Compile(inputs, engine.CompileOptions{PriorStates: AllActivePriorStates(inputs)})
|
||||
if bs != nil {
|
||||
buckets := make([]string, 0, len(inputs))
|
||||
for _, in := range inputs {
|
||||
buckets = append(buckets, in.Bucket)
|
||||
}
|
||||
bs.KickOffNew(ctx, buckets)
|
||||
}
|
||||
}
|
||||
|
||||
// pipelineFanout routes a synthesized event to the pipeline that owns
|
||||
// its shard. Returned as an EventInjector so the bootstrapper doesn't
|
||||
// know about pipelines.
|
||||
type pipelineFanout map[int]*dispatcher.Pipeline
|
||||
|
||||
func (f pipelineFanout) InjectEvent(ctx context.Context, ev *reader.Event) error {
|
||||
if ev == nil {
|
||||
return nil
|
||||
}
|
||||
p, ok := f[ev.ShardID]
|
||||
if !ok {
|
||||
// Shard isn't covered by any pipeline in this scheduler — nothing
|
||||
// to do. This shouldn't happen with AssignShards covering [0, ShardCount),
|
||||
// but stay tolerant if a future change introduces gaps.
|
||||
return nil
|
||||
}
|
||||
return p.InjectEvent(ctx, ev)
|
||||
}
|
||||
|
||||
// AssignShards returns the contiguous shard slice for worker idx of total.
|
||||
// Shards distribute as evenly as possible: with ShardCount=16 and total=3,
|
||||
// workers receive [0..5], [6..10], [11..15].
|
||||
func AssignShards(idx, total int) []int {
|
||||
if total <= 0 || idx < 0 || idx >= total {
|
||||
return nil
|
||||
}
|
||||
shardCount := s3lifecycle.ShardCount
|
||||
base := shardCount / total
|
||||
extra := shardCount % total
|
||||
var lo, hi int
|
||||
if idx < extra {
|
||||
lo = idx * (base + 1)
|
||||
hi = lo + base + 1
|
||||
} else {
|
||||
lo = idx*base + extra
|
||||
hi = lo + base
|
||||
}
|
||||
if hi > shardCount {
|
||||
hi = shardCount
|
||||
}
|
||||
if lo >= hi {
|
||||
return nil
|
||||
}
|
||||
out := make([]int, 0, hi-lo)
|
||||
for i := lo; i < hi; i++ {
|
||||
out = append(out, i)
|
||||
}
|
||||
return out
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package scheduler
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAssignShardsSingleWorker(t *testing.T) {
|
||||
got := AssignShards(0, 1)
|
||||
want := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Fatalf("got %v, want %v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAssignShardsEvenSplit(t *testing.T) {
|
||||
a := AssignShards(0, 2)
|
||||
b := AssignShards(1, 2)
|
||||
wantA := []int{0, 1, 2, 3, 4, 5, 6, 7}
|
||||
wantB := []int{8, 9, 10, 11, 12, 13, 14, 15}
|
||||
if !reflect.DeepEqual(a, wantA) {
|
||||
t.Fatalf("worker 0: got %v, want %v", a, wantA)
|
||||
}
|
||||
if !reflect.DeepEqual(b, wantB) {
|
||||
t.Fatalf("worker 1: got %v, want %v", b, wantB)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAssignShardsUnevenSplit(t *testing.T) {
|
||||
// 16 shards / 3 workers = 5,5,5 + 1 remainder. Earlier workers absorb
|
||||
// the remainder so the slices stay contiguous: 6,5,5.
|
||||
w0 := AssignShards(0, 3)
|
||||
w1 := AssignShards(1, 3)
|
||||
w2 := AssignShards(2, 3)
|
||||
if len(w0) != 6 || w0[0] != 0 || w0[len(w0)-1] != 5 {
|
||||
t.Fatalf("w0 expected [0..5], got %v", w0)
|
||||
}
|
||||
if len(w1) != 5 || w1[0] != 6 || w1[len(w1)-1] != 10 {
|
||||
t.Fatalf("w1 expected [6..10], got %v", w1)
|
||||
}
|
||||
if len(w2) != 5 || w2[0] != 11 || w2[len(w2)-1] != 15 {
|
||||
t.Fatalf("w2 expected [11..15], got %v", w2)
|
||||
}
|
||||
// All shards covered, exactly once.
|
||||
covered := map[int]int{}
|
||||
for _, w := range [][]int{w0, w1, w2} {
|
||||
for _, s := range w {
|
||||
covered[s]++
|
||||
}
|
||||
}
|
||||
if len(covered) != 16 {
|
||||
t.Fatalf("expected 16 unique shards, got %d", len(covered))
|
||||
}
|
||||
for s, c := range covered {
|
||||
if c != 1 {
|
||||
t.Fatalf("shard %d covered %d times, expected 1", s, c)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAssignShardsMoreWorkersThanShards(t *testing.T) {
|
||||
// 20 workers, 16 shards: first 16 get one shard each, last 4 get nothing.
|
||||
for i := 0; i < 16; i++ {
|
||||
got := AssignShards(i, 20)
|
||||
if len(got) != 1 || got[0] != i {
|
||||
t.Fatalf("worker %d: got %v, want [%d]", i, got, i)
|
||||
}
|
||||
}
|
||||
for i := 16; i < 20; i++ {
|
||||
if got := AssignShards(i, 20); got != nil {
|
||||
t.Fatalf("worker %d should get nil, got %v", i, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAssignShardsBounds(t *testing.T) {
|
||||
if got := AssignShards(-1, 4); got != nil {
|
||||
t.Fatalf("idx -1: got %v, want nil", got)
|
||||
}
|
||||
if got := AssignShards(4, 4); got != nil {
|
||||
t.Fatalf("idx==total: got %v, want nil", got)
|
||||
}
|
||||
if got := AssignShards(0, 0); got != nil {
|
||||
t.Fatalf("total 0: got %v, want nil", got)
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
package scheduler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"sort"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
// fakeListStream implements grpc.ServerStreamingClient[filer_pb.ListEntriesResponse]
|
||||
// for configload tests.
|
||||
type fakeListStream struct {
|
||||
responses []*filer_pb.ListEntriesResponse
|
||||
index int
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func (s *fakeListStream) Recv() (*filer_pb.ListEntriesResponse, error) {
|
||||
if s.ctx != nil {
|
||||
if err := s.ctx.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if s.index >= len(s.responses) {
|
||||
return nil, io.EOF
|
||||
}
|
||||
r := s.responses[s.index]
|
||||
s.index++
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func (s *fakeListStream) Header() (metadata.MD, error) { return metadata.MD{}, nil }
|
||||
func (s *fakeListStream) Trailer() metadata.MD { return metadata.MD{} }
|
||||
func (s *fakeListStream) CloseSend() error { return nil }
|
||||
func (s *fakeListStream) Context() context.Context {
|
||||
if s.ctx != nil {
|
||||
return s.ctx
|
||||
}
|
||||
return context.Background()
|
||||
}
|
||||
func (s *fakeListStream) SendMsg(any) error { return nil }
|
||||
func (s *fakeListStream) RecvMsg(any) error { return nil }
|
||||
|
||||
// fakeFilerClient is the in-memory filer used by configload tests.
|
||||
type fakeFilerClient struct {
|
||||
filer_pb.SeaweedFilerClient
|
||||
|
||||
mu sync.Mutex
|
||||
tree map[string][]*filer_pb.Entry
|
||||
listed []string
|
||||
listedN int32
|
||||
}
|
||||
|
||||
func (c *fakeFilerClient) LookupDirectoryEntry(_ context.Context, in *filer_pb.LookupDirectoryEntryRequest, _ ...grpc.CallOption) (*filer_pb.LookupDirectoryEntryResponse, error) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
for _, e := range c.tree[in.Directory] {
|
||||
if e != nil && e.Name == in.Name {
|
||||
return &filer_pb.LookupDirectoryEntryResponse{Entry: e}, nil
|
||||
}
|
||||
}
|
||||
return nil, filer_pb.ErrNotFound
|
||||
}
|
||||
|
||||
func (c *fakeFilerClient) ListEntries(ctx context.Context, in *filer_pb.ListEntriesRequest, _ ...grpc.CallOption) (grpc.ServerStreamingClient[filer_pb.ListEntriesResponse], error) {
|
||||
c.mu.Lock()
|
||||
c.listed = append(c.listed, in.Directory)
|
||||
src := c.tree[in.Directory]
|
||||
c.mu.Unlock()
|
||||
atomic.AddInt32(&c.listedN, 1)
|
||||
|
||||
filtered := make([]*filer_pb.Entry, 0, len(src))
|
||||
for _, e := range src {
|
||||
if e == nil {
|
||||
continue
|
||||
}
|
||||
if in.StartFromFileName != "" {
|
||||
if in.InclusiveStartFrom {
|
||||
if e.Name < in.StartFromFileName {
|
||||
continue
|
||||
}
|
||||
} else if e.Name <= in.StartFromFileName {
|
||||
continue
|
||||
}
|
||||
}
|
||||
filtered = append(filtered, e)
|
||||
}
|
||||
sort.SliceStable(filtered, func(i, j int) bool { return filtered[i].Name < filtered[j].Name })
|
||||
if in.Limit > 0 && uint32(len(filtered)) > in.Limit {
|
||||
filtered = filtered[:in.Limit]
|
||||
}
|
||||
resps := make([]*filer_pb.ListEntriesResponse, 0, len(filtered))
|
||||
for _, e := range filtered {
|
||||
resps = append(resps, &filer_pb.ListEntriesResponse{Entry: e})
|
||||
}
|
||||
return &fakeListStream{responses: resps, ctx: ctx}, nil
|
||||
}
|
||||
|
||||
func dirEntry(name string, extended map[string][]byte) *filer_pb.Entry {
|
||||
return &filer_pb.Entry{
|
||||
Name: name,
|
||||
IsDirectory: true,
|
||||
Attributes: &filer_pb.FuseAttributes{},
|
||||
Extended: extended,
|
||||
}
|
||||
}
|
||||
|
||||
func fileEntry(name string) *filer_pb.Entry {
|
||||
return &filer_pb.Entry{
|
||||
Name: name,
|
||||
IsDirectory: false,
|
||||
Attributes: &filer_pb.FuseAttributes{},
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import (
|
||||
"github.com/seaweedfs/seaweedfs/weed/util/version"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3_constants"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3err"
|
||||
stats_collect "github.com/seaweedfs/seaweedfs/weed/stats"
|
||||
)
|
||||
|
||||
@@ -21,10 +20,6 @@ func track(f http.HandlerFunc, action string) http.HandlerFunc {
|
||||
bucket, _ := s3_constants.GetBucketAndObject(r)
|
||||
w.Header().Set("Server", "SeaweedFS "+version.VERSION)
|
||||
recorder := stats_collect.NewStatusResponseWriter(w)
|
||||
// Attach an audit-tracking flag to the request so handlers that call
|
||||
// PostLog directly mark it; we emit a fallback entry afterward for
|
||||
// handlers (e.g. successful GET/HEAD object) that don't.
|
||||
r = s3err.EnsureAuditTracking(r)
|
||||
start := time.Now()
|
||||
f(recorder, r)
|
||||
if recorder.Status == http.StatusForbidden {
|
||||
@@ -33,9 +28,6 @@ func track(f http.HandlerFunc, action string) http.HandlerFunc {
|
||||
stats_collect.S3RequestHistogram.WithLabelValues(action, bucket).Observe(time.Since(start).Seconds())
|
||||
stats_collect.S3RequestCounter.WithLabelValues(action, strconv.Itoa(recorder.Status), bucket).Inc()
|
||||
stats_collect.RecordBucketActiveTime(bucket)
|
||||
if !s3err.AuditAlreadyLogged(r) {
|
||||
s3err.PostLog(r, recorder.Status, s3err.ErrNone)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
package s3api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/s3err"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// TestTrackAuditFallbackForDirectWriteHeader covers the regression behind
|
||||
// issue #9463: handlers that bypass writeSuccessResponse helpers and call
|
||||
// w.WriteHeader directly (GetObjectHandler stream path, HeadObjectHandler,
|
||||
// GetBucketEncryption, GetObjectLockConfiguration, etc.) used to drop their
|
||||
// audit entry. track() must mark the request as audited via a fallback
|
||||
// PostLog after the handler returns.
|
||||
func TestTrackAuditFallbackForDirectWriteHeader(t *testing.T) {
|
||||
var captured *http.Request
|
||||
handler := func(w http.ResponseWriter, r *http.Request) {
|
||||
captured = r
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
wrapped := track(handler, "GET")
|
||||
wrapped(httptest.NewRecorder(), httptest.NewRequest(http.MethodGet, "/bucket/object", nil))
|
||||
|
||||
if assert.NotNil(t, captured, "handler must have been invoked") {
|
||||
assert.True(t, s3err.AuditAlreadyLogged(captured),
|
||||
"track must emit fallback audit when handler writes response directly")
|
||||
}
|
||||
}
|
||||
|
||||
// TestTrackAuditSkipsFallbackWhenHandlerEmits guards against double logging:
|
||||
// handlers that already call PostLog (e.g. via writeSuccessResponseXML or
|
||||
// WriteErrorResponse) flip the audit flag, and track must observe that and
|
||||
// not re-emit.
|
||||
func TestTrackAuditSkipsFallbackWhenHandlerEmits(t *testing.T) {
|
||||
var captured *http.Request
|
||||
handler := func(w http.ResponseWriter, r *http.Request) {
|
||||
captured = r
|
||||
s3err.PostLog(r, http.StatusOK, s3err.ErrNone)
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
wrapped := track(handler, "PUT")
|
||||
wrapped(httptest.NewRecorder(), httptest.NewRequest(http.MethodPut, "/bucket/object", nil))
|
||||
|
||||
if assert.NotNil(t, captured) {
|
||||
assert.True(t, s3err.AuditAlreadyLogged(captured),
|
||||
"flag must be set after handler PostLog")
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,6 @@ func (g *Guard) UpdateWhiteList(whiteList []string) {
|
||||
_, cidrnet, err := net.ParseCIDR(ip)
|
||||
if err != nil {
|
||||
glog.Errorf("Parse CIDR %s in whitelist failed: %v", ip, err)
|
||||
continue
|
||||
}
|
||||
whiteListCIDR[ip] = cidrnet
|
||||
} else {
|
||||
|
||||
@@ -29,41 +29,6 @@ type SeaweedFilerClaims struct {
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
// SeaweedFilerAdminClaims is presented by callers of the filer's IAM gRPC
|
||||
// service to prove they are authorised to administer users, access keys, and
|
||||
// policies. The token is signed with the filer write-signing key
|
||||
// (jwt.filer_signing.key in security.toml).
|
||||
//
|
||||
// Validation is delegated to DecodeJwt below: it enforces HS256 via the
|
||||
// SigningMethodHMAC type check, and jwt/v5 validates exp/nbf on the embedded
|
||||
// RegisteredClaims. Extra JSON fields in the payload are silently ignored by
|
||||
// encoding/json, which is the desired behaviour here (forward-compat).
|
||||
type SeaweedFilerAdminClaims struct {
|
||||
jwt.RegisteredClaims
|
||||
}
|
||||
|
||||
// GenJwtForFilerAdmin mints a Bearer token for the filer IAM gRPC service.
|
||||
// Returns an empty string if the signing key is not configured.
|
||||
func GenJwtForFilerAdmin(signingKey SigningKey, expiresAfterSec int) EncodedJwt {
|
||||
if len(signingKey) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
claims := SeaweedFilerAdminClaims{
|
||||
RegisteredClaims: jwt.RegisteredClaims{},
|
||||
}
|
||||
if expiresAfterSec > 0 {
|
||||
claims.ExpiresAt = jwt.NewNumericDate(time.Now().Add(time.Second * time.Duration(expiresAfterSec)))
|
||||
}
|
||||
t := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
||||
encoded, e := t.SignedString([]byte(signingKey))
|
||||
if e != nil {
|
||||
glog.V(0).Infof("Failed to sign claims %+v: %v", t.Claims, e)
|
||||
return ""
|
||||
}
|
||||
return EncodedJwt(encoded)
|
||||
}
|
||||
|
||||
func GenJwtForVolumeServer(signingKey SigningKey, expiresAfterSec int, fileId string) EncodedJwt {
|
||||
if len(signingKey) == 0 {
|
||||
return ""
|
||||
|
||||
@@ -5,9 +5,6 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/cluster"
|
||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb"
|
||||
@@ -47,57 +44,10 @@ func (fs *FilerServer) Statistics(ctx context.Context, req *filer_pb.StatisticsR
|
||||
}, nil
|
||||
}
|
||||
|
||||
// isKnownPingTarget reports whether target is a peer the filer has learned
|
||||
// about from its master subscription (other filers, volume servers) or from
|
||||
// its own master list. Restricting Ping prevents the RPC from being used as
|
||||
// an arbitrary outbound dialer. All lookups are O(1) so the gate adds no
|
||||
// noticeable overhead even in large clusters.
|
||||
func (fs *FilerServer) isKnownPingTarget(ctx context.Context, target string, targetType string) bool {
|
||||
addr := pb.ServerAddress(target)
|
||||
switch targetType {
|
||||
case cluster.FilerType:
|
||||
if fs.filer != nil && fs.filer.MetaAggregator != nil && fs.filer.MetaAggregator.HasPeer(addr) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
case cluster.VolumeServerType:
|
||||
if fs.filer != nil && fs.filer.MasterClient != nil {
|
||||
return fs.filer.MasterClient.HasVolumeServer(addr)
|
||||
}
|
||||
return false
|
||||
case cluster.MasterType:
|
||||
key := addr.ToHttpAddress()
|
||||
if fs.option != nil && fs.option.Masters != nil {
|
||||
if _, ok := fs.option.Masters.GetInstancesAsMap()[string(addr)]; ok {
|
||||
return true
|
||||
}
|
||||
// Fall back to a port-tolerant compare for callers that supply
|
||||
// the http form when masters were registered with grpc suffix.
|
||||
for _, master := range fs.option.Masters.GetInstances() {
|
||||
if master.ToHttpAddress() == key {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
if fs.filer != nil && fs.filer.MasterClient != nil {
|
||||
if _, ok := fs.filer.MasterClient.ListMasterSet()[key]; ok {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (fs *FilerServer) Ping(ctx context.Context, req *filer_pb.PingRequest) (resp *filer_pb.PingResponse, pingErr error) {
|
||||
resp = &filer_pb.PingResponse{
|
||||
StartTimeNs: time.Now().UnixNano(),
|
||||
}
|
||||
// Empty target is a self-liveness probe and stays unauthenticated.
|
||||
if req.Target != "" && !fs.isKnownPingTarget(ctx, req.Target, req.TargetType) {
|
||||
resp.StopTimeNs = time.Now().UnixNano()
|
||||
return resp, status.Errorf(codes.InvalidArgument, "unknown ping target %s of type %s", req.Target, req.TargetType)
|
||||
}
|
||||
if req.TargetType == cluster.FilerType {
|
||||
pingErr = pb.WithFilerClient(false, 0, pb.ServerAddress(req.Target), fs.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
|
||||
pingResp, err := client.Ping(ctx, &filer_pb.PingRequest{})
|
||||
|
||||
@@ -137,54 +137,6 @@ func TestFilerServer_maybeCheckJwtAuthorization_Scoped(t *testing.T) {
|
||||
isWrite: false,
|
||||
expectAuthorized: true,
|
||||
},
|
||||
{
|
||||
name: "tenant prefix does not match sibling tenant",
|
||||
token: genToken([]string{"/tenant1"}, nil),
|
||||
method: "GET",
|
||||
path: "/tenant1234/secret",
|
||||
isWrite: false,
|
||||
expectAuthorized: false,
|
||||
},
|
||||
{
|
||||
name: "tenant prefix does not match dashed sibling",
|
||||
token: genToken([]string{"/tenant1"}, nil),
|
||||
method: "GET",
|
||||
path: "/tenant1-old/secret",
|
||||
isWrite: false,
|
||||
expectAuthorized: false,
|
||||
},
|
||||
{
|
||||
name: "tenant prefix matches own subtree",
|
||||
token: genToken([]string{"/tenant1"}, nil),
|
||||
method: "GET",
|
||||
path: "/tenant1/ok.txt",
|
||||
isWrite: false,
|
||||
expectAuthorized: true,
|
||||
},
|
||||
{
|
||||
name: "tenant prefix with trailing slash matches own subtree",
|
||||
token: genToken([]string{"/tenant1/"}, nil),
|
||||
method: "GET",
|
||||
path: "/tenant1/ok.txt",
|
||||
isWrite: false,
|
||||
expectAuthorized: true,
|
||||
},
|
||||
{
|
||||
name: "root prefix matches anywhere",
|
||||
token: genToken([]string{"/"}, nil),
|
||||
method: "GET",
|
||||
path: "/tenant1234/secret",
|
||||
isWrite: false,
|
||||
expectAuthorized: true,
|
||||
},
|
||||
{
|
||||
name: "dot-dot cannot escape allowed subtree",
|
||||
token: genToken([]string{"/tenant1"}, nil),
|
||||
method: "GET",
|
||||
path: "/tenant1/../tenant2/secret",
|
||||
isWrite: false,
|
||||
expectAuthorized: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
@@ -199,33 +151,3 @@ func TestFilerServer_maybeCheckJwtAuthorization_Scoped(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestPathHasComponentPrefix(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
path string
|
||||
prefix string
|
||||
want bool
|
||||
}{
|
||||
{"exact match", "/tenant1", "/tenant1", true},
|
||||
{"subtree match", "/tenant1/a/b", "/tenant1", true},
|
||||
{"trailing slash prefix", "/tenant1/a", "/tenant1/", true},
|
||||
{"sibling numeric suffix", "/tenant1234/secret", "/tenant1", false},
|
||||
{"sibling dash suffix", "/tenant1-old/secret", "/tenant1", false},
|
||||
{"sibling dot suffix", "/tenant1.bak/x", "/tenant1", false},
|
||||
{"unrelated tree", "/other/x", "/tenant1", false},
|
||||
{"root prefix matches root", "/", "/", true},
|
||||
{"root prefix matches any", "/tenant1234/secret", "/", true},
|
||||
{"empty prefix denies", "/tenant1/x", "", false},
|
||||
{"dot-dot does not escape", "/tenant1/../tenant2/secret", "/tenant1", false},
|
||||
{"dot-dot stays inside", "/tenant1/a/../b", "/tenant1", true},
|
||||
{"double slashes normalised", "/tenant1//a", "/tenant1", true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := pathHasComponentPrefix(tt.path, tt.prefix); got != tt.want {
|
||||
t.Errorf("pathHasComponentPrefix(%q, %q) = %v, want %v", tt.path, tt.prefix, got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
@@ -257,7 +256,7 @@ func (fs *FilerServer) maybeCheckJwtAuthorization(r *http.Request, isWrite bool)
|
||||
if len(claims.AllowedPrefixes) > 0 {
|
||||
hasPrefix := false
|
||||
for _, prefix := range claims.AllowedPrefixes {
|
||||
if pathHasComponentPrefix(r.URL.Path, prefix) {
|
||||
if strings.HasPrefix(r.URL.Path, prefix) {
|
||||
hasPrefix = true
|
||||
break
|
||||
}
|
||||
@@ -284,32 +283,6 @@ func (fs *FilerServer) maybeCheckJwtAuthorization(r *http.Request, isWrite bool)
|
||||
return true
|
||||
}
|
||||
|
||||
// pathHasComponentPrefix reports whether reqPath is contained within the
|
||||
// directory subtree denoted by prefix, treating both as "/"-separated
|
||||
// path components. Both inputs are normalised with path.Clean to neutralise
|
||||
// "." and ".." segments and collapse duplicate slashes. A prefix of "/"
|
||||
// matches any path.
|
||||
func pathHasComponentPrefix(reqPath, prefix string) bool {
|
||||
if prefix == "" {
|
||||
return false
|
||||
}
|
||||
cleanedPath := path.Clean(reqPath)
|
||||
if cleanedPath == "." {
|
||||
cleanedPath = "/"
|
||||
}
|
||||
cleanedPrefix := path.Clean(prefix)
|
||||
if cleanedPrefix == "." {
|
||||
cleanedPrefix = "/"
|
||||
}
|
||||
if cleanedPrefix == "/" {
|
||||
return true
|
||||
}
|
||||
if cleanedPath == cleanedPrefix {
|
||||
return true
|
||||
}
|
||||
return strings.HasPrefix(cleanedPath, cleanedPrefix+"/")
|
||||
}
|
||||
|
||||
func (fs *FilerServer) filerHealthzHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Server", "SeaweedFS "+version.VERSION)
|
||||
if _, err := fs.filer.Store.FindEntry(context.Background(), filer.TopicsDir); err != nil && err != filer_pb.ErrNotFound {
|
||||
|
||||
@@ -3,78 +3,32 @@ package weed_server
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/credential"
|
||||
"github.com/seaweedfs/seaweedfs/weed/glog"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/iam_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/s3api/policy_engine"
|
||||
"github.com/seaweedfs/seaweedfs/weed/security"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// IamGrpcServer implements the IAM gRPC service on the filer.
|
||||
// Every RPC requires a Bearer token in the "authorization" metadata, signed
|
||||
// with the filer write-signing key (jwt.filer_signing.key in security.toml).
|
||||
// If no signing key is configured the service refuses to register at all; the
|
||||
// adminSigningKey check below is defensive in case that wiring is bypassed.
|
||||
// IamGrpcServer implements the IAM gRPC service on the filer
|
||||
type IamGrpcServer struct {
|
||||
iam_pb.UnimplementedSeaweedIdentityAccessManagementServer
|
||||
credentialManager *credential.CredentialManager
|
||||
adminSigningKey security.SigningKey
|
||||
}
|
||||
|
||||
// NewIamGrpcServer creates a new IAM gRPC server. adminSigningKey is required:
|
||||
// callers without a Bearer token signed by this key are rejected.
|
||||
func NewIamGrpcServer(credentialManager *credential.CredentialManager, adminSigningKey security.SigningKey) *IamGrpcServer {
|
||||
// NewIamGrpcServer creates a new IAM gRPC server
|
||||
func NewIamGrpcServer(credentialManager *credential.CredentialManager) *IamGrpcServer {
|
||||
return &IamGrpcServer{
|
||||
credentialManager: credentialManager,
|
||||
adminSigningKey: adminSigningKey,
|
||||
}
|
||||
}
|
||||
|
||||
// checkAdminAuth verifies the caller presented a Bearer token signed by the
|
||||
// filer's write-signing key. It is invoked at the top of every IAM RPC.
|
||||
func (s *IamGrpcServer) checkAdminAuth(ctx context.Context) error {
|
||||
if len(s.adminSigningKey) == 0 {
|
||||
// Service should not be registered without a key; fail closed.
|
||||
return status.Error(codes.PermissionDenied, "iam admin auth not configured")
|
||||
}
|
||||
md, ok := metadata.FromIncomingContext(ctx)
|
||||
if !ok {
|
||||
return status.Error(codes.Unauthenticated, "missing metadata")
|
||||
}
|
||||
authHeaders := md.Get("authorization")
|
||||
if len(authHeaders) == 0 {
|
||||
return status.Error(codes.Unauthenticated, "missing authorization metadata")
|
||||
}
|
||||
// RFC 6750 §2.1: the "Bearer" auth-scheme name is case-insensitive.
|
||||
// Tolerate surrounding whitespace and any spacing between scheme and token.
|
||||
raw := strings.TrimSpace(authHeaders[0])
|
||||
parts := strings.Fields(raw)
|
||||
if len(parts) != 2 || !strings.EqualFold(parts[0], "Bearer") || parts[1] == "" {
|
||||
return status.Error(codes.Unauthenticated, "authorization header must use Bearer scheme")
|
||||
}
|
||||
token := parts[1]
|
||||
parsed, err := security.DecodeJwt(s.adminSigningKey, security.EncodedJwt(token), &security.SeaweedFilerAdminClaims{})
|
||||
if err != nil || parsed == nil || !parsed.Valid {
|
||||
return status.Error(codes.Unauthenticated, "invalid admin token")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Configuration Management
|
||||
|
||||
func (s *IamGrpcServer) GetConfiguration(ctx context.Context, req *iam_pb.GetConfigurationRequest) (*iam_pb.GetConfigurationResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
glog.V(4).Infof("GetConfiguration")
|
||||
|
||||
if s.credentialManager == nil {
|
||||
@@ -93,12 +47,6 @@ func (s *IamGrpcServer) GetConfiguration(ctx context.Context, req *iam_pb.GetCon
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) PutConfiguration(ctx context.Context, req *iam_pb.PutConfigurationRequest) (*iam_pb.PutConfigurationResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
glog.V(4).Infof("PutConfiguration")
|
||||
|
||||
if s.credentialManager == nil {
|
||||
@@ -122,9 +70,6 @@ func (s *IamGrpcServer) PutConfiguration(ctx context.Context, req *iam_pb.PutCon
|
||||
// User Management
|
||||
|
||||
func (s *IamGrpcServer) CreateUser(ctx context.Context, req *iam_pb.CreateUserRequest) (*iam_pb.CreateUserResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil || req.Identity == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "identity is required")
|
||||
}
|
||||
@@ -147,12 +92,6 @@ func (s *IamGrpcServer) CreateUser(ctx context.Context, req *iam_pb.CreateUserRe
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) GetUser(ctx context.Context, req *iam_pb.GetUserRequest) (*iam_pb.GetUserResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
glog.V(4).Infof("GetUser: %s", req.Username)
|
||||
|
||||
if s.credentialManager == nil {
|
||||
@@ -178,9 +117,6 @@ func (s *IamGrpcServer) GetUser(ctx context.Context, req *iam_pb.GetUserRequest)
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) UpdateUser(ctx context.Context, req *iam_pb.UpdateUserRequest) (*iam_pb.UpdateUserResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil || req.Identity == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "identity is required")
|
||||
}
|
||||
@@ -203,12 +139,6 @@ func (s *IamGrpcServer) UpdateUser(ctx context.Context, req *iam_pb.UpdateUserRe
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) DeleteUser(ctx context.Context, req *iam_pb.DeleteUserRequest) (*iam_pb.DeleteUserResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
glog.V(4).Infof("IAM: Filer.DeleteUser %s", req.Username)
|
||||
|
||||
if s.credentialManager == nil {
|
||||
@@ -228,12 +158,6 @@ func (s *IamGrpcServer) DeleteUser(ctx context.Context, req *iam_pb.DeleteUserRe
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) ListUsers(ctx context.Context, req *iam_pb.ListUsersRequest) (*iam_pb.ListUsersResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
glog.V(4).Infof("ListUsers")
|
||||
|
||||
if s.credentialManager == nil {
|
||||
@@ -269,9 +193,6 @@ func (s *IamGrpcServer) ListUsers(ctx context.Context, req *iam_pb.ListUsersRequ
|
||||
// Access Key Management
|
||||
|
||||
func (s *IamGrpcServer) CreateAccessKey(ctx context.Context, req *iam_pb.CreateAccessKeyRequest) (*iam_pb.CreateAccessKeyResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil || req.Credential == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "credential is required")
|
||||
}
|
||||
@@ -294,12 +215,6 @@ func (s *IamGrpcServer) CreateAccessKey(ctx context.Context, req *iam_pb.CreateA
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) DeleteAccessKey(ctx context.Context, req *iam_pb.DeleteAccessKeyRequest) (*iam_pb.DeleteAccessKeyResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
glog.V(4).Infof("DeleteAccessKey: %s for user: %s", req.AccessKey, req.Username)
|
||||
|
||||
if s.credentialManager == nil {
|
||||
@@ -322,12 +237,6 @@ func (s *IamGrpcServer) DeleteAccessKey(ctx context.Context, req *iam_pb.DeleteA
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) GetUserByAccessKey(ctx context.Context, req *iam_pb.GetUserByAccessKeyRequest) (*iam_pb.GetUserByAccessKeyResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
glog.V(4).Infof("GetUserByAccessKey: %s", req.AccessKey)
|
||||
|
||||
if s.credentialManager == nil {
|
||||
@@ -352,12 +261,6 @@ func (s *IamGrpcServer) GetUserByAccessKey(ctx context.Context, req *iam_pb.GetU
|
||||
// Policy Management
|
||||
|
||||
func (s *IamGrpcServer) PutPolicy(ctx context.Context, req *iam_pb.PutPolicyRequest) (*iam_pb.PutPolicyResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
glog.V(4).Infof("IAM: Filer.PutPolicy %s", req.Name)
|
||||
|
||||
if s.credentialManager == nil {
|
||||
@@ -390,12 +293,6 @@ func (s *IamGrpcServer) PutPolicy(ctx context.Context, req *iam_pb.PutPolicyRequ
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) GetPolicy(ctx context.Context, req *iam_pb.GetPolicyRequest) (*iam_pb.GetPolicyResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
glog.V(4).Infof("GetPolicy: %s", req.Name)
|
||||
|
||||
if s.credentialManager == nil {
|
||||
@@ -425,12 +322,6 @@ func (s *IamGrpcServer) GetPolicy(ctx context.Context, req *iam_pb.GetPolicyRequ
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) ListPolicies(ctx context.Context, req *iam_pb.ListPoliciesRequest) (*iam_pb.ListPoliciesResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
glog.V(4).Infof("ListPolicies")
|
||||
|
||||
if s.credentialManager == nil {
|
||||
@@ -461,12 +352,6 @@ func (s *IamGrpcServer) ListPolicies(ctx context.Context, req *iam_pb.ListPolici
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) DeletePolicy(ctx context.Context, req *iam_pb.DeletePolicyRequest) (*iam_pb.DeletePolicyResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
glog.V(4).Infof("DeletePolicy: %s", req.Name)
|
||||
|
||||
if s.credentialManager == nil {
|
||||
@@ -486,9 +371,6 @@ func (s *IamGrpcServer) DeletePolicy(ctx context.Context, req *iam_pb.DeletePoli
|
||||
// Service Account Management
|
||||
|
||||
func (s *IamGrpcServer) CreateServiceAccount(ctx context.Context, req *iam_pb.CreateServiceAccountRequest) (*iam_pb.CreateServiceAccountResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil || req.ServiceAccount == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "service account is required")
|
||||
}
|
||||
@@ -511,9 +393,6 @@ func (s *IamGrpcServer) CreateServiceAccount(ctx context.Context, req *iam_pb.Cr
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) UpdateServiceAccount(ctx context.Context, req *iam_pb.UpdateServiceAccountRequest) (*iam_pb.UpdateServiceAccountResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil || req.ServiceAccount == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "service account is required")
|
||||
}
|
||||
@@ -533,12 +412,6 @@ func (s *IamGrpcServer) UpdateServiceAccount(ctx context.Context, req *iam_pb.Up
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) DeleteServiceAccount(ctx context.Context, req *iam_pb.DeleteServiceAccountRequest) (*iam_pb.DeleteServiceAccountResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
glog.V(4).Infof("DeleteServiceAccount: %s", req.Id)
|
||||
|
||||
if s.credentialManager == nil {
|
||||
@@ -558,12 +431,6 @@ func (s *IamGrpcServer) DeleteServiceAccount(ctx context.Context, req *iam_pb.De
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) GetServiceAccount(ctx context.Context, req *iam_pb.GetServiceAccountRequest) (*iam_pb.GetServiceAccountResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
glog.V(4).Infof("GetServiceAccount: %s", req.Id)
|
||||
|
||||
if s.credentialManager == nil {
|
||||
@@ -586,12 +453,6 @@ func (s *IamGrpcServer) GetServiceAccount(ctx context.Context, req *iam_pb.GetSe
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) ListServiceAccounts(ctx context.Context, req *iam_pb.ListServiceAccountsRequest) (*iam_pb.ListServiceAccountsResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
glog.V(4).Infof("ListServiceAccounts")
|
||||
|
||||
if s.credentialManager == nil {
|
||||
@@ -610,9 +471,6 @@ func (s *IamGrpcServer) ListServiceAccounts(ctx context.Context, req *iam_pb.Lis
|
||||
}
|
||||
|
||||
func (s *IamGrpcServer) GetServiceAccountByAccessKey(ctx context.Context, req *iam_pb.GetServiceAccountByAccessKeyRequest) (*iam_pb.GetServiceAccountByAccessKeyResponse, error) {
|
||||
if err := s.checkAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if req == nil {
|
||||
return nil, status.Errorf(codes.InvalidArgument, "request is required")
|
||||
}
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
package weed_server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
jwt "github.com/golang-jwt/jwt/v5"
|
||||
"github.com/seaweedfs/seaweedfs/weed/credential"
|
||||
_ "github.com/seaweedfs/seaweedfs/weed/credential/memory"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/iam_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/security"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
const testIamSigningKey = "iam-admin-test-key-do-not-use-in-prod"
|
||||
|
||||
func newTestIamGrpcServer(t *testing.T) *IamGrpcServer {
|
||||
t.Helper()
|
||||
cm, err := credential.NewCredentialManager(credential.StoreTypeMemory, nil, "")
|
||||
if err != nil {
|
||||
t.Fatalf("NewCredentialManager: %v", err)
|
||||
}
|
||||
return NewIamGrpcServer(cm, security.SigningKey(testIamSigningKey))
|
||||
}
|
||||
|
||||
func ctxWithBearer(token string) context.Context {
|
||||
md := metadata.New(map[string]string{"authorization": "Bearer " + token})
|
||||
return metadata.NewIncomingContext(context.Background(), md)
|
||||
}
|
||||
|
||||
func TestIamGrpc_NoMetadata_Unauthenticated(t *testing.T) {
|
||||
s := newTestIamGrpcServer(t)
|
||||
_, err := s.ListUsers(context.Background(), &iam_pb.ListUsersRequest{})
|
||||
if got, want := status.Code(err), codes.Unauthenticated; got != want {
|
||||
t.Fatalf("ListUsers without metadata: got code %v, want %v (err=%v)", got, want, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIamGrpc_MissingAuthorizationHeader_Unauthenticated(t *testing.T) {
|
||||
s := newTestIamGrpcServer(t)
|
||||
ctx := metadata.NewIncomingContext(context.Background(), metadata.New(map[string]string{"other": "value"}))
|
||||
_, err := s.ListUsers(ctx, &iam_pb.ListUsersRequest{})
|
||||
if got, want := status.Code(err), codes.Unauthenticated; got != want {
|
||||
t.Fatalf("ListUsers with no authorization header: got code %v, want %v (err=%v)", got, want, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIamGrpc_NonBearerAuthorization_Unauthenticated(t *testing.T) {
|
||||
s := newTestIamGrpcServer(t)
|
||||
md := metadata.New(map[string]string{"authorization": "Basic dXNlcjpwYXNz"})
|
||||
ctx := metadata.NewIncomingContext(context.Background(), md)
|
||||
_, err := s.ListUsers(ctx, &iam_pb.ListUsersRequest{})
|
||||
if got, want := status.Code(err), codes.Unauthenticated; got != want {
|
||||
t.Fatalf("ListUsers with non-Bearer scheme: got code %v, want %v (err=%v)", got, want, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIamGrpc_InvalidToken_Unauthenticated(t *testing.T) {
|
||||
s := newTestIamGrpcServer(t)
|
||||
// Token signed with the wrong key.
|
||||
bad := security.GenJwtForFilerAdmin(security.SigningKey("a-different-key"), 60)
|
||||
if bad == "" {
|
||||
t.Fatal("GenJwtForFilerAdmin returned empty")
|
||||
}
|
||||
_, err := s.ListUsers(ctxWithBearer(string(bad)), &iam_pb.ListUsersRequest{})
|
||||
if got, want := status.Code(err), codes.Unauthenticated; got != want {
|
||||
t.Fatalf("ListUsers with mis-signed token: got code %v, want %v (err=%v)", got, want, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIamGrpc_GarbageToken_Unauthenticated(t *testing.T) {
|
||||
s := newTestIamGrpcServer(t)
|
||||
_, err := s.ListUsers(ctxWithBearer("not.a.jwt"), &iam_pb.ListUsersRequest{})
|
||||
if got, want := status.Code(err), codes.Unauthenticated; got != want {
|
||||
t.Fatalf("ListUsers with garbage token: got code %v, want %v (err=%v)", got, want, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIamGrpc_ExpiredToken_Unauthenticated(t *testing.T) {
|
||||
s := newTestIamGrpcServer(t)
|
||||
// Mint a token that's already expired (exp in the past).
|
||||
claims := security.SeaweedFilerAdminClaims{
|
||||
RegisteredClaims: jwt.RegisteredClaims{
|
||||
ExpiresAt: jwt.NewNumericDate(time.Now().Add(-time.Hour)),
|
||||
},
|
||||
}
|
||||
tok := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
||||
encoded, err := tok.SignedString([]byte(testIamSigningKey))
|
||||
if err != nil {
|
||||
t.Fatalf("SignedString: %v", err)
|
||||
}
|
||||
_, err = s.ListUsers(ctxWithBearer(encoded), &iam_pb.ListUsersRequest{})
|
||||
if got, want := status.Code(err), codes.Unauthenticated; got != want {
|
||||
t.Fatalf("ListUsers with expired token: got code %v, want %v (err=%v)", got, want, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIamGrpc_ValidToken_ReachesHandler(t *testing.T) {
|
||||
s := newTestIamGrpcServer(t)
|
||||
good := security.GenJwtForFilerAdmin(security.SigningKey(testIamSigningKey), 60)
|
||||
if good == "" {
|
||||
t.Fatal("GenJwtForFilerAdmin returned empty")
|
||||
}
|
||||
resp, err := s.ListUsers(ctxWithBearer(string(good)), &iam_pb.ListUsersRequest{})
|
||||
if err != nil {
|
||||
t.Fatalf("ListUsers with valid token: unexpected error %v", err)
|
||||
}
|
||||
if resp == nil {
|
||||
t.Fatal("ListUsers with valid token: nil response")
|
||||
}
|
||||
// Memory store starts empty; the handler ran past the auth gate.
|
||||
if len(resp.Usernames) != 0 {
|
||||
t.Fatalf("ListUsers: expected empty user list from fresh memory store, got %v", resp.Usernames)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIamGrpc_NoSigningKey_PermissionDenied(t *testing.T) {
|
||||
// Defensive path: even if the service is somehow registered without a
|
||||
// key, every RPC must refuse.
|
||||
cm, err := credential.NewCredentialManager(credential.StoreTypeMemory, nil, "")
|
||||
if err != nil {
|
||||
t.Fatalf("NewCredentialManager: %v", err)
|
||||
}
|
||||
s := NewIamGrpcServer(cm, nil)
|
||||
good := security.GenJwtForFilerAdmin(security.SigningKey(testIamSigningKey), 60)
|
||||
_, err = s.ListUsers(ctxWithBearer(string(good)), &iam_pb.ListUsersRequest{})
|
||||
if got, want := status.Code(err), codes.PermissionDenied; got != want {
|
||||
t.Fatalf("ListUsers with no signing key: got code %v, want %v (err=%v)", got, want, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIamGrpc_CreateUser_RequiresAuth(t *testing.T) {
|
||||
// Spot-check a write RPC too — auth must run before any work.
|
||||
s := newTestIamGrpcServer(t)
|
||||
_, err := s.CreateUser(context.Background(), &iam_pb.CreateUserRequest{
|
||||
Identity: &iam_pb.Identity{Name: "admin"},
|
||||
})
|
||||
if got, want := status.Code(err), codes.Unauthenticated; got != want {
|
||||
t.Fatalf("CreateUser without token: got code %v, want %v (err=%v)", got, want, err)
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,6 @@ import (
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/stats"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
/*
|
||||
@@ -160,42 +158,10 @@ func (ms *MasterServer) ReleaseAdminToken(ctx context.Context, req *master_pb.Re
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// isKnownPingTarget reports whether target is a peer that the master has
|
||||
// learned about as part of cluster membership. Restricting Ping to known
|
||||
// peers avoids turning the RPC into a generic outbound dialer. The lookups
|
||||
// are O(1) so the gate stays cheap on clusters with thousands of nodes.
|
||||
func (ms *MasterServer) isKnownPingTarget(ctx context.Context, target string, targetType string) bool {
|
||||
addr := pb.ServerAddress(target)
|
||||
switch targetType {
|
||||
case cluster.FilerType, cluster.BrokerType, cluster.S3Type:
|
||||
return ms.Cluster.IsKnownNode(targetType, addr)
|
||||
case cluster.VolumeServerType:
|
||||
if ms.Topo == nil {
|
||||
return false
|
||||
}
|
||||
return ms.Topo.LookupDataNodeByAddress(addr) != nil
|
||||
case cluster.MasterType:
|
||||
if ms.option != nil && ms.option.Master.Equals(addr) {
|
||||
return true
|
||||
}
|
||||
if ms.MasterClient != nil {
|
||||
_, ok := ms.MasterClient.ListMasterSet()[addr.ToHttpAddress()]
|
||||
return ok
|
||||
}
|
||||
return false
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (ms *MasterServer) Ping(ctx context.Context, req *master_pb.PingRequest) (resp *master_pb.PingResponse, pingErr error) {
|
||||
resp = &master_pb.PingResponse{
|
||||
StartTimeNs: time.Now().UnixNano(),
|
||||
}
|
||||
// Empty target is a self-liveness probe and stays unauthenticated.
|
||||
if req.Target != "" && !ms.isKnownPingTarget(ctx, req.Target, req.TargetType) {
|
||||
resp.StopTimeNs = time.Now().UnixNano()
|
||||
return resp, status.Errorf(codes.InvalidArgument, "unknown ping target %s of type %s", req.Target, req.TargetType)
|
||||
}
|
||||
if req.TargetType == cluster.FilerType {
|
||||
pingErr = pb.WithFilerClient(false, 0, pb.ServerAddress(req.Target), ms.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
|
||||
pingResp, err := client.Ping(ctx, &filer_pb.PingRequest{})
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
package weed_server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/cluster"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/sequence"
|
||||
"github.com/seaweedfs/seaweedfs/weed/topology"
|
||||
)
|
||||
|
||||
func TestMasterIsKnownPingTarget(t *testing.T) {
|
||||
topo := topology.NewTopology("test", sequence.NewMemorySequencer(), 32*1024, 5, false)
|
||||
dc := topology.NewDataCenter("dc1")
|
||||
topo.LinkChildNode(dc)
|
||||
rack := topology.NewRack("rack1")
|
||||
dc.LinkChildNode(rack)
|
||||
|
||||
dn := topology.NewDataNode("vol1")
|
||||
dn.Ip = "10.0.0.10"
|
||||
dn.Port = 8080
|
||||
dn.GrpcPort = 18080
|
||||
rack.LinkChildNode(dn)
|
||||
|
||||
c := cluster.NewCluster()
|
||||
filerAddr := pb.ServerAddress("10.0.0.20:8888")
|
||||
c.AddClusterNode("", cluster.FilerType, "dc1", "rack1", filerAddr, "test")
|
||||
|
||||
ms := &MasterServer{
|
||||
option: &MasterOption{Master: pb.ServerAddress("10.0.0.1:9333")},
|
||||
Topo: topo,
|
||||
Cluster: c,
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
cases := []struct {
|
||||
name string
|
||||
target string
|
||||
targetType string
|
||||
want bool
|
||||
}{
|
||||
{"known filer", string(filerAddr), cluster.FilerType, true},
|
||||
{"known volume server", "10.0.0.10:8080.18080", cluster.VolumeServerType, true},
|
||||
{"known volume server http addr", "10.0.0.10:8080", cluster.VolumeServerType, true},
|
||||
{"known self master", "10.0.0.1:9333", cluster.MasterType, true},
|
||||
{"unknown localhost low port", "127.0.0.1:1", cluster.VolumeServerType, false},
|
||||
{"unknown localhost high port", "127.0.0.1:65000", cluster.FilerType, false},
|
||||
{"unrelated host", "example.com:443", cluster.MasterType, false},
|
||||
{"unknown target type", string(filerAddr), "garbage", false},
|
||||
{"filer address checked as volume server", string(filerAddr), cluster.VolumeServerType, false},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
got := ms.isKnownPingTarget(ctx, tc.target, tc.targetType)
|
||||
if got != tc.want {
|
||||
t.Fatalf("isKnownPingTarget(%q,%q) = %v, want %v", tc.target, tc.targetType, got, tc.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestVolumeServerIsKnownPingTarget(t *testing.T) {
|
||||
seed := pb.ServerAddress("10.0.0.1:9333")
|
||||
vs := &VolumeServer{
|
||||
SeedMasterNodes: []pb.ServerAddress{seed},
|
||||
seedMasterSet: map[string]struct{}{seed.ToHttpAddress(): {}},
|
||||
}
|
||||
vs.setCurrentMaster(pb.ServerAddress("10.0.0.2:9333"))
|
||||
|
||||
cases := []struct {
|
||||
name string
|
||||
target string
|
||||
targetType string
|
||||
want bool
|
||||
}{
|
||||
{"seed master", string(seed), cluster.MasterType, true},
|
||||
{"current master", "10.0.0.2:9333", cluster.MasterType, true},
|
||||
{"other volume server", "10.0.0.5:8080", cluster.VolumeServerType, false},
|
||||
{"random filer", "10.0.0.6:8888", cluster.FilerType, false},
|
||||
{"unknown low port", "127.0.0.1:1", cluster.MasterType, false},
|
||||
{"unknown high port", "127.0.0.1:65000", cluster.MasterType, false},
|
||||
{"unrelated host", "example.com:443", cluster.MasterType, false},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
got := vs.isKnownPingTarget(tc.target, tc.targetType)
|
||||
if got != tc.want {
|
||||
t.Fatalf("isKnownPingTarget(%q,%q) = %v, want %v", tc.target, tc.targetType, got, tc.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -274,8 +274,6 @@ func (ms *MasterServer) LookupEcVolume(ctx context.Context, req *master_pb.Looku
|
||||
Url: dn.Url(),
|
||||
PublicUrl: dn.PublicUrl,
|
||||
DataCenter: dn.GetDataCenterId(),
|
||||
// without this, clients derive grpc as httpPort+10000
|
||||
GrpcPort: uint32(dn.GrpcPort),
|
||||
})
|
||||
}
|
||||
resp.ShardIdLocations = append(resp.ShardIdLocations, &master_pb.LookupEcVolumeResponse_EcShardIdLocation{
|
||||
|
||||
@@ -176,8 +176,7 @@ func (vs *VolumeServer) VolumeDelete(ctx context.Context, req *volume_server_pb.
|
||||
if err != nil {
|
||||
glog.Errorf("volume delete %v: %v", req, err)
|
||||
} else {
|
||||
// V(0) so destructive RPCs are always traceable.
|
||||
glog.Infof("volume delete %v", req)
|
||||
glog.V(2).Infof("volume delete %v", req)
|
||||
}
|
||||
|
||||
return resp, err
|
||||
@@ -440,37 +439,10 @@ func (vs *VolumeServer) VolumeNeedleStatus(ctx context.Context, req *volume_serv
|
||||
|
||||
}
|
||||
|
||||
// isKnownPingTarget reports whether target is a master this volume server
|
||||
// already knows about. Volume servers do not maintain a peer-volume or
|
||||
// peer-filer list, so Ping is scoped to the masters they heartbeat with.
|
||||
// The current-master read is taken under a lock to avoid racing with the
|
||||
// heartbeat goroutine that rewrites it on leader changes, and the seed
|
||||
// list is consulted via a pre-built set so the check stays O(1).
|
||||
func (vs *VolumeServer) isKnownPingTarget(target string, targetType string) bool {
|
||||
if targetType != cluster.MasterType {
|
||||
return false
|
||||
}
|
||||
addr := pb.ServerAddress(target)
|
||||
key := addr.ToHttpAddress()
|
||||
if key == "" {
|
||||
return false
|
||||
}
|
||||
if current := vs.getCurrentMaster(); current != "" && current.ToHttpAddress() == key {
|
||||
return true
|
||||
}
|
||||
_, ok := vs.seedMasterSet[key]
|
||||
return ok
|
||||
}
|
||||
|
||||
func (vs *VolumeServer) Ping(ctx context.Context, req *volume_server_pb.PingRequest) (resp *volume_server_pb.PingResponse, pingErr error) {
|
||||
resp = &volume_server_pb.PingResponse{
|
||||
StartTimeNs: time.Now().UnixNano(),
|
||||
}
|
||||
// Empty target is a self-liveness probe and stays unauthenticated.
|
||||
if req.Target != "" && !vs.isKnownPingTarget(req.Target, req.TargetType) {
|
||||
resp.StopTimeNs = time.Now().UnixNano()
|
||||
return resp, status.Errorf(codes.InvalidArgument, "unknown ping target %s of type %s", req.Target, req.TargetType)
|
||||
}
|
||||
if req.TargetType == cluster.FilerType {
|
||||
pingErr = pb.WithFilerClient(false, 0, pb.ServerAddress(req.Target), vs.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
|
||||
pingResp, err := client.Ping(ctx, &filer_pb.PingRequest{})
|
||||
|
||||
@@ -24,26 +24,9 @@ import (
|
||||
)
|
||||
|
||||
func (vs *VolumeServer) GetMaster(ctx context.Context) pb.ServerAddress {
|
||||
return vs.getCurrentMaster()
|
||||
}
|
||||
|
||||
// getCurrentMaster returns vs.currentMaster under a read lock so callers
|
||||
// (e.g. Ping admission) do not race with the heartbeat goroutine that
|
||||
// rewrites it on leader changes.
|
||||
func (vs *VolumeServer) getCurrentMaster() pb.ServerAddress {
|
||||
vs.currentMasterLock.RLock()
|
||||
defer vs.currentMasterLock.RUnlock()
|
||||
return vs.currentMaster
|
||||
}
|
||||
|
||||
// setCurrentMaster updates vs.currentMaster under a write lock. The
|
||||
// heartbeat goroutine calls this whenever it (re)connects to a master.
|
||||
func (vs *VolumeServer) setCurrentMaster(master pb.ServerAddress) {
|
||||
vs.currentMasterLock.Lock()
|
||||
vs.currentMaster = master
|
||||
vs.currentMasterLock.Unlock()
|
||||
}
|
||||
|
||||
func (vs *VolumeServer) checkWithMaster() (err error) {
|
||||
for {
|
||||
for _, master := range vs.SeedMasterNodes {
|
||||
@@ -143,7 +126,7 @@ func (vs *VolumeServer) doHeartbeatWithRetry(masterAddress pb.ServerAddress, grp
|
||||
return "", err
|
||||
}
|
||||
glog.V(0).Infof("Heartbeat to: %v", masterAddress)
|
||||
vs.setCurrentMaster(masterAddress)
|
||||
vs.currentMaster = masterAddress
|
||||
|
||||
doneChan := make(chan error, 1)
|
||||
|
||||
@@ -193,19 +176,16 @@ func (vs *VolumeServer) doHeartbeatWithRetry(masterAddress pb.ServerAddress, grp
|
||||
if volumeOptsChanged {
|
||||
if vs.store.MaybeAdjustVolumeMax() {
|
||||
if err = stream.Send(vs.store.CollectHeartbeat()); err != nil {
|
||||
glog.V(0).Infof("Volume Server Failed to talk with master %s: %v", vs.getCurrentMaster(), err)
|
||||
glog.V(0).Infof("Volume Server Failed to talk with master %s: %v", vs.currentMaster, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if in.GetLeader() != "" {
|
||||
current := vs.getCurrentMaster()
|
||||
if !current.Equals(pb.ServerAddress(in.GetLeader())) {
|
||||
glog.V(0).Infof("Volume Server found a new master newLeader: %v instead of %v", in.GetLeader(), current)
|
||||
newLeader = pb.ServerAddress(in.GetLeader())
|
||||
doneChan <- nil
|
||||
return
|
||||
}
|
||||
if in.GetLeader() != "" && !vs.currentMaster.Equals(pb.ServerAddress(in.GetLeader())) {
|
||||
glog.V(0).Infof("Volume Server found a new master newLeader: %v instead of %v", in.GetLeader(), vs.currentMaster)
|
||||
newLeader = pb.ServerAddress(in.GetLeader())
|
||||
doneChan <- nil
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -482,9 +482,7 @@ func (vs *VolumeServer) VolumeEcShardRead(req *volume_server_pb.VolumeEcShardRea
|
||||
if !found {
|
||||
return fmt.Errorf("VolumeEcShardRead not found ec volume id %d", req.VolumeId)
|
||||
}
|
||||
// shard may live on a sibling disk of this server; walk all of them
|
||||
// under ecVolumesLock.
|
||||
_, ecShard, found := vs.store.FindEcShard(needle.VolumeId(req.VolumeId), erasure_coding.ShardId(req.ShardId))
|
||||
ecShard, found := ecVolume.FindEcVolumeShard(erasure_coding.ShardId(req.ShardId))
|
||||
if !found {
|
||||
return fmt.Errorf("not found ec shard %d.%d", req.VolumeId, req.ShardId)
|
||||
}
|
||||
|
||||
@@ -3,179 +3,18 @@ package weed_server
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/operation"
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
|
||||
"github.com/seaweedfs/seaweedfs/weed/remote_storage"
|
||||
s3remote "github.com/seaweedfs/seaweedfs/weed/remote_storage/s3"
|
||||
"github.com/seaweedfs/seaweedfs/weed/security"
|
||||
"github.com/seaweedfs/seaweedfs/weed/storage/needle"
|
||||
"github.com/seaweedfs/seaweedfs/weed/storage/types"
|
||||
)
|
||||
|
||||
// lookupIPAddrFunc resolves a host to one or more IP addresses. It is a
|
||||
// package-level variable so tests can substitute a deterministic resolver.
|
||||
var lookupIPAddrFunc = net.DefaultResolver.LookupIPAddr
|
||||
|
||||
// blockedIMDSHosts lists hostnames that target cloud instance metadata
|
||||
// services (IMDS). These are blocked regardless of how they happen to
|
||||
// resolve, because some environments alias the IMDS address under a name.
|
||||
var blockedIMDSHosts = map[string]struct{}{
|
||||
"metadata.google.internal": {},
|
||||
"metadata": {},
|
||||
}
|
||||
|
||||
// validateRemoteEndpoint returns an error if the supplied S3 endpoint is not
|
||||
// safe to dial from a server that has network access to cluster-internal
|
||||
// hosts. It rejects empty/non-http(s) schemes, loopback/link-local/
|
||||
// unspecified addresses, RFC 1918 + CGNAT ranges, and well-known IMDS
|
||||
// hostnames. Operators that legitimately fetch from private hosts can opt
|
||||
// out with -volume.allowUntrustedRemoteEndpoints.
|
||||
func validateRemoteEndpoint(ctx context.Context, endpoint string) error {
|
||||
if strings.TrimSpace(endpoint) == "" {
|
||||
return fmt.Errorf("remote endpoint is empty")
|
||||
}
|
||||
u, parseErr := url.Parse(endpoint)
|
||||
if parseErr != nil {
|
||||
return fmt.Errorf("parse remote endpoint %q: %w", endpoint, parseErr)
|
||||
}
|
||||
scheme := strings.ToLower(u.Scheme)
|
||||
if scheme != "http" && scheme != "https" {
|
||||
return fmt.Errorf("remote endpoint %q must use http or https, got %q", endpoint, u.Scheme)
|
||||
}
|
||||
host := u.Hostname()
|
||||
if host == "" {
|
||||
return fmt.Errorf("remote endpoint %q has no host", endpoint)
|
||||
}
|
||||
lowerHost := strings.ToLower(host)
|
||||
if _, ok := blockedIMDSHosts[lowerHost]; ok {
|
||||
return fmt.Errorf("remote endpoint %q targets instance metadata service", endpoint)
|
||||
}
|
||||
if ip := net.ParseIP(host); ip != nil {
|
||||
if err := checkBlockedIP(endpoint, ip); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
resolveCtx, cancel := context.WithTimeout(ctx, 2*time.Second)
|
||||
defer cancel()
|
||||
addrs, lookupErr := lookupIPAddrFunc(resolveCtx, host)
|
||||
if lookupErr != nil {
|
||||
return fmt.Errorf("resolve remote endpoint host %q: %w", host, lookupErr)
|
||||
}
|
||||
for _, addr := range addrs {
|
||||
if err := checkBlockedIP(endpoint, addr.IP); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// imdsIPv4 is the AWS/Azure/GCP IPv4 IMDS address. It is link-local and is
|
||||
// already covered by IsLinkLocalUnicast, but is named explicitly so the
|
||||
// error message is unambiguous in logs.
|
||||
var imdsIPv4 = net.ParseIP("169.254.169.254")
|
||||
|
||||
// cgnatNet is the RFC 6598 carrier-grade NAT range (100.64.0.0/10). The
|
||||
// stdlib's IsPrivate covers RFC 1918 but not CGNAT, so check it explicitly.
|
||||
var cgnatNet = &net.IPNet{IP: net.IPv4(100, 64, 0, 0), Mask: net.CIDRMask(10, 32)}
|
||||
|
||||
func checkBlockedIP(endpoint string, ip net.IP) error {
|
||||
if ip == nil {
|
||||
return nil
|
||||
}
|
||||
if ip.Equal(imdsIPv4) {
|
||||
return fmt.Errorf("remote endpoint %q targets instance metadata service %s", endpoint, ip)
|
||||
}
|
||||
switch {
|
||||
case ip.IsLoopback():
|
||||
return fmt.Errorf("remote endpoint %q resolves to loopback address %s", endpoint, ip)
|
||||
case ip.IsUnspecified():
|
||||
return fmt.Errorf("remote endpoint %q resolves to unspecified address %s", endpoint, ip)
|
||||
case ip.IsLinkLocalUnicast(), ip.IsLinkLocalMulticast():
|
||||
return fmt.Errorf("remote endpoint %q resolves to link-local address %s", endpoint, ip)
|
||||
case ip.IsInterfaceLocalMulticast():
|
||||
return fmt.Errorf("remote endpoint %q resolves to interface-local address %s", endpoint, ip)
|
||||
case ip.IsPrivate():
|
||||
return fmt.Errorf("remote endpoint %q resolves to private address %s", endpoint, ip)
|
||||
case cgnatNet.Contains(ip):
|
||||
return fmt.Errorf("remote endpoint %q resolves to CGNAT address %s", endpoint, ip)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// guardedDialer returns a DialContext that resolves the host itself and
|
||||
// re-applies checkBlockedIP to every resolved address immediately before
|
||||
// dialing. This closes the DNS-rebinding window between
|
||||
// validateRemoteEndpoint and the actual TCP connect performed by the AWS S3
|
||||
// client: even if the attacker's DNS flips to 127.0.0.1 (or any other
|
||||
// blocked range) after the up-front check, the dial is refused.
|
||||
func guardedDialer(endpoint string) func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
dialer := &net.Dialer{Timeout: 30 * time.Second, KeepAlive: 30 * time.Second}
|
||||
return func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
host, port, splitErr := net.SplitHostPort(addr)
|
||||
if splitErr != nil {
|
||||
return nil, splitErr
|
||||
}
|
||||
// If the host is already a literal IP just validate and dial it.
|
||||
if ip := net.ParseIP(host); ip != nil {
|
||||
if err := checkBlockedIP(endpoint, ip); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dialer.DialContext(ctx, network, addr)
|
||||
}
|
||||
// Otherwise resolve, validate every answer, and dial the first IP
|
||||
// that passes the deny list. Using a literal-IP target prevents the
|
||||
// kernel resolver in net.Dialer from looking the name up a second
|
||||
// time inside Dial and getting a different answer.
|
||||
addrs, lookupErr := lookupIPAddrFunc(ctx, host)
|
||||
if lookupErr != nil {
|
||||
return nil, fmt.Errorf("resolve remote endpoint host %q: %w", host, lookupErr)
|
||||
}
|
||||
var firstBlockErr error
|
||||
for _, a := range addrs {
|
||||
if err := checkBlockedIP(endpoint, a.IP); err != nil {
|
||||
if firstBlockErr == nil {
|
||||
firstBlockErr = err
|
||||
}
|
||||
continue
|
||||
}
|
||||
return dialer.DialContext(ctx, network, net.JoinHostPort(a.IP.String(), port))
|
||||
}
|
||||
if firstBlockErr != nil {
|
||||
return nil, firstBlockErr
|
||||
}
|
||||
return nil, fmt.Errorf("resolve remote endpoint host %q: no addresses", host)
|
||||
}
|
||||
}
|
||||
|
||||
// newGuardedHTTPClient returns an *http.Client whose transport refuses to
|
||||
// dial addresses that fail checkBlockedIP at connect time. It is meant for
|
||||
// per-request use; do not share across remote configs.
|
||||
func newGuardedHTTPClient(endpoint string) *http.Client {
|
||||
return &http.Client{
|
||||
Transport: &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
DialContext: guardedDialer(endpoint),
|
||||
ForceAttemptHTTP2: true,
|
||||
MaxIdleConns: 16,
|
||||
IdleConnTimeout: 60 * time.Second,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
ExpectContinueTimeout: 1 * time.Second,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (vs *VolumeServer) FetchAndWriteNeedle(ctx context.Context, req *volume_server_pb.FetchAndWriteNeedleRequest) (resp *volume_server_pb.FetchAndWriteNeedleResponse, err error) {
|
||||
if err := vs.checkGrpcAdminAuth(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := vs.CheckMaintenanceMode(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -188,25 +27,7 @@ func (vs *VolumeServer) FetchAndWriteNeedle(ctx context.Context, req *volume_ser
|
||||
|
||||
remoteConf := req.RemoteConf
|
||||
|
||||
var client remote_storage.RemoteStorageClient
|
||||
var getClientErr error
|
||||
if !vs.AllowUntrustedRemoteEndpoints && remoteConf != nil && remoteConf.Type == "s3" {
|
||||
// Endpoint validation is S3-specific: only RemoteConf.S3Endpoint
|
||||
// is a URL the volume server dials directly. Other backends
|
||||
// (gcs, azure, ...) authenticate against their own SDKs and
|
||||
// don't accept an attacker-controlled host.
|
||||
if validateErr := validateRemoteEndpoint(ctx, remoteConf.S3Endpoint); validateErr != nil {
|
||||
return nil, fmt.Errorf("reject remote endpoint: %w", validateErr)
|
||||
}
|
||||
// Build a one-shot S3 client whose dial path re-validates the
|
||||
// resolved IP every time. This pins the validated endpoint against
|
||||
// DNS rebinding (a hostname that resolves to a public IP for
|
||||
// validateRemoteEndpoint and then flips to 127.0.0.1 / 169.254.x.x
|
||||
// when the AWS SDK dials).
|
||||
client, getClientErr = s3remote.MakeWithHTTPClient(remoteConf, newGuardedHTTPClient(remoteConf.S3Endpoint))
|
||||
} else {
|
||||
client, getClientErr = remote_storage.GetRemoteStorage(remoteConf)
|
||||
}
|
||||
client, getClientErr := remote_storage.GetRemoteStorage(remoteConf)
|
||||
if getClientErr != nil {
|
||||
return nil, fmt.Errorf("get remote client: %w", getClientErr)
|
||||
}
|
||||
|
||||
@@ -1,270 +0,0 @@
|
||||
package weed_server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// stubLookup returns a resolver func that maps the supplied hostnames to
|
||||
// the supplied IP addresses, and errors for any host that is not in the map.
|
||||
func stubLookup(t *testing.T, mapping map[string][]net.IP) func(ctx context.Context, host string) ([]net.IPAddr, error) {
|
||||
t.Helper()
|
||||
return func(_ context.Context, host string) ([]net.IPAddr, error) {
|
||||
ips, ok := mapping[host]
|
||||
if !ok {
|
||||
return nil, &net.DNSError{Err: "no such host", Name: host, IsNotFound: true}
|
||||
}
|
||||
out := make([]net.IPAddr, 0, len(ips))
|
||||
for _, ip := range ips {
|
||||
out = append(out, net.IPAddr{IP: ip})
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateRemoteEndpoint(t *testing.T) {
|
||||
originalLookup := lookupIPAddrFunc
|
||||
t.Cleanup(func() { lookupIPAddrFunc = originalLookup })
|
||||
|
||||
lookupIPAddrFunc = stubLookup(t, map[string][]net.IP{
|
||||
"s3.us-east-1.amazonaws.com": {net.ParseIP("52.216.10.10")},
|
||||
"internal.example.com": {net.ParseIP("127.0.0.1")},
|
||||
"linklocal.example.com": {net.ParseIP("169.254.10.20")},
|
||||
"private.example.com": {net.ParseIP("10.1.2.3")},
|
||||
"private172.example.com": {net.ParseIP("172.20.0.5")},
|
||||
"private192.example.com": {net.ParseIP("192.168.1.1")},
|
||||
"cgnat.example.com": {net.ParseIP("100.64.0.42")},
|
||||
})
|
||||
|
||||
cases := []struct {
|
||||
name string
|
||||
endpoint string
|
||||
wantErr bool
|
||||
wantSub string
|
||||
}{
|
||||
{
|
||||
name: "empty",
|
||||
endpoint: "",
|
||||
wantErr: true,
|
||||
wantSub: "empty",
|
||||
},
|
||||
{
|
||||
name: "loopback literal",
|
||||
endpoint: "http://127.0.0.1:8080",
|
||||
wantErr: true,
|
||||
wantSub: "loopback",
|
||||
},
|
||||
{
|
||||
name: "ipv6 loopback",
|
||||
endpoint: "http://[::1]:8080",
|
||||
wantErr: true,
|
||||
wantSub: "loopback",
|
||||
},
|
||||
{
|
||||
name: "imds ipv4",
|
||||
endpoint: "http://169.254.169.254/",
|
||||
wantErr: true,
|
||||
wantSub: "metadata",
|
||||
},
|
||||
{
|
||||
name: "unspecified ipv4",
|
||||
endpoint: "http://0.0.0.0/",
|
||||
wantErr: true,
|
||||
wantSub: "unspecified",
|
||||
},
|
||||
{
|
||||
name: "link-local ipv6",
|
||||
endpoint: "http://[fe80::1]/",
|
||||
wantErr: true,
|
||||
wantSub: "link-local",
|
||||
},
|
||||
{
|
||||
name: "ftp scheme",
|
||||
endpoint: "ftp://example.com/",
|
||||
wantErr: true,
|
||||
wantSub: "http or https",
|
||||
},
|
||||
{
|
||||
name: "missing scheme",
|
||||
endpoint: "example.com/",
|
||||
wantErr: true,
|
||||
wantSub: "http or https",
|
||||
},
|
||||
{
|
||||
name: "imds hostname",
|
||||
endpoint: "http://metadata.google.internal/",
|
||||
wantErr: true,
|
||||
wantSub: "metadata service",
|
||||
},
|
||||
{
|
||||
name: "imds short hostname",
|
||||
endpoint: "http://metadata/",
|
||||
wantErr: true,
|
||||
wantSub: "metadata service",
|
||||
},
|
||||
{
|
||||
name: "host resolves to loopback",
|
||||
endpoint: "https://internal.example.com/",
|
||||
wantErr: true,
|
||||
wantSub: "loopback",
|
||||
},
|
||||
{
|
||||
name: "host resolves to link-local",
|
||||
endpoint: "https://linklocal.example.com/",
|
||||
wantErr: true,
|
||||
wantSub: "link-local",
|
||||
},
|
||||
{
|
||||
name: "rfc1918 10/8 literal",
|
||||
endpoint: "http://10.0.0.1/",
|
||||
wantErr: true,
|
||||
wantSub: "private",
|
||||
},
|
||||
{
|
||||
name: "rfc1918 172.16/12 literal",
|
||||
endpoint: "http://172.16.5.5/",
|
||||
wantErr: true,
|
||||
wantSub: "private",
|
||||
},
|
||||
{
|
||||
name: "rfc1918 192.168/16 literal",
|
||||
endpoint: "http://192.168.0.1/",
|
||||
wantErr: true,
|
||||
wantSub: "private",
|
||||
},
|
||||
{
|
||||
name: "cgnat literal",
|
||||
endpoint: "http://100.64.0.1/",
|
||||
wantErr: true,
|
||||
wantSub: "CGNAT",
|
||||
},
|
||||
{
|
||||
name: "host resolves to rfc1918 10/8",
|
||||
endpoint: "https://private.example.com/",
|
||||
wantErr: true,
|
||||
wantSub: "private",
|
||||
},
|
||||
{
|
||||
name: "host resolves to rfc1918 172/12",
|
||||
endpoint: "https://private172.example.com/",
|
||||
wantErr: true,
|
||||
wantSub: "private",
|
||||
},
|
||||
{
|
||||
name: "host resolves to rfc1918 192.168/16",
|
||||
endpoint: "https://private192.example.com/",
|
||||
wantErr: true,
|
||||
wantSub: "private",
|
||||
},
|
||||
{
|
||||
name: "host resolves to cgnat",
|
||||
endpoint: "https://cgnat.example.com/",
|
||||
wantErr: true,
|
||||
wantSub: "CGNAT",
|
||||
},
|
||||
{
|
||||
name: "public s3",
|
||||
endpoint: "https://s3.us-east-1.amazonaws.com/",
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
err := validateRemoteEndpoint(context.Background(), tc.endpoint)
|
||||
if tc.wantErr {
|
||||
if err == nil {
|
||||
t.Fatalf("expected error for %q, got nil", tc.endpoint)
|
||||
}
|
||||
if tc.wantSub != "" && !strings.Contains(err.Error(), tc.wantSub) {
|
||||
t.Fatalf("expected error to contain %q, got %v", tc.wantSub, err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error for %q: %v", tc.endpoint, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateRemoteEndpointResolverFailure(t *testing.T) {
|
||||
originalLookup := lookupIPAddrFunc
|
||||
t.Cleanup(func() { lookupIPAddrFunc = originalLookup })
|
||||
|
||||
resolveErr := errors.New("simulated DNS failure")
|
||||
lookupIPAddrFunc = func(_ context.Context, _ string) ([]net.IPAddr, error) {
|
||||
return nil, resolveErr
|
||||
}
|
||||
|
||||
err := validateRemoteEndpoint(context.Background(), "https://does-not-resolve.example.com/")
|
||||
if err == nil {
|
||||
t.Fatal("expected error when resolver fails")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "resolve remote endpoint host") {
|
||||
t.Fatalf("expected resolver error wrapping, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TestGuardedDialerRebind simulates a DNS rebinding attack: the host first
|
||||
// resolves to a public address (passing validateRemoteEndpoint) and then
|
||||
// flips to 127.0.0.1 on the very next lookup (what the AWS SDK would do at
|
||||
// dial time). The dial path must refuse the loopback answer instead of
|
||||
// connecting to it.
|
||||
func TestGuardedDialerRebind(t *testing.T) {
|
||||
originalLookup := lookupIPAddrFunc
|
||||
t.Cleanup(func() { lookupIPAddrFunc = originalLookup })
|
||||
|
||||
const host = "rebind.example.com"
|
||||
endpoint := "https://" + host + "/"
|
||||
|
||||
var calls atomic.Int32
|
||||
lookupIPAddrFunc = func(_ context.Context, name string) ([]net.IPAddr, error) {
|
||||
if name != host {
|
||||
return nil, &net.DNSError{Err: "no such host", Name: name, IsNotFound: true}
|
||||
}
|
||||
if calls.Add(1) == 1 {
|
||||
return []net.IPAddr{{IP: net.ParseIP("52.216.10.10")}}, nil
|
||||
}
|
||||
return []net.IPAddr{{IP: net.ParseIP("127.0.0.1")}}, nil
|
||||
}
|
||||
|
||||
if err := validateRemoteEndpoint(context.Background(), endpoint); err != nil {
|
||||
t.Fatalf("first-pass validation should accept public IP, got %v", err)
|
||||
}
|
||||
|
||||
dial := guardedDialer(endpoint)
|
||||
conn, err := dial(context.Background(), "tcp", host+":443")
|
||||
if conn != nil {
|
||||
conn.Close()
|
||||
t.Fatalf("guarded dialer must refuse loopback rebind, got conn")
|
||||
}
|
||||
if err == nil || !strings.Contains(err.Error(), "loopback") {
|
||||
t.Fatalf("guarded dialer should fail with loopback error, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TestGuardedDialerLiteralBlocked confirms that a literal blocked IP target
|
||||
// is refused without any DNS lookup.
|
||||
func TestGuardedDialerLiteralBlocked(t *testing.T) {
|
||||
originalLookup := lookupIPAddrFunc
|
||||
t.Cleanup(func() { lookupIPAddrFunc = originalLookup })
|
||||
lookupIPAddrFunc = func(_ context.Context, name string) ([]net.IPAddr, error) {
|
||||
t.Fatalf("resolver should not be called for IP literal target, got lookup of %q", name)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
dial := guardedDialer("http://10.0.0.5:80")
|
||||
conn, err := dial(context.Background(), "tcp", "10.0.0.5:80")
|
||||
if conn != nil {
|
||||
conn.Close()
|
||||
t.Fatalf("guarded dialer must refuse rfc1918 literal, got conn")
|
||||
}
|
||||
if err == nil || !strings.Contains(err.Error(), "private") {
|
||||
t.Fatalf("guarded dialer should fail with private-address error, got %v", err)
|
||||
}
|
||||
}
|
||||
@@ -34,32 +34,26 @@ type VolumeServer struct {
|
||||
readBufferSizeMB int
|
||||
|
||||
SeedMasterNodes []pb.ServerAddress
|
||||
// seedMasterSet mirrors SeedMasterNodes keyed by the canonical http
|
||||
// form. It is computed once in NewVolumeServer so admission paths can
|
||||
// answer is-this-a-seed-master in O(1).
|
||||
seedMasterSet map[string]struct{}
|
||||
whiteList []string
|
||||
currentMaster pb.ServerAddress
|
||||
currentMasterLock sync.RWMutex
|
||||
pulsePeriod time.Duration
|
||||
whiteList []string
|
||||
currentMaster pb.ServerAddress
|
||||
pulsePeriod time.Duration
|
||||
dataCenter string
|
||||
rack string
|
||||
store *storage.Store
|
||||
guard *security.Guard
|
||||
grpcDialOption grpc.DialOption
|
||||
|
||||
needleMapKind storage.NeedleMapKind
|
||||
ldbTimout int64
|
||||
FixJpgOrientation bool
|
||||
ReadMode string
|
||||
AllowUntrustedRemoteEndpoints bool
|
||||
compactionBytePerSecond int64
|
||||
maintenanceBytePerSecond int64
|
||||
metricsAddress string
|
||||
metricsIntervalSec int
|
||||
fileSizeLimitBytes int64
|
||||
isHeartbeating bool
|
||||
stopChan chan bool
|
||||
needleMapKind storage.NeedleMapKind
|
||||
ldbTimout int64
|
||||
FixJpgOrientation bool
|
||||
ReadMode string
|
||||
compactionBytePerSecond int64
|
||||
maintenanceBytePerSecond int64
|
||||
metricsAddress string
|
||||
metricsIntervalSec int
|
||||
fileSizeLimitBytes int64
|
||||
isHeartbeating bool
|
||||
stopChan chan bool
|
||||
}
|
||||
|
||||
func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
|
||||
@@ -82,7 +76,6 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
|
||||
hasSlowRead bool,
|
||||
readBufferSizeMB int,
|
||||
ldbTimeout int64,
|
||||
allowUntrustedRemoteEndpoints bool,
|
||||
) *VolumeServer {
|
||||
|
||||
v := util.GetViper()
|
||||
@@ -118,19 +111,10 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
|
||||
readBufferSizeMB: readBufferSizeMB,
|
||||
ldbTimout: ldbTimeout,
|
||||
whiteList: whiteList,
|
||||
AllowUntrustedRemoteEndpoints: allowUntrustedRemoteEndpoints,
|
||||
}
|
||||
|
||||
whiteList = append(whiteList, util.StringSplit(v.GetString("guard.white_list"), ",")...)
|
||||
// Copy the caller's slice so subsequent external mutation cannot desync
|
||||
// SeedMasterNodes from the frozen lookup set built below.
|
||||
seedMasters := make([]pb.ServerAddress, len(masterNodes))
|
||||
copy(seedMasters, masterNodes)
|
||||
vs.SeedMasterNodes = seedMasters
|
||||
vs.seedMasterSet = make(map[string]struct{}, len(seedMasters))
|
||||
for _, m := range seedMasters {
|
||||
vs.seedMasterSet[m.ToHttpAddress()] = struct{}{}
|
||||
}
|
||||
vs.SeedMasterNodes = masterNodes
|
||||
|
||||
vs.checkWithMaster()
|
||||
|
||||
|
||||
@@ -213,11 +213,28 @@ func (c *commandClusterCheck) Do(args []string, commandEnv *CommandEnv, writer i
|
||||
}
|
||||
}
|
||||
|
||||
// Direct volume-to-volume connectivity is intentionally not validated
|
||||
// here. Each volume server now restricts Ping to peers it can identify
|
||||
// (its configured/current masters), so it does not carry a peer-volume
|
||||
// list to drive a mesh check from. The master->volume and filer->volume
|
||||
// probes above do not exercise volume-to-volume reachability.
|
||||
// check between volume servers
|
||||
for _, sourceVolumeServer := range volumeServers {
|
||||
for _, targetVolumeServer := range volumeServers {
|
||||
if sourceVolumeServer == targetVolumeServer {
|
||||
continue
|
||||
}
|
||||
fmt.Fprintf(writer, "checking volume server %s to %s ... ", string(sourceVolumeServer), string(targetVolumeServer))
|
||||
err := pb.WithVolumeServerClient(false, sourceVolumeServer, commandEnv.option.GrpcDialOption, func(client volume_server_pb.VolumeServerClient) error {
|
||||
pong, err := client.Ping(context.Background(), &volume_server_pb.PingRequest{
|
||||
Target: string(targetVolumeServer),
|
||||
TargetType: cluster.VolumeServerType,
|
||||
})
|
||||
if err == nil {
|
||||
printTiming(writer, pong.StartTimeNs, pong.RemoteTimeNs, pong.StopTimeNs)
|
||||
}
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
fmt.Fprintf(writer, "%v\n", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check between filers, and need to connect to itself
|
||||
for _, sourceFiler := range filers {
|
||||
|
||||
Loaded 100 of 139 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user