mirror of
https://github.com/rustfs/rustfs.git
synced 2026-11-26 10:22:44 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 22f8fcec62 | |||
| 0275a3d1b5 |
@@ -1,500 +1,10 @@
|
||||
# Rulings for the gateway conformance lane. Each row covers the exact failure diagnostic(s) for one case.
|
||||
# Remove a row when the case passes. Review the referenced compatibility decision before expiry.
|
||||
# Backlog #2684 registers both R/K entries and the legacy response heads in rustfs/gateway#1159.
|
||||
# Official RustFS 1.0.5 and the gateway candidate both omit the region on a successful HeadBucket.
|
||||
|
||||
[[ruling]]
|
||||
case = "c-bkt-0008"
|
||||
ledger = "rustfs/gateway#1159"
|
||||
reason = "The RustFS profile preserves the absent bucket region on successful HeadBucket (rustfs/backlog#2684)."
|
||||
failure = "[expect/headers_present] at /expect/headers_present/x-amz-bucket-region: exchange #1, attempt 1: expected `x-amz-bucket-region: us-east-1`, observed no such header"
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-bkt-0009"
|
||||
ledger = "rustfs/gateway#1159"
|
||||
reason = "The RustFS profile preserves the absent bucket region on successful HeadBucket (rustfs/backlog#2684)."
|
||||
failure = "[expect/headers_present] at /expect/headers_present/x-amz-bucket-region: exchange #1, attempt 1: expected `x-amz-bucket-region: us-east-1`, observed no such header"
|
||||
expires = 2027-02-01
|
||||
|
||||
# Connection-close ruling: https://github.com/rustfs/backlog/issues/2684#issuecomment-7124472117
|
||||
|
||||
[[ruling]]
|
||||
case = "c-cred-0013"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "The released and native hosts both close this HTTP/1 connection after serving the expected refusal."
|
||||
failure = "[expect/connection_after] at /expect/connection_after: exchange #1, attempt 1: expected the connection to be `open` afterwards, observed `closed`"
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-cred-0016"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "The released and native hosts both close this HTTP/1 connection after serving the expected refusal."
|
||||
failure = "[expect/connection_after] at /expect/connection_after: exchange #1, attempt 1: expected the connection to be `open` afterwards, observed `closed`"
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-cred-0021"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "The released and native hosts both close this HTTP/1 connection after serving the expected refusal."
|
||||
failure = "[expect/connection_after] at /expect/connection_after: exchange #1, attempt 1: expected the connection to be `open` afterwards, observed `closed`"
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-cred-0026"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "The released and native hosts both close this HTTP/1 connection after serving the expected refusal."
|
||||
failure = "[expect/connection_after] at /expect/connection_after: exchange #1, attempt 1: expected the connection to be `open` afterwards, observed `closed`"
|
||||
expires = 2027-02-01
|
||||
|
||||
# Maintainer-signed accepted change: https://github.com/rustfs/backlog/issues/2684#issuecomment-7163283798
|
||||
|
||||
[[ruling]]
|
||||
case = "c-sig-0598"
|
||||
ledger = "rustfs/gateway#1349"
|
||||
reason = "Accepted change (R-053, rustfs/backlog#2684): unreadable access key grammar returns 403 AccessDenied instead of InvalidAccessKeyId."
|
||||
failures = [
|
||||
"[expect/error.code] at /expect/error/code: exchange #1, attempt 1: expected <Code>InvalidAccessKeyId</Code>, the body carried <Code>AccessDenied</Code>",
|
||||
"[expect/body.contains_utf8] at /expect/body: exchange #1, attempt 1: the body does not contain \"<Code>InvalidAccessKeyId</Code>\"",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
# Tracked IAM gap (R-065): https://github.com/rustfs/backlog/issues/2684#issuecomment-7163283798
|
||||
|
||||
[[ruling]]
|
||||
case = "c-cred-0020"
|
||||
ledger = "R-065"
|
||||
reason = "Tracked IAM gap (rustfs/rustfs#9559, rustfs/backlog#2684): expired STS session token returns 403 InvalidAccessKeyId instead of 400 ExpiredToken."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 400, observed 403",
|
||||
"[expect/error.code] at /expect/error/code: exchange #1, attempt 1: expected <Code>ExpiredToken</Code>, the body carried <Code>InvalidAccessKeyId</Code>",
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 52 (expected 196 bytes, observed 200 bytes)\n expected: …F-8\\\"?>\\n<Error><Code>ExpiredToken</Code><Message>the session …\n observed: …F-8\\\"?>\\n<Error><Code>InvalidAccessKeyId</Code><Message>The Ac…",
|
||||
"[expect/body.not_contains_utf8] at /expect/body: exchange #1, attempt 1: the body must not contain \"InvalidAccessKeyId\", found at byte 52",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
# Outer CORS middleware and HTTP/2 OPTIONS parity: https://github.com/rustfs/backlog/issues/2684#issuecomment-7163283798
|
||||
|
||||
[[ruling]]
|
||||
case = "c-cors-0034"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): outer CORS middleware answers OPTIONS preflight 200 before bucket routing."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 403, observed 200",
|
||||
"[expect/error.code] at /expect/error/code: exchange #1, attempt 1: expected <Code>AccessForbidden</Code>, the body carried no <Code> element at all",
|
||||
"[expect/error.request_id_present] at /expect/error/request_id_present: exchange #1, attempt 1: expected <RequestId> to be present and non-empty, it was absent",
|
||||
"[expect/headers_present] at /expect/headers_present/content-type: exchange #1, attempt 1: expected `content-type: application/xml`, observed no such header",
|
||||
"[expect/headers_present] at /expect/headers_present/vary: exchange #1, attempt 1: expected `vary: origin`, observed `Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Authorization, Cookie, X-Amz-Security-Token, X-Amz-Content-Sha256`",
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 0 (expected 211 bytes, observed 0 bytes)\n expected: <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<…\n observed: ",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-cors-0035"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): outer CORS middleware answers OPTIONS preflight 200 before bucket routing."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 403, observed 200",
|
||||
"[expect/error.code] at /expect/error/code: exchange #1, attempt 1: expected <Code>AccessForbidden</Code>, the body carried no <Code> element at all",
|
||||
"[expect/error.request_id_present] at /expect/error/request_id_present: exchange #1, attempt 1: expected <RequestId> to be present and non-empty, it was absent",
|
||||
"[expect/headers_present] at /expect/headers_present/content-type: exchange #1, attempt 1: expected `content-type: application/xml`, observed no such header",
|
||||
"[expect/headers_present] at /expect/headers_present/vary: exchange #1, attempt 1: expected `vary: origin`, observed `Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Authorization, Cookie, X-Amz-Security-Token, X-Amz-Content-Sha256`",
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 0 (expected 211 bytes, observed 0 bytes)\n expected: <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<…\n observed: ",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-cors-0036"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): outer CORS middleware answers OPTIONS preflight 200 before bucket routing."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 403, observed 200",
|
||||
"[expect/error.code] at /expect/error/code: exchange #1, attempt 1: expected <Code>AccessForbidden</Code>, the body carried no <Code> element at all",
|
||||
"[expect/error.request_id_present] at /expect/error/request_id_present: exchange #1, attempt 1: expected <RequestId> to be present and non-empty, it was absent",
|
||||
"[expect/headers_present] at /expect/headers_present/content-type: exchange #1, attempt 1: expected `content-type: application/xml`, observed no such header",
|
||||
"[expect/headers_present] at /expect/headers_present/vary: exchange #1, attempt 1: expected `vary: origin`, observed `Origin, Access-Control-Request-Method, Access-Control-Request-Headers, Authorization, Cookie, X-Amz-Security-Token, X-Amz-Content-Sha256`",
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 0 (expected 211 bytes, observed 0 bytes)\n expected: <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<…\n observed: ",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-cors-0043"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): outer CORS middleware handles OPTIONS without CORS headers without returning an S3 XML BadRequest body."
|
||||
failure = "[expect/error.code] at /expect/error/code: exchange #1, attempt 1: expected <Code>BadRequest</Code>, the body carried no <Code> element at all"
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-cors-0058"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): outer CORS middleware answers half-preflight OPTIONS with empty 400 instead of S3 403 AccessForbidden XML."
|
||||
failures = [
|
||||
"[expect/status] at /exchanges/0/expect/status: exchange #1, attempt 1: expected status 403, observed 400",
|
||||
"[expect/error.code] at /exchanges/0/expect/error/code: exchange #1, attempt 1: expected <Code>AccessForbidden</Code>, the body carried no <Code> element at all",
|
||||
"[expect/error.request_id_present] at /exchanges/0/expect/error/request_id_present: exchange #1, attempt 1: expected <RequestId> to be present and non-empty, it was absent",
|
||||
"[expect/status] at /exchanges/1/expect/status: exchange #2, attempt 1: expected status 403, observed 400",
|
||||
"[expect/error.code] at /exchanges/1/expect/error/code: exchange #2, attempt 1: expected <Code>AccessForbidden</Code>, the body carried no <Code> element at all",
|
||||
"[expect/error.request_id_present] at /exchanges/1/expect/error/request_id_present: exchange #2, attempt 1: expected <RequestId> to be present and non-empty, it was absent",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-h2-0001"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): outer CORS middleware serves OPTIONS over HTTP/2 with an empty body instead of S3 XML BadRequest."
|
||||
failure = "[expect/body.contains_utf8] at /expect/body: exchange #1, attempt 1: the body does not contain \"<Code>BadRequest</Code>\""
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-h2-0002"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): outer CORS middleware serves OPTIONS over HTTP/2 with an empty body instead of S3 XML BadRequest."
|
||||
failure = "[expect/body.contains_utf8] at /expect/body: exchange #1, attempt 1: the body does not contain \"<Code>BadRequest</Code>\""
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-h2-0003"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): outer CORS middleware answers OPTIONS with an empty body, so a 1-byte HTTP/2 flow-control window finishes immediately."
|
||||
failures = [
|
||||
"[expect/kind] at /expect/kind: exchange #1, attempt 1: expected the exchange to end as `hang`, it ended as `response`",
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 0 (expected 1 bytes, observed 0 bytes)\n expected: <\n observed: ",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-h2-0008"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): outer CORS middleware serves OPTIONS over HTTP/2 with an empty body instead of S3 XML BadRequest."
|
||||
failure = "[expect/body.contains_utf8] at /expect/body: exchange #1, attempt 1: the body does not contain \"<Code>BadRequest</Code>\""
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-h2-0010"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): outer CORS middleware serves OPTIONS over HTTP/2 with an empty body instead of S3 XML BadRequest."
|
||||
failure = "[expect/body.contains_utf8] at /expect/body: exchange #1, attempt 1: the body does not contain \"<Code>BadRequest</Code>\""
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-h2-0017"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): outer CORS middleware serves OPTIONS over HTTP/2 with an empty body instead of S3 XML BadRequest."
|
||||
failure = "[expect/body.contains_utf8] at /expect/body: exchange #1, attempt 1: the body does not contain \"<Code>BadRequest</Code>\""
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-h2-0018"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): outer CORS middleware serves OPTIONS over HTTP/2 with an empty body instead of S3 XML BadRequest."
|
||||
failure = "[expect/body.contains_utf8] at /expect/body: exchange #1, attempt 1: the body does not contain \"<Code>BadRequest</Code>\""
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-h2-0019"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): outer CORS middleware answers OPTIONS with an empty body before the client RST_STREAM interrupts a response body."
|
||||
failures = [
|
||||
"[expect/kind] at /expect/kind: exchange #1, attempt 1: expected the exchange to end as `client_reset`, it ended as `response`",
|
||||
"[expect/h2_control_frames] at /expect/h2_control_frames: exchange #1, attempt 1: received HTTP/2 control frames differ in count, order, or fields",
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 0 (expected 1 bytes, observed 0 bytes)\n expected: <\n observed: ",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-h2-0020"
|
||||
ledger = "rustfs/gateway#1120"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): outer CORS middleware answers OPTIONS with an empty body before the malformed RST_STREAM triggers a mid-body stream error."
|
||||
failures = [
|
||||
"[expect/kind] at /expect/kind: exchange #1, attempt 1: expected the exchange to end as `stream_error`, it ended as `response`",
|
||||
"[expect/stream_termination] at /expect/stream_termination: exchange #1, attempt 1: expected `abrupt_close`, observed `nothing`",
|
||||
"[expect/h2_control_frames] at /expect/h2_control_frames: exchange #1, attempt 1: received HTTP/2 control frames differ in count, order, or fields",
|
||||
"[expect/socket_read_after] at /expect/socket_read_after: exchange #1, attempt 1: receive-side termination: expected eof, observed no_termination_observed",
|
||||
"[expect/body_bytes_before_error] at /expect/body_bytes_before_error: exchange #1, attempt 1: expected 1 response bytes before the error, the transport did not record any",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
# Cleartext SSE-C error parity: https://github.com/rustfs/backlog/issues/2684#issuecomment-7163283798
|
||||
|
||||
[[ruling]]
|
||||
case = "c-ssec-0002"
|
||||
ledger = "rustfs/backlog#2762"
|
||||
reason = "Official 1.0.5 parity (rustfs/backlog#2684): cleartext GET with SSE-C headers on an absent object returns 404 NoSuchKey instead of 400 InvalidRequest."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 400, observed 404",
|
||||
"[expect/error.code] at /expect/error/code: exchange #1, attempt 1: expected <Code>InvalidRequest</Code>, the body carried <Code>NoSuchKey</Code>",
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 52 (expected 256 bytes, observed 163 bytes)\n expected: …F-8\\\"?>\\n<Error><Code>InvalidRequest</Code><Message>requests s…\n observed: …F-8\\\"?>\\n<Error><Code>NoSuchKey</Code><Message>The specified k…",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
# Maintainer-signed 1.0.5-identical compatibility rulings: https://github.com/rustfs/backlog/issues/2684#issuecomment-7163283798
|
||||
|
||||
[[ruling]]
|
||||
case = "c-acl-0001"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: default bucket ACL reports the RustFS owner display name and canonical ID instead of the conformance fixture owner."
|
||||
failures = [
|
||||
"[expect/body.golden] at /expect/body: exchange #1, attempt 1: bodies differ at byte 234 (expected 555 bytes, observed 545 bytes)\n expected: …lUser\\\"><DisplayName>conformance</DisplayName><ID>3f6e2b1c4a8…\n observed: …lUser\\\"><DisplayName>rustfs</DisplayName><ID>c19050dbcee97fda…",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-acl-0028"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: bucket ACL XML omits the newline after the XML declaration and uses the RustFS default owner."
|
||||
failures = [
|
||||
"[expect/body.golden] at /expect/body: exchange #1, attempt 1: bodies differ at byte 38 (expected 556 bytes, observed 545 bytes)\n expected: …\\\" encoding=\\\"UTF-8\\\"?>\\n<AccessControlPolicy xmlns=\\\"http://s3.a…\n observed: …\\\" encoding=\\\"UTF-8\\\"?><AccessControlPolicy xmlns=\\\"http://s3.am…",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-acl-0029"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: object ACL XML omits the newline after the XML declaration and uses the RustFS default owner."
|
||||
failures = [
|
||||
"[expect/body.golden] at /expect/body: exchange #1, attempt 1: bodies differ at byte 38 (expected 556 bytes, observed 545 bytes)\n expected: …\\\" encoding=\\\"UTF-8\\\"?>\\n<AccessControlPolicy xmlns=\\\"http://s3.a…\n observed: …\\\" encoding=\\\"UTF-8\\\"?><AccessControlPolicy xmlns=\\\"http://s3.am…",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-bkt-0026"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: single-region server rejects creating the foreign-region fixture bucket with status 400."
|
||||
failure = "[runner/fixture-refused] at /setup: external fixture PUT for bucket `conf-bkt-far` returned status 400; the failed create is not owned"
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-bucketconfig-0030"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: GetBucketPolicyStatus on a bucket without a policy returns 200 instead of 404 NoSuchBucketPolicy."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 404, observed 200",
|
||||
"[expect/error.code] at /expect/error/code: exchange #1, attempt 1: expected <Code>NoSuchBucketPolicy</Code>, the body carried no <Code> element at all",
|
||||
"[expect/error.request_id_present] at /expect/error/request_id_present: exchange #1, attempt 1: expected <RequestId> to be present and non-empty, it was absent",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-bucketconfig-0031"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: GetPublicAccessBlock on an unconfigured bucket returns 500 instead of 404 NoSuchPublicAccessBlockConfiguration."
|
||||
failure = "[expect/status] at /expect/status: exchange #1, attempt 1: expected status 404, observed 500"
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-cred-0003"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: static external-endpoint server has no fixture STS session token and returns 403."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 200, observed 403",
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 0 (expected 16 bytes, observed 224 bytes)\n expected: credential-probe\n observed: <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<…",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-cred-0008"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: unknown access key returns the standard S3 InvalidAccessKeyId error message instead of the redacted conformance text."
|
||||
failures = [
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 86 (expected 201 bytes, observed 200 bytes)\n expected: …eyId</Code><Message>the request was not authenticated</Messa…\n observed: …eyId</Code><Message>The Access Key Id you provided does not …",
|
||||
"[expect/body.not_contains_utf8] at /expect/body: exchange #1, attempt 1: the body must not contain \"does not exist\", found at byte 117",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-cred-0009"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: wrong secret key returns the standard S3 SignatureDoesNotMatch error message instead of the redacted conformance text."
|
||||
failures = [
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 89 (expected 204 bytes, observed 356 bytes)\n expected: …atch</Code><Message>the request was not authenticated</Messa…\n observed: …atch</Code><Message>The request signature we calculated does…",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-cred-0010"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: unknown or disabled credential returns the standard S3 InvalidAccessKeyId error message instead of the redacted conformance text."
|
||||
failures = [
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 86 (expected 201 bytes, observed 200 bytes)\n expected: …eyId</Code><Message>the request was not authenticated</Messa…\n observed: …eyId</Code><Message>The Access Key Id you provided does not …",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-encryption-0012"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: GetBucketEncryption on an unconfigured bucket returns 400 with hyphenated server-side wording instead of 404."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 404, observed 400",
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 124 (expected 250 bytes, observed 222 bytes)\n expected: …><Message>The server side encryption configuration was not f…\n observed: …><Message>The server-side encryption configuration was not f…",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-host-0006"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: virtual-host routing does not resolve this mid-domain Host header to path style and returns 404 XML."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 200, observed 404",
|
||||
"[expect/headers_present] at /expect/headers_present/content-type: exchange #1, attempt 1: expected `content-type: text/plain; charset=utf-8`, observed `application/xml`",
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 0 (expected 14 bytes, observed 192 bytes)\n expected: virtual hosted\n observed: <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<…",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-host-0009"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: unrecognized multi-label Host prefix returns 404 XML instead of path-style 200."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 200, observed 404",
|
||||
"[expect/headers_present] at /expect/headers_present/content-type: exchange #1, attempt 1: expected `content-type: text/plain; charset=utf-8`, observed `application/xml`",
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 0 (expected 14 bytes, observed 192 bytes)\n expected: virtual hosted\n observed: <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<…",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-host-0010"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: punycode Host bucket label is rejected with 400 XML instead of falling back to path style."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 200, observed 400",
|
||||
"[expect/headers_present] at /expect/headers_present/content-type: exchange #1, attempt 1: expected `content-type: text/plain; charset=utf-8`, observed `application/xml`",
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 0 (expected 14 bytes, observed 222 bytes)\n expected: virtual hosted\n observed: <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<…",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-host-0011"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: illegal Host bucket label is rejected with 400 XML instead of falling back to path style."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 200, observed 400",
|
||||
"[expect/headers_present] at /expect/headers_present/content-type: exchange #1, attempt 1: expected `content-type: text/plain; charset=utf-8`, observed `application/xml`",
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 0 (expected 14 bytes, observed 222 bytes)\n expected: virtual hosted\n observed: <?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<…",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-lifecycle-0013"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: NoSuchLifecycleConfiguration message includes a trailing period and omits HostId."
|
||||
failures = [
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 138 (expected 220 bytes, observed 192 bytes)\n expected: …ation does not exist</Message><RequestId>__REDACTED__</Reque…\n observed: …ation does not exist.</Message><RequestId>__REDACTED__</Requ…",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-location-0001"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: single-region server rejects creating the foreign-region fixture bucket with status 400."
|
||||
failure = "[runner/fixture-refused] at /setup: external fixture PUT for bucket `conf-location-far` returned status 400; the failed create is not owned"
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-location-0005"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: GetBucketLocation accepts the request and returns 200 LocationConstraint instead of 400 AuthorizationHeaderMalformed."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 400, observed 200",
|
||||
"[expect/error.code] at /expect/error/code: exchange #1, attempt 1: expected <Code>AuthorizationHeaderMalformed</Code>, the body carried no <Code> element at all",
|
||||
"[expect/error.request_id_present] at /expect/error/request_id_present: exchange #1, attempt 1: expected <RequestId> to be present and non-empty, it was absent",
|
||||
"[expect/body.contains_utf8] at /expect/body: exchange #1, attempt 1: the body does not contain \"<Code>AuthorizationHeaderMalformed</Code>\"",
|
||||
"[expect/body.contains_utf8] at /expect/body: exchange #1, attempt 1: the body does not contain \"<Region>us-east-1</Region>\"",
|
||||
"[expect/body.not_contains_utf8] at /expect/body: exchange #1, attempt 1: the body must not contain \"<LocationConstraint\", found at byte 38",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-lock-0011"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: ObjectLockConfigurationNotFoundError XML omits the HostId element."
|
||||
failures = [
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 206 (expected 242 bytes, observed 213 bytes)\n expected: …ACTED__</RequestId><HostId>__REDACTED__</HostId></Error>\n observed: …ACTED__</RequestId></Error>",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-lock-0029"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: NoSuchBucket XML on GetObjectLockConfiguration omits the HostId element."
|
||||
failures = [
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 161 (expected 197 bytes, observed 168 bytes)\n expected: …ACTED__</RequestId><HostId>__REDACTED__</HostId></Error>\n observed: …ACTED__</RequestId></Error>",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-naming-0033"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: escaped slash in the first path segment fails signature verification (403 SignatureDoesNotMatch) before bucket-name validation."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 400, observed 403",
|
||||
"[expect/error.code] at /expect/error/code: exchange #1, attempt 1: expected <Code>InvalidBucketName</Code>, the body carried <Code>SignatureDoesNotMatch</Code>",
|
||||
"[expect/body.contains_utf8] at /expect/body: exchange #1, attempt 1: the body does not contain \"<Code>InvalidBucketName</Code>\"",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-replication-0013"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: ReplicationConfigurationNotFoundError carries the legacy 'replication not found' message."
|
||||
failures = [
|
||||
"[expect/body.exact_utf8] at /expect/body: exchange #1, attempt 1: bodies differ at byte 105 (expected 230 bytes, observed 179 bytes)\n expected: …rror</Code><Message>The replication configuration was not fo…\n observed: …rror</Code><Message>replication not found</Message><RequestI…",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-sig-0506"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: SigV2 request using x-amz-date with an empty Date slot is rejected with 400."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 200, observed 400",
|
||||
"[expect/body.contains_utf8] at /expect/body: exchange #1, attempt 1: the body does not contain \"<ListAllMyBucketsResult\"",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-sig-0597"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: empty credential scope region returns SignatureDoesNotMatch for both header and presigned exchanges."
|
||||
failures = [
|
||||
"[expect/error.code] at /exchanges/0/expect/error/code: exchange #1 header, attempt 1: expected <Code>InvalidAccessKeyId</Code>, the body carried <Code>SignatureDoesNotMatch</Code>",
|
||||
"[expect/body.contains_utf8] at /exchanges/0/expect/body: exchange #1 header, attempt 1: the body does not contain \"<Code>InvalidAccessKeyId</Code>\"",
|
||||
"[expect/error.code] at /exchanges/1/expect/error/code: exchange #2 presigned, attempt 1: expected <Code>AccessDenied</Code>, the body carried <Code>SignatureDoesNotMatch</Code>",
|
||||
"[expect/body.contains_utf8] at /exchanges/1/expect/body: exchange #2 presigned, attempt 1: the body does not contain \"<Code>AccessDenied</Code>\"",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-sig-0599"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: out-of-grammar credential scope region returns 403 SignatureDoesNotMatch instead of 400 AuthorizationHeaderMalformed."
|
||||
failures = [
|
||||
"[expect/status] at /expect/status: exchange #1, attempt 1: expected status 400, observed 403",
|
||||
"[expect/error.code] at /expect/error/code: exchange #1, attempt 1: expected <Code>AuthorizationHeaderMalformed</Code>, the body carried <Code>SignatureDoesNotMatch</Code>",
|
||||
"[expect/body.contains_utf8] at /expect/body: exchange #1, attempt 1: the body does not contain \"<Code>AuthorizationHeaderMalformed</Code>\"",
|
||||
"[expect/body.contains_utf8] at /expect/body: exchange #1, attempt 1: the body does not contain \"<Region>us-east-1</Region>\"",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-sig-0600"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: overlong credential scope region returns SignatureDoesNotMatch instead of InvalidAccessKeyId."
|
||||
failures = [
|
||||
"[expect/error.code] at /expect/error/code: exchange #1, attempt 1: expected <Code>InvalidAccessKeyId</Code>, the body carried <Code>SignatureDoesNotMatch</Code>",
|
||||
"[expect/body.contains_utf8] at /expect/body: exchange #1, attempt 1: the body does not contain \"<Code>InvalidAccessKeyId</Code>\"",
|
||||
]
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-sig-0604"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: unsigned x-amz-* metadata header returns AccessDenied after credential lookup instead of SignatureDoesNotMatch."
|
||||
failure = "[expect/error.code] at /expect/error/code: exchange #1, attempt 1: expected <Code>SignatureDoesNotMatch</Code>, the body carried <Code>AccessDenied</Code>"
|
||||
expires = 2027-02-01
|
||||
|
||||
[[ruling]]
|
||||
case = "c-sig-0605"
|
||||
ledger = "rustfs/backlog#2684"
|
||||
reason = "Official 1.0.5 parity: presigned URL with unlisted payload declaration header returns AccessDenied instead of SignatureDoesNotMatch."
|
||||
failure = "[expect/error.code] at /expect/error/code: exchange #1, attempt 1: expected <Code>SignatureDoesNotMatch</Code>, the body carried <Code>AccessDenied</Code>"
|
||||
expires = 2027-02-01
|
||||
# Rulings for the gateway conformance lane (.github/workflows/gateway-acceptance.yml).
|
||||
#
|
||||
# One row per case that fails on the GATEWAY stack for a reviewed reason: `case`; `ledger`, the
|
||||
# rustfs/backlog#2684 entry that accepts the difference (R-0xx or K-n); a one-line `reason`; and
|
||||
# `failure`, a prefix of the failure the ruling accepts, as the runner's report.json renders it
|
||||
# (`[expect/status] at /expect/status: exchange #1, attempt 1: expected status 400, observed 403`).
|
||||
# scripts/check_conformance_rulings.py fails the lane on a failed case without a row, on a ruled
|
||||
# case whose failures do not start with its `failure`, and on a row whose case no longer fails or
|
||||
# no longer exists. The legacy stack is a reference run and takes no rulings: the `rustfs` profile
|
||||
# describes the gateway edge, not the legacy one.
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
sha256-linux=983efba6508e684db29bbdb923485fcc1c4fb312fc47fe101f7f27620906978b
|
||||
sha256-darwin=983efba6508e684db29bbdb923485fcc1c4fb312fc47fe101f7f27620906978b
|
||||
sha256-linux=348fa5eed9ae58962c06b33283ff4f15122cff97bce9b4eb1e3ffcb227264b0b
|
||||
sha256-darwin=348fa5eed9ae58962c06b33283ff4f15122cff97bce9b4eb1e3ffcb227264b0b
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
sha256-darwin=107ad4762081d210db76cc622111c8664f69b29453bf5397d3575103badbc101
|
||||
sha256-linux=19762635332bbcc717a2d8af1541c23949e8381131b93466b4c39b995eccea14
|
||||
sha256-darwin=9ccb03f4139e99ec11a63810523d504df39191b86e74b28a72dd9a075682293b
|
||||
sha256-linux=5ef052b03a03afbd00ebfcbbdcb754bbde414b7e6151aae3e2ee78024ce1d0b6
|
||||
|
||||
@@ -1 +1 @@
|
||||
sha256=a88a5a77a1d038975bab9c66c77d113861721573978a99bb8df778811f4b4af7
|
||||
sha256=fd5683273bba1eae3b4402a4e854a5d168ace845bd0e5fc801f8e336485a4394
|
||||
|
||||
@@ -1,787 +0,0 @@
|
||||
# Ordinary S3 compatibility tests for gateway wire capture. The nightly run includes the smoke cases.
|
||||
|
||||
[smoke]
|
||||
e2e = [
|
||||
"listing_regression_test::tests::test_list_objects_v2_completeness_100_objects",
|
||||
"listing_regression_test::tests::test_list_objects_v2_delimiter_common_prefixes",
|
||||
"listing_regression_test::tests::test_list_objects_v2_is_truncated_correctness",
|
||||
"listing_regression_test::tests::test_list_objects_v2_prefix_filter_correctness",
|
||||
]
|
||||
ceph = [
|
||||
"test_bucket_listv2_prefix_basic",
|
||||
"test_bucket_listv2_continuationtoken",
|
||||
"test_object_head_zero_bytes",
|
||||
"test_object_write_file",
|
||||
"test_multipart_copy_small",
|
||||
"test_multipart_upload_resend_part",
|
||||
"test_multipart_upload_contents",
|
||||
]
|
||||
|
||||
[nightly_extra]
|
||||
e2e = [
|
||||
"anonymous_access_test::ghsa_x298_anonymous_list_object_versions_denied_when_restrict_public_buckets_enabled",
|
||||
"anonymous_access_test::test_anonymous_access_allowed_when_public_access_block_missing",
|
||||
"anonymous_access_test::test_anonymous_access_allowed_when_restrict_public_buckets_disabled",
|
||||
"anonymous_access_test::test_anonymous_access_denied_when_restrict_public_buckets_enabled",
|
||||
"anonymous_access_test::test_plain_http_matches_secure_transport_false_bucket_policy",
|
||||
"anonymous_access_test::test_root_requests_keep_policy_owner_flag",
|
||||
"api_rate_limit_test::api_rate_limit_bucket_dimension_throttles_per_bucket",
|
||||
"api_rate_limit_test::api_rate_limit_enforces_429_with_retry_after_when_enabled",
|
||||
"api_rate_limit_test::api_rate_limit_stays_inert_by_default",
|
||||
"archive_download_integrity_test::tests::test_archive_download_roundtrip_with_http_compression_enabled",
|
||||
"archive_download_integrity_test::tests::test_archive_multipart_roundtrip_preserves_bytes",
|
||||
"archive_download_integrity_test::tests::test_archive_multipart_with_aws_chunked_allowed_when_strict_mode_enabled",
|
||||
"archive_download_integrity_test::tests::test_archive_multipart_with_aws_chunked_and_effective_encoding_rejects_when_strict_mode_enabled",
|
||||
"archive_download_integrity_test::tests::test_archive_multipart_with_aws_chunked_and_effective_encoding_roundtrips_by_default",
|
||||
"archive_download_integrity_test::tests::test_archive_put_allows_content_encoding_by_default",
|
||||
"archive_download_integrity_test::tests::test_archive_put_rejects_content_encoding_when_strict_mode_enabled",
|
||||
"archive_download_integrity_test::tests::test_archive_put_with_aws_chunked_allowed_when_strict_mode_enabled",
|
||||
"archive_download_integrity_test::tests::test_archive_put_with_aws_chunked_and_effective_encoding_rejects_when_strict_mode_enabled",
|
||||
"archive_download_integrity_test::tests::test_archive_put_with_aws_chunked_and_effective_encoding_roundtrips_by_default",
|
||||
"archive_download_integrity_test::tests::test_archive_put_with_aws_chunked_does_not_persist_content_encoding_by_default",
|
||||
"archive_download_integrity_test::tests::test_multipart_get_ignores_empty_conditional_etag_headers",
|
||||
"archive_download_integrity_test::tests::test_presigned_get_and_reverse_proxy_preserve_multipart_bytes",
|
||||
"bucket_logging_test::tests::test_dummy_bucket_compatibility_endpoints",
|
||||
"bucket_logging_test::tests::test_dummy_bucket_compatibility_endpoints_no_such_bucket",
|
||||
"bucket_logging_test::tests::test_dummy_bucket_endpoints_http_contracts",
|
||||
"checksum_upload_test::tests::test_additional_checksums_verify_on_write",
|
||||
"checksum_upload_test::tests::test_complete_multipart_rejects_contradicting_checksum_type",
|
||||
"checksum_upload_test::tests::test_crc64nvme_matches_between_put_object_and_multipart_upload",
|
||||
"checksum_upload_test::tests::test_full_object_multipart_reports_full_object_checksum_type",
|
||||
"checksum_upload_test::tests::test_head_object_returns_sse_s3_checksum",
|
||||
"checksum_upload_test::tests::test_head_object_returns_stored_sha256",
|
||||
"checksum_upload_test::tests::test_multipart_upload_with_checksum",
|
||||
"checksum_upload_test::tests::test_put_object_rejects_mismatched_sha256",
|
||||
"checksum_upload_test::tests::test_put_object_with_checksum_sha256",
|
||||
"checksum_upload_test::tests::test_put_object_with_content_md5",
|
||||
"compression_test::test_compression_multipart_high_ratio_binary_roundtrip",
|
||||
"compression_test::test_compression_multipart_roundtrip",
|
||||
"compression_test::test_compression_multipart_sse_s3_roundtrip",
|
||||
"compression_test::test_compression_multipart_three_parts_part_number_gets",
|
||||
"compression_test::test_compression_multipart_upload_part_copy_roundtrip",
|
||||
"compression_test::test_compression_roundtrip",
|
||||
"conditional_delete_objects_test::sdk_conditional_delete_objects_mixed_results_overwrites_duplicates_and_quiet",
|
||||
"conditional_delete_objects_test::sdk_conditional_delete_objects_versioning_current_markers_and_explicit_versions",
|
||||
"content_encoding_test::tests::test_content_encoding_aws_chunked_not_returned_issue_1857",
|
||||
"content_encoding_test::tests::test_content_encoding_aws_chunked_with_effective_encoding_roundtrip",
|
||||
"content_encoding_test::tests::test_content_encoding_roundtrip",
|
||||
"copy_object_checksum_test::tests::test_copy_rejects_unknown_algorithm_without_destination_mutation",
|
||||
"copy_object_checksum_test::tests::test_copy_requested_algorithm_overrides_source_checksum",
|
||||
"copy_object_checksum_test::tests::test_copy_supports_all_checksum_algorithms",
|
||||
"copy_object_checksum_test::tests::test_copy_with_checksum_algorithm_returns_and_persists_sha256",
|
||||
"copy_object_checksum_test::tests::test_copy_without_algorithm_preserves_composite_checksum_type",
|
||||
"copy_object_checksum_test::tests::test_copy_without_algorithm_preserves_every_supported_source_checksum",
|
||||
"copy_object_checksum_test::tests::test_copy_without_algorithm_preserves_source_checksum",
|
||||
"copy_object_metadata_test::tests::copy_object_replace_accepts_each_standard_field_independently",
|
||||
"copy_object_metadata_test::tests::copy_object_replace_handles_versioned_multipart_source",
|
||||
"copy_object_metadata_test::tests::copy_object_standard_metadata_copy_replace_and_clear",
|
||||
"copy_object_metadata_test::tests::invalid_replacement_metadata_does_not_mutate_destination",
|
||||
"copy_object_tagging_test::tests::copy_object_applies_copy_replace_and_empty_tagging_directives",
|
||||
"copy_object_tagging_test::tests::copy_object_tag_replacement_honors_request_tag_policy_denial",
|
||||
"copy_object_version_restore_test::tests::test_copy_of_non_latest_source_version_returns_copy_source_version_id",
|
||||
"copy_object_version_restore_test::tests::test_self_copy_of_historical_version_restores_data_and_metadata",
|
||||
"copy_source_invalid_date_test::tests::test_copy_source_if_unmodified_since_valid_and_invalid",
|
||||
"create_bucket_region_test::tests::test_create_bucket_accepts_listed_regions",
|
||||
"create_bucket_region_test::tests::test_create_bucket_duplicate_in_default_region_is_idempotent_for_iam_user",
|
||||
"create_bucket_region_test::tests::test_create_bucket_duplicate_outside_default_region_reports_owned_by_you",
|
||||
"create_bucket_region_test::tests::test_create_bucket_location_constraint_policy_allow",
|
||||
"create_bucket_region_test::tests::test_create_bucket_location_constraint_policy_deny",
|
||||
"create_bucket_region_test::tests::test_create_bucket_rejects_unserved_location_constraints",
|
||||
"create_bucket_region_test::tests::test_create_bucket_uses_configured_region",
|
||||
"create_bucket_region_test::tests::test_create_bucket_with_us_east_1_location_constraint",
|
||||
"create_bucket_region_test::tests::test_create_bucket_without_location_constraint",
|
||||
"delete_marker_migration_semantics_test::tests::conditional_writes_cannot_replace_delete_marker_with_if_match",
|
||||
"delete_marker_migration_semantics_test::tests::test_versioning_delete_marker_plus_history_remains_visible_for_migration_proof",
|
||||
"delete_marker_migration_semantics_test::tests::test_versioning_only_delete_marker_has_minio_compatible_visibility_for_migration_proof",
|
||||
"delete_object_no_content_length_test::tests::test_delete_object_version_without_content_length_succeeds",
|
||||
"delete_objects_versioning_test::tests::test_delete_objects_delete_marker_immediately_visible",
|
||||
"delete_objects_versioning_test::tests::test_delete_objects_multiple_keys_delete_markers_immediately_visible",
|
||||
"delete_objects_versioning_test::tests::test_explicit_delete_marker_batch_removes_versions_without_client_retries",
|
||||
"delete_regression_test::tests::test_batch_delete_removes_all_objects",
|
||||
"delete_regression_test::tests::test_delete_removes_object_from_list",
|
||||
"delete_regression_test::tests::test_delete_removes_object_head_returns_404",
|
||||
"delete_regression_test::tests::test_versioned_delete_marker_and_list_consistency",
|
||||
"delete_regression_test::tests::test_versioned_permanent_delete",
|
||||
"dual_stack_differential::tests::both_stacks_answer_every_operation_identically",
|
||||
"get_object_parts_count_test::get_object_reports_parts_count_for_multipart_upload",
|
||||
"head_object_consistency_test::head_object_consistency_after_write_and_multipart_and_presigned_head",
|
||||
"head_object_range_test::head_object_advertises_accept_ranges",
|
||||
"kms::configured_roundtrip_test::test_admin_configured_local_kms_is_restored_after_restart",
|
||||
"kms::configured_roundtrip_test::test_configured_local_kms_admin_and_versioned_cleanup",
|
||||
"kms::copy_object_version_restore_sse_test::test_self_copy_of_historical_sse_s3_version_is_readable",
|
||||
"kms::encrypted_range_get_test::sse_s3_single_part_ranged_gets_are_byte_exact",
|
||||
"kms::kms_edge_cases_test::test_kms_single_byte_file_encryption",
|
||||
"kms::kms_edge_cases_test::test_kms_zero_byte_file_encryption",
|
||||
"kms::multipart_encryption_test::test_step1_basic_single_file_encryption",
|
||||
"leading_slash_key_test::tests::test_put_object_with_duplicate_slashes_normalized",
|
||||
"leading_slash_key_test::tests::test_put_object_with_leading_slash_key",
|
||||
"lifecycle_regression_test::tests::test_delete_marker_creation_and_visibility",
|
||||
"lifecycle_regression_test::tests::test_lifecycle_expiration_rule_persists_correctly",
|
||||
"lifecycle_regression_test::tests::test_lifecycle_noncurrent_version_expiration_rule_persists",
|
||||
"lifecycle_regression_test::tests::test_lifecycle_prefix_rule_persists",
|
||||
"list_buckets_auth_test::bucket_scoped_policy_returns_only_authorized_bucket",
|
||||
"list_buckets_double_slash_test::tests::test_double_slash_rewrite_is_narrowly_scoped",
|
||||
"list_buckets_double_slash_test::tests::test_list_buckets_double_slash_browser_compat",
|
||||
"list_buckets_double_slash_test::tests::test_list_buckets_single_slash",
|
||||
"list_buckets_iam_filter_test::list_buckets_filters_with_iam_bucket_resources",
|
||||
"list_object_versions_metadata_extension_test::tests::test_list_object_versions_metadata_extension_returns_metadata_tags_and_internal",
|
||||
"list_object_versions_regression_test::tests::test_list_object_versions_immediately_returns_latest_put_after_delete_marker",
|
||||
"list_object_versions_regression_test::tests::test_list_object_versions_prefix_with_marker_object_returns_children",
|
||||
"list_objects_duplicates_test::tests::test_list_objects_v2_exact_prefix_pagination_boundaries",
|
||||
"list_objects_duplicates_test::tests::test_list_objects_v2_object_and_same_named_prefix_coexist",
|
||||
"list_objects_duplicates_test::tests::test_list_objects_v2_prefix_marker_pagination",
|
||||
"list_objects_duplicates_test::tests::test_list_objects_v2_prefix_marker_preserves_metadata",
|
||||
"list_objects_duplicates_test::tests::test_list_objects_v2_unique_common_prefixes",
|
||||
"list_objects_duplicates_test::tests::test_list_objects_v2_unique_contents_with_explicit_directory_markers",
|
||||
"list_objects_v2_metadata_extension_test::tests::test_list_objects_v2_metadata_extension_returns_metadata_tags_and_internal",
|
||||
"list_objects_v2_pagination_test::tests::test_list_objects_v2_continuation_keeps_keys_after_marker_stem",
|
||||
"list_objects_v2_pagination_test::tests::test_list_objects_v2_delimiter_collapsed_prefix_no_false_truncation",
|
||||
"list_objects_v2_pagination_test::tests::test_list_objects_v2_delimiter_small_page_traverses_all",
|
||||
"list_objects_v2_pagination_test::tests::test_list_objects_v2_empty_bucket",
|
||||
"list_objects_v2_pagination_test::tests::test_list_objects_v2_max_keys_above_limit_returns_token",
|
||||
"list_objects_v2_pagination_test::tests::test_list_objects_v2_max_keys_equals_object_count",
|
||||
"list_objects_v2_pagination_test::tests::test_list_objects_v2_max_keys_zero",
|
||||
"list_objects_v2_pagination_test::tests::test_list_objects_v2_maxkeys_above_limit_with_delimiter",
|
||||
"list_objects_v2_pagination_test::tests::test_list_objects_v2_not_truncated_when_all_objects_returned",
|
||||
"list_objects_v2_pagination_test::tests::test_list_objects_v2_pagination_with_continuation_token",
|
||||
"list_objects_v2_pagination_test::tests::test_list_objects_v2_raw_exceeds_maxkeys_but_visible_below",
|
||||
"list_objects_v2_pagination_test::tests::test_list_objects_v2_repeated_prefix_continuation",
|
||||
"multipart_auth_test::test_anonymous_post_object_accepts_fields_covered_by_policy_conditions",
|
||||
"multipart_auth_test::test_anonymous_post_object_accepts_form_fields_covered_by_policy_conditions",
|
||||
"multipart_auth_test::test_anonymous_post_object_accepts_success_action_redirect_exact_policy_match",
|
||||
"multipart_auth_test::test_anonymous_post_object_defaults_to_no_content",
|
||||
"multipart_auth_test::test_anonymous_post_object_honors_success_action_redirect",
|
||||
"multipart_auth_test::test_anonymous_post_object_honors_success_action_status",
|
||||
"multipart_auth_test::test_signed_put_object_extract_accepts_compat_header",
|
||||
"multipart_auth_test::test_signed_put_object_extract_expands_s2_and_lz4_by_magic_with_raw_etags",
|
||||
"multipart_auth_test::test_signed_put_object_extract_expands_tar_entries_with_prefix_headers",
|
||||
"multipart_auth_test::test_signed_put_object_extract_expands_tar_gz_archive",
|
||||
"multipart_auth_test::test_signed_put_object_extract_expands_tbz2_archive",
|
||||
"multipart_auth_test::test_signed_put_object_extract_normalizes_prefix_header_value",
|
||||
"multipart_auth_test::test_signed_put_object_extract_pax_retention_overrides_request_retention",
|
||||
"multipart_auth_test::test_signed_put_object_extract_preserves_directory_markers_by_default",
|
||||
"multipart_auth_test::test_signed_put_object_extract_preserves_entry_mtime",
|
||||
"multipart_auth_test::test_signed_put_object_extract_preserves_object_lock_legal_hold",
|
||||
"multipart_auth_test::test_signed_put_object_extract_preserves_object_lock_retention",
|
||||
"multipart_auth_test::test_signed_put_object_extract_preserves_request_metadata_on_extracted_objects",
|
||||
"multipart_auth_test::test_signed_put_object_extract_preserves_sse_c",
|
||||
"multipart_auth_test::test_signed_put_object_extract_preserves_sse_s3_and_redirect",
|
||||
"multipart_copy_readiness_test::harbor_style_multipart_staging_copy_object_boundaries",
|
||||
"multipart_copy_readiness_test::multipart_complete_invalid_etag_returns_400_and_preserves_retry",
|
||||
"multipart_storage_class_test::tests::invalid_and_aborted_uploads_leave_no_session_or_object",
|
||||
"multipart_storage_class_test::tests::list_parts_sdk_paginator_terminates_and_preserves_completion",
|
||||
"multipart_storage_class_test::tests::multipart_copy_preserves_standard_and_rrs",
|
||||
"multipart_storage_class_test::tests::multipart_upload_preserves_standard_and_rrs_across_retry_and_resume",
|
||||
"multipart_upload_id_test::tests::aborted_upload_id_reports_no_such_upload_on_every_upload_operation",
|
||||
"multipart_upload_id_test::tests::malformed_upload_id_reports_no_such_upload_on_every_upload_operation",
|
||||
"negative_sigv4_test::aws_chunked_decoded_length_mismatch_returns_incomplete_body",
|
||||
"negative_sigv4_test::aws_chunked_named_errors_reject_put_and_upload_part",
|
||||
"negative_sigv4_test::aws_chunked_valid_signed_and_trailer_boundaries_succeed",
|
||||
"negative_sigv4_test::ghsa_xm99_header_sigv4_accepts_signed_copy_source",
|
||||
"negative_sigv4_test::ghsa_xm99_header_sigv4_rejects_unsigned_copy_source",
|
||||
"negative_sigv4_test::malformed_authorization_header_returns_clean_4xx",
|
||||
"negative_sigv4_test::skewed_date_returns_request_time_too_skewed",
|
||||
"negative_sigv4_test::snowball_streaming_unsigned_trailer_rejects_forged_signature",
|
||||
"negative_sigv4_test::snowball_streaming_unsigned_trailer_returns_sha256_checksum",
|
||||
"negative_sigv4_test::tampered_payload_is_rejected",
|
||||
"negative_sigv4_test::tampered_signature_returns_signature_does_not_match",
|
||||
"negative_sigv4_test::tampered_upload_part_payload_is_rejected",
|
||||
"negative_sigv4_test::valid_header_sigv4_request_succeeds",
|
||||
"negative_sigv4_test::wrong_secret_key_returns_signature_does_not_match",
|
||||
"notification_webhook_test::test_webhook_event_delivery_and_filtering",
|
||||
"notification_webhook_test::test_webhook_metadata_mutations_keep_verified_bucket_identity",
|
||||
"object_lock::object_lock_test::test_complete_multipart_upload_creates_new_version_under_compliance_retention",
|
||||
"object_lock::object_lock_test::test_complete_multipart_upload_creates_new_version_under_legal_hold",
|
||||
"object_lock::object_lock_test::test_copy_object_applies_requested_legal_hold",
|
||||
"object_lock::object_lock_test::test_copy_object_does_not_inherit_source_legal_hold",
|
||||
"object_lock::object_lock_test::test_copy_object_overwrite_creates_new_version_under_legal_hold",
|
||||
"object_lock::object_lock_test::test_copy_object_retention_uses_destination_policy",
|
||||
"object_lock::object_lock_test::test_create_multipart_upload_applies_requested_legal_hold",
|
||||
"object_lock::object_lock_test::test_create_multipart_upload_creates_new_version_under_compliance_retention",
|
||||
"object_lock::object_lock_test::test_default_retention_applied_to_new_objects",
|
||||
"object_lock::object_lock_test::test_delete_completed_multipart_object_blocked_by_legal_hold",
|
||||
"object_lock::object_lock_test::test_delete_completed_multipart_object_blocked_by_retention",
|
||||
"object_lock::object_lock_test::test_delete_object_after_legal_hold_removed",
|
||||
"object_lock::object_lock_test::test_delete_object_allowed_by_governance_with_bypass",
|
||||
"object_lock::object_lock_test::test_delete_object_allowed_with_legal_hold_off",
|
||||
"object_lock::object_lock_test::test_delete_object_blocked_by_compliance_retention",
|
||||
"object_lock::object_lock_test::test_delete_object_blocked_by_governance_without_bypass",
|
||||
"object_lock::object_lock_test::test_delete_object_blocked_by_legal_hold",
|
||||
"object_lock::object_lock_test::test_delete_object_creates_delete_marker_for_default_retained_current_version",
|
||||
"object_lock::object_lock_test::test_delete_object_creates_delete_marker_for_retained_current_version",
|
||||
"object_lock::object_lock_test::test_delete_objects_mixed_locked_unlocked",
|
||||
"object_lock::object_lock_test::test_get_object_legal_hold_returns_updated_status",
|
||||
"object_lock::object_lock_test::test_get_object_retention_returns_configured_values",
|
||||
"object_lock::object_lock_test::test_legal_hold_and_retention_delete_errors_are_exact_and_non_mutating",
|
||||
"object_lock::object_lock_test::test_multipart_default_retention_fixed_at_create",
|
||||
"object_lock::object_lock_test::test_put_copy_and_multipart_reject_incomplete_retention_headers",
|
||||
"object_lock::object_lock_test::test_put_object_overwrite_creates_new_version_under_legal_hold",
|
||||
"object_lock::object_lock_test::test_put_retention_compliance_can_extend",
|
||||
"object_lock::object_lock_test::test_put_retention_compliance_cannot_shorten",
|
||||
"object_lock::object_lock_test::test_put_retention_governance_extend_without_bypass",
|
||||
"object_lock::object_lock_test::test_put_retention_governance_shorten_requires_bypass",
|
||||
"object_lock::object_lock_test::test_unretained_object_lock_object_delete_and_bucket_cleanup",
|
||||
"object_lock::object_lock_test::test_versioning_auto_enabled_with_object_lock",
|
||||
"object_lock::object_lock_test::test_write_paths_require_put_object_legal_hold_permission",
|
||||
"object_lock::object_lock_test::test_write_paths_require_put_object_retention_permission",
|
||||
"on_demand_migration::get_basic_test::get_large_object_streams_through_and_backfills_in_background",
|
||||
"on_demand_migration::get_basic_test::get_with_version_id_does_not_consult_the_source",
|
||||
"on_demand_migration::get_basic_test::head_miss_answers_from_the_source_without_persisting",
|
||||
"on_demand_migration::interaction_test::test_odm_pull_emits_object_created_events_unless_disabled",
|
||||
"on_demand_migration::interaction_test::test_odm_pulled_object_inherits_object_lock_retention",
|
||||
"on_demand_migration::interaction_test::test_odm_pulled_object_replicates_and_target_as_source_is_rejected",
|
||||
"presigned_negative_test::expired_presigned_get_is_rejected",
|
||||
"presigned_negative_test::ghsa_g8w9_presigned_get_rejects_unsigned_x_amz_headers",
|
||||
"presigned_negative_test::ghsa_g8w9_presigned_put_accepts_signed_x_amz_headers",
|
||||
"presigned_negative_test::ghsa_g8w9_presigned_put_rejects_unsigned_copy_source",
|
||||
"presigned_negative_test::ghsa_g8w9_presigned_put_rejects_unsigned_x_amz_headers",
|
||||
"presigned_negative_test::ghsa_g8w9_presigned_put_still_accepts_unsigned_non_amz_headers",
|
||||
"presigned_negative_test::tampered_presigned_put_returns_signature_does_not_match",
|
||||
"presigned_negative_test::tampered_signature_returns_signature_does_not_match",
|
||||
"presigned_negative_test::tampered_target_key_returns_signature_does_not_match",
|
||||
"presigned_negative_test::valid_presigned_get_succeeds",
|
||||
"presigned_negative_test::valid_presigned_put_succeeds",
|
||||
"presigned_negative_test::wrong_secret_key_returns_signature_does_not_match",
|
||||
"put_object_no_content_length_test::tests::test_put_object_without_content_length_boundaries",
|
||||
"reliant::conditional_writes::test_conditional_multi_part_upload",
|
||||
"reliant::conditional_writes::test_conditional_put_failed",
|
||||
"reliant::conditional_writes::test_conditional_put_okay",
|
||||
"reliant::conditional_writes::test_conditional_put_when_object_does_not_exist",
|
||||
"reliant::lifecycle::test_lifecycle_expiry_backdated_mtime",
|
||||
"reliant::lifecycle::test_lifecycle_noncurrent_expiry_then_cleans_expired_delete_marker",
|
||||
"reliant::lifecycle::test_lifecycle_noncurrent_version_expiry_removes_only_old_version",
|
||||
"reliant::lifecycle::test_lifecycle_rejects_zero_day_rule",
|
||||
"reliant::lifecycle::test_lifecycle_versioned_current_version_expiry_creates_delete_marker",
|
||||
"reliant::s3_select_compression::test_select_object_content_compressed_csv_and_json",
|
||||
"reliant::s3_select_compression::test_select_object_content_compressed_disconnect_releases_query",
|
||||
"reliant::s3_select_compression::test_select_object_content_invalid_compressed_stream_fails",
|
||||
"reliant::sql::test_select_object_content_csv_aggregation",
|
||||
"reliant::sql::test_select_object_content_csv_basic",
|
||||
"reliant::sql::test_select_object_content_csv_limit",
|
||||
"reliant::sql::test_select_object_content_csv_order_by",
|
||||
"reliant::sql::test_select_object_content_error_handling",
|
||||
"reliant::sql::test_select_object_content_http_disconnect_releases_query",
|
||||
"reliant::sql::test_select_object_content_http_event_order_crc_and_input_byte_stats",
|
||||
"reliant::sql::test_select_object_content_json_basic",
|
||||
"reliant::sql::test_select_object_content_nested_json_source_path",
|
||||
"reliant::sql::test_select_object_content_nonexistent_object",
|
||||
"replication_lww_receiver_test::receiver_lww_keeps_newer_tags_across_delivery_orders",
|
||||
"sec_signature_matrix_test::ghsa_copy_source_authorization_enforced_both_stacks",
|
||||
"sec_signature_matrix_test::ghsa_sts_forged_or_wrong_secret_rejected_both_stacks",
|
||||
"sec_signature_matrix_test::ghsa_unknown_or_empty_secret_rejected_both_stacks",
|
||||
"sec_signature_matrix_test::ghsa_unsigned_amz_headers_rejected_both_stacks",
|
||||
"sec_signature_matrix_test::ghsa_versioned_get_requires_get_object_version_both_stacks",
|
||||
"sec_signature_matrix_test::sec_signature_matrix_anonymous",
|
||||
"sec_signature_matrix_test::sec_signature_matrix_head_error_body_empty",
|
||||
"sec_signature_matrix_test::sec_signature_matrix_post_policy",
|
||||
"sec_signature_matrix_test::sec_signature_matrix_sigv2_header",
|
||||
"sec_signature_matrix_test::sec_signature_matrix_sigv2_presigned",
|
||||
"sec_signature_matrix_test::sec_signature_matrix_sigv4_header",
|
||||
"sec_signature_matrix_test::sec_signature_matrix_sigv4_presigned",
|
||||
"security_boundary_test::test_excessive_multipart_parts",
|
||||
"security_boundary_test::test_large_xml_body_rejection",
|
||||
"select_request_root_alias_test::select_request_root_alias_reaches_select_endpoint",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_accepts_negative_gnu_mtime",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_applies_member_semantics_and_metadata_precedence",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_consumes_concatenated_gzip_members",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_ignores_directories_when_requested",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_ignores_invalid_entries_when_requested",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_prefers_exact_minio_prefix_over_suffix_fallback",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_rejects_corrupt_tar_when_ignore_errors_enabled",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_rejects_gzip_crc_error_when_ignore_errors_enabled",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_rejects_mismatched_content_md5",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_rejects_parent_dir_entry_even_when_ignore_errors_enabled",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_rejects_veeam_virtual_members",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_skips_non_utf8_member_without_lossy_key_collision",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_skips_non_utf8_symlink_without_ignore_errors",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_supports_minio_prefix_and_directory_markers",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_supports_standard_headers_with_combined_extract_options",
|
||||
"snowball_auto_extract_test::tests::snowball_auto_extract_validates_pax_version_id_against_bucket_state",
|
||||
"special_chars_test::tests::test_control_characters_rejected",
|
||||
"special_chars_test::tests::test_copy_object_with_special_chars",
|
||||
"special_chars_test::tests::test_delete_object_with_special_chars",
|
||||
"special_chars_test::tests::test_head_object_with_special_chars",
|
||||
"special_chars_test::tests::test_issue_scenario_exact",
|
||||
"special_chars_test::tests::test_list_with_delimiter_and_special_chars",
|
||||
"special_chars_test::tests::test_list_with_special_char_prefixes",
|
||||
"special_chars_test::tests::test_object_with_mixed_special_chars",
|
||||
"special_chars_test::tests::test_object_with_plus_in_path",
|
||||
"special_chars_test::tests::test_object_with_space_in_path",
|
||||
"special_chars_test::tests::test_signed_get_existing_object_with_trailing_equals_returns_content",
|
||||
"special_chars_test::tests::test_signed_get_missing_object_with_trailing_equals_returns_no_such_key",
|
||||
"special_chars_test::tests::test_special_chars_in_different_path_positions",
|
||||
"special_chars_test::tests::test_unicode_characters_in_path",
|
||||
"ssec_copy_test::copy_object_rotates_ssec_key_and_drops_source_encryption_metadata",
|
||||
"ssec_copy_test::multipart_copy_requires_keys_on_every_stage_and_abort_leaves_no_object",
|
||||
"storage_class_capability_test::tests::authenticated_runtime_capabilities_publish_the_versioned_storage_class_contract",
|
||||
"storage_class_capability_test::tests::historical_label_only_metadata_is_standard_without_hiding_a_real_transition_tier",
|
||||
"storage_class_capability_test::tests::label_only_aws_classes_fail_before_put_copy_or_multipart_mutation",
|
||||
"storage_class_capability_test::tests::standard_and_rrs_are_supported_across_put_copy_and_multipart",
|
||||
"version_id_regression_test::tests::test_basic_s3_operations_no_regression",
|
||||
"version_id_regression_test::tests::test_copy_object_omits_version_id_with_suspended_versioning",
|
||||
"version_id_regression_test::tests::test_copy_object_returns_version_id_with_versioning",
|
||||
"version_id_regression_test::tests::test_multipart_upload_omits_version_id_with_suspended_versioning",
|
||||
"version_id_regression_test::tests::test_multipart_upload_returns_version_id_with_versioning",
|
||||
"version_id_regression_test::tests::test_put_object_omits_version_id_with_suspended_versioning",
|
||||
"version_id_regression_test::tests::test_put_object_returns_version_id_with_versioning",
|
||||
"version_id_regression_test::tests::test_put_object_without_versioning",
|
||||
"version_id_regression_test::tests::test_terraform_put_after_delete",
|
||||
"version_id_regression_test::tests::test_veeam_backup_workflow_simulation",
|
||||
"version_id_regression_test::tests::test_veeam_sosapi_system_and_capacity",
|
||||
"website_hosting_test::website_host_serves_pages_without_changing_s3_reads",
|
||||
]
|
||||
ceph = [
|
||||
"test_100_continue_error_retry",
|
||||
"test_abort_multipart_upload",
|
||||
"test_abort_multipart_upload_not_found",
|
||||
"test_basic_key_count",
|
||||
"test_block_public_policy",
|
||||
"test_block_public_policy_with_principal",
|
||||
"test_block_public_restrict_public_buckets",
|
||||
"test_bucket_acl_canned_private_to_private",
|
||||
"test_bucket_create_delete",
|
||||
"test_bucket_create_exists",
|
||||
"test_bucket_create_naming_bad_ip",
|
||||
"test_bucket_create_naming_bad_short_one",
|
||||
"test_bucket_create_naming_bad_short_two",
|
||||
"test_bucket_create_naming_bad_starts_nonalpha",
|
||||
"test_bucket_create_naming_dns_dash_at_end",
|
||||
"test_bucket_create_naming_dns_dash_dot",
|
||||
"test_bucket_create_naming_dns_dot_dash",
|
||||
"test_bucket_create_naming_dns_dot_dot",
|
||||
"test_bucket_create_naming_dns_long",
|
||||
"test_bucket_create_naming_dns_underscore",
|
||||
"test_bucket_create_naming_good_contains_hyphen",
|
||||
"test_bucket_create_naming_good_contains_period",
|
||||
"test_bucket_create_naming_good_long_60",
|
||||
"test_bucket_create_naming_good_long_61",
|
||||
"test_bucket_create_naming_good_long_62",
|
||||
"test_bucket_create_naming_good_long_63",
|
||||
"test_bucket_create_special_key_names",
|
||||
"test_bucket_delete_nonempty",
|
||||
"test_bucket_delete_notexist",
|
||||
"test_bucket_head",
|
||||
"test_bucket_head_notexist",
|
||||
"test_bucket_list_delimiter_alt",
|
||||
"test_bucket_list_delimiter_basic",
|
||||
"test_bucket_list_delimiter_dot",
|
||||
"test_bucket_list_delimiter_empty",
|
||||
"test_bucket_list_delimiter_none",
|
||||
"test_bucket_list_delimiter_not_exist",
|
||||
"test_bucket_list_delimiter_not_skip_special",
|
||||
"test_bucket_list_delimiter_percentage",
|
||||
"test_bucket_list_delimiter_prefix",
|
||||
"test_bucket_list_delimiter_prefix_ends_with_delimiter",
|
||||
"test_bucket_list_delimiter_prefix_underscore",
|
||||
"test_bucket_list_delimiter_unreadable",
|
||||
"test_bucket_list_delimiter_whitespace",
|
||||
"test_bucket_list_distinct",
|
||||
"test_bucket_list_empty",
|
||||
"test_bucket_list_encoding_basic",
|
||||
"test_bucket_list_long_name",
|
||||
"test_bucket_list_many",
|
||||
"test_bucket_list_marker_after_list",
|
||||
"test_bucket_list_marker_empty",
|
||||
"test_bucket_list_marker_none",
|
||||
"test_bucket_list_marker_not_in_list",
|
||||
"test_bucket_list_marker_unreadable",
|
||||
"test_bucket_list_maxkeys_invalid",
|
||||
"test_bucket_list_maxkeys_none",
|
||||
"test_bucket_list_maxkeys_one",
|
||||
"test_bucket_list_maxkeys_zero",
|
||||
"test_bucket_list_objects_anonymous_fail",
|
||||
"test_bucket_list_prefix_alt",
|
||||
"test_bucket_list_prefix_basic",
|
||||
"test_bucket_list_prefix_delimiter_alt",
|
||||
"test_bucket_list_prefix_delimiter_basic",
|
||||
"test_bucket_list_prefix_delimiter_delimiter_not_exist",
|
||||
"test_bucket_list_prefix_delimiter_prefix_delimiter_not_exist",
|
||||
"test_bucket_list_prefix_delimiter_prefix_not_exist",
|
||||
"test_bucket_list_prefix_empty",
|
||||
"test_bucket_list_prefix_none",
|
||||
"test_bucket_list_prefix_not_exist",
|
||||
"test_bucket_list_prefix_unreadable",
|
||||
"test_bucket_list_special_prefix",
|
||||
"test_bucket_list_unordered",
|
||||
"test_bucket_listv2_both_continuationtoken_startafter",
|
||||
"test_bucket_listv2_continuationtoken_empty",
|
||||
"test_bucket_listv2_delimiter_alt",
|
||||
"test_bucket_listv2_delimiter_basic",
|
||||
"test_bucket_listv2_delimiter_dot",
|
||||
"test_bucket_listv2_delimiter_empty",
|
||||
"test_bucket_listv2_delimiter_none",
|
||||
"test_bucket_listv2_delimiter_not_exist",
|
||||
"test_bucket_listv2_delimiter_percentage",
|
||||
"test_bucket_listv2_delimiter_prefix",
|
||||
"test_bucket_listv2_delimiter_prefix_ends_with_delimiter",
|
||||
"test_bucket_listv2_delimiter_prefix_underscore",
|
||||
"test_bucket_listv2_delimiter_unreadable",
|
||||
"test_bucket_listv2_delimiter_whitespace",
|
||||
"test_bucket_listv2_encoding_basic",
|
||||
"test_bucket_listv2_fetchowner_defaultempty",
|
||||
"test_bucket_listv2_fetchowner_empty",
|
||||
"test_bucket_listv2_fetchowner_notempty",
|
||||
"test_bucket_listv2_many",
|
||||
"test_bucket_listv2_maxkeys_none",
|
||||
"test_bucket_listv2_maxkeys_one",
|
||||
"test_bucket_listv2_maxkeys_zero",
|
||||
"test_bucket_listv2_objects_anonymous_fail",
|
||||
"test_bucket_listv2_prefix_alt",
|
||||
"test_bucket_listv2_prefix_delimiter_alt",
|
||||
"test_bucket_listv2_prefix_delimiter_basic",
|
||||
"test_bucket_listv2_prefix_delimiter_delimiter_not_exist",
|
||||
"test_bucket_listv2_prefix_delimiter_prefix_delimiter_not_exist",
|
||||
"test_bucket_listv2_prefix_delimiter_prefix_not_exist",
|
||||
"test_bucket_listv2_prefix_empty",
|
||||
"test_bucket_listv2_prefix_none",
|
||||
"test_bucket_listv2_prefix_not_exist",
|
||||
"test_bucket_listv2_prefix_unreadable",
|
||||
"test_bucket_listv2_startafter_after_list",
|
||||
"test_bucket_listv2_startafter_not_in_list",
|
||||
"test_bucket_listv2_startafter_unreadable",
|
||||
"test_bucket_listv2_unordered",
|
||||
"test_bucket_notexist",
|
||||
"test_bucket_policy_allow_notprincipal",
|
||||
"test_bucket_recreate_not_overriding",
|
||||
"test_buckets_create_then_list",
|
||||
"test_buckets_list_ctime",
|
||||
"test_bucketv2_notexist",
|
||||
"test_copy_object_ifmatch_failed",
|
||||
"test_copy_object_ifmatch_good",
|
||||
"test_copy_object_ifnonematch_failed",
|
||||
"test_copy_object_ifnonematch_good",
|
||||
"test_cors_header_option",
|
||||
"test_cors_presigned_get_object",
|
||||
"test_cors_presigned_put_object",
|
||||
"test_cors_presigned_put_object_with_acl",
|
||||
"test_delete_bucket_encryption_s3",
|
||||
"test_encrypted_transfer_13b",
|
||||
"test_encrypted_transfer_1b",
|
||||
"test_encrypted_transfer_1kb",
|
||||
"test_encryption_key_no_sse_c",
|
||||
"test_encryption_sse_c_deny_algo_with_bucket_policy",
|
||||
"test_encryption_sse_c_enforced_with_bucket_policy",
|
||||
"test_encryption_sse_c_invalid_md5",
|
||||
"test_encryption_sse_c_method_head",
|
||||
"test_encryption_sse_c_multipart_bad_download",
|
||||
"test_encryption_sse_c_multipart_invalid_chunks_1",
|
||||
"test_encryption_sse_c_multipart_invalid_chunks_2",
|
||||
"test_encryption_sse_c_multipart_upload",
|
||||
"test_encryption_sse_c_no_key",
|
||||
"test_encryption_sse_c_no_md5",
|
||||
"test_encryption_sse_c_other_key",
|
||||
"test_encryption_sse_c_post_object_authenticated_request",
|
||||
"test_encryption_sse_c_present",
|
||||
"test_encryption_sse_c_unaligned_multipart_upload",
|
||||
"test_expected_bucket_owner",
|
||||
"test_get_bucket_encryption_s3",
|
||||
"test_get_bucket_policy_status",
|
||||
"test_get_checksum_object_attributes",
|
||||
"test_get_multipart_object_attributes",
|
||||
"test_get_nonpublicpolicy_acl_bucket_policy_status",
|
||||
"test_get_nonpublicpolicy_principal_bucket_policy_status",
|
||||
"test_get_obj_head_tagging",
|
||||
"test_get_obj_tagging",
|
||||
"test_get_object_attributes",
|
||||
"test_get_object_ifmatch_failed",
|
||||
"test_get_object_ifmatch_good",
|
||||
"test_get_object_ifmodifiedsince_failed",
|
||||
"test_get_object_ifmodifiedsince_good",
|
||||
"test_get_object_ifnonematch_failed",
|
||||
"test_get_object_ifnonematch_good",
|
||||
"test_get_object_ifunmodifiedsince_failed",
|
||||
"test_get_object_ifunmodifiedsince_good",
|
||||
"test_get_object_torrent",
|
||||
"test_get_paginated_multipart_object_attributes",
|
||||
"test_get_public_block_deny_bucket_policy",
|
||||
"test_get_publicpolicy_acl_bucket_policy_status",
|
||||
"test_get_single_multipart_object_attributes",
|
||||
"test_get_sse_c_encrypted_object_attributes",
|
||||
"test_get_undefined_public_block",
|
||||
"test_get_versioned_object_attributes",
|
||||
"test_lifecycle_delete",
|
||||
"test_lifecycle_expiration_days0",
|
||||
"test_lifecycle_expiration_header_and_tags_head",
|
||||
"test_lifecycle_expiration_header_head",
|
||||
"test_lifecycle_expiration_header_put",
|
||||
"test_lifecycle_expiration_header_tags_head",
|
||||
"test_lifecycle_get",
|
||||
"test_lifecycle_get_no_id",
|
||||
"test_lifecycle_id_too_long",
|
||||
"test_lifecycle_invalid_status",
|
||||
"test_lifecycle_same_id",
|
||||
"test_lifecycle_set",
|
||||
"test_lifecycle_set_date",
|
||||
"test_lifecycle_set_deletemarker",
|
||||
"test_lifecycle_set_empty_filter",
|
||||
"test_lifecycle_set_filter",
|
||||
"test_lifecycle_set_invalid_date",
|
||||
"test_lifecycle_set_multipart",
|
||||
"test_lifecycle_set_noncurrent",
|
||||
"test_lifecycle_transition_set_invalid_date",
|
||||
"test_list_buckets_bad_auth",
|
||||
"test_list_buckets_invalid_auth",
|
||||
"test_list_multipart_upload",
|
||||
"test_multi_object_delete",
|
||||
"test_multi_objectv2_delete",
|
||||
"test_multipart_checksum_sha256",
|
||||
"test_multipart_copy_improper_range",
|
||||
"test_multipart_copy_invalid_range",
|
||||
"test_multipart_copy_multiple_sizes",
|
||||
"test_multipart_copy_special_names",
|
||||
"test_multipart_copy_versioned",
|
||||
"test_multipart_copy_without_range",
|
||||
"test_multipart_resend_first_finishes_last",
|
||||
"test_multipart_upload_empty",
|
||||
"test_multipart_upload_incorrect_etag",
|
||||
"test_multipart_upload_missing_part",
|
||||
"test_multipart_upload_multiple_sizes",
|
||||
"test_multipart_upload_on_a_bucket_with_policy",
|
||||
"test_multipart_upload_overwrite_existing_object",
|
||||
"test_multipart_upload_size_too_small",
|
||||
"test_non_multipart_get_part",
|
||||
"test_non_multipart_sse_c_get_part",
|
||||
"test_object_anon_put",
|
||||
"test_object_checksum_crc64nvme",
|
||||
"test_object_checksum_sha256",
|
||||
"test_object_content_encoding_aws_chunked",
|
||||
"test_object_copy_bucket_not_found",
|
||||
"test_object_copy_diff_bucket",
|
||||
"test_object_copy_key_not_found",
|
||||
"test_object_copy_replacing_metadata",
|
||||
"test_object_copy_retaining_metadata",
|
||||
"test_object_copy_same_bucket",
|
||||
"test_object_copy_to_itself",
|
||||
"test_object_copy_to_itself_with_metadata",
|
||||
"test_object_copy_verify_contenttype",
|
||||
"test_object_copy_versioned_bucket",
|
||||
"test_object_copy_versioned_url_encoding",
|
||||
"test_object_copy_versioning_multipart_upload",
|
||||
"test_object_copy_zero_size",
|
||||
"test_object_delete_key_bucket_gone",
|
||||
"test_object_lock_changing_mode_from_compliance",
|
||||
"test_object_lock_changing_mode_from_governance_with_bypass",
|
||||
"test_object_lock_changing_mode_from_governance_without_bypass",
|
||||
"test_object_lock_delete_multipart_object_with_legal_hold_on",
|
||||
"test_object_lock_delete_multipart_object_with_retention",
|
||||
"test_object_lock_delete_object_with_legal_hold_off",
|
||||
"test_object_lock_delete_object_with_legal_hold_on",
|
||||
"test_object_lock_delete_object_with_retention",
|
||||
"test_object_lock_delete_object_with_retention_and_marker",
|
||||
"test_object_lock_get_legal_hold",
|
||||
"test_object_lock_get_legal_hold_invalid_bucket",
|
||||
"test_object_lock_get_obj_lock",
|
||||
"test_object_lock_get_obj_lock_invalid_bucket",
|
||||
"test_object_lock_get_obj_metadata",
|
||||
"test_object_lock_get_obj_retention",
|
||||
"test_object_lock_get_obj_retention_invalid_bucket",
|
||||
"test_object_lock_get_obj_retention_iso8601",
|
||||
"test_object_lock_multi_delete_object_with_retention",
|
||||
"test_object_lock_put_legal_hold",
|
||||
"test_object_lock_put_legal_hold_invalid_bucket",
|
||||
"test_object_lock_put_legal_hold_invalid_status",
|
||||
"test_object_lock_put_obj_lock",
|
||||
"test_object_lock_put_obj_lock_enable_after_create",
|
||||
"test_object_lock_put_obj_lock_invalid_bucket",
|
||||
"test_object_lock_put_obj_lock_invalid_days",
|
||||
"test_object_lock_put_obj_lock_invalid_mode",
|
||||
"test_object_lock_put_obj_lock_invalid_status",
|
||||
"test_object_lock_put_obj_lock_invalid_years",
|
||||
"test_object_lock_put_obj_lock_with_days_and_years",
|
||||
"test_object_lock_put_obj_retention",
|
||||
"test_object_lock_put_obj_retention_increase_period",
|
||||
"test_object_lock_put_obj_retention_invalid_bucket",
|
||||
"test_object_lock_put_obj_retention_invalid_mode",
|
||||
"test_object_lock_put_obj_retention_override_default_retention",
|
||||
"test_object_lock_put_obj_retention_shorten_period",
|
||||
"test_object_lock_put_obj_retention_shorten_period_bypass",
|
||||
"test_object_lock_put_obj_retention_versionid",
|
||||
"test_object_lock_suspend_versioning",
|
||||
"test_object_lock_uploading_obj",
|
||||
"test_object_metadata_replaced_on_put",
|
||||
"test_object_presigned_put_object_with_acl",
|
||||
"test_object_put_acl_mtime",
|
||||
"test_object_put_authenticated",
|
||||
"test_object_raw_authenticated",
|
||||
"test_object_raw_authenticated_bucket_acl",
|
||||
"test_object_raw_authenticated_bucket_gone",
|
||||
"test_object_raw_authenticated_object_acl",
|
||||
"test_object_raw_authenticated_object_gone",
|
||||
"test_object_raw_get_object_acl",
|
||||
"test_object_raw_get_x_amz_expires_not_expired",
|
||||
"test_object_raw_get_x_amz_expires_out_range_zero",
|
||||
"test_object_raw_response_headers",
|
||||
"test_object_read_not_exist",
|
||||
"test_object_set_get_metadata_none_to_empty",
|
||||
"test_object_set_get_metadata_none_to_good",
|
||||
"test_object_set_get_metadata_overwrite_to_empty",
|
||||
"test_object_write_cache_control",
|
||||
"test_object_write_check_etag",
|
||||
"test_object_write_expires",
|
||||
"test_object_write_read_update_read_delete",
|
||||
"test_object_write_to_nonexist_bucket",
|
||||
"test_post_object_authenticated_no_content_type",
|
||||
"test_post_object_authenticated_request",
|
||||
"test_post_object_authenticated_request_bad_access_key",
|
||||
"test_post_object_case_insensitive_condition_fields",
|
||||
"test_post_object_condition_is_case_sensitive",
|
||||
"test_post_object_empty_conditions",
|
||||
"test_post_object_escaped_field_values",
|
||||
"test_post_object_expired_policy",
|
||||
"test_post_object_expires_is_case_sensitive",
|
||||
"test_post_object_ignored_header",
|
||||
"test_post_object_invalid_access_key",
|
||||
"test_post_object_invalid_content_length_argument",
|
||||
"test_post_object_invalid_signature",
|
||||
"test_post_object_missing_conditions_list",
|
||||
"test_post_object_missing_content_length_argument",
|
||||
"test_post_object_missing_expires_condition",
|
||||
"test_post_object_missing_signature",
|
||||
"test_post_object_no_key_specified",
|
||||
"test_post_object_set_key_from_filename",
|
||||
"test_post_object_tags_authenticated_request",
|
||||
"test_post_object_upload_size_below_minimum",
|
||||
"test_post_object_upload_size_limit_exceeded",
|
||||
"test_post_object_upload_size_rgw_chunk_size_bug",
|
||||
"test_post_object_user_specified_header",
|
||||
"test_put_bucket_encryption_s3",
|
||||
"test_put_delete_tags",
|
||||
"test_put_excess_key_tags",
|
||||
"test_put_excess_tags",
|
||||
"test_put_excess_val_tags",
|
||||
"test_put_get_delete_public_block",
|
||||
"test_put_max_kvsize_tags",
|
||||
"test_put_max_tags",
|
||||
"test_put_modify_tags",
|
||||
"test_put_obj_enc_conflict_c_s3",
|
||||
"test_put_obj_with_tags",
|
||||
"test_put_object_ifmatch_failed",
|
||||
"test_put_object_ifmatch_good",
|
||||
"test_put_object_ifmatch_nonexisted_failed",
|
||||
"test_put_object_ifmatch_overwrite_existed_good",
|
||||
"test_put_object_ifnonmatch_nonexisted_good",
|
||||
"test_put_object_ifnonmatch_overwrite_existed_failed",
|
||||
"test_put_public_block",
|
||||
"test_ranged_request_empty_object",
|
||||
"test_ranged_request_invalid_range",
|
||||
"test_ranged_request_response_code",
|
||||
"test_ranged_request_return_trailing_bytes_response_code",
|
||||
"test_ranged_request_skip_leading_bytes_response_code",
|
||||
"test_rm_bucket_logging",
|
||||
"test_set_bucket_tagging",
|
||||
"test_set_cors",
|
||||
"test_set_get_del_bucket_policy",
|
||||
"test_set_multipart_tagging",
|
||||
"test_upload_part_copy_percent_encoded_key",
|
||||
"test_versioning_bucket_atomic_upload_return_version_id",
|
||||
"test_versioning_bucket_create_suspend",
|
||||
"test_versioning_bucket_multipart_upload_return_version_id",
|
||||
"test_versioning_copy_obj_version",
|
||||
"test_versioning_multi_object_delete",
|
||||
"test_versioning_multi_object_delete_with_marker",
|
||||
"test_versioning_multi_object_delete_with_marker_create",
|
||||
"test_versioning_obj_create_overwrite_multipart",
|
||||
"test_versioning_obj_create_read_remove",
|
||||
"test_versioning_obj_create_read_remove_head",
|
||||
"test_versioning_obj_create_versions_remove_all",
|
||||
"test_versioning_obj_create_versions_remove_special_names",
|
||||
"test_versioning_obj_list_marker",
|
||||
"test_versioning_obj_plain_null_version_overwrite",
|
||||
"test_versioning_obj_plain_null_version_overwrite_suspended",
|
||||
"test_versioning_obj_plain_null_version_removal",
|
||||
"test_versioning_obj_suspend_versions",
|
||||
"test_versioning_obj_suspended_copy",
|
||||
]
|
||||
|
||||
# Same-byte replay uses cases that do not feed a server-generated object version or upload ID into a later request.
|
||||
[wire_replay]
|
||||
ceph = [
|
||||
"test_bucket_list_delimiter_alt",
|
||||
"test_bucket_list_delimiter_basic",
|
||||
"test_bucket_list_delimiter_dot",
|
||||
"test_bucket_list_delimiter_empty",
|
||||
"test_bucket_list_delimiter_none",
|
||||
"test_bucket_list_delimiter_not_exist",
|
||||
"test_bucket_list_delimiter_percentage",
|
||||
"test_bucket_list_delimiter_prefix",
|
||||
"test_bucket_list_delimiter_prefix_ends_with_delimiter",
|
||||
"test_bucket_list_delimiter_prefix_underscore",
|
||||
"test_bucket_list_delimiter_whitespace",
|
||||
"test_bucket_list_distinct",
|
||||
"test_bucket_list_empty",
|
||||
"test_bucket_list_encoding_basic",
|
||||
"test_bucket_list_many",
|
||||
"test_bucket_list_maxkeys_none",
|
||||
"test_bucket_list_maxkeys_one",
|
||||
"test_bucket_list_maxkeys_zero",
|
||||
"test_bucket_list_prefix_alt",
|
||||
"test_bucket_list_prefix_basic",
|
||||
"test_bucket_list_prefix_delimiter_alt",
|
||||
"test_bucket_list_prefix_delimiter_basic",
|
||||
"test_bucket_list_prefix_delimiter_delimiter_not_exist",
|
||||
"test_bucket_list_prefix_delimiter_prefix_delimiter_not_exist",
|
||||
"test_bucket_list_prefix_delimiter_prefix_not_exist",
|
||||
"test_bucket_list_prefix_empty",
|
||||
"test_bucket_list_prefix_none",
|
||||
"test_bucket_list_prefix_not_exist",
|
||||
"test_bucket_listv2_continuationtoken",
|
||||
"test_bucket_listv2_delimiter_alt",
|
||||
"test_bucket_listv2_delimiter_basic",
|
||||
"test_bucket_listv2_delimiter_dot",
|
||||
"test_bucket_listv2_delimiter_empty",
|
||||
"test_bucket_listv2_delimiter_none",
|
||||
"test_bucket_listv2_delimiter_not_exist",
|
||||
"test_bucket_listv2_delimiter_percentage",
|
||||
"test_bucket_listv2_delimiter_prefix",
|
||||
"test_bucket_listv2_delimiter_prefix_ends_with_delimiter",
|
||||
"test_bucket_listv2_delimiter_prefix_underscore",
|
||||
"test_bucket_listv2_delimiter_whitespace",
|
||||
"test_bucket_listv2_encoding_basic",
|
||||
"test_bucket_listv2_many",
|
||||
"test_bucket_listv2_maxkeys_none",
|
||||
"test_bucket_listv2_maxkeys_one",
|
||||
"test_bucket_listv2_maxkeys_zero",
|
||||
"test_bucket_listv2_prefix_alt",
|
||||
"test_bucket_listv2_prefix_basic",
|
||||
"test_bucket_listv2_prefix_delimiter_alt",
|
||||
"test_bucket_listv2_prefix_delimiter_basic",
|
||||
"test_bucket_listv2_prefix_delimiter_delimiter_not_exist",
|
||||
"test_bucket_listv2_prefix_delimiter_prefix_delimiter_not_exist",
|
||||
"test_bucket_listv2_prefix_delimiter_prefix_not_exist",
|
||||
"test_bucket_listv2_prefix_empty",
|
||||
"test_bucket_listv2_prefix_none",
|
||||
"test_bucket_listv2_prefix_not_exist",
|
||||
"test_get_obj_head_tagging",
|
||||
"test_get_obj_tagging",
|
||||
"test_lifecycle_expiration_header_head",
|
||||
"test_object_checksum_crc64nvme",
|
||||
"test_object_content_encoding_aws_chunked",
|
||||
"test_object_copy_diff_bucket",
|
||||
"test_object_copy_replacing_metadata",
|
||||
"test_object_copy_retaining_metadata",
|
||||
"test_object_copy_same_bucket",
|
||||
"test_object_copy_to_itself_with_metadata",
|
||||
"test_object_copy_verify_contenttype",
|
||||
"test_object_copy_zero_size",
|
||||
"test_object_head_zero_bytes",
|
||||
"test_object_lock_get_obj_lock",
|
||||
"test_object_lock_put_obj_lock",
|
||||
"test_object_metadata_replaced_on_put",
|
||||
"test_object_read_not_exist",
|
||||
"test_object_set_get_metadata_none_to_empty",
|
||||
"test_object_set_get_metadata_none_to_good",
|
||||
"test_object_set_get_metadata_overwrite_to_empty",
|
||||
"test_object_write_cache_control",
|
||||
"test_object_write_check_etag",
|
||||
"test_object_write_file",
|
||||
"test_object_write_read_update_read_delete",
|
||||
"test_put_delete_tags",
|
||||
"test_ranged_request_empty_object",
|
||||
"test_ranged_request_response_code",
|
||||
"test_ranged_request_return_trailing_bytes_response_code",
|
||||
"test_ranged_request_skip_leading_bytes_response_code",
|
||||
"test_rm_bucket_logging",
|
||||
"test_set_bucket_tagging",
|
||||
"test_set_cors",
|
||||
"test_versioning_bucket_create_suspend",
|
||||
]
|
||||
@@ -69,7 +69,6 @@ body-cache-whitelist-check: ## Check the body-cache eligibility gate stays a fai
|
||||
s3s-footprint-check: ## Check the s3s dependency footprint ratchet stays frozen
|
||||
@echo "📦 Checking s3s footprint ratchet..."
|
||||
./scripts/check_s3s_footprint.sh
|
||||
./scripts/check_s3s_footprint.sh --mode allowlist
|
||||
|
||||
.PHONY: release-feature-boundary-check
|
||||
release-feature-boundary-check: ## Check no release-reachable feature enables a debug-only one
|
||||
|
||||
@@ -103,12 +103,8 @@ script-tests: ## Run shell script tests
|
||||
$(RUSTFS_PYTHON_BIN) ./scripts/test_retain_validation_evidence.py
|
||||
$(RUSTFS_PYTHON_BIN) ./scripts/test_ci_timing_report.py
|
||||
$(RUSTFS_PYTHON_BIN) ./scripts/test_junit_diff.py
|
||||
$(RUSTFS_PYTHON_BIN) ./scripts/test_mint_stack_diff.py
|
||||
$(RUSTFS_PYTHON_BIN) ./scripts/check_conformance_rulings.py --self-test
|
||||
$(RUSTFS_PYTHON_BIN) ./scripts/compat_matrix_report.py --self-test
|
||||
$(RUSTFS_PYTHON_BIN) ./scripts/check_gateway_admin_census.py --self-test
|
||||
$(RUSTFS_PYTHON_BIN) ./scripts/test_gateway_corpus_capture.py
|
||||
$(RUSTFS_PYTHON_BIN) ./scripts/test_gateway_wire_replay.py
|
||||
$(RUSTFS_PYTHON_BIN) ./scripts/s3-tests/test_report_compat.py
|
||||
$(RUSTFS_PYTHON_BIN) ./scripts/s3-tests/test_runner_tools.py
|
||||
$(RUSTFS_PYTHON_BIN) ./scripts/s3-tests/test_api_coverage.py
|
||||
|
||||
+4
-17
@@ -253,7 +253,7 @@ threads-required = "num-test-threads"
|
||||
# peers complete durable IO. Reserve capacity from unrelated test processes;
|
||||
# the shared fixture's durable_iam_state_ prefix keeps the whole family together.
|
||||
[[profile.default.overrides]]
|
||||
filter = 'package(rustfs) & test(/^admin::handlers::site_replication::(tests::durable_iam_state_|removal_tests::decommission_durable_)/)'
|
||||
filter = 'package(rustfs) & test(/^admin::handlers::site_replication::tests::durable_iam_state_/)'
|
||||
threads-required = "num-test-threads"
|
||||
|
||||
# Real target-repair and rebalance-stop fixtures commit durable metadata while
|
||||
@@ -582,7 +582,7 @@ threads-required = "num-test-threads"
|
||||
# Keep the same IAM/state fixture capacity reservation in CI without changing the
|
||||
# production lock deadline, internal concurrency, assertions, or retry policy.
|
||||
[[profile.ci.overrides]]
|
||||
filter = 'package(rustfs) & test(/^admin::handlers::site_replication::(tests::durable_iam_state_|removal_tests::decommission_durable_)/)'
|
||||
filter = 'package(rustfs) & test(/^admin::handlers::site_replication::tests::durable_iam_state_/)'
|
||||
threads-required = "num-test-threads"
|
||||
|
||||
# Match the real admin fixture capacity reservation without retries or changes
|
||||
@@ -731,7 +731,7 @@ test-group = 'ecstore-serial-flaky'
|
||||
[profile.e2e-smoke]
|
||||
default-filter = """
|
||||
package(e2e_test) & (
|
||||
test(/^(access_request_validation|delete_marker_migration_semantics|version_id_regression|list_objects_v2_pagination|list_object_versions_regression|list_objects_duplicates|list_buckets_double_slash|list_buckets_auth|list_buckets_iam_filter|leading_slash_key|special_chars|create_bucket_region|delete_objects_versioning|head_object_consistency|head_object_range|copy_object_metadata|copy_object_tagging|copy_source_invalid_date|content_encoding|compression|multipart_storage_class|multipart_upload_id|storage_class_capability|ssec_copy|anonymous_access|bucket_policy_check|presigned_negative|negative_sigv4|admin_auth|notification_webhook|tls_hot_reload|console_smoke|admin_iam_crud|admin_pools|sts_query_compat|data_usage)_test::|^fake_s3_target::/)
|
||||
test(/^(delete_marker_migration_semantics|version_id_regression|list_objects_v2_pagination|list_object_versions_regression|list_objects_duplicates|list_buckets_double_slash|list_buckets_auth|list_buckets_iam_filter|leading_slash_key|special_chars|create_bucket_region|delete_objects_versioning|head_object_consistency|head_object_range|copy_object_metadata|copy_object_tagging|copy_source_invalid_date|content_encoding|compression|multipart_storage_class|multipart_upload_id|storage_class_capability|ssec_copy|anonymous_access|bucket_policy_check|presigned_negative|negative_sigv4|admin_auth|notification_webhook|tls_hot_reload|console_smoke|admin_iam_crud|admin_pools|sts_query_compat|data_usage)_test::|^fake_s3_target::/)
|
||||
| test(/^replication_extension_test::(test_replication_check_succeeds_with_remote_target|test_replication_check_rejects_target_without_object_lock|test_set_remote_target_rejects_unversioned_source_bucket|test_replication_check_rejects_unversioned_source_bucket|test_replication_check_rejects_missing_replication_config|test_replication_check_rejects_invalid_bucket|test_set_remote_target_rejects_same_bucket_on_same_deployment|test_set_remote_target_rejects_unversioned_target_bucket|test_set_remote_target_update_requires_arn|test_set_remote_target_update_rejects_missing_target|test_set_remote_target_rejects_invalid_target_url|test_set_remote_target_rejects_self_signed_https_target_without_skip_tls_verify|test_set_remote_target_rejects_private_ca_https_target_without_ca_cert_pem|test_list_remote_targets_rejects_empty_bucket|test_list_remote_targets_rejects_invalid_bucket|test_remove_remote_target_rejects_missing_target|test_remove_remote_target_rejects_missing_arn|test_remove_remote_target_rejects_invalid_bucket|test_remove_remote_target_rejects_target_used_by_replication|test_delete_bucket_replication_removes_remote_target)$/)
|
||||
| test(/^reliant::lifecycle::/)
|
||||
| test(/^conditional_delete_objects_test::/)
|
||||
@@ -960,11 +960,10 @@ path = "junit.xml"
|
||||
# differential picks side A (shell-script stand-ins, no server, no reference
|
||||
# binary). They already run on every pull request in e2e-smoke, so e2e-full
|
||||
# excludes them to keep its selection digest unchanged.
|
||||
# ACL admission protocol tests already run on every PR in e2e-smoke.
|
||||
[profile.e2e-full]
|
||||
default-filter = """
|
||||
package(e2e_test)
|
||||
& !test(/^(protocols|access_request_validation_test)::/)
|
||||
& !test(/^protocols::/)
|
||||
& !test(/^(admin_timeout_regression_test|cluster_concurrency_test|cluster_multidrive_pool_test|degraded_listing_availability_test|namespace_lock_quorum_test|object_lambda_test|stale_multipart_cleanup_cluster_test)::/)
|
||||
& !test(/^distributed::/)
|
||||
& !test(/^replication_extension_test::/)
|
||||
@@ -997,18 +996,6 @@ test-group = 'e2e-inline-boundaries'
|
||||
filter = 'package(e2e_test) & test(/^heal_erasure_disk_rebuild_test::/)'
|
||||
test-group = 'e2e-cluster-nightly'
|
||||
|
||||
# macOS can exceed the capability timeout when both startup CAS fixtures first
|
||||
# execute their private copies of the debug server at the same time.
|
||||
[[profile.e2e-full.overrides]]
|
||||
platform = { host = 'cfg(target_os = "macos")' }
|
||||
filter = """
|
||||
package(e2e_test) & (
|
||||
test(=distributed_startup_regression_test::tests::test_fresh_four_node_bootstrap_metadata_cas)
|
||||
| test(=distributed_startup_regression_test::tests::test_two_pool_restart_repairs_missing_pool_metadata_via_bootstrap_cas)
|
||||
)
|
||||
"""
|
||||
test-group = 'e2e-cluster-nightly'
|
||||
|
||||
# The multi-pool crash fixture seeds three nodes and 36 drives. Reserve this
|
||||
# nextest run's workers so other multi-node tests do not starve its deadline.
|
||||
[[profile.e2e-full.overrides]]
|
||||
|
||||
@@ -17,12 +17,19 @@
|
||||
# entirely, and the script rejects such an entry. Only the s3s-facing edge of
|
||||
# the rustfs binary and the e2e oracle keep it.
|
||||
|
||||
# rustfs binary: reviewed #[cfg(test)] legacy comparison oracles
|
||||
# rustfs binary: the s3s-facing edge that survives Phase 1
|
||||
rustfs/src/storage/ecfs.rs
|
||||
rustfs/src/storage/s3_compat/**
|
||||
rustfs/src/storage/access.rs
|
||||
rustfs/src/auth.rs
|
||||
rustfs/src/error.rs
|
||||
rustfs/src/storage_api.rs
|
||||
rustfs/src/app/storage_api.rs
|
||||
rustfs/src/admin/router.rs
|
||||
rustfs/src/app/metadata_route.rs
|
||||
rustfs/src/server/http.rs
|
||||
rustfs/src/protocols/client.rs
|
||||
|
||||
# e2e oracle: reviewed test targets that compare S3 behaviour against s3s
|
||||
crates/e2e_test/src/access_request_validation_test.rs
|
||||
crates/e2e_test/src/dual_stack_differential/compare.rs
|
||||
# e2e oracle: the test target that verifies S3 behaviour against s3s
|
||||
crates/e2e_test/src/fake_s3_target/**
|
||||
crates/e2e_test/src/**
|
||||
|
||||
@@ -13,6 +13,6 @@
|
||||
# s3_error_lines lines holding s3_error!, same scope, minus those the script
|
||||
# header's rule clears (rustfs_s3_types's macro); fails closed
|
||||
# ecstore_files Rust files referencing s3s paths under crates/ecstore/src
|
||||
files=3
|
||||
s3_error_lines=16
|
||||
files=33
|
||||
s3_error_lines=89
|
||||
ecstore_files=0
|
||||
|
||||
@@ -44,33 +44,6 @@ runs:
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Read the gateway pin
|
||||
id: gateway-pin
|
||||
shell: bash
|
||||
run: python3 scripts/gateway_corpus_capture.py pins >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Checkout the pinned admin route inventory and collector
|
||||
uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
repository: rustfs/gateway
|
||||
ref: ${{ steps.gateway-pin.outputs.rev }}
|
||||
# The collector requires a clean RustFS checkout.
|
||||
path: target/gateway-admin-census
|
||||
persist-credentials: false
|
||||
sparse-checkout-cone-mode: false
|
||||
sparse-checkout: |
|
||||
/scripts/
|
||||
/crates/goldens/src/migration_inventory/rustfs_admin_routes_native.json
|
||||
/crates/dialect-rustfs-admin/Cargo.toml
|
||||
/crates/dialect-rustfs-admin/src/lib.rs
|
||||
/crates/dialect-rustfs-admin/src/native.rs
|
||||
/crates/dialect-rustfs-admin/src/native/
|
||||
/crates/dialect-rustfs-admin/src/ops/
|
||||
|
||||
- name: Compare registered admin routes with the gateway native inventory
|
||||
shell: bash
|
||||
run: python3 scripts/check_gateway_admin_census.py --gateway target/gateway-admin-census
|
||||
|
||||
- name: Install workflow parser
|
||||
shell: bash
|
||||
run: python3 -m pip install --disable-pip-version-check PyYAML==6.0.3
|
||||
@@ -134,10 +107,6 @@ runs:
|
||||
git cat-file -e "$FOOTPRINT_BASE^{commit}" 2>/dev/null || git fetch --no-tags --depth=1 origin "$FOOTPRINT_BASE"
|
||||
./scripts/check_s3s_footprint.sh --base "$FOOTPRINT_BASE"
|
||||
|
||||
- name: Check s3s edge allowlist
|
||||
shell: bash
|
||||
run: ./scripts/check_s3s_footprint.sh --mode allowlist
|
||||
|
||||
- name: Check release feature boundaries
|
||||
shell: bash
|
||||
run: python3 scripts/check_connect_release_boundary.py --features-only
|
||||
|
||||
@@ -33,9 +33,6 @@ outputs:
|
||||
path:
|
||||
description: "Absolute path of the verified executable"
|
||||
value: ${{ steps.unpack.outputs.path }}
|
||||
executable-sha256:
|
||||
description: "SHA-256 of the executable extracted from the verified archive"
|
||||
value: ${{ steps.unpack.outputs.executable-sha256 }}
|
||||
version:
|
||||
description: "Pinned reference version"
|
||||
value: ${{ steps.pin.outputs.version }}
|
||||
@@ -96,6 +93,4 @@ runs:
|
||||
test -x "$path"
|
||||
echo "Reference executable: $path"
|
||||
"$path" --version
|
||||
digest="$(sha256sum "$path")"
|
||||
echo "executable-sha256=${digest%% *}" >> "$GITHUB_OUTPUT"
|
||||
echo "path=$path" >> "$GITHUB_OUTPUT"
|
||||
|
||||
@@ -6,9 +6,8 @@ runs:
|
||||
- name: Install runtime tools
|
||||
shell: bash
|
||||
run: |
|
||||
# These runners have no IPv6 route to the Git PPA inherited from the image.
|
||||
sudo apt-get -o Acquire::ForceIPv4=true update
|
||||
sudo apt-get -o Acquire::ForceIPv4=true install -y libssl-dev ripgrep
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libssl-dev ripgrep
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
|
||||
- name: Install cargo-nextest
|
||||
|
||||
@@ -22,8 +22,6 @@ Identify the tested commit and any local changes. When testing a prebuilt binary
|
||||
List relevant checks not run and the remaining risk. Use the validation tier in AGENTS.md; do not run broader checks solely to fill this section. For documentation-only changes, list the applicable documentation checks. Use N/A only when verification is not applicable.
|
||||
-->
|
||||
|
||||
**auto-testing regression coverage** <!-- For each issue-backed bug fix, give the added or extended case ID or PR link, the existing case ID/path and assertion that catches the bug, or "Skipped" with a brief reason. Omit this line for other changes, including documentation-only fixes. -->
|
||||
|
||||
## Impact
|
||||
<!--
|
||||
Describe user-facing, compatibility, API, deployment, configuration, or documentation impact. Use N/A when there is no expected impact.
|
||||
|
||||
@@ -523,30 +523,6 @@
|
||||
"monitor_reason": "Event-driven or operator-requested work has no periodic freshness obligation.",
|
||||
"origin": "baseline"
|
||||
},
|
||||
{
|
||||
"workflow": ".github/workflows/agent-v1-protocol-regression.yml",
|
||||
"name": "Agent v1 protocol regression",
|
||||
"roles": [
|
||||
"pr",
|
||||
"push",
|
||||
"manual"
|
||||
],
|
||||
"events": [
|
||||
"pull_request",
|
||||
"push",
|
||||
"workflow_dispatch"
|
||||
],
|
||||
"cadence": "event",
|
||||
"timezone": "UTC",
|
||||
"schedule": [],
|
||||
"owner": "@overtrue",
|
||||
"policy": "active",
|
||||
"monitor": "none",
|
||||
"result_owner": "agent-v1-protocol-regression.yml",
|
||||
"disposition": "validates Agent v1 schemas and fixture integrity",
|
||||
"monitor_reason": "Runs on changes to the Agent v1 contract and on request.",
|
||||
"origin": "added"
|
||||
},
|
||||
{
|
||||
"workflow": ".github/workflows/connect-diagnostic-schedule-acceptance.yml",
|
||||
"name": "Connect diagnostic scheduler receipt acceptance",
|
||||
@@ -1054,6 +1030,33 @@
|
||||
"failure_owner": "watchdog",
|
||||
"origin": "added"
|
||||
},
|
||||
{
|
||||
"workflow": ".github/workflows/gateway-integration-sync.yml",
|
||||
"name": "Gateway Integration Sync",
|
||||
"roles": [
|
||||
"periodic",
|
||||
"manual",
|
||||
"maintenance"
|
||||
],
|
||||
"events": [
|
||||
"schedule",
|
||||
"workflow_dispatch"
|
||||
],
|
||||
"cadence": "nightly",
|
||||
"timezone": "UTC",
|
||||
"schedule": [
|
||||
"0 2 * * 1-5"
|
||||
],
|
||||
"owner": "@overtrue",
|
||||
"policy": "active",
|
||||
"monitor": "workflow",
|
||||
"max_age_hours": 36,
|
||||
"result_owner": "gateway-integration-sync.yml",
|
||||
"disposition": "retained independent entry",
|
||||
"failure_owner": "workflow",
|
||||
"origin": "baseline",
|
||||
"alert_contract": "independent"
|
||||
},
|
||||
{
|
||||
"workflow": ".github/workflows/helm-package.yml",
|
||||
"name": "Build candidate Helm chart",
|
||||
@@ -1154,17 +1157,17 @@
|
||||
"workflow_dispatch",
|
||||
"schedule"
|
||||
],
|
||||
"cadence": "nightly",
|
||||
"cadence": "weekly",
|
||||
"timezone": "UTC",
|
||||
"schedule": [
|
||||
"41 6 * * *"
|
||||
"41 6 * * 0"
|
||||
],
|
||||
"owner": "@overtrue",
|
||||
"policy": "active",
|
||||
"monitor": "workflow",
|
||||
"max_age_hours": 36,
|
||||
"max_age_hours": 192,
|
||||
"result_owner": "mint.yml",
|
||||
"disposition": "nightly dual-stack mint comparison (pinned reference release vs candidate) with fail-closed diff-table gate",
|
||||
"disposition": "retained independent entry",
|
||||
"failure_owner": "workflow",
|
||||
"origin": "baseline",
|
||||
"alert_contract": "scheduled-validation"
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
name: Agent v1 protocol regression
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- "protocol/agent/v1/**"
|
||||
- "scripts/test_agent_v1_*.py"
|
||||
- "scripts/verify_agent_v1_fixtures.py"
|
||||
- "scripts/run_agent_v1_regression.sh"
|
||||
- "rustfs/src/connect/diagnostics/job.rs"
|
||||
- "rustfs/src/connect/diagnostics/job_delivery.rs"
|
||||
- ".github/workflows/agent-v1-protocol-regression.yml"
|
||||
push:
|
||||
paths:
|
||||
- "protocol/agent/v1/**"
|
||||
- "scripts/test_agent_v1_*.py"
|
||||
- "scripts/verify_agent_v1_fixtures.py"
|
||||
- "scripts/run_agent_v1_regression.sh"
|
||||
- "rustfs/src/connect/diagnostics/job.rs"
|
||||
- "rustfs/src/connect/diagnostics/job_delivery.rs"
|
||||
- ".github/workflows/agent-v1-protocol-regression.yml"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: agent-v1-protocol-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
protocol-regression:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: "3.12"
|
||||
cache: pip
|
||||
cache-dependency-path: protocol/agent/v1/requirements.txt
|
||||
- name: Install test dependencies
|
||||
run: python -m pip install -r protocol/agent/v1/requirements.txt
|
||||
- name: Run Agent v1 contract regression suite
|
||||
run: scripts/run_agent_v1_regression.sh
|
||||
@@ -16,7 +16,9 @@ name: Continuous Integration
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
# gateway/integration receives the daily merge of main as a direct push
|
||||
# (rustfs/backlog#2734), so its pushes must prove the result like main's.
|
||||
branches: [ main, gateway/integration ]
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
- "docs/**"
|
||||
@@ -36,7 +38,9 @@ on:
|
||||
- "flake.lock"
|
||||
pull_request:
|
||||
types: [ opened, synchronize, reopened, closed ]
|
||||
branches: [ main ]
|
||||
# gateway/integration carries main's ruleset (rustfs/backlog#2734), so its
|
||||
# pull requests must produce the same required checks.
|
||||
branches: [ main, gateway/integration ]
|
||||
merge_group:
|
||||
types: [ checks_requested ]
|
||||
schedule:
|
||||
@@ -502,10 +506,6 @@ jobs:
|
||||
if: matrix.mode == 'fips'
|
||||
run: sudo apt-get install -y cmake golang clang libclang-dev
|
||||
|
||||
- name: Check the native SigV4 crypto services
|
||||
if: matrix.mode == 'fips'
|
||||
run: ./scripts/sigv4-fips/check.sh
|
||||
|
||||
- name: Verify provider installation
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -1062,13 +1062,13 @@ jobs:
|
||||
# Merge gate only (backlog#1149 ci-5): the never-automated user-visible
|
||||
# suites — KMS, object_lock, multipart_auth, quota, checksum, encryption,
|
||||
# security-boundary, ... — via the e2e-full nextest profile. Too heavy for
|
||||
# every PR, so it is gated to main pushes, the merge
|
||||
# every PR, so it is gated to main and gateway/integration pushes, the merge
|
||||
# queue, and manual dispatch. protocols / the 7 cluster suites / replication
|
||||
# / #[ignore] are owned by other lanes (see .config/nextest.toml profile.e2e-full).
|
||||
if: >-
|
||||
github.event_name == 'workflow_dispatch' ||
|
||||
github.event_name == 'merge_group' ||
|
||||
(github.event_name == 'push' && github.ref == 'refs/heads/main')
|
||||
(github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/gateway/integration'))
|
||||
needs: [ build-rustfs-debug-binary ]
|
||||
# Retain the producer image and fixture paths until the runtime pilot passes.
|
||||
runs-on: sm-standard-4
|
||||
@@ -1370,6 +1370,15 @@ jobs:
|
||||
# the intermediate 4-object plateau requires 4*lc_interval < 5*debug_day, i.e.
|
||||
# debug_day > 8. A smaller value lets the Days=5 rule fire inside the Days=1
|
||||
# poll window so the count collapses straight to 2 and the test fails (#4764).
|
||||
#
|
||||
# RUSTFS_DATA_USAGE_UPDATE_DIR_CYCLES=1 is also required. A compacted directory
|
||||
# is only re-descended (and its objects re-evaluated for ILM) once every
|
||||
# DATA_USAGE_UPDATE_DIR_CYCLES scanner cycles (default 16). At the accelerated
|
||||
# RUSTFS_SCANNER_CYCLE=2 that is ~32s between evaluations, so a Days=1 object
|
||||
# that becomes due at debug_day (10s) is not actually expired until the next
|
||||
# ~32s boundary (~42s), landing just past the 4*lc_interval (40s) poll window
|
||||
# and making the count stall at 6 (#4767). Forcing every-cycle re-descent
|
||||
# evaluates ILM within ~2s of the due time, well inside the poll window.
|
||||
s3-lifecycle-behavior-tests:
|
||||
name: S3 Lifecycle Behavior Tests
|
||||
# Also gated on e2e-tests, matching s3-implemented-tests: when the e2e smoke
|
||||
@@ -1411,6 +1420,7 @@ jobs:
|
||||
RUSTFS_ILM_PROCESS_TIME=1 \
|
||||
RUSTFS_SCANNER_ENABLED=true \
|
||||
RUSTFS_SCANNER_CYCLE=2 \
|
||||
RUSTFS_DATA_USAGE_UPDATE_DIR_CYCLES=1 \
|
||||
RUSTFS_SCANNER_START_DELAY_SECS=0 \
|
||||
RUSTFS_API_STALE_UPLOADS_CLEANUP_INTERVAL=2s \
|
||||
S3_PORT="${S3_PORT}" \
|
||||
|
||||
@@ -123,14 +123,10 @@ jobs:
|
||||
echo "AWSCURL_PATH=$HOME/.local/bin/awscurl" >> "$GITHUB_ENV"
|
||||
test -x "$HOME/.local/bin/awscurl"
|
||||
|
||||
- name: Install network fault-injection tools and the persistence test clock
|
||||
- name: Install network fault-injection tools
|
||||
if: matrix.profile == 'e2e-full'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y iptables libfaketime
|
||||
clock_library="$(dpkg-query -L libfaketime | grep -E '/libfaketime[.]so[.]1$')"
|
||||
test -f "$clock_library"
|
||||
echo "RUSTFS_PERSISTENCE_CLOCK_LIBRARY=$clock_library" >> "$GITHUB_ENV"
|
||||
sudo apt-get install -y iptables
|
||||
sudo -n iptables --version
|
||||
# The endpoint-blackhole heal scenario needs CAP_NET_ADMIN. Containerised
|
||||
# runners can run iptables but not touch the rule set; the test then logs
|
||||
@@ -175,23 +171,11 @@ jobs:
|
||||
run: |
|
||||
"$RUSTFS_TEST_VAULT_BIN" version
|
||||
|
||||
- name: Download pinned release for persistence byte parity
|
||||
id: persistence-reference
|
||||
if: matrix.profile == 'e2e-full'
|
||||
uses: ./.github/actions/reference-binary
|
||||
|
||||
- name: Run the profile
|
||||
env:
|
||||
PROFILE: ${{ matrix.profile }}
|
||||
RUSTFS_E2E_LOG_DIR: ${{ runner.temp }}/server-logs
|
||||
PERSISTENCE_REFERENCE_BINARY: ${{ steps.persistence-reference.outputs.path }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [[ "$PROFILE" == "e2e-full" ]]; then
|
||||
test -x "$PERSISTENCE_REFERENCE_BINARY"
|
||||
test -f "$RUSTFS_PERSISTENCE_CLOCK_LIBRARY"
|
||||
export RUSTFS_PERSISTENCE_REFERENCE_BINARY="$PERSISTENCE_REFERENCE_BINARY"
|
||||
fi
|
||||
chmod +x target/debug/rustfs
|
||||
filter='not test(/^(dual_stack_differential|fake_s3_target|distributed_startup_regression_test)::/)'
|
||||
filter="$filter & not test(/^upgrade_compatibility_test::upgrade_write_readiness_tests::/)"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# Gateway black-box acceptance lanes (rustfs/backlog#2775 T3.4, #2776 T3.5).
|
||||
#
|
||||
# Runs two suites of the rustfs/gateway repository against the candidate binary,
|
||||
# with isolated data and a separate server for each suite:
|
||||
# one server:
|
||||
#
|
||||
# - the conformance corpus, `--profile rustfs`, judged by
|
||||
# scripts/check_conformance_rulings.py against .config/conformance-rulings.toml
|
||||
@@ -64,16 +64,26 @@ jobs:
|
||||
timeout-minutes: 5
|
||||
outputs:
|
||||
gateway-rev: ${{ steps.pin.outputs.rev }}
|
||||
ceph-rev: ${{ steps.pin.outputs.ceph-rev }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Read the gateway and Ceph pins
|
||||
- name: Read the rustfs/gateway rev from Cargo.toml
|
||||
id: pin
|
||||
run: python3 scripts/gateway_corpus_capture.py pins >> "$GITHUB_OUTPUT"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python3 - <<'PY' >> "$GITHUB_OUTPUT"
|
||||
import re, sys, tomllib
|
||||
dependencies = tomllib.load(open("Cargo.toml", "rb"))["workspace"]["dependencies"]
|
||||
revs = {spec.get("rev") for spec in dependencies.values()
|
||||
if isinstance(spec, dict) and spec.get("git") == "https://github.com/rustfs/gateway.git"}
|
||||
if len(revs) != 1 or not re.fullmatch(r"[0-9a-f]{40}", str(next(iter(revs)))):
|
||||
sys.exit(f"Cargo.toml must pin rustfs/gateway at exactly one full rev, found {sorted(map(str, revs))}")
|
||||
print(f"rev={revs.pop()}")
|
||||
PY
|
||||
cat "$GITHUB_OUTPUT"
|
||||
|
||||
build-candidate:
|
||||
name: Build candidate binary
|
||||
@@ -130,8 +140,8 @@ jobs:
|
||||
- name: Build
|
||||
working-directory: gateway
|
||||
run: |
|
||||
cargo build --locked --release -p rustfs-gateway-conformance -p rustfs-gateway-compat-sut -p rustfs-gateway-corpus \
|
||||
--bin rustfs-gateway-conformance --bin compat-sut --bin corpus
|
||||
cargo build --locked --release -p rustfs-gateway-conformance -p rustfs-gateway-compat-sut \
|
||||
--bin rustfs-gateway-conformance --bin compat-sut
|
||||
|
||||
- name: Upload tools
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
@@ -141,7 +151,6 @@ jobs:
|
||||
path: |
|
||||
gateway/target/release/rustfs-gateway-conformance
|
||||
gateway/target/release/compat-sut
|
||||
gateway/target/release/corpus
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
@@ -156,8 +165,6 @@ jobs:
|
||||
timeout-minutes: 45
|
||||
env:
|
||||
ENDPOINT: http://127.0.0.1:9000
|
||||
CONFORMANCE_ENDPOINT: http://127.0.0.1:19000
|
||||
CREATE_BUCKET_ENDPOINT: http://127.0.0.1:19001
|
||||
# The conformance suite signs with these fixed fixture credentials (the AWS
|
||||
# documentation example pair), so the candidate is started with them and the
|
||||
# client matrix is handed the same pair.
|
||||
@@ -189,42 +196,36 @@ jobs:
|
||||
name: gateway-acceptance-tools
|
||||
path: tools
|
||||
|
||||
- name: Start conformance candidate
|
||||
env:
|
||||
# The corpus declares both virtual-host endpoints and a 2 MiB HTTP/2 connection window.
|
||||
ENDPOINT: ${{ env.CONFORMANCE_ENDPOINT }}
|
||||
HOST_DIR: lane
|
||||
RUSTFS_H2_INITIAL_CONN_WINDOW_SIZE: "2097152"
|
||||
RUSTFS_CONSOLE_ENABLE: "false"
|
||||
RUSTFS_SERVER_DOMAINS: s3.example.com,s3.us-east-1.example.com
|
||||
run: &start-candidate |
|
||||
# Records `ready`, or what the process said when it exited, in lane/startup.txt.
|
||||
- name: Start candidate
|
||||
run: |
|
||||
set -uo pipefail
|
||||
chmod +x target/debug/rustfs tools/*
|
||||
mkdir -p "$HOST_DIR" "$RUNNER_TEMP/$HOST_DIR"/data/rustfs{0..3}
|
||||
target/debug/rustfs --version | tee "$HOST_DIR/candidate-version.txt"
|
||||
mkdir -p lane "$RUNNER_TEMP"/data/rustfs{0..3}
|
||||
target/debug/rustfs --version | tee lane/candidate-version.txt
|
||||
# The four directories share the runner's one disk; the bypass is the CI case the
|
||||
# physical-disk guard sanctions (as in mint.yml).
|
||||
RUSTFS_UNSAFE_BYPASS_DISK_CHECK=true RUST_LOG=info target/debug/rustfs --address "${ENDPOINT#http://}" \
|
||||
--access-key "$ACCESS_KEY" --secret-key "$SECRET_KEY" "$RUNNER_TEMP/$HOST_DIR"/data/rustfs{0..3} \
|
||||
> "$HOST_DIR/rustfs.log" 2>&1 &
|
||||
RUSTFS_UNSAFE_BYPASS_DISK_CHECK=true RUST_LOG=info target/debug/rustfs --address 127.0.0.1:9000 \
|
||||
--access-key "$ACCESS_KEY" --secret-key "$SECRET_KEY" "$RUNNER_TEMP"/data/rustfs{0..3} \
|
||||
> lane/rustfs.log 2>&1 &
|
||||
pid=$!
|
||||
echo "$pid" > "$HOST_DIR/rustfs.pid"
|
||||
echo "$pid" > lane/rustfs.pid
|
||||
# Liveness first: a ready answer counts only while this process is still running.
|
||||
for _ in $(seq 120); do
|
||||
if ! kill -0 "$pid" 2>/dev/null; then
|
||||
status=0
|
||||
wait "$pid" || status=$?
|
||||
echo "did not start: exit ${status}: $(grep -v '^[[:space:]]*$' "$HOST_DIR/rustfs.log" | tail -n 1)" > "$HOST_DIR/startup.txt"
|
||||
cat "$HOST_DIR/startup.txt"
|
||||
echo "did not start: exit ${status}: $(grep -v '^[[:space:]]*$' lane/rustfs.log | tail -n 1)" > lane/startup.txt
|
||||
cat lane/startup.txt
|
||||
exit 1
|
||||
fi
|
||||
if curl -sf "$ENDPOINT/health/ready" >/dev/null; then
|
||||
echo ready > "$HOST_DIR/startup.txt"
|
||||
echo ready > lane/startup.txt
|
||||
exit 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo "did not start: /health/ready did not answer within 120 seconds" > "$HOST_DIR/startup.txt"
|
||||
echo "did not start: /health/ready did not answer within 120 seconds" > lane/startup.txt
|
||||
exit 1
|
||||
|
||||
# The exit code is data for the judge step, not this step's result.
|
||||
@@ -232,11 +233,10 @@ jobs:
|
||||
run: |
|
||||
set +e
|
||||
tools/rustfs-gateway-conformance run --root gateway/conformance --profile rustfs \
|
||||
--endpoint "$CONFORMANCE_ENDPOINT" --allow-external-fixtures \
|
||||
--endpoint "$ENDPOINT" --allow-external-fixtures \
|
||||
--json lane/report.json > lane/conformance.log 2>&1
|
||||
echo "$?" > lane/runner-exit.txt
|
||||
if kill -0 "$(cat lane/rustfs.pid)" 2>/dev/null; then echo alive; else echo exited; fi > lane/alive-after-conformance.txt
|
||||
kill "$(cat lane/rustfs.pid)" 2>/dev/null || true
|
||||
tail -n 20 lane/conformance.log
|
||||
|
||||
- name: Set up Python
|
||||
@@ -291,11 +291,6 @@ jobs:
|
||||
echo "COMPAT_CLIENTS=$(IFS=,; echo "${installed[*]}")" >> "$GITHUB_ENV"
|
||||
cat ../lane/skipped-clients.txt 2>/dev/null || echo "every pinned client installed"
|
||||
|
||||
- name: Start client matrix candidate with default protocol settings
|
||||
env:
|
||||
HOST_DIR: lane/matrix-host
|
||||
run: *start-candidate
|
||||
|
||||
# The exit code is data for the judge step, not this step's result.
|
||||
- name: Run client matrix (external)
|
||||
working-directory: gateway
|
||||
@@ -314,54 +309,13 @@ jobs:
|
||||
fi
|
||||
echo "$?" > ../lane/matrix-exit.txt
|
||||
|
||||
- name: Start isolated bucket creation candidate
|
||||
id: create_bucket_host
|
||||
env:
|
||||
ENDPOINT: ${{ env.CREATE_BUCKET_ENDPOINT }}
|
||||
HOST_DIR: lane/create-bucket
|
||||
RUSTFS_CONSOLE_ENABLE: "false"
|
||||
RUSTFS_SERVER_DOMAINS: s3.example.com,s3.us-east-1.example.com
|
||||
run: *start-candidate
|
||||
|
||||
- name: Require bucket creation conformance
|
||||
run: |
|
||||
cases=(c-bkt-0001 c-bkt-0010 c-host-0003)
|
||||
status=0
|
||||
for id in "${cases[@]}"; do
|
||||
tools/rustfs-gateway-conformance run --root gateway/conformance --profile rustfs \
|
||||
--filter "$id" --endpoint "$CREATE_BUCKET_ENDPOINT" --allow-external-fixtures --allow-external-writes \
|
||||
--json "lane/create-bucket/$id.json" || status=1
|
||||
done
|
||||
python3 - "$CREATE_BUCKET_ENDPOINT" "${cases[@]}" <<'PY'
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
endpoint, *case_ids = sys.argv[1:]
|
||||
for case_id in case_ids:
|
||||
report = json.loads(Path(f"lane/create-bucket/{case_id}.json").read_text())
|
||||
if report.get("endpoint") != endpoint or report.get("profile") != "rustfs":
|
||||
sys.exit(f"{case_id}: report does not identify the requested RustFS endpoint")
|
||||
observed = [(case["id"], case["phase"], case["verdict"]) for case in report["cases"]]
|
||||
if report.get("validate_only") is not False or observed != [(case_id, "execute", "passed")]:
|
||||
sys.exit(f"{case_id}: expected one executed pass, got {observed}, validate_only={report.get('validate_only')}")
|
||||
PY
|
||||
exit "$status"
|
||||
|
||||
- name: Stop bucket creation candidate
|
||||
if: always() && steps.create_bucket_host.outcome != 'skipped'
|
||||
run: |
|
||||
if [[ -f lane/create-bucket/rustfs.pid ]]; then
|
||||
kill "$(cat lane/create-bucket/rustfs.pid)" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
- name: Judge and summarize
|
||||
if: always()
|
||||
run: |
|
||||
set -uo pipefail
|
||||
status=0
|
||||
python3 scripts/check_conformance_rulings.py --run-dir lane --case-dir gateway/conformance/cases | tee -a "$GITHUB_STEP_SUMMARY" || status=1
|
||||
python3 scripts/compat_matrix_report.py check --run-dir lane --server-dir lane/matrix-host | tee -a "$GITHUB_STEP_SUMMARY" || status=1
|
||||
python3 scripts/check_conformance_rulings.py --run-dir lane | tee -a "$GITHUB_STEP_SUMMARY" || status=1
|
||||
python3 scripts/compat_matrix_report.py check --run-dir lane | tee -a "$GITHUB_STEP_SUMMARY" || status=1
|
||||
exit "$status"
|
||||
|
||||
- name: Upload lane results
|
||||
@@ -373,130 +327,10 @@ jobs:
|
||||
path: |
|
||||
lane/*.txt
|
||||
lane/*.log
|
||||
lane/matrix-host/*.txt
|
||||
lane/matrix-host/*.log
|
||||
lane/report.json
|
||||
lane/create-bucket/c-*.json
|
||||
lane/compat/matrix.json
|
||||
lane/compat/probe.jsonl
|
||||
lane/compat/sut.log
|
||||
lane/compat/results/**
|
||||
if-no-files-found: error
|
||||
retention-days: 14
|
||||
|
||||
capture-corpus:
|
||||
name: Capture wire samples (selected E2E and Ceph tests)
|
||||
needs: [ plan, build-gateway-tools ]
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Rust environment
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
# Reuse the hosted server and e2e harness dependencies. Capture jobs never save caches.
|
||||
cache-shared-key: ci-e2e-distributed-hosted
|
||||
cache-save-if: 'false'
|
||||
install-build-packaging-tools: 'false'
|
||||
|
||||
# Keep external source and tools outside the verified server's source inventory.
|
||||
- name: Checkout gateway's independent secret scanner
|
||||
uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
repository: rustfs/gateway
|
||||
ref: ${{ needs.plan.outputs.gateway-rev }}
|
||||
path: target/wire/gateway
|
||||
persist-credentials: false
|
||||
|
||||
- name: Checkout pinned Ceph tests
|
||||
uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
repository: ceph/s3-tests
|
||||
ref: ${{ needs.plan.outputs.ceph-rev }}
|
||||
path: target/wire/ceph
|
||||
persist-credentials: false
|
||||
|
||||
- name: Download matching corpus tools
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: gateway-acceptance-tools
|
||||
path: target/wire/tools
|
||||
|
||||
- name: Install Ceph's test dependencies
|
||||
run: |
|
||||
python3 -m venv "$RUNNER_TEMP/ceph-venv"
|
||||
"$RUNNER_TEMP/ceph-venv/bin/python" -m pip install -r target/wire/ceph/requirements.txt
|
||||
|
||||
- name: Build the debug-only recording server
|
||||
id: wire_server
|
||||
run: python3 scripts/e2e_binary.py build --features corpus-record
|
||||
|
||||
- name: Record and verify selected scenarios from both sources
|
||||
id: capture
|
||||
run: |
|
||||
chmod +x target/wire/tools/corpus
|
||||
python3 scripts/e2e_binary.py run --features corpus-record -- \
|
||||
"$RUNNER_TEMP/ceph-venv/bin/python" scripts/gateway_corpus_capture.py record --suite nightly \
|
||||
--gateway target/wire/gateway --ceph target/wire/ceph --tool target/wire/tools/corpus \
|
||||
--summary "$RUNNER_TEMP/gateway-capture-summary.json"
|
||||
|
||||
- name: Require 1000–2000 retained entries
|
||||
run: python3 scripts/gateway_corpus_capture.py check-size "$RUNNER_TEMP/gateway-capture-summary.json"
|
||||
|
||||
# Only publish after the enclosing binary verifier also succeeds. A size shortfall still has valid counts.
|
||||
- name: Upload validated counts
|
||||
if: ${{ !cancelled() && steps.capture.outcome == 'success' }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: gateway-capture-summary
|
||||
path: ${{ runner.temp }}/gateway-capture-summary.json
|
||||
if-no-files-found: error
|
||||
retention-days: 14
|
||||
|
||||
# The capture size and release parity are independent verdicts.
|
||||
- name: Fetch the verified release reference
|
||||
id: wire_reference
|
||||
if: ${{ !cancelled() && steps.wire_server.outcome == 'success' }}
|
||||
uses: ./.github/actions/reference-binary
|
||||
|
||||
- name: Install a child-process clock for the wire comparison
|
||||
id: wire_clock
|
||||
if: ${{ !cancelled() && steps.wire_reference.outcome == 'success' }}
|
||||
run: |
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install --no-install-recommends -y libfaketime
|
||||
lib="$(dpkg-query -L libfaketime | sed -n '/\/libfaketime\.so\.1$/p')"
|
||||
test -f "$lib"
|
||||
echo "path=$lib" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Compare the same signed Ceph requests against the release
|
||||
id: wire_compare
|
||||
if: ${{ !cancelled() && steps.wire_clock.outcome == 'success' }}
|
||||
env:
|
||||
REF_BINARY: ${{ steps.wire_reference.outputs.path }}
|
||||
REF_SHA256: ${{ steps.wire_reference.outputs.executable-sha256 }}
|
||||
REF_VERSION: ${{ steps.wire_reference.outputs.version }}
|
||||
CLOCK_LIBRARY: ${{ steps.wire_clock.outputs.path }}
|
||||
run: |
|
||||
python3 scripts/e2e_binary.py run --features corpus-record -- \
|
||||
"$RUNNER_TEMP/ceph-venv/bin/python" scripts/gateway_wire_replay.py compare \
|
||||
--ceph target/wire/ceph --gateway target/wire/gateway --reference "$REF_BINARY" \
|
||||
--reference-sha256 "$REF_SHA256" --reference-version "$REF_VERSION" --clock-library "$CLOCK_LIBRARY" \
|
||||
--summary "$RUNNER_TEMP/gateway-wire-differences.json"
|
||||
|
||||
- name: Require zero response differences on replayed cases
|
||||
if: ${{ !cancelled() && steps.wire_compare.outcome == 'success' }}
|
||||
run: python3 scripts/gateway_wire_replay.py check "$RUNNER_TEMP/gateway-wire-differences.json"
|
||||
|
||||
- name: Upload validated difference counts and case IDs
|
||||
if: ${{ !cancelled() && steps.wire_compare.outcome == 'success' }}
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: gateway-wire-differences
|
||||
path: ${{ runner.temp }}/gateway-wire-differences.json
|
||||
if-no-files-found: error
|
||||
retention-days: 14
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
# Copyright 2026 RustFS Team
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
name: Gateway Integration Sync
|
||||
|
||||
# Merges `main` into the long-lived `gateway/integration` branch every weekday
|
||||
# so the s3s -> gateway migration (rustfs/backlog#2734, task T0.1 in #2736)
|
||||
# never accumulates merge debt. A clean merge lands as a `--no-ff` merge commit
|
||||
# pushed straight to the branch. A conflicting merge is aborted and fails the
|
||||
# run after its summary records the source and target SHAs, run URL, and exact
|
||||
# conflicting paths. It creates no sync branch or pull request. Resolve the
|
||||
# merge in an isolated worktree based on the latest target, preserve the
|
||||
# two-parent merge commit, and push only after the required checks pass and the
|
||||
# target still matches the merge's first parent. If the target moves, restart
|
||||
# from its new head.
|
||||
#
|
||||
# Write scope: only `gateway/integration` is ever pushed. The push uses a
|
||||
# one-hour installation token of the organisation's GitHub App (contents:
|
||||
# write) because that app is the only non-admin bypass actor of the
|
||||
# `gateway/integration` ruleset; GITHUB_TOKEN cannot be a ruleset bypass actor,
|
||||
# so it cannot push through the required reviews and checks. GITHUB_TOKEN is
|
||||
# read-only here.
|
||||
#
|
||||
# `schedule` fires only from the default branch, so the cron is live once this
|
||||
# file exists on `main`. `workflow_dispatch` runs from any ref that carries the
|
||||
# file and always acts on `gateway/integration`.
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 2 * * 1-5" # Weekdays 02:00 UTC
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
source_ref:
|
||||
description: >-
|
||||
Branch to merge into gateway/integration. The schedule always merges
|
||||
main; only the conflict acceptance test (rustfs/backlog#2736) sets
|
||||
another branch.
|
||||
required: false
|
||||
default: main
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}
|
||||
cancel-in-progress: false
|
||||
|
||||
env:
|
||||
TARGET_BRANCH: gateway/integration
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
name: Merge main into gateway/integration
|
||||
if: github.repository == 'rustfs/rustfs'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- name: Create the branch push token
|
||||
id: push-token
|
||||
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
|
||||
with:
|
||||
app-id: ${{ vars.CLA_BOT_APP_ID }}
|
||||
private-key: ${{ secrets.CLA_BOT_APP_PRIVATE_KEY }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repositories: rustfs
|
||||
permission-contents: write
|
||||
|
||||
- name: Checkout gateway/integration
|
||||
uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
# persist-credentials-exempt: this checkout's token IS the push
|
||||
# credential — the merge commit and the sync branch are pushed with it
|
||||
# below. It is a one-hour installation token scoped to contents.
|
||||
ref: gateway/integration
|
||||
fetch-depth: 0
|
||||
token: ${{ steps.push-token.outputs.token }}
|
||||
|
||||
- name: Configure the bot identity
|
||||
run: |
|
||||
git config user.name "rustfs-cla-assistant[bot]"
|
||||
git config user.email "273121464+rustfs-cla-assistant[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Merge the source branch
|
||||
id: merge
|
||||
env:
|
||||
SOURCE_REF: ${{ inputs.source_ref || 'main' }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if ! [[ "$SOURCE_REF" =~ ^[A-Za-z0-9][A-Za-z0-9._/-]*$ ]] \
|
||||
|| [[ "$SOURCE_REF" == *..* ]] \
|
||||
|| [[ "$SOURCE_REF" == "$TARGET_BRANCH" ]]; then
|
||||
echo "::error::refusing source_ref '${SOURCE_REF}'"
|
||||
exit 1
|
||||
fi
|
||||
git fetch origin "refs/heads/${SOURCE_REF}:refs/remotes/origin/${SOURCE_REF}"
|
||||
source_sha=$(git rev-parse "origin/${SOURCE_REF}")
|
||||
target_sha=$(git rev-parse HEAD)
|
||||
{
|
||||
echo "source_ref=${SOURCE_REF}"
|
||||
echo "source_sha=${source_sha}"
|
||||
echo "target_sha=${target_sha}"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
if git merge --no-ff --no-edit "origin/${SOURCE_REF}"; then
|
||||
if [[ "$(git rev-parse HEAD)" == "$target_sha" ]]; then
|
||||
echo "result=up-to-date" >> "$GITHUB_OUTPUT"
|
||||
echo "\`${TARGET_BRANCH}\` already contains \`${SOURCE_REF}\` (${source_sha}); nothing to push." >> "$GITHUB_STEP_SUMMARY"
|
||||
else
|
||||
echo "result=merged" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
conflicts=$(git diff --name-only --diff-filter=U)
|
||||
if [[ -z "$conflicts" ]]; then
|
||||
git merge --abort || true
|
||||
echo "::error::git merge failed without reporting conflicting paths; this is not a conflict"
|
||||
exit 1
|
||||
fi
|
||||
{
|
||||
echo "## Gateway integration sync stopped on conflicts"
|
||||
echo
|
||||
echo "- Run: ${RUN_URL}"
|
||||
echo "- Source: \`${SOURCE_REF}\` at ${source_sha}"
|
||||
echo "- Target: \`${TARGET_BRANCH}\` at ${target_sha}"
|
||||
echo
|
||||
echo "Conflicting files:"
|
||||
printf '%s\n' "$conflicts" | sed 's/^/- /'
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
git merge --abort
|
||||
echo "::error::${SOURCE_REF} cannot be merged cleanly into ${TARGET_BRANCH}; no branch or pull request was created"
|
||||
exit 1
|
||||
|
||||
- name: Push the merge commit
|
||||
if: steps.merge.outputs.result == 'merged'
|
||||
env:
|
||||
SOURCE_REF: ${{ steps.merge.outputs.source_ref }}
|
||||
SOURCE_SHA: ${{ steps.merge.outputs.source_sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git push origin HEAD:refs/heads/gateway/integration
|
||||
echo "Merged \`${SOURCE_REF}\` (${SOURCE_SHA}) into \`${TARGET_BRANCH}\` as $(git rev-parse HEAD)." >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
alert-on-failure:
|
||||
name: Alert on scheduled failure
|
||||
needs: [sync]
|
||||
# Same ci-8 mechanism audit.yml and coverage.yml use: a scheduled run that
|
||||
# could not push or encountered merge conflicts must not stay visible only
|
||||
# in the Actions tab.
|
||||
if: github.repository == 'rustfs/rustfs' && (always() && github.event_name == 'schedule' && contains(needs.*.result, 'failure'))
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Open or update failure-tracking issue
|
||||
uses: ./.github/actions/schedule-failure-issue
|
||||
with:
|
||||
github-token: ${{ secrets.BACKLOG_ISSUE_TOKEN }}
|
||||
+102
-289
@@ -12,45 +12,38 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# MinIO Mint dual-stack comparison against RustFS: multi-SDK client compatibility
|
||||
# (rustfs/backlog#2774, T3.3).
|
||||
# MinIO Mint against RustFS: multi-SDK client compatibility.
|
||||
#
|
||||
# ceph/s3-tests (see e2e-s3tests.yml, reference-parity.yml, and the ci.yml PR
|
||||
# gate) exercises S3 API semantics through boto3 only. Mint complements it by
|
||||
# running the functional test suites of many real client SDKs and tools (awscli,
|
||||
# mc, aws-sdk-go-v2/php/ruby, minio-go/java/js/py, s3cmd, versioning, ...),
|
||||
# catching client-specific signing, encoding, and streaming edge cases a single
|
||||
# client cannot.
|
||||
# ceph/s3-tests (see e2e-s3tests.yml and the ci.yml PR gate) exercises the S3
|
||||
# API semantics through boto3 only. Mint complements it by running the
|
||||
# functional test suites of many REAL client SDKs and tools (awscli, mc,
|
||||
# aws-sdk-java/go/php/ruby, minio-go/java/js/py, s3cmd, ...), which catches
|
||||
# client-specific signing, encoding, and streaming edge cases a single client
|
||||
# cannot.
|
||||
#
|
||||
# Dual-stack nightly gate (rustfs/backlog#2774): runs the pinned minio/mint
|
||||
# image against BOTH:
|
||||
# - `legacy`: the pinned reference release in .config/reference-binary.toml,
|
||||
# downloaded and SHA-256 verified by ./.github/actions/reference-binary;
|
||||
# - `gateway`: the candidate binary built from this checkout by
|
||||
# `build-candidate` on `sm-standard-4` (matching `ci.yml` and
|
||||
# `reference-parity.yml`, avoiding release-LTO OOM on 16 GB `ubuntu-latest`).
|
||||
# This job is REPORT-ONLY for test failures: RustFS does not pass every mint
|
||||
# suite yet, so failures are inventoried in the job summary instead of turning
|
||||
# the run red. The job fails only when mint produces no results at all
|
||||
# (infrastructure error). Once a suite passes reliably, tightening this into a
|
||||
# baseline gate (like implemented_tests.txt for s3-tests) is the natural next
|
||||
# step. Tightening this into a per-suite baseline gate is tracked as ci-3
|
||||
# (backlog#1149) and is intentionally NOT done here.
|
||||
#
|
||||
# Both legs build the same lightweight `ubuntu:26.04` runtime image (glibc
|
||||
# >= both `sm-standard-4`'s Ubuntu 24.04 glibc 2.39 and the pinned 1.0.5
|
||||
# reference binary's glibc 2.31), symmetrically bind-mount their verified
|
||||
# binary read-only at `/usr/bin/rustfs`, run on identical Docker bridge
|
||||
# networking (`rustfs-net`, `SERVER_ENDPOINT=rustfs-mint:9000`), and record
|
||||
# verified in-container binary provenance (`target.json`). Individual SDK test
|
||||
# failures within a leg are data for the comparison, not a leg failure; a
|
||||
# missing/empty `log.json` or container startup failure fails the leg. The
|
||||
# `compare` job runs `scripts/mint_stack_diff.py` as a fail-closed gate: it
|
||||
# verifies distinct binary provenance, writes the Markdown
|
||||
# `(sdk, test, legacy, gateway)` diff table to `$GITHUB_STEP_SUMMARY`, uploads
|
||||
# `diff.md`/`diff.json`, and fails whenever the diff table is non-empty or
|
||||
# either leg lacks valid results.
|
||||
#
|
||||
# Runner infrastructure (ci-2, backlog#1149; backlog#2774): compiling the RustFS
|
||||
# candidate binary needs no Docker daemon and belongs on `sm-standard-4` (28 GB
|
||||
# RAM, warmed `ci-dev` cache) because the full release LTO `Dockerfile.source`
|
||||
# build OOMs on 16 GB `ubuntu-latest`. Running `rustfs-mint` and `minio/mint`
|
||||
# needs a working Docker daemon without self-hosted pod drift (no
|
||||
# `/var/run/docker.sock` on `sm-standard-*`), so the `mint` matrix stays on
|
||||
# GitHub-hosted `ubuntu-latest`.
|
||||
# Runner infrastructure (ci-2, backlog#1149): this job needs a working Docker
|
||||
# daemon to (a) build the RustFS source image with buildx and (b) run both the
|
||||
# RustFS server and the mint image. It previously ran on the self-hosted
|
||||
# `sm-standard-4` label, which is served by heterogeneous runners; its single
|
||||
# recorded run (28730530597, 2026-07-05) landed on a minimal pod with no
|
||||
# `/var/run/docker.sock`, so "Enable buildx" died at `docker buildx create`
|
||||
# ("failed to connect to the docker API at unix:///var/run/docker.sock") before
|
||||
# any test executed -- the same root cause ci-1 fixed for the weekly s3-tests
|
||||
# sweep. The fix is to pin to GitHub-hosted `ubuntu-latest`, which reliably
|
||||
# ships a running Docker daemon + buildx + python3, instead of trusting the
|
||||
# drifting self-hosted fleet. Tradeoff: the source Rust build is heavier on a
|
||||
# GitHub-hosted 4-vCPU runner than on a warm self-hosted host, but it stays
|
||||
# well inside the 120-minute budget and buys deterministic infra. The
|
||||
# docker-capable self-hosted `dind-sm-standard-2` label was the alternative but
|
||||
# has fewer cores and reintroduces fleet-state risk for no reliability gain.
|
||||
|
||||
name: mint
|
||||
|
||||
@@ -74,22 +67,19 @@ on:
|
||||
required: false
|
||||
default: ""
|
||||
schedule:
|
||||
# Nightly at 06:41 UTC, clear of the overnight validation lanes
|
||||
# (reference-parity 01:37, e2e-s3tests Sun 02:19, dual-stack-nightly 03:13,
|
||||
# gateway-acceptance 03:29, e2e-nightly 04:29, e2e-distributed 05:53).
|
||||
- cron: "41 6 * * *"
|
||||
# Weekly, after the Sunday s3-tests full sweep (starts 02:00 UTC, up to
|
||||
# 3h) has finished, so the two never contend for the same runner pool.
|
||||
- cron: "41 6 * * 0"
|
||||
|
||||
env:
|
||||
# Matches ci.yml, cache-warm.yml, and reference-parity.yml: these variables
|
||||
# are hashed into the rust-cache key, so build-candidate reads the warmed
|
||||
# ci-dev cache on sm-standard-4.
|
||||
CARGO_TERM_COLOR: always
|
||||
RUST_BACKTRACE: 1
|
||||
|
||||
S3_ACCESS_KEY: rustfsadmin-ci
|
||||
S3_SECRET_KEY: rustfssecret-ci
|
||||
S3_REGION: us-east-1
|
||||
|
||||
RUST_LOG: info
|
||||
PLATFORM: linux/amd64
|
||||
BUILDX_CACHE_SCOPE: rustfs-e2e-s3tests-source
|
||||
|
||||
MINT_SUITES: ${{ github.event.inputs.suites || '' }}
|
||||
MINT_MODE: ${{ github.event.inputs.mode || 'core' }}
|
||||
# minio/mint:edge is a rolling tag, so an unpinned run is not reproducible and
|
||||
@@ -106,7 +96,7 @@ env:
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name != 'schedule' }}
|
||||
cancel-in-progress: true
|
||||
|
||||
# Only alert-on-failure needs more than read access; it declares its own
|
||||
# job-level `issues: write`.
|
||||
@@ -118,146 +108,65 @@ defaults:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
build-candidate:
|
||||
name: Build candidate binary
|
||||
# Disk, critical-path CPU, and cache ownership: the same debug build as
|
||||
# ci.yml's build-rustfs-debug-binary and reference-parity.yml's
|
||||
# build-candidate, reading the ci-dev cache written on sm-standard-4 (and
|
||||
# avoiding release-LTO OOM on 16 GB ubuntu-latest).
|
||||
runs-on: sm-standard-4
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Rust environment
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
rust-version: stable
|
||||
cache-shared-key: ci-dev-ea7eec74fe14
|
||||
cache-save-if: 'false'
|
||||
install-build-packaging-tools: 'false'
|
||||
install-test-tools: 'false'
|
||||
|
||||
- name: Build debug binary
|
||||
run: python3 scripts/e2e_binary.py build --bins --features e2e-test-hooks
|
||||
|
||||
- name: Upload candidate binary
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: mint-candidate-binary
|
||||
overwrite: true
|
||||
path: |
|
||||
target/debug/rustfs
|
||||
target/debug/rustfs.e2e.json
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
mint:
|
||||
name: mint (${{ matrix.leg }})
|
||||
needs: [build-candidate]
|
||||
# GitHub-hosted: reliably provides a running Docker daemon + python3.
|
||||
# Self-hosted sm-standard-* pods do not provide /var/run/docker.sock.
|
||||
image:
|
||||
name: Build the RustFS image once
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
leg: [legacy, gateway]
|
||||
env:
|
||||
LEG: ${{ matrix.leg }}
|
||||
NO_PROXY: 127.0.0.1,localhost,::1
|
||||
steps:
|
||||
- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Fetch pinned reference binary
|
||||
id: reference
|
||||
if: matrix.leg == 'legacy'
|
||||
uses: ./.github/actions/reference-binary
|
||||
- name: Enable buildx
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
|
||||
|
||||
- name: Download candidate binary
|
||||
if: matrix.leg == 'gateway'
|
||||
- name: Build RustFS image (source, cached)
|
||||
run: |
|
||||
DOCKER_BUILDKIT=1 docker buildx build --load \
|
||||
--platform "${PLATFORM}" \
|
||||
--cache-from "type=gha,scope=${BUILDX_CACHE_SCOPE}" \
|
||||
--cache-to "type=gha,mode=max,scope=${BUILDX_CACHE_SCOPE}" \
|
||||
-t rustfs-ci \
|
||||
-f Dockerfile.source .
|
||||
docker save rustfs-ci --output "${RUNNER_TEMP}/rustfs-ci.tar"
|
||||
|
||||
- name: Upload the image
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: mint-image
|
||||
path: ${{ runner.temp }}/rustfs-ci.tar
|
||||
retention-days: 1
|
||||
|
||||
mint:
|
||||
name: mint
|
||||
needs: [image]
|
||||
# GitHub-hosted: reliably provides a running Docker daemon + buildx +
|
||||
# python3. See the header note (ci-2) for why the self-hosted sm-standard-4
|
||||
# label was abandoned (no docker.sock on the pod its only run landed on).
|
||||
# sm-standard-2 has no docker.sock either (weekly runs failed at "Enable
|
||||
# buildx" from 2026-09-27 to 2026-11-08), so keep this job on ubuntu-latest.
|
||||
# TODO(ci-8): scheduled-failure alerting (auto-open issue on a red weekly
|
||||
# run) is added by the ci-8 composite action; do not implement it here.
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
steps:
|
||||
- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Download the image
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: mint-candidate-binary
|
||||
path: ${{ runner.temp }}/candidate
|
||||
name: mint-image
|
||||
path: ${{ runner.temp }}
|
||||
|
||||
- name: Build lightweight runtime image
|
||||
run: |
|
||||
set -euo pipefail
|
||||
ctx="${RUNNER_TEMP}/mint-runtime-ctx"
|
||||
rm -rf "${ctx}"
|
||||
mkdir -p "${ctx}"
|
||||
cp entrypoint.sh "${ctx}/entrypoint.sh"
|
||||
cp -R bootstrap "${ctx}/bootstrap"
|
||||
cat > "${ctx}/Dockerfile" <<'EOF'
|
||||
FROM ubuntu:26.04
|
||||
|
||||
RUN set -eux; \
|
||||
export DEBIAN_FRONTEND=noninteractive; \
|
||||
apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
jq \
|
||||
tzdata \
|
||||
coreutils; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN set -eux; \
|
||||
groupadd -g 10001 rustfs; \
|
||||
useradd -u 10001 -g rustfs -M -s /usr/sbin/nologin rustfs; \
|
||||
mkdir -p /data/.rustfs/events /data/.rustfs/audit /logs /opt/rustfs /app; \
|
||||
ln -s /data/.rustfs/events /opt/rustfs/events; \
|
||||
ln -s /data/.rustfs/audit /opt/rustfs/audit; \
|
||||
chown -R rustfs:rustfs /data /logs /app; \
|
||||
chmod 0750 /data /logs
|
||||
|
||||
WORKDIR /app
|
||||
COPY entrypoint.sh /etc/rustfs/entrypoint.sh
|
||||
COPY bootstrap/ /etc/rustfs/bootstrap/
|
||||
RUN chmod +x /etc/rustfs/entrypoint.sh && \
|
||||
ln -s /etc/rustfs/entrypoint.sh /entrypoint.sh
|
||||
|
||||
ENV RUSTFS_VOLUMES="/data" \
|
||||
RUST_LOG="warn" \
|
||||
RUSTFS_USERNAME="rustfs" \
|
||||
RUSTFS_GROUPNAME="rustfs" \
|
||||
RUSTFS_UID="10001" \
|
||||
RUSTFS_GID="10001"
|
||||
|
||||
EXPOSE 9000
|
||||
VOLUME ["/data"]
|
||||
|
||||
ENTRYPOINT ["/etc/rustfs/entrypoint.sh"]
|
||||
CMD ["/usr/bin/rustfs"]
|
||||
EOF
|
||||
docker build -t rustfs-mint-runtime "${ctx}"
|
||||
- name: Load the image
|
||||
run: docker load --input "${RUNNER_TEMP}/rustfs-ci.tar"
|
||||
|
||||
- name: Start RustFS
|
||||
env:
|
||||
REFERENCE_PATH: ${{ steps.reference.outputs.path }}
|
||||
CANDIDATE_PATH: ${{ runner.temp }}/candidate/rustfs
|
||||
run: |
|
||||
set -euo pipefail
|
||||
docker network inspect rustfs-net >/dev/null 2>&1 || docker network create rustfs-net
|
||||
docker rm -f rustfs-mint >/dev/null 2>&1 || true
|
||||
rm -rf /tmp/rustfs-mint
|
||||
mkdir -p /tmp/rustfs-mint
|
||||
case "${LEG}" in
|
||||
legacy) binary_path="${REFERENCE_PATH}" ;;
|
||||
gateway) binary_path="${CANDIDATE_PATH}" ;;
|
||||
*) echo "unknown mint leg: ${LEG}" >&2; exit 1 ;;
|
||||
esac
|
||||
test -f "${binary_path}"
|
||||
chmod 0755 "${binary_path}"
|
||||
test -x "${binary_path}"
|
||||
# The four disks share one physical device on the runner (a single
|
||||
# loopback filesystem), so the local physical-disk-independence guard
|
||||
# would refuse to start. Bypass it — this is the CI use case the guard
|
||||
@@ -272,69 +181,32 @@ jobs:
|
||||
-e RUSTFS_UNSAFE_BYPASS_DISK_CHECK=true \
|
||||
-e RUST_LOG=rustfs=info \
|
||||
-v /tmp/rustfs-mint:/data \
|
||||
-v "${binary_path}:/usr/bin/rustfs:ro" \
|
||||
rustfs-mint-runtime
|
||||
rustfs-ci
|
||||
|
||||
- name: Wait for RustFS ready
|
||||
run: |
|
||||
export no_proxy="${NO_PROXY}"
|
||||
for _ in {1..60}; do
|
||||
if curl -sf http://127.0.0.1:9000/health/ready >/dev/null 2>&1; then
|
||||
echo "RustFS (${LEG}) is ready"
|
||||
echo "RustFS is ready"
|
||||
exit 0
|
||||
fi
|
||||
if [ "$(docker inspect -f '{{.State.Running}}' rustfs-mint 2>/dev/null)" != "true" ]; then
|
||||
echo "RustFS (${LEG}) container not running" >&2
|
||||
echo "RustFS container not running" >&2
|
||||
docker logs rustfs-mint || true
|
||||
exit 1
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
echo "Health check timed out (${LEG})" >&2
|
||||
echo "Health check timed out" >&2
|
||||
docker logs rustfs-mint || true
|
||||
exit 1
|
||||
|
||||
- name: Record server provenance
|
||||
env:
|
||||
REFERENCE_VERSION: ${{ steps.reference.outputs.version }}
|
||||
REFERENCE_SHA256: ${{ steps.reference.outputs.executable-sha256 }}
|
||||
CANDIDATE_RECEIPT: ${{ runner.temp }}/candidate/rustfs.e2e.json
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p artifacts
|
||||
actual_sha256="$(docker exec rustfs-mint sha256sum /usr/bin/rustfs | awk '{print $1}')"
|
||||
actual_version="$(docker exec rustfs-mint /usr/bin/rustfs --version | tr '\n' ' ' | sed 's/[[:space:]]*$//')"
|
||||
if [[ "${LEG}" == "legacy" ]]; then
|
||||
expected_sha256="${REFERENCE_SHA256}"
|
||||
else
|
||||
expected_sha256="$(python3 -c 'import json, sys; print(json.load(open(sys.argv[1], encoding="utf-8"))["binary_sha256"])' "${CANDIDATE_RECEIPT}")"
|
||||
fi
|
||||
if [[ "${actual_sha256}" != "${expected_sha256}" ]]; then
|
||||
echo "::error::${LEG} container /usr/bin/rustfs sha256 (${actual_sha256}) != verified binary (${expected_sha256})" >&2
|
||||
exit 1
|
||||
fi
|
||||
ACTUAL_SHA256="${actual_sha256}" EXPECTED_SHA256="${expected_sha256}" ACTUAL_VERSION="${actual_version}" python3 - <<'EOF'
|
||||
import json, os, pathlib
|
||||
|
||||
meta = {
|
||||
"leg": os.environ["LEG"],
|
||||
"binary_sha256": os.environ["ACTUAL_SHA256"],
|
||||
"expected_sha256": os.environ["EXPECTED_SHA256"],
|
||||
"version": os.environ["ACTUAL_VERSION"],
|
||||
}
|
||||
if os.environ["LEG"] == "legacy":
|
||||
meta["expected_version"] = os.environ["REFERENCE_VERSION"]
|
||||
out = pathlib.Path("artifacts/target.json")
|
||||
out.write_text(json.dumps(meta, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print(out.read_text(encoding="utf-8"))
|
||||
EOF
|
||||
|
||||
- name: Run mint
|
||||
run: |
|
||||
mkdir -p artifacts/mint-log
|
||||
# Mint exits non-zero when any SDK test fails; individual failures are
|
||||
# comparison data for the fail-closed diff-table gate in `compare`.
|
||||
# Capture the exit code and verify log.json exists in the next step.
|
||||
# Mint exits non-zero when any test fails; that is inventory here,
|
||||
# not a gate (see header comment). Capture the exit code and let the
|
||||
# summary step decide.
|
||||
set +e
|
||||
# shellcheck disable=SC2086 # MINT_SUITES is intentionally word-split
|
||||
docker run --rm --network rustfs-net \
|
||||
@@ -346,42 +218,36 @@ jobs:
|
||||
-e MINT_MODE=${MINT_MODE} \
|
||||
-v "${PWD}/artifacts/mint-log:/mint/log" \
|
||||
"${MINT_IMAGE}" ${MINT_SUITES}
|
||||
rc=$?
|
||||
echo "MINT_RC=${rc}" >> "$GITHUB_ENV"
|
||||
echo "${rc}" > artifacts/mint-exit-code.txt
|
||||
echo "MINT_RC=$?" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Summarize leg results
|
||||
- name: Summarize results
|
||||
run: |
|
||||
python3 - <<'EOF'
|
||||
import json, os, pathlib, sys
|
||||
from collections import Counter
|
||||
|
||||
leg = os.environ["LEG"]
|
||||
log = pathlib.Path("artifacts/mint-log/log.json")
|
||||
if not log.is_file():
|
||||
print(f"mint ({leg}) produced no log.json - infrastructure failure", file=sys.stderr)
|
||||
print("mint produced no log.json - infrastructure failure", file=sys.stderr)
|
||||
sys.exit(int(os.environ.get("MINT_RC", "1")) or 1)
|
||||
|
||||
per_suite: dict[str, Counter] = {}
|
||||
failures: list[tuple[str, str, str]] = []
|
||||
entries = 0
|
||||
for line in log.read_text(encoding="utf-8").splitlines():
|
||||
line = line.strip()
|
||||
if not line or not line.startswith("{"):
|
||||
if not line:
|
||||
continue
|
||||
try:
|
||||
entry = json.loads(line)
|
||||
except json.JSONDecodeError:
|
||||
continue
|
||||
entry = json.loads(line)
|
||||
entries += 1
|
||||
suite = entry.get("name", "unknown")
|
||||
status = str(entry.get("status", "unknown")).upper()
|
||||
status = entry.get("status", "unknown").upper()
|
||||
per_suite.setdefault(suite, Counter())[status] += 1
|
||||
if status == "FAIL":
|
||||
failures.append((suite, entry.get("function") or "", entry.get("error") or entry.get("message") or ""))
|
||||
failures.append((suite, entry.get("function", ""), entry.get("error") or entry.get("message") or ""))
|
||||
|
||||
if entries == 0:
|
||||
print(f"mint ({leg}) wrote zero JSON test entries - infrastructure failure", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
lines = [f"# Mint results ({leg})", "", "| Suite | Pass | Fail | N/A |", "|-------|------|------|-----|"]
|
||||
lines = ["# Mint results", "", "| Suite | Pass | Fail | N/A |", "|-------|------|------|-----|"]
|
||||
for suite in sorted(per_suite):
|
||||
c = per_suite[suite]
|
||||
lines.append(f"| {suite} | {c.get('PASS', 0)} | {c.get('FAIL', 0)} | {c.get('NA', 0)} |")
|
||||
@@ -393,6 +259,7 @@ jobs:
|
||||
first = err.strip().splitlines()[0] if err.strip() else ""
|
||||
lines.append(f"- `{suite}` / `{func}` {first}")
|
||||
lines.append("")
|
||||
lines.append("_Report-only: failures are inventory, not a gate (see workflow header)._")
|
||||
|
||||
report = "\n".join(lines)
|
||||
print(report)
|
||||
@@ -408,70 +275,16 @@ jobs:
|
||||
mkdir -p artifacts/rustfs-mint
|
||||
docker logs rustfs-mint > artifacts/rustfs-mint/rustfs.log 2>&1 || true
|
||||
|
||||
- name: Upload leg artifacts
|
||||
- name: Upload artifacts
|
||||
if: always() && env.ACT != 'true'
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: mint-leg-${{ matrix.leg }}
|
||||
overwrite: true
|
||||
name: mint
|
||||
path: artifacts/**
|
||||
if-no-files-found: error
|
||||
retention-days: 14
|
||||
|
||||
compare:
|
||||
name: Compare legacy vs gateway
|
||||
needs: [build-candidate, mint]
|
||||
if: always() && needs.build-candidate.result == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Download leg artifacts
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
pattern: mint-leg-*
|
||||
path: mint-download
|
||||
|
||||
- name: Compare mint results (fail-closed diff-table gate)
|
||||
env:
|
||||
MINT_JOB_RESULT: ${{ needs.mint.result }}
|
||||
run: |
|
||||
set -uo pipefail
|
||||
mkdir -p mint-diff
|
||||
python3 scripts/mint_stack_diff.py \
|
||||
mint-download/mint-leg-legacy \
|
||||
mint-download/mint-leg-gateway \
|
||||
--require-meta \
|
||||
--markdown mint-diff/diff.md \
|
||||
--json mint-diff/diff.json
|
||||
status=$?
|
||||
if [[ -f mint-diff/diff.md ]]; then
|
||||
cat mint-diff/diff.md >> "$GITHUB_STEP_SUMMARY"
|
||||
fi
|
||||
if [[ "${MINT_JOB_RESULT}" != "success" ]]; then
|
||||
echo "::error::mint leg job finished with '${MINT_JOB_RESULT}'"
|
||||
if [[ "${status}" -eq 0 ]]; then
|
||||
status=1
|
||||
fi
|
||||
fi
|
||||
exit "${status}"
|
||||
|
||||
- name: Upload diff report
|
||||
if: always() && env.ACT != 'true'
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: mint-diff
|
||||
overwrite: true
|
||||
path: mint-diff/**
|
||||
if-no-files-found: warn
|
||||
retention-days: 14
|
||||
|
||||
alert-on-failure:
|
||||
name: Alert on scheduled failure
|
||||
needs: [build-candidate, mint, compare]
|
||||
needs: [image, mint]
|
||||
# `always()` is required: without it this job is skipped when a needed
|
||||
# job fails. Alerts only for scheduled runs (backlog#1149 ci-8) — manual
|
||||
# dispatch failures are already watched by a human.
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
name: S3-over-RDMA feature check
|
||||
|
||||
# Compile the optional RDMA features independently. The cuObject tests link
|
||||
# the NVIDIA SDK and exercise the host-side behavior on a CPU runner.
|
||||
# The `nixl` and `cuobject` features are off in every other build, so the code
|
||||
# behind them is compiled nowhere else. This job compiles the `nixl` half on
|
||||
# Linux and runs rustfs-nixl's unit tests; nixl-sys builds through its stub
|
||||
# fallback, so no NIXL SDK is needed.
|
||||
# The cuObject half needs the NVIDIA cuObject SDK and is not compiled here.
|
||||
# Not a required check and not part of the `Test and Lint` aggregate.
|
||||
|
||||
on:
|
||||
@@ -9,7 +12,6 @@ on:
|
||||
paths:
|
||||
- "crates/nixl/**"
|
||||
- "crates/cuobject/**"
|
||||
- "crates/cuobject-sys/**"
|
||||
- "rustfs/src/storage/rpc/nixl*"
|
||||
- "rustfs/src/app/object/cuobject.rs"
|
||||
- "rustfs/src/app/object/get.rs"
|
||||
@@ -66,44 +68,11 @@ jobs:
|
||||
# These unit tests use a fake sysfs and plain host memory; none needs an
|
||||
# RDMA device or the NIXL libraries.
|
||||
- name: Run the rustfs-nixl unit tests
|
||||
run: cargo test --locked -p rustfs-nixl --features client-http
|
||||
|
||||
cuobject-check:
|
||||
name: cuObject server SDK and unit tests
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: ./.github/actions/setup
|
||||
with:
|
||||
rust-version: stable
|
||||
cache-shared-key: ci-feat-cuobject
|
||||
cache-save-if: 'false'
|
||||
install-build-packaging-tools: 'false'
|
||||
- name: Check the cuObject crates without the NVIDIA SDK
|
||||
run: cargo check --locked -p rustfs-cuobject -p rustfs-cuobject-sys
|
||||
- name: Install the NVIDIA server SDK
|
||||
working-directory: ${{ runner.temp }}
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install --no-install-recommends -y libibverbs-dev librdmacm-dev
|
||||
repo=https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64
|
||||
for pkg in libcuobjserver libcuobjserver-dev; do
|
||||
curl --fail --location --retry 3 "$repo/${pkg}_2.1.0.101-1_amd64.deb" -o "$pkg.deb"
|
||||
done
|
||||
sha256sum --check <<'DIGESTS'
|
||||
39e6271118717e8e726233ae5ac29ee3b83e335e1fbe96b097bb458a4a52393a libcuobjserver.deb
|
||||
73d4f187e58b784c7cf64633d7e76c2ac59dea5b475fd981cc6897c34cb9876f libcuobjserver-dev.deb
|
||||
DIGESTS
|
||||
sudo dpkg -i libcuobjserver.deb libcuobjserver-dev.deb
|
||||
- name: Test the server bridge
|
||||
run: cargo test --locked -p rustfs-cuobject --features server
|
||||
run: cargo test --locked -p rustfs-nixl --features sys
|
||||
|
||||
alert-on-failure:
|
||||
name: Alert on scheduled failure
|
||||
needs: [nixl-check, cuobject-check]
|
||||
needs: [nixl-check]
|
||||
# Only scheduled runs open or update the tracking issue; pull-request and
|
||||
# manual runs stay quiet.
|
||||
if: always() && github.event_name == 'schedule' && contains(needs.*.result, 'failure')
|
||||
|
||||
@@ -56,7 +56,6 @@ on:
|
||||
- "scripts/s3-tests/reference_parity.py"
|
||||
- "scripts/junit_diff.py"
|
||||
- "crates/e2e_test/src/dual_stack_differential/**"
|
||||
- "crates/gateway-adapter/tests/fixtures/observability-contract.json"
|
||||
schedule:
|
||||
- cron: "37 1 * * *"
|
||||
workflow_dispatch:
|
||||
@@ -390,24 +389,6 @@ jobs:
|
||||
echo "::error::the dual-stack differential failed; see the job summary for every (op, field, a, b)"
|
||||
exit 1
|
||||
|
||||
- name: Verify observability and middleware on the pinned reference and candidate
|
||||
if: ${{ !cancelled() && (steps.differential.outcome == 'success' || steps.differential.outcome == 'failure') }}
|
||||
env:
|
||||
RUSTFS_E2E_REFERENCE_BINARY: ${{ steps.reference.outputs.path }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
export no_proxy="$NO_PROXY"
|
||||
test -x "$RUSTFS_E2E_REFERENCE_BINARY"
|
||||
failed=0
|
||||
for contract in observability middleware; do
|
||||
for side in reference current; do
|
||||
name="dual_stack_differential::${contract}_contract::${side}_${contract}_contract"
|
||||
python3 scripts/e2e_binary.py run --features e2e-test-hooks -- \
|
||||
cargo nextest run --locked -p e2e_test --lib --no-tests fail -E "test(=$name)" || failed=1
|
||||
done
|
||||
done
|
||||
exit "$failed"
|
||||
|
||||
compare:
|
||||
name: Compare targets
|
||||
needs: [ plan, s3tests ]
|
||||
|
||||
@@ -80,18 +80,6 @@ Do not commit one-shot plans, trackers, migration ledgers, benchmark snapshots,
|
||||
|
||||
Select checks from the final task-owned diff. Scoped `AGENTS.md` files may add a concrete path-specific check, but must not replace this tiering with a generic full-workspace gate.
|
||||
|
||||
### Issue Fixes and External Regression Coverage
|
||||
|
||||
After fixing a bug tracked by an issue and running the applicable local checks, ask the developer once per fixed issue whether to cover it in [rustfs/auto-testing](https://github.com/rustfs/auto-testing). Ask before opening or updating the fix PR, or before reporting completion if there is no PR. Reuse a choice already made for that fix. Investigation alone and documentation-only changes do not trigger this prompt.
|
||||
|
||||
When presenting the three choices, describe the failing scenario and the assertion that would catch it.
|
||||
|
||||
- **Add or extend a case.** Prefer extending an existing scenario when it can exercise the regression. Record the resulting case ID or auto-testing PR link.
|
||||
- **Already covered.** Cite the existing auto-testing case ID or path and the assertion that would catch this bug.
|
||||
- **Skip.** Record the developer's one-line reason and continue with the fix.
|
||||
|
||||
Record the choice in the PR's Verification section or in the completion report for work without a PR. All three choices retain the applicable RustFS verification requirements below.
|
||||
|
||||
### Documentation and Instructions
|
||||
|
||||
For prose, comments, agent instructions, and skill metadata that cannot affect runtime/build output:
|
||||
|
||||
@@ -46,8 +46,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
### Fixed
|
||||
|
||||
- **SSE-C multipart and copy responses no longer carry `x-amz-server-side-encryption`**: `CreateMultipartUpload`, `UploadPart`, `UploadPartCopy` and `CompleteMultipartUpload` on an SSE-C upload, and `CopyObject` to an SSE-C destination, answered with `x-amz-server-side-encryption: AES256` next to the customer-key headers, so a client reading the response saw an SSE-S3 object. They now return only `x-amz-server-side-encryption-customer-algorithm` and `x-amz-server-side-encryption-customer-key-MD5`, as `PutObject`, `GetObject` and `HeadObject` already did. SSE-S3 and SSE-KMS responses are unchanged.
|
||||
|
||||
- **Vault KMS backends no longer fail when the server answers reads from a replica**: a Vault or OpenBao node that serves reads locally (an OpenBao standby, a Vault Enterprise performance standby) can return the state from before a write for a short while after acknowledging it. Against such a node the KV2 backend failed every key creation with `404 Key not found` while leaving the key stored without its description and tags, failed operations issued right after a create or update with `Key not found` or `Concurrent modification`, and the Transit backend failed a disable followed quickly by an enable. Key creation on the KV2 backend is now a single create-only write that carries the description and tags. Both backends now re-read a key record when the answer is older than a write the same RustFS node made in the previous five seconds, pause before re-reading after a lost check-and-set write and allow five attempts instead of three, and retry a Transit key delete that is refused because the deletion switch is not visible yet. A different RustFS node reading the same replica can still observe the earlier state until the replica catches up; see [OpenBao as the Vault KMS backend](docs/operations/kms-openbao-compatibility.md).
|
||||
|
||||
- **KMS keys could not be described by ARN through the path route**: `GET /rustfs/admin/v3/kms/keys/{key_id}` read the path segment verbatim, so a key id that has to be percent-encoded to fit in one segment — an AWS key ARN, with its `:` and `/` — was looked up, authorized and audited under its encoded spelling and answered `404`. The segment is now percent-decoded first; a segment that is not valid UTF-8 after decoding is refused with `400 InvalidArgument`. The `describe-key?keyId=` form was unaffected.
|
||||
@@ -118,7 +116,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Four-layer regression-prevention tests guard against silent feature deletion: compile-time module assertion, module-presence unit test, cross-module `Protocol` enum assertion, end-to-end SSH banner test against the running binary
|
||||
|
||||
### Changed
|
||||
- **Startup reports the state of `RUSTFS_SSE_S3_MASTER_KEY`**: the server now checks the local SSE-S3 master key when it starts and logs one `sse_local_master_key` event with `state` `loaded`, `not_set`, or `invalid`. An unusable value used to surface only as a `400 InvalidRequest` on the first SSE-S3 request served without a KMS; it is now logged as an error at startup with the reason. Startup still succeeds and request behavior is unchanged. The line "Using RUSTFS_SSE_S3_MASTER_KEY for SSE-S3 (KMS not configured)", logged when the key was first used, is replaced by this event.
|
||||
- **Scanner bucket walkers are no longer tied to the disk count**: a new scanner key `walkers_per_disk` (`RUSTFS_SCANNER_WALKERS_PER_DISK`, `1` through `16`, default `1`) spawns that many bucket walkers per local disk of an erasure set, so a single-disk deployment can walk several buckets at once instead of one bucket, one object at a time. The walkers of one disk share its scanner admission, so a peer still sees one scan session per physical disk, and remote disks keep one walker. The walker count is what `max_concurrent_disk_scans` caps and the disk count stays the floor; the `disk_concurrency_budget` log line now reports `walkers_per_disk`, `walkers`, and the `reason` for the effective limit. The default keeps today's I/O profile because a local disk cannot yet report whether it is rotational; the design intends a higher default on flash once it can (`docs/architecture/scanner-per-bucket-convergence.md`). As groundwork for pacing, the raw-enumeration page writer inserts into its building page in place and commits pages without copying them, and a regression test pins the cost of recording 20,000 entries in one prefix so the quadratic bookkeeping removed by [#8114](https://github.com/rustfs/rustfs/pull/8114) (rustfs#8113) cannot return. No persisted format, protocol or admin API changes beyond the additional config key, which older releases preserve and ignore.
|
||||
- **Encryption and KMS work merged since `1.0.0-rc.5`** (entries were missing from this section):
|
||||
- **Persisted KMS configuration secrets** are sealed field-by-field with `RUSTFS_KMS_CONFIG_SECRET`. **When the variable is unset the secrets are persisted in cleartext and the server only warns** (`persisted KMS configuration carries cleartext secrets`); it never refuses the write. Set it, identically, on every node, and re-save the configuration to seal an existing one.
|
||||
|
||||
Generated
+59
-211
@@ -1654,7 +1654,7 @@ dependencies = [
|
||||
"regex",
|
||||
"rustc-hash",
|
||||
"shlex 2.0.1",
|
||||
"syn 3.0.10",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2322,17 +2322,6 @@ dependencies = [
|
||||
"x509-cert",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "codespan-reporting"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"termcolor",
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.5"
|
||||
@@ -2811,6 +2800,27 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cuobject"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "486fec9045f8057131bf4bba71fbb87bf9dd3e44f853622cf7fa42713f3a108c"
|
||||
dependencies = [
|
||||
"cuobject-sys",
|
||||
"memmap2",
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cuobject-sys"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "edc615b2a037eb0d80180d202f809629155742db9c9e94b9f7696b1100a7d52f"
|
||||
dependencies = [
|
||||
"bindgen 0.73.2",
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "curve25519-dalek"
|
||||
version = "4.1.3"
|
||||
@@ -2854,68 +2864,6 @@ dependencies = [
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cxx"
|
||||
version = "1.0.205"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8a02bfeba9074b2bbb39492c9b0908ec854f455a3cccdcde7a1de55e2315e40"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"cxx-build",
|
||||
"cxxbridge-cmd",
|
||||
"cxxbridge-flags",
|
||||
"cxxbridge-macro",
|
||||
"foldhash 0.2.0",
|
||||
"link-cplusplus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cxx-build"
|
||||
version = "1.0.205"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbc2ac76997619d2d888b58ad79488f1c835de41ca4dd3dd7082acf4ecb0a50f"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"codespan-reporting",
|
||||
"indexmap 2.14.2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"scratch",
|
||||
"syn 3.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cxxbridge-cmd"
|
||||
version = "1.0.205"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "54a486ed16a3f2a053fe7f5b98db4c1a59846a23e8cb9e49f9d1bd48830d51a2"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"codespan-reporting",
|
||||
"indexmap 2.14.2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cxxbridge-flags"
|
||||
version = "1.0.205"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c72569be94e2283764d334cd285980b747dbe221e27e315484eb6bcd93fa808a"
|
||||
|
||||
[[package]]
|
||||
name = "cxxbridge-macro"
|
||||
version = "1.0.205"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "423e795284a7f7b3f843c956a5322c4bc497b60c2dd1a6339da10313cb18d575"
|
||||
dependencies = [
|
||||
"indexmap 2.14.2",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.11"
|
||||
@@ -4268,7 +4216,7 @@ dependencies = [
|
||||
"prost 0.14.6",
|
||||
"rand 0.10.4",
|
||||
"rcgen",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rmp-serde",
|
||||
"russh",
|
||||
"russh-sftp",
|
||||
@@ -4277,9 +4225,6 @@ dependencies = [
|
||||
"rustfs-data-usage",
|
||||
"rustfs-ecstore",
|
||||
"rustfs-filemeta",
|
||||
"rustfs-gateway",
|
||||
"rustfs-gateway-stream",
|
||||
"rustfs-gateway-types",
|
||||
"rustfs-heal",
|
||||
"rustfs-lock",
|
||||
"rustfs-madmin",
|
||||
@@ -4291,7 +4236,6 @@ dependencies = [
|
||||
"rustfs-utils",
|
||||
"rustls",
|
||||
"s3s",
|
||||
"s3s-sigv4",
|
||||
"same-file",
|
||||
"serde",
|
||||
"serde-value",
|
||||
@@ -4307,7 +4251,6 @@ dependencies = [
|
||||
"tonic",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"url",
|
||||
"urlencoding",
|
||||
"uuid",
|
||||
"walkdir",
|
||||
@@ -4966,7 +4909,7 @@ dependencies = [
|
||||
"http 1.5.0",
|
||||
"jiff 0.2.46",
|
||||
"jsonwebtoken 11.1.0",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rustc_version",
|
||||
"rustls",
|
||||
"rustls-pki-types",
|
||||
@@ -5025,7 +4968,7 @@ dependencies = [
|
||||
"pin-project",
|
||||
"prost 0.14.6",
|
||||
"prost-types 0.14.6",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rustc_version",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -5511,7 +5454,7 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
"quanta",
|
||||
"regex-lite",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"reqwest-middleware",
|
||||
"rustc-demangle",
|
||||
"serde",
|
||||
@@ -6481,15 +6424,6 @@ dependencies = [
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "link-cplusplus"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f78c730aaa7d0b9336a299029ea49f9ee53b0ed06e9202e8cb7db9bae7b8c82"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.12.1"
|
||||
@@ -7731,7 +7665,7 @@ dependencies = [
|
||||
"bytes",
|
||||
"http 1.5.0",
|
||||
"opentelemetry",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -7748,7 +7682,7 @@ dependencies = [
|
||||
"opentelemetry-proto",
|
||||
"opentelemetry_sdk",
|
||||
"prost 0.14.6",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
|
||||
@@ -8926,7 +8860,7 @@ dependencies = [
|
||||
"object 0.40.0",
|
||||
"once_cell",
|
||||
"prost 0.14.6",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"ruzstd",
|
||||
"serde_json",
|
||||
"smallvec",
|
||||
@@ -9483,7 +9417,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"rustix",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -9521,38 +9455,6 @@ version = "0.8.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d902046e6a28a1e4c3cab97258a0ce11e994903f01c2d97a9447a0b3df85f4f6"
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.12.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bytes",
|
||||
"futures-core",
|
||||
"http 1.5.0",
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"js-sys",
|
||||
"log",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_urlencoded",
|
||||
"sync_wrapper",
|
||||
"tokio",
|
||||
"tower",
|
||||
"tower-http 0.6.11",
|
||||
"tower-service",
|
||||
"url",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reqwest"
|
||||
version = "0.13.5"
|
||||
@@ -9608,7 +9510,7 @@ dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"http 1.5.0",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"thiserror 2.0.21",
|
||||
"tower-service",
|
||||
@@ -10005,7 +9907,7 @@ dependencies = [
|
||||
"rand 0.10.4",
|
||||
"rcgen",
|
||||
"regex",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rmp-serde",
|
||||
"rsa 0.10.0",
|
||||
"rust-embed",
|
||||
@@ -10023,9 +9925,7 @@ dependencies = [
|
||||
"rustfs-gateway",
|
||||
"rustfs-gateway-adapter",
|
||||
"rustfs-gateway-core",
|
||||
"rustfs-gateway-corpus-recorder",
|
||||
"rustfs-gateway-dialect-rustfs-admin",
|
||||
"rustfs-gateway-http",
|
||||
"rustfs-gateway-stream",
|
||||
"rustfs-gateway-types",
|
||||
"rustfs-heal",
|
||||
@@ -10230,21 +10130,12 @@ name = "rustfs-cuobject"
|
||||
version = "1.0.5"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"cuobject",
|
||||
"parking_lot 0.13.0",
|
||||
"rustfs-cuobject-sys",
|
||||
"thiserror 2.0.21",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustfs-cuobject-sys"
|
||||
version = "1.0.5"
|
||||
dependencies = [
|
||||
"cxx",
|
||||
"cxx-build",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustfs-data-usage"
|
||||
version = "1.0.5"
|
||||
@@ -10313,7 +10204,7 @@ dependencies = [
|
||||
"rcgen",
|
||||
"reed-solomon-simd",
|
||||
"regex",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rmp",
|
||||
"rmp-serde",
|
||||
"rustfs-common",
|
||||
@@ -10433,8 +10324,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustfs-gateway"
|
||||
version = "0.67.0"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=095d4763a3f58a5e1d22fe7a231bf1c105473de8#095d4763a3f58a5e1d22fe7a231bf1c105473de8"
|
||||
version = "0.66.0"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=60dcd2a55713dbcc9dbd6e165922e1a0df4473d7#60dcd2a55713dbcc9dbd6e165922e1a0df4473d7"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"bytes",
|
||||
@@ -10480,8 +10371,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustfs-gateway-core"
|
||||
version = "0.64.0"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=095d4763a3f58a5e1d22fe7a231bf1c105473de8#095d4763a3f58a5e1d22fe7a231bf1c105473de8"
|
||||
version = "0.63.0"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=60dcd2a55713dbcc9dbd6e165922e1a0df4473d7#60dcd2a55713dbcc9dbd6e165922e1a0df4473d7"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-core",
|
||||
@@ -10499,35 +10390,10 @@ dependencies = [
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustfs-gateway-corpus"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=095d4763a3f58a5e1d22fe7a231bf1c105473de8#095d4763a3f58a5e1d22fe7a231bf1c105473de8"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2 0.11.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustfs-gateway-corpus-recorder"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=095d4763a3f58a5e1d22fe7a231bf1c105473de8#095d4763a3f58a5e1d22fe7a231bf1c105473de8"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http 1.5.0",
|
||||
"http-body",
|
||||
"pin-project-lite",
|
||||
"rustfs-gateway",
|
||||
"rustfs-gateway-core",
|
||||
"rustfs-gateway-corpus",
|
||||
"tower",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustfs-gateway-dialect-rustfs-admin"
|
||||
version = "0.13.0"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=095d4763a3f58a5e1d22fe7a231bf1c105473de8#095d4763a3f58a5e1d22fe7a231bf1c105473de8"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=60dcd2a55713dbcc9dbd6e165922e1a0df4473d7#60dcd2a55713dbcc9dbd6e165922e1a0df4473d7"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"form_urlencoded",
|
||||
@@ -10541,7 +10407,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rustfs-gateway-http"
|
||||
version = "0.1.4"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=095d4763a3f58a5e1d22fe7a231bf1c105473de8#095d4763a3f58a5e1d22fe7a231bf1c105473de8"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=60dcd2a55713dbcc9dbd6e165922e1a0df4473d7#60dcd2a55713dbcc9dbd6e165922e1a0df4473d7"
|
||||
dependencies = [
|
||||
"hmac 0.13.0",
|
||||
"http 1.5.0",
|
||||
@@ -10559,7 +10425,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rustfs-gateway-macros"
|
||||
version = "0.1.4"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=095d4763a3f58a5e1d22fe7a231bf1c105473de8#095d4763a3f58a5e1d22fe7a231bf1c105473de8"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=60dcd2a55713dbcc9dbd6e165922e1a0df4473d7#60dcd2a55713dbcc9dbd6e165922e1a0df4473d7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -10568,8 +10434,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustfs-gateway-sig"
|
||||
version = "0.16.0"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=095d4763a3f58a5e1d22fe7a231bf1c105473de8#095d4763a3f58a5e1d22fe7a231bf1c105473de8"
|
||||
version = "0.15.0"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=60dcd2a55713dbcc9dbd6e165922e1a0df4473d7#60dcd2a55713dbcc9dbd6e165922e1a0df4473d7"
|
||||
dependencies = [
|
||||
"hmac 0.13.0",
|
||||
"http 1.5.0",
|
||||
@@ -10584,7 +10450,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rustfs-gateway-stream"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=095d4763a3f58a5e1d22fe7a231bf1c105473de8#095d4763a3f58a5e1d22fe7a231bf1c105473de8"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=60dcd2a55713dbcc9dbd6e165922e1a0df4473d7#60dcd2a55713dbcc9dbd6e165922e1a0df4473d7"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"bytes",
|
||||
@@ -10595,7 +10461,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rustfs-gateway-types"
|
||||
version = "0.42.0+aws.2026-10-02"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=095d4763a3f58a5e1d22fe7a231bf1c105473de8#095d4763a3f58a5e1d22fe7a231bf1c105473de8"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=60dcd2a55713dbcc9dbd6e165922e1a0df4473d7#60dcd2a55713dbcc9dbd6e165922e1a0df4473d7"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"crc-fast",
|
||||
@@ -10606,6 +10472,7 @@ dependencies = [
|
||||
"percent-encoding",
|
||||
"rustfs-gateway-stream",
|
||||
"rustfs-gateway-xml",
|
||||
"s3s",
|
||||
"sha1 0.11.0",
|
||||
"sha2 0.11.1",
|
||||
"time",
|
||||
@@ -10617,7 +10484,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "rustfs-gateway-xml"
|
||||
version = "0.4.0"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=095d4763a3f58a5e1d22fe7a231bf1c105473de8#095d4763a3f58a5e1d22fe7a231bf1c105473de8"
|
||||
source = "git+https://github.com/rustfs/gateway.git?rev=60dcd2a55713dbcc9dbd6e165922e1a0df4473d7#60dcd2a55713dbcc9dbd6e165922e1a0df4473d7"
|
||||
dependencies = [
|
||||
"quick-xml 0.41.0",
|
||||
]
|
||||
@@ -10692,7 +10559,7 @@ dependencies = [
|
||||
"qrcode-rs",
|
||||
"rand 0.10.4",
|
||||
"rcgen",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rustfs-config",
|
||||
"rustfs-credentials",
|
||||
"rustfs-crypto",
|
||||
@@ -10809,7 +10676,7 @@ dependencies = [
|
||||
"http-body",
|
||||
"http-body-util",
|
||||
"moka",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rustfs-credentials",
|
||||
"rustfs-policy",
|
||||
"rustfs-utils",
|
||||
@@ -10851,7 +10718,7 @@ dependencies = [
|
||||
"moka",
|
||||
"rand 0.10.4",
|
||||
"rcgen",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rustfs-s3-types",
|
||||
"rustfs-security-governance",
|
||||
"rustfs-utils",
|
||||
@@ -10953,7 +10820,7 @@ dependencies = [
|
||||
"humantime",
|
||||
"hyper",
|
||||
"jiff 1.0.2",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rmp-serde",
|
||||
"rustfs-signer",
|
||||
"serde",
|
||||
@@ -10985,18 +10852,11 @@ dependencies = [
|
||||
name = "rustfs-nixl"
|
||||
version = "1.0.5"
|
||||
dependencies = [
|
||||
"aws-credential-types",
|
||||
"aws-sigv4",
|
||||
"base64-simd",
|
||||
"bytes",
|
||||
"libc",
|
||||
"memmap2",
|
||||
"nixl-sys",
|
||||
"parking_lot 0.13.0",
|
||||
"quick-xml 0.42.0",
|
||||
"reqwest 0.12.28",
|
||||
"rustix",
|
||||
"serde",
|
||||
"thiserror 2.0.21",
|
||||
"tokio",
|
||||
"tracing",
|
||||
@@ -11035,7 +10895,6 @@ dependencies = [
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"url",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -11101,7 +10960,7 @@ dependencies = [
|
||||
"percent-encoding",
|
||||
"pyroscope",
|
||||
"rcgen",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rustfs-audit",
|
||||
"rustfs-common",
|
||||
"rustfs-config",
|
||||
@@ -11149,7 +11008,7 @@ dependencies = [
|
||||
"pollster",
|
||||
"proptest",
|
||||
"regex",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rustfs-config",
|
||||
"rustfs-credentials",
|
||||
"rustfs-crypto",
|
||||
@@ -11303,7 +11162,7 @@ dependencies = [
|
||||
"proptest",
|
||||
"rand 0.10.4",
|
||||
"rcgen",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rustfs-config",
|
||||
"rustfs-io-metrics",
|
||||
"rustfs-tls-runtime",
|
||||
@@ -11409,7 +11268,6 @@ dependencies = [
|
||||
"hyper",
|
||||
"hyper-util",
|
||||
"pin-project-lite",
|
||||
"quick-xml 0.42.0",
|
||||
"s3s",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -11516,8 +11374,6 @@ dependencies = [
|
||||
"rustfs-storage-api",
|
||||
"rustfs-test-utils",
|
||||
"rustfs-utils",
|
||||
"rustix",
|
||||
"same-file",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serial_test",
|
||||
@@ -11531,7 +11387,6 @@ dependencies = [
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"uuid",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -11641,7 +11496,7 @@ dependencies = [
|
||||
"rcgen",
|
||||
"redis",
|
||||
"regex",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rumqttc-next",
|
||||
"rustfs-config",
|
||||
"rustfs-extension-schema",
|
||||
@@ -11736,7 +11591,7 @@ dependencies = [
|
||||
"metrics",
|
||||
"moka",
|
||||
"regex",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rustfs-config",
|
||||
"rustfs-utils",
|
||||
"serde",
|
||||
@@ -11785,7 +11640,7 @@ dependencies = [
|
||||
"netif",
|
||||
"proptest",
|
||||
"regex",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rustix",
|
||||
"serde",
|
||||
"sha1 0.11.0",
|
||||
@@ -11808,7 +11663,6 @@ version = "1.0.5"
|
||||
dependencies = [
|
||||
"async-compression",
|
||||
"futures",
|
||||
"liblzma",
|
||||
"rustfs-rio",
|
||||
"rustfs-tokio-tar",
|
||||
"serde",
|
||||
@@ -11839,7 +11693,7 @@ dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
"http 1.5.0",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rustify_derive",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@@ -12194,12 +12048,6 @@ version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "scratch"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d68f2ec51b097e4c1a75b681a8bec621909b5e91f15bb7b840c4f2f7b01148b2"
|
||||
|
||||
[[package]]
|
||||
name = "scrypt"
|
||||
version = "0.11.0"
|
||||
@@ -14124,7 +13972,7 @@ dependencies = [
|
||||
"async-trait",
|
||||
"derive_builder",
|
||||
"http 1.5.0",
|
||||
"reqwest 0.13.5",
|
||||
"reqwest",
|
||||
"rustify",
|
||||
"rustify_derive",
|
||||
"serde",
|
||||
|
||||
+17
-12
@@ -23,7 +23,6 @@ members = [
|
||||
"crates/connect-symbol-catalog", # Release-only CPU profile symbol catalog generator
|
||||
"crates/credentials", # Credential management system
|
||||
"crates/crypto", # Cryptography and security features
|
||||
"crates/cuobject-sys", # Native NVIDIA cuObject server SDK bindings
|
||||
"crates/cuobject", # NVIDIA cuObject S3-over-RDMA staging and transfers (optional)
|
||||
"crates/nixl", # NIXL/UCX S3-over-RDMA server side (optional)
|
||||
"crates/ecstore", # Erasure coding storage implementation
|
||||
@@ -110,7 +109,6 @@ rustfs-concurrency = { path = "./crates/concurrency", version = "1.0.5" }
|
||||
rustfs-credentials = { path = "crates/credentials", version = "1.0.5" }
|
||||
rustfs-crypto = { path = "crates/crypto", version = "1.0.5" }
|
||||
rustfs-cuobject = { path = "crates/cuobject", version = "1.0.5" }
|
||||
rustfs-cuobject-sys = { path = "crates/cuobject-sys", version = "1.0.5" }
|
||||
rustfs-nixl = { path = "crates/nixl", version = "1.0.5" }
|
||||
rustfs-ecstore = { path = "crates/ecstore", version = "1.0.5" }
|
||||
rustfs-filemeta = { path = "crates/filemeta", version = "1.0.5" }
|
||||
@@ -152,18 +150,20 @@ rustfs-tls-runtime = { path = "crates/tls-runtime", version = "1.0.5" }
|
||||
rustfs-utils = { path = "crates/utils", version = "1.0.5" }
|
||||
rustfs-zip = { path = "./crates/zip", version = "1.0.5" }
|
||||
|
||||
# Pin the gateway and its protocol crates to the same revision.
|
||||
rustfs-gateway-types = { git = "https://github.com/rustfs/gateway.git", rev = "095d4763a3f58a5e1d22fe7a231bf1c105473de8", version = "0.42.0", default-features = false }
|
||||
rustfs-gateway-stream = { git = "https://github.com/rustfs/gateway.git", rev = "095d4763a3f58a5e1d22fe7a231bf1c105473de8", version = "0.2.0", default-features = false }
|
||||
# The gateway's S3 types: the DTOs and persisted bucket-configuration codecs the
|
||||
# engine crates move onto from s3s (rustfs/backlog#2745). The one pin of the
|
||||
# gateway in this workspace; no crate may enable a `compat-s3s*` feature except
|
||||
# the s3s-facing edge of the rustfs binary.
|
||||
rustfs-gateway-types = { git = "https://github.com/rustfs/gateway.git", rev = "60dcd2a55713dbcc9dbd6e165922e1a0df4473d7", version = "0.42.0", default-features = false }
|
||||
rustfs-gateway-stream = { git = "https://github.com/rustfs/gateway.git", rev = "60dcd2a55713dbcc9dbd6e165922e1a0df4473d7", version = "0.2.0", default-features = false }
|
||||
# The gateway framework itself, consumed for its extension traits by the ring-2
|
||||
# adapter. `default-features = false` keeps the `server` feature, and with it the
|
||||
# server crate, out of the build.
|
||||
rustfs-gateway = { git = "https://github.com/rustfs/gateway.git", rev = "095d4763a3f58a5e1d22fe7a231bf1c105473de8", version = "0.67.0", default-features = false }
|
||||
rustfs-gateway = { git = "https://github.com/rustfs/gateway.git", rev = "60dcd2a55713dbcc9dbd6e165922e1a0df4473d7", version = "0.66.0", default-features = false }
|
||||
# Test-only: builds the `EffectiveHost` a host-resolution test queries with.
|
||||
rustfs-gateway-http = { git = "https://github.com/rustfs/gateway.git", rev = "095d4763a3f58a5e1d22fe7a231bf1c105473de8", default-features = false }
|
||||
rustfs-gateway-core = { git = "https://github.com/rustfs/gateway.git", rev = "095d4763a3f58a5e1d22fe7a231bf1c105473de8", version = "0.64.0", default-features = false }
|
||||
rustfs-gateway-corpus-recorder = { git = "https://github.com/rustfs/gateway.git", rev = "095d4763a3f58a5e1d22fe7a231bf1c105473de8", version = "0.1.0", default-features = false }
|
||||
rustfs-gateway-dialect-rustfs-admin = { git = "https://github.com/rustfs/gateway.git", rev = "095d4763a3f58a5e1d22fe7a231bf1c105473de8", version = "0.13.0", default-features = false }
|
||||
rustfs-gateway-http = { git = "https://github.com/rustfs/gateway.git", rev = "60dcd2a55713dbcc9dbd6e165922e1a0df4473d7", default-features = false }
|
||||
rustfs-gateway-core = { git = "https://github.com/rustfs/gateway.git", rev = "60dcd2a55713dbcc9dbd6e165922e1a0df4473d7", version = "0.63.0", default-features = false }
|
||||
rustfs-gateway-dialect-rustfs-admin = { git = "https://github.com/rustfs/gateway.git", rev = "60dcd2a55713dbcc9dbd6e165922e1a0df4473d7", version = "0.13.0", default-features = false }
|
||||
|
||||
# Async Runtime and Networking
|
||||
async-channel = "2.5.0"
|
||||
@@ -315,8 +315,7 @@ hostname = "0.4.2"
|
||||
ipnetwork = { version = "0.21.1" }
|
||||
lazy_static = "1.5.1"
|
||||
libc = "0.2.191"
|
||||
cxx = "1"
|
||||
cxx-build = "1"
|
||||
cuobject = { version = "0.1.0", default-features = false }
|
||||
libsystemd = "0.7.2"
|
||||
local-ip-address = "0.6.13"
|
||||
log = "0.4"
|
||||
@@ -354,6 +353,12 @@ rustify = { version = "0.7", default-features = false }
|
||||
rustix = { version = "1.1.6" }
|
||||
rust-embed = { version = "8.14.0" }
|
||||
rustc-hash = { version = "2.1.3" }
|
||||
s3s = { git = "https://github.com/s3s-project/s3s", rev = "5761ddfe4c509fcac87e3b99fd5bd9e176b442c0", features = ["minio"] }
|
||||
s3s-sigv4 = { git = "https://github.com/s3s-project/s3s", rev = "5761ddfe4c509fcac87e3b99fd5bd9e176b442c0" }
|
||||
# The same s3s pin under the name the legacy edge of the gateway migration uses
|
||||
# (crates/s3-types, feature `compat-s3s`). Keep `rev` identical to `s3s` above.
|
||||
# DELETE BY T4.2 (rustfs/backlog#2784).
|
||||
legacy-s3s = { package = "s3s", git = "https://github.com/s3s-project/s3s", rev = "5761ddfe4c509fcac87e3b99fd5bd9e176b442c0", features = ["minio"] }
|
||||
serial_test = "4.0.1"
|
||||
shadow-rs = { default-features = false, version = "2.0.0" }
|
||||
siphasher = "1.0.4"
|
||||
|
||||
@@ -255,24 +255,6 @@ pub const ENV_RUSTFS_KMS_ENFORCE_SSE_KEY_POLICY: &str = "RUSTFS_KMS_ENFORCE_SSE_
|
||||
/// working; the default flips to on in a later release.
|
||||
pub const DEFAULT_KMS_ENFORCE_SSE_KEY_POLICY: bool = false;
|
||||
|
||||
/// Write-side switch for opening every encrypted multipart part segment with
|
||||
/// an authenticated random segment-nonce frame (`0x03`).
|
||||
///
|
||||
/// Off by default for rolling-upgrade safety: nodes without `0x03` read support
|
||||
/// reject segment-nonce frames, and encrypted ciphertext travels verbatim
|
||||
/// through transition, decommission, heal, and SSE-C replication passthrough.
|
||||
/// Enable only after every node (and every RustFS warm or replication target
|
||||
/// receiving raw ciphertext) runs a release with segment-nonce read support.
|
||||
/// Reading `0x03` segments needs no switch; the default flips in a later
|
||||
/// release.
|
||||
pub const ENV_RUSTFS_ENCRYPTION_MULTIPART_SEGMENT_NONCE: &str = "RUSTFS_ENCRYPTION_MULTIPART_SEGMENT_NONCE";
|
||||
|
||||
/// Default write-side switch for multipart segment-nonce frames.
|
||||
///
|
||||
/// Default value: false
|
||||
/// Environment variable: RUSTFS_ENCRYPTION_MULTIPART_SEGMENT_NONCE
|
||||
pub const DEFAULT_RUSTFS_ENCRYPTION_MULTIPART_SEGMENT_NONCE: bool = false;
|
||||
|
||||
/// Environment variable for server KMS backend.
|
||||
pub const ENV_RUSTFS_KMS_BACKEND: &str = "RUSTFS_KMS_BACKEND";
|
||||
|
||||
@@ -444,7 +426,6 @@ mod tests {
|
||||
DEFAULT_ADDRESS,
|
||||
DEFAULT_CONSOLE_ADDRESS,
|
||||
ENV_RUSTFS_BROWSER_REDIRECT_URL,
|
||||
ENV_RUSTFS_ENCRYPTION_MULTIPART_SEGMENT_NONCE,
|
||||
];
|
||||
|
||||
for constant in &string_constants {
|
||||
@@ -487,12 +468,4 @@ mod tests {
|
||||
assert_eq!(DEFAULT_ADDRESS, format!(":{DEFAULT_PORT}"));
|
||||
assert_eq!(DEFAULT_CONSOLE_ADDRESS, format!(":{DEFAULT_CONSOLE_PORT}"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multipart_segment_nonce_constants() {
|
||||
assert_eq!(ENV_RUSTFS_ENCRYPTION_MULTIPART_SEGMENT_NONCE, "RUSTFS_ENCRYPTION_MULTIPART_SEGMENT_NONCE");
|
||||
const {
|
||||
assert!(!DEFAULT_RUSTFS_ENCRYPTION_MULTIPART_SEGMENT_NONCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,23 +43,6 @@ pub const MAX_IAM_IMPORT_EXPANDED_SIZE: u64 = 100 * 1024 * 1024; // 100 MB
|
||||
/// 100MB allows importing metadata for ~10,000 buckets with reasonable configs.
|
||||
pub const MAX_BUCKET_METADATA_IMPORT_SIZE: usize = 100 * 1024 * 1024; // 100 MB
|
||||
|
||||
/// Maximum total size the members of a bucket metadata import ZIP may expand to (100 MB).
|
||||
/// Used for: bounding total decompression of `ImportBucketMetadata` archive members.
|
||||
/// Rationale: `MAX_BUCKET_METADATA_IMPORT_SIZE` caps the *compressed* upload only, and
|
||||
/// the archive may use any compression method the `zip` crate supports (deflate, bzip2, zstd, ...),
|
||||
/// so without a separate budget a few hundred bytes can expand to gigabytes. Bucket
|
||||
/// configs are small XML/JSON documents: 100 MB of them still covers the ~10,000
|
||||
/// buckets the compressed cap is sized for while keeping worst-case allocation bounded.
|
||||
pub const MAX_BUCKET_METADATA_IMPORT_EXPANDED_SIZE: u64 = 100 * 1024 * 1024; // 100 MB
|
||||
|
||||
/// Maximum expanded size of a single member inside a bucket metadata import ZIP (1 MB).
|
||||
/// Used for: bounding individual configuration payloads in `ImportBucketMetadata`.
|
||||
/// Rationale: Individual bucket configuration files (policy, lifecycle, replication, etc.)
|
||||
/// are small XML/JSON documents well under 1 MB (matching `MAX_ADMIN_REQUEST_BODY_SIZE`).
|
||||
/// Capping each member prevents repeated oversized config payloads from bloating
|
||||
/// persisted bucket metadata and startup memory across restarts.
|
||||
pub const MAX_BUCKET_METADATA_IMPORT_MEMBER_SIZE: u64 = 1024 * 1024; // 1 MB
|
||||
|
||||
/// Maximum size for healing operation requests (1 MB)
|
||||
/// Used for: Healing parameters and configuration
|
||||
/// Rationale: Healing requests contain bucket/object paths and options. Should be small.
|
||||
@@ -82,7 +65,7 @@ pub const MAX_HEAL_REQUEST_SIZE: usize = 1024 * 1024; // 1 MB
|
||||
pub const MAX_S3_CLIENT_RESPONSE_SIZE: usize = 10 * 1024 * 1024; // 10 MB
|
||||
|
||||
/// Maximum body size accepted by a single `PutObject` or `UploadPart` request (5 GiB).
|
||||
/// Enforced on the upload body and at request-header admission.
|
||||
/// Used for: the s3s streaming-body limit and the request-header admission check.
|
||||
/// Rationale: matches the AWS S3 single-PUT / single-part ceiling. Larger objects
|
||||
/// must use multipart upload. The header check rejects an oversize
|
||||
/// `Content-Length` before any body byte is read so the client gets
|
||||
|
||||
@@ -32,9 +32,6 @@ pub const DEFAULT_HEAL_BITROT_CYCLE_SECS: u64 = 30 * 24 * 60 * 60;
|
||||
/// - Note: Enabling auto-heal can improve system resilience by automatically addressing issues, but may increase resource usage; evaluate based on your operational requirements.
|
||||
pub const ENV_HEAL_AUTO_HEAL_ENABLE: &str = "RUSTFS_HEAL_AUTO_HEAL_ENABLE";
|
||||
|
||||
/// Colon-separated Linux mount roots for automatic replacement of data directories below a mount point.
|
||||
pub const ENV_HEAL_REPLACEMENT_MOUNT_ROOTS: &str = "RUSTFS_HEAL_REPLACEMENT_MOUNT_ROOTS";
|
||||
|
||||
/// Environment variable name that specifies the heal queue size.
|
||||
///
|
||||
/// - Purpose: Set the maximum number of heal requests that can be queued.
|
||||
|
||||
@@ -349,8 +349,10 @@ pub const DEFAULT_INTERNODE_DATA_TRANSPORT: &str = "tcp-http";
|
||||
/// Legacy alias for "tcp-http". Both values select the TCP/HTTP transport backend.
|
||||
pub const INTERNODE_DATA_TRANSPORT_TCP: &str = "tcp";
|
||||
|
||||
/// Shard reads and writes use NIXL/UCX and require an active NIXL agent on both peers.
|
||||
/// Format metadata, directory walks and scanner requests use the control transport.
|
||||
/// Internode reads whose data moves over NIXL/UCX (InfiniBand rails or RoCE by
|
||||
/// LID/GID, no IP needed); requests, writes and walks stay on TCP/HTTP. Requires
|
||||
/// a binary built with the `nixl` feature and `RUSTFS_NIXL_ENABLE`; until the
|
||||
/// NIXL agent is up, and for any read it cannot serve, it uses TCP/HTTP.
|
||||
pub const INTERNODE_DATA_TRANSPORT_NIXL: &str = "nixl";
|
||||
|
||||
/// Known internode transport backend names accepted by the config parser.
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
[package]
|
||||
name = "rustfs-cuobject-sys"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
repository.workspace = true
|
||||
rust-version.workspace = true
|
||||
version.workspace = true
|
||||
description = "Native bindings to the NVIDIA cuObject server SDK"
|
||||
links = "cuobjserver"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
cxx = { workspace = true, optional = true }
|
||||
libc = { workspace = true, optional = true }
|
||||
|
||||
[build-dependencies]
|
||||
cxx-build = { workspace = true, optional = true }
|
||||
|
||||
[features]
|
||||
server = ["dep:cxx", "dep:cxx-build", "dep:libc"]
|
||||
@@ -1,41 +0,0 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
fn main() {
|
||||
#[cfg(feature = "server")]
|
||||
build_server();
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
fn build_server() {
|
||||
use std::{env, path::PathBuf};
|
||||
|
||||
println!("cargo:rerun-if-env-changed=CUOBJSERVER_ROOT");
|
||||
for file in ["src/sdk.rs", "native/server.h", "native/server.cc"] {
|
||||
println!("cargo:rerun-if-changed={file}");
|
||||
}
|
||||
let mut build = cxx_build::bridge("src/sdk.rs");
|
||||
if let Some(root) = env::var_os("CUOBJSERVER_ROOT").map(PathBuf::from) {
|
||||
build.include(root.join("include"));
|
||||
for subdir in ["lib", "lib64"] {
|
||||
println!("cargo:rustc-link-search=native={}", root.join(subdir).display());
|
||||
}
|
||||
}
|
||||
build
|
||||
.include(".")
|
||||
.file("native/server.cc")
|
||||
.std("c++17")
|
||||
.compile("rustfs_cuobject_server");
|
||||
println!("cargo:rustc-link-lib=cuobjserver");
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "rustfs-cuobject-sys/src/sdk.rs.h"
|
||||
#include <cuobjserver.h>
|
||||
#include <array>
|
||||
#include <cerrno>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
#include <system_error>
|
||||
#include <sys/mman.h>
|
||||
|
||||
namespace rustfs::cuobject {
|
||||
|
||||
class Server {
|
||||
public:
|
||||
Server(std::string address, std::uint16_t port, int channels, std::uint32_t depth)
|
||||
: address_(std::move(address)) {
|
||||
cuObjRDMATunable options;
|
||||
if (channels > 0) options.setNumDcis(channels);
|
||||
if (depth > 0) options.setCqDepth(depth);
|
||||
sdk = std::make_unique<cuObjServer>(address_.c_str(), port, CUOBJ_PROTO_RDMA_DC_V1, options);
|
||||
}
|
||||
// The SDK may retain the address string through server teardown.
|
||||
const std::string address_;
|
||||
std::unique_ptr<cuObjServer> sdk;
|
||||
};
|
||||
|
||||
std::uint32_t header_version() noexcept {
|
||||
return CUOBJ_SERVER_MAJOR_VERSION * 1000 + CUOBJ_SERVER_MINOR_VERSION;
|
||||
}
|
||||
|
||||
std::shared_ptr<Server> open_server(rust::Str addr, std::uint16_t port, int channels, std::uint32_t depth) {
|
||||
return std::make_shared<Server>(std::string(addr), port, channels, depth);
|
||||
}
|
||||
|
||||
class Buffer {
|
||||
public:
|
||||
std::shared_ptr<Server> owner;
|
||||
std::shared_ptr<Buffer> base;
|
||||
rdma_buffer* handle = nullptr;
|
||||
void* mapping = MAP_FAILED;
|
||||
std::size_t length = 0;
|
||||
|
||||
static void destroy(Buffer* buffer) noexcept {
|
||||
try {
|
||||
if (buffer->handle) {
|
||||
if (buffer->base) buffer->owner->sdk->putRDMABufferFromSgList(buffer->handle);
|
||||
else buffer->owner->sdk->deRegisterBuffer(buffer->handle);
|
||||
}
|
||||
} catch (...) {
|
||||
// The SDK may still reference the mapping and its owning server.
|
||||
return;
|
||||
}
|
||||
if (buffer->mapping != MAP_FAILED) munmap(buffer->mapping, buffer->length);
|
||||
delete buffer;
|
||||
}
|
||||
};
|
||||
|
||||
std::shared_ptr<Buffer> register_buffer(std::shared_ptr<Server> server, std::size_t length) {
|
||||
if (!server || !length) throw std::invalid_argument("invalid host registration");
|
||||
auto buffer = std::shared_ptr<Buffer>(new Buffer, Buffer::destroy);
|
||||
buffer->owner = std::move(server);
|
||||
buffer->length = length;
|
||||
buffer->mapping = mmap(nullptr, length, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
if (buffer->mapping == MAP_FAILED) throw std::system_error(errno, std::generic_category(), "mmap");
|
||||
buffer->handle = buffer->owner->sdk->registerBuffer(buffer->mapping, length);
|
||||
if (!buffer->handle) throw std::runtime_error("NVIDIA memory registration failed");
|
||||
return buffer;
|
||||
}
|
||||
|
||||
std::shared_ptr<Buffer> scatter_list(std::shared_ptr<Buffer> base, rust::Slice<const Range> ranges) {
|
||||
if (!base || base->base || ranges.empty() || ranges.size() > 10) throw std::invalid_argument("invalid scatter list");
|
||||
auto list = std::shared_ptr<Buffer>(new Buffer, Buffer::destroy);
|
||||
list->owner = base->owner;
|
||||
list->base = std::move(base);
|
||||
std::vector<cuObjScatterGatherEntryWithOffset_t> entries;
|
||||
entries.reserve(ranges.size());
|
||||
for (auto range : ranges) {
|
||||
if (!range.size || range.offset > list->base->length || range.size > list->base->length - range.offset ||
|
||||
range.offset > std::numeric_limits<loff_t>::max() || range.size > SIZE_MAX - list->length)
|
||||
throw std::invalid_argument("invalid scatter range");
|
||||
entries.push_back({static_cast<loff_t>(range.offset), range.size});
|
||||
list->length += range.size;
|
||||
}
|
||||
list->handle = list->owner->sdk->getRDMABufferFromSgList(list->base->handle, std::move(entries));
|
||||
if (!list->handle) throw std::runtime_error("NVIDIA scatter list registration failed");
|
||||
return list;
|
||||
}
|
||||
|
||||
std::uint8_t* data(const Buffer& buffer) noexcept { return static_cast<std::uint8_t*>(buffer.mapping); }
|
||||
std::size_t size(const Buffer& buffer) noexcept { return buffer.length; }
|
||||
|
||||
std::uint16_t lease_channel(const Server& server) { return server.sdk->allocateChannelId(); }
|
||||
void release_channel(const Server& server, std::uint16_t channel) noexcept {
|
||||
try { server.sdk->freeChannelId(channel); } catch (...) { /* SDK owns the channel. */ }
|
||||
}
|
||||
int completion_fd(const Server& server, std::uint16_t channel) noexcept {
|
||||
try { return server.sdk->getCompletionFd(channel); } catch (...) { return -EIO; }
|
||||
}
|
||||
|
||||
int drain(const Server& server, int fd, rust::Slice<Completion> out) noexcept {
|
||||
std::array<cuObjAsyncEvent_t, 8> events{};
|
||||
if (out.empty() || out.size() > events.size()) return -EINVAL;
|
||||
try {
|
||||
const int count = server.sdk->processCompletions(events.data(), static_cast<int>(out.size()), fd);
|
||||
if (count > static_cast<int>(out.size())) return -EIO;
|
||||
for (int i = 0; i < count; ++i) {
|
||||
out[i] = {reinterpret_cast<std::uintptr_t>(events[i].async_handle), events[i].status};
|
||||
}
|
||||
return count;
|
||||
} catch (...) { return -EIO; }
|
||||
}
|
||||
|
||||
Outcome transfer(const Server& server, const Buffer& buffer, const Operation& op) noexcept {
|
||||
if (buffer.owner.get() != &server || !op.length || op.offset > buffer.length ||
|
||||
op.length > buffer.length - op.offset || (buffer.base && (op.offset || op.length != buffer.length)))
|
||||
return {-EINVAL, 0, false};
|
||||
ibv_wc_status verbs = IBV_WC_SUCCESS;
|
||||
bool submitted_to_sdk = false;
|
||||
try {
|
||||
const std::string key(op.key), token(op.token);
|
||||
void* handle = reinterpret_cast<void*>(op.handle);
|
||||
auto& sdk = *server.sdk;
|
||||
submitted_to_sdk = true;
|
||||
const ssize_t moved = op.put
|
||||
? sdk.handlePutObject(key, buffer.handle, op.address, op.length, token, op.channel, op.offset, &verbs, handle)
|
||||
: sdk.handleGetObject(key, buffer.handle, op.address, op.length, token, op.channel, op.offset, &verbs, handle);
|
||||
return {moved, static_cast<int>(verbs), false};
|
||||
} catch (...) { return {-EIO, static_cast<int>(verbs), submitted_to_sdk}; }
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
#include "rust/cxx.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
namespace rustfs::cuobject {
|
||||
class Server;
|
||||
class Buffer;
|
||||
struct Range;
|
||||
struct Completion;
|
||||
struct Operation;
|
||||
struct Outcome;
|
||||
|
||||
std::uint32_t header_version() noexcept;
|
||||
std::shared_ptr<Server> open_server(rust::Str address, std::uint16_t port, int channels, std::uint32_t depth);
|
||||
std::shared_ptr<Buffer> register_buffer(std::shared_ptr<Server> server, std::size_t length);
|
||||
std::shared_ptr<Buffer> scatter_list(std::shared_ptr<Buffer> base, rust::Slice<const Range> ranges);
|
||||
std::uint8_t* data(const Buffer& buffer) noexcept;
|
||||
std::size_t size(const Buffer& buffer) noexcept;
|
||||
std::uint16_t lease_channel(const Server& server);
|
||||
void release_channel(const Server& server, std::uint16_t channel) noexcept;
|
||||
int completion_fd(const Server& server, std::uint16_t channel) noexcept;
|
||||
int drain(const Server& server, int fd, rust::Slice<Completion> events) noexcept;
|
||||
Outcome transfer(const Server& server, const Buffer& buffer, const Operation& op) noexcept;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Native bindings and SDK handle ownership for the NVIDIA cuObject server.
|
||||
#![cfg(feature = "server")]
|
||||
|
||||
pub use cxx::Exception;
|
||||
// SAFETY: this module declares the SDK ABI and the ownership of native handles.
|
||||
#[allow(unsafe_code)]
|
||||
mod sdk;
|
||||
pub use sdk::*;
|
||||
@@ -1,149 +0,0 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Private ABI for the NVIDIA server SDK.
|
||||
|
||||
use cxx::SharedPtr;
|
||||
use std::io;
|
||||
use std::os::fd::{AsRawFd, RawFd};
|
||||
|
||||
#[cxx::bridge(namespace = "rustfs::cuobject")]
|
||||
mod ffi {
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
struct Range {
|
||||
offset: usize,
|
||||
size: usize,
|
||||
}
|
||||
#[derive(Clone, Copy, Default)]
|
||||
struct Completion {
|
||||
handle: usize,
|
||||
status: isize,
|
||||
}
|
||||
struct Operation<'a> {
|
||||
key: &'a str,
|
||||
token: &'a str,
|
||||
address: u64,
|
||||
offset: usize,
|
||||
length: usize,
|
||||
channel: u16,
|
||||
handle: usize,
|
||||
put: bool,
|
||||
}
|
||||
struct Outcome {
|
||||
count: isize,
|
||||
verbs: i32,
|
||||
uncertain: bool,
|
||||
}
|
||||
|
||||
// SAFETY: native registrations own their server and mapping. Scatter views
|
||||
// also own their base. The caller keeps DMA ranges exclusive until completion.
|
||||
unsafe extern "C++" {
|
||||
include!("native/server.h");
|
||||
type Server;
|
||||
type Buffer;
|
||||
fn header_version() -> u32;
|
||||
fn open_server(address: &str, port: u16, channels: i32, depth: u32) -> Result<SharedPtr<Server>>;
|
||||
fn register_buffer(server: SharedPtr<Server>, length: usize) -> Result<SharedPtr<Buffer>>;
|
||||
fn scatter_list(base: SharedPtr<Buffer>, ranges: &[Range]) -> Result<SharedPtr<Buffer>>;
|
||||
fn size(buffer: &Buffer) -> usize;
|
||||
fn data(buffer: &Buffer) -> *mut u8;
|
||||
fn lease_channel(server: &Server) -> Result<u16>;
|
||||
fn release_channel(server: &Server, channel: u16);
|
||||
fn completion_fd(server: &Server, channel: u16) -> i32;
|
||||
fn drain(server: &Server, fd: i32, events: &mut [Completion]) -> i32;
|
||||
unsafe fn transfer(server: &Server, buffer: &Buffer, op: &Operation) -> Outcome;
|
||||
}
|
||||
}
|
||||
|
||||
// SAFETY: the SDK supports concurrent transfers on separately leased channels.
|
||||
// Server and registration metadata stay immutable after construction. Sharing a
|
||||
// handle gives no safe access to the host bytes.
|
||||
unsafe impl Send for ffi::Server {}
|
||||
unsafe impl Sync for ffi::Server {}
|
||||
unsafe impl Send for ffi::Buffer {}
|
||||
unsafe impl Sync for ffi::Buffer {}
|
||||
|
||||
pub use ffi::{Completion, Operation, Outcome, Range, data, header_version, open_server, register_buffer, scatter_list, size};
|
||||
|
||||
pub type ServerHandle = SharedPtr<ffi::Server>;
|
||||
pub type BufferHandle = SharedPtr<ffi::Buffer>;
|
||||
|
||||
pub fn errno(status: isize) -> io::Error {
|
||||
match status.checked_neg().and_then(|code| i32::try_from(code).ok()) {
|
||||
Some(code) => io::Error::from_raw_os_error(code),
|
||||
None => io::Error::other("invalid NVIDIA error status"),
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Channel {
|
||||
server: SharedPtr<ffi::Server>,
|
||||
id: u16,
|
||||
}
|
||||
|
||||
impl Channel {
|
||||
pub fn lease(server: &SharedPtr<ffi::Server>) -> io::Result<Self> {
|
||||
let id = ffi::lease_channel(server).map_err(io::Error::other)?;
|
||||
if id == u16::MAX {
|
||||
return Err(io::Error::from_raw_os_error(libc::EBUSY));
|
||||
}
|
||||
Ok(Self {
|
||||
server: server.clone(),
|
||||
id,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn fd(&self) -> Option<CompletionFd> {
|
||||
let fd = ffi::completion_fd(&self.server, self.id);
|
||||
(fd >= 0).then(|| CompletionFd {
|
||||
fd,
|
||||
server: self.server.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Submits a transfer to the leased channel.
|
||||
///
|
||||
/// # Safety
|
||||
/// The caller must exclusively own the local range, keep the remote token valid,
|
||||
/// and retain the channel and registrations until the SDK confirms completion.
|
||||
/// An unknown submission or undelivered completion must preserve those owners.
|
||||
pub unsafe fn submit(&mut self, buffer: &ffi::Buffer, mut op: ffi::Operation<'_>) -> ffi::Outcome {
|
||||
op.channel = self.id;
|
||||
// SAFETY: the caller holds the range and the exclusive channel lease.
|
||||
unsafe { ffi::transfer(&self.server, buffer, &op) }
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Channel {
|
||||
fn drop(&mut self) {
|
||||
ffi::release_channel(&self.server, self.id);
|
||||
}
|
||||
}
|
||||
|
||||
pub struct CompletionFd {
|
||||
fd: RawFd,
|
||||
server: SharedPtr<ffi::Server>,
|
||||
}
|
||||
|
||||
impl AsRawFd for CompletionFd {
|
||||
fn as_raw_fd(&self) -> RawFd {
|
||||
self.fd
|
||||
}
|
||||
}
|
||||
|
||||
impl CompletionFd {
|
||||
pub fn drain(&self, events: &mut [ffi::Completion]) -> io::Result<usize> {
|
||||
let count = ffi::drain(&self.server, self.fd, events);
|
||||
usize::try_from(count).map_err(|_| errno(count as isize))
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,11 @@ workspace = true
|
||||
|
||||
[dependencies]
|
||||
bytes = { workspace = true, optional = true }
|
||||
rustfs-cuobject-sys = { workspace = true, features = ["server"], optional = true }
|
||||
cuobject = { workspace = true, default-features = false, optional = true }
|
||||
parking_lot = { workspace = true, optional = true }
|
||||
thiserror = { workspace = true, optional = true }
|
||||
tokio = { workspace = true, features = ["net", "rt-multi-thread", "sync", "time"], optional = true }
|
||||
|
||||
[features]
|
||||
# Compiles the cuObject server bindings (needs the NVIDIA cuObject SDK).
|
||||
server = ["dep:bytes", "dep:rustfs-cuobject-sys", "dep:parking_lot", "dep:thiserror", "dep:tokio"]
|
||||
server = ["dep:bytes", "dep:cuobject", "cuobject/server", "dep:parking_lot", "dep:thiserror", "dep:tokio"]
|
||||
|
||||
+224
-650
File diff suppressed because it is too large
Load Diff
@@ -1235,66 +1235,23 @@ impl Serialize for DataUsageEntry {
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
self.serialize_fields(serializer, &self.children, &self.replication_stats, &self.all_tier_stats)
|
||||
}
|
||||
}
|
||||
|
||||
struct OrderedUsageEntry<'a>(&'a DataUsageEntry);
|
||||
|
||||
impl Serialize for OrderedUsageEntry<'_> {
|
||||
fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
|
||||
let mut children: Vec<_> = self.0.children.iter().collect();
|
||||
children.sort_unstable();
|
||||
// MessagePack decoders accept struct fields as positional sequences.
|
||||
// Include the nested target and tier maps in stable order as well.
|
||||
let replication = self.0.replication_stats.as_ref().map(|stats| {
|
||||
let ReplicationAllStats {
|
||||
targets,
|
||||
replica_size,
|
||||
replica_count,
|
||||
} = stats;
|
||||
let targets: std::collections::BTreeMap<_, _> = targets.iter().collect();
|
||||
(targets, replica_size, replica_count)
|
||||
});
|
||||
let tiers = self.0.all_tier_stats.as_ref().map(|stats| {
|
||||
let AllTierStats { tiers } = stats;
|
||||
let tiers: std::collections::BTreeMap<_, _> = tiers.iter().collect();
|
||||
(tiers,)
|
||||
});
|
||||
self.0.serialize_fields(serializer, &children, &replication, &tiers)
|
||||
}
|
||||
}
|
||||
|
||||
impl DataUsageEntry {
|
||||
/// Stable MessagePack encoding for independently reusable scanner checkpoint pages.
|
||||
pub fn ordered_encoding(&self) -> impl Serialize + '_ {
|
||||
OrderedUsageEntry(self)
|
||||
}
|
||||
|
||||
fn serialize_fields<S: serde::Serializer, C: Serialize, R: Serialize, T: Serialize>(
|
||||
&self,
|
||||
serializer: S,
|
||||
children: &C,
|
||||
replication: &R,
|
||||
tiers: &T,
|
||||
) -> Result<S::Ok, S::Error> {
|
||||
// Keep entries map-encoded so older readers can ignore fields appended
|
||||
// by newer scanner versions during rolling upgrades. The derived
|
||||
// (array) encoding made any appended field a decode error for them.
|
||||
let mut state = serializer.serialize_map(Some(
|
||||
11 + usize::from(self.unknown_tier_stats.is_some()) + usize::from(self.tier_accounting_proof.is_some()),
|
||||
))?;
|
||||
state.serialize_entry("children", children)?;
|
||||
state.serialize_entry("children", &self.children)?;
|
||||
state.serialize_entry("size", &self.size)?;
|
||||
state.serialize_entry("objects", &self.objects)?;
|
||||
state.serialize_entry("versions", &self.versions)?;
|
||||
state.serialize_entry("delete_markers", &self.delete_markers)?;
|
||||
state.serialize_entry("obj_sizes", &self.obj_sizes)?;
|
||||
state.serialize_entry("obj_versions", &self.obj_versions)?;
|
||||
state.serialize_entry("replication_stats", replication)?;
|
||||
state.serialize_entry("replication_stats", &self.replication_stats)?;
|
||||
state.serialize_entry("compacted", &self.compacted)?;
|
||||
state.serialize_entry("failed_objects", &self.failed_objects)?;
|
||||
state.serialize_entry("all_tier_stats", tiers)?;
|
||||
state.serialize_entry("all_tier_stats", &self.all_tier_stats)?;
|
||||
// Keep the legacy no-unknown shape byte-for-byte stable. Once unknown
|
||||
// accounting exists, append its map field before the optional proof.
|
||||
if let Some(unknown_tier_stats) = self.unknown_tier_stats.as_ref() {
|
||||
@@ -1539,9 +1496,9 @@ pub fn prefix_usage_in_cache(
|
||||
} else {
|
||||
format!("{bucket}/{prefix}")
|
||||
};
|
||||
let entry = cache.get(&hash_path(&root).0)?;
|
||||
let entry = clone_cache_value(cache.get(&clone_cache_value(&hash_path(&root).0))?);
|
||||
|
||||
let usage = PrefixUsageSummary::from_entry(&flatten_entry(cache, entry, 0)?);
|
||||
let usage = PrefixUsageSummary::from_entry(&flatten_entry(cache, &entry, 0)?);
|
||||
|
||||
let child_prefix = format!("{root}/");
|
||||
let mut sub_prefixes: Vec<PrefixUsageEntry> = entry
|
||||
@@ -1710,69 +1667,28 @@ impl DataUsageCache {
|
||||
}
|
||||
|
||||
pub fn flatten(&self, root: &DataUsageEntry) -> DataUsageEntry {
|
||||
let mut aggregate = clone_cache_value(root);
|
||||
aggregate.children = HashSet::new();
|
||||
let mut current = (aggregate, root.children.iter());
|
||||
let mut ancestors = Vec::new();
|
||||
let mut visited = HashSet::new();
|
||||
loop {
|
||||
if let Some(id) = current.1.next() {
|
||||
if !visited.insert(id.as_str()) {
|
||||
continue;
|
||||
let mut root = clone_cache_value(root);
|
||||
for id in clone_cache_value(&root.children).iter() {
|
||||
if let Some(e) = self.cache.get(id) {
|
||||
let mut e = clone_cache_value(e);
|
||||
if !e.children.is_empty() {
|
||||
e = self.flatten(&e);
|
||||
}
|
||||
let Some(child) = self.cache.get(id).filter(|child| !std::ptr::eq(*child, root)) else {
|
||||
continue;
|
||||
};
|
||||
if child.children.is_empty() {
|
||||
current.0.merge(child);
|
||||
} else {
|
||||
let mut aggregate = clone_cache_value(child);
|
||||
aggregate.children = HashSet::new();
|
||||
ancestors.push(std::mem::replace(&mut current, (aggregate, child.children.iter())));
|
||||
}
|
||||
} else if let Some(mut parent) = ancestors.pop() {
|
||||
// Preserve subtree grouping for tier accounting proofs.
|
||||
parent.0.merge(¤t.0);
|
||||
current = parent;
|
||||
} else {
|
||||
return current.0;
|
||||
root.merge(&e);
|
||||
}
|
||||
}
|
||||
root.children.clear();
|
||||
root
|
||||
}
|
||||
|
||||
pub fn copy_with_children(&mut self, src: &DataUsageCache, hash: &DataUsageHash, parent: &Option<DataUsageHash>) {
|
||||
let mut visited = HashSet::new();
|
||||
self.copy_with_children_guard(src, hash, parent, &mut visited, 0);
|
||||
}
|
||||
|
||||
fn copy_with_children_guard(
|
||||
&mut self,
|
||||
src: &DataUsageCache,
|
||||
hash: &DataUsageHash,
|
||||
parent: &Option<DataUsageHash>,
|
||||
visited: &mut HashSet<String>,
|
||||
depth: usize,
|
||||
) {
|
||||
if depth > PREFIX_USAGE_MAX_DEPTH {
|
||||
return;
|
||||
}
|
||||
let key = clone_cache_value(&hash.0);
|
||||
if !visited.insert(key.clone()) {
|
||||
return;
|
||||
}
|
||||
if let Some(e) = src.cache.get(&key) {
|
||||
self.cache.insert(key.clone(), clone_cache_value(e));
|
||||
if let Some(e) = src.cache.get(&clone_cache_value(&hash.0)) {
|
||||
self.cache.insert(clone_cache_value(&hash.0), clone_cache_value(e));
|
||||
for ch in e.children.iter() {
|
||||
if *ch == key {
|
||||
if *ch == clone_cache_value(&hash.0) {
|
||||
return;
|
||||
}
|
||||
self.copy_with_children_guard(
|
||||
src,
|
||||
&DataUsageHash(clone_cache_value(ch)),
|
||||
&Some(clone_cache_value(hash)),
|
||||
visited,
|
||||
depth + 1,
|
||||
);
|
||||
self.copy_with_children(src, &DataUsageHash(clone_cache_value(ch)), &Some(clone_cache_value(hash)));
|
||||
}
|
||||
if let Some(parent) = parent {
|
||||
let p = self.cache.entry(clone_cache_value(&parent.0)).or_default();
|
||||
@@ -1782,40 +1698,32 @@ impl DataUsageCache {
|
||||
}
|
||||
|
||||
pub fn delete_recursive(&mut self, hash: &DataUsageHash) {
|
||||
let mut visited = HashSet::new();
|
||||
self.delete_recursive_guard(&hash.0, &mut visited, 0);
|
||||
}
|
||||
|
||||
fn delete_recursive_guard(&mut self, path: &str, visited: &mut HashSet<String>, depth: usize) {
|
||||
if depth > PREFIX_USAGE_MAX_DEPTH {
|
||||
return;
|
||||
}
|
||||
let key = clone_cache_value(path);
|
||||
if !visited.insert(key.clone()) {
|
||||
return;
|
||||
}
|
||||
let mut need_remove = Vec::new();
|
||||
if let Some(v) = self.cache.get(&key) {
|
||||
if let Some(v) = self.cache.get(&clone_cache_value(&hash.0)) {
|
||||
for child in v.children.iter() {
|
||||
need_remove.push(clone_cache_value(child));
|
||||
}
|
||||
}
|
||||
self.cache.remove(&key);
|
||||
self.cache.remove(&clone_cache_value(&hash.0));
|
||||
need_remove.iter().for_each(|child| {
|
||||
self.delete_recursive_guard(child, visited, depth + 1);
|
||||
self.delete_recursive(&DataUsageHash(clone_cache_value(child)));
|
||||
});
|
||||
}
|
||||
|
||||
pub fn size_recursive(&self, path: &str) -> Option<DataUsageEntry> {
|
||||
let root = self.cache.get(&hash_path(path).0)?;
|
||||
if root.children.is_empty() {
|
||||
return Some(clone_cache_value(root));
|
||||
match self.find(path) {
|
||||
Some(root) => {
|
||||
if root.children.is_empty() {
|
||||
return Some(root);
|
||||
}
|
||||
let mut flat = self.flatten(&root);
|
||||
if flat.replication_stats.as_ref().is_some_and(ReplicationAllStats::is_empty) {
|
||||
flat.replication_stats = None;
|
||||
}
|
||||
Some(flat)
|
||||
}
|
||||
None => None,
|
||||
}
|
||||
let mut flat = self.flatten(root);
|
||||
if flat.replication_stats.as_ref().is_some_and(ReplicationAllStats::is_empty) {
|
||||
flat.replication_stats = None;
|
||||
}
|
||||
Some(flat)
|
||||
}
|
||||
|
||||
pub fn search_parent(&self, hash: &DataUsageHash) -> Option<DataUsageHash> {
|
||||
@@ -1937,17 +1845,6 @@ impl DataUsageCache {
|
||||
}
|
||||
|
||||
pub fn total_children_rec(&self, path: &str) -> usize {
|
||||
let mut visited = HashSet::new();
|
||||
self.total_children_rec_guard(path, &mut visited, 0)
|
||||
}
|
||||
|
||||
fn total_children_rec_guard(&self, path: &str, visited: &mut HashSet<String>, depth: usize) -> usize {
|
||||
if depth > PREFIX_USAGE_MAX_DEPTH {
|
||||
return 0;
|
||||
}
|
||||
if !visited.insert(clone_cache_value(path)) {
|
||||
return 0;
|
||||
}
|
||||
let Some(root) = self.find(path) else {
|
||||
return 0;
|
||||
};
|
||||
@@ -1957,7 +1854,7 @@ impl DataUsageCache {
|
||||
|
||||
let mut n = root.children.len();
|
||||
for ch in root.children.iter() {
|
||||
n += self.total_children_rec_guard(ch, visited, depth + 1);
|
||||
n += self.total_children_rec(ch);
|
||||
}
|
||||
n
|
||||
}
|
||||
@@ -2007,17 +1904,19 @@ impl DataUsageCache {
|
||||
|
||||
/// Convert cache to DataUsageInfo for a specific path
|
||||
pub fn dui(&self, path: &str, buckets: &[String]) -> DataUsageInfo {
|
||||
let Some(e) = self.cache.get(&hash_path(path).0) else {
|
||||
return DataUsageInfo::default();
|
||||
let e = match self.find(path) {
|
||||
Some(e) => e,
|
||||
None => return DataUsageInfo::default(),
|
||||
};
|
||||
let flat = self.flatten(e);
|
||||
let flat = self.flatten(&e);
|
||||
|
||||
let mut buckets_usage = HashMap::new();
|
||||
for bucket_name in buckets.iter() {
|
||||
let Some(e) = self.cache.get(&hash_path(bucket_name).0) else {
|
||||
continue;
|
||||
let e = match self.find(bucket_name) {
|
||||
Some(e) => e,
|
||||
None => continue,
|
||||
};
|
||||
let flat = self.flatten(e);
|
||||
let flat = self.flatten(&e);
|
||||
let mut bui = BucketUsageInfo {
|
||||
size: flat.size as u64,
|
||||
versions_count: flat.versions as u64,
|
||||
@@ -2635,32 +2534,6 @@ mod tests {
|
||||
entry
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ordered_checkpoint_entry_round_trips_and_stays_identical_after_reload() {
|
||||
let mut entry = DataUsageEntry::default();
|
||||
let mut replication = ReplicationAllStats {
|
||||
replica_size: 998,
|
||||
replica_count: 3,
|
||||
..Default::default()
|
||||
};
|
||||
let mut tiers = AllTierStats::default();
|
||||
for index in 1..=32 {
|
||||
let key = format!("source-{index}");
|
||||
entry.children.insert(key.clone());
|
||||
replication.targets.insert(key.clone(), ReplicationTargetUsage::default());
|
||||
tiers.tiers.insert(key, TierStats::default());
|
||||
}
|
||||
entry.replication_stats = Some(replication);
|
||||
entry.all_tier_stats = Some(tiers);
|
||||
let bytes = rmp_serde::to_vec(&entry.ordered_encoding()).expect("encode ordered checkpoint");
|
||||
let reloaded: DataUsageEntry = rmp_serde::from_slice(&bytes).expect("read with the existing codec");
|
||||
assert_eq!(reloaded.children, entry.children);
|
||||
let replicas = reloaded.replication_stats.as_ref().expect("replication stats");
|
||||
assert_eq!((replicas.targets.len(), replicas.replica_size, replicas.replica_count), (32, 998, 3));
|
||||
assert_eq!(reloaded.all_tier_stats.as_ref().expect("tier stats").tiers.len(), 32);
|
||||
assert_eq!(rmp_serde::to_vec(&reloaded.ordered_encoding()).expect("encode reloaded entry"), bytes);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tier_stats_survive_entry_merge() {
|
||||
let mut left = tier_entry(
|
||||
@@ -4171,17 +4044,6 @@ mod tests {
|
||||
(cache, root)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_flatten_aggregates_nested_siblings() {
|
||||
let (cache, root) = build_test_tree();
|
||||
let root_entry = cache.cache.get(&root.0).expect("usage root");
|
||||
let flattened = cache.flatten(root_entry);
|
||||
assert!(flattened.children.is_empty());
|
||||
assert_eq!(flattened.objects, 6);
|
||||
assert_eq!(flattened.size, 60);
|
||||
assert_eq!(root_entry.children.len(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_add_collects_internal_nodes_as_compaction_candidates() {
|
||||
let (cache, root) = build_test_tree();
|
||||
|
||||
@@ -13,9 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
pub mod data_usage;
|
||||
pub mod scan_progress;
|
||||
pub mod usage_observation;
|
||||
|
||||
pub use data_usage::*;
|
||||
pub use scan_progress::*;
|
||||
pub use usage_observation::*;
|
||||
|
||||
@@ -1,223 +0,0 @@
|
||||
// Copyright 2026 RustFS Team
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
//! Display-only scanner progress. These values never authorize quota admission,
|
||||
//! cache reuse, or publication of a certified usage snapshot.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
pub const BUCKET_SCAN_PROGRESS_VERSION: u16 = 1;
|
||||
pub const BUCKET_SCAN_PROGRESS_MAX_BYTES: usize = 16 * 1024;
|
||||
pub const BUCKET_SCAN_PROGRESS_OBJECT_NAME: &str = ".usage-progress.json";
|
||||
|
||||
/// The object lives on its contributing erasure set, alongside its bucket cache.
|
||||
pub fn bucket_scan_progress_path(bucket: &str) -> String {
|
||||
format!("buckets/{bucket}/{BUCKET_SCAN_PROGRESS_OBJECT_NAME}")
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum BucketScanStage {
|
||||
Enumerating,
|
||||
Scanning,
|
||||
AwaitingSources,
|
||||
Completed,
|
||||
}
|
||||
|
||||
/// One replaceable sample from a logical erasure set, never a per-disk delta.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||
pub struct BucketScanProgressSource {
|
||||
pub version: u16,
|
||||
pub bucket: String,
|
||||
pub bucket_incarnation: String,
|
||||
pub pool_index: u64,
|
||||
pub set_index: u64,
|
||||
pub set_layout: [u8; 32],
|
||||
pub publication_epoch: u64,
|
||||
/// Shared durable movement scope. A writer's local admission epoch is not
|
||||
/// comparable to another node's counter, including after restart.
|
||||
#[serde(default)]
|
||||
pub movement_generation: Option<u64>,
|
||||
pub scanner_epoch: u64,
|
||||
pub scanner_cycle: u64,
|
||||
/// Unix milliseconds of the sample, preserved when an older sample is carried.
|
||||
pub updated_at: u64,
|
||||
pub stage: BucketScanStage,
|
||||
/// Accepted logical object usage; enumeration alone leaves both absent.
|
||||
pub objects: Option<u64>,
|
||||
pub size: Option<u64>,
|
||||
}
|
||||
|
||||
/// Response-only progress, deliberately separate from a bucket's total usage.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
|
||||
pub struct BucketScanProgress {
|
||||
pub stage: BucketScanStage,
|
||||
pub updated_at: u64,
|
||||
pub objects: Option<u64>,
|
||||
pub size: Option<u64>,
|
||||
pub sources_observed: u64,
|
||||
pub sources_total: u64,
|
||||
}
|
||||
|
||||
impl BucketScanProgressSource {
|
||||
/// Bind a sample to shared storage scope, independently of reader-local epochs.
|
||||
pub fn matches(&self, bucket: &str, incarnation: &str, source: (u64, u64), movement_generation: u64) -> bool {
|
||||
self.version == BUCKET_SCAN_PROGRESS_VERSION
|
||||
&& self.bucket == bucket
|
||||
&& !incarnation.is_empty()
|
||||
&& incarnation != "00000000-0000-0000-0000-000000000000"
|
||||
&& self.bucket_incarnation == incarnation
|
||||
&& (self.pool_index, self.set_index) == source
|
||||
&& self.movement_generation == Some(movement_generation)
|
||||
&& self.updated_at > 0
|
||||
&& self.objects.is_some() == self.size.is_some()
|
||||
&& (self.stage != BucketScanStage::Completed || self.objects.is_some())
|
||||
&& self.stage != BucketScanStage::AwaitingSources
|
||||
}
|
||||
}
|
||||
|
||||
/// Fold each logical source exactly once. Retries replace samples; replicas do
|
||||
/// not add to them. Missing sources remain explicit, including on first startup.
|
||||
/// Overflow or conflicting copies of a source make the view unavailable.
|
||||
/// Callers first bind each sample to the same current bucket and movement
|
||||
/// scope with [`BucketScanProgressSource::matches`].
|
||||
pub fn aggregate_bucket_scan_progress(
|
||||
sources: impl IntoIterator<Item = BucketScanProgressSource>,
|
||||
expected: &[(u64, u64)],
|
||||
) -> Option<BucketScanProgress> {
|
||||
if expected.is_empty() || expected.windows(2).any(|pair| pair[0] >= pair[1]) {
|
||||
return None;
|
||||
}
|
||||
let mut selected = BTreeMap::new();
|
||||
for sample in sources {
|
||||
let key = (sample.pool_index, sample.set_index);
|
||||
if expected.binary_search(&key).is_err() {
|
||||
return None;
|
||||
}
|
||||
if let Some(previous) = selected.insert(key, sample.clone())
|
||||
&& previous != sample
|
||||
{
|
||||
return None;
|
||||
}
|
||||
}
|
||||
let updated_at = selected.values().map(|sample| sample.updated_at).min()?;
|
||||
let mut objects = None;
|
||||
let mut size = None;
|
||||
for sample in selected.values() {
|
||||
match (sample.objects, sample.size) {
|
||||
(Some(count), Some(bytes)) => {
|
||||
objects = Some(objects.unwrap_or(0_u64).checked_add(count)?);
|
||||
size = Some(size.unwrap_or(0_u64).checked_add(bytes)?);
|
||||
}
|
||||
(None, None) => {}
|
||||
_ => return None,
|
||||
}
|
||||
}
|
||||
let complete = selected.len() == expected.len() && selected.values().all(|s| s.stage == BucketScanStage::Completed);
|
||||
Some(BucketScanProgress {
|
||||
stage: if complete {
|
||||
BucketScanStage::Completed
|
||||
} else if selected.len() < expected.len() {
|
||||
BucketScanStage::AwaitingSources
|
||||
} else if objects.is_some() {
|
||||
BucketScanStage::Scanning
|
||||
} else {
|
||||
BucketScanStage::Enumerating
|
||||
},
|
||||
updated_at,
|
||||
objects,
|
||||
size,
|
||||
sources_observed: u64::try_from(selected.len()).ok()?,
|
||||
sources_total: u64::try_from(expected.len()).ok()?,
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn sample(set: u64) -> BucketScanProgressSource {
|
||||
BucketScanProgressSource {
|
||||
version: BUCKET_SCAN_PROGRESS_VERSION,
|
||||
bucket: "bucket".into(),
|
||||
bucket_incarnation: "identity".into(),
|
||||
pool_index: 0,
|
||||
set_index: set,
|
||||
set_layout: [1; 32],
|
||||
publication_epoch: 0,
|
||||
movement_generation: Some(0),
|
||||
scanner_epoch: 3,
|
||||
scanner_cycle: 4,
|
||||
updated_at: 1000,
|
||||
stage: BucketScanStage::Scanning,
|
||||
objects: Some(7),
|
||||
size: Some(77),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn repeated_source_samples_never_double_count() {
|
||||
let one = sample(0);
|
||||
let progress = aggregate_bucket_scan_progress([one.clone(), one], &[(0, 0), (0, 1)]).expect("partial progress");
|
||||
assert_eq!(progress.objects, Some(7));
|
||||
assert_eq!(progress.size, Some(77));
|
||||
assert_eq!(progress.stage, BucketScanStage::AwaitingSources);
|
||||
assert_eq!(progress.sources_observed, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enumeration_does_not_invent_empty_usage() {
|
||||
let mut one = sample(0);
|
||||
one.stage = BucketScanStage::Enumerating;
|
||||
one.objects = None;
|
||||
one.size = None;
|
||||
let progress = aggregate_bucket_scan_progress([one], &[(0, 0)]).expect("enumeration progress");
|
||||
assert_eq!(progress.objects, None);
|
||||
assert_eq!(progress.size, None);
|
||||
assert_eq!(progress.stage, BucketScanStage::Enumerating);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completion_requires_every_source_and_keeps_oldest_timestamp() {
|
||||
let mut one = sample(0);
|
||||
one.stage = BucketScanStage::Completed;
|
||||
let mut two = sample(1);
|
||||
two.updated_at = 2000;
|
||||
let pending = aggregate_bucket_scan_progress([one.clone(), two.clone()], &[(0, 0), (0, 1)]).expect("pending");
|
||||
assert_eq!(pending.stage, BucketScanStage::Scanning);
|
||||
two.stage = BucketScanStage::Completed;
|
||||
let done = aggregate_bucket_scan_progress([one, two], &[(0, 0), (0, 1)]).expect("completed");
|
||||
assert_eq!((done.objects, done.size, done.updated_at), (Some(14), Some(154), 1000));
|
||||
assert_eq!(done.stage, BucketScanStage::Completed);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn conflicting_replicas_overflow_and_foreign_sources_are_rejected() {
|
||||
let mut other = sample(0);
|
||||
other.objects = Some(8);
|
||||
assert!(aggregate_bucket_scan_progress([sample(0), other], &[(0, 0)]).is_none());
|
||||
assert!(aggregate_bucket_scan_progress([sample(1)], &[(0, 0)]).is_none());
|
||||
let mut huge = sample(1);
|
||||
huge.size = Some(u64::MAX);
|
||||
assert!(aggregate_bucket_scan_progress([sample(0), huge], &[(0, 0), (0, 1)]).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn progress_cannot_cross_bucket_incarnation_or_movement_generation() {
|
||||
let one = sample(0);
|
||||
assert!(one.matches("bucket", "identity", (0, 0), 0));
|
||||
assert!(!one.matches("bucket", "recreated", (0, 0), 0));
|
||||
assert!(!one.matches("bucket", "identity", (0, 1), 0));
|
||||
assert!(!one.matches("bucket", "identity", (0, 0), 1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn progress_reader_local_epoch_does_not_hide_shared_sample() {
|
||||
let mut one = sample(0);
|
||||
one.publication_epoch = 7;
|
||||
assert!(one.matches("bucket", "identity", (0, 0), 0));
|
||||
one.movement_generation = None;
|
||||
assert!(!one.matches("bucket", "identity", (0, 0), 0), "missing shared scope stays unknown");
|
||||
}
|
||||
}
|
||||
@@ -171,70 +171,6 @@ impl DataUsageBucketObservation {
|
||||
}
|
||||
|
||||
impl DataUsageInfo {
|
||||
/// Hide values that cannot be bound to the current storage-owned identity.
|
||||
///
|
||||
/// `incarnations` contains canonical non-nil identities read from storage;
|
||||
/// a missing entry means identity was unavailable. Neither legacy values
|
||||
/// without identity nor metadata read failures establish confirmed zero.
|
||||
/// Changed responses are display-only and cannot authorize quota or writes.
|
||||
/// If retained counters overflow, all values remain unknown.
|
||||
/// Returns the number of canonical values removed.
|
||||
pub fn retain_current_bucket_usage_for_admin(&mut self, incarnations: &HashMap<String, String>) -> usize {
|
||||
let original_count = self.buckets_usage.len();
|
||||
let original_observation_count = self.usage_snapshot_bucket_observations.len();
|
||||
let matches_current = |bucket: &String, usage: &BucketUsageInfo| {
|
||||
incarnations.get(bucket).is_some_and(|current| {
|
||||
!current.is_empty()
|
||||
&& current != "00000000-0000-0000-0000-000000000000"
|
||||
&& usage.bucket_incarnation.as_ref() == Some(current)
|
||||
})
|
||||
};
|
||||
self.buckets_usage.retain(|bucket, usage| matches_current(bucket, usage));
|
||||
self.usage_snapshot_bucket_observations.retain(|bucket, observation| {
|
||||
matches_current(bucket, &observation.usage)
|
||||
&& observation
|
||||
.sources
|
||||
.iter()
|
||||
.all(|source| incarnations.get(bucket) == Some(&source.bucket_incarnation))
|
||||
});
|
||||
if original_count == self.buckets_usage.len()
|
||||
&& original_observation_count == self.usage_snapshot_bucket_observations.len()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
let totals = self.buckets_usage.values().try_fold([0_u64; 4], |total, usage| {
|
||||
Some([
|
||||
total[0].checked_add(usage.size)?,
|
||||
total[1].checked_add(usage.objects_count)?,
|
||||
total[2].checked_add(usage.versions_count)?,
|
||||
total[3].checked_add(usage.delete_markers_count)?,
|
||||
])
|
||||
});
|
||||
let [size, objects, versions, markers] = totals.unwrap_or_else(|| {
|
||||
self.buckets_usage.clear();
|
||||
self.usage_snapshot_bucket_observations.clear();
|
||||
[0; 4]
|
||||
});
|
||||
self.bucket_sizes = self
|
||||
.buckets_usage
|
||||
.iter()
|
||||
.map(|(bucket, usage)| (bucket.clone(), usage.size))
|
||||
.collect();
|
||||
self.buckets_count = u64::try_from(self.buckets_usage.len()).unwrap_or(u64::MAX);
|
||||
self.objects_total_size = size;
|
||||
self.objects_total_count = objects;
|
||||
self.versions_total_count = versions;
|
||||
self.delete_markers_total_count = markers;
|
||||
self.replication_info.clear();
|
||||
self.tier_stats = None;
|
||||
self.unknown_tier_stats = None;
|
||||
self.usage_snapshot_complete = false;
|
||||
self.usage_snapshot_partial = true;
|
||||
self.usage_snapshot_converged = Some(false);
|
||||
self.usage_snapshot_admin_projection = true;
|
||||
original_count.saturating_sub(self.buckets_usage.len())
|
||||
}
|
||||
|
||||
/// Overlay validated companions on an owned admin response only.
|
||||
///
|
||||
/// `incarnations` must come from current storage metadata, not the companion.
|
||||
|
||||
@@ -321,110 +321,3 @@ fn provenance_and_companions_change_candidate_bytes_and_round_trip_as_maps() {
|
||||
let restored: DataUsageInfo = rmp_serde::from_slice(&named).expect("read named map with additive fields");
|
||||
assert_eq!(restored, canonical);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn current_identity_filter_preserves_an_unchanged_complete_snapshot() {
|
||||
let mut candidate = snapshot();
|
||||
let original = candidate.clone();
|
||||
assert_eq!(candidate.retain_current_bucket_usage_for_admin(&incarnations()), 0);
|
||||
assert_eq!(candidate, original);
|
||||
assert!(candidate.is_complete_bucket_usage_snapshot());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn current_identity_filter_hides_unbound_values_without_confirming_zero() {
|
||||
for identity in [
|
||||
None,
|
||||
Some(""),
|
||||
Some("corrupt"),
|
||||
Some("00000000-0000-0000-0000-000000000000"),
|
||||
Some("22222222-2222-4222-8222-222222222222"),
|
||||
] {
|
||||
let mut candidate = snapshot();
|
||||
candidate.usage_snapshot_bucket_observations.clear();
|
||||
candidate
|
||||
.buckets_usage
|
||||
.get_mut("bucket")
|
||||
.expect("canonical")
|
||||
.bucket_incarnation = identity.map(str::to_string);
|
||||
assert_eq!(
|
||||
candidate.retain_current_bucket_usage_for_admin(&incarnations()),
|
||||
1,
|
||||
"identity {identity:?}"
|
||||
);
|
||||
assert!(!candidate.buckets_usage.contains_key("bucket"));
|
||||
assert!(!candidate.bucket_sizes.contains_key("bucket"));
|
||||
assert_eq!(candidate.usage_snapshot_converged, Some(false));
|
||||
assert!(candidate.usage_snapshot_admin_projection);
|
||||
assert!(!candidate.is_complete_bucket_usage_snapshot());
|
||||
assert!(!candidate.is_valid_partial_snapshot());
|
||||
}
|
||||
for current in ["", "00000000-0000-0000-0000-000000000000"] {
|
||||
let mut candidate = snapshot();
|
||||
candidate
|
||||
.buckets_usage
|
||||
.get_mut("bucket")
|
||||
.expect("canonical")
|
||||
.bucket_incarnation = Some(current.to_string());
|
||||
assert_eq!(
|
||||
candidate.retain_current_bucket_usage_for_admin(&HashMap::from([("bucket".to_string(), current.to_string())])),
|
||||
1
|
||||
);
|
||||
assert!(candidate.usage_snapshot_admin_projection);
|
||||
}
|
||||
let mut candidate = snapshot();
|
||||
assert_eq!(candidate.retain_current_bucket_usage_for_admin(&HashMap::new()), 1);
|
||||
assert!(candidate.usage_snapshot_bucket_observations.is_empty());
|
||||
assert_eq!(candidate.usage_snapshot_converged, Some(false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn current_identity_filter_keeps_healthy_buckets_and_recalculates_partial_totals() {
|
||||
let mut candidate = snapshot();
|
||||
candidate.buckets_usage.insert("cold".to_string(), usage(7));
|
||||
candidate.buckets_count = 2;
|
||||
candidate.bucket_sizes.insert("cold".to_string(), 7);
|
||||
candidate.calculate_totals();
|
||||
candidate.replication_info.insert("target".to_string(), Default::default());
|
||||
candidate.tier_stats = Some(Default::default());
|
||||
candidate.unknown_tier_stats = Some(Default::default());
|
||||
assert_eq!(
|
||||
candidate.retain_current_bucket_usage_for_admin(&HashMap::from([("cold".to_string(), INCARNATION.to_string())])),
|
||||
1
|
||||
);
|
||||
assert_eq!(candidate.buckets_usage.len(), 1);
|
||||
assert_eq!(candidate.buckets_usage["cold"].size, 7);
|
||||
assert_eq!(candidate.bucket_sizes, HashMap::from([("cold".to_string(), 7)]));
|
||||
assert_eq!(
|
||||
(
|
||||
candidate.buckets_count,
|
||||
candidate.objects_total_size,
|
||||
candidate.objects_total_count,
|
||||
candidate.versions_total_count
|
||||
),
|
||||
(1, 7, 7, 7)
|
||||
);
|
||||
assert!(candidate.replication_info.is_empty());
|
||||
assert!(candidate.tier_stats.is_none());
|
||||
assert!(candidate.unknown_tier_stats.is_none());
|
||||
assert!(candidate.usage_snapshot_admin_projection);
|
||||
assert_eq!(candidate.usage_snapshot_converged, Some(false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn current_identity_filter_overflow_leaves_totals_unknown() {
|
||||
let mut candidate = snapshot();
|
||||
candidate.buckets_usage.insert("large".to_string(), usage(u64::MAX));
|
||||
candidate.buckets_usage.insert("small".to_string(), usage(1));
|
||||
candidate.buckets_count = 3;
|
||||
let current = HashMap::from([
|
||||
("large".to_string(), INCARNATION.to_string()),
|
||||
("small".to_string(), INCARNATION.to_string()),
|
||||
]);
|
||||
assert_eq!(candidate.retain_current_bucket_usage_for_admin(¤t), 3);
|
||||
assert!(candidate.buckets_usage.is_empty());
|
||||
assert!(candidate.bucket_sizes.is_empty());
|
||||
assert_eq!(candidate.usage_snapshot_converged, Some(false));
|
||||
assert!(candidate.usage_snapshot_admin_projection);
|
||||
assert!(!candidate.is_complete_bucket_usage_snapshot());
|
||||
}
|
||||
|
||||
@@ -138,13 +138,8 @@ rustls = { workspace = true, default-features = false, features = ["aws-lc-rs",
|
||||
clap = { workspace = true, features = ["derive", "env"] }
|
||||
|
||||
[dev-dependencies]
|
||||
rustfs-gateway.workspace = true
|
||||
rustfs-gateway-types.workspace = true
|
||||
rustfs-gateway-stream.workspace = true
|
||||
serde-value.workspace = true
|
||||
s3s = { git = "https://github.com/s3s-project/s3s", rev = "5761ddfe4c509fcac87e3b99fd5bd9e176b442c0", features = ["minio"] }
|
||||
s3s-sigv4 = { git = "https://github.com/s3s-project/s3s", rev = "5761ddfe4c509fcac87e3b99fd5bd9e176b442c0" }
|
||||
url.workspace = true
|
||||
s3s = { workspace = true, features = ["minio"] }
|
||||
async-compression = { workspace = true, features = ["tokio", "bzip2", "lz4", "xz"] }
|
||||
aws-config = { workspace = true }
|
||||
aws-sdk-sts = { workspace = true, default-features = false, features = ["default-https-client", "rt-tokio"] }
|
||||
|
||||
@@ -1,587 +0,0 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
// Exercise the production validator at the protocol boundary without importing the server crate.
|
||||
#[path = "../../../rustfs/src/storage/authorization/admission/request_validation.rs"]
|
||||
mod request_validation;
|
||||
|
||||
use async_trait::async_trait;
|
||||
use http::{Extensions, HeaderMap, Method, Request, StatusCode, Uri};
|
||||
use http_body_util::BodyExt;
|
||||
use request_validation::{RequestViolation, validate_method_subresource};
|
||||
use s3s::access::{S3Access, S3AccessContext};
|
||||
use s3s::auth::SimpleAuth;
|
||||
use s3s::dto::{
|
||||
AbortMultipartUploadInput, AbortMultipartUploadOutput, DeleteBucketInput, DeleteBucketOutput, DeleteBucketPolicyInput,
|
||||
DeleteBucketPolicyOutput, DeleteObjectInput, DeleteObjectOutput, DeleteObjectTaggingInput, DeleteObjectTaggingOutput,
|
||||
GetBucketAclInput, GetBucketAclOutput, GetObjectAclInput, GetObjectAclOutput, GetObjectInput, GetObjectOutput,
|
||||
HeadBucketInput, HeadBucketOutput, PutBucketAclInput, PutBucketAclOutput, PutObjectAclInput, PutObjectAclOutput,
|
||||
StreamingBlob,
|
||||
};
|
||||
use s3s::host::SingleDomain;
|
||||
use s3s::route::S3Route;
|
||||
use s3s::service::{S3Service, S3ServiceBuilder};
|
||||
use s3s::{Body, S3Request, S3Response, S3Result, s3_error};
|
||||
use s3s_sigv4::{
|
||||
AmzDate, EMPTY_STRING_SHA256_HASH, Payload, calculate_signature, create_canonical_request,
|
||||
create_presigned_canonical_request, create_string_to_sign,
|
||||
};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use time::{OffsetDateTime, macros::format_description};
|
||||
|
||||
#[derive(Default)]
|
||||
struct State {
|
||||
object_deleted: bool,
|
||||
bucket_deleted: bool,
|
||||
calls: Vec<(&'static str, Option<String>)>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
struct ProbeS3(Arc<Mutex<State>>);
|
||||
|
||||
#[async_trait]
|
||||
impl s3s::S3 for ProbeS3 {
|
||||
async fn delete_object(&self, req: S3Request<DeleteObjectInput>) -> S3Result<S3Response<DeleteObjectOutput>> {
|
||||
let mut state = self.0.lock().expect("probe state");
|
||||
state.object_deleted = true;
|
||||
state.calls.push(("DeleteObject", req.input.version_id));
|
||||
Ok(S3Response::new(DeleteObjectOutput::default()))
|
||||
}
|
||||
|
||||
async fn delete_bucket(&self, _: S3Request<DeleteBucketInput>) -> S3Result<S3Response<DeleteBucketOutput>> {
|
||||
let mut state = self.0.lock().expect("probe state");
|
||||
state.bucket_deleted = true;
|
||||
state.calls.push(("DeleteBucket", None));
|
||||
Ok(S3Response::new(DeleteBucketOutput::default()))
|
||||
}
|
||||
|
||||
async fn get_object(&self, _: S3Request<GetObjectInput>) -> S3Result<S3Response<GetObjectOutput>> {
|
||||
if self.0.lock().expect("probe state").object_deleted {
|
||||
return Err(s3_error!(NoSuchKey));
|
||||
}
|
||||
Ok(S3Response::new(GetObjectOutput {
|
||||
body: Some(StreamingBlob::from(Body::from("original object".to_owned()))),
|
||||
..Default::default()
|
||||
}))
|
||||
}
|
||||
|
||||
async fn head_bucket(&self, _: S3Request<HeadBucketInput>) -> S3Result<S3Response<HeadBucketOutput>> {
|
||||
if self.0.lock().expect("probe state").bucket_deleted {
|
||||
return Err(s3_error!(NoSuchBucket));
|
||||
}
|
||||
Ok(S3Response::new(HeadBucketOutput::default()))
|
||||
}
|
||||
|
||||
async fn delete_object_tagging(
|
||||
&self,
|
||||
req: S3Request<DeleteObjectTaggingInput>,
|
||||
) -> S3Result<S3Response<DeleteObjectTaggingOutput>> {
|
||||
self.0
|
||||
.lock()
|
||||
.expect("probe state")
|
||||
.calls
|
||||
.push(("DeleteObjectTagging", req.input.version_id));
|
||||
Ok(S3Response::new(DeleteObjectTaggingOutput::default()))
|
||||
}
|
||||
|
||||
async fn abort_multipart_upload(
|
||||
&self,
|
||||
req: S3Request<AbortMultipartUploadInput>,
|
||||
) -> S3Result<S3Response<AbortMultipartUploadOutput>> {
|
||||
self.0
|
||||
.lock()
|
||||
.expect("probe state")
|
||||
.calls
|
||||
.push(("AbortMultipartUpload", Some(req.input.upload_id)));
|
||||
Ok(S3Response::new(AbortMultipartUploadOutput::default()))
|
||||
}
|
||||
|
||||
async fn delete_bucket_policy(
|
||||
&self,
|
||||
_: S3Request<DeleteBucketPolicyInput>,
|
||||
) -> S3Result<S3Response<DeleteBucketPolicyOutput>> {
|
||||
self.0.lock().expect("probe state").calls.push(("DeleteBucketPolicy", None));
|
||||
Ok(S3Response::new(DeleteBucketPolicyOutput::default()))
|
||||
}
|
||||
|
||||
async fn get_object_acl(&self, _: S3Request<GetObjectAclInput>) -> S3Result<S3Response<GetObjectAclOutput>> {
|
||||
self.0.lock().expect("probe state").calls.push(("GetObjectAcl", None));
|
||||
Ok(S3Response::new(GetObjectAclOutput::default()))
|
||||
}
|
||||
|
||||
async fn put_object_acl(&self, _: S3Request<PutObjectAclInput>) -> S3Result<S3Response<PutObjectAclOutput>> {
|
||||
self.0.lock().expect("probe state").calls.push(("PutObjectAcl", None));
|
||||
Ok(S3Response::new(PutObjectAclOutput::default()))
|
||||
}
|
||||
|
||||
async fn get_bucket_acl(&self, _: S3Request<GetBucketAclInput>) -> S3Result<S3Response<GetBucketAclOutput>> {
|
||||
self.0.lock().expect("probe state").calls.push(("GetBucketAcl", None));
|
||||
Ok(S3Response::new(GetBucketAclOutput::default()))
|
||||
}
|
||||
|
||||
async fn put_bucket_acl(&self, _: S3Request<PutBucketAclInput>) -> S3Result<S3Response<PutBucketAclOutput>> {
|
||||
self.0.lock().expect("probe state").calls.push(("PutBucketAcl", None));
|
||||
Ok(S3Response::new(PutBucketAclOutput::default()))
|
||||
}
|
||||
}
|
||||
|
||||
struct CustomRoute;
|
||||
|
||||
struct MethodValidation;
|
||||
|
||||
#[async_trait]
|
||||
impl S3Access for MethodValidation {
|
||||
async fn check(&self, context: &mut S3AccessContext<'_>) -> S3Result<()> {
|
||||
validate_method_subresource(context.method(), context.uri().query()).map_err(|violation| match violation {
|
||||
RequestViolation::DeleteAcl => s3_error!(MethodNotAllowed),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct CustomRouteMatched;
|
||||
|
||||
#[async_trait]
|
||||
impl S3Route for CustomRoute {
|
||||
fn is_match(&self, _: &Method, uri: &Uri, _: &HeaderMap, extensions: &mut Extensions) -> bool {
|
||||
if uri.path() == "/custom" {
|
||||
extensions.insert(CustomRouteMatched);
|
||||
return true;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
async fn check_access(&self, req: &mut S3Request<Body>) -> S3Result<()> {
|
||||
assert!(req.extensions.get::<CustomRouteMatched>().is_some());
|
||||
if req.headers.contains_key("x-test-deny") {
|
||||
return Err(s3_error!(AccessDenied));
|
||||
}
|
||||
assert!(req.credentials.is_some(), "custom route retains verified credentials");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn call(&self, req: S3Request<Body>) -> S3Result<S3Response<Body>> {
|
||||
assert!(req.extensions.get::<CustomRouteMatched>().is_some());
|
||||
Ok(S3Response::new(Body::from("custom route".to_owned())))
|
||||
}
|
||||
}
|
||||
|
||||
fn service(virtual_host: bool) -> (S3Service, ProbeS3) {
|
||||
let probe = ProbeS3::default();
|
||||
let mut builder = S3ServiceBuilder::new(probe.clone());
|
||||
builder.set_auth(SimpleAuth::from_single("test-key", "test-secret"));
|
||||
builder.set_access(MethodValidation);
|
||||
builder.set_route(CustomRoute);
|
||||
let mut config = s3s::config::S3Config::default();
|
||||
config.enable_sig_v2 = true;
|
||||
config.normalize_forward_slash_path = true;
|
||||
builder.set_config(Arc::new(s3s::config::StaticConfigProvider::new(Arc::new(config))));
|
||||
if virtual_host {
|
||||
builder.set_host(SingleDomain::new("s3.example.test").expect("test domain"));
|
||||
}
|
||||
(builder.build(), probe)
|
||||
}
|
||||
|
||||
fn signed_request(method: Method, uri: &str, presigned: bool, secret: &str) -> Request<Body> {
|
||||
signed_request_with_credentials(method, uri, presigned, "test-key", secret)
|
||||
}
|
||||
|
||||
fn signed_request_with_credentials(method: Method, uri: &str, presigned: bool, access_key: &str, secret: &str) -> Request<Body> {
|
||||
let uri: Uri = uri.parse().expect("test URI");
|
||||
let host = uri.authority().expect("test authority").as_str();
|
||||
let timestamp = OffsetDateTime::now_utc()
|
||||
.format(format_description!("[year][month][day]T[hour][minute][second]Z"))
|
||||
.expect("format SigV4 timestamp");
|
||||
let date = AmzDate::parse(×tamp).expect("test date");
|
||||
let credential = format!("{access_key}/{}/us-east-1/s3/aws4_request", date.fmt_date());
|
||||
let mut query: Vec<(String, String)> = url::form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes())
|
||||
.into_owned()
|
||||
.collect();
|
||||
let mut request = Request::builder()
|
||||
.method(method.clone())
|
||||
.header("host", host)
|
||||
.header("content-length", "0");
|
||||
if presigned {
|
||||
query.extend([
|
||||
("X-Amz-Algorithm".into(), "AWS4-HMAC-SHA256".into()),
|
||||
("X-Amz-Credential".into(), credential),
|
||||
("X-Amz-Date".into(), timestamp),
|
||||
("X-Amz-Expires".into(), "300".into()),
|
||||
("X-Amz-SignedHeaders".into(), "host".into()),
|
||||
]);
|
||||
let canonical = create_presigned_canonical_request(method.as_str(), uri.path(), &query, [("host", host)]);
|
||||
let to_sign = create_string_to_sign(&canonical, &date, "us-east-1", "s3");
|
||||
query.push(("X-Amz-Signature".into(), calculate_signature(&to_sign, secret, &date, "us-east-1", "s3")));
|
||||
let query = url::form_urlencoded::Serializer::new(String::new())
|
||||
.extend_pairs(&query)
|
||||
.finish();
|
||||
request = request.uri(format!("http://{host}{}?{query}", uri.path()));
|
||||
} else {
|
||||
let canonical = create_canonical_request(
|
||||
method.as_str(),
|
||||
uri.path(),
|
||||
&query,
|
||||
[
|
||||
("host", host),
|
||||
("x-amz-content-sha256", EMPTY_STRING_SHA256_HASH),
|
||||
("x-amz-date", ×tamp),
|
||||
],
|
||||
Payload::SingleChunk(EMPTY_STRING_SHA256_HASH),
|
||||
);
|
||||
let to_sign = create_string_to_sign(&canonical, &date, "us-east-1", "s3");
|
||||
let signature = calculate_signature(&to_sign, secret, &date, "us-east-1", "s3");
|
||||
request = request
|
||||
.uri(uri.clone())
|
||||
.header("x-amz-date", timestamp)
|
||||
.header("x-amz-content-sha256", EMPTY_STRING_SHA256_HASH)
|
||||
.header("authorization", format!("AWS4-HMAC-SHA256 Credential={credential}, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature={signature}"));
|
||||
}
|
||||
request.body(Body::empty()).expect("signed request")
|
||||
}
|
||||
|
||||
async fn response(service: &S3Service, request: Request<Body>) -> (StatusCode, String) {
|
||||
let response = service.call(request).await.expect("S3 service response");
|
||||
let status = response.status();
|
||||
let bytes = response.into_body().collect().await.expect("response body").to_bytes();
|
||||
(status, String::from_utf8(bytes.to_vec()).expect("UTF-8 test response"))
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn delete_acl_preserves_objects_and_buckets_for_signed_requests() {
|
||||
for virtual_host in [false, true] {
|
||||
let base = if virtual_host {
|
||||
"http://bucket.s3.example.test"
|
||||
} else {
|
||||
"http://s3.example.test/bucket"
|
||||
};
|
||||
for presigned in [false, true] {
|
||||
let (service, probe) = service(virtual_host);
|
||||
for path in ["", "/", "/key"] {
|
||||
for query in [
|
||||
"acl",
|
||||
"acl=",
|
||||
"%61cl",
|
||||
"a%63l=anything",
|
||||
"acl&acl=",
|
||||
"acl&versionId=version-1",
|
||||
"acl&tagging",
|
||||
"acl&uploadId=upload-1",
|
||||
] {
|
||||
let uri = format!("{base}{path}?{query}");
|
||||
let (status, body) = response(&service, signed_request(Method::DELETE, &uri, presigned, "test-secret")).await;
|
||||
assert_eq!(status, StatusCode::METHOD_NOT_ALLOWED, "{uri}: {body}");
|
||||
assert!(body.contains("<Code>MethodNotAllowed</Code>"), "{uri}: {body}");
|
||||
}
|
||||
let operation = if path == "/key" { "DeleteObject" } else { "DeleteBucket" };
|
||||
let uri = format!("{base}{path}?acl&x-id={operation}");
|
||||
let (status, body) = response(&service, signed_request(Method::DELETE, &uri, presigned, "test-secret")).await;
|
||||
assert_eq!(status, StatusCode::METHOD_NOT_ALLOWED, "{uri}: {body}");
|
||||
}
|
||||
assert!(
|
||||
probe.0.lock().expect("probe state").calls.is_empty(),
|
||||
"refused requests must not reach S3 handlers"
|
||||
);
|
||||
let (status, body) =
|
||||
response(&service, signed_request(Method::GET, &format!("{base}/key"), presigned, "test-secret")).await;
|
||||
assert_eq!(status, StatusCode::OK);
|
||||
assert_eq!(body, "original object");
|
||||
let (status, _) =
|
||||
response(&service, signed_request(Method::HEAD, &format!("{base}/"), presigned, "test-secret")).await;
|
||||
assert_eq!(status, StatusCode::OK, "bucket must still exist");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn delete_acl_keeps_signature_verification_before_method_rejection() {
|
||||
let (service, probe) = service(false);
|
||||
for presigned in [false, true] {
|
||||
for query in ["acl", "versionId=version-1"] {
|
||||
let uri = format!("http://s3.example.test/bucket/key?{query}");
|
||||
let (status, body) = response(&service, signed_request(Method::DELETE, &uri, presigned, "wrong-secret")).await;
|
||||
assert_eq!(status, StatusCode::FORBIDDEN);
|
||||
assert!(body.contains("<Code>SignatureDoesNotMatch</Code>"), "{body}");
|
||||
}
|
||||
}
|
||||
assert!(probe.0.lock().expect("probe state").calls.is_empty());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn delete_acl_keeps_supported_s3_operations_and_parameters() {
|
||||
for presigned in [false, true] {
|
||||
for (method, path, operation, parameter) in [
|
||||
(Method::DELETE, "/bucket/key", "DeleteObject", None),
|
||||
(Method::DELETE, "/bucket/key?versionId=version-1", "DeleteObject", Some("version-1")),
|
||||
(
|
||||
Method::DELETE,
|
||||
"/bucket/key?versionId=null&x-id=DeleteObject",
|
||||
"DeleteObject",
|
||||
Some("null"),
|
||||
),
|
||||
(Method::DELETE, "/bucket/key?custom=value&other=acl", "DeleteObject", None),
|
||||
(Method::DELETE, "/bucket/key?ACL&acl-extra&%2561cl", "DeleteObject", None),
|
||||
(
|
||||
Method::DELETE,
|
||||
"/bucket/key?tagging&versionId=version-1",
|
||||
"DeleteObjectTagging",
|
||||
Some("version-1"),
|
||||
),
|
||||
(Method::DELETE, "/bucket/key?uploadId=upload-1", "AbortMultipartUpload", Some("upload-1")),
|
||||
(Method::DELETE, "/bucket", "DeleteBucket", None),
|
||||
(Method::DELETE, "/bucket?policy", "DeleteBucketPolicy", None),
|
||||
(Method::GET, "/bucket/key?acl", "GetObjectAcl", None),
|
||||
(Method::PUT, "/bucket/key?acl", "PutObjectAcl", None),
|
||||
(Method::GET, "/bucket?acl", "GetBucketAcl", None),
|
||||
(Method::PUT, "/bucket?acl", "PutBucketAcl", None),
|
||||
] {
|
||||
let (service, probe) = service(false);
|
||||
let uri = format!("http://s3.example.test{path}");
|
||||
let (status, body) = response(&service, signed_request(method, &uri, presigned, "test-secret")).await;
|
||||
assert!(status.is_success(), "{operation} {uri}: {status} {body}");
|
||||
assert_eq!(probe.0.lock().expect("probe state").calls, [(operation, parameter.map(str::to_owned))]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn delete_acl_preserves_custom_route_matching_and_access() {
|
||||
let (service, probe) = service(false);
|
||||
for presigned in [false, true] {
|
||||
let uri = "http://s3.example.test/custom?acl";
|
||||
let (status, body) = response(&service, signed_request(Method::DELETE, uri, presigned, "test-secret")).await;
|
||||
assert_eq!(status, StatusCode::OK);
|
||||
assert_eq!(body, "custom route");
|
||||
|
||||
let mut denied = signed_request(Method::DELETE, uri, presigned, "test-secret");
|
||||
denied
|
||||
.headers_mut()
|
||||
.insert("x-test-deny", http::HeaderValue::from_static("true"));
|
||||
let (status, body) = response(&service, denied).await;
|
||||
assert_eq!(status, StatusCode::FORBIDDEN);
|
||||
assert!(body.contains("<Code>AccessDenied</Code>"));
|
||||
}
|
||||
assert!(probe.0.lock().expect("probe state").calls.is_empty());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn delete_acl_preserves_sigv2_header_and_query_authentication() {
|
||||
for presigned in [false, true] {
|
||||
for (query, secret, expected_status, expected_code) in [
|
||||
("acl", "test-secret", StatusCode::METHOD_NOT_ALLOWED, Some("MethodNotAllowed")),
|
||||
("acl", "wrong-secret", StatusCode::FORBIDDEN, Some("SignatureDoesNotMatch")),
|
||||
("versionId=version-1", "test-secret", StatusCode::NO_CONTENT, None),
|
||||
] {
|
||||
let (service, probe) = service(false);
|
||||
let date = OffsetDateTime::now_utc()
|
||||
.format(format_description!(
|
||||
"[weekday repr:short], [day] [month repr:short] [year] [hour]:[minute]:[second] GMT"
|
||||
))
|
||||
.expect("format SigV2 HTTP date");
|
||||
let request = Request::builder()
|
||||
.method(Method::DELETE)
|
||||
.uri(format!("http://s3.example.test/bucket/key?{query}"))
|
||||
.header("host", "s3.example.test")
|
||||
.header("content-length", "0")
|
||||
.header("date", date)
|
||||
.body(Body::empty())
|
||||
.expect("SigV2 request");
|
||||
let request = if presigned {
|
||||
let mut request =
|
||||
rustfs_signer::try_pre_sign_v2(request, "test-key", secret, 60, false).expect("presign SigV2 request");
|
||||
let uri = request.uri().to_string();
|
||||
let (prefix, signature) = uri.rsplit_once("&Signature=").expect("SigV2 signature");
|
||||
let encoded = url::form_urlencoded::Serializer::new(String::new())
|
||||
.append_pair("Signature", signature)
|
||||
.finish();
|
||||
*request.uri_mut() = format!("{prefix}&{encoded}").parse().expect("encoded SigV2 URI");
|
||||
request
|
||||
} else {
|
||||
rustfs_signer::try_sign_v2(request, 0, "test-key", secret, false).expect("sign SigV2 request")
|
||||
};
|
||||
let (status, body) = response(&service, request).await;
|
||||
assert_eq!(status, expected_status, "{query}: {body}");
|
||||
if let Some(code) = expected_code {
|
||||
assert!(body.contains(&format!("<Code>{code}</Code>")), "{body}");
|
||||
assert!(probe.0.lock().expect("probe state").calls.is_empty());
|
||||
} else {
|
||||
assert_eq!(probe.0.lock().expect("probe state").calls, [("DeleteObject", Some("version-1".into()))]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn live_delete(
|
||||
env: &crate::common::RustFSTestEnvironment,
|
||||
path: &str,
|
||||
presigned: bool,
|
||||
secret: &str,
|
||||
) -> (StatusCode, String) {
|
||||
let request =
|
||||
signed_request_with_credentials(Method::DELETE, &format!("{}{path}", env.url), presigned, &env.access_key, secret);
|
||||
let response = crate::common::local_http_client()
|
||||
.delete(request.uri().to_string())
|
||||
.headers(request.headers().clone())
|
||||
.send()
|
||||
.await
|
||||
.expect("send signed DELETE to RustFS");
|
||||
let status = response.status();
|
||||
(status, response.text().await.expect("read DELETE response"))
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn delete_acl_admission_through_gateway_edge() {
|
||||
use aws_sdk_s3::primitives::ByteStream;
|
||||
use aws_sdk_s3::types::{BucketVersioningStatus, Tag, Tagging, VersioningConfiguration};
|
||||
|
||||
let mut env = crate::common::RustFSTestEnvironment::new()
|
||||
.await
|
||||
.expect("isolated S3 environment");
|
||||
env.start_rustfs_server_without_cleanup_with_env(&[("RUSTFS_REGION", "us-east-1")])
|
||||
.await
|
||||
.expect("start RustFS");
|
||||
let client = env.create_s3_client();
|
||||
let bucket = "acl-admission";
|
||||
let empty_bucket = "acl-admission-empty";
|
||||
env.create_test_bucket(bucket).await.expect("create object bucket");
|
||||
env.create_test_bucket(empty_bucket).await.expect("create empty bucket");
|
||||
client
|
||||
.put_bucket_versioning()
|
||||
.bucket(bucket)
|
||||
.versioning_configuration(
|
||||
VersioningConfiguration::builder()
|
||||
.status(BucketVersioningStatus::Enabled)
|
||||
.build(),
|
||||
)
|
||||
.send()
|
||||
.await
|
||||
.expect("enable versioning");
|
||||
let object = client
|
||||
.put_object()
|
||||
.bucket(bucket)
|
||||
.key("key")
|
||||
.body(ByteStream::from_static(b"original object"))
|
||||
.send()
|
||||
.await
|
||||
.expect("create preserved object");
|
||||
let version = object.version_id().expect("versioned object ID");
|
||||
let version_query = url::form_urlencoded::Serializer::new(String::new())
|
||||
.append_pair("versionId", version)
|
||||
.finish();
|
||||
// The gateway wire parser refuses escaped parameter names before signature verification.
|
||||
let encoded_path = format!("/{bucket}/key?%61cl&{version_query}");
|
||||
let (status, body) = live_delete(&env, &encoded_path, false, &env.secret_key).await;
|
||||
assert_eq!(status, StatusCode::BAD_REQUEST, "{encoded_path}: {body}");
|
||||
assert!(body.contains("<Code>InvalidArgument</Code>"), "{body}");
|
||||
|
||||
for presigned in [false, true] {
|
||||
// SigV4 canonicalization rejects repeated parameter names before admission.
|
||||
let repeated_path = format!("/{bucket}/key?acl&acl=&tagging");
|
||||
let (status, body) = live_delete(&env, &repeated_path, presigned, &env.secret_key).await;
|
||||
assert_eq!(status, StatusCode::BAD_REQUEST, "{repeated_path}: {body}");
|
||||
assert!(body.contains("<Code>AuthorizationHeaderMalformed</Code>"), "{body}");
|
||||
|
||||
for path in [
|
||||
format!("/{empty_bucket}?acl"),
|
||||
format!("/{bucket}/key?acl&{version_query}"),
|
||||
format!("/{bucket}/key?acl&tagging"),
|
||||
format!("/{bucket}/key?acl&uploadId=upload-1"),
|
||||
] {
|
||||
let (status, body) = live_delete(&env, &path, presigned, &env.secret_key).await;
|
||||
assert_eq!(status, StatusCode::METHOD_NOT_ALLOWED, "{path}: {body}");
|
||||
assert!(body.contains("<Code>MethodNotAllowed</Code>"), "{body}");
|
||||
let (status, body) = live_delete(&env, &path, presigned, "wrong-secret").await;
|
||||
assert_eq!(status, StatusCode::FORBIDDEN, "{path}: {body}");
|
||||
assert!(body.contains("<Code>SignatureDoesNotMatch</Code>"), "{body}");
|
||||
}
|
||||
client
|
||||
.head_bucket()
|
||||
.bucket(empty_bucket)
|
||||
.send()
|
||||
.await
|
||||
.expect("refused DELETE preserves empty bucket");
|
||||
let current = client
|
||||
.get_object()
|
||||
.bucket(bucket)
|
||||
.key("key")
|
||||
.send()
|
||||
.await
|
||||
.expect("refused DELETE leaves the current object readable");
|
||||
assert_eq!(current.version_id(), Some(version));
|
||||
let body = current.body.collect().await.expect("read preserved object").into_bytes();
|
||||
assert_eq!(body.as_ref(), b"original object");
|
||||
|
||||
client
|
||||
.put_object_tagging()
|
||||
.bucket(bucket)
|
||||
.key("key")
|
||||
.version_id(version)
|
||||
.tagging(
|
||||
Tagging::builder()
|
||||
.tag_set(Tag::builder().key("test").value("acl").build().expect("tag"))
|
||||
.build()
|
||||
.expect("tagging"),
|
||||
)
|
||||
.send()
|
||||
.await
|
||||
.expect("set object tags");
|
||||
let path = format!("/{bucket}/key?tagging&{version_query}");
|
||||
let (status, body) = live_delete(&env, &path, presigned, &env.secret_key).await;
|
||||
assert!(status.is_success(), "{path}: {body}");
|
||||
let tags = client
|
||||
.get_object_tagging()
|
||||
.bucket(bucket)
|
||||
.key("key")
|
||||
.version_id(version)
|
||||
.send()
|
||||
.await
|
||||
.expect("read cleared tags");
|
||||
assert!(tags.tag_set().is_empty());
|
||||
|
||||
let upload = client
|
||||
.create_multipart_upload()
|
||||
.bucket(bucket)
|
||||
.key("upload")
|
||||
.send()
|
||||
.await
|
||||
.expect("start multipart upload");
|
||||
let query = url::form_urlencoded::Serializer::new(String::new())
|
||||
.append_pair("uploadId", upload.upload_id().expect("upload ID"))
|
||||
.finish();
|
||||
let path = format!("/{bucket}/upload?{query}");
|
||||
let (status, body) = live_delete(&env, &path, presigned, &env.secret_key).await;
|
||||
assert!(status.is_success(), "{path}: {body}");
|
||||
let uploads = client
|
||||
.list_multipart_uploads()
|
||||
.bucket(bucket)
|
||||
.send()
|
||||
.await
|
||||
.expect("list remaining uploads");
|
||||
assert!(uploads.uploads().is_empty());
|
||||
}
|
||||
let path = format!("/{bucket}/key?{version_query}");
|
||||
let (status, body) = live_delete(&env, &path, false, &env.secret_key).await;
|
||||
assert_eq!(status, StatusCode::NO_CONTENT, "{path}: {body}");
|
||||
let versions = client
|
||||
.list_object_versions()
|
||||
.bucket(bucket)
|
||||
.send()
|
||||
.await
|
||||
.expect("list remaining versions");
|
||||
assert!(versions.versions().is_empty());
|
||||
let (status, body) = live_delete(&env, &format!("/{empty_bucket}"), false, &env.secret_key).await;
|
||||
assert_eq!(status, StatusCode::NO_CONTENT, "{body}");
|
||||
env.stop_server();
|
||||
}
|
||||
@@ -34,10 +34,7 @@
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::common::{
|
||||
AdminTransport, RustFSTestEnvironment, admin_attach_user_policy_via, admin_create_user, admin_request_with_session_token,
|
||||
init_logging, local_http_client, parse_assume_role_credentials,
|
||||
};
|
||||
use crate::common::{RustFSTestEnvironment, init_logging, local_http_client};
|
||||
use hmac::{Hmac, KeyInit as _, Mac};
|
||||
use http::header::HOST;
|
||||
use rustfs_s3_types::Body;
|
||||
@@ -399,54 +396,6 @@ mod tests {
|
||||
let (status, _) = signed_request(&env.url, http::Method::GET, ACCOUNT_INFO_PATH, None, user_ak, old_sk).await?;
|
||||
assert!(status.is_client_error(), "the old secret must stop working, status: {status}");
|
||||
|
||||
env.stop_server();
|
||||
drop(env);
|
||||
console_session_rotates_the_iam_password_and_revokes_the_old_session().await
|
||||
}
|
||||
|
||||
async fn console_session_rotates_the_iam_password_and_revokes_the_old_session() -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||
init_logging();
|
||||
let mut env = RustFSTestEnvironment::new().await?;
|
||||
env.start_rustfs_server(vec![]).await?;
|
||||
|
||||
let user = "console-password-user";
|
||||
let old_password = uuid::Uuid::new_v4().to_string();
|
||||
let new_password = uuid::Uuid::new_v4().to_string();
|
||||
admin_create_user(&env, user, &old_password).await?;
|
||||
admin_attach_user_policy_via(AdminTransport::Signed, &env.url, &env.access_key, &env.secret_key, "readonly", user)
|
||||
.await?;
|
||||
|
||||
let (status, response) = assume_role(&env.url, user, &old_password, None).await?;
|
||||
assert_eq!(status, reqwest::StatusCode::OK, "the current password must sign in");
|
||||
let (session_key, session_secret, token) = parse_assume_role_credentials(&response)?;
|
||||
let session_request = |method, path, body| {
|
||||
admin_request_with_session_token(&env.url, method, path, body, &session_key, &session_secret, Some(&token))
|
||||
};
|
||||
let password_request = |current: &str| {
|
||||
Some(serde_json::json!({ "current_secret_key": current, "new_secret_key": new_password }).to_string())
|
||||
};
|
||||
|
||||
let (status, body) =
|
||||
session_request(http::Method::POST, ACCOUNT_PASSWORD_PATH, password_request(&session_secret)).await?;
|
||||
assert_eq!(
|
||||
status,
|
||||
reqwest::StatusCode::BAD_REQUEST,
|
||||
"the session secret must not be accepted as the IAM password"
|
||||
);
|
||||
assert!(body.contains("InvalidRequest") && body.contains("the current secret key is incorrect"));
|
||||
|
||||
let (status, body) = session_request(http::Method::POST, ACCOUNT_PASSWORD_PATH, password_request(&old_password)).await?;
|
||||
assert_eq!(status, reqwest::StatusCode::OK, "the same session must accept the current IAM password");
|
||||
assert_eq!(serde_json::from_str::<serde_json::Value>(&body)?["sessions_revoked"], 1);
|
||||
|
||||
let (status, _) = session_request(http::Method::GET, ACCOUNT_INFO_PATH, None).await?;
|
||||
assert_eq!(status, reqwest::StatusCode::FORBIDDEN, "the pre-rotation session must be revoked");
|
||||
let (status, _) = assume_role(&env.url, user, &old_password, None).await?;
|
||||
assert_eq!(status, reqwest::StatusCode::FORBIDDEN, "the old password must no longer sign in");
|
||||
let (status, response) = assume_role(&env.url, user, &new_password, None).await?;
|
||||
assert_eq!(status, reqwest::StatusCode::OK, "the new password must sign in");
|
||||
parse_assume_role_credentials(&response)?;
|
||||
|
||||
env.stop_server();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
//! not an EIO-returning half-dead disk.
|
||||
//! - [`DiskFaultHarness::bring_disk_online`] restores the renamed directory.
|
||||
//! If the server recreated a skeleton directory at the original path in the
|
||||
//! meantime, the skeleton is moved aside for cleanup with the test root.
|
||||
//! meantime, the skeleton is discarded first.
|
||||
//! - [`DiskFaultHarness::replace_disk_with_empty`] retires the directory and
|
||||
//! creates a fresh empty one, simulating a fresh-disk replacement that the
|
||||
//! server should detect as unformatted and heal.
|
||||
@@ -43,7 +43,6 @@ use rustfs_signer::sign_v4;
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::error::Error;
|
||||
use std::io::ErrorKind;
|
||||
use std::path::{Path, PathBuf};
|
||||
use tracing::info;
|
||||
use uuid::Uuid;
|
||||
@@ -228,31 +227,19 @@ impl DiskFaultHarness {
|
||||
}
|
||||
|
||||
/// Restore a disk previously taken offline with [`Self::take_disk_offline`].
|
||||
pub fn bring_disk_online(&mut self, disk_index: usize) -> ChaosResult<()> {
|
||||
pub fn bring_disk_online(&self, disk_index: usize) -> ChaosResult<()> {
|
||||
let disk = &self.disks[disk_index];
|
||||
let offline = self.offline_path(disk_index);
|
||||
if !offline.exists() {
|
||||
return Err(format!("disk {disk_index} is not offline").into());
|
||||
}
|
||||
// A degraded write may recreate the target even while it is being cleared.
|
||||
// Move that tree aside atomically and leave its cleanup to the test root.
|
||||
let mut displaced = 0;
|
||||
loop {
|
||||
match std::fs::rename(&offline, disk) {
|
||||
Ok(()) => break,
|
||||
Err(error)
|
||||
if displaced < 8
|
||||
&& (matches!(error.kind(), ErrorKind::DirectoryNotEmpty | ErrorKind::AlreadyExists)
|
||||
|| (cfg!(windows) && error.kind() == ErrorKind::PermissionDenied && disk.is_dir())) => {}
|
||||
Err(error) => return Err(error.into()),
|
||||
}
|
||||
displaced += 1;
|
||||
let retired = self.root.join(format!("disk{disk_index}.recreated-{}", Uuid::new_v4()));
|
||||
match std::fs::rename(disk, retired) {
|
||||
Err(error) if error.kind() == ErrorKind::NotFound => continue,
|
||||
result => result?,
|
||||
}
|
||||
// The running server may have recreated a skeleton directory at the
|
||||
// original path (e.g. via degraded writes); discard it before
|
||||
// restoring the original data.
|
||||
if disk.exists() {
|
||||
std::fs::remove_dir_all(disk)?;
|
||||
}
|
||||
std::fs::rename(&offline, disk)?;
|
||||
info!("Brought disk {} back online: {:?}", disk_index, disk);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -49,15 +49,6 @@ use uuid::Uuid;
|
||||
// Common constants for all E2E tests
|
||||
pub const DEFAULT_ACCESS_KEY: &str = "rustfsadmin";
|
||||
pub const DEFAULT_SECRET_KEY: &str = "rustfsadmin";
|
||||
|
||||
fn fixture_access_key(default: &str) -> String {
|
||||
if std::env::var("RUSTFS_CORPUS_RECORD").as_deref() == Ok("1") {
|
||||
"rustfsadmin-ci".to_owned()
|
||||
} else {
|
||||
default.to_owned()
|
||||
}
|
||||
}
|
||||
|
||||
pub const ENV_RUSTFS_BUILD_FEATURES: &str = "RUSTFS_BUILD_FEATURES";
|
||||
pub(crate) const FAST_DATA_USAGE_SCANNER_ENV: &[(&str, &str)] =
|
||||
&[("RUSTFS_SCANNER_CYCLE", "1"), ("RUSTFS_SCANNER_START_DELAY_SECS", "0")];
|
||||
@@ -641,7 +632,7 @@ impl RustFSTestEnvironment {
|
||||
temp_dir,
|
||||
address,
|
||||
url,
|
||||
access_key: fixture_access_key(DEFAULT_ACCESS_KEY),
|
||||
access_key: DEFAULT_ACCESS_KEY.to_string(),
|
||||
secret_key: DEFAULT_SECRET_KEY.to_string(),
|
||||
process: None,
|
||||
capture_log_path,
|
||||
@@ -660,7 +651,7 @@ impl RustFSTestEnvironment {
|
||||
temp_dir,
|
||||
address: address.to_string(),
|
||||
url,
|
||||
access_key: fixture_access_key(DEFAULT_ACCESS_KEY),
|
||||
access_key: DEFAULT_ACCESS_KEY.to_string(),
|
||||
secret_key: DEFAULT_SECRET_KEY.to_string(),
|
||||
process: None,
|
||||
capture_log_path,
|
||||
@@ -1044,7 +1035,8 @@ pub async fn execute_awscurl(
|
||||
|
||||
/// `POST` with SigV4 `--service sts` and explicit `Content-Type: application/x-www-form-urlencoded`.
|
||||
///
|
||||
/// RustFS uses this content type to recognize an STS query on `POST /`.
|
||||
/// RustFS `AssumeRole` is handled on `POST /` by the admin router; `is_match` requires this
|
||||
/// content type so s3s routes to the custom handler instead of `Unknown operation`.
|
||||
pub async fn awscurl_post_sts_form_urlencoded(
|
||||
url: &str,
|
||||
body: &str,
|
||||
@@ -1421,7 +1413,7 @@ impl RustFSTestClusterEnvironment {
|
||||
Ok(Self {
|
||||
nodes,
|
||||
temp_dir,
|
||||
access_key: fixture_access_key("rustfs-cluster-test-access"),
|
||||
access_key: "rustfs-cluster-test-access".to_string(),
|
||||
secret_key: "rustfs-cluster-test-secret".to_string(),
|
||||
extra_env,
|
||||
node_extra_env: vec![Vec::new(); topology.node_count],
|
||||
@@ -2542,7 +2534,7 @@ mod tests {
|
||||
RustFSTestClusterEnvironment {
|
||||
nodes,
|
||||
temp_dir,
|
||||
access_key: fixture_access_key(DEFAULT_ACCESS_KEY),
|
||||
access_key: DEFAULT_ACCESS_KEY.to_string(),
|
||||
secret_key: DEFAULT_SECRET_KEY.to_string(),
|
||||
extra_env: Vec::new(),
|
||||
node_extra_env: vec![Vec::new(); topology.node_count],
|
||||
|
||||
@@ -366,13 +366,13 @@ mod tests {
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Principal": "*",
|
||||
"Action": ["s3:PutObject", "s3:PutObjectTagging"],
|
||||
"Action": ["s3:PutObject"],
|
||||
"Resource": [format!("arn:aws:s3:::{destination_bucket}/*")]
|
||||
},
|
||||
{
|
||||
"Effect": "Deny",
|
||||
"Principal": "*",
|
||||
"Action": ["s3:PutObject", "s3:PutObjectTagging"],
|
||||
"Action": ["s3:PutObject"],
|
||||
"Resource": [format!("arn:aws:s3:::{destination_bucket}/*")],
|
||||
"Condition": {
|
||||
"StringEquals": {
|
||||
|
||||
@@ -21,8 +21,23 @@
|
||||
//! when it fails to parse (`amztime.ParseHeader` error is swallowed), so the copy
|
||||
//! proceeds.
|
||||
//!
|
||||
//! The RustFS gateway profile rejects unreadable conditional dates before the copy handler runs.
|
||||
//! The signed requests below pin both the successful copy and the HTTP 400 `InvalidArgument` response.
|
||||
//! RustFS routes S3 through the `s3s` crate, which models the copy-source
|
||||
//! conditional-date headers as typed `Timestamp` fields and rejects an
|
||||
//! unparsable value with `400 InvalidArgument` during request deserialization —
|
||||
//! this happens *after* SigV4 verification but *before* the RustFS `CopyObject`
|
||||
//! handler runs. Because the header is part of the client's `SignedHeaders`, the
|
||||
//! value cannot be stripped or rewritten by a pre-`s3s` layer without breaking the
|
||||
//! signature, and `s3s` exposes no hook between auth and typed deserialization.
|
||||
//! Matching MinIO's tolerant behavior therefore requires a change in `s3s`
|
||||
//! (lenient parsing of conditional-date headers). See the PR description for
|
||||
//! details.
|
||||
//!
|
||||
//! This test pins the two ends of the current behavior:
|
||||
//! * a *valid* HTTP-date copy-source conditional header is accepted and the copy
|
||||
//! succeeds (the common, real-SDK path), and
|
||||
//! * an *invalid* date value is rejected with `400 InvalidArgument` at the `s3s`
|
||||
//! layer (the documented gap). When `s3s` gains lenient parsing, the second
|
||||
//! assertion should be flipped to expect a successful copy.
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
@@ -86,7 +101,7 @@ mod tests {
|
||||
|
||||
let copy_source = format!("/{bucket}/src.txt");
|
||||
|
||||
// A valid future HTTP-date allows the copy.
|
||||
// A valid future HTTP-date is accepted by s3s and the copy succeeds.
|
||||
let (status, body) = signed_copy(
|
||||
&env.url,
|
||||
&format!("/{bucket}/dst-valid.txt"),
|
||||
@@ -99,7 +114,10 @@ mod tests {
|
||||
assert_eq!(status, reqwest::StatusCode::OK, "valid copy-source date must succeed: {body}");
|
||||
assert!(body.contains("CopyObjectResult"), "expected CopyObjectResult XML: {body}");
|
||||
|
||||
// The signed header reaches the RustFS profile's conditional-date check unchanged.
|
||||
// An unparsable date ("Invalid Date") is currently rejected by s3s at the
|
||||
// deserialization layer with 400 InvalidArgument. This documents the s3s
|
||||
// limitation described in backlog#618 item 8. When s3s parses these headers
|
||||
// leniently (matching MinIO), this should become a successful copy.
|
||||
let (status, body) = signed_copy(
|
||||
&env.url,
|
||||
&format!("/{bucket}/dst-invalid.txt"),
|
||||
@@ -112,7 +130,7 @@ mod tests {
|
||||
assert_eq!(
|
||||
status,
|
||||
reqwest::StatusCode::BAD_REQUEST,
|
||||
"expected the signed invalid date to be rejected (backlog#618): {body}"
|
||||
"invalid copy-source date currently rejected by s3s (backlog#618): {body}"
|
||||
);
|
||||
assert!(body.contains("InvalidArgument"), "expected InvalidArgument for invalid date: {body}");
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ mod replication_delete_marker_test;
|
||||
mod replication_quota_test;
|
||||
mod s3_basic_test;
|
||||
mod s3_during_data_movement_test;
|
||||
mod scanner_cluster_observation_test;
|
||||
mod scanner_heal_topology_fixture;
|
||||
mod scanner_heal_topology_test;
|
||||
mod scanner_heal_topology_tier_test;
|
||||
|
||||
@@ -159,7 +159,6 @@ async fn four_node_health_inventory_metrics_and_audit_delivery_are_consistent()
|
||||
|
||||
let info_body = cluster_admin_ok(&dist.cluster, Method::GET, "/rustfs/admin/v3/info", None).await?;
|
||||
let info: Value = serde_json::from_str(&info_body)?;
|
||||
assert!(info.get("inventory").is_none(), "inventory requires explicit opt-in");
|
||||
let servers = info["info"]["servers"]
|
||||
.as_array()
|
||||
.ok_or_else(|| format!("admin info omitted servers: {info}"))?;
|
||||
@@ -201,24 +200,6 @@ async fn four_node_health_inventory_metrics_and_audit_delivery_are_consistent()
|
||||
assert!(sample.finally, "node {node_idx} metrics sample was not terminal");
|
||||
assert!(sample.errors.is_empty(), "node {node_idx} metrics reported errors: {:?}", sample.errors);
|
||||
assert!(!sample.hosts.is_empty(), "node {node_idx} metrics omitted hosts");
|
||||
assert!(sample.scanner_node.is_none(), "default metrics must not expose the internal peer sample");
|
||||
wait_until(
|
||||
Duration::from_secs(30),
|
||||
|| async {
|
||||
let frame: Value = serde_json::from_str(
|
||||
&node_admin_body(&dist, node_idx, "/rustfs/admin/v3/realtime?scope=cluster&types=1&n=1").await?,
|
||||
)?;
|
||||
assert_eq!(frame["final"], true);
|
||||
let summary = &frame["cluster_scanner"];
|
||||
assert_eq!(summary["nodes_total"], 4, "known cluster membership");
|
||||
assert!(summary["sampled_at"].as_str().is_some());
|
||||
assert!(matches!(summary["state"].as_str(), Some("scanning" | "idle" | "unknown")));
|
||||
assert_eq!(summary["current"].is_object(), summary["state"] == "scanning");
|
||||
Ok(summary["nodes_responded"] == 4)
|
||||
},
|
||||
"every request node reaches the full scanner peer set",
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
let targets_body = cluster_admin_ok(&dist.cluster, Method::GET, "/rustfs/admin/v3/audit/target/list", None).await?;
|
||||
@@ -253,38 +234,6 @@ async fn four_node_health_inventory_metrics_and_audit_delivery_are_consistent()
|
||||
"audit entry leaked the root secret key"
|
||||
);
|
||||
|
||||
let pending = unique_bucket("inventory");
|
||||
dist.create_bucket(&pending).await?;
|
||||
let listed = dist.client(1)?.list_buckets().send().await?;
|
||||
assert_eq!(listed.buckets().len(), 2, "expected the two test buckets");
|
||||
wait_until(
|
||||
Duration::from_secs(30),
|
||||
|| async {
|
||||
let body = node_admin_body(&dist, 1, "/rustfs/admin/v3/info?include=inventory").await?;
|
||||
let response: Value = serde_json::from_str(&body)?;
|
||||
let inventory: rustfs_madmin::ClusterInventory = serde_json::from_value(response["inventory"].clone())?;
|
||||
if inventory.current_buckets != Some(2) {
|
||||
return Ok(false);
|
||||
}
|
||||
match inventory.measured_buckets {
|
||||
None | Some(0) => {
|
||||
assert_eq!(inventory.measured_objects, None);
|
||||
assert_eq!(inventory.measured_bytes, None);
|
||||
}
|
||||
Some(1 | 2) => {
|
||||
assert!(inventory.measured_objects.is_some_and(|objects| objects <= 1));
|
||||
}
|
||||
Some(count) => panic!("measured {count} buckets across a two-bucket namespace"),
|
||||
}
|
||||
if inventory.measured_buckets != Some(2) {
|
||||
assert_ne!(inventory.converged, Some(true));
|
||||
}
|
||||
Ok(true)
|
||||
},
|
||||
"inventory reflects the current namespace and reports scanner coverage independently",
|
||||
)
|
||||
.await?;
|
||||
|
||||
let result = verify_write_observations_during_peer_failure(&dist, &bucket).await;
|
||||
collector.abort();
|
||||
result
|
||||
|
||||
@@ -1,111 +0,0 @@
|
||||
// Copyright 2026 RustFS Team
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use super::harness::{NODE_COUNT, TestResult, wait_until};
|
||||
use super::scanner_peer_bucket_fixture::PeerBucketRun;
|
||||
use crate::common::init_logging;
|
||||
use futures::future::try_join_all;
|
||||
use serde_json::Value;
|
||||
use std::time::Duration;
|
||||
use time::OffsetDateTime;
|
||||
use time::format_description::well_known::Rfc3339;
|
||||
|
||||
const CLUSTER_SCANNER: &str = "/rustfs/admin/v3/realtime?n=1&types=1&scope=cluster";
|
||||
const OBSERVATION_TIMEOUT: Duration = Duration::from_secs(35);
|
||||
|
||||
async fn scanner_frames(run: &PeerBucketRun) -> TestResult<Vec<Value>> {
|
||||
try_join_all((0..NODE_COUNT).map(|node| run.admin_json(node, CLUSTER_SCANNER))).await
|
||||
}
|
||||
|
||||
fn full_sample(frame: &Value) -> bool {
|
||||
frame["final"] == true
|
||||
&& frame["cluster_scanner"]["nodes_total"] == NODE_COUNT
|
||||
&& frame["cluster_scanner"]["nodes_responded"] == NODE_COUNT
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn followers_report_the_coordinators_active_progress_and_committed_completion() -> TestResult {
|
||||
init_logging();
|
||||
let mut run = PeerBucketRun::start("cluster-scanner-observation").await?;
|
||||
let baseline = run.quiet_baseline().await?;
|
||||
let leader = run.leader().await?;
|
||||
let pid = run.pid(leader)?;
|
||||
let hot = run.buckets[2].clone();
|
||||
run.barrier.arm("before_start_snapshot", pid, None)?;
|
||||
run.barrier.start_session(&run.buckets)?;
|
||||
// All four child processes and the harness use the same host clock.
|
||||
let written_after = OffsetDateTime::now_utc();
|
||||
run.put(leader, &hot, "wake-cluster-observation", 149).await?;
|
||||
|
||||
let start = run.barrier.wait_stage("before_start_snapshot", pid, None, true).await?;
|
||||
let epoch = start["detail"]["epoch"].as_u64().ok_or("start gate omitted epoch")?;
|
||||
let cycle = start["detail"]["cycle"].as_u64().ok_or("start gate omitted cycle")?;
|
||||
if baseline.scanner_epoch != Some(epoch) || baseline.scanner_cycle.is_none_or(|previous| previous >= cycle) {
|
||||
return Err("controlled cycle did not follow the quiet baseline under the same coordinator".into());
|
||||
}
|
||||
run.barrier.arm("root_durable", pid, Some((epoch, cycle)))?;
|
||||
run.barrier.release("before_start_snapshot", pid)?;
|
||||
run.barrier
|
||||
.wait_stage("root_durable", pid, Some((epoch, cycle)), true)
|
||||
.await?;
|
||||
|
||||
// The leader is held after the real walk and before committing its cycle completion.
|
||||
// Each ingress node maintains its own short-lived cluster sample cache.
|
||||
let expected_leader = &run.dist.cluster.nodes[leader].url;
|
||||
let active = wait_until(
|
||||
OBSERVATION_TIMEOUT,
|
||||
|| async {
|
||||
let frames = scanner_frames(&run).await?;
|
||||
let started = frames[leader]["cluster_scanner"]["current"]["started_at"].as_str();
|
||||
let consistent = started.is_some()
|
||||
&& frames.iter().all(|frame| {
|
||||
let summary = &frame["cluster_scanner"];
|
||||
let current = &summary["current"];
|
||||
full_sample(frame)
|
||||
&& summary["state"] == "scanning"
|
||||
&& current["cycle"] == cycle
|
||||
&& current["leader"].as_str() == Some(expected_leader.as_str())
|
||||
&& current["started_at"].as_str() == started
|
||||
&& current["objects_scanned"].as_u64().is_some_and(|objects| objects > 0)
|
||||
});
|
||||
if !consistent {
|
||||
tracing::info!(
|
||||
?frames,
|
||||
cycle,
|
||||
expected_leader,
|
||||
"waiting for active scanner progress on every ingress node"
|
||||
);
|
||||
}
|
||||
Ok(consistent)
|
||||
},
|
||||
"leader and all three followers report the identified active cycle with nonzero work",
|
||||
)
|
||||
.await;
|
||||
run.barrier.disarm()?;
|
||||
run.barrier.release("root_durable", pid)?;
|
||||
active?;
|
||||
|
||||
wait_until(
|
||||
OBSERVATION_TIMEOUT,
|
||||
|| async {
|
||||
let frames = scanner_frames(&run).await?;
|
||||
let settled = frames.iter().all(|frame| {
|
||||
let summary = &frame["cluster_scanner"];
|
||||
full_sample(frame)
|
||||
&& summary["state"] == "idle"
|
||||
&& summary.get("current").is_none()
|
||||
&& summary["last_attempt"]["cycle"] == cycle
|
||||
&& summary["last_attempt"]["result"] == "success"
|
||||
&& summary["last_success_at"].as_str().is_some_and(|value| {
|
||||
OffsetDateTime::parse(value, &Rfc3339).is_ok_and(|completed| completed >= written_after)
|
||||
})
|
||||
});
|
||||
if !settled {
|
||||
tracing::info!(?frames, cycle, "waiting for the controlled scanner cycle to finish");
|
||||
}
|
||||
Ok(settled)
|
||||
},
|
||||
"every ingress node reports the completed cycle and an idle cluster scanner",
|
||||
)
|
||||
.await
|
||||
}
|
||||
@@ -20,7 +20,6 @@
|
||||
//! corpus, not here. The comparator is pure so it can be tested without a server.
|
||||
|
||||
use serde::Serialize;
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
@@ -70,9 +69,6 @@ pub(crate) struct Observation {
|
||||
pub error_code: Option<String>,
|
||||
/// Allowlisted headers only, lowercase names, normalized values.
|
||||
pub headers: BTreeMap<String, String>,
|
||||
/// Captured before SDK response interceptors can rewrite the response.
|
||||
#[serde(skip)]
|
||||
pub(super) wire_head: Option<WireHead>,
|
||||
/// Typed values decoded from the response body, never free text.
|
||||
pub fields: BTreeMap<String, String>,
|
||||
/// Diagnostic only; never compared.
|
||||
@@ -91,10 +87,10 @@ impl Observation {
|
||||
) -> Self {
|
||||
let headers = headers
|
||||
.into_iter()
|
||||
.filter_map(|(name, value)| {
|
||||
let name = compared_header(name)?;
|
||||
.filter_map(|(name, value)| compared_header(name).map(|name| (name, value)))
|
||||
.map(|(name, value)| {
|
||||
let value = normalized_header_value(&name, value);
|
||||
Some((name, value))
|
||||
(name, value)
|
||||
})
|
||||
.collect();
|
||||
Self {
|
||||
@@ -103,7 +99,6 @@ impl Observation {
|
||||
status,
|
||||
error_code,
|
||||
headers,
|
||||
wire_head: None,
|
||||
fields: BTreeMap::new(),
|
||||
message: None,
|
||||
}
|
||||
@@ -129,106 +124,6 @@ pub(crate) struct Difference {
|
||||
pub b: String,
|
||||
}
|
||||
|
||||
/// Whether side A is the same binary under test or a pinned released reference binary.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum ComparisonMode {
|
||||
SameBinary,
|
||||
Reference,
|
||||
}
|
||||
|
||||
/// A maintainer-signed behavior change between a released reference binary (side A) and the
|
||||
/// current candidate binary (side B).
|
||||
///
|
||||
/// Exemptions apply only in [`ComparisonMode::Reference`] and must match the exact
|
||||
/// `(op, case, field, a, b)` tuple with no other unruled difference on the same `(op, case)`.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(crate) struct AcceptedChange {
|
||||
pub op: &'static str,
|
||||
pub case: &'static str,
|
||||
pub field: &'static str,
|
||||
pub reference_value: &'static str,
|
||||
pub candidate_value: &'static str,
|
||||
pub ruling: &'static str,
|
||||
}
|
||||
|
||||
impl AcceptedChange {
|
||||
pub(crate) fn matches(&self, diff: &Difference) -> bool {
|
||||
diff.op == self.op
|
||||
&& diff.case == self.case
|
||||
&& diff.field == self.field
|
||||
&& diff.a == self.reference_value
|
||||
&& diff.b == self.candidate_value
|
||||
}
|
||||
}
|
||||
|
||||
/// Maintainer-signed accepted differences for external reference-binary parity runs.
|
||||
pub(crate) const ACCEPTED_REFERENCE_CHANGES: &[AcceptedChange] = &[
|
||||
// Signed off in rustfs/backlog#2684#issuecomment-7163283798:
|
||||
// Commit 8f81762a6 aligned PutBucketPolicy on malformed JSON with AWS S3 (`400 MalformedPolicy`)
|
||||
// instead of official 1.0.5's `400 InvalidArgument`.
|
||||
AcceptedChange {
|
||||
op: "PutBucketPolicy",
|
||||
case: "negative",
|
||||
field: "error_code",
|
||||
reference_value: "InvalidArgument",
|
||||
candidate_value: "MalformedPolicy",
|
||||
ruling: "rustfs/backlog#2684#issuecomment-7163283798 (commit 8f81762a6)",
|
||||
},
|
||||
];
|
||||
|
||||
/// One difference explicitly exempted by an [`AcceptedChange`] ruling in reference mode.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
|
||||
pub(crate) struct AcceptedDifference {
|
||||
#[serde(flatten)]
|
||||
pub difference: Difference,
|
||||
pub ruling: String,
|
||||
}
|
||||
|
||||
/// Separates raw differences into unruled failures and maintainer-signed accepted changes.
|
||||
///
|
||||
/// Accepted changes are evaluated only in [`ComparisonMode::Reference`]. In
|
||||
/// [`ComparisonMode::SameBinary`], every difference stays unruled even when rules are supplied.
|
||||
/// Evaluation is also atomic per `(op, case)`: if any field of a case has an unruled difference
|
||||
/// (for example, `status` also differs), no field on that case is accepted.
|
||||
pub(crate) fn partition_differences(
|
||||
raw: Vec<Difference>,
|
||||
mode: ComparisonMode,
|
||||
accepted_changes: &[AcceptedChange],
|
||||
) -> (Vec<Difference>, Vec<AcceptedDifference>) {
|
||||
if mode != ComparisonMode::Reference || accepted_changes.is_empty() {
|
||||
return (raw, Vec::new());
|
||||
}
|
||||
let matched: Vec<Option<&AcceptedChange>> = raw
|
||||
.iter()
|
||||
.map(|diff| accepted_changes.iter().find(|rule| rule.matches(diff)))
|
||||
.collect();
|
||||
let unruled_cases: BTreeSet<(&str, &str)> = raw
|
||||
.iter()
|
||||
.zip(&matched)
|
||||
.filter_map(|(diff, rule)| rule.is_none().then_some((diff.op.as_str(), diff.case.as_str())))
|
||||
.collect();
|
||||
let rulings: Vec<Option<&'static str>> = raw
|
||||
.iter()
|
||||
.zip(&matched)
|
||||
.map(|(diff, rule)| {
|
||||
rule.filter(|_| !unruled_cases.contains(&(diff.op.as_str(), diff.case.as_str())))
|
||||
.map(|rule| rule.ruling)
|
||||
})
|
||||
.collect();
|
||||
let mut unruled = Vec::new();
|
||||
let mut accepted = Vec::new();
|
||||
for (diff, ruling) in raw.into_iter().zip(rulings) {
|
||||
match ruling {
|
||||
Some(ruling) => accepted.push(AcceptedDifference {
|
||||
difference: diff,
|
||||
ruling: ruling.to_owned(),
|
||||
}),
|
||||
None => unruled.push(diff),
|
||||
}
|
||||
}
|
||||
(unruled, accepted)
|
||||
}
|
||||
|
||||
/// Every difference between two transcripts of the same script, matched by `(op, case)`.
|
||||
pub(crate) fn compare(a: &[Observation], b: &[Observation]) -> Vec<Difference> {
|
||||
let mut differences = Vec::new();
|
||||
@@ -330,65 +225,6 @@ pub(crate) fn compared_cases(a: &[Observation], b: &[Observation]) -> usize {
|
||||
.count()
|
||||
}
|
||||
|
||||
/// Status and the digest of unique header names at the transport boundary. Header values are never retained.
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
pub(super) struct WireHead {
|
||||
status: u16,
|
||||
header_names_sha256: String,
|
||||
}
|
||||
|
||||
impl WireHead {
|
||||
pub(super) fn new<'h>(status: u16, names: impl Iterator<Item = &'h str>) -> Self {
|
||||
let names: BTreeSet<_> = names.map(str::to_ascii_lowercase).collect();
|
||||
let mut digest = Sha256::new();
|
||||
for name in names {
|
||||
digest.update(name.as_bytes());
|
||||
digest.update(b"\n");
|
||||
}
|
||||
Self {
|
||||
status,
|
||||
header_names_sha256: hex_simd::encode_to_string(digest.finalize(), hex_simd::AsciiCase::Lower),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Evidence for one transmitted response, including cases where the two sides agreed.
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(super) struct ResponseReceipt {
|
||||
op: &'static str,
|
||||
case: &'static str,
|
||||
#[serde(flatten)]
|
||||
head: WireHead,
|
||||
}
|
||||
|
||||
pub(super) fn response_receipts(observations: &[Observation]) -> Vec<ResponseReceipt> {
|
||||
observations
|
||||
.iter()
|
||||
.filter_map(|o| {
|
||||
Some(ResponseReceipt {
|
||||
op: o.op,
|
||||
case: o.case,
|
||||
head: o.wire_head.clone()?,
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(super) struct PairedReceipts {
|
||||
responses_a: Vec<ResponseReceipt>,
|
||||
responses_b: Vec<ResponseReceipt>,
|
||||
}
|
||||
|
||||
impl PairedReceipts {
|
||||
pub(super) fn new(a: &[Observation], b: &[Observation]) -> Self {
|
||||
Self {
|
||||
responses_a: response_receipts(a),
|
||||
responses_b: response_receipts(b),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The JSON report written for every run.
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(crate) struct Report {
|
||||
@@ -407,9 +243,6 @@ pub(crate) struct Report {
|
||||
pub compared_ops: usize,
|
||||
pub compared_cases: usize,
|
||||
pub differences: Vec<Difference>,
|
||||
pub accepted_differences: Vec<AcceptedDifference>,
|
||||
#[serde(flatten)]
|
||||
pub(super) responses: PairedReceipts,
|
||||
}
|
||||
|
||||
impl Report {
|
||||
@@ -432,18 +265,6 @@ pub(crate) fn render(differences: &[Difference]) -> String {
|
||||
.join("\n")
|
||||
}
|
||||
|
||||
/// One line per accepted difference, for run diagnostics.
|
||||
pub(crate) fn render_accepted(differences: &[AcceptedDifference]) -> String {
|
||||
differences
|
||||
.iter()
|
||||
.map(|entry| {
|
||||
let d = &entry.difference;
|
||||
format!("({}, {}, {}, a={:?}, b={:?}, ruling={:?})", d.op, d.case, d.field, d.a, d.b, entry.ruling)
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -664,20 +485,6 @@ mod tests {
|
||||
#[test]
|
||||
fn the_report_lists_each_difference_as_op_field_a_b() {
|
||||
let directory = std::env::temp_dir().join(format!("dual-stack-report-{}", uuid::Uuid::new_v4()));
|
||||
let mut a = [Observation::new(
|
||||
"GetBucketLocation",
|
||||
"normal",
|
||||
200,
|
||||
None,
|
||||
[("x-test-only", "private value"), ("Date", "clock a"), ("date", "duplicate")],
|
||||
)
|
||||
.with_field("location_constraint", "us-east-1")];
|
||||
let mut b = [
|
||||
Observation::new("GetBucketLocation", "normal", 200, None, [("DATE", "clock b"), ("X-TEST-ONLY", "other")])
|
||||
.with_field("location_constraint", "eu-west-1"),
|
||||
];
|
||||
a[0].wire_head = Some(WireHead::new(200, ["x-test-only", "Date", "date"].into_iter()));
|
||||
b[0].wire_head = Some(WireHead::new(201, ["Date"].into_iter()));
|
||||
let report = Report {
|
||||
schema: 2,
|
||||
run: "unit".into(),
|
||||
@@ -690,27 +497,15 @@ mod tests {
|
||||
region_b: Some("eu-west-1".into()),
|
||||
compared_ops: 1,
|
||||
compared_cases: 1,
|
||||
differences: compare(&a, &b),
|
||||
accepted_differences: Vec::new(),
|
||||
responses: PairedReceipts::new(&a, &b),
|
||||
differences: compare(
|
||||
&[ok("GetBucketLocation").with_field("location_constraint", "us-east-1")],
|
||||
&[ok("GetBucketLocation").with_field("location_constraint", "eu-west-1")],
|
||||
),
|
||||
};
|
||||
let path = report.write_to(&directory).expect("write the report");
|
||||
let json: serde_json::Value = serde_json::from_slice(&std::fs::read(&path).expect("read the report")).expect("parse");
|
||||
let _ = std::fs::remove_dir_all(&directory);
|
||||
assert_eq!(path.file_name().and_then(|name| name.to_str()), Some("unit.json"));
|
||||
let expected_receipt = serde_json::json!([{
|
||||
"op": "GetBucketLocation", "case": "normal", "status": 200,
|
||||
"header_names_sha256": "fc98ca59b6a14566b52845df9838e7fb48e1e162149d2b6967085ff0a6a20da3",
|
||||
}]);
|
||||
assert_eq!(json["responses_a"], expected_receipt);
|
||||
assert_eq!(
|
||||
json["responses_b"],
|
||||
serde_json::json!([{
|
||||
"op": "GetBucketLocation", "case": "normal", "status": 201,
|
||||
"header_names_sha256": "426e0b848d77d7b3d778187d006056ee406221ca567ce2844ca403dc834ff8f1"
|
||||
}])
|
||||
);
|
||||
assert!(response_receipts(&[ok("HeadBucket")]).is_empty());
|
||||
assert_eq!(json["compared_ops"], 1);
|
||||
assert_eq!(json["reference_side"], "a");
|
||||
assert_eq!(json["version_a"], "rustfs 1.0.4");
|
||||
@@ -725,203 +520,5 @@ mod tests {
|
||||
"b": "eu-west-1",
|
||||
}])
|
||||
);
|
||||
assert_eq!(json["accepted_differences"], serde_json::json!([]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn accepted_reference_change_exempts_only_exact_put_bucket_policy_tuple() {
|
||||
let a = vec![Observation::new(
|
||||
"PutBucketPolicy",
|
||||
"negative",
|
||||
400,
|
||||
Some("InvalidArgument".into()),
|
||||
[("content-type", "application/xml")],
|
||||
)];
|
||||
let b = vec![Observation::new(
|
||||
"PutBucketPolicy",
|
||||
"negative",
|
||||
400,
|
||||
Some("MalformedPolicy".into()),
|
||||
[("content-type", "application/xml")],
|
||||
)];
|
||||
|
||||
let (unruled, accepted) = partition_differences(compare(&a, &b), ComparisonMode::Reference, ACCEPTED_REFERENCE_CHANGES);
|
||||
assert!(unruled.is_empty(), "expected 0 unruled differences, got: {unruled:?}");
|
||||
assert_eq!(
|
||||
accepted,
|
||||
vec![AcceptedDifference {
|
||||
difference: Difference {
|
||||
op: "PutBucketPolicy".into(),
|
||||
case: "negative".into(),
|
||||
field: "error_code".into(),
|
||||
a: "InvalidArgument".into(),
|
||||
b: "MalformedPolicy".into(),
|
||||
},
|
||||
ruling: "rustfs/backlog#2684#issuecomment-7163283798 (commit 8f81762a6)".into(),
|
||||
}]
|
||||
);
|
||||
|
||||
let directory = std::env::temp_dir().join(format!("dual-stack-accepted-report-{}", uuid::Uuid::new_v4()));
|
||||
let report = Report {
|
||||
schema: 2,
|
||||
run: "accepted".into(),
|
||||
stack_a: "reference".into(),
|
||||
stack_b: "under-test".into(),
|
||||
reference_side: Some("a"),
|
||||
version_a: "rustfs 1.0.5".into(),
|
||||
version_b: "rustfs 1.0.6".into(),
|
||||
region_a: None,
|
||||
region_b: None,
|
||||
compared_ops: 1,
|
||||
compared_cases: 1,
|
||||
differences: unruled,
|
||||
accepted_differences: accepted,
|
||||
responses: PairedReceipts::new(&a, &b),
|
||||
};
|
||||
let path = report.write_to(&directory).expect("write accepted report");
|
||||
let json: serde_json::Value =
|
||||
serde_json::from_slice(&std::fs::read(&path).expect("read accepted report")).expect("parse");
|
||||
let _ = std::fs::remove_dir_all(&directory);
|
||||
assert_eq!(json["differences"], serde_json::json!([]));
|
||||
assert_eq!(
|
||||
json["accepted_differences"],
|
||||
serde_json::json!([{
|
||||
"op": "PutBucketPolicy",
|
||||
"case": "negative",
|
||||
"field": "error_code",
|
||||
"a": "InvalidArgument",
|
||||
"b": "MalformedPolicy",
|
||||
"ruling": "rustfs/backlog#2684#issuecomment-7163283798 (commit 8f81762a6)",
|
||||
}])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn accepted_reference_changes_never_apply_in_same_binary_mode() {
|
||||
let a = vec![Observation::new(
|
||||
"PutBucketPolicy",
|
||||
"negative",
|
||||
400,
|
||||
Some("InvalidArgument".into()),
|
||||
[("content-type", "application/xml")],
|
||||
)];
|
||||
let b = vec![Observation::new(
|
||||
"PutBucketPolicy",
|
||||
"negative",
|
||||
400,
|
||||
Some("MalformedPolicy".into()),
|
||||
[("content-type", "application/xml")],
|
||||
)];
|
||||
|
||||
let (unruled, accepted) = partition_differences(compare(&a, &b), ComparisonMode::SameBinary, ACCEPTED_REFERENCE_CHANGES);
|
||||
assert!(accepted.is_empty(), "same-binary mode must never accept differences: {accepted:?}");
|
||||
assert_eq!(
|
||||
unruled,
|
||||
vec![Difference {
|
||||
op: "PutBucketPolicy".into(),
|
||||
case: "negative".into(),
|
||||
field: "error_code".into(),
|
||||
a: "InvalidArgument".into(),
|
||||
b: "MalformedPolicy".into(),
|
||||
}]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn accepted_reference_change_fails_closed_on_any_mutation_or_extra_field_diff() {
|
||||
let cases: &[(&str, Observation, Observation, &[&str])] = &[
|
||||
(
|
||||
"wrong candidate error code",
|
||||
Observation::new("PutBucketPolicy", "negative", 400, Some("InvalidArgument".into()), []),
|
||||
Observation::new("PutBucketPolicy", "negative", 400, Some("AccessDenied".into()), []),
|
||||
&["error_code"],
|
||||
),
|
||||
(
|
||||
"missing candidate error code",
|
||||
Observation::new("PutBucketPolicy", "negative", 400, Some("InvalidArgument".into()), []),
|
||||
Observation::new("PutBucketPolicy", "negative", 400, None, []),
|
||||
&["error_code"],
|
||||
),
|
||||
(
|
||||
"wrong reference error code",
|
||||
Observation::new("PutBucketPolicy", "negative", 400, Some("MalformedXML".into()), []),
|
||||
Observation::new("PutBucketPolicy", "negative", 400, Some("MalformedPolicy".into()), []),
|
||||
&["error_code"],
|
||||
),
|
||||
(
|
||||
"swapped reference and candidate error codes",
|
||||
Observation::new("PutBucketPolicy", "negative", 400, Some("MalformedPolicy".into()), []),
|
||||
Observation::new("PutBucketPolicy", "negative", 400, Some("InvalidArgument".into()), []),
|
||||
&["error_code"],
|
||||
),
|
||||
(
|
||||
"different operation",
|
||||
Observation::new("GetBucketPolicy", "negative", 400, Some("InvalidArgument".into()), []),
|
||||
Observation::new("GetBucketPolicy", "negative", 400, Some("MalformedPolicy".into()), []),
|
||||
&["error_code"],
|
||||
),
|
||||
(
|
||||
"different case",
|
||||
Observation::new("PutBucketPolicy", "normal", 400, Some("InvalidArgument".into()), []),
|
||||
Observation::new("PutBucketPolicy", "normal", 400, Some("MalformedPolicy".into()), []),
|
||||
&["error_code"],
|
||||
),
|
||||
(
|
||||
"status differs alone",
|
||||
Observation::new("PutBucketPolicy", "negative", 400, Some("InvalidArgument".into()), []),
|
||||
Observation::new("PutBucketPolicy", "negative", 500, Some("InvalidArgument".into()), []),
|
||||
&["status"],
|
||||
),
|
||||
(
|
||||
"status also differs alongside matching error_code",
|
||||
Observation::new("PutBucketPolicy", "negative", 400, Some("InvalidArgument".into()), []),
|
||||
Observation::new("PutBucketPolicy", "negative", 500, Some("MalformedPolicy".into()), []),
|
||||
&["status", "error_code"],
|
||||
),
|
||||
(
|
||||
"header also differs alongside matching error_code",
|
||||
Observation::new(
|
||||
"PutBucketPolicy",
|
||||
"negative",
|
||||
400,
|
||||
Some("InvalidArgument".into()),
|
||||
[("content-type", "application/xml")],
|
||||
),
|
||||
Observation::new(
|
||||
"PutBucketPolicy",
|
||||
"negative",
|
||||
400,
|
||||
Some("MalformedPolicy".into()),
|
||||
[("content-type", "text/plain")],
|
||||
),
|
||||
&["error_code", "header.content-type"],
|
||||
),
|
||||
];
|
||||
|
||||
for (label, obs_a, obs_b, expected_fields) in cases {
|
||||
let (unruled, accepted) = partition_differences(
|
||||
compare(std::slice::from_ref(obs_a), std::slice::from_ref(obs_b)),
|
||||
ComparisonMode::Reference,
|
||||
ACCEPTED_REFERENCE_CHANGES,
|
||||
);
|
||||
assert!(accepted.is_empty(), "case `{label}` must not be accepted, got accepted={accepted:?}");
|
||||
assert_eq!(fields(&unruled), *expected_fields, "case `{label}` must preserve all unruled differences");
|
||||
}
|
||||
|
||||
// An accepted difference on PutBucketPolicy must never mask an unrelated regression.
|
||||
let a = vec![
|
||||
Observation::new("PutBucketPolicy", "negative", 400, Some("InvalidArgument".into()), []),
|
||||
Observation::new("GetObject", "negative", 404, Some("NoSuchKey".into()), []),
|
||||
];
|
||||
let b = vec![
|
||||
Observation::new("PutBucketPolicy", "negative", 400, Some("MalformedPolicy".into()), []),
|
||||
Observation::new("GetObject", "negative", 404, Some("NoSuchBucket".into()), []),
|
||||
];
|
||||
let (unruled, accepted) = partition_differences(compare(&a, &b), ComparisonMode::Reference, ACCEPTED_REFERENCE_CHANGES);
|
||||
assert_eq!(accepted.len(), 1);
|
||||
assert_eq!(accepted[0].difference.op, "PutBucketPolicy");
|
||||
assert_eq!(unruled.len(), 1);
|
||||
assert_eq!(unruled[0].op, "GetObject");
|
||||
assert_eq!(unruled[0].field, "error_code");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Browser preflight and actual CORS responses from a bucket with a stored rule.
|
||||
use super::{BoxError, RustFSTestEnvironment};
|
||||
use crate::common::signed_request_with_client;
|
||||
use aws_sdk_s3::{
|
||||
primitives::ByteStream,
|
||||
types::{CorsConfiguration, CorsRule},
|
||||
};
|
||||
use http::{
|
||||
HeaderMap, HeaderValue, Method, StatusCode,
|
||||
header::{ACCESS_CONTROL_ALLOW_METHODS, ACCESS_CONTROL_ALLOW_ORIGIN, ACCESS_CONTROL_REQUEST_METHOD, ORIGIN},
|
||||
};
|
||||
use std::{net::SocketAddr, time::Duration};
|
||||
|
||||
const ORIGIN_VALUE: &str = "https://app.example.com";
|
||||
const KEY: &str = "cors-object.txt";
|
||||
const BODY: &[u8] = b"middleware cors object";
|
||||
|
||||
fn assert_allowed_origin(headers: &HeaderMap, expected: Option<&str>) -> Result<(), BoxError> {
|
||||
let mut origins = headers.get_all(ACCESS_CONTROL_ALLOW_ORIGIN).iter();
|
||||
assert_eq!(origins.next().map(HeaderValue::to_str).transpose()?, expected, "CORS allow-origin");
|
||||
assert!(origins.next().is_none(), "duplicate CORS allow-origin header");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) async fn check(env: &RustFSTestEnvironment, bucket: &str) -> Result<(), BoxError> {
|
||||
let s3 = env.create_s3_client();
|
||||
let rule = CorsRule::builder()
|
||||
.allowed_origins(ORIGIN_VALUE)
|
||||
.allowed_methods("GET")
|
||||
.allowed_methods("HEAD")
|
||||
.build()?;
|
||||
s3.put_bucket_cors()
|
||||
.bucket(bucket)
|
||||
.cors_configuration(CorsConfiguration::builder().cors_rules(rule).build()?)
|
||||
.send()
|
||||
.await?;
|
||||
s3.put_object()
|
||||
.bucket(bucket)
|
||||
.key(KEY)
|
||||
.body(ByteStream::from_static(BODY))
|
||||
.send()
|
||||
.await?;
|
||||
|
||||
let address: SocketAddr = env.address.parse()?;
|
||||
assert!(address.ip().is_loopback(), "CORS fixture must run on loopback");
|
||||
let host = format!("{bucket}.s3.test");
|
||||
let client = || {
|
||||
reqwest::Client::builder()
|
||||
.no_proxy()
|
||||
.redirect(reqwest::redirect::Policy::none())
|
||||
.timeout(Duration::from_secs(10))
|
||||
.resolve(&host, address)
|
||||
};
|
||||
let http = client().build()?;
|
||||
let preflight = http
|
||||
.request(Method::OPTIONS, format!("http://{host}:{}/{KEY}", address.port()))
|
||||
.header(ORIGIN, ORIGIN_VALUE)
|
||||
.header(ACCESS_CONTROL_REQUEST_METHOD, "GET")
|
||||
.send()
|
||||
.await?;
|
||||
assert_eq!(preflight.status(), StatusCode::OK, "virtual-hosted CORS preflight");
|
||||
assert_allowed_origin(preflight.headers(), Some(ORIGIN_VALUE))?;
|
||||
assert!(
|
||||
preflight
|
||||
.headers()
|
||||
.get_all(ACCESS_CONTROL_ALLOW_METHODS)
|
||||
.iter()
|
||||
.filter_map(|v| v.to_str().ok())
|
||||
.flat_map(|v| v.split(','))
|
||||
.any(|method| method.trim() == "GET"),
|
||||
"preflight must allow GET"
|
||||
);
|
||||
|
||||
let mut headers = HeaderMap::new();
|
||||
headers.insert(ORIGIN, HeaderValue::from_static(ORIGIN_VALUE));
|
||||
let browser = client().default_headers(headers).build()?;
|
||||
let url = format!("{}/{bucket}/{KEY}", env.url);
|
||||
for (client, origin) in [(&browser, Some(ORIGIN_VALUE)), (&http, None)] {
|
||||
let response =
|
||||
signed_request_with_client(client, Method::GET, &url, &env.access_key, &env.secret_key, None, None).await?;
|
||||
assert_eq!(response.status(), StatusCode::OK, "CORS object GET");
|
||||
assert_allowed_origin(response.headers(), origin)?;
|
||||
assert_eq!(response.bytes().await?.as_ref(), BODY, "CORS object GET payload");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Wire contracts for the S3 middleware shared by the candidate and released server.
|
||||
use super::{BoxError, RustFSTestEnvironment, SideA, rustfs_binary_path};
|
||||
|
||||
mod cors;
|
||||
mod object;
|
||||
|
||||
async fn check(side: SideA) -> Result<(), BoxError> {
|
||||
let binary = match side {
|
||||
SideA::SameBinary => rustfs_binary_path(),
|
||||
SideA::Reference(path) => path,
|
||||
};
|
||||
let mut env = RustFSTestEnvironment::new().await?;
|
||||
env.start_rustfs_server_from_binary_without_cleanup(
|
||||
&binary,
|
||||
vec![],
|
||||
&[
|
||||
("RUSTFS_CHECK_UPDATE", "false"),
|
||||
("RUSTFS_SERVER_DOMAINS", "s3.test"),
|
||||
("RUSTFS_COMPRESS_ENABLE", "true"),
|
||||
("RUSTFS_COMPRESS_MIN_SIZE", "1000"),
|
||||
("RUSTFS_COMPRESS_MIME_TYPES", "text/*"),
|
||||
("RUSTFS_COMPRESS_EXTENSIONS", ""),
|
||||
],
|
||||
)
|
||||
.await?;
|
||||
let bucket = format!("middleware-{}", uuid::Uuid::new_v4().simple());
|
||||
env.create_s3_client().create_bucket().bucket(&bucket).send().await?;
|
||||
cors::check(&env, &bucket).await?;
|
||||
object::check(&env, &bucket).await
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn current_middleware_contract() -> Result<(), BoxError> {
|
||||
check(SideA::SameBinary).await
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn reference_middleware_contract() -> Result<(), BoxError> {
|
||||
check(SideA::from_env()?).await
|
||||
}
|
||||
@@ -1,217 +0,0 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use super::{BoxError, RustFSTestEnvironment};
|
||||
use crate::common::signed_request_with_client;
|
||||
use aws_sdk_s3::{
|
||||
presigning::{PresignedRequest, PresigningConfig},
|
||||
primitives::ByteStream,
|
||||
types::ObjectAttributes,
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use flate2::read::GzDecoder;
|
||||
use http::{HeaderMap, HeaderValue, Method, StatusCode, Version, header};
|
||||
use http_body_util::{BodyExt, Empty};
|
||||
use hyper_util::{client::legacy::Client, rt::TokioExecutor};
|
||||
use md5::{Digest, Md5};
|
||||
use std::io::Read;
|
||||
use std::time::Duration;
|
||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
use tokio::net::TcpStream;
|
||||
use tokio::time::timeout;
|
||||
|
||||
async fn request(
|
||||
env: &RustFSTestEnvironment,
|
||||
method: Method,
|
||||
url: &str,
|
||||
headers: HeaderMap,
|
||||
) -> Result<reqwest::Response, BoxError> {
|
||||
let client = reqwest::Client::builder()
|
||||
.no_proxy()
|
||||
.no_gzip()
|
||||
.redirect(reqwest::redirect::Policy::none())
|
||||
.default_headers(headers)
|
||||
.http1_only()
|
||||
.build()?;
|
||||
let response = signed_request_with_client(&client, method, url, &env.access_key, &env.secret_key, None, None).await?;
|
||||
assert_eq!(response.version(), Version::HTTP_11);
|
||||
Ok(response)
|
||||
}
|
||||
|
||||
// HTTP clients discard HEAD bodies. Read through EOF so an illegal body fails the contract.
|
||||
async fn head_on_wire(env: &RustFSTestEnvironment, bucket: &str, expected: StatusCode) -> Result<HeaderMap, BoxError> {
|
||||
let signed = env
|
||||
.create_s3_client()
|
||||
.head_object()
|
||||
.bucket(bucket)
|
||||
.key("normal.txt")
|
||||
.presigned(PresigningConfig::expires_in(Duration::from_secs(60))?)
|
||||
.await?;
|
||||
let uri: http::Uri = signed.uri().parse()?;
|
||||
assert_eq!(uri.authority().map(|a| a.as_str()), Some(env.address.as_str()));
|
||||
let target = uri.path_and_query().ok_or("missing HEAD target")?;
|
||||
let mut request = format!("HEAD {target} HTTP/1.1\r\nHost: {}\r\nConnection: close\r\n", env.address);
|
||||
for (name, value) in signed.headers() {
|
||||
use std::fmt::Write;
|
||||
write!(request, "{name}: {value}\r\n")?;
|
||||
}
|
||||
request.push_str("\r\n");
|
||||
|
||||
const LIMIT: usize = 64 * 1024;
|
||||
let mut reply = Vec::new();
|
||||
timeout(Duration::from_secs(10), async {
|
||||
let mut stream = TcpStream::connect(&env.address).await?;
|
||||
stream.write_all(request.as_bytes()).await?;
|
||||
stream.take((LIMIT + 1) as u64).read_to_end(&mut reply).await
|
||||
})
|
||||
.await??;
|
||||
assert!(reply.len() <= LIMIT, "HEAD response exceeds limit");
|
||||
let end = reply
|
||||
.windows(4)
|
||||
.position(|v| v == b"\r\n\r\n")
|
||||
.ok_or("incomplete HEAD response")?;
|
||||
assert_eq!(reply.len(), end + 4, "unexpected body bytes after HEAD response headers");
|
||||
let mut lines = std::str::from_utf8(&reply[..end])?.split("\r\n");
|
||||
let mut status = lines.next().ok_or("missing HEAD status line")?.split_ascii_whitespace();
|
||||
assert_eq!(status.next(), Some("HTTP/1.1"));
|
||||
assert_eq!(status.next(), Some(expected.as_str()));
|
||||
let mut headers = HeaderMap::new();
|
||||
for line in lines {
|
||||
let (name, value) = line.split_once(':').ok_or("invalid HEAD response header")?;
|
||||
headers.append(header::HeaderName::from_bytes(name.as_bytes())?, HeaderValue::from_str(value.trim())?);
|
||||
}
|
||||
Ok(headers)
|
||||
}
|
||||
|
||||
async fn check_h2_body(signed: PresignedRequest, status: StatusCode, expected: &[u8]) -> Result<(), BoxError> {
|
||||
let client = Client::builder(TokioExecutor::new()).http2_only(true).build_http();
|
||||
let mut req = signed.into_http_1x_request(Empty::<Bytes>::new());
|
||||
req.headers_mut()
|
||||
.insert(header::ACCEPT_ENCODING, HeaderValue::from_static("identity"));
|
||||
timeout(Duration::from_secs(10), async {
|
||||
let response = client.request(req).await?;
|
||||
assert_eq!(response.version(), Version::HTTP_2);
|
||||
assert_eq!(response.status(), status);
|
||||
let mut body = response.into_body();
|
||||
let mut frames = 0;
|
||||
let mut received = 0;
|
||||
while let Some(frame) = body.frame().await {
|
||||
if let Ok(data) = frame?.into_data() {
|
||||
frames += 1;
|
||||
assert!(expected[received..].starts_with(&data), "HTTP/2 DATA differs from stored content");
|
||||
received += data.len();
|
||||
}
|
||||
}
|
||||
assert_eq!(received, expected.len());
|
||||
assert_eq!(frames == 0, expected.is_empty(), "unexpected HTTP/2 DATA frame count for {status}");
|
||||
Ok::<_, BoxError>(())
|
||||
})
|
||||
.await?
|
||||
}
|
||||
|
||||
pub(super) async fn check(env: &RustFSTestEnvironment, bucket: &str) -> Result<(), BoxError> {
|
||||
let sdk = env.create_s3_client();
|
||||
let text = b"ordinary middleware payload\n".repeat(1200);
|
||||
let png = b"image-control\0".repeat(2000);
|
||||
let short = b"hello".as_slice();
|
||||
for (key, body, mime) in [
|
||||
("normal.txt", text.as_slice(), "text/plain"),
|
||||
("short.txt", short, "text/plain"),
|
||||
("image.png", png.as_slice(), "image/png"),
|
||||
] {
|
||||
sdk.put_object()
|
||||
.bucket(bucket)
|
||||
.key(key)
|
||||
.content_type(mime)
|
||||
.body(ByteStream::from(body.to_vec()))
|
||||
.send()
|
||||
.await?;
|
||||
}
|
||||
let root = format!("{}/{bucket}", env.url);
|
||||
let url = format!("{root}/normal.txt");
|
||||
let digest = hex_simd::encode_to_string(Md5::digest(&text), hex_simd::AsciiCase::Lower);
|
||||
let etag = format!("\"{digest}\"");
|
||||
|
||||
let head = head_on_wire(env, bucket, StatusCode::OK).await?;
|
||||
assert_eq!(head[header::ETAG], etag.as_str());
|
||||
assert_eq!(head[header::CONTENT_LENGTH].to_str()?.parse::<usize>()?, text.len());
|
||||
|
||||
for (key, accepted, expected_encoding, expected_body) in [
|
||||
("normal.txt", "gzip", "gzip", text.as_slice()),
|
||||
("normal.txt", "identity", "identity", text.as_slice()),
|
||||
("short.txt", "gzip", "identity", short),
|
||||
("image.png", "gzip", "identity", png.as_slice()),
|
||||
] {
|
||||
let headers = HeaderMap::from_iter([(header::ACCEPT_ENCODING, HeaderValue::from_static(accepted))]);
|
||||
let res = request(env, Method::GET, &format!("{root}/{key}"), headers).await?;
|
||||
assert_eq!(res.status(), StatusCode::OK, "{key} accepting {accepted}");
|
||||
let encoding = res
|
||||
.headers()
|
||||
.get(header::CONTENT_ENCODING)
|
||||
.map(HeaderValue::to_str)
|
||||
.transpose()?
|
||||
.unwrap_or("identity");
|
||||
assert_eq!(encoding, expected_encoding, "{key} accepting {accepted}");
|
||||
let bytes = res.bytes().await?;
|
||||
if expected_encoding == "gzip" {
|
||||
let mut decoded = Vec::new();
|
||||
GzDecoder::new(bytes.as_ref()).read_to_end(&mut decoded)?;
|
||||
assert!(decoded == expected_body, "decompressed {key} differs from stored bytes");
|
||||
} else {
|
||||
assert!(bytes.as_ref() == expected_body, "{key} differs from stored bytes");
|
||||
}
|
||||
}
|
||||
|
||||
let headers = HeaderMap::from_iter([
|
||||
(header::RANGE, HeaderValue::from_static("bytes=5-19")),
|
||||
(header::ACCEPT_ENCODING, HeaderValue::from_static("identity")),
|
||||
]);
|
||||
let range = request(env, Method::GET, &url, headers).await?;
|
||||
assert_eq!(range.status(), StatusCode::PARTIAL_CONTENT);
|
||||
assert_eq!(range.headers()[header::CONTENT_RANGE], format!("bytes 5-19/{}", text.len()));
|
||||
assert_eq!(range.bytes().await?.as_ref(), &text[5..20]);
|
||||
|
||||
for (condition, expected, body) in [
|
||||
(etag.as_str(), StatusCode::NOT_MODIFIED, [].as_slice()),
|
||||
("\"other-etag\"", StatusCode::OK, text.as_slice()),
|
||||
] {
|
||||
let signed = sdk
|
||||
.get_object()
|
||||
.bucket(bucket)
|
||||
.key("normal.txt")
|
||||
.if_none_match(condition)
|
||||
.presigned(PresigningConfig::expires_in(Duration::from_secs(60))?)
|
||||
.await?;
|
||||
check_h2_body(signed, expected, body).await?;
|
||||
}
|
||||
|
||||
let attrs = sdk
|
||||
.get_object_attributes()
|
||||
.bucket(bucket)
|
||||
.key("normal.txt")
|
||||
.object_attributes(ObjectAttributes::Etag)
|
||||
.send()
|
||||
.await?;
|
||||
assert_eq!(attrs.e_tag(), Some(digest.as_str()));
|
||||
|
||||
let deleted = sdk
|
||||
.delete_object()
|
||||
.bucket(bucket)
|
||||
.key("normal.txt")
|
||||
.presigned(PresigningConfig::expires_in(Duration::from_secs(60))?)
|
||||
.await?;
|
||||
check_h2_body(deleted, StatusCode::NO_CONTENT, &[]).await?;
|
||||
head_on_wire(env, bucket, StatusCode::NOT_FOUND).await?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -27,16 +27,11 @@
|
||||
//! is process-global, so two stacks in one process would read each other's buckets.
|
||||
|
||||
mod compare;
|
||||
mod middleware_contract;
|
||||
mod observability_contract;
|
||||
pub(crate) mod reference;
|
||||
mod scenarios;
|
||||
|
||||
use crate::common::{RustFSTestEnvironment, init_logging, rustfs_binary_path, workspace_root};
|
||||
use compare::{
|
||||
ACCEPTED_REFERENCE_CHANGES, ComparisonMode, Difference, Observation, PairedReceipts, Report, compare, compared_cases,
|
||||
compared_ops, partition_differences, render, render_accepted,
|
||||
};
|
||||
use compare::{Difference, Observation, Report, compare, compared_cases, compared_ops, render};
|
||||
use reference::{SideA, binary_version};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
@@ -83,13 +78,6 @@ impl PairConfig {
|
||||
SideA::Reference(_) => STACK_A_REFERENCE,
|
||||
}
|
||||
}
|
||||
|
||||
fn comparison_mode(&self) -> ComparisonMode {
|
||||
match self.side_a {
|
||||
SideA::SameBinary => ComparisonMode::SameBinary,
|
||||
SideA::Reference(_) => ComparisonMode::Reference,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Starts one server of the binary under test, overriding its region only when asked.
|
||||
@@ -164,8 +152,6 @@ async fn run_differential(label: &str, config: &PairConfig) -> Run {
|
||||
let millis = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.map_or(0, |elapsed| elapsed.as_millis());
|
||||
let (differences, accepted_differences) =
|
||||
partition_differences(compare(&a, &b), config.comparison_mode(), ACCEPTED_REFERENCE_CHANGES);
|
||||
let report = Report {
|
||||
schema: 2,
|
||||
run: format!("{label}-{millis}-{}", std::process::id()),
|
||||
@@ -178,9 +164,7 @@ async fn run_differential(label: &str, config: &PairConfig) -> Run {
|
||||
region_b: config.region_b.clone(),
|
||||
compared_ops: compared_ops(&a, &b).len(),
|
||||
compared_cases: compared_cases(&a, &b),
|
||||
differences,
|
||||
accepted_differences,
|
||||
responses: PairedReceipts::new(&a, &b),
|
||||
differences: compare(&a, &b),
|
||||
};
|
||||
let path = report.write_to(&report_directory()).expect("write the dual-stack report");
|
||||
Run { report, path, a }
|
||||
@@ -206,23 +190,6 @@ mod tests {
|
||||
"the script must drive exactly the operations of impl S3 for FS"
|
||||
);
|
||||
assert_eq!(report.compared_ops, scenarios::OPERATIONS.len(), "report: {}", run.path.display());
|
||||
if config.comparison_mode() == ComparisonMode::SameBinary {
|
||||
assert!(
|
||||
report.accepted_differences.is_empty(),
|
||||
"same-binary comparison must never accept differences (report: {}):\n{}",
|
||||
run.path.display(),
|
||||
render_accepted(&report.accepted_differences)
|
||||
);
|
||||
}
|
||||
if !report.accepted_differences.is_empty() {
|
||||
println!(
|
||||
"accepted reference differences ({} of {} cases, report: {}):\n{}",
|
||||
report.accepted_differences.len(),
|
||||
report.compared_cases,
|
||||
run.path.display(),
|
||||
render_accepted(&report.accepted_differences)
|
||||
);
|
||||
}
|
||||
assert!(
|
||||
report.differences.is_empty(),
|
||||
"stack {} ({}) and stack {} ({}) differ on {} of {} cases (report: {}):\n{}",
|
||||
@@ -275,12 +242,6 @@ mod tests {
|
||||
a: CONTROL_REGION_A.to_owned(),
|
||||
b: CONTROL_REGION_B.to_owned(),
|
||||
};
|
||||
assert!(
|
||||
run.report.accepted_differences.is_empty(),
|
||||
"same-binary negative control must never accept differences (report: {}):\n{}",
|
||||
run.path.display(),
|
||||
render_accepted(&run.report.accepted_differences)
|
||||
);
|
||||
assert!(
|
||||
run.report.differences.contains(&expected),
|
||||
"B started in {CONTROL_REGION_B} but GetBucketLocation was not reported (report: {}):\n{}",
|
||||
|
||||
@@ -1,415 +0,0 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! SDK responses, audit receipts and HTTP counters for isolated successful PUTs and a missing-object GET.
|
||||
use super::reference::{SideA, binary_version};
|
||||
use super::{BoxError, RustFSTestEnvironment, rustfs_binary_path};
|
||||
use crate::common::admin_request;
|
||||
use aws_sdk_s3::{operation::RequestId, primitives::ByteStream};
|
||||
use bytes::Bytes;
|
||||
use flate2::read::GzDecoder;
|
||||
use http_body_util::{BodyExt, Empty, Limited};
|
||||
use hyper::{Method, Request, Response, StatusCode, body::Incoming, service::service_fn};
|
||||
use hyper_util::rt::TokioIo;
|
||||
use md5::{Digest, Md5};
|
||||
use opentelemetry_proto::tonic::{
|
||||
collector::metrics::v1::ExportMetricsServiceRequest,
|
||||
common::v1::{KeyValue, any_value},
|
||||
metrics::v1::{metric::Data, number_data_point},
|
||||
};
|
||||
use prost::Message;
|
||||
use rustfs_madmin::metrics::RealtimeMetrics;
|
||||
use serde::Deserialize;
|
||||
use serde_json::Value;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use std::convert::Infallible;
|
||||
use std::io::Read;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::task::JoinSet;
|
||||
use tokio::time::{sleep, timeout};
|
||||
|
||||
const BODY: &[u8] = b"observability contract";
|
||||
const HTTP_COUNTER: &str = "rustfs_s3_http_requests_total";
|
||||
const PUT: &str = "s3:PutObject";
|
||||
const MAX_EXPORT: usize = 8 * 1024 * 1024;
|
||||
const CONTRACT: &str = include_str!("../../../gateway-adapter/tests/fixtures/observability-contract.json");
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Contract {
|
||||
reference_version: String,
|
||||
sdk_puts: u64,
|
||||
s3_metrics: BTreeMap<String, BTreeSet<String>>,
|
||||
audit_fields: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Default)]
|
||||
struct HttpCounts {
|
||||
put_success: u64,
|
||||
get_error: u64,
|
||||
}
|
||||
|
||||
impl HttpCounts {
|
||||
fn series(&mut self, method: &str, op: &str, outcome: &str) -> Option<&mut u64> {
|
||||
match (method, op, outcome) {
|
||||
("PUT", PUT, "2xx") => Some(&mut self.put_success),
|
||||
("GET", "s3:GetObject", "4xx") => Some(&mut self.get_error),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct Observations {
|
||||
labels: BTreeMap<String, BTreeSet<String>>,
|
||||
exports: usize,
|
||||
http: HttpCounts,
|
||||
audits: BTreeMap<String, String>,
|
||||
error: Option<&'static str>,
|
||||
}
|
||||
|
||||
impl Observations {
|
||||
fn audit(&mut self, event: &Value, bucket: &str, contract: &Contract) -> Result<(), &'static str> {
|
||||
if event.pointer("/api/name").and_then(Value::as_str) != Some(PUT)
|
||||
|| event.pointer("/api/bucket").and_then(Value::as_str) != Some(bucket)
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
if !contract.audit_fields.iter().all(|field| event.pointer(field).is_some()) {
|
||||
return Err("successful PUT audit omitted a required field");
|
||||
}
|
||||
if event.pointer("/api/status_code").and_then(Value::as_u64) != Some(200) {
|
||||
return Err("unexpected audited PUT status");
|
||||
}
|
||||
let id = event["requestID"]
|
||||
.as_str()
|
||||
.filter(|id| !id.is_empty())
|
||||
.ok_or("audit omitted request ID")?;
|
||||
let object = event["api"]["object"].as_str().ok_or("audit omitted object")?;
|
||||
if self.audits.insert(id.to_owned(), object.to_owned()).is_some() {
|
||||
return Err("duplicate PUT audit delivery");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn metrics(&mut self, export: ExportMetricsServiceRequest, contract: &Contract) -> Result<(), &'static str> {
|
||||
for metric in export
|
||||
.resource_metrics
|
||||
.into_iter()
|
||||
.flat_map(|r| r.scope_metrics)
|
||||
.flat_map(|s| s.metrics)
|
||||
{
|
||||
if !contract.s3_metrics.contains_key(&metric.name) {
|
||||
continue;
|
||||
}
|
||||
let mut record = |attrs: &[KeyValue]| {
|
||||
self.labels
|
||||
.entry(metric.name.clone())
|
||||
.or_default()
|
||||
.extend(attrs.iter().map(|kv| kv.key.clone()));
|
||||
};
|
||||
match metric.data {
|
||||
Some(Data::Gauge(gauge)) => gauge.data_points.iter().for_each(|p| record(&p.attributes)),
|
||||
Some(Data::Histogram(hist)) => hist.data_points.iter().for_each(|p| record(&p.attributes)),
|
||||
Some(Data::Sum(sum)) => {
|
||||
for point in sum.data_points {
|
||||
record(&point.attributes);
|
||||
if metric.name != HTTP_COUNTER {
|
||||
continue;
|
||||
}
|
||||
let attr = |key: &str| {
|
||||
point
|
||||
.attributes
|
||||
.iter()
|
||||
.find(|a| a.key == key)
|
||||
.and_then(|a| match a.value.as_ref()?.value.as_ref()? {
|
||||
any_value::Value::StringValue(value) => Some(value.as_str()),
|
||||
_ => None,
|
||||
})
|
||||
.unwrap_or_default()
|
||||
};
|
||||
if let Some(count) = self.http.series(attr("method"), attr("op"), attr("outcome")) {
|
||||
*count = match point.value {
|
||||
Some(number_data_point::Value::AsInt(n)) => {
|
||||
u64::try_from(n).map_err(|_| "negative HTTP counter")?
|
||||
}
|
||||
Some(number_data_point::Value::AsDouble(n)) if n.is_finite() && n >= 0.0 && n.fract() == 0.0 => {
|
||||
n as u64
|
||||
}
|
||||
_ => return Err("invalid HTTP counter"),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => return Err("unexpected S3 metric aggregation"),
|
||||
}
|
||||
}
|
||||
self.exports += 1;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
async fn collect(
|
||||
req: Request<Incoming>,
|
||||
state: &Mutex<Observations>,
|
||||
bucket: &str,
|
||||
contract: &Contract,
|
||||
) -> Result<(), &'static str> {
|
||||
let (parts, body) = req.into_parts();
|
||||
// WebhookTarget checks the origin before delivering events to /audit.
|
||||
if parts.method == Method::HEAD && parts.uri == "/" {
|
||||
return Ok(());
|
||||
}
|
||||
if parts.method != Method::POST {
|
||||
return Err("unexpected collector method");
|
||||
}
|
||||
let bytes = Limited::new(body, MAX_EXPORT)
|
||||
.collect()
|
||||
.await
|
||||
.map_err(|_| "invalid export size")?
|
||||
.to_bytes();
|
||||
let mut decoded = Vec::new();
|
||||
let payload = if parts.headers.get("content-encoding").is_some_and(|v| v == "gzip") {
|
||||
GzDecoder::new(bytes.as_ref())
|
||||
.take(MAX_EXPORT as u64 + 1)
|
||||
.read_to_end(&mut decoded)
|
||||
.map_err(|_| "invalid gzip export")?;
|
||||
if decoded.len() > MAX_EXPORT {
|
||||
return Err("decoded export exceeds limit");
|
||||
}
|
||||
&decoded[..]
|
||||
} else {
|
||||
&bytes[..]
|
||||
};
|
||||
match parts.uri.path() {
|
||||
"/audit" => {
|
||||
let document: Value = serde_json::from_slice(payload).map_err(|_| "invalid audit JSON")?;
|
||||
let events = document
|
||||
.get("Records")
|
||||
.and_then(Value::as_array)
|
||||
.map(Vec::as_slice)
|
||||
.unwrap_or(std::slice::from_ref(&document));
|
||||
let mut snapshot = state.lock().expect("collector mutex");
|
||||
for event in events {
|
||||
snapshot.audit(event, bucket, contract)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
"/v1/metrics" => {
|
||||
let export = ExportMetricsServiceRequest::decode(payload).map_err(|_| "invalid OTLP export")?;
|
||||
state.lock().expect("collector mutex").metrics(export, contract)
|
||||
}
|
||||
_ => Err("unexpected collector path"),
|
||||
}
|
||||
}
|
||||
|
||||
async fn listen(listener: TcpListener, state: Arc<Mutex<Observations>>, bucket: String, contract: Arc<Contract>) {
|
||||
let mut connections = JoinSet::new();
|
||||
loop {
|
||||
tokio::select! {
|
||||
Ok((socket, _)) = listener.accept() => {
|
||||
let state = Arc::clone(&state);
|
||||
let contract = Arc::clone(&contract);
|
||||
let bucket = bucket.clone();
|
||||
connections.spawn(async move {
|
||||
let svc = service_fn(|req| async {
|
||||
let result = collect(req, &state, &bucket, &contract).await;
|
||||
let mut response = Response::new(Empty::<Bytes>::new());
|
||||
if let Err(error) = result {
|
||||
state.lock().expect("collector mutex").error = Some(error);
|
||||
*response.status_mut() = StatusCode::BAD_REQUEST;
|
||||
}
|
||||
Ok::<_, Infallible>(response)
|
||||
});
|
||||
let _ = hyper::server::conn::http1::Builder::new().serve_connection(TokioIo::new(socket), svc).await;
|
||||
});
|
||||
}
|
||||
Some(_) = connections.join_next(), if !connections.is_empty() => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn admin_http_counts(env: &RustFSTestEnvironment) -> Result<HttpCounts, BoxError> {
|
||||
let (code, text) = admin_request(
|
||||
&env.url,
|
||||
Method::GET,
|
||||
"/rustfs/admin/v3/realtime?types=512&by-host=true&n=1",
|
||||
None,
|
||||
&env.access_key,
|
||||
&env.secret_key,
|
||||
)
|
||||
.await?;
|
||||
assert_eq!(code, StatusCode::OK, "read realtime HTTP counters");
|
||||
let report: RealtimeMetrics = serde_json::from_str(text.lines().next().ok_or("empty admin metrics")?)?;
|
||||
assert!(report.errors.is_empty(), "admin reported metric collection errors");
|
||||
let http = report.aggregated.http.ok_or("missing admin HTTP metrics")?;
|
||||
let mut counts = HttpCounts::default();
|
||||
for row in http.requests {
|
||||
if let Some(total) = counts.series(&row.method, &row.operation, &row.outcome) {
|
||||
*total += row.total;
|
||||
}
|
||||
}
|
||||
Ok(counts)
|
||||
}
|
||||
|
||||
async fn wait_for(state: &Mutex<Observations>, ready: impl Fn(&Observations) -> bool) -> Result<(), BoxError> {
|
||||
timeout(Duration::from_secs(45), async {
|
||||
loop {
|
||||
{
|
||||
let s = state.lock().expect("collector mutex");
|
||||
if let Some(e) = s.error {
|
||||
return Err::<(), BoxError>(e.into());
|
||||
}
|
||||
if ready(&s) {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
sleep(Duration::from_millis(150)).await;
|
||||
}
|
||||
})
|
||||
.await
|
||||
.map_err(|_| {
|
||||
let snapshot = state.lock().expect("collector mutex");
|
||||
format!(
|
||||
"timed out after {} OTLP exports, {} successful PUTs, {} failed GETs, {} audit receipts and {} S3 metrics",
|
||||
snapshot.exports,
|
||||
snapshot.http.put_success,
|
||||
snapshot.http.get_error,
|
||||
snapshot.audits.len(),
|
||||
snapshot.labels.len()
|
||||
)
|
||||
})?
|
||||
}
|
||||
|
||||
async fn check(side: SideA) -> Result<(), BoxError> {
|
||||
let contract: Arc<Contract> = Arc::new(serde_json::from_str(CONTRACT)?);
|
||||
assert_eq!(contract.sdk_puts, 20);
|
||||
let (label, binary) = match &side {
|
||||
SideA::Reference(path) => ("reference", path.clone()),
|
||||
SideA::SameBinary => ("under-test", rustfs_binary_path()),
|
||||
};
|
||||
eprintln!(
|
||||
"observability {label}: {}; fixture {}",
|
||||
binary_version(&binary).await?,
|
||||
contract.reference_version
|
||||
);
|
||||
let bucket = format!("observability-{}", uuid::Uuid::new_v4().simple());
|
||||
let listener = TcpListener::bind(("127.0.0.1", 0)).await?;
|
||||
let origin = format!("http://{}", listener.local_addr()?);
|
||||
let audit = format!("{origin}/audit");
|
||||
let metrics = format!("{origin}/v1/metrics");
|
||||
let state = Arc::new(Mutex::new(Observations::default()));
|
||||
let mut collector = JoinSet::new();
|
||||
collector.spawn(listen(listener, Arc::clone(&state), bucket.clone(), Arc::clone(&contract)));
|
||||
let mut env = RustFSTestEnvironment::new().await?;
|
||||
let queue = format!("{}/queue", env.temp_dir);
|
||||
let vars = [
|
||||
("RUSTFS_OUTBOUND_ALLOW_ORIGINS", origin.as_str()),
|
||||
("RUSTFS_CHECK_UPDATE", "false"),
|
||||
("RUSTFS_AUDIT_ENABLE", "true"),
|
||||
("RUSTFS_AUDIT_WEBHOOK_ENABLE_CONTRACT", "on"),
|
||||
("RUSTFS_AUDIT_WEBHOOK_ENDPOINT_CONTRACT", audit.as_str()),
|
||||
("RUSTFS_AUDIT_WEBHOOK_QUEUE_DIR_CONTRACT", queue.as_str()),
|
||||
("RUSTFS_OBS_METRIC_ENDPOINT", metrics.as_str()),
|
||||
("RUSTFS_OBS_METER_INTERVAL", "1"),
|
||||
("RUSTFS_OBS_METRICS_EXPORT_ENABLED", "true"),
|
||||
("RUSTFS_OBS_LOGS_EXPORT_ENABLED", "false"),
|
||||
("RUSTFS_OBS_TRACES_EXPORT_ENABLED", "false"),
|
||||
("NO_PROXY", "127.0.0.1,localhost"),
|
||||
("no_proxy", "127.0.0.1,localhost"),
|
||||
];
|
||||
match side {
|
||||
SideA::SameBinary => env.start_rustfs_server_without_cleanup_with_env(&vars).await?,
|
||||
SideA::Reference(path) => {
|
||||
env.start_rustfs_server_from_binary_without_cleanup(&path, vec![], &vars)
|
||||
.await?
|
||||
}
|
||||
};
|
||||
let client = env.create_s3_client();
|
||||
client.create_bucket().bucket(&bucket).send().await?;
|
||||
wait_for(&state, |s| s.exports > 0 && s.labels.contains_key(HTTP_COUNTER)).await?;
|
||||
let start = state.lock().expect("collector mutex").http;
|
||||
let before = admin_http_counts(&env).await?;
|
||||
let mut expected = BTreeMap::new();
|
||||
let etag = format!("\"{}\"", hex_simd::encode_to_string(Md5::digest(BODY), hex_simd::AsciiCase::Lower));
|
||||
for i in 0..contract.sdk_puts {
|
||||
let key = format!("contract-{i}");
|
||||
let output = client
|
||||
.put_object()
|
||||
.bucket(&bucket)
|
||||
.key(&key)
|
||||
.body(ByteStream::from_static(BODY))
|
||||
.send()
|
||||
.await?;
|
||||
assert_eq!(output.e_tag(), Some(etag.as_str()), "stored PUT payload ETag");
|
||||
let id = output
|
||||
.request_id()
|
||||
.filter(|s| !s.is_empty())
|
||||
.ok_or("PUT omitted its request ID")?;
|
||||
assert!(expected.insert(id.to_owned(), key).is_none(), "duplicate SDK request ID");
|
||||
}
|
||||
let missing = client
|
||||
.get_object()
|
||||
.bucket(&bucket)
|
||||
.key("never-written")
|
||||
.send()
|
||||
.await
|
||||
.expect_err("GET of a missing object must fail");
|
||||
assert_eq!(missing.raw_response().map(|r| r.status().as_u16()), Some(404));
|
||||
assert!(
|
||||
missing.as_service_error().is_some_and(|err| err.is_no_such_key()),
|
||||
"missing-object GET must return NoSuchKey"
|
||||
);
|
||||
let after = admin_http_counts(&env).await?;
|
||||
assert_eq!(after.put_success.checked_sub(before.put_success), Some(contract.sdk_puts));
|
||||
assert_eq!(after.get_error.checked_sub(before.get_error), Some(1), "admin GetObject 4xx delta");
|
||||
client.list_objects_v2().bucket(&bucket).send().await?;
|
||||
wait_for(&state, |s| {
|
||||
s.http.put_success >= start.put_success + contract.sdk_puts
|
||||
&& s.http.get_error > start.get_error
|
||||
&& s.audits.len() >= expected.len()
|
||||
&& s.labels.len() == contract.s3_metrics.len()
|
||||
})
|
||||
.await?;
|
||||
// Keep collecting for another export after all PUTs are present to catch late duplicates.
|
||||
let complete_export = state.lock().expect("collector mutex").exports;
|
||||
wait_for(&state, |s| s.exports > complete_export).await?;
|
||||
let observed = state.lock().expect("collector mutex");
|
||||
if let Some(error) = observed.error {
|
||||
return Err(error.into());
|
||||
}
|
||||
assert_eq!(
|
||||
observed.http.put_success.checked_sub(start.put_success),
|
||||
Some(contract.sdk_puts),
|
||||
"OTLP PUT delta"
|
||||
);
|
||||
assert_eq!(observed.http.get_error.checked_sub(start.get_error), Some(1), "OTLP GetObject 4xx delta");
|
||||
assert!(
|
||||
observed.audits == expected,
|
||||
"audit IDs and objects must match each successful SDK PUT once"
|
||||
);
|
||||
assert_eq!(observed.labels, contract.s3_metrics, "stable S3 metric names and label keys");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn reference_observability_contract() -> Result<(), BoxError> {
|
||||
check(SideA::from_env()?).await
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn current_observability_contract() -> Result<(), BoxError> {
|
||||
check(SideA::SameBinary).await
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
mod extra;
|
||||
|
||||
use super::compare::{Observation, WireHead};
|
||||
use super::compare::Observation;
|
||||
use crate::common::{RustFSTestEnvironment, build_test_s3_config};
|
||||
use aws_sdk_s3::Client;
|
||||
use aws_sdk_s3::config::interceptors::BeforeDeserializationInterceptorContextRef;
|
||||
@@ -67,11 +67,7 @@ const RETAIN_UNTIL_SECS: i64 = 4_070_908_800;
|
||||
const SELECT_DEADLINE: Duration = Duration::from_secs(30);
|
||||
|
||||
type Fields = Vec<(&'static str, String)>;
|
||||
#[derive(Default, Debug)]
|
||||
struct Captured {
|
||||
wire: Option<WireHead>,
|
||||
sdk: Option<(u16, Vec<(String, String)>)>,
|
||||
}
|
||||
type Captured = (u16, Vec<(String, String)>);
|
||||
|
||||
/// Every method of `impl S3 for FS` in `rustfs/src/storage/ecfs.rs`, by S3 operation name, sorted.
|
||||
/// Derived with
|
||||
@@ -156,11 +152,11 @@ pub(crate) const OPERATIONS: [&str; 73] = [
|
||||
|
||||
/// Records the status and headers of the one response each request receives (retries are off).
|
||||
#[derive(Clone, Debug, Default)]
|
||||
struct ResponseCapture(Arc<Mutex<Captured>>);
|
||||
struct ResponseCapture(Arc<Mutex<Option<Captured>>>);
|
||||
|
||||
impl ResponseCapture {
|
||||
fn take(&self) -> Captured {
|
||||
self.0.lock().map(|mut slot| std::mem::take(&mut *slot)).unwrap_or_default()
|
||||
fn take(&self) -> Option<Captured> {
|
||||
self.0.lock().ok().and_then(|mut slot| slot.take())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,21 +165,6 @@ impl Intercept for ResponseCapture {
|
||||
"dual-stack-response-capture"
|
||||
}
|
||||
|
||||
fn read_after_transmit(
|
||||
&self,
|
||||
context: &BeforeDeserializationInterceptorContextRef<'_>,
|
||||
_runtime_components: &RuntimeComponents,
|
||||
_cfg: &mut ConfigBag,
|
||||
) -> Result<(), BoxError> {
|
||||
let response = context.response();
|
||||
let head = WireHead::new(response.status().as_u16(), response.headers().iter().map(|(name, _)| name));
|
||||
self.0
|
||||
.lock()
|
||||
.map_err(|_| std::io::Error::other("response capture mutex was poisoned"))?
|
||||
.wire = Some(head);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn read_before_deserialization(
|
||||
&self,
|
||||
context: &BeforeDeserializationInterceptorContextRef<'_>,
|
||||
@@ -196,10 +177,11 @@ impl Intercept for ResponseCapture {
|
||||
.iter()
|
||||
.map(|(name, value)| (name.to_owned(), value.to_owned()))
|
||||
.collect();
|
||||
self.0
|
||||
*self
|
||||
.0
|
||||
.lock()
|
||||
.map_err(|_| std::io::Error::other("response capture mutex was poisoned"))?
|
||||
.sdk = Some((response.status().as_u16(), headers));
|
||||
.map_err(|_| std::io::Error::other("response capture mutex was poisoned"))? =
|
||||
Some((response.status().as_u16(), headers));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -295,27 +277,25 @@ impl Recorder {
|
||||
{
|
||||
let _ = self.capture.take();
|
||||
let result = request.await;
|
||||
let captured = self.capture.take();
|
||||
let (status, headers) = captured.sdk.unwrap_or_default();
|
||||
let (status, headers) = self.capture.take().unwrap_or_default();
|
||||
let headers = headers.iter().map(|(name, value)| (name.as_str(), value.as_str()));
|
||||
let (mut observation, output) = match result {
|
||||
match result {
|
||||
Ok(output) => {
|
||||
let observation = fields(&output)
|
||||
.into_iter()
|
||||
.fold(Observation::new(op, case, status, None, headers), |observation, (name, value)| {
|
||||
observation.with_field(name, value)
|
||||
});
|
||||
(observation, Some(output))
|
||||
self.observations.push(observation);
|
||||
Some(output)
|
||||
}
|
||||
Err(error) => {
|
||||
let mut observation = Observation::new(op, case, status, Some(error_code(&error)), headers);
|
||||
observation.message = error.as_service_error().and_then(|e| e.message()).map(str::to_owned);
|
||||
(observation, None)
|
||||
self.observations.push(observation);
|
||||
None
|
||||
}
|
||||
};
|
||||
observation.wire_head = captured.wire;
|
||||
self.observations.push(observation);
|
||||
output
|
||||
}
|
||||
}
|
||||
|
||||
/// Adds a field decoded after the response headers arrived (a streamed body).
|
||||
@@ -1171,64 +1151,6 @@ mod tests {
|
||||
use super::OPERATIONS;
|
||||
use super::{Observation, md5_hex, normalize_sse_c_etags};
|
||||
|
||||
#[tokio::test]
|
||||
async fn head_object_receipt_uses_the_transmitted_headers_before_the_sdk_derives_expires_string() {
|
||||
use super::{Client, Recorder, ResponseCapture, RetryConfig, build_test_s3_config, none};
|
||||
use crate::dual_stack_differential::compare::PairedReceipts;
|
||||
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
|
||||
|
||||
const DATE: &str = "Wed, 21 Oct 2037 07:28:00 GMT";
|
||||
let listener = tokio::net::TcpListener::bind(("127.0.0.1", 0)).await.unwrap();
|
||||
let endpoint = format!("http://{}", listener.local_addr().unwrap());
|
||||
let capture = ResponseCapture::default();
|
||||
let client = Client::from_conf(
|
||||
build_test_s3_config(&endpoint, "test", &uuid::Uuid::new_v4().to_string(), None, "wire-head")
|
||||
.to_builder()
|
||||
.retry_config(RetryConfig::disabled())
|
||||
.interceptor(capture.clone())
|
||||
.build(),
|
||||
);
|
||||
let mut recorder = Recorder {
|
||||
capture,
|
||||
observations: Vec::new(),
|
||||
};
|
||||
let server = async {
|
||||
for (status, extra) in [
|
||||
("200 OK", format!("Expires: {DATE}\r\nETag: \"data\"\r\n")),
|
||||
("404 Not Found", String::new()),
|
||||
] {
|
||||
let (mut socket, _) = listener.accept().await.unwrap();
|
||||
let mut lines = BufReader::new(&mut socket).lines();
|
||||
assert!(lines.next_line().await.unwrap().unwrap().starts_with("HEAD /bucket/key "));
|
||||
while !lines.next_line().await.unwrap().unwrap().is_empty() {}
|
||||
let response = format!("HTTP/1.1 {status}\r\n{extra}Content-Length: 0\r\nConnection: close\r\n\r\n");
|
||||
socket.write_all(response.as_bytes()).await.unwrap();
|
||||
}
|
||||
};
|
||||
let requests = async {
|
||||
let head = || client.head_object().bucket("bucket").key("key").send();
|
||||
let output = recorder.step("HeadObject", "expires", head(), none).await.unwrap();
|
||||
assert_eq!(output.expires_string(), Some(DATE));
|
||||
assert!(recorder.step("HeadObject", "absent", head(), none).await.is_none());
|
||||
let absent = recorder
|
||||
.step("HeadObject", "unsent", client.head_object().key("key").send(), none)
|
||||
.await;
|
||||
assert!(absent.is_none());
|
||||
};
|
||||
tokio::time::timeout(std::time::Duration::from_secs(10), async { tokio::join!(server, requests) })
|
||||
.await
|
||||
.unwrap();
|
||||
let (a, b) = recorder.observations.split_at(1);
|
||||
let receipts = serde_json::to_value(PairedReceipts::new(a, b)).unwrap();
|
||||
assert_eq!(
|
||||
receipts,
|
||||
serde_json::json!({
|
||||
"responses_a": [{"op":"HeadObject", "case":"expires", "status":200, "header_names_sha256":"bade6835ceb831c4bf589348000369e2501eec559843403cf4e596baae5367d7"}],
|
||||
"responses_b": [{"op":"HeadObject", "case":"absent", "status":404, "header_names_sha256":"ef176135a5f329e2b96dace1cc94aaf3e2a172d89d99dd5c52ab12679b7383ba"}]
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_operation_list_is_sorted_without_duplicates() {
|
||||
assert!(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Programmable fake S3 target
|
||||
|
||||
This module is the shared failure-injection boundary for replication end-to-end tests and the programmable external source for on-demand-migration (ODM) tests. It runs an in-process, path-style S3 endpoint with the RustFS gateway and an in-memory store.
|
||||
This module is the shared failure-injection boundary for replication end-to-end tests and the programmable external source for on-demand-migration (ODM) tests. It runs an in-process, path-style S3 endpoint backed by `s3s`; no production crate depends on it.
|
||||
|
||||
`FakeS3Target::start()` creates the listener. Add target buckets with `create_bucket`, point a RustFS remote target at `address()`, use `FAKE_ACCESS_KEY` / `FAKE_SECRET_KEY`, then enqueue per-operation faults with `inject`. Faults for one operation are consumed in FIFO order and do not consume faults queued for another operation. A fault is consumed only after the gateway verifies the request signature, so anonymous, other-access-key, and bad-signature traffic cannot disturb a script.
|
||||
`FakeS3Target::start()` creates the listener. Add target buckets with `create_bucket`, point a RustFS remote target at `address()`, use `FAKE_ACCESS_KEY` / `FAKE_SECRET_KEY`, then enqueue per-operation faults with `inject`. Faults for one operation are consumed in FIFO order and do not consume faults queued for another operation. A fault is consumed only after `s3s` verifies the full request signature, so anonymous, other-access-key, and bad-signature traffic cannot disturb a script.
|
||||
|
||||
Supported data operations are HeadBucket, GetBucketVersioning, ListObjectsV2, PUT/GET/HEAD/DELETE Object, Get/Put/Delete ObjectTagging (tags live per version; Put replaces the whole set, Delete clears it), and create/upload/complete/abort multipart upload. `create_bucket` models general-purpose buckets in S3's shared global namespace; account-regional namespace buckets and their `-an` names are intentionally out of scope. Buckets created with `create_bucket` are versioned: PUT creates a version, DELETE without `versionId` creates a delete marker, and DELETE with `versionId` removes exactly that version. Internal source version IDs must be UUIDs and are stored canonically. Source mtime is honored only for source-replication PUT/DELETE requests; absent or invalid values use receipt time, matching RustFS, while multipart completion always uses receipt time. Replicated versions are ordered newest-first by source mtime so late older versions and delete markers do not become current. Equal mtimes prefer objects over delete markers, then canonical UUID order; RustFS's internal FileMeta signature tie-break is intentionally out of scope because it is not part of the target S3 protocol. Multipart part numbers follow S3's `1..=10000` range, and every completed part except the final part must be at least 5 MiB.
|
||||
|
||||
|
||||
@@ -1,234 +0,0 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use super::*;
|
||||
use rustfs_gateway::{ETag, ObjectKey, dto};
|
||||
|
||||
impl FakeBackend {
|
||||
pub(super) async fn head_bucket(
|
||||
&self,
|
||||
req: TargetRequest<dto::HeadBucketInput>,
|
||||
) -> S3Result<TargetResponse<dto::HeadBucketOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
if !lock(&self.store).buckets.contains_key(req.input.bucket.as_str()) {
|
||||
return Err(s3_error!(NoSuchBucket, "bucket does not exist"));
|
||||
}
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::HeadBucketOutput::default()),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) async fn get_bucket_versioning(
|
||||
&self,
|
||||
req: TargetRequest<dto::GetBucketVersioningInput>,
|
||||
) -> S3Result<TargetResponse<dto::GetBucketVersioningOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let versioned = lock(&self.store)
|
||||
.buckets
|
||||
.get(req.input.bucket.as_str())
|
||||
.map(|bucket| bucket.versioned)
|
||||
.ok_or_else(|| s3_error!(NoSuchBucket, "bucket does not exist"))?;
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::GetBucketVersioningOutput {
|
||||
status: versioned.then_some(dto::Status::ENABLED),
|
||||
..Default::default()
|
||||
}),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) async fn get_object_lock_configuration(
|
||||
&self,
|
||||
req: TargetRequest<dto::GetObjectLockConfigurationInput>,
|
||||
) -> S3Result<TargetResponse<dto::GetObjectLockConfigurationOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let object_lock = lock(&self.store)
|
||||
.buckets
|
||||
.get(req.input.bucket.as_str())
|
||||
.map(|bucket| bucket.object_lock)
|
||||
.ok_or_else(|| s3_error!(NoSuchBucket, "bucket does not exist"))?;
|
||||
if !object_lock {
|
||||
return Err(s3_error!(
|
||||
ObjectLockConfigurationNotFoundError,
|
||||
"Object Lock configuration does not exist for this bucket"
|
||||
));
|
||||
}
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::GetObjectLockConfigurationOutput {
|
||||
object_lock_configuration: Some(dto::ObjectLockConfiguration {
|
||||
object_lock_enabled: Some(dto::ObjectLockEnabled::ENABLED),
|
||||
..Default::default()
|
||||
}),
|
||||
}),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
/// Current versions only (a key whose newest version is a delete marker
|
||||
/// is hidden), keys in byte order, `delimiter` folding into common
|
||||
/// prefixes that count toward `max-keys`, and `start-after` /
|
||||
/// `continuation-token` cursors. `encoding-type` and `fetch-owner` are
|
||||
/// accepted but ignored.
|
||||
pub(super) async fn list_objects_v2(
|
||||
&self,
|
||||
req: TargetRequest<dto::ListObjectsV2Input>,
|
||||
) -> S3Result<TargetResponse<dto::ListObjectsV2Output>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let input = req.input;
|
||||
let prefix = input.prefix.unwrap_or_default();
|
||||
let delimiter = input.delimiter.as_deref().filter(|delimiter| !delimiter.is_empty());
|
||||
let max_keys = input.max_keys.unwrap_or(MAX_LIST_KEYS).clamp(0, MAX_LIST_KEYS);
|
||||
let resume_after = input
|
||||
.continuation_token
|
||||
.as_ref()
|
||||
.map(|token| decode_continuation_token(token.as_str()))
|
||||
.transpose()?;
|
||||
let mut cursors = Vec::with_capacity(2);
|
||||
if let Some(start_after) = input.start_after.as_deref() {
|
||||
cursors.push(ListCursor {
|
||||
after: start_after,
|
||||
skips_group: false,
|
||||
});
|
||||
}
|
||||
if let Some(resume_after) = resume_after.as_deref() {
|
||||
cursors.push(ListCursor {
|
||||
after: resume_after,
|
||||
skips_group: delimiter.is_some_and(|delimiter| resume_after.ends_with(delimiter)),
|
||||
});
|
||||
}
|
||||
let page = {
|
||||
let state = lock(&self.store);
|
||||
let bucket_state = state
|
||||
.buckets
|
||||
.get(input.bucket.as_str())
|
||||
.ok_or_else(|| s3_error!(NoSuchBucket, "bucket does not exist"))?;
|
||||
list_page(
|
||||
bucket_state,
|
||||
&prefix,
|
||||
delimiter,
|
||||
&cursors,
|
||||
usize::try_from(max_keys).map_err(S3Error::internal_error)?,
|
||||
)
|
||||
};
|
||||
let next_continuation_token = page
|
||||
.truncated
|
||||
.then(|| {
|
||||
page.entries
|
||||
.last()
|
||||
.map(|entry| encode_continuation_token(entry.name()).into())
|
||||
})
|
||||
.flatten();
|
||||
let key_count = i32::try_from(page.entries.len()).map_err(S3Error::internal_error)?;
|
||||
let mut contents = Vec::new();
|
||||
let mut common_prefixes = Vec::new();
|
||||
for entry in page.entries {
|
||||
match entry {
|
||||
ListEntry::Object {
|
||||
key,
|
||||
e_tag,
|
||||
last_modified,
|
||||
size,
|
||||
} => contents.push(dto::Object {
|
||||
key: ObjectKey::new(key).map_err(S3Error::internal_error)?,
|
||||
e_tag: Some(ETag::from_stored(e_tag)),
|
||||
last_modified,
|
||||
size: i64::try_from(size).map_err(S3Error::internal_error)?,
|
||||
storage_class: dto::StorageClass::STANDARD,
|
||||
..Default::default()
|
||||
}),
|
||||
ListEntry::CommonPrefix(prefix) => common_prefixes.push(dto::CommonPrefix { prefix }),
|
||||
}
|
||||
}
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::ListObjectsV2Output {
|
||||
name: input.bucket,
|
||||
prefix,
|
||||
delimiter: input.delimiter,
|
||||
max_keys,
|
||||
key_count,
|
||||
continuation_token: input.continuation_token,
|
||||
start_after: input.start_after,
|
||||
encoding_type: input.encoding_type,
|
||||
is_truncated: page.truncated,
|
||||
next_continuation_token,
|
||||
contents,
|
||||
common_prefixes,
|
||||
..Default::default()
|
||||
}),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
/// Prefix + max-keys subset only — enough for the replication-check probe
|
||||
/// key allocation. No pagination markers or delimiter folding.
|
||||
pub(super) async fn list_object_versions(
|
||||
&self,
|
||||
req: TargetRequest<dto::ListObjectVersionsInput>,
|
||||
) -> S3Result<TargetResponse<dto::ListObjectVersionsOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let state = lock(&self.store);
|
||||
let Some(bucket_state) = state.buckets.get(req.input.bucket.as_str()) else {
|
||||
return Err(s3_error!(NoSuchBucket, "bucket does not exist"));
|
||||
};
|
||||
let prefix = req.input.prefix.as_deref().unwrap_or_default();
|
||||
let max_keys = usize::try_from(req.input.max_keys.unwrap_or(MAX_LIST_KEYS).max(0)).map_err(S3Error::internal_error)?;
|
||||
|
||||
let mut keys: Vec<&String> = bucket_state.objects.keys().filter(|key| key.starts_with(prefix)).collect();
|
||||
keys.sort();
|
||||
|
||||
let mut versions = Vec::new();
|
||||
let mut delete_markers = Vec::new();
|
||||
'keys: for key in keys {
|
||||
for version in bucket_state.objects[key].iter().rev() {
|
||||
if versions.len() + delete_markers.len() >= max_keys {
|
||||
break 'keys;
|
||||
}
|
||||
if version.delete_marker {
|
||||
delete_markers.push(dto::DeleteMarkerEntry {
|
||||
key: ObjectKey::new(key.clone()).map_err(S3Error::internal_error)?,
|
||||
version_id: version.version_id.clone().into(),
|
||||
last_modified: version.last_modified,
|
||||
..Default::default()
|
||||
});
|
||||
} else {
|
||||
versions.push(dto::ObjectVersion {
|
||||
key: ObjectKey::new(key.clone()).map_err(S3Error::internal_error)?,
|
||||
version_id: version.version_id.clone().into(),
|
||||
last_modified: version.last_modified,
|
||||
e_tag: Some(ETag::from_stored(version.e_tag.clone())),
|
||||
size: i64::try_from(version.body.len()).map_err(S3Error::internal_error)?,
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
drop(state);
|
||||
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::ListObjectVersionsOutput {
|
||||
name: req.input.bucket,
|
||||
versions,
|
||||
delete_markers,
|
||||
..Default::default()
|
||||
}),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,327 +0,0 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Multipart staging and publication for the programmable remote S3 target.
|
||||
|
||||
use super::*;
|
||||
use rustfs_gateway::{BucketName, ObjectKey, RecordedUpload, UploadIdClaim, dto};
|
||||
use rustfs_s3_types::{S3Result, s3_error};
|
||||
|
||||
impl RecordedUpload for MultipartState {
|
||||
fn bucket(&self) -> &str {
|
||||
&self.bucket
|
||||
}
|
||||
|
||||
fn key(&self) -> &str {
|
||||
&self.key
|
||||
}
|
||||
}
|
||||
|
||||
fn resolve_upload<'id, 'store>(
|
||||
state: &'store StoreState,
|
||||
claim: &'id UploadIdClaim,
|
||||
bucket: &BucketName,
|
||||
key: &ObjectKey,
|
||||
) -> S3Result<(&'id str, &'store MultipartState)> {
|
||||
let (id, upload) = rustfs_gateway::resolve_upload(claim, bucket, key, |id| state.uploads.get(id))
|
||||
.map_err(|_| s3_error!(NoSuchUpload, "multipart upload does not exist"))?;
|
||||
Ok((id.id(), upload))
|
||||
}
|
||||
|
||||
impl FakeBackend {
|
||||
pub(super) async fn create_multipart_upload(
|
||||
&self,
|
||||
req: TargetRequest<dto::CreateMultipartUploadInput>,
|
||||
) -> S3Result<TargetResponse<dto::CreateMultipartUploadOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let headers = req.headers;
|
||||
let input = req.input;
|
||||
let mut state = lock(&self.store);
|
||||
if !state.buckets.contains_key(input.bucket.as_str()) {
|
||||
return Err(s3_error!(NoSuchBucket, "bucket does not exist"));
|
||||
}
|
||||
ensure_upload_budget(&state)?;
|
||||
let metadata = (!input.metadata.is_empty()).then(|| input.metadata.into_iter().collect());
|
||||
validate_stored_metadata(&input.content_type, &metadata)?;
|
||||
let standard_headers = StandardHeaders {
|
||||
cache_control: input.cache_control,
|
||||
content_disposition: input.content_disposition,
|
||||
content_encoding: input.content_encoding,
|
||||
content_language: input.content_language,
|
||||
expires: input.expires.map(|value| value.as_str().to_owned()),
|
||||
};
|
||||
standard_headers.validate()?;
|
||||
let upload_id = Uuid::new_v4().to_string();
|
||||
// Read the flags before the mutable borrow of `state.uploads` below
|
||||
// (and never re-lock the store: the mutex is not reentrant).
|
||||
let mint_own = state.assign_own_version_ids || state.assign_own_multipart_version_ids;
|
||||
let drop_unlisted = state.drop_unlisted_replication_headers;
|
||||
let version_id = if bucket_versioned(&state, input.bucket.as_str()) {
|
||||
new_version_id(&headers, mint_own)?
|
||||
} else {
|
||||
NULL_VERSION_ID.to_string()
|
||||
};
|
||||
state.uploads.insert(
|
||||
upload_id.clone(),
|
||||
MultipartState {
|
||||
bucket: input.bucket.as_str().to_owned(),
|
||||
key: input.key.as_str().to_owned(),
|
||||
version_id,
|
||||
content_type: input.content_type,
|
||||
metadata,
|
||||
standard_headers,
|
||||
replication_sse_headers: captured_replication_sse_headers(&headers, drop_unlisted),
|
||||
lock: VersionLock::from_headers(
|
||||
input.object_lock_mode,
|
||||
input.object_lock_retain_until_date,
|
||||
input.object_lock_legal_hold_status,
|
||||
),
|
||||
parts: BTreeMap::new(),
|
||||
},
|
||||
);
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::CreateMultipartUploadOutput {
|
||||
bucket: input.bucket,
|
||||
key: input.key,
|
||||
upload_id,
|
||||
..Default::default()
|
||||
}),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) async fn upload_part(
|
||||
&self,
|
||||
req: TargetRequest<dto::UploadPartInput>,
|
||||
) -> S3Result<TargetResponse<dto::UploadPartOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
let declared_actual_size = req
|
||||
.headers
|
||||
.get("x-rustfs-replication-part-actual-size")
|
||||
.and_then(|value| value.to_str().ok())
|
||||
.and_then(|value| value.parse::<usize>().ok());
|
||||
let _body_permit = timeout(MAX_FAULT_DURATION, Arc::clone(&self.body_limit).acquire_owned())
|
||||
.await
|
||||
.map_err(|_| s3_error!(RequestTimeout, "fake target body limiter wait exceeded 30 seconds"))?
|
||||
.map_err(|_| s3_error!(ServiceUnavailable, "fake target body limiter closed"))?;
|
||||
let input = req.input;
|
||||
if !(1..=10_000).contains(&input.part_number) {
|
||||
return Err(s3_error!(InvalidArgument, "part number must be in 1..=10000"));
|
||||
}
|
||||
let max_object_bytes = lock(&self.store).limits.max_object_bytes;
|
||||
let body =
|
||||
collect_stream(input.body, Some(input.content_length), fault.as_ref(), &self.control, max_object_bytes).await?;
|
||||
let (digest, _body_permit) = md5_digest(body.clone(), _body_permit).await?;
|
||||
let e_tag = hex_simd::encode_to_string(digest, hex_simd::AsciiCase::Lower);
|
||||
let mut state = lock(&self.store);
|
||||
let (upload_id, upload) = resolve_upload(&state, &input.upload_id, &input.bucket, &input.key)?;
|
||||
let existing = upload.parts.get(&input.part_number);
|
||||
let existing_bytes = existing.map_or(0, |part| part.body.len());
|
||||
let adds_part = existing.is_none();
|
||||
ensure_part_budget(&state, adds_part)?;
|
||||
ensure_store_budget(&state, existing_bytes, body.len(), false)?;
|
||||
state.total_bytes = state.total_bytes - existing_bytes + body.len();
|
||||
if adds_part {
|
||||
state.total_parts += 1;
|
||||
}
|
||||
let upload = state.uploads.get_mut(upload_id).expect("upload existence checked above");
|
||||
upload.parts.insert(
|
||||
input.part_number,
|
||||
MultipartPart {
|
||||
body,
|
||||
e_tag: e_tag.clone(),
|
||||
digest,
|
||||
actual_size: declared_actual_size,
|
||||
},
|
||||
);
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::UploadPartOutput {
|
||||
e_tag: rustfs_gateway::ETag::from_stored(maybe_wrong_etag(fault.as_ref(), e_tag)),
|
||||
..Default::default()
|
||||
}),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) async fn complete_multipart_upload(
|
||||
&self,
|
||||
mut req: TargetRequest<dto::CompleteMultipartUploadInput>,
|
||||
) -> S3Result<TargetResponse<dto::CompleteMultipartUploadOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let _body_permits = match req.extensions.remove::<PrebodyPermit>().and_then(PrebodyPermit::take) {
|
||||
Some(permit) => permit,
|
||||
None => timeout(
|
||||
MAX_FAULT_DURATION,
|
||||
Arc::clone(&self.body_limit).acquire_many_owned(MAX_CONCURRENT_BODY_REQUESTS as u32),
|
||||
)
|
||||
.await
|
||||
.map_err(|_| s3_error!(RequestTimeout, "fake target body limiter wait exceeded 30 seconds"))?
|
||||
.map_err(|_| s3_error!(ServiceUnavailable, "fake target body limiter closed"))?,
|
||||
};
|
||||
let headers = req.headers;
|
||||
let input = req.input;
|
||||
let requested = input.multipart_upload.parts;
|
||||
if requested.is_empty() {
|
||||
return Err(s3_error!(InvalidPart, "completion omitted parts"));
|
||||
}
|
||||
let mut requested_parts = Vec::with_capacity(requested.len());
|
||||
let mut previous = 0;
|
||||
for part in &requested {
|
||||
let number = part.part_number;
|
||||
if number <= previous {
|
||||
return Err(s3_error!(InvalidPartOrder, "parts are not strictly ordered"));
|
||||
}
|
||||
previous = number;
|
||||
let requested_etag = part
|
||||
.e_tag
|
||||
.as_ref()
|
||||
.ok_or_else(|| s3_error!(InvalidPart, "part ETag is missing"))?;
|
||||
requested_parts.push((number, normalize_etag(requested_etag.opaque_tag())));
|
||||
}
|
||||
|
||||
let (upload_id, upload, selected_parts) = {
|
||||
let state = lock(&self.store);
|
||||
let (upload_id, upload) = resolve_upload(&state, &input.upload_id, &input.bucket, &input.key)?;
|
||||
let mut selected = Vec::with_capacity(requested_parts.len());
|
||||
for (index, (number, requested_etag)) in requested_parts.iter().enumerate() {
|
||||
let stored = upload
|
||||
.parts
|
||||
.get(number)
|
||||
.ok_or_else(|| s3_error!(InvalidPart, "part was not uploaded"))?;
|
||||
if requested_etag != &stored.e_tag {
|
||||
return Err(s3_error!(InvalidPart, "part ETag does not match"));
|
||||
}
|
||||
if index + 1 != requested_parts.len()
|
||||
&& stored.actual_size.unwrap_or(stored.body.len()) < MIN_MULTIPART_PART_BYTES
|
||||
{
|
||||
return Err(s3_error!(EntityTooSmall, "non-final multipart part is smaller than 5 MiB"));
|
||||
}
|
||||
selected.push((*number, stored.clone()));
|
||||
}
|
||||
(
|
||||
upload_id,
|
||||
MultipartState {
|
||||
bucket: upload.bucket.clone(),
|
||||
key: upload.key.clone(),
|
||||
version_id: upload.version_id.clone(),
|
||||
content_type: upload.content_type.clone(),
|
||||
metadata: upload.metadata.clone(),
|
||||
standard_headers: upload.standard_headers.clone(),
|
||||
replication_sse_headers: upload.replication_sse_headers.clone(),
|
||||
lock: upload.lock.clone(),
|
||||
parts: BTreeMap::new(),
|
||||
},
|
||||
selected,
|
||||
)
|
||||
};
|
||||
let max_total_bytes = lock(&self.store).limits.max_total_bytes;
|
||||
let total_len = selected_parts.iter().try_fold(0usize, |total, (_, part)| {
|
||||
total
|
||||
.checked_add(part.body.len())
|
||||
.filter(|total| *total <= max_total_bytes)
|
||||
.ok_or_else(|| s3_error!(EntityTooLarge, "multipart object exceeds {max_total_bytes} bytes"))
|
||||
})?;
|
||||
let assembly_parts = selected_parts
|
||||
.iter()
|
||||
.map(|(_, stored)| (stored.body.clone(), stored.digest))
|
||||
.collect();
|
||||
let (body, digests, _body_permits) = assemble_multipart(assembly_parts, total_len, _body_permits).await?;
|
||||
let part_count = requested.len();
|
||||
let ignore_source_etags = lock(&self.store).ignore_source_etags;
|
||||
let e_tag = source_etag(&headers)?
|
||||
.filter(|_| !ignore_source_etags)
|
||||
.unwrap_or_else(|| format!("{}-{part_count}", md5_hex(digests)));
|
||||
let version = ObjectVersion {
|
||||
version_id: upload.version_id.clone(),
|
||||
body,
|
||||
e_tag: e_tag.clone(),
|
||||
last_modified: now_timestamp(),
|
||||
delete_marker: false,
|
||||
content_type: upload.content_type,
|
||||
metadata: upload.metadata,
|
||||
standard_headers: upload.standard_headers,
|
||||
tags: Vec::new(),
|
||||
replication_sse_headers: upload.replication_sse_headers,
|
||||
lock: upload.lock,
|
||||
};
|
||||
let mut state = lock(&self.store);
|
||||
let versioned = bucket_versioned(&state, input.bucket.as_str());
|
||||
let current = state
|
||||
.uploads
|
||||
.get(upload_id)
|
||||
.filter(|current| current.bucket == input.bucket.as_str() && current.key == input.key.as_str())
|
||||
.ok_or_else(|| s3_error!(NoSuchUpload, "multipart upload does not exist"))?;
|
||||
for (part, (selected_number, selected_part)) in requested.iter().zip(&selected_parts) {
|
||||
let number = part.part_number;
|
||||
debug_assert_eq!(number, *selected_number);
|
||||
let current_part = current
|
||||
.parts
|
||||
.get(&number)
|
||||
.ok_or_else(|| s3_error!(InvalidPart, "part changed during completion"))?;
|
||||
if current_part.e_tag != selected_part.e_tag {
|
||||
return Err(s3_error!(InvalidPart, "part changed during completion"));
|
||||
}
|
||||
}
|
||||
let upload_bytes = current.parts.values().map(|part| part.body.len()).sum::<usize>();
|
||||
let upload_part_count = current.parts.len();
|
||||
let existing = state
|
||||
.buckets
|
||||
.get(input.bucket.as_str())
|
||||
.ok_or_else(|| s3_error!(NoSuchBucket, "bucket does not exist"))?
|
||||
.objects
|
||||
.get(input.key.as_str())
|
||||
.and_then(|versions| versions.iter().find(|candidate| candidate.version_id == version.version_id))
|
||||
.map(|version| version.body.len());
|
||||
ensure_store_budget(
|
||||
&state,
|
||||
upload_bytes + existing.unwrap_or_default(),
|
||||
version.body.len(),
|
||||
existing.is_none(),
|
||||
)?;
|
||||
state.total_bytes -= upload_bytes;
|
||||
state.total_parts -= upload_part_count;
|
||||
state.uploads.remove(upload_id);
|
||||
upsert_version(&mut state, input.bucket.as_str(), input.key.as_str().to_owned(), version)?;
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::CompleteMultipartUploadOutput {
|
||||
bucket: Some(input.bucket),
|
||||
key: Some(input.key),
|
||||
e_tag: Some(rustfs_gateway::ETag::from_stored(maybe_wrong_etag(fault.as_ref(), e_tag))),
|
||||
version_id: versioned.then_some(upload.version_id),
|
||||
..Default::default()
|
||||
}),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) async fn abort_multipart_upload(
|
||||
&self,
|
||||
req: TargetRequest<dto::AbortMultipartUploadInput>,
|
||||
) -> S3Result<TargetResponse<dto::AbortMultipartUploadOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let input = req.input;
|
||||
let mut state = lock(&self.store);
|
||||
let (upload_id, _) = resolve_upload(&state, &input.upload_id, &input.bucket, &input.key)?;
|
||||
let removed = state.uploads.remove(upload_id).expect("upload existence checked above");
|
||||
state.total_bytes -= removed.parts.values().map(|part| part.body.len()).sum::<usize>();
|
||||
state.total_parts -= removed.parts.len();
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::AbortMultipartUploadOutput::default()),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
}
|
||||
@@ -1,545 +0,0 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Object operations for the programmable S3 target.
|
||||
|
||||
use super::*;
|
||||
use rustfs_gateway::{ByteStream, ETag, dto};
|
||||
|
||||
impl FakeBackend {
|
||||
pub(super) async fn put_object(
|
||||
&self,
|
||||
req: TargetRequest<dto::PutObjectInput>,
|
||||
) -> S3Result<TargetResponse<dto::PutObjectOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
let _body_permit = timeout(MAX_FAULT_DURATION, Arc::clone(&self.body_limit).acquire_owned())
|
||||
.await
|
||||
.map_err(|_| s3_error!(RequestTimeout, "fake target body limiter wait exceeded 30 seconds"))?
|
||||
.map_err(|_| s3_error!(ServiceUnavailable, "fake target body limiter closed"))?;
|
||||
let headers = req.headers;
|
||||
let input = req.input;
|
||||
let (assign_own, drop_unlisted, require_checksum, ignore_source_etags, limits, versioned) = {
|
||||
let state = lock(&self.store);
|
||||
(
|
||||
state.assign_own_version_ids,
|
||||
state.drop_unlisted_replication_headers,
|
||||
state.require_checksum_for_object_lock,
|
||||
state.ignore_source_etags,
|
||||
state.limits,
|
||||
bucket_versioned(&state, input.bucket.as_str()),
|
||||
)
|
||||
};
|
||||
let transport = TransportSnapshot::from_headers(&headers);
|
||||
if require_checksum
|
||||
&& transport.object_lock_params
|
||||
&& transport.content_md5.is_none()
|
||||
&& transport.checksum_headers.is_empty()
|
||||
{
|
||||
return Err(s3_error!(
|
||||
InvalidRequest,
|
||||
"Content-MD5 OR x-amz-checksum- HTTP header is required for Put Object requests with Object Lock parameters"
|
||||
));
|
||||
}
|
||||
let body = collect_stream(
|
||||
input.body,
|
||||
Some(input.content_length),
|
||||
fault.as_ref(),
|
||||
&self.control,
|
||||
limits.max_object_bytes,
|
||||
)
|
||||
.await?;
|
||||
let mut body_permit = _body_permit;
|
||||
if let Some(expected) = &transport.content_md5 {
|
||||
let (digest, permit) = md5_digest(body.clone(), body_permit).await?;
|
||||
body_permit = permit;
|
||||
if BASE64_STANDARD.encode_to_string(digest) != expected.trim() {
|
||||
return Err(s3_error!(BadDigest, "The Content-MD5 you specified did not match what we received."));
|
||||
}
|
||||
}
|
||||
let metadata = (!input.metadata.is_empty()).then(|| input.metadata.into_iter().collect());
|
||||
validate_stored_metadata(&input.content_type, &metadata)?;
|
||||
let standard_headers = StandardHeaders {
|
||||
cache_control: input.cache_control,
|
||||
content_disposition: input.content_disposition,
|
||||
content_encoding: input.content_encoding,
|
||||
content_language: input.content_language,
|
||||
expires: input.expires.map(|value| value.into_string()),
|
||||
};
|
||||
standard_headers.validate()?;
|
||||
let version_id = if versioned {
|
||||
new_version_id(&headers, assign_own)?
|
||||
} else {
|
||||
NULL_VERSION_ID.to_string()
|
||||
};
|
||||
let e_tag = match source_etag(&headers)?.filter(|_| !ignore_source_etags) {
|
||||
Some(value) => value,
|
||||
None => {
|
||||
let (digest, permit) = md5_digest(body.clone(), body_permit).await?;
|
||||
body_permit = permit;
|
||||
hex_simd::encode_to_string(digest, hex_simd::AsciiCase::Lower)
|
||||
}
|
||||
};
|
||||
// Held until the version is stored, like every other body-bearing op.
|
||||
let _body_permit = body_permit;
|
||||
let version = ObjectVersion {
|
||||
version_id: version_id.clone(),
|
||||
body,
|
||||
e_tag: e_tag.clone(),
|
||||
last_modified: source_mtime(&headers),
|
||||
delete_marker: false,
|
||||
content_type: input.content_type,
|
||||
metadata,
|
||||
standard_headers,
|
||||
tags: Vec::new(),
|
||||
replication_sse_headers: captured_replication_sse_headers(&headers, drop_unlisted),
|
||||
lock: VersionLock::from_headers(
|
||||
input.object_lock_mode,
|
||||
input.object_lock_retain_until_date,
|
||||
input.object_lock_legal_hold_status,
|
||||
),
|
||||
};
|
||||
upsert_version(&mut lock(&self.store), input.bucket.as_str(), input.key.as_str().to_owned(), version)?;
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::PutObjectOutput {
|
||||
e_tag: ETag::from_stored(maybe_wrong_etag(fault.as_ref(), e_tag)),
|
||||
version_id: versioned.then_some(version_id),
|
||||
..Default::default()
|
||||
}),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) async fn get_object(
|
||||
&self,
|
||||
req: TargetRequest<dto::GetObjectInput>,
|
||||
) -> S3Result<TargetResponse<dto::GetObjectOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let input = req.input;
|
||||
let held_get = lock(&self.control)
|
||||
.held_get
|
||||
.as_ref()
|
||||
.filter(|held| held.bucket == input.bucket.as_str() && held.key == input.key.as_str())
|
||||
.cloned();
|
||||
if let Some(mut held) = held_get {
|
||||
held.entered.send_modify(|count| *count += 1);
|
||||
// Keep the gate installed when a request is cancelled or times out:
|
||||
// a retry must cross the same boundary before returning any bytes.
|
||||
let _ = held.released.wait_for(|released| *released).await;
|
||||
}
|
||||
let (version, versioned) = {
|
||||
let state = lock(&self.store);
|
||||
(
|
||||
find_version(&state, input.bucket.as_str(), input.key.as_str(), input.version_id.as_deref())?,
|
||||
bucket_versioned(&state, input.bucket.as_str()),
|
||||
)
|
||||
};
|
||||
let sse_customer_algorithm = stored_sse_customer_algorithm(&version);
|
||||
let served = resolve_range(input.range.as_ref(), version.body.len())?;
|
||||
let body = version.body.slice(served.range.clone());
|
||||
let body = match fault.as_ref().map(|fault| &fault.action) {
|
||||
Some(FaultAction::TruncateBodyAt(truncate_at)) => truncated_body(body, *truncate_at),
|
||||
Some(FaultAction::SlowSendBody { chunk_bytes, delay }) => slow_sent_body(body, *chunk_bytes, *delay),
|
||||
_ => ByteStream::from_bytes(body),
|
||||
};
|
||||
let mut response = TargetResponse::new(dto::GetObjectOutput {
|
||||
body: Some(body),
|
||||
content_length: Some(served.len() as i64),
|
||||
content_range: served.content_range,
|
||||
accept_ranges: Some("bytes".to_string()),
|
||||
content_type: version.content_type,
|
||||
metadata: version.metadata.unwrap_or_default().into_iter().collect(),
|
||||
cache_control: version.standard_headers.cache_control,
|
||||
content_disposition: version.standard_headers.content_disposition,
|
||||
content_encoding: version.standard_headers.content_encoding,
|
||||
content_language: version.standard_headers.content_language,
|
||||
expires: version.standard_headers.expires.map(Into::into),
|
||||
e_tag: Some(ETag::from_stored(version.e_tag)),
|
||||
last_modified: Some(version.last_modified),
|
||||
version_id: versioned.then_some(version.version_id),
|
||||
sse_customer_algorithm,
|
||||
object_lock_mode: version
|
||||
.lock
|
||||
.retention
|
||||
.as_ref()
|
||||
.map(|(mode, _)| dto::ObjectLockMode::custom(mode.clone())),
|
||||
object_lock_retain_until_date: version.lock.retention.as_ref().map(|(_, until)| *until),
|
||||
object_lock_legal_hold_status: version.lock.legal_hold_status(),
|
||||
..Default::default()
|
||||
});
|
||||
response.status = served.status;
|
||||
Ok(apply_response_fault(response, fault.as_ref()))
|
||||
}
|
||||
|
||||
pub(super) async fn head_object(
|
||||
&self,
|
||||
req: TargetRequest<dto::HeadObjectInput>,
|
||||
) -> S3Result<TargetResponse<dto::HeadObjectOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let input = req.input;
|
||||
let (version, versioned) = {
|
||||
let state = lock(&self.store);
|
||||
(
|
||||
find_version(&state, input.bucket.as_str(), input.key.as_str(), input.version_id.as_deref())?,
|
||||
bucket_versioned(&state, input.bucket.as_str()),
|
||||
)
|
||||
};
|
||||
let sse_customer_algorithm = stored_sse_customer_algorithm(&version);
|
||||
let served = resolve_range(input.range.as_ref(), version.body.len())?;
|
||||
let mut response = TargetResponse::new(dto::HeadObjectOutput {
|
||||
content_length: Some(served.len() as i64),
|
||||
content_range: served.content_range,
|
||||
accept_ranges: Some("bytes".to_string()),
|
||||
content_type: version.content_type,
|
||||
metadata: version.metadata.unwrap_or_default().into_iter().collect(),
|
||||
cache_control: version.standard_headers.cache_control,
|
||||
content_disposition: version.standard_headers.content_disposition,
|
||||
content_encoding: version.standard_headers.content_encoding,
|
||||
content_language: version.standard_headers.content_language,
|
||||
expires: version.standard_headers.expires.map(Into::into),
|
||||
e_tag: Some(ETag::from_stored(version.e_tag)),
|
||||
last_modified: Some(version.last_modified),
|
||||
version_id: versioned.then_some(version.version_id),
|
||||
sse_customer_algorithm,
|
||||
object_lock_mode: version
|
||||
.lock
|
||||
.retention
|
||||
.as_ref()
|
||||
.map(|(mode, _)| dto::ObjectLockMode::custom(mode.clone())),
|
||||
object_lock_retain_until_date: version.lock.retention.as_ref().map(|(_, until)| *until),
|
||||
object_lock_legal_hold_status: version.lock.legal_hold_status(),
|
||||
..Default::default()
|
||||
});
|
||||
response.status = served.status;
|
||||
Ok(apply_response_fault(response, fault.as_ref()))
|
||||
}
|
||||
|
||||
pub(super) async fn get_object_tagging(
|
||||
&self,
|
||||
req: TargetRequest<dto::GetObjectTaggingInput>,
|
||||
) -> S3Result<TargetResponse<dto::GetObjectTaggingOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let input = req.input;
|
||||
let (version, versioned) = {
|
||||
let state = lock(&self.store);
|
||||
(
|
||||
find_version(&state, input.bucket.as_str(), input.key.as_str(), input.version_id.as_deref())?,
|
||||
bucket_versioned(&state, input.bucket.as_str()),
|
||||
)
|
||||
};
|
||||
let tag_set = version
|
||||
.tags
|
||||
.into_iter()
|
||||
.map(|(key, value)| dto::Tag {
|
||||
key: Some(key),
|
||||
value: Some(value),
|
||||
})
|
||||
.collect();
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::GetObjectTaggingOutput {
|
||||
tag_set,
|
||||
version_id: versioned.then_some(version.version_id),
|
||||
}),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) async fn put_object_tagging(
|
||||
&self,
|
||||
req: TargetRequest<dto::PutObjectTaggingInput>,
|
||||
) -> S3Result<TargetResponse<dto::PutObjectTaggingOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let input = req.input;
|
||||
let tags = input
|
||||
.tagging
|
||||
.tag_set
|
||||
.into_iter()
|
||||
.map(|tag| (tag.key.unwrap_or_default(), tag.value.unwrap_or_default()))
|
||||
.collect();
|
||||
let (version_id, versioned) = {
|
||||
let mut state = lock(&self.store);
|
||||
(
|
||||
set_version_tags(&mut state, input.bucket.as_str(), input.key.as_str(), input.version_id.as_deref(), tags)?,
|
||||
bucket_versioned(&state, input.bucket.as_str()),
|
||||
)
|
||||
};
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::PutObjectTaggingOutput {
|
||||
version_id: versioned.then_some(version_id),
|
||||
}),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) async fn get_object_retention(
|
||||
&self,
|
||||
req: TargetRequest<dto::GetObjectRetentionInput>,
|
||||
) -> S3Result<TargetResponse<dto::GetObjectRetentionOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let input = req.input;
|
||||
let version = find_version(&lock(&self.store), input.bucket.as_str(), input.key.as_str(), input.version_id.as_deref())?;
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::GetObjectRetentionOutput {
|
||||
retention: version.lock.retention.map(|(mode, until)| dto::ObjectLockRetention {
|
||||
mode: Some(dto::Mode::custom(mode)),
|
||||
retain_until_date: Some(until),
|
||||
..Default::default()
|
||||
}),
|
||||
}),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) async fn put_object_retention(
|
||||
&self,
|
||||
req: TargetRequest<dto::PutObjectRetentionInput>,
|
||||
) -> S3Result<TargetResponse<dto::PutObjectRetentionOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let input = req.input;
|
||||
let retention = input
|
||||
.retention
|
||||
.mode
|
||||
.zip(input.retention.retain_until_date)
|
||||
.map(|(mode, until)| (mode.as_str().to_string(), until));
|
||||
update_version_lock(
|
||||
&mut lock(&self.store),
|
||||
input.bucket.as_str(),
|
||||
input.key.as_str(),
|
||||
input.version_id.as_deref(),
|
||||
|lock| {
|
||||
lock.retention = retention;
|
||||
},
|
||||
)?;
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::PutObjectRetentionOutput::default()),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) async fn get_object_legal_hold(
|
||||
&self,
|
||||
req: TargetRequest<dto::GetObjectLegalHoldInput>,
|
||||
) -> S3Result<TargetResponse<dto::GetObjectLegalHoldOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let input = req.input;
|
||||
let version = find_version(&lock(&self.store), input.bucket.as_str(), input.key.as_str(), input.version_id.as_deref())?;
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::GetObjectLegalHoldOutput {
|
||||
legal_hold: Some(dto::ObjectLockLegalHold {
|
||||
status: Some(if version.lock.legal_hold == Some(true) {
|
||||
dto::Status::ON
|
||||
} else {
|
||||
dto::Status::OFF
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) async fn put_object_legal_hold(
|
||||
&self,
|
||||
req: TargetRequest<dto::PutObjectLegalHoldInput>,
|
||||
) -> S3Result<TargetResponse<dto::PutObjectLegalHoldOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let input = req.input;
|
||||
let legal_hold_on = input
|
||||
.legal_hold
|
||||
.status
|
||||
.is_some_and(|status| status.as_str().eq_ignore_ascii_case("ON"));
|
||||
update_version_lock(
|
||||
&mut lock(&self.store),
|
||||
input.bucket.as_str(),
|
||||
input.key.as_str(),
|
||||
input.version_id.as_deref(),
|
||||
|lock| {
|
||||
lock.legal_hold = Some(legal_hold_on);
|
||||
},
|
||||
)?;
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::PutObjectLegalHoldOutput::default()),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) async fn delete_object_tagging(
|
||||
&self,
|
||||
req: TargetRequest<dto::DeleteObjectTaggingInput>,
|
||||
) -> S3Result<TargetResponse<dto::DeleteObjectTaggingOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let input = req.input;
|
||||
let (version_id, versioned) = {
|
||||
let mut state = lock(&self.store);
|
||||
(
|
||||
set_version_tags(
|
||||
&mut state,
|
||||
input.bucket.as_str(),
|
||||
input.key.as_str(),
|
||||
input.version_id.as_deref(),
|
||||
Vec::new(),
|
||||
)?,
|
||||
bucket_versioned(&state, input.bucket.as_str()),
|
||||
)
|
||||
};
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::DeleteObjectTaggingOutput {
|
||||
version_id: versioned.then_some(version_id),
|
||||
}),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
|
||||
pub(super) async fn delete_object(
|
||||
&self,
|
||||
req: TargetRequest<dto::DeleteObjectInput>,
|
||||
) -> S3Result<TargetResponse<dto::DeleteObjectOutput>> {
|
||||
let fault = request_fault(&req);
|
||||
apply_non_body_fault(fault.as_ref(), &self.control).await?;
|
||||
let headers = req.headers;
|
||||
let input = req.input;
|
||||
let held_delete = lock(&self.control)
|
||||
.held_delete
|
||||
.as_ref()
|
||||
.filter(|held| held.bucket == input.bucket.as_str() && held.key == input.key.as_str())
|
||||
.cloned();
|
||||
if let Some(mut held) = held_delete {
|
||||
held.entered.send_modify(|count| *count += 1);
|
||||
let _ = held.released.wait_for(|released| *released).await;
|
||||
}
|
||||
let mut state = lock(&self.store);
|
||||
let Some(versioned) = state.buckets.get(input.bucket.as_str()).map(|bucket| bucket.versioned) else {
|
||||
return Err(s3_error!(NoSuchBucket, "bucket does not exist"));
|
||||
};
|
||||
if !versioned {
|
||||
// Unversioned buckets know only the `null` version: DELETE removes
|
||||
// the key outright and never writes a delete marker.
|
||||
if input
|
||||
.version_id
|
||||
.as_deref()
|
||||
.is_some_and(|version_id| version_id != NULL_VERSION_ID)
|
||||
{
|
||||
return Err(s3_error!(InvalidArgument, "invalid version id specified"));
|
||||
}
|
||||
let removed = state
|
||||
.buckets
|
||||
.get_mut(input.bucket.as_str())
|
||||
.expect("bucket existence checked above")
|
||||
.objects
|
||||
.remove(input.key.as_str())
|
||||
.unwrap_or_default();
|
||||
state.total_bytes -= removed.iter().map(|version| version.body.len()).sum::<usize>();
|
||||
state.total_versions -= removed.len();
|
||||
return Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::DeleteObjectOutput::default()),
|
||||
fault.as_ref(),
|
||||
));
|
||||
}
|
||||
if let Some(version_id) = input.version_id {
|
||||
let reject_unknown = state.reject_unknown_version_deletes;
|
||||
let (removed_bytes, removed_versions, delete_marker, remove_key) = {
|
||||
let Some(versions) = state
|
||||
.buckets
|
||||
.get_mut(input.bucket.as_str())
|
||||
.expect("bucket existence checked above")
|
||||
.objects
|
||||
.get_mut(input.key.as_str())
|
||||
else {
|
||||
if reject_unknown {
|
||||
return Err(s3_error!(NoSuchVersion, "The specified version does not exist."));
|
||||
}
|
||||
return Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::DeleteObjectOutput {
|
||||
version_id: Some(version_id),
|
||||
..Default::default()
|
||||
}),
|
||||
fault.as_ref(),
|
||||
));
|
||||
};
|
||||
if reject_unknown && !versions.iter().any(|version| version.version_id == version_id) {
|
||||
return Err(s3_error!(NoSuchVersion, "The specified version does not exist."));
|
||||
}
|
||||
let mut removed_bytes = 0usize;
|
||||
let mut removed_versions = 0usize;
|
||||
let mut delete_marker = None;
|
||||
versions.retain(|version| {
|
||||
if version.version_id == version_id {
|
||||
removed_bytes += version.body.len();
|
||||
removed_versions += 1;
|
||||
delete_marker.get_or_insert(version.delete_marker);
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
});
|
||||
(removed_bytes, removed_versions, delete_marker, versions.is_empty())
|
||||
};
|
||||
if remove_key {
|
||||
state
|
||||
.buckets
|
||||
.get_mut(input.bucket.as_str())
|
||||
.expect("bucket existence checked above")
|
||||
.objects
|
||||
.remove(input.key.as_str());
|
||||
}
|
||||
state.total_bytes -= removed_bytes;
|
||||
state.total_versions -= removed_versions;
|
||||
return Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::DeleteObjectOutput {
|
||||
delete_marker,
|
||||
version_id: Some(version_id),
|
||||
..Default::default()
|
||||
}),
|
||||
fault.as_ref(),
|
||||
));
|
||||
}
|
||||
|
||||
// `state` is the live store guard: read the flag from it. Re-locking
|
||||
// would self-deadlock (the store mutex is not reentrant).
|
||||
let version_id = new_version_id(&headers, state.assign_own_version_ids)?;
|
||||
upsert_version(
|
||||
&mut state,
|
||||
input.bucket.as_str(),
|
||||
input.key.as_str().to_owned(),
|
||||
ObjectVersion {
|
||||
version_id: version_id.clone(),
|
||||
body: Bytes::new(),
|
||||
e_tag: String::new(),
|
||||
last_modified: source_mtime(&headers),
|
||||
delete_marker: true,
|
||||
content_type: None,
|
||||
metadata: None,
|
||||
standard_headers: StandardHeaders::default(),
|
||||
tags: Vec::new(),
|
||||
replication_sse_headers: Vec::new(),
|
||||
lock: VersionLock::default(),
|
||||
},
|
||||
)?;
|
||||
Ok(apply_response_fault(
|
||||
TargetResponse::new(dto::DeleteObjectOutput {
|
||||
delete_marker: Some(true),
|
||||
version_id: Some(version_id),
|
||||
..Default::default()
|
||||
}),
|
||||
fault.as_ref(),
|
||||
))
|
||||
}
|
||||
}
|
||||
@@ -1,255 +0,0 @@
|
||||
// Copyright 2024 RustFS Team
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! The loopback target's authenticated gateway and scripted wire responses.
|
||||
|
||||
use super::*;
|
||||
use rustfs_gateway::{
|
||||
Authorizer, AuthzRequest, BoxFuture, CodecError, Credentials, Decision, ErrorCode, Handler, HandlerDeadlineConfig,
|
||||
HandlerError, HandlerErrorContext, HandlerResult, InputAuthzRequest, InputDecisions, LegacyRustfsFacts, LegacyRustfsRefusal,
|
||||
Operation as GatewayOperation, PlaintextCustomerKeyAck, RegionSet, Req, RequestBodyDeadlineConfig, RequestContext, Resp,
|
||||
ServiceBuilder, ServiceConfig, SigV4Authenticator, SseConfig, StaticCredentials,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(super) struct RequestState(Arc<State>);
|
||||
|
||||
struct State {
|
||||
method: Method,
|
||||
uri: Uri,
|
||||
headers: HeaderMap,
|
||||
sequence: RequestSequence,
|
||||
admitted: OnceLock<http::Extensions>,
|
||||
// A scripted target can deliberately replace a typed header such as ETag on the wire.
|
||||
response_headers: OnceLock<(u16, HeaderMap)>,
|
||||
}
|
||||
|
||||
impl RequestState {
|
||||
pub(super) fn new<B>(request: &Request<B>) -> Self {
|
||||
Self(Arc::new(State {
|
||||
method: request.method().clone(),
|
||||
uri: request.uri().clone(),
|
||||
headers: request.headers().clone(),
|
||||
sequence: RequestSequence::default(),
|
||||
admitted: OnceLock::new(),
|
||||
response_headers: OnceLock::new(),
|
||||
}))
|
||||
}
|
||||
|
||||
pub(super) fn sequence(&self) -> Option<u64> {
|
||||
self.0.sequence.0.get().copied()
|
||||
}
|
||||
|
||||
fn save_headers(&self, status: u16, headers: HeaderMap) {
|
||||
if !headers.is_empty() {
|
||||
let _ = self.0.response_headers.set((status, headers));
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn apply_response<B>(&self, response: &mut Response<B>) {
|
||||
let Some((status, headers)) = self.0.response_headers.get() else { return };
|
||||
if *status == response.status().as_u16() {
|
||||
response.headers_mut().extend(headers.clone());
|
||||
} else if let Some(disconnect) = headers.get(DISCONNECT_HEADER) {
|
||||
// Dropping a partially consumed upload can also produce a gateway body error. The
|
||||
// scripted transport disconnect was already reached and must still close the socket.
|
||||
response.headers_mut().insert(DISCONNECT_HEADER, disconnect.clone());
|
||||
}
|
||||
}
|
||||
|
||||
fn error(&self, error: S3Error) -> HandlerError {
|
||||
let parts = error.into_parts();
|
||||
let status = parts
|
||||
.status
|
||||
.or_else(|| parts.code.status_code())
|
||||
.unwrap_or(StatusCode::INTERNAL_SERVER_ERROR);
|
||||
let code = ErrorCode::custom(parts.code.as_str().to_owned(), status);
|
||||
let message = parts
|
||||
.message
|
||||
.map(|message| message.into_owned())
|
||||
.or_else(|| parts.code.default_message().map(str::to_owned));
|
||||
match LegacyRustfsRefusal::new(code, message, LegacyRustfsFacts::default()) {
|
||||
Ok(refusal) => {
|
||||
self.save_headers(status.as_u16(), parts.headers.unwrap_or_default());
|
||||
HandlerErrorContext::legacy_rustfs(refusal).into()
|
||||
}
|
||||
Err(_) => HandlerError::internal_error("invalid fake target error"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn credential_decision(request: &AuthzRequest<'_>) -> Decision {
|
||||
if request
|
||||
.identity
|
||||
.is_some_and(|identity| identity.access_key_id() == FAKE_ACCESS_KEY)
|
||||
{
|
||||
Decision::Allow
|
||||
} else {
|
||||
Decision::Deny
|
||||
}
|
||||
}
|
||||
|
||||
impl Authorizer for FaultAccess {
|
||||
fn authorize_route<'a>(&'a self, _context: &'a RequestContext<'a>, request: &'a AuthzRequest<'a>) -> BoxFuture<'a, Decision> {
|
||||
Box::pin(async move { credential_decision(request) })
|
||||
}
|
||||
|
||||
fn authorize_route_result<'a>(
|
||||
&'a self,
|
||||
context: &'a RequestContext<'a>,
|
||||
request: &'a AuthzRequest<'a>,
|
||||
) -> BoxFuture<'a, Result<Decision, HandlerError>> {
|
||||
Box::pin(async move {
|
||||
if credential_decision(request) != Decision::Allow {
|
||||
return Err(HandlerError::new(ErrorCode::ACCESS_DENIED, "valid fixture credentials are required"));
|
||||
}
|
||||
let state = context.server_extensions().get::<RequestState>().ok_or_else(missing_state)?;
|
||||
// The gateway can ask several permissions for a single operation. Dispatch consumes
|
||||
// one fault and journals one request, after the signature has been verified.
|
||||
if state.0.admitted.get().is_none() {
|
||||
let extensions = self
|
||||
.admit(
|
||||
&state.0.method,
|
||||
&state.0.uri,
|
||||
&state.0.headers,
|
||||
operation_from_s3_name(request.operation),
|
||||
&state.0.sequence,
|
||||
)
|
||||
.await
|
||||
.map_err(|error| state.error(error))?;
|
||||
state
|
||||
.0
|
||||
.admitted
|
||||
.set(extensions)
|
||||
.map_err(|_| HandlerError::internal_error("fixture request admitted twice"))?;
|
||||
}
|
||||
Ok(Decision::Allow)
|
||||
})
|
||||
}
|
||||
|
||||
fn authorize_input<'a>(
|
||||
&'a self,
|
||||
_context: &'a RequestContext<'a>,
|
||||
request: &'a InputAuthzRequest<'a>,
|
||||
) -> BoxFuture<'a, InputDecisions> {
|
||||
Box::pin(async move { request.decide_all(credential_decision(request.route()), credential_decision) })
|
||||
}
|
||||
}
|
||||
|
||||
fn missing_state() -> HandlerError {
|
||||
HandlerError::internal_error("missing fake target request state")
|
||||
}
|
||||
|
||||
fn target_request<O: GatewayOperation>(request: Req<O>) -> Result<(RequestState, TargetRequest<O::Input>), HandlerError> {
|
||||
let state = request
|
||||
.context()
|
||||
.transport_extensions()
|
||||
.get::<RequestState>()
|
||||
.cloned()
|
||||
.ok_or_else(missing_state)?;
|
||||
let extensions = state.0.admitted.get().cloned().ok_or_else(missing_state)?;
|
||||
let target = TargetRequest {
|
||||
input: request.into_input(),
|
||||
headers: state.0.headers.clone(),
|
||||
extensions,
|
||||
};
|
||||
Ok((state, target))
|
||||
}
|
||||
|
||||
fn target_response<O: GatewayOperation>(state: &RequestState, response: S3Result<TargetResponse<O::Output>>) -> HandlerResult<O> {
|
||||
let TargetResponse { output, headers, status } = response.map_err(|error| state.error(error))?;
|
||||
let response = match status {
|
||||
Some(status) => Resp::<O>::with_status(output, status.as_u16()),
|
||||
None => Resp::<O>::new(output),
|
||||
};
|
||||
state.save_headers(response.status(), headers);
|
||||
Ok(response)
|
||||
}
|
||||
|
||||
macro_rules! fixture_operations {
|
||||
($($operation:ident => $method:ident),+ $(,)?) => {
|
||||
$(impl Handler<dto::$operation> for FakeBackend {
|
||||
async fn call(&self, request: Req<dto::$operation>) -> HandlerResult<dto::$operation> {
|
||||
let (state, request) = target_request(request)?;
|
||||
target_response::<dto::$operation>(&state, self.$method(request).await)
|
||||
}
|
||||
})+
|
||||
|
||||
fn register_operations(builder: ServiceBuilder, backend: &Arc<FakeBackend>) -> ServiceBuilder {
|
||||
builder$(.register::<dto::$operation, _>(Arc::clone(backend)))+
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fixture_operations! {
|
||||
HeadBucket => head_bucket,
|
||||
GetBucketVersioning => get_bucket_versioning,
|
||||
GetObjectLockConfiguration => get_object_lock_configuration,
|
||||
ListObjectsV2 => list_objects_v2,
|
||||
ListObjectVersions => list_object_versions,
|
||||
PutObject => put_object,
|
||||
GetObject => get_object,
|
||||
HeadObject => head_object,
|
||||
GetObjectTagging => get_object_tagging,
|
||||
PutObjectTagging => put_object_tagging,
|
||||
DeleteObjectTagging => delete_object_tagging,
|
||||
GetObjectRetention => get_object_retention,
|
||||
PutObjectRetention => put_object_retention,
|
||||
GetObjectLegalHold => get_object_legal_hold,
|
||||
PutObjectLegalHold => put_object_legal_hold,
|
||||
DeleteObject => delete_object,
|
||||
CreateMultipartUpload => create_multipart_upload,
|
||||
UploadPart => upload_part,
|
||||
AbortMultipartUpload => abort_multipart_upload,
|
||||
}
|
||||
|
||||
impl Handler<dto::CompleteMultipartUpload> for FakeBackend {
|
||||
async fn call(&self, request: Req<dto::CompleteMultipartUpload>) -> HandlerResult<dto::CompleteMultipartUpload> {
|
||||
let (state, request) = target_request(request)?;
|
||||
target_response::<dto::CompleteMultipartUpload>(&state, self.complete_multipart_upload(request).await)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn build(backend: FakeBackend, access: FaultAccess) -> Result<S3Service, BoxError> {
|
||||
let credentials = Credentials::new(FAKE_ACCESS_KEY, FAKE_SECRET_KEY.as_bytes())?;
|
||||
let authenticator =
|
||||
SigV4Authenticator::new(Arc::new(StaticCredentials::new().with(credentials)), RegionSet::new(["us-east-1"])?);
|
||||
// The target bounds the body reader and the entire request itself. A scripted delay or
|
||||
// slow drain must reach that bound without the gateway timing it out earlier.
|
||||
let config = ServiceConfig::new(MAX_BUFFERED_BODY_BYTES as u64)
|
||||
.with_handler_deadlines(HandlerDeadlineConfig::new(MAX_REQUEST_DURATION, MAX_REQUEST_DURATION)?)
|
||||
.with_request_body_deadlines(
|
||||
RequestBodyDeadlineConfig::S3
|
||||
.without_idle_deadlines()
|
||||
.without_throughput_floor(),
|
||||
);
|
||||
let (builder, _) = ServiceBuilder::new()
|
||||
.rustfs_profile()
|
||||
.authenticate_before_rejecting_unframed_upload_trailers()
|
||||
.config(config);
|
||||
let backend = Arc::new(backend);
|
||||
let service = register_operations(builder, &backend)
|
||||
.sse_config(SseConfig::allowing_customer_keys_over_plaintext(
|
||||
PlaintextCustomerKeyAck::i_understand_customer_keys_will_be_sent_in_the_clear(),
|
||||
))
|
||||
.authenticator(authenticator.rustfs_profile())
|
||||
.authorizer(access)
|
||||
.register_with_decode_error_mapping::<dto::CompleteMultipartUpload, _>(
|
||||
backend,
|
||||
CodecError::malformed_xml("the body omits a member the schema requires").about("PartNumber"),
|
||||
CodecError::new(ErrorCode::INVALID_PART, "part number is missing"),
|
||||
)
|
||||
.build()?;
|
||||
Ok(service)
|
||||
}
|
||||
@@ -1080,7 +1080,6 @@ mod tests {
|
||||
assert!(!has_file_under(&disk0), "disk0 must be empty immediately after runtime wipe");
|
||||
|
||||
let mut remaining_rebuild_keys: HashSet<String> = objects.iter().map(|(key, _, _)| key.clone()).collect();
|
||||
let format_path = disk0.join(".rustfs.sys").join("format.json");
|
||||
for _ in 0..heal_timeout_secs {
|
||||
for (key, body, _) in &objects {
|
||||
assert_object_body(&env, bucket, key, body).await;
|
||||
@@ -1098,17 +1097,18 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
if remaining_rebuild_keys.is_empty() && format_path.is_file() {
|
||||
if remaining_rebuild_keys.is_empty() {
|
||||
assert!(
|
||||
disk0.join(".rustfs.sys").join("format.json").is_file(),
|
||||
"runtime-wiped disk should have format.json restored by auto heal"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
sleep(Duration::from_secs(1)).await;
|
||||
}
|
||||
|
||||
panic!(
|
||||
"runtime-wiped disk did not recover within timeout: missing object metadata={remaining_rebuild_keys:?}, format.json present={}",
|
||||
format_path.is_file()
|
||||
);
|
||||
panic!("auto heal did not rebuild all files on the runtime-wiped disk within timeout");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -1435,38 +1435,16 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
struct ScannerWaitDiagnostics {
|
||||
previous_cycle_end: u64,
|
||||
nodes: Vec<String>,
|
||||
}
|
||||
|
||||
impl Drop for ScannerWaitDiagnostics {
|
||||
fn drop(&mut self) {
|
||||
// The scenario timeout can cancel a poll before its own deadline.
|
||||
if !self.nodes.is_empty() {
|
||||
eprintln!(
|
||||
"Last scanner observations while waiting for a cycle after {}: {:?}",
|
||||
self.previous_cycle_end, self.nodes
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn wait_for_scanner_cycle_after(
|
||||
cluster: &RustFSTestClusterEnvironment,
|
||||
previous_cycle_end: u64,
|
||||
) -> Result<u64, Box<dyn Error + Send + Sync>> {
|
||||
let mut deadline = Instant::now() + Duration::from_secs(60);
|
||||
let mut accounted_schedules = HashSet::new();
|
||||
let mut diagnostics = ScannerWaitDiagnostics {
|
||||
previous_cycle_end,
|
||||
nodes: (0..cluster.nodes.len())
|
||||
.map(|index| format!("node{index}: not polled yet"))
|
||||
.collect(),
|
||||
};
|
||||
loop {
|
||||
let mut latest_cycle_end = 0;
|
||||
let mut versions_observed = false;
|
||||
let mut observations = Vec::with_capacity(cluster.nodes.len());
|
||||
for (node_index, node) in cluster.nodes.iter().enumerate() {
|
||||
let response = timeout(
|
||||
Duration::from_secs(5),
|
||||
@@ -1483,16 +1461,16 @@ mod tests {
|
||||
let (status, body) = match response {
|
||||
Ok(Ok(response)) => response,
|
||||
Ok(Err(error)) => {
|
||||
diagnostics.nodes[node_index] = format!("node{node_index}: scanner status request failed: {error}");
|
||||
observations.push(format!("node{node_index}: scanner status request failed: {error}"));
|
||||
continue;
|
||||
}
|
||||
Err(_) => {
|
||||
diagnostics.nodes[node_index] = format!("node{node_index}: scanner status request exceeded 5s");
|
||||
observations.push(format!("node{node_index}: scanner status request exceeded 5s"));
|
||||
continue;
|
||||
}
|
||||
};
|
||||
if status != 200 {
|
||||
diagnostics.nodes[node_index] = format!("node{node_index}: scanner status returned {status}: {body}");
|
||||
observations.push(format!("node{node_index}: scanner status returned {status}: {body}"));
|
||||
continue;
|
||||
}
|
||||
let status: serde_json::Value = serde_json::from_str(&body)?;
|
||||
@@ -1538,25 +1516,22 @@ mod tests {
|
||||
latest_cycle_end = latest_cycle_end.max(cycle_end);
|
||||
}
|
||||
versions_observed |= versions_scanned > 0;
|
||||
diagnostics.nodes[node_index] = format!(
|
||||
"node{node_index}: end={cycle_end}, versions={versions_scanned}, cycle={}, active={}, leader={}, result={}, partial_reason={}, partial_stage={}, schedule={}",
|
||||
observations.push(format!(
|
||||
"node{node_index}: end={cycle_end}, versions={versions_scanned}, cycle={}, active={}, leader={}, result={}, partial_reason={}, schedule={}",
|
||||
metrics["current_cycle"],
|
||||
metrics["current_cycle_active"],
|
||||
metrics["leader_lock_state"],
|
||||
metrics["last_cycle_result"],
|
||||
metrics["last_cycle_partial_reason"],
|
||||
metrics["last_cycle_partial_stage"],
|
||||
schedule,
|
||||
);
|
||||
));
|
||||
}
|
||||
// The coordinator records cycle completion, but remote workers
|
||||
// record scanned versions. Both witnesses need not share a node.
|
||||
if latest_cycle_end > previous_cycle_end && versions_observed {
|
||||
diagnostics.nodes.clear();
|
||||
return Ok(latest_cycle_end);
|
||||
}
|
||||
if Instant::now() >= deadline {
|
||||
let observations = std::mem::take(&mut diagnostics.nodes);
|
||||
return Err(format!(
|
||||
"enabled scanner did not complete an object-scanning cycle after {previous_cycle_end}: {observations:?}"
|
||||
)
|
||||
|
||||
@@ -114,7 +114,7 @@ async fn select_projects_encryption_headers_and_rejects_invalid_sse_c_before_str
|
||||
let log_path = format!("{}/server.log", kms.base_env.temp_dir);
|
||||
kms.base_env.capture_log_path = Some(log_path.clone());
|
||||
kms.base_env
|
||||
.start_rustfs_server_with_env(Vec::new(), &[("RUST_LOG", "rustfs_gateway=debug,rustfs=info")])
|
||||
.start_rustfs_server_with_env(Vec::new(), &[("RUST_LOG", "s3s=debug,rustfs=info")])
|
||||
.await?;
|
||||
let key_id = kms.configure_local_kms().await?;
|
||||
start_kms(&kms.base_env.url, &kms.base_env.access_key, &kms.base_env.secret_key).await?;
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
mod access_request_validation_test;
|
||||
|
||||
#[cfg(test)]
|
||||
mod storage_metric_ownership_test;
|
||||
|
||||
@@ -107,9 +105,6 @@ mod replication_target_matrix_test;
|
||||
#[cfg(test)]
|
||||
mod data_usage_test;
|
||||
|
||||
#[cfg(test)]
|
||||
mod scanner_wide_directory_test;
|
||||
|
||||
// KMS-specific test modules
|
||||
#[cfg(test)]
|
||||
mod kms;
|
||||
@@ -323,10 +318,6 @@ mod presigned_negative_test;
|
||||
#[cfg(test)]
|
||||
mod negative_sigv4_test;
|
||||
|
||||
// Dual-stack signature admission matrix and historical GHSA regressions (backlog#2781 T3.10).
|
||||
#[cfg(test)]
|
||||
mod sec_signature_matrix_test;
|
||||
|
||||
#[cfg(test)]
|
||||
mod stale_multipart_cleanup_cluster_test;
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
mod tests {
|
||||
use crate::common::{RustFSTestEnvironment, init_logging};
|
||||
use aws_sdk_s3::Client;
|
||||
use aws_sdk_s3::error::ProvideErrorMetadata;
|
||||
use aws_sdk_s3::primitives::ByteStream;
|
||||
use aws_sdk_s3::types::{BucketVersioningStatus, VersioningConfiguration};
|
||||
use tracing::info;
|
||||
@@ -178,53 +177,6 @@ mod tests {
|
||||
Some(false),
|
||||
"Delete marker should no longer be latest after the second put"
|
||||
);
|
||||
|
||||
let expected = [
|
||||
(second_version_id.as_str(), false),
|
||||
(delete_marker_version_id.as_str(), true),
|
||||
(first_version_id.as_str(), false),
|
||||
];
|
||||
let mut key_marker = None;
|
||||
let mut version_marker = None;
|
||||
for (index, (version_id, is_delete_marker)) in expected.iter().copied().enumerate() {
|
||||
let page = client
|
||||
.list_object_versions()
|
||||
.bucket(bucket)
|
||||
.prefix(key)
|
||||
.max_keys(1)
|
||||
.set_key_marker(key_marker)
|
||||
.set_version_id_marker(version_marker)
|
||||
.send()
|
||||
.await
|
||||
.expect("Failed to list a page of object versions");
|
||||
let entry = match (page.versions(), page.delete_markers()) {
|
||||
([version], []) => (version.key(), version.version_id(), false),
|
||||
([], [marker]) => (marker.key(), marker.version_id(), true),
|
||||
_ => panic!("Expected exactly one version or delete marker on page {}", index + 1),
|
||||
};
|
||||
assert_eq!(entry, (Some(key), Some(version_id), is_delete_marker));
|
||||
let more = index + 1 < expected.len();
|
||||
assert_eq!(page.is_truncated(), Some(more));
|
||||
if more {
|
||||
assert!(page.next_key_marker().is_some_and(|marker| !marker.is_empty()));
|
||||
assert!(page.next_version_id_marker().is_some_and(|marker| !marker.is_empty()));
|
||||
} else {
|
||||
assert!(page.next_key_marker().is_none());
|
||||
assert!(page.next_version_id_marker().is_none());
|
||||
}
|
||||
key_marker = page.next_key_marker().map(str::to_owned);
|
||||
version_marker = page.next_version_id_marker().map(str::to_owned);
|
||||
}
|
||||
|
||||
let error = client
|
||||
.list_object_versions()
|
||||
.bucket(bucket)
|
||||
.version_id_marker(&first_version_id)
|
||||
.send()
|
||||
.await
|
||||
.expect_err("A version ID marker requires a key marker");
|
||||
assert_eq!(error.raw_response().map(|response| response.status().as_u16()), Some(400));
|
||||
assert_eq!(error.as_service_error().and_then(ProvideErrorMetadata::code), Some("InvalidArgument"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::common::RustFSTestEnvironment;
|
||||
use crate::common::{DEFAULT_ACCESS_KEY, DEFAULT_SECRET_KEY, RustFSTestEnvironment};
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use std::time::Duration;
|
||||
@@ -75,7 +75,7 @@ async fn test_mc_mirror_small_bucket_completes_without_list_timeout() -> TestRes
|
||||
env.create_test_bucket(BUCKET).await?;
|
||||
|
||||
let alias = format!("rustfs-issue-3107-{}", uuid::Uuid::new_v4());
|
||||
run_mc(&["alias", "set", &alias, &env.url, &env.access_key, &env.secret_key])?;
|
||||
run_mc(&["alias", "set", &alias, &env.url, DEFAULT_ACCESS_KEY, DEFAULT_SECRET_KEY])?;
|
||||
|
||||
let fixture = Path::new(&env.temp_dir).join("issue-3107-fixture");
|
||||
let backup = Path::new(&env.temp_dir).join("issue-3107-backup");
|
||||
|
||||
@@ -3521,25 +3521,7 @@ async fn test_anonymous_post_object_accepts_tagging_field_exact_policy_match()
|
||||
|
||||
let admin_client = env.create_s3_client();
|
||||
admin_client.create_bucket().bucket(bucket).send().await?;
|
||||
let tagging_policy = serde_json::json!({
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "AllowAnonymousTaggedPutObject",
|
||||
"Effect": "Allow",
|
||||
"Principal": "*",
|
||||
"Action": ["s3:PutObject", "s3:PutObjectTagging"],
|
||||
"Resource": [format!("arn:aws:s3:::{}/*", bucket)]
|
||||
}
|
||||
]
|
||||
})
|
||||
.to_string();
|
||||
admin_client
|
||||
.put_bucket_policy()
|
||||
.bucket(bucket)
|
||||
.policy(tagging_policy)
|
||||
.send()
|
||||
.await?;
|
||||
allow_anonymous_put_object(&admin_client, bucket).await?;
|
||||
|
||||
let policy = encode_post_policy(vec![
|
||||
serde_json::json!({ "bucket": bucket }),
|
||||
|
||||
@@ -269,54 +269,6 @@ fn encode_signed_aws_chunked(signer: &SigV4, headers: &SignedHeaders, decoded: &
|
||||
encoded
|
||||
}
|
||||
|
||||
async fn assert_signature_refusal_preserves_part(
|
||||
client: &aws_sdk_s3::Client,
|
||||
key: &str,
|
||||
upload_id: &str,
|
||||
overwrite: reqwest::RequestBuilder,
|
||||
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
let original = b"abc";
|
||||
let uploaded = client
|
||||
.upload_part()
|
||||
.bucket(BUCKET)
|
||||
.key(key)
|
||||
.upload_id(upload_id)
|
||||
.part_number(1)
|
||||
.body(aws_sdk_s3::primitives::ByteStream::from_static(original))
|
||||
.send()
|
||||
.await?;
|
||||
let etag = uploaded.e_tag().ok_or("successful UploadPart omitted ETag")?;
|
||||
assert_eq!(etag.trim_matches('"'), "900150983cd24fb0d6963f7d28e17f72");
|
||||
|
||||
let response = overwrite.send().await?;
|
||||
assert_eq!(response.status().as_u16(), 403);
|
||||
assert_error_code(&response.text().await?, "SignatureDoesNotMatch");
|
||||
|
||||
let listed = client
|
||||
.list_parts()
|
||||
.bucket(BUCKET)
|
||||
.key(key)
|
||||
.upload_id(upload_id)
|
||||
.send()
|
||||
.await?;
|
||||
let [part] = listed.parts() else {
|
||||
panic!("the original part must be the only listed part");
|
||||
};
|
||||
assert_eq!((part.part_number(), part.size(), part.e_tag()), (Some(1), Some(3), Some(etag)));
|
||||
let part = aws_sdk_s3::types::CompletedPart::builder().part_number(1).e_tag(etag).build();
|
||||
client
|
||||
.complete_multipart_upload()
|
||||
.bucket(BUCKET)
|
||||
.key(key)
|
||||
.upload_id(upload_id)
|
||||
.multipart_upload(aws_sdk_s3::types::CompletedMultipartUpload::builder().parts(part).build())
|
||||
.send()
|
||||
.await?;
|
||||
let object = client.get_object().bucket(BUCKET).key(key).send().await?;
|
||||
assert_eq!(object.body.collect().await?.into_bytes().as_ref(), original);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Exercise decoder failures through both storage publication boundaries.
|
||||
#[tokio::test]
|
||||
async fn aws_chunked_named_errors_reject_put_and_upload_part() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
@@ -419,10 +371,11 @@ async fn aws_chunked_named_errors_reject_put_and_upload_part() -> Result<(), Box
|
||||
for (name, value) in extra {
|
||||
request = request.header(name, value);
|
||||
}
|
||||
let request = request.body(encoded).timeout(std::time::Duration::from_secs(20));
|
||||
let overwrite = (multipart && matches!(case, "signature" | "final-signature"))
|
||||
.then(|| request.try_clone().expect("the request body is held in memory"));
|
||||
let response = request.send().await?;
|
||||
let response = request
|
||||
.body(encoded)
|
||||
.timeout(std::time::Duration::from_secs(20))
|
||||
.send()
|
||||
.await?;
|
||||
let status = response.status().as_u16();
|
||||
let body = response.text().await?;
|
||||
eprintln!("aws-chunked {case} multipart={multipart}: HTTP {status}, {body}");
|
||||
@@ -441,21 +394,9 @@ async fn aws_chunked_named_errors_reject_put_and_upload_part() -> Result<(), Box
|
||||
failures.push(format!("{case}: response exposed {private}"));
|
||||
}
|
||||
}
|
||||
let absent = client
|
||||
.get_object()
|
||||
.bucket(BUCKET)
|
||||
.key(&key)
|
||||
.send()
|
||||
.await
|
||||
.expect_err("a rejected body must not publish an object");
|
||||
assert_eq!(absent.as_service_error().and_then(ProvideErrorMetadata::code), Some("NoSuchKey"));
|
||||
if let Some(id) = upload_id {
|
||||
let parts = client.list_parts().bucket(BUCKET).key(&key).upload_id(&id).send().await?;
|
||||
assert!(parts.parts().is_empty(), "{case}: rejected UploadPart published a part");
|
||||
if let Some(overwrite) = overwrite {
|
||||
assert_signature_refusal_preserves_part(&client, &key, &id, overwrite).await?;
|
||||
continue;
|
||||
}
|
||||
client
|
||||
.abort_multipart_upload()
|
||||
.bucket(BUCKET)
|
||||
@@ -464,6 +405,14 @@ async fn aws_chunked_named_errors_reject_put_and_upload_part() -> Result<(), Box
|
||||
.send()
|
||||
.await?;
|
||||
}
|
||||
let absent = client
|
||||
.get_object()
|
||||
.bucket(BUCKET)
|
||||
.key(&key)
|
||||
.send()
|
||||
.await
|
||||
.expect_err("a rejected body must not publish an object");
|
||||
assert_eq!(absent.as_service_error().and_then(ProvideErrorMetadata::code), Some("NoSuchKey"));
|
||||
}
|
||||
}
|
||||
assert!(failures.is_empty(), "{}", failures.join("\n"));
|
||||
|
||||
@@ -864,70 +864,6 @@ async fn test_webhook_event_delivery_and_filtering() -> TestResult {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_webhook_subscriptions_follow_bucket_incarnation() -> TestResult {
|
||||
init_logging();
|
||||
|
||||
let (endpoint, mut rx, collector) = spawn_event_collector().await?;
|
||||
let allowed_origin = endpoint_origin(&endpoint)?;
|
||||
let mut env = RustFSTestEnvironment::new().await?;
|
||||
env.start_rustfs_server_with_env(vec![], &[(ENV_OUTBOUND_ALLOW_ORIGINS, allowed_origin.as_str())])
|
||||
.await?;
|
||||
enable_notify_module(&env).await?;
|
||||
let target = "incarnation";
|
||||
configure_webhook_target(&env, target, &endpoint).await?;
|
||||
wait_for_target_registered(&env, target).await?;
|
||||
|
||||
let client = env.create_s3_client();
|
||||
let bucket = "notify-incarnation";
|
||||
let control_bucket = "notify-incarnation-control";
|
||||
for name in [bucket, control_bucket] {
|
||||
client.create_bucket().bucket(name).send().await?;
|
||||
put_notification_config(&client, name, target, "events/", ".txt").await?;
|
||||
}
|
||||
let put = |bucket, key| {
|
||||
client
|
||||
.put_object()
|
||||
.bucket(bucket)
|
||||
.key(key)
|
||||
.body(ByteStream::from_static(b"event fixture"))
|
||||
.send()
|
||||
};
|
||||
let wait = Duration::from_secs(20);
|
||||
let original_key = "events/original.txt";
|
||||
put(bucket, original_key).await?;
|
||||
wait_for_event(&mut rx, original_key, "s3:ObjectCreated:", wait).await?;
|
||||
|
||||
assert!(client.delete_bucket().bucket(bucket).send().await.is_err());
|
||||
let after_failed_delete = "events/retained.txt";
|
||||
put(bucket, after_failed_delete).await?;
|
||||
wait_for_event(&mut rx, after_failed_delete, "s3:ObjectCreated:", wait).await?;
|
||||
|
||||
for key in [original_key, after_failed_delete] {
|
||||
client.delete_object().bucket(bucket).key(key).send().await?;
|
||||
}
|
||||
client.delete_bucket().bucket(bucket).send().await?;
|
||||
client.create_bucket().bucket(bucket).send().await?;
|
||||
let config = client.get_bucket_notification_configuration().bucket(bucket).send().await?;
|
||||
assert!(config.queue_configurations().is_empty());
|
||||
|
||||
let new_key = "events/fresh.txt";
|
||||
let sentinel_key = "events/sentinel.txt";
|
||||
put(bucket, new_key).await?;
|
||||
put(control_bucket, sentinel_key).await?;
|
||||
let events = collect_until(&mut rx, sentinel_key, wait, Duration::from_secs(2)).await;
|
||||
assert!(events.iter().any(|event| event_key(event).as_deref() == Some(sentinel_key)));
|
||||
assert!(events.iter().all(|event| event_key(event).as_deref() != Some(new_key)));
|
||||
|
||||
put_notification_config(&client, bucket, target, "events/", ".txt").await?;
|
||||
let subscribed_key = "events/subscribed.txt";
|
||||
put(bucket, subscribed_key).await?;
|
||||
wait_for_event(&mut rx, subscribed_key, "s3:ObjectCreated:", wait).await?;
|
||||
env.stop_server();
|
||||
collector.abort();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// An event queued while the target endpoint rejects delivery survives on the
|
||||
/// durable store and is redelivered once the endpoint comes back.
|
||||
#[tokio::test]
|
||||
@@ -1026,101 +962,3 @@ async fn test_webhook_redelivers_event_after_target_recovers() -> TestResult {
|
||||
handle.abort();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_webhook_metadata_mutations_keep_verified_bucket_identity() -> TestResult {
|
||||
init_logging();
|
||||
let (endpoint, mut rx, collector) = spawn_event_collector().await?;
|
||||
let allowed_origin = endpoint_origin(&endpoint)?;
|
||||
let mut env = RustFSTestEnvironment::new().await?;
|
||||
env.start_rustfs_server_with_env(vec![], &[(ENV_OUTBOUND_ALLOW_ORIGINS, allowed_origin.as_str())])
|
||||
.await?;
|
||||
enable_notify_module(&env).await?;
|
||||
let target = "metadata-events";
|
||||
configure_webhook_target(&env, target, &endpoint).await?;
|
||||
wait_for_target_registered(&env, target).await?;
|
||||
let client = env.create_s3_client();
|
||||
let bucket = "metadata-event-identity";
|
||||
let key = "object";
|
||||
client.create_bucket().bucket(bucket).send().await?;
|
||||
client
|
||||
.put_object()
|
||||
.bucket(bucket)
|
||||
.key(key)
|
||||
.body(ByteStream::from_static(b"metadata"))
|
||||
.send()
|
||||
.await?;
|
||||
let queue = QueueConfiguration::builder()
|
||||
.id("metadata-events")
|
||||
.queue_arn(target_arn(target))
|
||||
.events(Event::from("s3:ObjectTagging:*"))
|
||||
.events(Event::from("s3:ObjectAcl:Put"))
|
||||
.events(Event::from("s3:BucketRemoved:*"))
|
||||
.build()?;
|
||||
client
|
||||
.put_bucket_notification_configuration()
|
||||
.bucket(bucket)
|
||||
.notification_configuration(NotificationConfiguration::builder().queue_configurations(queue).build())
|
||||
.send()
|
||||
.await?;
|
||||
let tagging = aws_sdk_s3::types::Tagging::builder()
|
||||
.tag_set(aws_sdk_s3::types::Tag::builder().key("kind").value("test").build()?)
|
||||
.build()?;
|
||||
client
|
||||
.put_object_tagging()
|
||||
.bucket(bucket)
|
||||
.key(key)
|
||||
.tagging(tagging)
|
||||
.send()
|
||||
.await?;
|
||||
assert_eq!(
|
||||
client
|
||||
.get_object_tagging()
|
||||
.bucket(bucket)
|
||||
.key(key)
|
||||
.send()
|
||||
.await?
|
||||
.tag_set()
|
||||
.len(),
|
||||
1
|
||||
);
|
||||
wait_for_event(&mut rx, key, "s3:ObjectTagging:Put", Duration::from_secs(20)).await?;
|
||||
client.delete_object_tagging().bucket(bucket).key(key).send().await?;
|
||||
assert!(
|
||||
client
|
||||
.get_object_tagging()
|
||||
.bucket(bucket)
|
||||
.key(key)
|
||||
.send()
|
||||
.await?
|
||||
.tag_set()
|
||||
.is_empty()
|
||||
);
|
||||
wait_for_event(&mut rx, key, "s3:ObjectTagging:Delete", Duration::from_secs(20)).await?;
|
||||
client
|
||||
.put_object_acl()
|
||||
.bucket(bucket)
|
||||
.key(key)
|
||||
.acl(aws_sdk_s3::types::ObjectCannedAcl::Private)
|
||||
.send()
|
||||
.await?;
|
||||
wait_for_event(&mut rx, key, "s3:ObjectAcl:Put", Duration::from_secs(20)).await?;
|
||||
client.delete_object().bucket(bucket).key(key).send().await?;
|
||||
client.delete_bucket().bucket(bucket).send().await?;
|
||||
let removed = timeout(Duration::from_secs(20), async {
|
||||
loop {
|
||||
let event = rx.recv().await.expect("bucket-event collector remains open");
|
||||
if event["EventName"]
|
||||
.as_str()
|
||||
.is_some_and(|name| name.starts_with("s3:BucketRemoved:"))
|
||||
{
|
||||
break event;
|
||||
}
|
||||
}
|
||||
})
|
||||
.await?;
|
||||
assert_eq!(removed["Records"][0]["s3"]["bucket"]["name"].as_str(), Some(bucket));
|
||||
env.stop_server();
|
||||
collector.abort();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ use crate::storage_api::persistence_parity::{BucketMetadata, RUSTFS_META_BUCKET}
|
||||
use crate::upgrade_compatibility_test::{set_bucket_quota, write_multipart};
|
||||
use aws_sdk_s3::Client;
|
||||
use aws_sdk_s3::primitives::ByteStream;
|
||||
use aws_sdk_s3::types::{BucketCannedAcl, ObjectLockLegalHoldStatus, ObjectLockMode, ObjectLockRetentionMode, Tag, Tagging};
|
||||
use aws_sdk_s3::types::{BucketCannedAcl, Tag, Tagging};
|
||||
use http::{HeaderMap, Method};
|
||||
use md5::{Digest, Md5};
|
||||
use rustfs_filemeta::{FileMeta, MetaObject};
|
||||
@@ -36,9 +36,6 @@ const CONFIGS: &str = "persisted-configs";
|
||||
const OBJECTS: &str = "persisted-objects";
|
||||
const FIRST_PART_SIZE: usize = 5 * 1024 * 1024;
|
||||
const LOGS: &str = "rustfs-access-logs";
|
||||
const LOCKED: &str = "persistence-locked";
|
||||
const SEEDED_OBJECTS: [(&str, &str); 3] = [(LOCKED, "locked"), (OBJECTS, "ssec"), (OBJECTS, "multipart")];
|
||||
const BODY: &[u8] = b"persisted protected object";
|
||||
|
||||
fn bucket_metadata(volume: &Path, bucket: &str) -> Result<BucketMetadata, Error> {
|
||||
let key = BucketMetadata::new(bucket).save_file_path();
|
||||
@@ -130,7 +127,7 @@ struct Snapshot {
|
||||
multipart_files: BTreeMap<String, Vec<u8>>,
|
||||
}
|
||||
|
||||
async fn capture(binary: &Path, peer: &Path, target: &FakeS3Target, clock: &str, clock_library: &str) -> Result<Snapshot, Error> {
|
||||
async fn capture(binary: &Path, target: &FakeS3Target, clock: &str, clock_library: &str) -> Result<Snapshot, Error> {
|
||||
let mut env = RustFSTestEnvironment::new().await?;
|
||||
let queue = tempfile::tempdir()?;
|
||||
let clock_loader = if cfg!(target_os = "macos") {
|
||||
@@ -162,181 +159,9 @@ async fn capture(binary: &Path, peer: &Path, target: &FakeS3Target, clock: &str,
|
||||
.await?;
|
||||
let client = env.create_s3_client();
|
||||
write_configs(&env, &client, target).await?;
|
||||
check_private_acl(&client, binary).await?;
|
||||
write_objects(&client).await?;
|
||||
let key: [u8; 32] = rand::random();
|
||||
let customer_key = base64_simd::STANDARD.encode_to_string(key);
|
||||
let customer_md5 = base64_simd::STANDARD.encode_to_string(Md5::digest(key));
|
||||
client
|
||||
.put_object()
|
||||
.bucket(OBJECTS)
|
||||
.key("ssec")
|
||||
.sse_customer_algorithm("AES256")
|
||||
.sse_customer_key(&customer_key)
|
||||
.sse_customer_key_md5(&customer_md5)
|
||||
.body(ByteStream::from_static(BODY))
|
||||
.send()
|
||||
.await?;
|
||||
client
|
||||
.create_bucket()
|
||||
.bucket(LOCKED)
|
||||
.object_lock_enabled_for_bucket(true)
|
||||
.send()
|
||||
.await?;
|
||||
let retain_until = aws_sdk_s3::primitives::DateTime::from_secs(time::OffsetDateTime::now_utc().unix_timestamp() + 86_400);
|
||||
let locked = client
|
||||
.put_object()
|
||||
.bucket(LOCKED)
|
||||
.key("locked")
|
||||
.object_lock_legal_hold_status(ObjectLockLegalHoldStatus::On)
|
||||
.object_lock_mode(ObjectLockMode::Governance)
|
||||
.object_lock_retain_until_date(retain_until)
|
||||
.body(ByteStream::from_static(BODY))
|
||||
.send()
|
||||
.await?;
|
||||
let version = locked.version_id().ok_or("missing locked object version")?;
|
||||
let volume = PathBuf::from(&env.temp_dir);
|
||||
|
||||
// Both tag updates start with the same writer-produced version ID, encryption IV and multipart
|
||||
// publication identity. The full raw version maps can then be compared without masking them.
|
||||
let mut originals = Vec::new();
|
||||
for (bucket, key) in SEEDED_OBJECTS {
|
||||
let path = volume.join(bucket).join(key).join("xl.meta");
|
||||
originals.push((path.clone(), std::fs::read(path)?));
|
||||
}
|
||||
let expected = tag_and_read_versions(&client, &volume, version).await?;
|
||||
env.stop_server();
|
||||
for (path, bytes) in originals {
|
||||
std::fs::write(path, bytes)?;
|
||||
}
|
||||
let snapshot = read_snapshot(&volume)?;
|
||||
env.start_rustfs_server_from_binary_without_cleanup(peer, vec![], &options)
|
||||
.await?;
|
||||
let peer_client = env.create_s3_client();
|
||||
check_private_acl(&peer_client, peer).await?;
|
||||
let locked = peer_client
|
||||
.get_object()
|
||||
.bucket(LOCKED)
|
||||
.key("locked")
|
||||
.version_id(version)
|
||||
.send()
|
||||
.await?;
|
||||
let retention = peer_client
|
||||
.get_object_retention()
|
||||
.bucket(LOCKED)
|
||||
.key("locked")
|
||||
.version_id(version)
|
||||
.send()
|
||||
.await?;
|
||||
let retention = retention.retention().ok_or("missing persisted retention")?;
|
||||
let legal_hold = peer_client
|
||||
.get_object_legal_hold()
|
||||
.bucket(LOCKED)
|
||||
.key("locked")
|
||||
.version_id(version)
|
||||
.send()
|
||||
.await?;
|
||||
if locked.version_id() != Some(version)
|
||||
|| legal_hold.legal_hold().and_then(|hold| hold.status()) != Some(&ObjectLockLegalHoldStatus::On)
|
||||
|| retention.mode() != Some(&ObjectLockRetentionMode::Governance)
|
||||
|| retention.retain_until_date() != Some(&retain_until)
|
||||
|| locked.body.collect().await?.into_bytes().as_ref() != BODY
|
||||
{
|
||||
return Err("peer could not read the locked version, its contents and retention".into());
|
||||
}
|
||||
let encrypted = peer_client
|
||||
.get_object()
|
||||
.bucket(OBJECTS)
|
||||
.key("ssec")
|
||||
.sse_customer_algorithm("AES256")
|
||||
.sse_customer_key(&customer_key)
|
||||
.sse_customer_key_md5(&customer_md5)
|
||||
.send()
|
||||
.await?;
|
||||
if encrypted.sse_customer_algorithm() != Some("AES256")
|
||||
|| encrypted.sse_customer_key_md5() != Some(customer_md5.as_str())
|
||||
|| encrypted.body.collect().await?.into_bytes().as_ref() != BODY
|
||||
{
|
||||
return Err("peer could not decrypt the persisted SSE-C object".into());
|
||||
}
|
||||
let multipart = peer_client
|
||||
.get_object()
|
||||
.bucket(OBJECTS)
|
||||
.key("multipart")
|
||||
.send()
|
||||
.await?
|
||||
.body
|
||||
.collect()
|
||||
.await?
|
||||
.into_bytes();
|
||||
if multipart.len() != FIRST_PART_SIZE + 100
|
||||
|| !multipart[..FIRST_PART_SIZE].iter().all(|&byte| byte == 0x31)
|
||||
|| !multipart[FIRST_PART_SIZE..].iter().all(|&byte| byte == 0x32)
|
||||
{
|
||||
return Err("peer read different multipart data".into());
|
||||
}
|
||||
let actual = tag_and_read_versions(&peer_client, &volume, version).await?;
|
||||
for (index, (_, key)) in SEEDED_OBJECTS.iter().enumerate() {
|
||||
if actual[index] != expected[index] {
|
||||
return Err(
|
||||
format!("{key}: the two writers persisted different full xl.meta version fields for the same seed").into(),
|
||||
);
|
||||
}
|
||||
}
|
||||
env.stop_server();
|
||||
Ok(snapshot)
|
||||
}
|
||||
|
||||
async fn tag_and_read_versions(client: &Client, volume: &Path, locked_version: &str) -> Result<Vec<VersionFields>, Error> {
|
||||
let tags = Tagging::builder()
|
||||
.tag_set(Tag::builder().key("purpose").value("persistence-parity").build()?)
|
||||
.build()?;
|
||||
let mut versions = Vec::new();
|
||||
for (bucket, key) in SEEDED_OBJECTS {
|
||||
let version = (bucket == LOCKED).then(|| locked_version.to_owned());
|
||||
client
|
||||
.put_object_tagging()
|
||||
.bucket(bucket)
|
||||
.key(key)
|
||||
.set_version_id(version.clone())
|
||||
.tagging(tags.clone())
|
||||
.send()
|
||||
.await?;
|
||||
let actual = client
|
||||
.get_object_tagging()
|
||||
.bucket(bucket)
|
||||
.key(key)
|
||||
.set_version_id(version)
|
||||
.send()
|
||||
.await?;
|
||||
if actual.tag_set() != tags.tag_set() {
|
||||
return Err(format!("{key}: tagging update was not visible").into());
|
||||
}
|
||||
let meta = FileMeta::load(&std::fs::read(volume.join(bucket).join(key).join("xl.meta"))?)?;
|
||||
let [version] = meta.versions.as_slice() else {
|
||||
return Err(format!("{key}: expected one tagged version").into());
|
||||
};
|
||||
versions.push(rmp_serde::from_slice(&version.meta)?);
|
||||
}
|
||||
Ok(versions)
|
||||
}
|
||||
|
||||
async fn check_private_acl(client: &Client, reader: &Path) -> Result<(), Error> {
|
||||
let acl = client.get_bucket_acl().bucket(CONFIGS).send().await?;
|
||||
let owner = acl.owner().and_then(|owner| owner.id()).ok_or("ACL owner missing")?;
|
||||
let [grant] = acl.grants() else { return Err("expected exactly one ACL grant".into()) };
|
||||
let grantee = grant.grantee().ok_or("missing ACL grantee")?;
|
||||
// Release 1.0.5 omits the canonical grantee ID. The candidate returns the bucket owner's ID,
|
||||
// including when it reads the release's volume.
|
||||
let expected_id = (reader == rustfs_binary_path()).then_some(owner);
|
||||
if owner.is_empty()
|
||||
|| grant.permission().map(|p| p.as_str()) != Some("FULL_CONTROL")
|
||||
|| grantee.r#type().as_str() != "CanonicalUser"
|
||||
|| grantee.id() != expected_id
|
||||
{
|
||||
return Err("GET ACL changed its canonical owner grant".into());
|
||||
}
|
||||
Ok(())
|
||||
read_snapshot(Path::new(&env.temp_dir))
|
||||
}
|
||||
|
||||
async fn write_configs(env: &RustFSTestEnvironment, client: &Client, target: &FakeS3Target) -> Result<(), Error> {
|
||||
@@ -392,6 +217,17 @@ async fn write_configs(env: &RustFSTestEnvironment, client: &Client, target: &Fa
|
||||
.acl(BucketCannedAcl::Private)
|
||||
.send()
|
||||
.await?;
|
||||
let acl = client.get_bucket_acl().bucket(CONFIGS).send().await?;
|
||||
let owner = acl.owner().and_then(|owner| owner.id()).ok_or("ACL owner missing")?;
|
||||
let [grant] = acl.grants() else { return Err("expected exactly one ACL grant".into()) };
|
||||
let grantee = grant.grantee().ok_or("missing ACL grantee")?;
|
||||
if owner.is_empty()
|
||||
|| grant.permission().map(|p| p.as_str()) != Some("FULL_CONTROL")
|
||||
|| grantee.r#type().as_str() != "CanonicalUser"
|
||||
|| grantee.id().is_some()
|
||||
{
|
||||
return Err("GET ACL changed its canonical owner grant".into());
|
||||
}
|
||||
let policy = serde_json::json!({
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [{
|
||||
@@ -543,11 +379,11 @@ fn save_xml_samples(root: &Path, side: &str, snapshot: &Snapshot) -> Result<(),
|
||||
|
||||
#[tokio::test]
|
||||
async fn persistence_byte_parity() -> Result<(), Error> {
|
||||
let reference_binary = PathBuf::from(
|
||||
let reference = PathBuf::from(
|
||||
std::env::var_os("RUSTFS_PERSISTENCE_REFERENCE_BINARY").ok_or("missing pinned RUSTFS_PERSISTENCE_REFERENCE_BINARY")?,
|
||||
);
|
||||
let candidate = rustfs_binary_path();
|
||||
if binary_version(&reference_binary).await? == binary_version(&candidate).await? {
|
||||
if binary_version(&reference).await? == binary_version(&candidate).await? {
|
||||
return Err("reference and candidate binaries report identical build identities".into());
|
||||
}
|
||||
// The quota writer records the process wall clock inside its JSON document. Keep raw bytes
|
||||
@@ -561,8 +397,8 @@ async fn persistence_byte_parity() -> Result<(), Error> {
|
||||
let target = FakeS3Target::start().await?;
|
||||
target.create_bucket("migration-source");
|
||||
target.create_bucket_with_object_lock("interop-dr");
|
||||
let reference = capture(&reference_binary, &candidate, &target, &clock, &clock_library).await?;
|
||||
let candidate = capture(&candidate, &reference_binary, &target, &clock, &clock_library).await?;
|
||||
let reference = capture(&reference, &target, &clock, &clock_library).await?;
|
||||
let candidate = capture(&candidate, &target, &clock, &clock_library).await?;
|
||||
if let Some(directory) = std::env::var_os("RUSTFS_PERSISTENCE_XML_DIR") {
|
||||
save_xml_samples(Path::new(&directory), "reference", &reference)?;
|
||||
save_xml_samples(Path::new(&directory), "candidate", &candidate)?;
|
||||
@@ -585,7 +421,7 @@ async fn persistence_byte_parity() -> Result<(), Error> {
|
||||
return Err("different multipart part files or part metadata".into());
|
||||
}
|
||||
eprintln!(
|
||||
"Compared {} bucket fields (canned ACL empty), {} independently written object records, three shared-seed full version maps in both directions, and multipart part files",
|
||||
"Compared {} bucket fields (canned ACL empty), {} full object records and multipart part files",
|
||||
reference.configs.len(),
|
||||
reference.objects.len()
|
||||
);
|
||||
|
||||
@@ -198,23 +198,8 @@ mod tests {
|
||||
.await?;
|
||||
verify_manifest(&client, bucket, &manifest, "read-back of degraded write").await?;
|
||||
|
||||
// Model an in-flight write to the directory the server recreated while the
|
||||
// original volume was offline. The restore must leave that tree intact.
|
||||
let disk = harness.disk_path(0).to_owned();
|
||||
let marker = ".e2e-in-flight";
|
||||
std::fs::create_dir_all(&disk)?;
|
||||
std::fs::write(disk.join(marker), b"pending")?;
|
||||
harness.bring_disk_online(0)?;
|
||||
|
||||
assert!(!disk.join(marker).exists(), "the original volume must be back in its slot");
|
||||
let mut preserved = false;
|
||||
for entry in std::fs::read_dir(&harness.env.temp_dir)? {
|
||||
if entry?.path().join(marker).is_file() {
|
||||
preserved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert!(preserved, "the displaced tree must remain available to its writer");
|
||||
verify_manifest(&client, bucket, &manifest, "after disk0 came back online").await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#[cfg(all(test, target_os = "linux"))]
|
||||
mod tests {
|
||||
use crate::chaos::{VersionShardCensus, census_object_version_on_disk};
|
||||
use crate::common::{ClusterTopology, RustFSTestClusterEnvironment, admin_request, init_logging, local_http_client};
|
||||
use crate::common::{ClusterTopology, RustFSTestClusterEnvironment, admin_request, init_logging};
|
||||
use aws_sdk_s3::Client;
|
||||
use aws_sdk_s3::primitives::ByteStream;
|
||||
use aws_sdk_s3::types::{BucketVersioningStatus, CompletedMultipartUpload, CompletedPart, VersioningConfiguration};
|
||||
@@ -412,7 +412,7 @@ mod tests {
|
||||
.arg(test_binary)
|
||||
.arg("--exact")
|
||||
.arg(test_name)
|
||||
.arg("--include-ignored")
|
||||
.arg("--ignored")
|
||||
.arg("--nocapture")
|
||||
.env(NAMESPACE_ENV, "1")
|
||||
.status()?;
|
||||
@@ -1524,110 +1524,6 @@ mod tests {
|
||||
assert!(assert_no_replacement_status_records_in_status(&definitive, target).is_ok());
|
||||
}
|
||||
|
||||
/// Linux mount namespaces are per-thread; keep mount setup and process
|
||||
/// spawning on one OS thread so child RustFS nodes inherit the test mounts.
|
||||
#[tokio::test(flavor = "current_thread")]
|
||||
async fn test_privileged_4x1_subdirectory_replacement_waits_for_write_quorum() -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||
init_logging();
|
||||
if !privileged_run_enabled()? {
|
||||
return Ok(());
|
||||
}
|
||||
if std::env::var_os(NAMESPACE_ENV).is_none() {
|
||||
return run_current_test_in_mount_namespace(
|
||||
"replacement_privileged_e2e_test::tests::test_privileged_4x1_subdirectory_replacement_waits_for_write_quorum",
|
||||
);
|
||||
}
|
||||
|
||||
let mut mounts = MountNamespaceGuard::new()?;
|
||||
let mut cluster = RustFSTestClusterEnvironment::new(4).await?;
|
||||
let filesystem: serde_json::Value = serde_json::from_str(&run_command_stdout(
|
||||
"findmnt",
|
||||
&["--json", "--target", &cluster.temp_dir, "--output", "TARGET,FSTYPE"],
|
||||
)?)?;
|
||||
let xfs_root = filesystem["filesystems"][0]["target"]
|
||||
.as_str()
|
||||
.filter(|root| *root != "/" && filesystem["filesystems"][0]["fstype"] == "xfs");
|
||||
for (index, node) in cluster.nodes.iter_mut().enumerate() {
|
||||
let mount = PathBuf::from(&node.data_dir);
|
||||
if xfs_root.is_none() {
|
||||
mounts.mount_tmpfs(&mount, &format!("rustfs-replacement-4x1-{index}"))?;
|
||||
}
|
||||
let data = mount.join("data");
|
||||
fs::create_dir(&data)?;
|
||||
node.data_dir = path_to_string(&data, "replacement subdirectory")?;
|
||||
node.data_dirs[0] = node.data_dir.clone();
|
||||
}
|
||||
let target = PathBuf::from(&cluster.nodes[TARGET_NODE].data_dir);
|
||||
let mount = xfs_root.unwrap_or(target.parent().and_then(Path::to_str).ok_or("missing target mount root")?);
|
||||
eprintln!(
|
||||
"4x1 replacement fixture filesystem = {}",
|
||||
if xfs_root.is_some() { "xfs" } else { "tmpfs" }
|
||||
);
|
||||
cluster.set_node_env(TARGET_NODE, "RUSTFS_HEAL_REPLACEMENT_MOUNT_ROOTS", mount)?;
|
||||
cluster.set_env("RUSTFS_STORAGE_CLASS_STANDARD", "EC:2");
|
||||
cluster.set_env("RUSTFS_HEAL_ENABLED", "true");
|
||||
cluster.set_env("RUSTFS_HEAL_INTERVAL_SECS", "1");
|
||||
cluster.set_env("RUSTFS_SCANNER_START_DELAY_SECS", "0");
|
||||
cluster.set_env("RUSTFS_PUT_RENAME_EARLY_ACK_ENABLE", "false");
|
||||
cluster.start().await?;
|
||||
let clients = cluster.create_all_clients()?;
|
||||
let versions = seed_baseline(&clients[0], &target, 0).await?;
|
||||
|
||||
cluster.stop_node_gracefully(TARGET_NODE).await?;
|
||||
cluster.stop_node_gracefully(0).await?;
|
||||
fs::remove_dir_all(&target)?;
|
||||
fs::create_dir(&target)?;
|
||||
|
||||
let metadata = ["format.json", "pool.bin/xl.meta", "pool.bin.identity/xl.meta"];
|
||||
let system_dir = Path::new(".rustfs.sys");
|
||||
let survivor_files = cluster.nodes[2..]
|
||||
.iter()
|
||||
.flat_map(|node| metadata.map(|name| Path::new(&node.data_dir).join(system_dir).join(name)))
|
||||
.map(|file| fs::read(&file).map(|bytes| (file, bytes)))
|
||||
.collect::<std::io::Result<Vec<_>>>()?;
|
||||
|
||||
cluster.start_node_process(TARGET_NODE).await?;
|
||||
let write_health = format!("{}/minio/health/cluster", cluster.nodes[2].url);
|
||||
let http = local_http_client();
|
||||
timeout(Duration::from_secs(30), async {
|
||||
loop {
|
||||
let status = http.get(&write_health).send().await?.status();
|
||||
if status.as_u16() == 503 {
|
||||
break;
|
||||
}
|
||||
sleep(Duration::from_millis(200)).await;
|
||||
}
|
||||
Ok::<_, reqwest::Error>(())
|
||||
})
|
||||
.await??;
|
||||
verify_bodies(&clients[2], &versions).await?;
|
||||
let version = &versions[0];
|
||||
let failed_delete = clients[2]
|
||||
.delete_object()
|
||||
.bucket(&version.bucket)
|
||||
.key(&version.key)
|
||||
.send()
|
||||
.await
|
||||
.expect_err("two of four drives must not delete an existing object");
|
||||
assert_eq!(failed_delete.raw_response().map(|response| response.status().as_u16()), Some(503));
|
||||
for name in metadata {
|
||||
assert!(!target.join(system_dir).join(name).try_exists()?, "unadmitted target published {name}");
|
||||
}
|
||||
for (file, before) in survivor_files {
|
||||
assert_eq!(fs::read(&file)?, before, "surviving pool evidence changed below write quorum");
|
||||
}
|
||||
|
||||
cluster.start_node(0).await?;
|
||||
wait_for_completed_replacement_with_census(&cluster, &target, &versions, 90).await?;
|
||||
for name in metadata {
|
||||
assert!(fs::metadata(target.join(system_dir).join(name))?.is_file());
|
||||
}
|
||||
cluster.stop_node_gracefully(TARGET_NODE).await?;
|
||||
cluster.start_node(TARGET_NODE).await?;
|
||||
assert!(incomplete_versions(&target, &versions)?.is_empty());
|
||||
verify_bodies(&clients[TARGET_NODE], &versions).await
|
||||
}
|
||||
|
||||
/// Linux mount namespaces are per-thread; keep mount setup and process
|
||||
/// spawning on one OS thread so child RustFS nodes inherit the test mounts.
|
||||
#[tokio::test(flavor = "current_thread")]
|
||||
|
||||
@@ -2075,18 +2075,12 @@ fn replication_response_hold() -> (ReplicationResponseHoldRuntime, ReplicationRe
|
||||
)
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct ReplicationProxyGate {
|
||||
enabled: watch::Receiver<bool>,
|
||||
blocked_admin_commit_path: Option<&'static str>,
|
||||
}
|
||||
|
||||
async fn forward_replication_proxy_request(
|
||||
request: Request<Incoming>,
|
||||
backend_url: &str,
|
||||
client: &reqwest::Client,
|
||||
request_count: &AtomicU64,
|
||||
mut gate: ReplicationProxyGate,
|
||||
mut replication_enabled: watch::Receiver<bool>,
|
||||
mut held_tagging: watch::Receiver<Option<String>>,
|
||||
mut response_hold: ReplicationResponseHoldRuntime,
|
||||
) -> Response<Full<bytes::Bytes>> {
|
||||
@@ -2097,8 +2091,8 @@ async fn forward_replication_proxy_request(
|
||||
.is_some_and(|value| value.as_bytes().eq_ignore_ascii_case(b"REPLICA"));
|
||||
if is_replication {
|
||||
request_count.fetch_add(1, Ordering::Relaxed);
|
||||
while !*gate.enabled.borrow() {
|
||||
if gate.enabled.changed().await.is_err() {
|
||||
while !*replication_enabled.borrow() {
|
||||
if replication_enabled.changed().await.is_err() {
|
||||
return proxy_error_response("replication gate closed");
|
||||
}
|
||||
}
|
||||
@@ -2123,12 +2117,6 @@ async fn forward_replication_proxy_request(
|
||||
Ok(body) => body.to_bytes(),
|
||||
Err(error) => return proxy_error_response(error),
|
||||
};
|
||||
if gate.blocked_admin_commit_path == Some(parts.uri.path())
|
||||
&& !*gate.enabled.borrow()
|
||||
&& serde_json::from_slice::<serde_json::Value>(&body).is_ok_and(|payload| payload["phase"] == "commit")
|
||||
{
|
||||
return proxy_error_response("admin commit blocked by replication gate");
|
||||
}
|
||||
let mut forwarded = client.request(parts.method, format!("{backend_url}{path_and_query}"));
|
||||
for (name, value) in &parts.headers {
|
||||
forwarded = forwarded.header(name, value);
|
||||
@@ -2165,7 +2153,7 @@ async fn start_replication_counting_proxy(
|
||||
tasks: &mut JoinSet<()>,
|
||||
) -> Result<(String, Arc<AtomicU64>, watch::Sender<bool>), Box<dyn Error + Send + Sync>> {
|
||||
let (proxy_url, request_count, replication_enabled, _held_tagging, _response_hold) =
|
||||
start_replication_counting_proxy_with_tag_hold(backend_url, tasks, None).await?;
|
||||
start_replication_counting_proxy_with_tag_hold(backend_url, tasks).await?;
|
||||
Ok((proxy_url, request_count, replication_enabled))
|
||||
}
|
||||
|
||||
@@ -2173,11 +2161,9 @@ async fn start_replication_counting_proxy(
|
||||
/// returned `watch::Sender<Option<String>>` holds `Some(tagging)`, replication
|
||||
/// requests whose `x-amz-tagging` equals `tagging` are parked (and still
|
||||
/// counted); all other traffic flows. Send `None` to release them.
|
||||
/// An optional admin commit path rejects its commit phase while the replication gate is closed.
|
||||
async fn start_replication_counting_proxy_with_tag_hold(
|
||||
backend_url: &str,
|
||||
tasks: &mut JoinSet<()>,
|
||||
blocked_admin_commit_path: Option<&'static str>,
|
||||
) -> Result<
|
||||
(
|
||||
String,
|
||||
@@ -2194,10 +2180,6 @@ async fn start_replication_counting_proxy_with_tag_hold(
|
||||
let request_count = Arc::new(AtomicU64::new(0));
|
||||
let task_request_count = request_count.clone();
|
||||
let (replication_enabled, task_replication_enabled) = watch::channel(true);
|
||||
let gate = ReplicationProxyGate {
|
||||
enabled: task_replication_enabled,
|
||||
blocked_admin_commit_path,
|
||||
};
|
||||
let (held_tagging, task_held_tagging) = watch::channel(None);
|
||||
let (response_hold_runtime, response_hold) = replication_response_hold();
|
||||
tasks.spawn(async move {
|
||||
@@ -2210,7 +2192,7 @@ async fn start_replication_counting_proxy_with_tag_hold(
|
||||
let backend_url = backend_url.clone();
|
||||
let client = client.clone();
|
||||
let request_count = task_request_count.clone();
|
||||
let gate = gate.clone();
|
||||
let replication_enabled = task_replication_enabled.clone();
|
||||
let held_tagging = task_held_tagging.clone();
|
||||
let response_hold = response_hold_runtime.clone();
|
||||
connections.spawn(async move {
|
||||
@@ -2218,7 +2200,7 @@ async fn start_replication_counting_proxy_with_tag_hold(
|
||||
let backend_url = backend_url.clone();
|
||||
let client = client.clone();
|
||||
let request_count = request_count.clone();
|
||||
let gate = gate.clone();
|
||||
let replication_enabled = replication_enabled.clone();
|
||||
let held_tagging = held_tagging.clone();
|
||||
let response_hold = response_hold.clone();
|
||||
async move {
|
||||
@@ -2228,7 +2210,7 @@ async fn start_replication_counting_proxy_with_tag_hold(
|
||||
&backend_url,
|
||||
&client,
|
||||
&request_count,
|
||||
gate,
|
||||
replication_enabled,
|
||||
held_tagging,
|
||||
response_hold,
|
||||
)
|
||||
@@ -2270,309 +2252,6 @@ async fn site_replication_remove(
|
||||
Ok(serde_json::from_slice(&response.bytes().await?)?)
|
||||
}
|
||||
|
||||
async fn decommission_site_v2(
|
||||
env: &RustFSTestEnvironment,
|
||||
request: &rustfs_madmin::SRRemoveV2Req,
|
||||
) -> Result<rustfs_madmin::SRRemoveV2Status, Box<dyn Error + Send + Sync>> {
|
||||
let response = signed_request(
|
||||
http::Method::PUT,
|
||||
&format!("{}/rustfs/admin/v3/site-replication/remove-v2", env.url),
|
||||
&env.access_key,
|
||||
&env.secret_key,
|
||||
Some(serde_json::to_vec(request)?),
|
||||
Some("application/json"),
|
||||
)
|
||||
.await?;
|
||||
if response.status() != StatusCode::OK {
|
||||
return Err(format!("decommission failed: {} {}", response.status(), response.text().await?).into());
|
||||
}
|
||||
Ok(response.json().await?)
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_site_decommission_dead_peer_recovers_pending_remove_and_bucket_delete() -> Result<(), Box<dyn Error + Send + Sync>>
|
||||
{
|
||||
init_logging();
|
||||
let mut source = RustFSTestEnvironment::new().await?;
|
||||
let mut target = RustFSTestEnvironment::new().await?;
|
||||
let mut env = replication_fast_env();
|
||||
env.extend_from_slice(FAST_SCANNER_ENV);
|
||||
env.extend_from_slice(LOOPBACK_REPLICATION_TARGET_ENV);
|
||||
source.start_rustfs_server_with_env(vec![], &env).await?;
|
||||
target.start_rustfs_server_without_cleanup_with_env(&env).await?;
|
||||
let added = site_replication_add(
|
||||
&source,
|
||||
&[
|
||||
PeerSite {
|
||||
name: "survivor".to_string(),
|
||||
endpoint: source.url.clone(),
|
||||
access_key: source.access_key.clone(),
|
||||
secret_key: source.secret_key.clone(),
|
||||
..Default::default()
|
||||
},
|
||||
PeerSite {
|
||||
name: "retired".to_string(),
|
||||
endpoint: target.url.clone(),
|
||||
access_key: target.access_key.clone(),
|
||||
secret_key: target.secret_key.clone(),
|
||||
..Default::default()
|
||||
},
|
||||
],
|
||||
)
|
||||
.await?;
|
||||
assert!(added.success, "{added:?}");
|
||||
let source_client = source.create_s3_client();
|
||||
let target_client = target.create_s3_client();
|
||||
let bucket = "decommission-pending-delete";
|
||||
source_client.create_bucket().bucket(bucket).send().await?;
|
||||
wait_for_bucket_on_target(&target_client, bucket).await?;
|
||||
let version = source_client
|
||||
.put_object()
|
||||
.bucket(bucket)
|
||||
.key("data")
|
||||
.body(ByteStream::from_static(b"decommission data survives until purge"))
|
||||
.send()
|
||||
.await?
|
||||
.version_id
|
||||
.ok_or("site bucket must be versioned")?;
|
||||
wait_for_object_on_target(&target_client, bucket, "data").await?;
|
||||
target.stop_server();
|
||||
source_client
|
||||
.delete_object()
|
||||
.bucket(bucket)
|
||||
.key("data")
|
||||
.version_id(&version)
|
||||
.send()
|
||||
.await?;
|
||||
let blocked = source_client
|
||||
.delete_bucket()
|
||||
.bucket(bucket)
|
||||
.send()
|
||||
.await
|
||||
.expect_err("pending version must block delete");
|
||||
assert_eq!(blocked.code(), Some("BucketNotEmpty"));
|
||||
let legacy = site_replication_remove(
|
||||
&source,
|
||||
&SRRemoveReq {
|
||||
site_names: vec!["retired".to_string()],
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
assert_eq!(legacy.status, "Partial");
|
||||
assert!(site_replication_info(&source).await?.pending_operation.is_some());
|
||||
let mut request = rustfs_madmin::SRRemoveV2Req {
|
||||
mode: "dry-run".to_string(),
|
||||
sites: vec!["retired".to_string()],
|
||||
..Default::default()
|
||||
};
|
||||
let preview = decommission_site_v2(&source, &request).await?;
|
||||
assert_eq!(preview.status, "planned");
|
||||
request.mode = "execute".to_string();
|
||||
request.operation_id = Some(preview.operation_id.clone());
|
||||
request.preflight_token = Some(preview.preflight_token);
|
||||
let removed = decommission_site_v2(&source, &request).await?;
|
||||
assert_eq!(removed.status, "success", "{removed:?}");
|
||||
assert_site_replication_bucket_detached(&source, bucket).await?;
|
||||
assert!(site_replication_info(&source).await?.pending_operation.is_none());
|
||||
source.restart_server_preserving_data(vec![], &env).await?;
|
||||
let replay = decommission_site_v2(&source, &request).await?;
|
||||
assert_eq!(replay.status, "success");
|
||||
assert_eq!(replay.operation_id, removed.operation_id);
|
||||
let deadline = tokio::time::Instant::now() + Duration::from_secs(120);
|
||||
loop {
|
||||
match source_client.delete_bucket().bucket(bucket).send().await {
|
||||
Ok(_) => break,
|
||||
Err(err) if err.code() == Some("BucketNotEmpty") && tokio::time::Instant::now() < deadline => {
|
||||
tokio::time::sleep(Duration::from_millis(250)).await;
|
||||
}
|
||||
Err(err) => return Err(err.into()),
|
||||
}
|
||||
}
|
||||
assert!(source_client.head_bucket().bucket(bucket).send().await.is_err());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_site_decommission_preserves_two_live_sites_and_bidirectional_replication()
|
||||
-> Result<(), Box<dyn Error + Send + Sync>> {
|
||||
init_logging();
|
||||
let mut a = RustFSTestEnvironment::new().await?;
|
||||
let mut b = RustFSTestEnvironment::new().await?;
|
||||
let mut c = RustFSTestEnvironment::new().await?;
|
||||
let mut env = replication_fast_env();
|
||||
env.extend_from_slice(FAST_SCANNER_ENV);
|
||||
env.extend_from_slice(LOOPBACK_REPLICATION_TARGET_ENV);
|
||||
a.start_rustfs_server_with_env(vec![], &env).await?;
|
||||
b.start_rustfs_server_without_cleanup_with_env(&env).await?;
|
||||
c.start_rustfs_server_without_cleanup_with_env(&env).await?;
|
||||
let mut proxy_tasks = JoinSet::new();
|
||||
let (c_proxy, _, allow_peer_removal, _, _) = start_replication_counting_proxy_with_tag_hold(
|
||||
&c.url,
|
||||
&mut proxy_tasks,
|
||||
Some("/minio/admin/v3/site-replication/peer/remove-v2"),
|
||||
)
|
||||
.await?;
|
||||
let added = site_replication_add(
|
||||
&a,
|
||||
&[
|
||||
PeerSite {
|
||||
name: "a".to_string(),
|
||||
endpoint: a.url.clone(),
|
||||
access_key: a.access_key.clone(),
|
||||
secret_key: a.secret_key.clone(),
|
||||
..Default::default()
|
||||
},
|
||||
PeerSite {
|
||||
name: "b".to_string(),
|
||||
endpoint: b.url.clone(),
|
||||
access_key: b.access_key.clone(),
|
||||
secret_key: b.secret_key.clone(),
|
||||
..Default::default()
|
||||
},
|
||||
PeerSite {
|
||||
name: "c".to_string(),
|
||||
endpoint: c.url.clone(),
|
||||
access_key: c.access_key.clone(),
|
||||
secret_key: c.secret_key.clone(),
|
||||
..Default::default()
|
||||
},
|
||||
],
|
||||
)
|
||||
.await?;
|
||||
assert!(added.success, "{added:?}");
|
||||
let info = wait_for_site_replication_enabled(&a, 3).await?;
|
||||
let retired_id = info
|
||||
.sites
|
||||
.iter()
|
||||
.find(|peer| peer.name == "b")
|
||||
.ok_or("site b is missing")?
|
||||
.deployment_id
|
||||
.clone();
|
||||
let mut survivor = info
|
||||
.sites
|
||||
.into_iter()
|
||||
.find(|peer| peer.name == "c")
|
||||
.ok_or("site c is missing")?;
|
||||
let survivor_id = survivor.deployment_id.clone();
|
||||
survivor.endpoint = c_proxy;
|
||||
let edited = site_replication_edit(&a, "", &survivor).await?;
|
||||
assert!(edited.success, "{edited:?}");
|
||||
let ca = a.create_s3_client();
|
||||
let cb = b.create_s3_client();
|
||||
let cc = c.create_s3_client();
|
||||
let bucket = "decommission-preserve-live-peers";
|
||||
let operator_bucket = "decommission-operator-target";
|
||||
cc.create_bucket().bucket(operator_bucket).send().await?;
|
||||
enable_bucket_versioning(&c, operator_bucket).await?;
|
||||
ca.create_bucket().bucket(bucket).send().await?;
|
||||
wait_for_bucket_on_target(&cb, bucket).await?;
|
||||
wait_for_bucket_on_target(&cc, bucket).await?;
|
||||
let operator_arn = set_replication_target(&a, bucket, &c, operator_bucket).await?;
|
||||
put_bucket_replication(&a, bucket, &operator_arn).await?;
|
||||
ca.put_object()
|
||||
.bucket(bucket)
|
||||
.key("baseline")
|
||||
.body(ByteStream::from_static(b"baseline"))
|
||||
.send()
|
||||
.await?;
|
||||
wait_for_object_on_target(&cc, bucket, "baseline").await?;
|
||||
wait_for_object_on_target(&cc, operator_bucket, "baseline").await?;
|
||||
let retired_rule_id = format!("site-repl-{retired_id}");
|
||||
let retired_arn = ca
|
||||
.get_bucket_replication()
|
||||
.bucket(bucket)
|
||||
.send()
|
||||
.await?
|
||||
.replication_configuration
|
||||
.ok_or("source bucket replication is missing")?
|
||||
.rules
|
||||
.into_iter()
|
||||
.find(|rule| rule.id.as_deref() == Some(retired_rule_id.as_str()))
|
||||
.and_then(|rule| rule.destination)
|
||||
.ok_or("site b replication rule is missing")?
|
||||
.bucket;
|
||||
b.stop_server();
|
||||
let preview_request = rustfs_madmin::SRRemoveV2Req {
|
||||
mode: "dry-run".to_string(),
|
||||
sites: vec!["b".to_string()],
|
||||
..Default::default()
|
||||
};
|
||||
let preview = decommission_site_v2(&a, &preview_request).await?;
|
||||
let request = rustfs_madmin::SRRemoveV2Req {
|
||||
mode: "execute".to_string(),
|
||||
operation_id: Some(preview.operation_id.clone()),
|
||||
preflight_token: Some(preview.preflight_token),
|
||||
..preview_request.clone()
|
||||
};
|
||||
allow_peer_removal.send(false)?;
|
||||
let partial = decommission_site_v2(&a, &request).await?;
|
||||
assert_eq!(partial.status, "Partial", "{partial:?}");
|
||||
assert!(partial.local_cleanup_complete, "{partial:?}");
|
||||
assert_eq!(partial.pending_peers, [survivor_id]);
|
||||
assert!(partial.errors.iter().any(|error| error.contains("admin commit blocked")), "{partial:?}");
|
||||
let prepared = site_replication_info(&c)
|
||||
.await?
|
||||
.pending_operation
|
||||
.ok_or("site c must have prepared")?;
|
||||
assert_eq!(prepared.id, preview.operation_id);
|
||||
a.restart_server_preserving_data(vec![], &env).await?;
|
||||
let restored = decommission_site_v2(&a, &preview_request).await?;
|
||||
assert_eq!(restored.operation_id, preview.operation_id);
|
||||
assert_eq!(restored.status, "Partial", "{restored:?}");
|
||||
assert!(restored.local_cleanup_complete, "{restored:?}");
|
||||
assert_eq!(restored.pending_peers, partial.pending_peers);
|
||||
allow_peer_removal.send(true)?;
|
||||
let result = decommission_site_v2(&a, &request).await?;
|
||||
assert_eq!(result.status, "success", "{result:?}");
|
||||
let ia = site_replication_info(&a).await?;
|
||||
let ic = site_replication_info(&c).await?;
|
||||
assert!(ia.enabled && ic.enabled);
|
||||
assert!(ia.pending_operation.is_none() && ic.pending_operation.is_none());
|
||||
assert_eq!(
|
||||
ia.sites
|
||||
.iter()
|
||||
.map(|peer| peer.deployment_id.clone())
|
||||
.collect::<std::collections::BTreeSet<_>>(),
|
||||
ic.sites.iter().map(|peer| peer.deployment_id.clone()).collect()
|
||||
);
|
||||
assert!(!ia.sites.iter().any(|peer| peer.name == "b"));
|
||||
let targets: Vec<serde_json::Value> = list_replication_targets_request(&a, Some(bucket))
|
||||
.await?
|
||||
.error_for_status()?
|
||||
.json()
|
||||
.await?;
|
||||
assert!(
|
||||
targets
|
||||
.iter()
|
||||
.any(|target| target["arn"] == operator_arn && target["targetbucket"] == operator_bucket),
|
||||
"operator target {operator_arn} must survive decommission"
|
||||
);
|
||||
assert!(
|
||||
!targets.iter().any(|target| target["arn"] == retired_arn),
|
||||
"retired site target {retired_arn} must be removed"
|
||||
);
|
||||
ca.put_object()
|
||||
.bucket(bucket)
|
||||
.key("a-to-c")
|
||||
.body(ByteStream::from_static(b"a to c survives"))
|
||||
.send()
|
||||
.await?;
|
||||
assert_eq!(wait_for_object_on_target(&cc, bucket, "a-to-c").await?, b"a to c survives");
|
||||
assert_eq!(wait_for_object_on_target(&cc, operator_bucket, "a-to-c").await?, b"a to c survives");
|
||||
cc.put_object()
|
||||
.bucket(bucket)
|
||||
.key("c-to-a")
|
||||
.body(ByteStream::from_static(b"c to a survives"))
|
||||
.send()
|
||||
.await?;
|
||||
assert_eq!(wait_for_object_on_target(&ca, bucket, "c-to-a").await?, b"c to a survives");
|
||||
c.restart_server_preserving_data(vec![], &env).await?;
|
||||
assert!(site_replication_info(&c).await?.pending_operation.is_none());
|
||||
assert_eq!(decommission_site_v2(&a, &request).await?.status, "success");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn site_replication_state_edit(
|
||||
env: &RustFSTestEnvironment,
|
||||
body: &rustfs_madmin::SRStateEditReq,
|
||||
@@ -8543,7 +8222,7 @@ async fn test_site_replication_tagging_during_initial_pending_window_converges()
|
||||
_site_b_replication_enabled,
|
||||
_site_b_held_tagging,
|
||||
mut site_b_response_hold,
|
||||
) = start_replication_counting_proxy_with_tag_hold(&site_b_env.url, &mut proxy_tasks, None).await?;
|
||||
) = start_replication_counting_proxy_with_tag_hold(&site_b_env.url, &mut proxy_tasks).await?;
|
||||
|
||||
let add_status = site_replication_add(
|
||||
&site_a_env,
|
||||
@@ -8800,9 +8479,9 @@ async fn test_site_replication_tagging_lww_converges_active_active_real_dual_nod
|
||||
|
||||
let mut proxy_tasks = JoinSet::new();
|
||||
let (site_a_proxy, site_a_replication_requests, _site_a_replication_enabled, site_a_held_tagging, _site_a_response_hold) =
|
||||
start_replication_counting_proxy_with_tag_hold(&site_a_env.url, &mut proxy_tasks, None).await?;
|
||||
start_replication_counting_proxy_with_tag_hold(&site_a_env.url, &mut proxy_tasks).await?;
|
||||
let (site_b_proxy, site_b_replication_requests, _site_b_replication_enabled, site_b_held_tagging, _site_b_response_hold) =
|
||||
start_replication_counting_proxy_with_tag_hold(&site_b_env.url, &mut proxy_tasks, None).await?;
|
||||
start_replication_counting_proxy_with_tag_hold(&site_b_env.url, &mut proxy_tasks).await?;
|
||||
|
||||
let site_a_client = site_a_env.create_s3_client();
|
||||
let site_b_client = site_b_env.create_s3_client();
|
||||
|
||||
@@ -1,208 +0,0 @@
|
||||
// Copyright 2026 RustFS Team
|
||||
// Licensed under the Apache License, Version 2.0.
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::path::Path;
|
||||
use std::time::{Duration, SystemTime};
|
||||
|
||||
use aws_sdk_s3::{Client, primitives::ByteStream};
|
||||
use futures::{StreamExt, TryStreamExt, stream};
|
||||
use rustfs_data_usage::{BucketUsageValueState, DataUsageInfo};
|
||||
use serde::{Deserialize, de::DeserializeOwned};
|
||||
use tokio::time::{Instant, sleep, timeout};
|
||||
|
||||
use crate::common::{RustFSTestEnvironment, signed_request};
|
||||
use crate::storage_api::scanner_peer_bucket::{BUCKET_META_PREFIX, RUSTFS_META_BUCKET};
|
||||
|
||||
type TestResult<T = ()> = Result<T, Box<dyn std::error::Error + Send + Sync>>;
|
||||
|
||||
const BUCKET: &str = "wide-directory-usage";
|
||||
const WIDTH: usize = 512;
|
||||
// The per-disk token bucket allows an initial burst of one second. Even the
|
||||
// first pass can read at most (1 + 3) * 96 = 384 of these 512 root entries.
|
||||
const SCAN_ENV: &[(&str, &str)] = &[
|
||||
("RUST_LOG", "warn,rustfs::scanner::io=debug,rustfs::scanner::data_usage=debug"),
|
||||
("RUSTFS_SCANNER_ENABLED", "true"),
|
||||
("RUSTFS_SCANNER_START_DELAY_SECS", "0"),
|
||||
("RUSTFS_SCANNER_CYCLE", "1"),
|
||||
("RUSTFS_SCANNER_CYCLE_MAX_DURATION_SECS", "3"),
|
||||
("RUSTFS_SCANNER_SPEED", "fastest"),
|
||||
("RUSTFS_SCANNER_DISK_IO_BUDGET_IOPS", "96"),
|
||||
("RUSTFS_SCANNER_DISK_IO_BUDGET_BYTES_PER_SEC", "off"),
|
||||
];
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Status {
|
||||
metrics: Metrics,
|
||||
disk_io_budget: Vec<DiskBudget>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct Metrics {
|
||||
current_cycle_active: bool,
|
||||
active_paths: Vec<String>,
|
||||
cycle_max_duration_seconds: f64,
|
||||
partial_cycles_runtime: u64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct DiskBudget {
|
||||
iops: Option<u64>,
|
||||
}
|
||||
|
||||
async fn admin<T: DeserializeOwned>(env: &RustFSTestEnvironment, resource: &str) -> TestResult<T> {
|
||||
let url = format!("{}/rustfs/admin/v3/{resource}", env.url);
|
||||
let response = signed_request(http::Method::GET, &url, &env.access_key, &env.secret_key, None, None).await?;
|
||||
Ok(response.error_for_status()?.json().await?)
|
||||
}
|
||||
|
||||
async fn inventory(client: &Client) -> TestResult<BTreeMap<String, u64>> {
|
||||
let mut pages = client.list_objects_v2().bucket(BUCKET).max_keys(37).into_paginator().send();
|
||||
let mut sizes = BTreeMap::new();
|
||||
while let Some(page) = pages.next().await {
|
||||
for object in page?.contents() {
|
||||
let key = object.key().ok_or("S3 inventory omitted object key")?;
|
||||
let size = u64::try_from(object.size().ok_or("S3 inventory omitted object size")?)?;
|
||||
assert!(sizes.insert(key.to_owned(), size).is_none(), "duplicate inventory key {key}");
|
||||
}
|
||||
}
|
||||
Ok(sizes)
|
||||
}
|
||||
|
||||
async fn scan_status(env: &RustFSTestEnvironment) -> TestResult<Status> {
|
||||
let status: Status = admin(env, "scanner/status").await?;
|
||||
assert_eq!(status.metrics.cycle_max_duration_seconds, 3.0, "effective cycle budget");
|
||||
assert!(status.disk_io_budget.iter().all(|disk| disk.iops == Some(96)), "effective disk budget");
|
||||
Ok(status)
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn certifies_wide_directory_after_mid_scan_process_restart() -> TestResult {
|
||||
let mut env = RustFSTestEnvironment::new().await?;
|
||||
let temporary_log = tempfile::NamedTempFile::new()?;
|
||||
let server_log = env
|
||||
.capture_log_path
|
||||
.get_or_insert_with(|| temporary_log.path().display().to_string())
|
||||
.clone();
|
||||
let bucket_metadata = Path::new(&env.temp_dir)
|
||||
.join(RUSTFS_META_BUCKET)
|
||||
.join(BUCKET_META_PREFIX)
|
||||
.join(BUCKET);
|
||||
// Seed a cold bucket without allowing any earlier, larger-budget sweep to count it.
|
||||
env.start_rustfs_server_without_cleanup_with_env(&[("RUSTFS_SCANNER_ENABLED", "false")])
|
||||
.await?;
|
||||
let client = env.create_s3_client();
|
||||
client.create_bucket().bucket(BUCKET).send().await?;
|
||||
stream::iter(0..WIDTH)
|
||||
.map(Ok)
|
||||
.try_for_each_concurrent(12, |i| {
|
||||
let client = &client;
|
||||
async move {
|
||||
client
|
||||
.put_object()
|
||||
.bucket(BUCKET)
|
||||
.key(format!("object-{i:064x}"))
|
||||
.body(ByteStream::from(vec![42; 1 + i % 67]))
|
||||
.send()
|
||||
.await
|
||||
.map(|_| ())
|
||||
}
|
||||
})
|
||||
.await?;
|
||||
let expected = inventory(&client).await?;
|
||||
assert_eq!(expected.len(), WIDTH);
|
||||
|
||||
env.restart_server_preserving_data(vec![], SCAN_ENV).await?;
|
||||
let first_pid = env.process.as_ref().ok_or("missing scanner process")?.id();
|
||||
timeout(Duration::from_secs(60), async {
|
||||
loop {
|
||||
let status = scan_status(&env).await?;
|
||||
if status.metrics.partial_cycles_runtime >= 1
|
||||
&& bucket_metadata.join(".usage-cache.bin").join("xl.meta").is_file()
|
||||
&& bucket_metadata.join(".usage-cache.bin.pages").is_dir()
|
||||
&& status.metrics.current_cycle_active
|
||||
&& status
|
||||
.metrics
|
||||
.active_paths
|
||||
.iter()
|
||||
.any(|path| path.split('/').any(|part| part == BUCKET))
|
||||
{
|
||||
let log = tokio::fs::read_to_string(&server_log).await?;
|
||||
if !log
|
||||
.lines()
|
||||
.any(|line| line.contains("partial_saved_not_published") && line.contains(BUCKET))
|
||||
{
|
||||
sleep(Duration::from_millis(200)).await;
|
||||
continue;
|
||||
}
|
||||
assert!(!status.disk_io_budget.is_empty(), "scanner never admitted disk I/O");
|
||||
break Ok::<_, Box<dyn std::error::Error + Send + Sync>>(());
|
||||
}
|
||||
sleep(Duration::from_millis(200)).await;
|
||||
}
|
||||
})
|
||||
.await
|
||||
.map_err(|_| "scanner did not re-enter the bucket after exhausting the fixed runtime budget")??;
|
||||
let partial: DataUsageInfo = admin(&env, "datausageinfo").await?;
|
||||
assert!(
|
||||
partial
|
||||
.buckets_usage
|
||||
.get(BUCKET)
|
||||
.is_none_or(|value| value.usage_certification.is_none()),
|
||||
"the first process certified the bucket before the injected crash"
|
||||
);
|
||||
|
||||
env.stop_server();
|
||||
// The terminal save has returned and the old process can no longer write.
|
||||
assert!(
|
||||
bucket_metadata.join(".usage-cache.bin").join("xl.meta").is_file()
|
||||
&& bucket_metadata.join(".usage-cache.bin.pages").is_dir(),
|
||||
"the interrupted process must have committed a paged checkpoint"
|
||||
);
|
||||
let restart_log_offset = usize::try_from(tokio::fs::metadata(&server_log).await?.len())?;
|
||||
let restarted_at = SystemTime::now();
|
||||
env.start_rustfs_server_without_cleanup_with_env(SCAN_ENV).await?;
|
||||
let second_pid = env.process.as_ref().ok_or("missing restarted scanner process")?.id();
|
||||
assert_ne!(first_pid, second_pid);
|
||||
let deadline = Instant::now() + Duration::from_secs(180);
|
||||
loop {
|
||||
let usage: DataUsageInfo = admin(&env, "datausageinfo").await?;
|
||||
let status = scan_status(&env).await?;
|
||||
if let Some(bucket) = usage.buckets_usage.get(BUCKET)
|
||||
&& bucket.usage_value_state == Some(BucketUsageValueState::Certified)
|
||||
{
|
||||
let log = tokio::fs::read_to_string(&server_log).await?;
|
||||
let first_admission = log
|
||||
.get(restart_log_offset..)
|
||||
.ok_or("server log truncated across restart")?
|
||||
.lines()
|
||||
.filter_map(|line| serde_json::from_str::<serde_json::Value>(line).ok())
|
||||
.find(|record| record["state"] == "bucket_checkpoint_prepared" && record["bucket"] == BUCKET)
|
||||
.ok_or("no checkpoint admission in the restarted process")?;
|
||||
assert_eq!(first_admission["resume_position"], true, "restarted scanner discarded the checkpoint");
|
||||
assert!(usage.is_complete_bucket_usage_snapshot());
|
||||
let certificate = bucket
|
||||
.usage_certification
|
||||
.ok_or("missing certificate for the measured bucket")?;
|
||||
assert!(certificate.certified_at >= restarted_at, "stale pre-restart certificate");
|
||||
assert!(status.metrics.partial_cycles_runtime > 0, "new process must cross a cycle deadline");
|
||||
assert!(!status.disk_io_budget.is_empty(), "restarted scanner never admitted disk I/O");
|
||||
assert_eq!(inventory(&client).await?, expected, "durable S3 inventory changed across restart");
|
||||
let count = u64::try_from(expected.len())?;
|
||||
let bytes = expected.values().sum::<u64>();
|
||||
assert_eq!((bucket.objects_count, bucket.size), (count, bytes));
|
||||
assert_eq!((usage.objects_total_count, usage.objects_total_size), (count, bytes));
|
||||
eprintln!(
|
||||
"PIDs {first_pid}/{second_pid}, runtime-limited cycles since restart {}, certificate epoch {} cycle {}, S3 and admin {} objects/{} bytes",
|
||||
status.metrics.partial_cycles_runtime, certificate.epoch, certificate.cycle, count, bytes
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
assert!(
|
||||
Instant::now() < deadline,
|
||||
"no certified bucket after restart: {status:?}, value={:?}",
|
||||
usage.buckets_usage.get(BUCKET)
|
||||
);
|
||||
sleep(Duration::from_millis(500)).await;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -655,31 +655,26 @@ mod tests {
|
||||
let ranged_body = ranged.body.collect().await?.into_bytes();
|
||||
assert_eq!(&ranged_body[..], &system_body[..4]);
|
||||
|
||||
tokio::time::timeout(std::time::Duration::from_secs(180), async {
|
||||
let capacity = tokio::time::timeout(std::time::Duration::from_secs(180), async {
|
||||
loop {
|
||||
match client.get_object().bucket(bucket).key(CAPACITY_KEY).send().await {
|
||||
Ok(capacity) => {
|
||||
assert_eq!(capacity.content_type(), Some("application/xml"));
|
||||
let body = capacity.body.collect().await?.into_bytes();
|
||||
let xml = std::str::from_utf8(&body)?;
|
||||
let capacity: u64 = xml_text(xml, "Capacity")?.parse()?;
|
||||
let available: u64 = xml_text(xml, "Available")?.parse()?;
|
||||
let used = xml_text(xml, "Used")?;
|
||||
assert!(capacity > 0 && available <= capacity, "{xml}");
|
||||
if used != "-1" {
|
||||
let used: u64 = used.parse()?;
|
||||
assert!(used <= capacity, "{xml}");
|
||||
assert!(available <= capacity - used, "{xml}");
|
||||
break Ok::<(), Box<dyn std::error::Error + Send + Sync>>(());
|
||||
}
|
||||
Ok(capacity) => break Ok(capacity),
|
||||
Err(err) if err.code() == Some("ServiceUnavailable") => {
|
||||
tokio::time::sleep(std::time::Duration::from_secs(2)).await;
|
||||
}
|
||||
Err(err) if err.code() == Some("ServiceUnavailable") => {}
|
||||
Err(err) => return Err(err.into()),
|
||||
Err(err) => break Err(err),
|
||||
}
|
||||
tokio::time::sleep(std::time::Duration::from_secs(2)).await;
|
||||
}
|
||||
})
|
||||
.await??;
|
||||
assert_eq!(capacity.content_type(), Some("application/xml"));
|
||||
let capacity_body = capacity.body.collect().await?.into_bytes();
|
||||
let capacity_xml = std::str::from_utf8(&capacity_body)?;
|
||||
let capacity_value = xml_u64(capacity_xml, "Capacity")?;
|
||||
let available_value = xml_u64(capacity_xml, "Available")?;
|
||||
let used_value = xml_u64(capacity_xml, "Used")?;
|
||||
assert!(used_value <= capacity_value, "{capacity_xml}");
|
||||
assert!(available_value <= capacity_value.saturating_sub(used_value), "{capacity_xml}");
|
||||
|
||||
let put_err = client
|
||||
.put_object()
|
||||
@@ -742,7 +737,7 @@ mod tests {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn xml_text<'a>(xml: &'a str, element: &str) -> Result<&'a str, Box<dyn std::error::Error + Send + Sync>> {
|
||||
fn xml_u64(xml: &str, element: &str) -> Result<u64, Box<dyn std::error::Error + Send + Sync>> {
|
||||
let start = format!("<{element}>");
|
||||
let end = format!("</{element}>");
|
||||
let start_idx = xml.find(&start).ok_or_else(|| format!("missing {element} in {xml}"))? + start.len();
|
||||
@@ -750,7 +745,7 @@ mod tests {
|
||||
.find(&end)
|
||||
.ok_or_else(|| format!("unclosed {element} in {xml}"))?
|
||||
+ start_idx;
|
||||
Ok(&xml[start_idx..end_idx])
|
||||
Ok(xml[start_idx..end_idx].parse()?)
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Cargo tracks option_env! when compiling this script. Keep its usual package-file
|
||||
// change detection, while refreshing shadow-rs when an E2E build switches revisions.
|
||||
const _: Option<&str> = option_env!("RUSTFS_E2E_BUILD_HEAD");
|
||||
|
||||
fn main() -> shadow_rs::SdResult<()> {
|
||||
shadow_rs::ShadowBuilder::builder().build()?;
|
||||
Ok(())
|
||||
|
||||
@@ -28,7 +28,7 @@ pub mod diagnostic {
|
||||
}
|
||||
|
||||
pub mod admin {
|
||||
pub use crate::diagnostics::admin_server_info::{get_local_server_property, get_server_info, get_server_info_with_inventory};
|
||||
pub use crate::diagnostics::admin_server_info::{get_local_server_property, get_server_info};
|
||||
}
|
||||
|
||||
pub mod bitrot {
|
||||
@@ -72,11 +72,10 @@ pub mod bucket {
|
||||
ExpiryState, LifecycleOps, ManualTransitionCancelCheck, ManualTransitionProgressSink,
|
||||
ManualTransitionQueueSnapshot, ManualTransitionRunExecution, ManualTransitionRunOptions,
|
||||
ManualTransitionRunReport, RestoreRequestOps, TransitionState, TransitionedObject, apply_expiry_rule,
|
||||
apply_transition_rule, apply_transition_rule_with_incarnation, enqueue_expiry_for_existing_objects,
|
||||
enqueue_transition_for_existing_objects, enqueue_transition_for_existing_objects_scoped,
|
||||
enqueue_transition_for_existing_objects_scoped_with_cancel, enqueue_transition_immediate,
|
||||
expire_transitioned_object, get_global_expiry_state, get_global_transition_state, init_background_expiry,
|
||||
lifecycle_version_delete_target, manual_transition_queue_snapshot, post_restore_opts,
|
||||
apply_transition_rule, enqueue_expiry_for_existing_objects, enqueue_transition_for_existing_objects,
|
||||
enqueue_transition_for_existing_objects_scoped, enqueue_transition_for_existing_objects_scoped_with_cancel,
|
||||
enqueue_transition_immediate, expire_transitioned_object, get_global_expiry_state, get_global_transition_state,
|
||||
init_background_expiry, lifecycle_version_delete_target, manual_transition_queue_snapshot, post_restore_opts,
|
||||
run_stale_multipart_upload_cleanup_once, validate_transition_tier,
|
||||
};
|
||||
}
|
||||
@@ -349,7 +348,7 @@ pub mod bucket {
|
||||
|
||||
pub mod utils {
|
||||
pub use crate::bucket::utils::{
|
||||
BucketConfigXml, BucketConfigXmlError, check_bucket_and_object_names, check_list_objs_args, check_object_args,
|
||||
BucketConfigXml, BucketConfigXmlError, check_bucket_and_object_names, check_list_objs_args,
|
||||
check_object_name_for_length_and_slash, check_valid_bucket_name_strict, deserialize, has_bad_path_component,
|
||||
has_xml_invalid_control_characters, is_meta_bucketname, is_valid_object_prefix, serialize,
|
||||
};
|
||||
@@ -455,13 +454,13 @@ pub mod data_usage {
|
||||
DATA_USAGE_CACHE_NAME, apply_bucket_usage_memory_overlay, compute_bucket_usage,
|
||||
init_compression_total_memory_from_backend, invalidate_admin_data_usage_snapshot_cache,
|
||||
invalidate_data_usage_snapshot_cache, live_bucket_usage_computations, load_admin_data_usage_from_backend_cached,
|
||||
load_admin_data_usage_with_memory_overlay, load_bucket_scan_progress_for_admin, load_bucket_usage_from_backend_cached,
|
||||
load_compression_total_from_memory, load_data_usage_from_backend, load_data_usage_from_backend_cached, quota_object_size,
|
||||
record_bucket_delete_marker_memory, record_bucket_object_delete_memory, record_bucket_object_version_write_memory,
|
||||
record_bucket_object_write_memory, record_bucket_object_write_unknown_previous_memory, record_compression_total_memory,
|
||||
load_bucket_usage_from_backend_cached, load_compression_total_from_memory, load_data_usage_from_backend,
|
||||
load_data_usage_from_backend_cached, quota_object_size, record_bucket_delete_marker_memory,
|
||||
record_bucket_object_delete_memory, record_bucket_object_version_write_memory, record_bucket_object_write_memory,
|
||||
record_bucket_object_write_unknown_previous_memory, record_compression_total_memory,
|
||||
refresh_bucket_usage_from_object_layer, refresh_versioned_bucket_usage_from_object_layer,
|
||||
remove_bucket_usage_from_backend, replace_bucket_usage_memory_from_info, store_compression_total_in_backend,
|
||||
store_data_usage_in_backend, verified_account_bucket_usage,
|
||||
store_data_usage_in_backend,
|
||||
};
|
||||
pub use crate::data_usage::{get_bucket_usage_memory, lookup_degraded_bucket_usage_baseline};
|
||||
}
|
||||
@@ -470,7 +469,6 @@ pub mod disk {
|
||||
pub use crate::cluster::rpc::background_pipe::{BackgroundPipeReader, BackgroundPipeWriter, background_pipe};
|
||||
pub use crate::cluster::rpc::background_reader_stream::BackgroundReaderStream;
|
||||
pub use crate::disk::BOUNDED_DELETE_PREPARE_PROTOCOL_VERSION;
|
||||
pub use crate::disk::ReplacementMount;
|
||||
pub use crate::disk::background_memory::BackgroundEncodeBuffer;
|
||||
pub use crate::disk::disk_store::get_object_disk_read_timeout;
|
||||
#[cfg(feature = "test-util")]
|
||||
@@ -716,12 +714,11 @@ pub mod rpc {
|
||||
rpc_auth_is_resource_exhausted, rpc_background_admission, set_tonic_canonical_body_digest, sign_ns_scanner_capability,
|
||||
sign_ns_scanner_capability_with_checkpoint_coverage, sign_ns_scanner_capability_with_durable_progress,
|
||||
sign_ns_scanner_capability_with_tier_registry_generation, sign_ns_scanner_capability_with_usage_capabilities,
|
||||
sign_ns_scanner_tier_registry_preflight_capability, sign_ns_scanner_usage_watch_capability, sign_put_file_capability,
|
||||
sign_tonic_rpc_response_proof, tonic_boot_epoch_challenge, tonic_boot_epoch_response_headers,
|
||||
tonic_boot_epoch_response_headers_with_msgpack_capability, tonic_msgpack_manifest_capability_requested,
|
||||
tonic_rpc_auth_failure_reason, verify_ns_scanner_capability, verify_ns_scanner_capability_with_checkpoint_coverage,
|
||||
verify_ns_scanner_capability_with_durable_progress, verify_ns_scanner_capability_with_tier_registry_generation,
|
||||
verify_ns_scanner_capability_with_usage_capabilities, verify_ns_scanner_tier_registry_preflight_capability,
|
||||
sign_ns_scanner_usage_watch_capability, sign_put_file_capability, sign_tonic_rpc_response_proof,
|
||||
tonic_boot_epoch_challenge, tonic_boot_epoch_response_headers, tonic_boot_epoch_response_headers_with_msgpack_capability,
|
||||
tonic_msgpack_manifest_capability_requested, tonic_rpc_auth_failure_reason, verify_ns_scanner_capability,
|
||||
verify_ns_scanner_capability_with_checkpoint_coverage, verify_ns_scanner_capability_with_durable_progress,
|
||||
verify_ns_scanner_capability_with_tier_registry_generation, verify_ns_scanner_capability_with_usage_capabilities,
|
||||
verify_ns_scanner_usage_watch_capability, verify_put_file_auth_trailer, verify_put_file_capability, verify_rpc_signature,
|
||||
verify_tonic_boot_epoch_response, verify_tonic_canonical_body_digest, verify_tonic_mutation_body_digest,
|
||||
verify_tonic_mutation_body_digest_reject_unsigned, verify_tonic_rpc_response_proof, verify_tonic_rpc_signature,
|
||||
|
||||
@@ -51,20 +51,15 @@ impl LcAuditEvent {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn emit_transition_failed_event(object: ObjectInfo, incarnation_id: Option<uuid::Uuid>) {
|
||||
emit_lifecycle_event(EventName::ObjectTransitionFailed, object, LIFECYCLE_TRANSITION_USER_AGENT, incarnation_id);
|
||||
pub(crate) fn emit_transition_failed_event(object: ObjectInfo) {
|
||||
emit_lifecycle_event(EventName::ObjectTransitionFailed, object, LIFECYCLE_TRANSITION_USER_AGENT);
|
||||
}
|
||||
|
||||
pub(crate) fn emit_transition_complete_event(object: ObjectInfo, incarnation_id: Option<uuid::Uuid>) {
|
||||
emit_lifecycle_event(
|
||||
EventName::ObjectTransitionComplete,
|
||||
object,
|
||||
LIFECYCLE_TRANSITION_USER_AGENT,
|
||||
incarnation_id,
|
||||
);
|
||||
pub(crate) fn emit_transition_complete_event(object: ObjectInfo) {
|
||||
emit_lifecycle_event(EventName::ObjectTransitionComplete, object, LIFECYCLE_TRANSITION_USER_AGENT);
|
||||
}
|
||||
|
||||
pub(crate) fn emit_transitioned_expiration_event(source: &ObjectInfo, deleted: &ObjectInfo, incarnation_id: uuid::Uuid) {
|
||||
pub(crate) fn emit_transitioned_expiration_event(source: &ObjectInfo, deleted: &ObjectInfo) {
|
||||
let event_name = transitioned_expiration_event_name(source.delete_marker, deleted.delete_marker);
|
||||
let object = ObjectInfo {
|
||||
bucket: source.bucket.clone(),
|
||||
@@ -74,17 +69,12 @@ pub(crate) fn emit_transitioned_expiration_event(source: &ObjectInfo, deleted: &
|
||||
delete_marker: source.delete_marker,
|
||||
..Default::default()
|
||||
};
|
||||
emit_lifecycle_event(event_name, object, LIFECYCLE_EXPIRY_USER_AGENT, Some(incarnation_id));
|
||||
emit_lifecycle_event(event_name, object, LIFECYCLE_EXPIRY_USER_AGENT);
|
||||
}
|
||||
|
||||
pub(crate) fn emit_non_transitioned_expiration_event(
|
||||
action: IlmAction,
|
||||
source: &ObjectInfo,
|
||||
deleted: ObjectInfo,
|
||||
incarnation_id: uuid::Uuid,
|
||||
) {
|
||||
pub(crate) fn emit_non_transitioned_expiration_event(action: IlmAction, source: &ObjectInfo, deleted: ObjectInfo) {
|
||||
let event_name = non_transitioned_expiration_event_name(action, source.delete_marker, deleted.delete_marker);
|
||||
emit_lifecycle_event(event_name, deleted, LIFECYCLE_EXPIRY_USER_AGENT, Some(incarnation_id));
|
||||
emit_lifecycle_event(event_name, deleted, LIFECYCLE_EXPIRY_USER_AGENT);
|
||||
}
|
||||
|
||||
/// Emit the lifecycle expiration event for one version removed by the batch
|
||||
@@ -93,15 +83,9 @@ pub(crate) fn emit_non_transitioned_expiration_event(
|
||||
/// That path never sent events, so a successful noncurrent-version expiry was
|
||||
/// invisible to notification subscribers even though the equivalent
|
||||
/// current-version path emits one (backlog#2202).
|
||||
pub(crate) fn emit_noncurrent_expiration_event(
|
||||
bucket: &str,
|
||||
target: &ObjectToDelete,
|
||||
deleted: &DeletedObject,
|
||||
failed: bool,
|
||||
incarnation_id: uuid::Uuid,
|
||||
) {
|
||||
pub(crate) fn emit_noncurrent_expiration_event(bucket: &str, target: &ObjectToDelete, deleted: &DeletedObject, failed: bool) {
|
||||
if let Some((event_name, object)) = noncurrent_expiration_event(bucket, target, deleted, failed) {
|
||||
emit_lifecycle_event(event_name, object, LIFECYCLE_EXPIRY_USER_AGENT, Some(incarnation_id));
|
||||
emit_lifecycle_event(event_name, object, LIFECYCLE_EXPIRY_USER_AGENT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,10 +131,9 @@ fn noncurrent_expiration_event(
|
||||
Some((event_name, object))
|
||||
}
|
||||
|
||||
fn emit_lifecycle_event(event_name: EventName, object: ObjectInfo, user_agent: &str, incarnation_id: Option<uuid::Uuid>) {
|
||||
fn emit_lifecycle_event(event_name: EventName, object: ObjectInfo, user_agent: &str) {
|
||||
send_event(EventArgs {
|
||||
event_name: event_name.to_string(),
|
||||
bucket_incarnation_id: incarnation_id,
|
||||
bucket_name: object.bucket.clone(),
|
||||
object,
|
||||
user_agent: user_agent.to_string(),
|
||||
|
||||
@@ -117,9 +117,9 @@ use tracing::{debug, error, warn};
|
||||
use uuid::Uuid;
|
||||
use xxhash_rust::xxh64;
|
||||
|
||||
pub(super) const LOG_COMPONENT_ECSTORE: &str = "ecstore";
|
||||
pub(super) const LOG_SUBSYSTEM_LIFECYCLE: &str = "lifecycle";
|
||||
pub(super) const EVENT_LIFECYCLE_WORKER_STATE: &str = "lifecycle_worker_state";
|
||||
const LOG_COMPONENT_ECSTORE: &str = "ecstore";
|
||||
const LOG_SUBSYSTEM_LIFECYCLE: &str = "lifecycle";
|
||||
const EVENT_LIFECYCLE_WORKER_STATE: &str = "lifecycle_worker_state";
|
||||
const EVENT_LIFECYCLE_TRANSITION_COMPENSATION: &str = "lifecycle_transition_compensation";
|
||||
const EVENT_LIFECYCLE_STALE_MULTIPART_CLEANUP: &str = "lifecycle_stale_multipart_cleanup";
|
||||
const METRIC_STALE_MULTIPART_CLEANUP_BLOCKED_TOTAL: &str = "rustfs_stale_multipart_cleanup_blocked_total";
|
||||
@@ -1566,12 +1566,7 @@ pub(super) async fn enqueue_recovered_free_version_with_cancel(
|
||||
queued
|
||||
}
|
||||
|
||||
type TransitionKey = (Option<Uuid>, String, String, String);
|
||||
|
||||
struct TransitionTask {
|
||||
// Captured with the source object; recovery without this provenance must
|
||||
// never bind notification authority from the bucket name at execution.
|
||||
notification_bucket_incarnation: Option<Uuid>,
|
||||
obj_info: ObjectInfo,
|
||||
src: LcEventSrc,
|
||||
event: lifecycle::Event,
|
||||
@@ -1611,12 +1606,12 @@ pub struct TransitionState {
|
||||
compensation_scheduled_tasks: AtomicI64,
|
||||
compensation_running_tasks: AtomicI64,
|
||||
compensation_buckets: Arc<Mutex<HashSet<String>>>,
|
||||
// (incarnation, bucket, object, version) currently queued or being transitioned. A single
|
||||
// (bucket, object, version) currently queued or being transitioned. A single
|
||||
// PUT can enqueue the same object twice (immediate transition + startup
|
||||
// compensation backfill); without this guard the duplicates run concurrently,
|
||||
// and the loser races the winner's source cleanup — reading data the winner
|
||||
// already removed and logging a spurious NotFound failure (rustfs/backlog#1268).
|
||||
in_flight_transitions: Arc<Mutex<HashSet<TransitionKey>>>,
|
||||
in_flight_transitions: Arc<Mutex<HashSet<(String, String, String)>>>,
|
||||
last_day_stats: Arc<Mutex<HashMap<String, LastDayTierStats>>>,
|
||||
}
|
||||
|
||||
@@ -1682,29 +1677,28 @@ impl TransitionState {
|
||||
})
|
||||
}
|
||||
|
||||
fn transition_key(oi: &ObjectInfo, incarnation: Option<Uuid>) -> TransitionKey {
|
||||
fn transition_key(oi: &ObjectInfo) -> (String, String, String) {
|
||||
(
|
||||
incarnation,
|
||||
oi.bucket.clone(),
|
||||
oi.name.clone(),
|
||||
oi.version_id.map(|v| v.to_string()).unwrap_or_default(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Try to claim a transition for this exact (incarnation, bucket, object, version). Returns
|
||||
/// Try to claim a transition for this exact (bucket, object, version). Returns
|
||||
/// `false` when one is already queued or running, so the caller can skip the
|
||||
/// duplicate enqueue (rustfs/backlog#1268). The claim is released in the
|
||||
/// worker once the transition finishes, or here if the enqueue fails.
|
||||
fn reserve_transition(&self, oi: &ObjectInfo, incarnation: Option<Uuid>) -> bool {
|
||||
let key = Self::transition_key(oi, incarnation);
|
||||
fn reserve_transition(&self, oi: &ObjectInfo) -> bool {
|
||||
let key = Self::transition_key(oi);
|
||||
match self.in_flight_transitions.lock() {
|
||||
Ok(mut set) => set.insert(key),
|
||||
Err(poisoned) => poisoned.into_inner().insert(key),
|
||||
}
|
||||
}
|
||||
|
||||
fn release_transition(&self, oi: &ObjectInfo, incarnation: Option<Uuid>) {
|
||||
let key = Self::transition_key(oi, incarnation);
|
||||
fn release_transition(&self, oi: &ObjectInfo) {
|
||||
let key = Self::transition_key(oi);
|
||||
match self.in_flight_transitions.lock() {
|
||||
Ok(mut set) => set.remove(&key),
|
||||
Err(poisoned) => poisoned.into_inner().remove(&key),
|
||||
@@ -1908,7 +1902,6 @@ impl TransitionState {
|
||||
event: &lifecycle::Event,
|
||||
src: &LcEventSrc,
|
||||
manual_job_id: Option<Uuid>,
|
||||
notification_bucket_incarnation: Option<Uuid>,
|
||||
) -> TransitionEnqueueOutcome {
|
||||
if is_immediate_transition_source(src) && should_force_immediate_transition_enqueue_timeout() {
|
||||
self.handle_immediate_enqueue_failure(oi, src, ImmediateEnqueueFailure::ForcedTimeout);
|
||||
@@ -1921,7 +1914,7 @@ impl TransitionState {
|
||||
// released by the worker after the transition finishes (rustfs/backlog#1268).
|
||||
// This is a no-op, not a new enqueue, so it must not touch the enqueue
|
||||
// counters (the first enqueue already counted this object).
|
||||
if !self.reserve_transition(oi, notification_bucket_incarnation) {
|
||||
if !self.reserve_transition(oi) {
|
||||
self.record_scanner_transition_state();
|
||||
return TransitionEnqueueOutcome::AlreadyInFlight;
|
||||
}
|
||||
@@ -1930,7 +1923,7 @@ impl TransitionState {
|
||||
manual_job_id.map(|_| manual_transition_worker_result_task_key(&oi.bucket, &oi.name, oi.version_id));
|
||||
if let (Some(job_id), Some(result_key)) = (manual_job_id, manual_result_key.as_deref()) {
|
||||
let Some(api) = api else {
|
||||
self.release_transition(oi, notification_bucket_incarnation);
|
||||
self.release_transition(oi);
|
||||
warn!(
|
||||
event = EVENT_LIFECYCLE_WORKER_STATE,
|
||||
component = LOG_COMPONENT_ECSTORE,
|
||||
@@ -1955,7 +1948,7 @@ impl TransitionState {
|
||||
)
|
||||
.with_object_metadata(oi.etag.clone(), oi.mod_time, oi.size, oi.is_latest);
|
||||
if let Err(err) = save_manual_transition_task_if_absent(api, &task_record).await {
|
||||
self.release_transition(oi, notification_bucket_incarnation);
|
||||
self.release_transition(oi);
|
||||
warn!(
|
||||
event = EVENT_LIFECYCLE_WORKER_STATE,
|
||||
component = LOG_COMPONENT_ECSTORE,
|
||||
@@ -1974,7 +1967,6 @@ impl TransitionState {
|
||||
}
|
||||
|
||||
let task = TransitionTask {
|
||||
notification_bucket_incarnation,
|
||||
obj_info: oi.clone(),
|
||||
src: src.clone(),
|
||||
event: event.clone(),
|
||||
@@ -2018,7 +2010,7 @@ impl TransitionState {
|
||||
};
|
||||
let queued = outcome == TransitionEnqueueOutcome::Queued;
|
||||
if !queued {
|
||||
self.release_transition(oi, notification_bucket_incarnation);
|
||||
self.release_transition(oi);
|
||||
}
|
||||
record_scanner_transition_enqueue_result(src, 1, queued);
|
||||
self.record_scanner_transition_state();
|
||||
@@ -2071,7 +2063,7 @@ impl TransitionState {
|
||||
};
|
||||
let queued = outcome == TransitionEnqueueOutcome::Queued;
|
||||
if !queued {
|
||||
self.release_transition(oi, notification_bucket_incarnation);
|
||||
self.release_transition(oi);
|
||||
}
|
||||
record_scanner_transition_enqueue_result(src, 1, queued);
|
||||
self.record_scanner_transition_state();
|
||||
@@ -2079,7 +2071,7 @@ impl TransitionState {
|
||||
}
|
||||
|
||||
pub async fn queue_transition_task(self: &Arc<Self>, oi: &ObjectInfo, event: &lifecycle::Event, src: &LcEventSrc) -> bool {
|
||||
self.queue_transition_task_outcome(None, oi, event, src, None, None)
|
||||
self.queue_transition_task_outcome(None, oi, event, src, None)
|
||||
.await
|
||||
.is_handled()
|
||||
}
|
||||
@@ -2174,10 +2166,9 @@ impl TransitionState {
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let (incarnation_id, transition_result) =
|
||||
transition_object(api.clone(), &task.obj_info, LcAuditEvent::new(task.event.clone(), task.src.clone()), task.notification_bucket_incarnation)
|
||||
.await;
|
||||
if let Err(err) = transition_result
|
||||
if let Err(err) =
|
||||
transition_object(api.clone(), &task.obj_info, LcAuditEvent::new(task.event.clone(), task.src.clone()))
|
||||
.await
|
||||
{
|
||||
if let (Some(job_id), Some(result_key)) = (task.manual_job_id, task.manual_result_key.as_deref()) {
|
||||
record_manual_transition_worker_result_for_task_with_reason(
|
||||
@@ -2204,7 +2195,7 @@ impl TransitionState {
|
||||
"Lifecycle tier operation failed"
|
||||
);
|
||||
}
|
||||
emit_transition_failed_event(obj_info_for_event, incarnation_id);
|
||||
emit_transition_failed_event(obj_info_for_event);
|
||||
} else {
|
||||
if let (Some(job_id), Some(result_key)) = (task.manual_job_id, task.manual_result_key.as_deref()) {
|
||||
record_manual_transition_worker_result_for_task(
|
||||
@@ -2226,11 +2217,11 @@ impl TransitionState {
|
||||
}
|
||||
transition_state.add_lastday_stats(&task.event.storage_class, ts);
|
||||
|
||||
emit_transition_complete_event(obj_info_for_event, incarnation_id);
|
||||
emit_transition_complete_event(obj_info_for_event);
|
||||
}
|
||||
// Release the dedup claim so a later lifecycle pass can
|
||||
// re-transition this object if needed (rustfs/backlog#1268).
|
||||
transition_state.release_transition(&task.obj_info, task.notification_bucket_incarnation);
|
||||
transition_state.release_transition(&task.obj_info);
|
||||
TransitionState::add_counter(&transition_state.active_tasks, -1);
|
||||
transition_state.record_scanner_transition_state();
|
||||
}
|
||||
@@ -2835,7 +2826,7 @@ async fn replay_manual_transition_pending_tasks(
|
||||
};
|
||||
|
||||
match transition_state
|
||||
.queue_transition_task_outcome(Some(api.clone()), &object, &event, &LcEventSrc::Scanner, Some(job_id), None)
|
||||
.queue_transition_task_outcome(Some(api.clone()), &object, &event, &LcEventSrc::Scanner, Some(job_id))
|
||||
.await
|
||||
{
|
||||
TransitionEnqueueOutcome::Queued | TransitionEnqueueOutcome::AlreadyInFlight => {
|
||||
@@ -3093,7 +3084,6 @@ async fn recover_configured_tier_free_versions(
|
||||
next_object_marker: None,
|
||||
scanned_entries: 0,
|
||||
buckets_scanned: 0,
|
||||
unreadable_objects: 0,
|
||||
truncated: false,
|
||||
});
|
||||
}
|
||||
@@ -3233,7 +3223,6 @@ async fn run_tier_free_version_recovery_loop<F, Fut>(
|
||||
scanned = stats.scanned,
|
||||
scanned_entries = stats.scanned_entries,
|
||||
buckets_scanned = stats.buckets_scanned,
|
||||
unreadable_objects = stats.unreadable_objects,
|
||||
enqueued = stats.enqueued,
|
||||
failed = stats.failed,
|
||||
truncated = stats.truncated,
|
||||
@@ -4070,11 +4059,9 @@ fn transitioned_cleanup_tuple(oi: &ObjectInfo) -> Result<(&str, &str, &str), std
|
||||
Ok((&transitioned.name, &transitioned.version_id, &transitioned.tier))
|
||||
}
|
||||
|
||||
/// Queue a committed object with its storage-validated bucket identity.
|
||||
/// `None` permits the transition but withholds external notifications.
|
||||
pub async fn enqueue_transition_immediate(oi: &ObjectInfo, src: LcEventSrc, notification_bucket_incarnation: Option<Uuid>) {
|
||||
pub async fn enqueue_transition_immediate(oi: &ObjectInfo, src: LcEventSrc) {
|
||||
if let Some(lc) = runtime_sources::bucket_lifecycle_config(&oi.bucket).await {
|
||||
enqueue_transition_with_lifecycle(oi, &lc, &src, notification_bucket_incarnation).await;
|
||||
enqueue_transition_with_lifecycle(oi, &lc, &src).await;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4547,20 +4534,10 @@ pub async fn enqueue_transition_for_existing_objects_scoped(
|
||||
let deadline = options.max_duration.map(|duration| tokio::time::Instant::now() + duration);
|
||||
|
||||
loop {
|
||||
let (page, bucket_incarnation_id) = {
|
||||
// Lock order: lifecycle read -> metadata transaction -> listing locks.
|
||||
// Release the lifecycle fence before enqueue or progress persistence.
|
||||
let guard = api.acquire_bucket_lifecycle_read_lock(bucket).await?;
|
||||
let incarnation = api.bucket_incarnation_id_from_disk(bucket).await?;
|
||||
let page = api
|
||||
.clone()
|
||||
.list_object_versions(bucket, &options.prefix, marker.clone(), version_marker.clone(), None, LIST_PAGE_SIZE)
|
||||
.await?;
|
||||
if guard.is_lock_lost() {
|
||||
return Err(Error::other("bucket lifecycle lock was lost while listing transition candidates"));
|
||||
}
|
||||
(page, incarnation)
|
||||
};
|
||||
let page = api
|
||||
.clone()
|
||||
.list_object_versions(bucket, &options.prefix, marker.clone(), version_marker.clone(), None, LIST_PAGE_SIZE)
|
||||
.await?;
|
||||
|
||||
for (index, object) in page.objects.iter().enumerate() {
|
||||
if manual_transition_cancel_requested(&options).await {
|
||||
@@ -4582,16 +4559,7 @@ pub async fn enqueue_transition_for_existing_objects_scoped(
|
||||
return Ok(report);
|
||||
}
|
||||
report.scanned = report.scanned.saturating_add(1);
|
||||
enqueue_transition_with_lifecycle_report(
|
||||
Some(api.clone()),
|
||||
object,
|
||||
&lc,
|
||||
&src,
|
||||
&options,
|
||||
&mut report,
|
||||
Some(bucket_incarnation_id),
|
||||
)
|
||||
.await;
|
||||
enqueue_transition_with_lifecycle_report(Some(api.clone()), object, &lc, &src, &options, &mut report).await;
|
||||
if report.has_enqueue_backpressure() {
|
||||
report.next_marker.clone_from(&previous_marker);
|
||||
report.next_version_idmarker.clone_from(&previous_version_marker);
|
||||
@@ -4897,7 +4865,6 @@ async fn enqueue_transition_with_lifecycle_report(
|
||||
src: &LcEventSrc,
|
||||
options: &ManualTransitionRunOptions,
|
||||
report: &mut ManualTransitionRunReport,
|
||||
notification_bucket_incarnation: Option<Uuid>,
|
||||
) -> bool {
|
||||
if oi.transitioned_object.status == TRANSITION_COMPLETE {
|
||||
if options
|
||||
@@ -4950,7 +4917,7 @@ async fn enqueue_transition_with_lifecycle_report(
|
||||
return true;
|
||||
}
|
||||
let outcome = runtime_sources::transition_state_handle()
|
||||
.queue_transition_task_outcome(api.clone(), oi, &event, src, options.job_id, notification_bucket_incarnation)
|
||||
.queue_transition_task_outcome(api.clone(), oi, &event, src, options.job_id)
|
||||
.await;
|
||||
report.record_enqueue_outcome(outcome);
|
||||
return outcome.is_handled();
|
||||
@@ -4960,12 +4927,7 @@ async fn enqueue_transition_with_lifecycle_report(
|
||||
false
|
||||
}
|
||||
|
||||
async fn enqueue_transition_with_lifecycle(
|
||||
oi: &ObjectInfo,
|
||||
lc: &PersistedLifecycleConfiguration,
|
||||
src: &LcEventSrc,
|
||||
notification_bucket_incarnation: Option<Uuid>,
|
||||
) -> bool {
|
||||
async fn enqueue_transition_with_lifecycle(oi: &ObjectInfo, lc: &PersistedLifecycleConfiguration, src: &LcEventSrc) -> bool {
|
||||
let event = lc.eval(&oi.to_lifecycle_opts()).await;
|
||||
match event.action {
|
||||
IlmAction::TransitionAction | IlmAction::TransitionVersionAction => {
|
||||
@@ -4976,9 +4938,8 @@ async fn enqueue_transition_with_lifecycle(
|
||||
return false;
|
||||
}
|
||||
runtime_sources::transition_state_handle()
|
||||
.queue_transition_task_outcome(None, oi, &event, src, None, notification_bucket_incarnation)
|
||||
.queue_transition_task(oi, &event, src)
|
||||
.await
|
||||
.is_handled()
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
@@ -5160,7 +5121,7 @@ async fn expire_transitioned_object_with_lock_lost_signal(
|
||||
}
|
||||
};
|
||||
|
||||
schedule_lifecycle_replication_delete_if_needed(oi, &dobj, bucket_incarnation_id).await;
|
||||
schedule_lifecycle_replication_delete_if_needed(oi, &dobj).await;
|
||||
|
||||
// The transitioned version is gone; evict any cached body for this object
|
||||
// so it does not linger until TTL (ODC-26).
|
||||
@@ -5173,7 +5134,7 @@ async fn expire_transitioned_object_with_lock_lost_signal(
|
||||
|
||||
//audit_log_lifecycle(oi, ILMExpiry, tags);
|
||||
|
||||
emit_transitioned_expiration_event(oi, &dobj, bucket_incarnation_id);
|
||||
emit_transitioned_expiration_event(oi, &dobj);
|
||||
|
||||
Ok(dobj)
|
||||
}
|
||||
@@ -5191,22 +5152,12 @@ pub fn gen_transition_objname(bucket: &str) -> Result<String, Error> {
|
||||
Ok(obj)
|
||||
}
|
||||
|
||||
async fn transition_object(
|
||||
api: Arc<ECStore>,
|
||||
oi: &ObjectInfo,
|
||||
lae: LcAuditEvent,
|
||||
notification_bucket_incarnation: Option<Uuid>,
|
||||
) -> (Option<Uuid>, Result<(), Error>) {
|
||||
pub async fn transition_object(api: Arc<ECStore>, oi: &ObjectInfo, lae: LcAuditEvent) -> Result<(), Error> {
|
||||
let time_ilm = Metrics::time_ilm(lae.event.action);
|
||||
|
||||
let Some((publication_guard, bucket_incarnation_id)) =
|
||||
lifecycle_transition_publication_guard(&api, oi, notification_bucket_incarnation).await
|
||||
else {
|
||||
return (
|
||||
notification_bucket_incarnation,
|
||||
Err(Error::other("lifecycle transition is not allowed for this bucket")),
|
||||
);
|
||||
};
|
||||
let (publication_guard, bucket_incarnation_id) = lifecycle_transition_publication_guard(&api, oi)
|
||||
.await
|
||||
.ok_or_else(|| Error::other("lifecycle transition is not allowed for this bucket"))?;
|
||||
|
||||
let etag = if let Some(etag) = &oi.etag { etag } else { "" };
|
||||
let etag = etag.to_string();
|
||||
@@ -5224,13 +5175,12 @@ async fn transition_object(
|
||||
version_suspended: BucketVersioningSys::prefix_suspended(&oi.bucket, &oi.name).await,
|
||||
mod_time: oi.mod_time,
|
||||
expected_bucket_incarnation_id: Some(bucket_incarnation_id),
|
||||
notification_bucket_incarnation_id: notification_bucket_incarnation,
|
||||
..Default::default()
|
||||
};
|
||||
opts.add_namespace_lock_guard(&publication_guard);
|
||||
let result = api.transition_object(&oi.bucket, &oi.name, &opts).await;
|
||||
time_ilm(1)();
|
||||
(notification_bucket_incarnation, result)
|
||||
result
|
||||
}
|
||||
|
||||
#[allow(
|
||||
@@ -5841,22 +5791,12 @@ fn lifecycle_replication_blocks_action(oi: &ObjectInfo) -> bool {
|
||||
}
|
||||
|
||||
pub async fn apply_transition_rule(event: &lifecycle::Event, src: &LcEventSrc, oi: &ObjectInfo) -> bool {
|
||||
apply_transition_rule_with_incarnation(event, src, oi, None).await
|
||||
}
|
||||
|
||||
pub async fn apply_transition_rule_with_incarnation(
|
||||
event: &lifecycle::Event,
|
||||
src: &LcEventSrc,
|
||||
oi: &ObjectInfo,
|
||||
notification_bucket_incarnation: Option<Uuid>,
|
||||
) -> bool {
|
||||
if oi.delete_marker || oi.is_dir {
|
||||
return false;
|
||||
}
|
||||
runtime_sources::transition_state_handle()
|
||||
.queue_transition_task_outcome(None, oi, event, src, None, notification_bucket_incarnation)
|
||||
.queue_transition_task(oi, event, src)
|
||||
.await
|
||||
.is_handled()
|
||||
}
|
||||
|
||||
async fn acquire_lifecycle_publication_guard(api: &ECStore, bucket: &str) -> Result<rustfs_lock::NamespaceLockGuard, Error> {
|
||||
@@ -5905,14 +5845,10 @@ pub(crate) async fn lifecycle_expiry_publication_guard(
|
||||
async fn lifecycle_transition_publication_guard(
|
||||
api: &ECStore,
|
||||
oi: &ObjectInfo,
|
||||
expected_incarnation: Option<Uuid>,
|
||||
) -> Option<(rustfs_lock::NamespaceLockGuard, Uuid)> {
|
||||
let result: std::result::Result<(rustfs_lock::NamespaceLockGuard, Uuid), Error> = async {
|
||||
let guard = acquire_lifecycle_publication_guard(api, &oi.bucket).await?;
|
||||
let configs = metadata_boundary::get_expiry_configs(api, &oi.bucket).await?;
|
||||
if expected_incarnation.is_some_and(|expected| expected != configs.bucket_incarnation_id) {
|
||||
return Err(Error::PreconditionFailed);
|
||||
}
|
||||
Ok((guard, configs.bucket_incarnation_id))
|
||||
}
|
||||
.await;
|
||||
@@ -6098,7 +6034,7 @@ async fn apply_expiry_on_non_transitioned_objects_with_lock_lost_signal(
|
||||
{
|
||||
accounting.commit(size).await;
|
||||
}
|
||||
schedule_lifecycle_replication_delete_if_needed(oi, &dobj, bucket_incarnation_id).await;
|
||||
schedule_lifecycle_replication_delete_if_needed(oi, &dobj).await;
|
||||
|
||||
// The object (or all its versions, for delete_all) was expired; evict any
|
||||
// cached body so dead bytes do not sit resident until TTL (ODC-26). The
|
||||
@@ -6114,7 +6050,7 @@ async fn apply_expiry_on_non_transitioned_objects_with_lock_lost_signal(
|
||||
//let tags = LcAuditEvent::new(lc_event.clone(), src.clone()).tags();
|
||||
//tags["version-id"] = dobj.version_id;
|
||||
|
||||
emit_non_transitioned_expiration_event(lc_event.action, oi, dobj, bucket_incarnation_id);
|
||||
emit_non_transitioned_expiration_event(lc_event.action, oi, dobj);
|
||||
|
||||
if lc_event.action != IlmAction::NoneAction {
|
||||
let mut num_versions = 1_u64;
|
||||
@@ -6266,12 +6202,12 @@ fn lifecycle_deleted_object(oi: &ObjectInfo, dobj: &ObjectInfo) -> DeletedObject
|
||||
}
|
||||
}
|
||||
|
||||
async fn schedule_lifecycle_replication_delete_if_needed(oi: &ObjectInfo, dobj: &ObjectInfo, bucket_incarnation_id: Uuid) {
|
||||
async fn schedule_lifecycle_replication_delete_if_needed(oi: &ObjectInfo, dobj: &ObjectInfo) {
|
||||
let delete_object = lifecycle_deleted_object(oi, dobj);
|
||||
if delete_object.replication_state.is_none() {
|
||||
return;
|
||||
}
|
||||
replication_sink::schedule_delete(oi.bucket.clone(), delete_object, Some(bucket_incarnation_id)).await;
|
||||
replication_sink::schedule_delete(oi.bucket.clone(), delete_object).await;
|
||||
}
|
||||
|
||||
async fn lifecycle_delete_config_snapshot(api: &ECStore, oi: &ObjectInfo) -> Result<DeleteReplicationConfigSnapshot, Error> {
|
||||
@@ -6661,7 +6597,6 @@ mod tests {
|
||||
next_object_marker: truncated.then(|| "object".to_string()),
|
||||
scanned_entries: 1,
|
||||
buckets_scanned: 1,
|
||||
unreadable_objects: 0,
|
||||
truncated,
|
||||
}
|
||||
}
|
||||
@@ -9179,160 +9114,6 @@ mod tests {
|
||||
assert!(recovery_notify.notified().now_or_never().is_some());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn transition_dedup_keeps_recreated_bucket_admissions_independent() {
|
||||
let state = TransitionState::new_with_capacity(2);
|
||||
let object = ObjectInfo {
|
||||
bucket: "bucket".to_string(),
|
||||
name: "same-key".to_string(),
|
||||
..Default::default()
|
||||
};
|
||||
let first = Uuid::new_v4();
|
||||
let second = Uuid::new_v4();
|
||||
let event = lifecycle::Event {
|
||||
action: IlmAction::TransitionAction,
|
||||
..Default::default()
|
||||
};
|
||||
for identity in [first, second] {
|
||||
assert_eq!(
|
||||
state
|
||||
.queue_transition_task_outcome(None, &object, &event, &LcEventSrc::Scanner, None, Some(identity))
|
||||
.await,
|
||||
TransitionEnqueueOutcome::Queued
|
||||
);
|
||||
}
|
||||
state.release_transition(&object, Some(first));
|
||||
assert!(
|
||||
!state.reserve_transition(&object, Some(second)),
|
||||
"finishing the old incarnation must retain the new claim"
|
||||
);
|
||||
assert!(state.reserve_transition(&object, Some(first)), "only the old claim was released");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[serial]
|
||||
async fn queued_transition_notifications_keep_the_admitted_bucket_incarnation() {
|
||||
use super::metadata_boundary::{init_bucket_metadata_sys, test_support::isolated_store_over_temp_disks};
|
||||
use crate::services::event_notification::test_recorder;
|
||||
let (_dirs, store) = isolated_store_over_temp_disks().await;
|
||||
init_bucket_metadata_sys(store.clone(), Vec::new()).await;
|
||||
let bucket = "queued-transition-notification-origin";
|
||||
store
|
||||
.make_bucket(bucket, &MakeBucketOptions::default())
|
||||
.await
|
||||
.expect("create original bucket");
|
||||
let original = store.bucket_incarnation_id(bucket).await.expect("original identity");
|
||||
let state = TransitionState::new_with_capacity(2);
|
||||
let event = lifecycle::Event {
|
||||
action: IlmAction::TransitionVersionAction,
|
||||
storage_class: "missing-tier".to_string(),
|
||||
..Default::default()
|
||||
};
|
||||
for (name, identity) in [("known-old", Some(original)), ("unknown-replay", None)] {
|
||||
let object = ObjectInfo {
|
||||
bucket: bucket.to_string(),
|
||||
name: name.to_string(),
|
||||
version_id: Some(Uuid::new_v4()),
|
||||
..Default::default()
|
||||
};
|
||||
assert_eq!(
|
||||
state
|
||||
.queue_transition_task_outcome(None, &object, &event, &LcEventSrc::Scanner, None, identity)
|
||||
.await,
|
||||
TransitionEnqueueOutcome::Queued
|
||||
);
|
||||
}
|
||||
store
|
||||
.delete_bucket(bucket, &DeleteBucketOptions::default())
|
||||
.await
|
||||
.expect("delete original bucket");
|
||||
store
|
||||
.make_bucket(bucket, &MakeBucketOptions::default())
|
||||
.await
|
||||
.expect("recreate bucket");
|
||||
let replacement = store.bucket_incarnation_id(bucket).await.expect("replacement identity");
|
||||
assert_ne!(original, replacement);
|
||||
test_recorder::install();
|
||||
for expected in [Some(original), None] {
|
||||
let task = state
|
||||
.transition_rx
|
||||
.recv()
|
||||
.await
|
||||
.expect("receive queued transition")
|
||||
.expect("transition task");
|
||||
assert_eq!(task.notification_bucket_incarnation, expected);
|
||||
let (identity, result) = super::transition_object(
|
||||
store.clone(),
|
||||
&task.obj_info,
|
||||
super::LcAuditEvent::new(task.event, task.src),
|
||||
task.notification_bucket_incarnation,
|
||||
)
|
||||
.await;
|
||||
assert!(result.is_err(), "the old version cannot transition in the replacement");
|
||||
assert_eq!(identity, expected);
|
||||
super::emit_transition_failed_event(task.obj_info, identity);
|
||||
}
|
||||
let events = test_recorder::recorded_for_bucket(bucket);
|
||||
assert_eq!(events.len(), 2);
|
||||
assert_eq!(events[0].bucket_incarnation_id, Some(original));
|
||||
assert_eq!(events[1].bucket_incarnation_id, None);
|
||||
assert!(events.iter().all(|event| event.bucket_incarnation_id != Some(replacement)));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[serial]
|
||||
async fn successful_recovered_transition_keeps_unknown_notification_origin_unbound() {
|
||||
use super::metadata_boundary::{init_bucket_metadata_sys, test_support::isolated_store_over_temp_disks};
|
||||
use crate::services::event_notification::test_recorder;
|
||||
use crate::services::tier::test_util::register_mock_tier;
|
||||
use rustfs_s3_types::EventName;
|
||||
|
||||
let (_dirs, store) = isolated_store_over_temp_disks().await;
|
||||
init_bucket_metadata_sys(store.clone(), Vec::new()).await;
|
||||
let bucket = format!("recovered-notify-{}", &Uuid::new_v4().simple().to_string()[..12]);
|
||||
let object = "object";
|
||||
store
|
||||
.make_bucket(&bucket, &MakeBucketOptions::default())
|
||||
.await
|
||||
.expect("create transition bucket");
|
||||
let mut reader = PutObjReader::from_vec(b"transition payload".to_vec());
|
||||
store
|
||||
.put_object(&bucket, object, &mut reader, &ObjectOptions::default())
|
||||
.await
|
||||
.expect("seed transition object");
|
||||
let object_info = store
|
||||
.get_object_info(&bucket, object, &ObjectOptions::default())
|
||||
.await
|
||||
.expect("read transition object");
|
||||
let tier = format!("COLDTIER{}", &Uuid::new_v4().simple().to_string()[..8]).to_uppercase();
|
||||
register_mock_tier(&store.tier_config_mgr(), &tier).await;
|
||||
test_recorder::install();
|
||||
|
||||
let (origin, result) = super::transition_object(
|
||||
store,
|
||||
&object_info,
|
||||
super::LcAuditEvent::new(
|
||||
lifecycle::Event {
|
||||
action: IlmAction::TransitionAction,
|
||||
storage_class: tier,
|
||||
..Default::default()
|
||||
},
|
||||
LcEventSrc::Scanner,
|
||||
),
|
||||
None,
|
||||
)
|
||||
.await;
|
||||
assert!(result.is_ok(), "recovered transition should complete: {result:?}");
|
||||
assert_eq!(origin, None);
|
||||
|
||||
let events = test_recorder::recorded_for_bucket(&bucket);
|
||||
let transition = events
|
||||
.iter()
|
||||
.find(|event| event.event_name == EventName::LifecycleTransition.as_str())
|
||||
.expect("successful transition should emit its native lifecycle event");
|
||||
assert_eq!(transition.bucket_incarnation_id, None);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[serial]
|
||||
async fn scanner_transition_enqueue_reports_full_queue() {
|
||||
@@ -9400,7 +9181,7 @@ mod tests {
|
||||
.await
|
||||
.expect("queue should remain open")
|
||||
.expect("first queued transition task should be present");
|
||||
state.release_transition(&first_task.obj_info, first_task.notification_bucket_incarnation);
|
||||
state.release_transition(&first_task.obj_info);
|
||||
|
||||
assert!(
|
||||
deferred.await,
|
||||
@@ -10159,8 +9940,8 @@ mod tests {
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
assert!(state.reserve_transition(&oi, None), "first claim must succeed");
|
||||
assert!(!state.reserve_transition(&oi, None), "duplicate claim must be rejected");
|
||||
assert!(state.reserve_transition(&oi), "first claim must succeed");
|
||||
assert!(!state.reserve_transition(&oi), "duplicate claim must be rejected");
|
||||
|
||||
// A different object is independent.
|
||||
let other = ObjectInfo {
|
||||
@@ -10169,11 +9950,11 @@ mod tests {
|
||||
version_id: None,
|
||||
..Default::default()
|
||||
};
|
||||
assert!(state.reserve_transition(&other, None), "distinct object must claim independently");
|
||||
assert!(state.reserve_transition(&other), "distinct object must claim independently");
|
||||
|
||||
// After release, the same object can be re-claimed (later lifecycle pass).
|
||||
state.release_transition(&oi, None);
|
||||
assert!(state.reserve_transition(&oi, None), "re-claim after release must succeed");
|
||||
state.release_transition(&oi);
|
||||
assert!(state.reserve_transition(&oi), "re-claim after release must succeed");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -10215,10 +9996,10 @@ mod tests {
|
||||
};
|
||||
|
||||
let first = state
|
||||
.queue_transition_task_outcome(None, &object, &event, &LcEventSrc::Scanner, None, None)
|
||||
.queue_transition_task_outcome(None, &object, &event, &LcEventSrc::Scanner, None)
|
||||
.await;
|
||||
let second = state
|
||||
.queue_transition_task_outcome(None, &object, &event, &LcEventSrc::Scanner, None, None)
|
||||
.queue_transition_task_outcome(None, &object, &event, &LcEventSrc::Scanner, None)
|
||||
.await;
|
||||
|
||||
assert_eq!(first, TransitionEnqueueOutcome::Queued);
|
||||
@@ -10246,10 +10027,10 @@ mod tests {
|
||||
};
|
||||
|
||||
let first = state
|
||||
.queue_transition_task_outcome(None, &first_object, &event, &LcEventSrc::Scanner, None, None)
|
||||
.queue_transition_task_outcome(None, &first_object, &event, &LcEventSrc::Scanner, None)
|
||||
.await;
|
||||
let second = state
|
||||
.queue_transition_task_outcome(None, &second_object, &event, &LcEventSrc::Scanner, None, None)
|
||||
.queue_transition_task_outcome(None, &second_object, &event, &LcEventSrc::Scanner, None)
|
||||
.await;
|
||||
|
||||
assert_eq!(first, TransitionEnqueueOutcome::Queued);
|
||||
@@ -10282,7 +10063,7 @@ mod tests {
|
||||
let task_key = manual_transition_worker_result_task_key(&object.bucket, &object.name, object.version_id);
|
||||
|
||||
let outcome = state
|
||||
.queue_transition_task_outcome(Some(ecstore.clone()), &object, &event, &LcEventSrc::Scanner, Some(job_id), None)
|
||||
.queue_transition_task_outcome(Some(ecstore.clone()), &object, &event, &LcEventSrc::Scanner, Some(job_id))
|
||||
.await;
|
||||
|
||||
assert_eq!(outcome, TransitionEnqueueOutcome::Queued);
|
||||
@@ -10319,14 +10100,14 @@ mod tests {
|
||||
};
|
||||
|
||||
let failed = state
|
||||
.queue_transition_task_outcome(Some(ecstore.clone()), &object, &event, &LcEventSrc::Scanner, Some(Uuid::nil()), None)
|
||||
.queue_transition_task_outcome(Some(ecstore.clone()), &object, &event, &LcEventSrc::Scanner, Some(Uuid::nil()))
|
||||
.await;
|
||||
|
||||
assert_eq!(failed, TransitionEnqueueOutcome::TaskJournalFailed);
|
||||
assert_eq!(state.transition_rx.len(), 0);
|
||||
|
||||
let retried = state
|
||||
.queue_transition_task_outcome(Some(ecstore), &object, &event, &LcEventSrc::Scanner, Some(Uuid::new_v4()), None)
|
||||
.queue_transition_task_outcome(Some(ecstore), &object, &event, &LcEventSrc::Scanner, Some(Uuid::new_v4()))
|
||||
.await;
|
||||
assert_eq!(retried, TransitionEnqueueOutcome::Queued);
|
||||
assert_eq!(state.transition_rx.len(), 1);
|
||||
@@ -10827,7 +10608,7 @@ mod tests {
|
||||
let lc = latest_transition_lifecycle();
|
||||
let object = current_object(ReplicationStatusType::Pending);
|
||||
|
||||
let queued = enqueue_transition_with_lifecycle(&object, &lc, &LcEventSrc::Scanner, None).await;
|
||||
let queued = enqueue_transition_with_lifecycle(&object, &lc, &LcEventSrc::Scanner).await;
|
||||
|
||||
assert!(!queued);
|
||||
}
|
||||
@@ -10843,7 +10624,7 @@ mod tests {
|
||||
let mut report = ManualTransitionRunReport::new(&object.bucket, &options);
|
||||
|
||||
let handled =
|
||||
enqueue_transition_with_lifecycle_report(None, &object, &lc, &LcEventSrc::Scanner, &options, &mut report, None).await;
|
||||
enqueue_transition_with_lifecycle_report(None, &object, &lc, &LcEventSrc::Scanner, &options, &mut report).await;
|
||||
|
||||
assert!(handled);
|
||||
assert_eq!(report.eligible, 1);
|
||||
@@ -10865,7 +10646,7 @@ mod tests {
|
||||
let mut report = ManualTransitionRunReport::new(&object.bucket, &options);
|
||||
|
||||
let handled =
|
||||
enqueue_transition_with_lifecycle_report(None, &object, &lc, &LcEventSrc::Scanner, &options, &mut report, None).await;
|
||||
enqueue_transition_with_lifecycle_report(None, &object, &lc, &LcEventSrc::Scanner, &options, &mut report).await;
|
||||
|
||||
assert!(!handled);
|
||||
assert_eq!(report.eligible, 0);
|
||||
@@ -10884,7 +10665,7 @@ mod tests {
|
||||
let mut report = ManualTransitionRunReport::new(&object.bucket, &options);
|
||||
|
||||
let handled =
|
||||
enqueue_transition_with_lifecycle_report(None, &object, &lc, &LcEventSrc::Scanner, &options, &mut report, None).await;
|
||||
enqueue_transition_with_lifecycle_report(None, &object, &lc, &LcEventSrc::Scanner, &options, &mut report).await;
|
||||
|
||||
assert!(!handled);
|
||||
assert_eq!(report.eligible, 0);
|
||||
@@ -10899,7 +10680,7 @@ mod tests {
|
||||
let mut report = ManualTransitionRunReport::new(&object.bucket, &options);
|
||||
|
||||
let handled =
|
||||
enqueue_transition_with_lifecycle_report(None, &object, &lc, &LcEventSrc::Scanner, &options, &mut report, None).await;
|
||||
enqueue_transition_with_lifecycle_report(None, &object, &lc, &LcEventSrc::Scanner, &options, &mut report).await;
|
||||
|
||||
assert!(!handled);
|
||||
assert_eq!(report.eligible, 0);
|
||||
@@ -11012,7 +10793,7 @@ mod tests {
|
||||
let mut report = ManualTransitionRunReport::new(&object.bucket, &options);
|
||||
|
||||
let handled =
|
||||
enqueue_transition_with_lifecycle_report(None, &object, &lc, &LcEventSrc::Scanner, &options, &mut report, None).await;
|
||||
enqueue_transition_with_lifecycle_report(None, &object, &lc, &LcEventSrc::Scanner, &options, &mut report).await;
|
||||
|
||||
assert!(!handled);
|
||||
assert_eq!(report.eligible, 0);
|
||||
@@ -14357,7 +14138,7 @@ mod tests {
|
||||
let admission_store = ecstore.clone();
|
||||
let admission_object = object_info.clone();
|
||||
let mut admission =
|
||||
tokio::spawn(async move { lifecycle_transition_publication_guard(&admission_store, &admission_object, None).await });
|
||||
tokio::spawn(async move { lifecycle_transition_publication_guard(&admission_store, &admission_object).await });
|
||||
assert!(
|
||||
tokio::time::timeout(StdDuration::from_millis(100), &mut admission)
|
||||
.await
|
||||
@@ -15176,37 +14957,6 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
async fn seed_corrupt_free_version(disk_paths: &[PathBuf], bucket: &str, object: &str) -> Vec<u8> {
|
||||
use rustfs_utils::http::metadata_compat::{SUFFIX_TRANSITIONED_VERSION_STATE, insert_bytes};
|
||||
|
||||
seed_recoverable_free_version(disk_paths, bucket, object, None, None).await;
|
||||
let path = PathBuf::from(bucket).join(object).join(STORAGE_FORMAT_FILE);
|
||||
let original = fs::read(disk_paths[0].join(&path))
|
||||
.await
|
||||
.expect("read the seeded free version");
|
||||
let mut metadata = FileMeta::load(&original).expect("load the seeded metadata");
|
||||
let mut version = metadata.versions[0].parse_version_meta().expect("decode the seeded version");
|
||||
let marker = version.delete_marker.as_mut().expect("the free version is a delete marker");
|
||||
insert_bytes(&mut marker.meta_sys, SUFFIX_TRANSITIONED_VERSION_STATE, b"invalid".to_vec());
|
||||
metadata.versions[0] = version
|
||||
.try_into()
|
||||
.expect("encode the malformed marker with a consistent header");
|
||||
let encoded = metadata.marshal_msg().expect("encode the metadata with a valid checksum");
|
||||
let reloaded = FileMeta::load(&encoded).expect("the metadata envelope must remain readable");
|
||||
assert_eq!(
|
||||
reloaded
|
||||
.get_file_info_versions(bucket, object, false)
|
||||
.expect_err("decoding the marker must fail"),
|
||||
rustfs_filemeta::Error::FileCorrupt
|
||||
);
|
||||
for disk in disk_paths {
|
||||
fs::write(disk.join(&path), &encoded)
|
||||
.await
|
||||
.expect("persist the same malformed marker on every disk");
|
||||
}
|
||||
encoded
|
||||
}
|
||||
|
||||
async fn remove_seeded_free_version(disk_paths: &[PathBuf], bucket: &str, object: &str) {
|
||||
for disk_path in disk_paths {
|
||||
fs::remove_dir_all(disk_path.join(bucket).join(object))
|
||||
@@ -15279,7 +15029,6 @@ mod tests {
|
||||
next_object_marker: None,
|
||||
scanned_entries: 0,
|
||||
buckets_scanned: 0,
|
||||
unreadable_objects: 0,
|
||||
truncated: false,
|
||||
}
|
||||
);
|
||||
@@ -15476,14 +15225,12 @@ mod tests {
|
||||
);
|
||||
assert_eq!(check.reasons.len(), 1);
|
||||
assert_eq!(check.reasons[0].kind, crate::services::tier::tier::TierDeletionReasonKind::CleanupPending);
|
||||
seed_corrupt_free_version(&disks, &bucket, "corrupt").await;
|
||||
let report = retry_tier_free_version_cleanup(api.clone(), "WARM")
|
||||
.await
|
||||
.expect("retry should enqueue durable cleanup");
|
||||
assert_eq!(report.status, TierCleanupRetryStatus::Accepted);
|
||||
assert_eq!(report.enqueued, 1);
|
||||
assert_eq!(report.failed, 0);
|
||||
assert_eq!(report.unreadable_objects, 1);
|
||||
let rx = Arc::clone(&state.read().await.tasks_rx[0]);
|
||||
let task = rx.lock().await.try_recv().expect("cleanup was queued").expect("queue item");
|
||||
let task = task
|
||||
@@ -15503,27 +15250,21 @@ mod tests {
|
||||
let other = retry_tier_free_version_cleanup(api.clone(), "OTHER")
|
||||
.await
|
||||
.expect("other tier retry should be bounded");
|
||||
assert_eq!(other.status, TierCleanupRetryStatus::Accepted);
|
||||
assert_eq!(other.enqueued, 0, "retry must not enqueue a different tier's marker");
|
||||
assert_eq!(other.failed, 0);
|
||||
let json = serde_json::to_value(&other).expect("serialize the public retry report");
|
||||
assert_eq!(json["unreadableObjects"], 1, "unreadable keys cannot be attributed to a tier");
|
||||
assert!(rx.lock().await.try_recv().is_err());
|
||||
reset_runtime_expiry_state(&api).await;
|
||||
let failed = retry_tier_free_version_cleanup(api.clone(), "WARM")
|
||||
.await
|
||||
.expect("queue failure remains retryable");
|
||||
assert_eq!(failed.failed, 1);
|
||||
assert_eq!(failed.enqueued, 0);
|
||||
assert_eq!(failed.unreadable_objects, 1);
|
||||
assert_eq!(crate::services::tier::test_util::free_version_count(&disks[0], &bucket, "owned").await, 1);
|
||||
remove_seeded_free_version(&disks, &bucket, "corrupt").await;
|
||||
api.tier_config_mgr()
|
||||
.write()
|
||||
.await
|
||||
.remove("OTHER", true)
|
||||
.await
|
||||
.expect("remove other mock tier");
|
||||
reset_runtime_expiry_state(&api).await;
|
||||
let failed = retry_tier_free_version_cleanup(api.clone(), "WARM")
|
||||
.await
|
||||
.expect("queue failure remains retryable");
|
||||
assert_eq!(failed.failed, 1);
|
||||
assert_eq!(failed.enqueued, 0);
|
||||
assert_eq!(crate::services::tier::test_util::free_version_count(&disks[0], &bucket, "owned").await, 1);
|
||||
remove_seeded_free_version(&disks, &bucket, "owned").await;
|
||||
api.tier_config_mgr()
|
||||
.write()
|
||||
@@ -15743,121 +15484,6 @@ mod tests {
|
||||
reset_runtime_expiry_state(&ecstore).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[serial]
|
||||
async fn tier_free_version_recovery_enqueues_past_a_corrupt_free_version() {
|
||||
let (disk_paths, ecstore) = setup_test_env().await;
|
||||
let prefix = format!("zzzz-recovery-corrupt-{}", Uuid::new_v4().simple());
|
||||
let first_bucket = format!("{prefix}-a");
|
||||
let second_bucket = format!("{prefix}-b");
|
||||
for bucket in [&first_bucket, &second_bucket] {
|
||||
create_test_bucket(&ecstore, bucket).await;
|
||||
}
|
||||
let healthy = [
|
||||
(first_bucket.as_str(), "a"),
|
||||
(first_bucket.as_str(), "c"),
|
||||
(second_bucket.as_str(), "d"),
|
||||
];
|
||||
for (bucket, object) in healthy {
|
||||
seed_recoverable_free_version(&disk_paths, bucket, object, None, None).await;
|
||||
}
|
||||
let corrupt = seed_corrupt_free_version(&disk_paths, &first_bucket, "b").await;
|
||||
let state = install_unconsumed_runtime_expiry_worker(&ecstore, healthy.len()).await;
|
||||
|
||||
let stats = recover_tier_free_versions_with_cancel(
|
||||
Arc::clone(&ecstore),
|
||||
healthy.len() + 1,
|
||||
Some(first_bucket.clone()),
|
||||
None,
|
||||
CancellationToken::new(),
|
||||
)
|
||||
.await
|
||||
.expect("a corrupt free version must not discard other recovery candidates");
|
||||
assert!(!stats.truncated);
|
||||
assert_eq!(stats.enqueued, healthy.len());
|
||||
let receiver = Arc::clone(&state.read().await.tasks_rx[0]);
|
||||
let mut receiver = receiver.lock().await;
|
||||
for (bucket, object) in healthy {
|
||||
let task = receiver
|
||||
.try_recv()
|
||||
.expect("receive a healthy cleanup task")
|
||||
.expect("the queue carries a task");
|
||||
let task = task
|
||||
.as_any()
|
||||
.downcast_ref::<FreeVersionTask>()
|
||||
.expect("a free-version cleanup task");
|
||||
assert_eq!((task.0.bucket.as_str(), task.0.name.as_str()), (bucket, object));
|
||||
}
|
||||
drop(receiver);
|
||||
reset_runtime_expiry_state(&ecstore).await;
|
||||
for disk in &disk_paths {
|
||||
let stored = fs::read(disk.join(&first_bucket).join("b").join(STORAGE_FORMAT_FILE))
|
||||
.await
|
||||
.expect("discovery must preserve the unreadable marker");
|
||||
assert_eq!(stored, corrupt);
|
||||
}
|
||||
for (bucket, object) in healthy.into_iter().chain([(first_bucket.as_str(), "b")]) {
|
||||
remove_seeded_free_version(&disk_paths, bucket, object).await;
|
||||
}
|
||||
for bucket in [&first_bucket, &second_bucket] {
|
||||
ecstore
|
||||
.delete_bucket(bucket, &DeleteBucketOptions::default())
|
||||
.await
|
||||
.expect("delete the empty test bucket");
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[serial]
|
||||
async fn tier_free_version_recovery_counts_a_corrupt_boundary_once_per_sweep() {
|
||||
let (disk_paths, ecstore) = setup_test_env().await;
|
||||
let bucket = format!("zzzz-recovery-boundary-{}", Uuid::new_v4().simple());
|
||||
create_test_bucket(&ecstore, &bucket).await;
|
||||
seed_corrupt_free_version(&disk_paths, &bucket, "b").await;
|
||||
seed_recoverable_free_version(&disk_paths, &bucket, "c", None, None).await;
|
||||
let page_from = |marker| {
|
||||
list_tier_free_versions_with_budget(
|
||||
Arc::clone(&ecstore),
|
||||
2,
|
||||
Some(bucket.clone()),
|
||||
marker,
|
||||
CancellationToken::new(),
|
||||
RecoveryWorkBudget {
|
||||
max_objects: 1,
|
||||
max_buckets: 1,
|
||||
},
|
||||
)
|
||||
};
|
||||
|
||||
let first = page_from(None)
|
||||
.await
|
||||
.expect("the unreadable key should consume the first page");
|
||||
assert!(first.items.is_empty());
|
||||
assert_eq!(first.unreadable_objects, 1);
|
||||
assert!(first.truncated);
|
||||
assert_eq!(first.next_bucket_marker.as_deref(), Some(bucket.as_str()));
|
||||
assert_eq!(first.next_object_marker.as_deref(), Some("b"));
|
||||
|
||||
let second = page_from(first.next_object_marker)
|
||||
.await
|
||||
.expect("resume past the unreadable boundary");
|
||||
assert_eq!(second.unreadable_objects, 0);
|
||||
assert_eq!(second.items.len(), 1);
|
||||
assert_eq!(second.items[0].name, "c");
|
||||
|
||||
let next_sweep = page_from(None).await.expect("a later sweep must revisit the unreadable key");
|
||||
assert_eq!(next_sweep.unreadable_objects, 1);
|
||||
assert_eq!(next_sweep.next_object_marker.as_deref(), Some("b"));
|
||||
|
||||
for object in ["b", "c"] {
|
||||
remove_seeded_free_version(&disk_paths, &bucket, object).await;
|
||||
}
|
||||
ecstore
|
||||
.delete_bucket(&bucket, &DeleteBucketOptions::default())
|
||||
.await
|
||||
.expect("delete the empty test bucket");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[serial]
|
||||
async fn tier_free_version_recovery_real_enqueue_failure_retries_same_object() {
|
||||
|
||||
@@ -124,9 +124,6 @@ pub(crate) async fn get_lifecycle_config(bucket: &str) -> Result<(PersistedLifec
|
||||
metadata_sys::get_lifecycle_config(bucket).await
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) use crate::bucket::metadata_sys::{init_bucket_metadata_sys, test_support};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
@@ -128,7 +128,7 @@ pub async fn delete_object_versions(
|
||||
// order and admission; the event is derived from the committed
|
||||
// result, and a send failure never rolls back a delete that
|
||||
// already happened (backlog#2202).
|
||||
emit_noncurrent_expiration_event(bucket, target, deleted_obj, false, bucket_incarnation_id);
|
||||
emit_noncurrent_expiration_event(bucket, target, deleted_obj, false);
|
||||
}
|
||||
if !deleted_obj
|
||||
.replication_state
|
||||
@@ -137,7 +137,7 @@ pub async fn delete_object_versions(
|
||||
{
|
||||
continue;
|
||||
}
|
||||
replication_sink::schedule_delete(bucket.to_string(), deleted_obj.clone(), Some(bucket_incarnation_id)).await;
|
||||
replication_sink::schedule_delete(bucket.to_string(), deleted_obj.clone()).await;
|
||||
}
|
||||
|
||||
for (i, err) in errors.iter().enumerate() {
|
||||
|
||||
@@ -66,12 +66,8 @@ pub(crate) fn lifecycle_action_waits_for_replication(action: IlmAction) -> bool
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) async fn schedule_delete(
|
||||
bucket: String,
|
||||
delete_object: DeletedObject,
|
||||
notification_bucket_incarnation: Option<uuid::Uuid>,
|
||||
) {
|
||||
ReplicationLifecycleBridge::schedule_delete(bucket, delete_object, notification_bucket_incarnation).await;
|
||||
pub(crate) async fn schedule_delete(bucket: String, delete_object: DeletedObject) {
|
||||
ReplicationLifecycleBridge::schedule_delete(bucket, delete_object).await;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -20,9 +20,7 @@ use std::time::Duration;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
use crate::bucket::lifecycle::bucket_lifecycle_ops::{
|
||||
EVENT_LIFECYCLE_WORKER_STATE, LOG_COMPONENT_ECSTORE, LOG_SUBSYSTEM_LIFECYCLE, enqueue_recovered_free_version_with_cancel,
|
||||
};
|
||||
use crate::bucket::lifecycle::bucket_lifecycle_ops::enqueue_recovered_free_version_with_cancel;
|
||||
use crate::disk::RUSTFS_META_BUCKET;
|
||||
use crate::error::Result;
|
||||
use crate::object_api::ObjectInfo;
|
||||
@@ -30,10 +28,9 @@ use crate::services::tier::tier::{ERR_TIER_INVALID_CONFIG, TierConfigMgr};
|
||||
use crate::storage_api_contracts::namespace::NamespaceLocking as _;
|
||||
use crate::storage_api_contracts::{
|
||||
bucket::{BucketOperations, BucketOptions},
|
||||
list::StorageWalkOptions,
|
||||
list::{ListOperations as _, StorageObjectInfoOrErr, StorageWalkOptions},
|
||||
};
|
||||
use crate::store::ECStore;
|
||||
use crate::store::list_objects::TierRecoveryEntry;
|
||||
use rustfs_filemeta::FileInfo;
|
||||
use rustfs_lock::error::LockError;
|
||||
use rustfs_s3_client::admin_handler_utils::AdminError;
|
||||
@@ -48,6 +45,7 @@ const BACKGROUND_WALK_SHUTDOWN_TIMEOUT: Duration = Duration::from_secs(5);
|
||||
#[cfg(test)]
|
||||
const BACKGROUND_WALK_SHUTDOWN_TIMEOUT: Duration = Duration::from_millis(100);
|
||||
|
||||
type ObjectInfoOrErr = StorageObjectInfoOrErr<ObjectInfo, crate::error::Error>;
|
||||
type WalkOptions = StorageWalkOptions<fn(&FileInfo) -> bool>;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
@@ -145,8 +143,6 @@ pub struct TierCleanupRetryReport {
|
||||
pub scanned: usize,
|
||||
pub enqueued: usize,
|
||||
pub failed: usize,
|
||||
/// Unreadable logical objects encountered in this pass, whose tier is unknown.
|
||||
pub unreadable_objects: usize,
|
||||
pub scan_truncated: bool,
|
||||
}
|
||||
|
||||
@@ -165,7 +161,6 @@ impl TierCleanupRetryReport {
|
||||
scanned: 0,
|
||||
enqueued: 0,
|
||||
failed: 0,
|
||||
unreadable_objects: 0,
|
||||
scan_truncated: false,
|
||||
}
|
||||
}
|
||||
@@ -272,7 +267,6 @@ async fn retry_tier_free_version_cleanup_page(
|
||||
.map_err(|_| tier_cleanup_retry_error())?;
|
||||
let mut report = TierCleanupRetryReport::new(tier_name, TierCleanupRetryStatus::Accepted);
|
||||
report.scanned = page.scanned_entries;
|
||||
report.unreadable_objects = page.unreadable_objects;
|
||||
report.scan_truncated = page.truncated;
|
||||
for object in page.items {
|
||||
if cancel.is_cancelled() {
|
||||
@@ -296,7 +290,6 @@ pub struct FreeVersionRecoveryStats {
|
||||
pub next_object_marker: Option<String>,
|
||||
pub scanned_entries: usize,
|
||||
pub buckets_scanned: usize,
|
||||
pub unreadable_objects: usize,
|
||||
pub truncated: bool,
|
||||
}
|
||||
|
||||
@@ -307,7 +300,6 @@ pub struct FreeVersionRecoveryPage {
|
||||
pub next_object_marker: Option<String>,
|
||||
pub scanned_entries: usize,
|
||||
pub buckets_scanned: usize,
|
||||
pub unreadable_objects: usize,
|
||||
pub truncated: bool,
|
||||
}
|
||||
|
||||
@@ -351,7 +343,6 @@ pub(super) async fn recover_tier_free_versions_with_cancel(
|
||||
next_object_marker: page.next_object_marker,
|
||||
scanned_entries: page.scanned_entries,
|
||||
buckets_scanned: page.buckets_scanned,
|
||||
unreadable_objects: page.unreadable_objects,
|
||||
truncated: page.truncated,
|
||||
};
|
||||
|
||||
@@ -481,7 +472,6 @@ async fn list_tier_free_versions_for_tier(
|
||||
next_object_marker: None,
|
||||
scanned_entries: 0,
|
||||
buckets_scanned: 0,
|
||||
unreadable_objects: 0,
|
||||
truncated: false,
|
||||
};
|
||||
|
||||
@@ -515,7 +505,6 @@ async fn list_tier_free_versions_for_tier(
|
||||
let mut bucket_seen = bucket_marker.is_none();
|
||||
let mut truncated_after: Option<RecoveryCursor> = None;
|
||||
let mut remaining_scan_objects = work_budget.max_objects;
|
||||
let mut first_unreadable = None;
|
||||
|
||||
for bucket in buckets {
|
||||
if cancel_token.is_cancelled() {
|
||||
@@ -546,7 +535,7 @@ async fn list_tier_free_versions_for_tier(
|
||||
};
|
||||
let bucket_walk_limit = remaining_scan_objects;
|
||||
|
||||
let (tx, mut rx) = mpsc::channel::<Result<TierRecoveryEntry>>(100);
|
||||
let (tx, mut rx) = mpsc::channel::<ObjectInfoOrErr>(100);
|
||||
let cancel = cancel_token.child_token();
|
||||
let mut draining_after_truncation = false;
|
||||
let mut drain_deadline = None;
|
||||
@@ -570,7 +559,14 @@ async fn list_tier_free_versions_for_tier(
|
||||
match action {
|
||||
RecoveryWalkTestAction::SendItems(items) => {
|
||||
for item in items {
|
||||
if tx.send(Ok(TierRecoveryEntry::Version(Box::new(item)))).await.is_err() {
|
||||
if tx
|
||||
.send(ObjectInfoOrErr {
|
||||
item: Some(item),
|
||||
err: None,
|
||||
})
|
||||
.await
|
||||
.is_err()
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
@@ -578,16 +574,35 @@ async fn list_tier_free_versions_for_tier(
|
||||
}
|
||||
RecoveryWalkTestAction::SendItemsThenError(items, err) => {
|
||||
for item in items {
|
||||
if tx.send(Ok(TierRecoveryEntry::Version(Box::new(item)))).await.is_err() {
|
||||
if tx
|
||||
.send(ObjectInfoOrErr {
|
||||
item: Some(item),
|
||||
err: None,
|
||||
})
|
||||
.await
|
||||
.is_err()
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
let _ = tx.send(Err(err)).await;
|
||||
let _ = tx
|
||||
.send(ObjectInfoOrErr {
|
||||
item: None,
|
||||
err: Some(err),
|
||||
})
|
||||
.await;
|
||||
return Ok(());
|
||||
}
|
||||
RecoveryWalkTestAction::SendItemsThenHang(items, started) => {
|
||||
for item in items {
|
||||
if tx.send(Ok(TierRecoveryEntry::Version(Box::new(item)))).await.is_err() {
|
||||
if tx
|
||||
.send(ObjectInfoOrErr {
|
||||
item: Some(item),
|
||||
err: None,
|
||||
})
|
||||
.await
|
||||
.is_err()
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
@@ -599,11 +614,14 @@ async fn list_tier_free_versions_for_tier(
|
||||
let mut index = 0usize;
|
||||
loop {
|
||||
if tx
|
||||
.send(Ok(TierRecoveryEntry::Version(Box::new(ObjectInfo {
|
||||
bucket: bucket_name.clone(),
|
||||
name: format!("nonrecoverable-{index:08}"),
|
||||
..Default::default()
|
||||
}))))
|
||||
.send(ObjectInfoOrErr {
|
||||
item: Some(ObjectInfo {
|
||||
bucket: bucket_name.clone(),
|
||||
name: format!("nonrecoverable-{index:08}"),
|
||||
..Default::default()
|
||||
}),
|
||||
err: None,
|
||||
})
|
||||
.await
|
||||
.is_err()
|
||||
{
|
||||
@@ -621,7 +639,7 @@ async fn list_tier_free_versions_for_tier(
|
||||
}
|
||||
}
|
||||
|
||||
api.walk_for_tier_recovery(cancel, &bucket_name, tx, recovery_walk_options(bucket_walk_limit, object_marker))
|
||||
api.walk(cancel, &bucket_name, "", tx, recovery_walk_options(bucket_walk_limit, object_marker))
|
||||
.await
|
||||
}
|
||||
});
|
||||
@@ -651,25 +669,21 @@ async fn list_tier_free_versions_for_tier(
|
||||
},
|
||||
};
|
||||
page.scanned_entries += 1;
|
||||
let entry = match item {
|
||||
Ok(entry) => entry,
|
||||
Err(err) => {
|
||||
cancel.cancel();
|
||||
receive_error = Some(err);
|
||||
break;
|
||||
}
|
||||
};
|
||||
if let Some(err) = item.err {
|
||||
cancel.cancel();
|
||||
receive_error = Some(err);
|
||||
break;
|
||||
}
|
||||
if draining_after_truncation {
|
||||
continue;
|
||||
}
|
||||
let name = match &entry {
|
||||
TierRecoveryEntry::Version(oi) => oi.name.as_str(),
|
||||
TierRecoveryEntry::Unreadable { object } => object.as_str(),
|
||||
let Some(oi) = item.item else {
|
||||
continue;
|
||||
};
|
||||
if last_seen_object.as_deref() != Some(name) && scanned_objects >= bucket_walk_limit {
|
||||
if last_seen_object.as_deref() != Some(oi.name.as_str()) && scanned_objects >= bucket_walk_limit {
|
||||
// The disk listing limit follows S3-visible counting rules and
|
||||
// does not charge metadata containing only hidden/free versions.
|
||||
// Charge the recovery budget by key, including unreadable metadata.
|
||||
// Enforce the repair budget again at the decoded-object boundary.
|
||||
page.truncated = true;
|
||||
page.next_bucket_marker = Some(bucket.name.clone());
|
||||
page.next_object_marker = last_seen_object.clone();
|
||||
@@ -678,9 +692,9 @@ async fn list_tier_free_versions_for_tier(
|
||||
drain_deadline = Some(tokio::time::Instant::now() + BACKGROUND_WALK_SHUTDOWN_TIMEOUT);
|
||||
continue;
|
||||
}
|
||||
record_scanned_object(&mut last_seen_object, &mut scanned_objects, name);
|
||||
record_scanned_object(&mut last_seen_object, &mut scanned_objects, &oi.name);
|
||||
if let Some(cursor) = &truncated_after
|
||||
&& (cursor.bucket.as_str() != bucket.name.as_str() || cursor.object.as_str() != name)
|
||||
&& (cursor.bucket.as_str() != bucket.name.as_str() || cursor.object.as_str() != oi.name.as_str())
|
||||
{
|
||||
page.truncated = true;
|
||||
cancel.cancel();
|
||||
@@ -688,14 +702,6 @@ async fn list_tier_free_versions_for_tier(
|
||||
drain_deadline = Some(tokio::time::Instant::now() + BACKGROUND_WALK_SHUTDOWN_TIMEOUT);
|
||||
continue;
|
||||
}
|
||||
let oi = match entry {
|
||||
TierRecoveryEntry::Version(oi) => *oi,
|
||||
TierRecoveryEntry::Unreadable { object } => {
|
||||
page.unreadable_objects += 1;
|
||||
first_unreadable.get_or_insert_with(|| (bucket.name.clone(), object));
|
||||
continue;
|
||||
}
|
||||
};
|
||||
if is_recoverable_tier_free_version_for_tier(&oi, tier_name) {
|
||||
let current_cursor = RecoveryCursor {
|
||||
bucket: bucket.name.clone(),
|
||||
@@ -750,18 +756,6 @@ async fn list_tier_free_versions_for_tier(
|
||||
page.next_object_marker = None;
|
||||
}
|
||||
|
||||
if let Some((bucket, object)) = first_unreadable {
|
||||
tracing::warn!(
|
||||
event = EVENT_LIFECYCLE_WORKER_STATE,
|
||||
component = LOG_COMPONENT_ECSTORE,
|
||||
subsystem = LOG_SUBSYSTEM_LIFECYCLE,
|
||||
state = "free_version_recovery_unreadable_metadata",
|
||||
unreadable_objects = page.unreadable_objects,
|
||||
sample_bucket = ?bucket,
|
||||
sample_object = ?object,
|
||||
"Retained unreadable objects during tier free-version recovery"
|
||||
);
|
||||
}
|
||||
Ok(page)
|
||||
}
|
||||
|
||||
@@ -829,7 +823,6 @@ mod tests {
|
||||
next_object_marker: None,
|
||||
scanned_entries: 1,
|
||||
buckets_scanned: 1,
|
||||
unreadable_objects: 0,
|
||||
truncated: false,
|
||||
};
|
||||
|
||||
@@ -850,7 +843,6 @@ mod tests {
|
||||
next_object_marker: Some("object".to_string()),
|
||||
scanned_entries: 1,
|
||||
buckets_scanned: 1,
|
||||
unreadable_objects: 0,
|
||||
truncated: false,
|
||||
};
|
||||
|
||||
@@ -871,7 +863,6 @@ mod tests {
|
||||
next_object_marker: Some("object-a".to_string()),
|
||||
scanned_entries: 1,
|
||||
buckets_scanned: 1,
|
||||
unreadable_objects: 0,
|
||||
truncated: false,
|
||||
};
|
||||
let mut cursor = RetryCursor::new(stats.next_bucket_marker.clone(), stats.next_object_marker.clone());
|
||||
@@ -982,7 +973,6 @@ mod tests {
|
||||
next_object_marker: None,
|
||||
scanned_entries: DEFAULT_FREE_VERSION_RECOVERY_SCAN_LIMIT,
|
||||
buckets_scanned: 1,
|
||||
unreadable_objects: 0,
|
||||
truncated: false,
|
||||
};
|
||||
|
||||
|
||||
@@ -1891,9 +1891,7 @@ pub(crate) async fn get_quota_config_and_incarnation_from_disk_for_options_in(
|
||||
{
|
||||
if snapshot_guard.is_lock_lost()
|
||||
|| snapshot_guard.is_released()
|
||||
|| snapshot
|
||||
.validated_bucket_incarnation_for(store.id, bucket, opts.expected_bucket_incarnation_id)
|
||||
.is_none()
|
||||
|| !snapshot.is_valid_for_destructive_put(store.id, bucket, opts.expected_bucket_incarnation_id.unwrap_or_default())
|
||||
{
|
||||
return Err(Error::other("quota snapshot fence or bucket incarnation changed during the disk read"));
|
||||
}
|
||||
@@ -1950,135 +1948,6 @@ pub(crate) async fn get_cached_quota_config_and_incarnation_in(
|
||||
bucket_meta_sys.cached_quota_config_and_incarnation(bucket).await
|
||||
}
|
||||
|
||||
/// Returns whether a commit-time write path will consult bucket metadata in
|
||||
/// `reservation::begin` and therefore needs a pre-captured Object Lock / quota
|
||||
/// snapshot before acquiring the object namespace write lock.
|
||||
pub(crate) fn needs_commit_metadata_snapshot(
|
||||
ctx: &crate::runtime::instance::InstanceContext,
|
||||
bucket: &str,
|
||||
opts: &ObjectOptions,
|
||||
) -> bool {
|
||||
let base_required = opts.object_lock_config_snapshot.is_none()
|
||||
&& !is_meta_bucketname(bucket)
|
||||
&& !(opts.is_lockless_cache_write() && opts.quota_admission.is_none());
|
||||
#[cfg(test)]
|
||||
let base_required = base_required && opts.quota_admission.is_none();
|
||||
#[cfg(any(test, feature = "test-util"))]
|
||||
let base_required = base_required && ctx.bucket_metadata_sys().is_some();
|
||||
#[cfg(not(any(test, feature = "test-util")))]
|
||||
let _ = ctx;
|
||||
base_required
|
||||
}
|
||||
|
||||
/// Capture an authoritative Object Lock / quota metadata snapshot using an
|
||||
/// already-held bucket lifecycle read fence. Acquires only the bucket metadata
|
||||
/// transaction read lock (preserving `lifecycle -> transaction -> object` order
|
||||
/// without touching `new_ns_lock(bucket, bucket)`).
|
||||
pub(crate) async fn capture_object_lock_config_snapshot_under_lifecycle_fence_in(
|
||||
ctx: &crate::runtime::instance::InstanceContext,
|
||||
bucket: &str,
|
||||
lifecycle_fence: &crate::object_api::NamespaceLockFence,
|
||||
) -> Result<Arc<crate::object_api::ObjectLockConfigSnapshot>> {
|
||||
if lifecycle_fence.is_lock_lost() {
|
||||
return Err(Error::other("bucket lifecycle lock was lost before loading the Object Lock snapshot"));
|
||||
}
|
||||
let store = object_store_in(ctx).await?;
|
||||
let metadata_guard =
|
||||
acquire_bucket_metadata_transaction_read_lock_in_for_purpose(ctx, bucket, "object_lock_completion_metadata_read").await?;
|
||||
let (state, bucket_incarnation_id, config_revision) =
|
||||
get_object_lock_config_and_incarnation_from_disk_with_guard_in(ctx, bucket, Some(&metadata_guard)).await?;
|
||||
if lifecycle_fence.is_lock_lost() || metadata_guard.is_lock_lost() {
|
||||
return Err(Error::other("bucket lock was lost while loading the Object Lock snapshot"));
|
||||
}
|
||||
Ok(Arc::new(
|
||||
crate::object_api::ObjectLockConfigSnapshot::for_store_bucket_under_lifecycle_fence(
|
||||
store.id,
|
||||
bucket,
|
||||
bucket_incarnation_id,
|
||||
config_revision,
|
||||
state,
|
||||
lifecycle_fence.clone(),
|
||||
Arc::new(metadata_guard),
|
||||
),
|
||||
))
|
||||
}
|
||||
|
||||
/// Clone `opts` and attach a commit-time metadata snapshot captured strictly
|
||||
/// before acquiring the object namespace write lock. Reuses an already-held
|
||||
/// bucket lifecycle fence when present, otherwise acquires both lifecycle and
|
||||
/// metadata-transaction read locks without touching `new_ns_lock(bucket, bucket)`.
|
||||
pub(crate) async fn capture_commit_metadata_snapshot_for_options_in(
|
||||
ctx: &crate::runtime::instance::InstanceContext,
|
||||
bucket: &str,
|
||||
expected_incarnation_id: Option<Uuid>,
|
||||
opts: &ObjectOptions,
|
||||
) -> Result<ObjectOptions> {
|
||||
let mut commit_opts = opts.clone();
|
||||
let store = object_store_in(ctx).await?;
|
||||
let snapshot = if let Some(lifecycle_fence) = commit_opts.bucket_lifecycle_lock_fence.as_ref() {
|
||||
capture_object_lock_config_snapshot_under_lifecycle_fence_in(ctx, bucket, lifecycle_fence).await?
|
||||
} else {
|
||||
store.object_lock_config_snapshot_for_single_put(bucket).await?
|
||||
};
|
||||
if let Some(expected) = expected_incarnation_id {
|
||||
if snapshot
|
||||
.validated_bucket_incarnation_for(store.id, bucket, Some(expected))
|
||||
.is_none()
|
||||
{
|
||||
return Err(Error::BucketNotFound(bucket.to_string()));
|
||||
}
|
||||
} else if let Some(incarnation) = snapshot.validated_bucket_incarnation_for(store.id, bucket, None) {
|
||||
commit_opts.expected_bucket_incarnation_id = Some(incarnation);
|
||||
} else {
|
||||
return Err(Error::other("bucket generation or configuration changed before commit"));
|
||||
}
|
||||
snapshot.add_lock_fences(&mut commit_opts);
|
||||
commit_opts.object_lock_config_snapshot = Some(snapshot);
|
||||
Ok(commit_opts)
|
||||
}
|
||||
|
||||
/// Resolve the bucket's hard quota limit (if configured) and bucket incarnation
|
||||
/// for multipart staging admission. Uses the warm metadata cache on the hot path
|
||||
/// and falls back to loading bucket metadata on a cold cache; unsupported quota
|
||||
/// reservation protocols fail closed.
|
||||
pub(crate) async fn get_bucket_quota_limit_and_incarnation_in(
|
||||
ctx: &crate::runtime::instance::InstanceContext,
|
||||
bucket: &str,
|
||||
) -> Result<Option<(u64, Option<Uuid>)>> {
|
||||
#[cfg(any(test, feature = "test-util"))]
|
||||
if ctx.bucket_metadata_sys().is_none() {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
let bucket_meta_sys_lock = bucket_metadata_sys_of(ctx)?;
|
||||
let bucket_meta_sys = bucket_meta_sys_lock.read().await.clone();
|
||||
if let Some(snapshot) = bucket_meta_sys.cached_quota_config_and_incarnation(bucket).await? {
|
||||
let Some(quota) = snapshot.quota else {
|
||||
return Ok(None);
|
||||
};
|
||||
if quota.has_unsupported_reservation_protocol() {
|
||||
return Err(Error::PartMissingOrCorrupt);
|
||||
}
|
||||
return Ok(quota
|
||||
.get_quota_limit()
|
||||
.map(|limit| (limit, (!snapshot.bucket_incarnation.is_nil()).then_some(snapshot.bucket_incarnation))));
|
||||
}
|
||||
|
||||
let (bm, _) = bucket_meta_sys.get_config(bucket).await?;
|
||||
if !bm.quota_config_json.is_empty() && bm.quota_config.is_none() {
|
||||
return Err(Error::other("persisted bucket quota configuration is invalid"));
|
||||
}
|
||||
let Some(quota) = &bm.quota_config else {
|
||||
return Ok(None);
|
||||
};
|
||||
if quota.has_unsupported_reservation_protocol() {
|
||||
return Err(Error::PartMissingOrCorrupt);
|
||||
}
|
||||
Ok(quota
|
||||
.get_quota_limit()
|
||||
.map(|limit| (limit, (!bm.bucket_incarnation_id.is_nil()).then_some(bm.bucket_incarnation_id))))
|
||||
}
|
||||
|
||||
pub async fn get_replication_config(bucket: &str) -> Result<(PersistedReplicationConfiguration, OffsetDateTime)> {
|
||||
let bucket_meta_sys_lock = get_bucket_metadata_sys()?;
|
||||
let bucket_meta_sys = bucket_meta_sys_lock.read().await;
|
||||
@@ -2221,74 +2090,6 @@ pub(crate) fn bump_local_meta_mutation_gen() {
|
||||
LOCAL_META_MUTATION_GEN.fetch_add(1, std::sync::atomic::Ordering::Release);
|
||||
}
|
||||
|
||||
/// Bumps `LOCAL_META_MUTATION_GEN` for mutations in `RUSTFS_META_BUCKET` except
|
||||
/// known non-authority scanner, data-usage, and shutdown-marker paths.
|
||||
///
|
||||
/// The classifier is fail-closed: only exact 1-, 2-, or 3-segment paths naming
|
||||
/// `unclean-shutdown`, root scanner summary/usage files under `buckets/`, or
|
||||
/// per-bucket `.usage-cache.bin[.bkp]` files (with at most one optional trailing
|
||||
/// `/<uuid>` data-dir/transaction cleanup segment) skip the generation bump.
|
||||
/// All bucket authority files (`.metadata.bin`, `.bucket-incarnation`), bucket
|
||||
/// metadata directories (including names ending in `.usage-cache.bin`), and any
|
||||
/// other `.rustfs.sys` paths bump `LOCAL_META_MUTATION_GEN`.
|
||||
pub(crate) fn maybe_bump_local_meta_mutation_gen_for_path(volume: &str, path: &str) {
|
||||
if volume != crate::disk::RUSTFS_META_BUCKET {
|
||||
return;
|
||||
}
|
||||
if !is_non_authority_meta_bucket_path(path) {
|
||||
bump_local_meta_mutation_gen();
|
||||
}
|
||||
}
|
||||
|
||||
fn is_non_authority_meta_bucket_path(path: &str) -> bool {
|
||||
let trimmed = path.trim_matches('/');
|
||||
if trimmed.is_empty() {
|
||||
return false;
|
||||
}
|
||||
let normalized = match trimmed.rsplit_once('/') {
|
||||
Some((prefix, tail)) if !prefix.is_empty() && Uuid::parse_str(tail).is_ok() => prefix,
|
||||
_ => trimmed,
|
||||
};
|
||||
if normalized == crate::disk::UNCLEAN_SHUTDOWN_MARKER_PATH {
|
||||
return true;
|
||||
}
|
||||
let Some(rest) = normalized
|
||||
.strip_prefix(crate::disk::BUCKET_META_PREFIX)
|
||||
.and_then(|rest| rest.strip_prefix('/'))
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
if rest.is_empty() {
|
||||
return false;
|
||||
}
|
||||
match rest.split_once('/') {
|
||||
None => {
|
||||
let base = rest.strip_suffix(".bkp").unwrap_or(rest);
|
||||
base == crate::data_usage::DATA_USAGE_CACHE_NAME
|
||||
|| matches!(
|
||||
rest,
|
||||
".usage.v2.json"
|
||||
| ".usage.v2.json.bkp"
|
||||
| ".usage.v2.json.recovery-pending.json"
|
||||
| ".usage.observed.json"
|
||||
| ".usage.json"
|
||||
| ".usage.json.bkp"
|
||||
| ".bloomcycle.bin"
|
||||
| ".compression.json"
|
||||
| ".background-heal.json"
|
||||
)
|
||||
}
|
||||
Some((bucket, name)) => {
|
||||
!bucket.is_empty()
|
||||
&& !bucket.contains('/')
|
||||
&& bucket != "."
|
||||
&& bucket != ".."
|
||||
&& !name.contains('/')
|
||||
&& name.strip_suffix(".bkp").unwrap_or(name) == crate::data_usage::DATA_USAGE_CACHE_NAME
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn current_local_meta_mutation_gen() -> u64 {
|
||||
LOCAL_META_MUTATION_GEN.load(std::sync::atomic::Ordering::Acquire)
|
||||
}
|
||||
@@ -2334,20 +2135,6 @@ pub struct BucketMetadataSys {
|
||||
/// then the metadata map. It is only ever taken as the first of those, so
|
||||
/// it cannot invert against a path that already holds one of the others.
|
||||
lazy_load_locks: Arc<MetadataPublishLockRegistry>,
|
||||
/// Deduplicates concurrent cold-cache loads in
|
||||
/// [`Self::read_authoritative_metadata_from_disk_under_guard`] when
|
||||
/// `can_use_local_authority_cache` is true.
|
||||
///
|
||||
/// Lock order: caller's bucket lifecycle / metadata-transaction guard ->
|
||||
/// `authority_load_locks` -> disk reads. Separate from `lazy_load_locks`
|
||||
/// (which is acquired before the bucket namespace lock); holders of
|
||||
/// `authority_load_locks` never acquire `lazy_load_locks`,
|
||||
/// `metadata_publish_locks`, or `metadata_map`. If the leader errors or the
|
||||
/// generation moves during the load, queued followers serialize and retry
|
||||
/// under their own held guard.
|
||||
authority_load_locks: Arc<MetadataPublishLockRegistry>,
|
||||
#[cfg(test)]
|
||||
authority_disk_loads: Arc<std::sync::atomic::AtomicUsize>,
|
||||
#[cfg(test)]
|
||||
lazy_load_lock_probe: Arc<std::sync::atomic::AtomicBool>,
|
||||
/// Counts disk loads taken by the lazy `get_config` path, so a test can
|
||||
@@ -2382,11 +2169,6 @@ impl BucketMetadataSys {
|
||||
lazy_load_locks: Arc::new(MetadataPublishLockRegistry {
|
||||
locks: StdMutex::new(HashMap::new()),
|
||||
}),
|
||||
authority_load_locks: Arc::new(MetadataPublishLockRegistry {
|
||||
locks: StdMutex::new(HashMap::new()),
|
||||
}),
|
||||
#[cfg(test)]
|
||||
authority_disk_loads: Arc::new(std::sync::atomic::AtomicUsize::new(0)),
|
||||
#[cfg(test)]
|
||||
lazy_load_lock_probe: Arc::new(std::sync::atomic::AtomicBool::new(false)),
|
||||
#[cfg(test)]
|
||||
@@ -2471,7 +2253,6 @@ impl BucketMetadataSys {
|
||||
.await?;
|
||||
self.publish_if_unchanged(bucket, expected.as_ref(), metadata, persisted, &guard)
|
||||
.await
|
||||
.map(|_| ())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -2510,12 +2291,6 @@ impl BucketMetadataSys {
|
||||
Self::bucket_lock_in(&self.lazy_load_locks, bucket)
|
||||
}
|
||||
|
||||
/// Per-bucket gate for cold `local_authority_cache` loads. See
|
||||
/// [`Self::authority_load_locks`].
|
||||
fn authority_load_lock(&self, bucket: &str) -> Arc<Mutex<MetadataPublishLockState>> {
|
||||
Self::bucket_lock_in(&self.authority_load_locks, bucket)
|
||||
}
|
||||
|
||||
fn bucket_lock_in(registry: &Arc<MetadataPublishLockRegistry>, bucket: &str) -> Arc<Mutex<MetadataPublishLockState>> {
|
||||
let mut locks = registry.locks.lock().unwrap_or_else(|poisoned| poisoned.into_inner());
|
||||
locks.get(bucket).and_then(Weak::upgrade).unwrap_or_else(|| {
|
||||
@@ -2775,7 +2550,7 @@ impl BucketMetadataSys {
|
||||
metadata: BucketMetadata,
|
||||
persisted: bool,
|
||||
namespace_guard: &rustfs_lock::NamespaceLockGuard,
|
||||
) -> Result<bool> {
|
||||
) -> Result<()> {
|
||||
self.revoke_pending_bucket_creation(bucket).await;
|
||||
if !persisted {
|
||||
let _publish_guard = self
|
||||
@@ -2788,7 +2563,7 @@ impl BucketMetadataSys {
|
||||
_ => false,
|
||||
};
|
||||
if !unchanged {
|
||||
return Ok(false);
|
||||
return Ok(());
|
||||
}
|
||||
let removed = map.remove(bucket).is_some();
|
||||
drop(map);
|
||||
@@ -2799,7 +2574,7 @@ impl BucketMetadataSys {
|
||||
clear_bucket_overrides(bucket);
|
||||
clear_on_demand_migration(bucket);
|
||||
}
|
||||
return Ok(true);
|
||||
return Ok(());
|
||||
}
|
||||
let _publish_guard = self
|
||||
.lock_metadata_publish(bucket, namespace_guard, "refreshed bucket metadata publish")
|
||||
@@ -2812,7 +2587,7 @@ impl BucketMetadataSys {
|
||||
_ => false,
|
||||
};
|
||||
if !unchanged {
|
||||
return Ok(false);
|
||||
return Ok(());
|
||||
}
|
||||
map.insert(bucket.to_string(), Arc::clone(&metadata));
|
||||
drop(map);
|
||||
@@ -2821,7 +2596,7 @@ impl BucketMetadataSys {
|
||||
sync_bucket_target_sys(bucket, &metadata).await;
|
||||
sync_bucket_overrides(bucket, &metadata);
|
||||
sync_on_demand_migration(bucket, &metadata);
|
||||
Ok(true)
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn get(&self, bucket: &str) -> Result<Arc<BucketMetadata>> {
|
||||
@@ -3105,35 +2880,25 @@ impl BucketMetadataSys {
|
||||
namespace_guard: &rustfs_lock::NamespaceLockGuard,
|
||||
) -> Result<()> {
|
||||
self.revoke_pending_bucket_creation(bucket).await;
|
||||
let expected = self.metadata_map.read().await.get(bucket).cloned();
|
||||
if !self
|
||||
.bucket_exists(bucket, namespace_guard, "peer bucket metadata existence check")
|
||||
.await?
|
||||
{
|
||||
return Err(Error::other(PEER_METADATA_NOT_PERSISTED));
|
||||
}
|
||||
// A concurrent publication can reject the snapshot we read. Re-read
|
||||
// from storage so a newer committed config does not lose its reload to
|
||||
// an older one that happened to publish first.
|
||||
for _ in 0..3 {
|
||||
let expected = self.metadata_map.read().await.get(bucket).cloned();
|
||||
let (metadata, persisted) = await_bucket_namespace_operation(
|
||||
Some(namespace_guard),
|
||||
bucket,
|
||||
"peer bucket metadata load",
|
||||
load_bucket_metadata_parse_with_presence(self.object_store(), bucket, true),
|
||||
)
|
||||
.await?;
|
||||
if !persisted {
|
||||
return Err(Error::other(PEER_METADATA_NOT_PERSISTED));
|
||||
}
|
||||
if self
|
||||
.publish_if_unchanged(bucket, expected.as_ref(), metadata, true, namespace_guard)
|
||||
.await?
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
let (metadata, persisted) = await_bucket_namespace_operation(
|
||||
Some(namespace_guard),
|
||||
bucket,
|
||||
"peer bucket metadata load",
|
||||
load_bucket_metadata_parse_with_presence(self.object_store(), bucket, true),
|
||||
)
|
||||
.await?;
|
||||
if !persisted {
|
||||
return Err(Error::other(PEER_METADATA_NOT_PERSISTED));
|
||||
}
|
||||
Err(Error::other("bucket metadata changed repeatedly during peer reload"))
|
||||
self.publish_if_unchanged(bucket, expected.as_ref(), metadata, true, namespace_guard)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn get_config(&self, bucket: &str) -> Result<(Arc<BucketMetadata>, bool)> {
|
||||
@@ -3710,7 +3475,7 @@ impl BucketMetadataSys {
|
||||
|
||||
let store = self.object_store();
|
||||
let can_use_local_authority_cache = !store.ctx.lock_manager().is_disabled() && store.all_disks_local_and_online();
|
||||
let mut gen_before = current_local_meta_mutation_gen();
|
||||
let gen_before = current_local_meta_mutation_gen();
|
||||
let cached_authority = can_use_local_authority_cache
|
||||
.then(|| {
|
||||
self.local_authority_cache
|
||||
@@ -3734,43 +3499,6 @@ impl BucketMetadataSys {
|
||||
}
|
||||
}
|
||||
|
||||
let _load_guard = if can_use_local_authority_cache {
|
||||
let load_lock = self.authority_load_lock(bucket);
|
||||
let acquired = Box::pin(await_bucket_namespace_operation(
|
||||
Some(guard),
|
||||
bucket,
|
||||
"bucket metadata authoritative snapshot",
|
||||
async { Ok(load_lock.lock_owned().await) },
|
||||
))
|
||||
.await?;
|
||||
gen_before = current_local_meta_mutation_gen();
|
||||
let cached_after_lock = self
|
||||
.local_authority_cache
|
||||
.lock()
|
||||
.unwrap_or_else(std::sync::PoisonError::into_inner)
|
||||
.get(bucket)
|
||||
.filter(|(cached_gen, _)| *cached_gen == gen_before)
|
||||
.map(|(_, bm)| Arc::clone(bm));
|
||||
if let Some(cached) = cached_after_lock {
|
||||
await_bucket_namespace_operation(
|
||||
Some(guard),
|
||||
bucket,
|
||||
"bucket metadata authoritative snapshot",
|
||||
std::future::ready(Ok::<_, Error>(())),
|
||||
)
|
||||
.await?;
|
||||
if current_local_meta_mutation_gen() == gen_before && store.all_disks_local_and_online() {
|
||||
return Ok(BucketMetadataAuthority::Authoritative(cached));
|
||||
}
|
||||
}
|
||||
Some(acquired)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
#[cfg(test)]
|
||||
self.authority_disk_loads.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
||||
|
||||
let (bucket_info_res, metadata_res) = tokio::join!(
|
||||
Box::pin(await_bucket_namespace_operation(
|
||||
Some(guard),
|
||||
@@ -7253,165 +6981,4 @@ mod tests {
|
||||
|
||||
assert!(!should_refresh);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[serial]
|
||||
async fn concurrent_authoritative_metadata_loads_singleflight_and_survive_usage_cache_writes() {
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
const CHILD: &str = "RUSTFS_TEST_AUTHORITY_SINGLEFLIGHT_CHILD";
|
||||
const TEST: &str =
|
||||
"bucket::metadata_sys::tests::concurrent_authoritative_metadata_loads_singleflight_and_survive_usage_cache_writes";
|
||||
|
||||
if std::env::var_os(CHILD).is_none() {
|
||||
let output = std::process::Command::new(std::env::current_exe().expect("test executable"))
|
||||
.args(["--exact", TEST, "--nocapture", "--test-threads=1"])
|
||||
.env(CHILD, "1")
|
||||
.output()
|
||||
.expect("authority singleflight subprocess");
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
assert!(output.status.success(), "authority singleflight child failed: {stdout}{stderr}");
|
||||
assert!(
|
||||
stdout.contains("AUTHORITY_SINGLEFLIGHT_OK"),
|
||||
"authority singleflight child must execute all assertions: {stdout}"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
let (dirs, ecstore) = isolated_store_over_temp_disks().await;
|
||||
init_bucket_metadata_sys(ecstore.clone(), Vec::new()).await;
|
||||
let sys_lock = bucket_metadata_sys_of(&ecstore.ctx).expect("initialized bucket_metadata_sys");
|
||||
let sys = Arc::new(sys_lock.read().await.clone());
|
||||
let bucket = "authority-singleflight-bucket";
|
||||
for dir in &dirs {
|
||||
std::fs::create_dir_all(dir.path().join(bucket)).expect("bucket volume should exist");
|
||||
}
|
||||
sys.persist_new_and_set(BucketMetadata::new(bucket))
|
||||
.await
|
||||
.expect("persist committed bucket metadata and incarnation sidecar");
|
||||
sys.local_authority_cache
|
||||
.lock()
|
||||
.unwrap_or_else(std::sync::PoisonError::into_inner)
|
||||
.clear();
|
||||
sys.authority_disk_loads.store(0, Ordering::Relaxed);
|
||||
|
||||
// Hold one leader lock so all 16 waiters queue behind authority_load_lock after missing the cold cache.
|
||||
let held_load_lock = sys.authority_load_lock(bucket);
|
||||
let held_load_guard = held_load_lock.lock_owned().await;
|
||||
let gen_before_burst = current_local_meta_mutation_gen();
|
||||
|
||||
let waiters = 16;
|
||||
let mut handles = Vec::with_capacity(waiters);
|
||||
for _ in 0..waiters {
|
||||
let sys = Arc::clone(&sys);
|
||||
let store = Arc::clone(&ecstore);
|
||||
handles.push(tokio::spawn(async move {
|
||||
let guard = acquire_bucket_metadata_transaction_read_lock_in(&store.ctx, bucket)
|
||||
.await
|
||||
.expect("transaction read lock");
|
||||
match sys
|
||||
.read_authoritative_metadata_from_disk_under_guard(bucket, &guard)
|
||||
.await
|
||||
.expect("authoritative read")
|
||||
{
|
||||
BucketMetadataAuthority::Authoritative(bm) => bm,
|
||||
_ => panic!("expected Authoritative metadata"),
|
||||
}
|
||||
}));
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(30)).await;
|
||||
drop(held_load_guard);
|
||||
|
||||
let mut results = Vec::with_capacity(waiters);
|
||||
for h in handles {
|
||||
results.push(h.await.expect("waiter task joins"));
|
||||
}
|
||||
assert_eq!(
|
||||
current_local_meta_mutation_gen(),
|
||||
gen_before_burst,
|
||||
"generation must stay stable across cold singleflight burst"
|
||||
);
|
||||
assert_eq!(
|
||||
sys.authority_disk_loads.load(Ordering::Relaxed),
|
||||
1,
|
||||
"16 concurrent cold authority reads must collapse into 1 disk load"
|
||||
);
|
||||
for bm in &results[1..] {
|
||||
assert!(Arc::ptr_eq(&results[0], bm), "followers must share the leader's Arc<BucketMetadata>");
|
||||
}
|
||||
|
||||
// Verify real store config writes to non-authority .rustfs.sys paths do NOT bump LOCAL_META_MUTATION_GEN.
|
||||
let gen_before = current_local_meta_mutation_gen();
|
||||
crate::config::com::save_config(ecstore.clone(), "buckets/.usage-cache.bin", b"usage-snapshot".to_vec())
|
||||
.await
|
||||
.expect("save root usage cache");
|
||||
crate::config::com::save_config(ecstore.clone(), "buckets/.usage-cache.bin.bkp", b"usage-snapshot-bkp".to_vec())
|
||||
.await
|
||||
.expect("save root usage cache bkp");
|
||||
assert_eq!(
|
||||
current_local_meta_mutation_gen(),
|
||||
gen_before,
|
||||
"real usage-cache writes must not bump LOCAL_META_MUTATION_GEN"
|
||||
);
|
||||
|
||||
let tx_uuid = Uuid::new_v4();
|
||||
for inert_path in [
|
||||
"unclean-shutdown".to_string(),
|
||||
"buckets/.usage-cache.bin".to_string(),
|
||||
"buckets/.usage-cache.bin.bkp".to_string(),
|
||||
format!("buckets/.usage-cache.bin/{tx_uuid}"),
|
||||
format!("buckets/{bucket}/.usage-cache.bin"),
|
||||
format!("buckets/{bucket}/.usage-cache.bin.bkp"),
|
||||
format!("buckets/{bucket}/.usage-cache.bin.bkp/{tx_uuid}"),
|
||||
"buckets/.usage.v2.json".to_string(),
|
||||
"buckets/.usage.v2.json.bkp".to_string(),
|
||||
"buckets/.usage.v2.json.recovery-pending.json".to_string(),
|
||||
"buckets/.usage.observed.json".to_string(),
|
||||
"buckets/.usage.json".to_string(),
|
||||
"buckets/.usage.json.bkp".to_string(),
|
||||
"buckets/.bloomcycle.bin".to_string(),
|
||||
"buckets/.compression.json".to_string(),
|
||||
"buckets/.background-heal.json".to_string(),
|
||||
] {
|
||||
maybe_bump_local_meta_mutation_gen_for_path(crate::disk::RUSTFS_META_BUCKET, &inert_path);
|
||||
assert_eq!(
|
||||
current_local_meta_mutation_gen(),
|
||||
gen_before,
|
||||
"inert path {inert_path} must not invalidate local_authority_cache"
|
||||
);
|
||||
}
|
||||
|
||||
// Warm hit after inert writes still performs 0 additional disk loads.
|
||||
let guard = acquire_bucket_metadata_transaction_read_lock_in(&ecstore.ctx, bucket)
|
||||
.await
|
||||
.expect("transaction read lock");
|
||||
let _ = sys
|
||||
.read_authoritative_metadata_from_disk_under_guard(bucket, &guard)
|
||||
.await
|
||||
.expect("warm cached read");
|
||||
assert_eq!(sys.authority_disk_loads.load(Ordering::Relaxed), 1);
|
||||
|
||||
// Negative controls: authority paths and suffix-bearing bucket names MUST bump LOCAL_META_MUTATION_GEN.
|
||||
for authority_path in [
|
||||
format!("buckets/{bucket}/.metadata.bin"),
|
||||
format!("buckets/{bucket}/.bucket-incarnation"),
|
||||
format!("buckets/{bucket}/.metadata.bin/{tx_uuid}"),
|
||||
"buckets/tenant.usage-cache.bin".to_string(),
|
||||
format!("buckets/tenant.usage-cache.bin/{tx_uuid}"),
|
||||
format!("buckets/{bucket}"),
|
||||
"buckets".to_string(),
|
||||
"format.json".to_string(),
|
||||
] {
|
||||
let before = current_local_meta_mutation_gen();
|
||||
maybe_bump_local_meta_mutation_gen_for_path(crate::disk::RUSTFS_META_BUCKET, &authority_path);
|
||||
assert_eq!(
|
||||
current_local_meta_mutation_gen(),
|
||||
before + 1,
|
||||
"authority path {authority_path} must bump LOCAL_META_MUTATION_GEN"
|
||||
);
|
||||
}
|
||||
|
||||
println!("AUTHORITY_SINGLEFLIGHT_OK");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,16 +16,12 @@ use crate::bucket::metadata_sys::{
|
||||
ObjectLockConfigState, default_retention_from_object_lock_config, get_object_lock_config, get_object_lock_config_state,
|
||||
};
|
||||
use crate::bucket::object_lock::objectlock;
|
||||
use crate::bucket::object_lock::types::{DefaultRetention, LegalHoldStatus, ObjectRetention, RetentionMode};
|
||||
use crate::bucket::object_lock::types::{DefaultRetention, LegalHoldStatus, RetentionMode};
|
||||
use crate::error::{Error, Result, StorageError};
|
||||
use crate::object_api::{ObjectInfo, ObjectOptions};
|
||||
use rustfs_filemeta::metadata_keys;
|
||||
use rustfs_utils::http::metadata_compat::{
|
||||
SUFFIX_OBJECTLOCK_LEGALHOLD_TIMESTAMP, SUFFIX_OBJECTLOCK_RETENTION_TIMESTAMP, get_str,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use time::OffsetDateTime;
|
||||
use time::format_description::well_known::Rfc3339;
|
||||
|
||||
pub struct BucketObjectLockSys {}
|
||||
|
||||
@@ -70,42 +66,18 @@ pub fn is_retention_active(_mode: RetentionMode, retain_until_date: Option<Offse
|
||||
}
|
||||
|
||||
/// Check if retention modification is blocked for the given object.
|
||||
///
|
||||
/// A version that carries no explicit retention keys is locked by the bucket
|
||||
/// default retention, so the existing retention is resolved through
|
||||
/// `active_retention` just like the deletion gate rather than read off keys
|
||||
/// alone. A non-authoritative bucket configuration is an error, never a pass.
|
||||
///
|
||||
/// Explicit keys keep the lenient parse so `PutObjectRetention` can still
|
||||
/// repair a version whose persisted retention metadata is incomplete.
|
||||
pub fn check_retention_for_modification(
|
||||
state: &ObjectLockConfigState,
|
||||
obj_info: &ObjectInfo,
|
||||
user_defined: &std::collections::HashMap<String, String>,
|
||||
new_mode: Option<RetentionMode>,
|
||||
new_retain_until: Option<OffsetDateTime>,
|
||||
bypass_governance: bool,
|
||||
) -> Result<Option<ObjectLockBlockReason>> {
|
||||
let default_retention = default_retention_from_state(state)?;
|
||||
if obj_info.delete_marker {
|
||||
return Ok(None);
|
||||
}
|
||||
) -> Option<ObjectLockBlockReason> {
|
||||
let retention = objectlock::get_object_retention_meta(user_defined);
|
||||
|
||||
let retention = if has_persisted_retention(obj_info) {
|
||||
objectlock::get_object_retention_meta(&obj_info.user_defined)
|
||||
} else {
|
||||
let active = active_retention(default_retention.as_ref(), obj_info)?;
|
||||
ObjectRetention {
|
||||
mode: active.map(|(mode, _)| mode),
|
||||
retain_until_date: active.map(|(_, retain_until)| retain_until),
|
||||
}
|
||||
};
|
||||
|
||||
let Some(mode) = retention.mode else {
|
||||
return Ok(None);
|
||||
};
|
||||
let mode = retention.mode?;
|
||||
|
||||
if !is_retention_active(mode, retention.retain_until_date) {
|
||||
return Ok(None);
|
||||
return None;
|
||||
}
|
||||
|
||||
let existing_retain_until = retention.retain_until_date;
|
||||
@@ -123,13 +95,13 @@ pub fn check_retention_for_modification(
|
||||
// Can only extend the retention period
|
||||
RetentionMode::Compliance => {
|
||||
if mode_changed || is_shortening {
|
||||
return Ok(Some(ObjectLockBlockReason::Retention {
|
||||
return Some(ObjectLockBlockReason::Retention {
|
||||
mode,
|
||||
retain_until: existing_retain_until,
|
||||
}));
|
||||
});
|
||||
}
|
||||
// Extending retention in COMPLIANCE mode is allowed
|
||||
Ok(None)
|
||||
None
|
||||
}
|
||||
// GOVERNANCE mode: extending is always allowed, shortening requires bypass
|
||||
// This matches AWS S3 behavior where:
|
||||
@@ -137,13 +109,13 @@ pub fn check_retention_for_modification(
|
||||
// - Shortening/removing retention: requires bypass permission
|
||||
RetentionMode::Governance => {
|
||||
if (mode_changed || is_shortening) && !bypass_governance {
|
||||
return Ok(Some(ObjectLockBlockReason::Retention {
|
||||
return Some(ObjectLockBlockReason::Retention {
|
||||
mode,
|
||||
retain_until: existing_retain_until,
|
||||
}));
|
||||
});
|
||||
}
|
||||
// Extending retention or shortening with bypass is allowed
|
||||
Ok(None)
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,52 +137,28 @@ fn has_legal_hold(user_defined: &std::collections::HashMap<String, String>) -> b
|
||||
}
|
||||
|
||||
/// Whether an authorized replication write (`ObjectOptions::replication_request`)
|
||||
/// may update metadata on a locked destination version.
|
||||
/// may overwrite a locked destination version.
|
||||
///
|
||||
/// The source's lock state governs a replica, and a source-side hold release
|
||||
/// or retention change reaches this site through the replication write path.
|
||||
/// The write is admitted only when it carries the source timestamp of every
|
||||
/// category that currently locks the version, AND when an LWW-winning inbound
|
||||
/// state cannot violate WORM guarantees:
|
||||
/// - Active `COMPLIANCE` retention (explicit or bucket default) can never be
|
||||
/// cleared, downgraded, or shortened — an inbound write that wins LWW must
|
||||
/// carry `COMPLIANCE` with a retain-until date at least as late as the
|
||||
/// existing retention.
|
||||
/// - Active `LegalHold: ON` can only be updated by an LWW-winning write that
|
||||
/// explicitly carries `x-amz-object-lock-legal-hold: ON|OFF` (requiring
|
||||
/// `s3:PutObjectLegalHold` at the request boundary). Absent/empty values can
|
||||
/// never silently strip an active hold.
|
||||
/// - Active `GOVERNANCE` retention (explicit or bucket default) may be kept or
|
||||
/// extended freely, or weakened/cleared only when the serving layer
|
||||
/// authorized `s3:BypassGovernanceRetention` (`opts.object_lock_retention.bypass_governance`).
|
||||
///
|
||||
/// Stale writes whose source timestamp loses receiver-side LWW keep the
|
||||
/// existing lock state, and the set layer preserves payload bytes, `etag`,
|
||||
/// `data_dir`, and `mod_time` on all locked versions.
|
||||
/// The source's lock state governs a replica (MinIO `checkPutObjectLockAllowed`
|
||||
/// skips the existing-version check for replicas), and a source-side hold
|
||||
/// release or retention change reaches this site only through this write. The
|
||||
/// overwrite is allowed only when the write carries the source timestamp of
|
||||
/// every category that currently locks the version, so receiver-side LWW
|
||||
/// (`merge_replication_metadata_lww`) judges each of them: a category locked
|
||||
/// more recently here is kept, otherwise the source's newer state wins. A write
|
||||
/// without that timestamp carries no source decision for the category — the
|
||||
/// metadata replace would lift the lock unjudged — so it stays WORM-rejected.
|
||||
///
|
||||
/// The locking categories come from the same authoritative evaluation as the
|
||||
/// commit-time WORM gate (`check_object_lock_for_deletion_with_state`): the
|
||||
/// bucket default retention locks a version that carries no explicit
|
||||
/// retention keys, so it is judged here too rather than read off the keys.
|
||||
/// Malformed persisted lock metadata or a non-authoritative bucket
|
||||
/// configuration is an error, never a pass.
|
||||
pub fn replication_write_may_pass_worm_gate(
|
||||
state: &ObjectLockConfigState,
|
||||
obj_info: &ObjectInfo,
|
||||
opts: &ObjectOptions,
|
||||
) -> Result<bool> {
|
||||
let mut inbound = opts.user_defined.clone();
|
||||
if let Some(eval_metadata) = opts.eval_metadata.as_ref() {
|
||||
inbound.extend(eval_metadata.iter().map(|(key, value)| (key.clone(), value.clone())));
|
||||
}
|
||||
replication_write_may_pass_worm_gate_with_inbound_metadata(state, obj_info, opts, &inbound)
|
||||
}
|
||||
|
||||
/// Variant of [`replication_write_may_pass_worm_gate`] that judges an already
|
||||
/// merged inbound metadata map (for example, staged multipart metadata in
|
||||
/// `SetDisks::complete_multipart_upload` or merged PUT metadata in
|
||||
/// `SetDisks::put_object`).
|
||||
pub fn replication_write_may_pass_worm_gate_with_inbound_metadata(
|
||||
state: &ObjectLockConfigState,
|
||||
obj_info: &ObjectInfo,
|
||||
opts: &ObjectOptions,
|
||||
inbound_metadata: &std::collections::HashMap<String, String>,
|
||||
) -> Result<bool> {
|
||||
if !opts.replication_request {
|
||||
return Ok(false);
|
||||
@@ -220,49 +168,33 @@ pub fn replication_write_may_pass_worm_gate_with_inbound_metadata(
|
||||
return Ok(true);
|
||||
}
|
||||
let default_retention = default_retention_from_state(state)?;
|
||||
|
||||
if legal_hold_locks(obj_info)? {
|
||||
let Some(inbound_timestamp) = opts.replication_legalhold_timestamp else {
|
||||
return Ok(false);
|
||||
};
|
||||
let stored_timestamp = get_str(&obj_info.user_defined, SUFFIX_OBJECTLOCK_LEGALHOLD_TIMESTAMP)
|
||||
.and_then(|value| OffsetDateTime::parse(&value, &Rfc3339).ok());
|
||||
if !stored_timestamp.is_some_and(|stored| stored > inbound_timestamp) {
|
||||
let inbound_hold = objectlock::get_object_legalhold_meta(inbound_metadata).status;
|
||||
if !matches!(inbound_hold, Some(LegalHoldStatus::On | LegalHoldStatus::Off)) {
|
||||
return Ok(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let Some((mode, retain_until)) = active_retention(default_retention.as_ref(), obj_info)? else {
|
||||
return Ok(true);
|
||||
};
|
||||
let Some(inbound_timestamp) = opts.replication_retention_timestamp else {
|
||||
if legal_hold_locks(obj_info)? && opts.replication_legalhold_timestamp.is_none() {
|
||||
return Ok(false);
|
||||
};
|
||||
// Same comparison as `merge_replication_metadata_lww`: a retention stored
|
||||
// more recently here is kept, whatever the stale write carries.
|
||||
let stored_timestamp = get_str(&obj_info.user_defined, SUFFIX_OBJECTLOCK_RETENTION_TIMESTAMP)
|
||||
.and_then(|value| OffsetDateTime::parse(&value, &Rfc3339).ok());
|
||||
if stored_timestamp.is_some_and(|stored| stored > inbound_timestamp) {
|
||||
return Ok(true);
|
||||
}
|
||||
let retention_locked = active_retention(default_retention.as_ref(), obj_info)?.is_some();
|
||||
Ok(!(retention_locked && opts.replication_retention_timestamp.is_none()))
|
||||
}
|
||||
|
||||
let inbound = objectlock::get_object_retention_meta(inbound_metadata);
|
||||
match mode {
|
||||
RetentionMode::Compliance => Ok(inbound.mode == Some(RetentionMode::Compliance)
|
||||
&& inbound.retain_until_date.is_some_and(|until| until >= retain_until)),
|
||||
RetentionMode::Governance => {
|
||||
let keeps_or_extends = inbound.mode == Some(RetentionMode::Governance)
|
||||
&& inbound.retain_until_date.is_some_and(|until| until >= retain_until);
|
||||
let bypass_governance = opts
|
||||
.object_lock_retention
|
||||
.as_ref()
|
||||
.is_some_and(|retention| retention.bypass_governance);
|
||||
Ok(keeps_or_extends || bypass_governance)
|
||||
}
|
||||
}
|
||||
/// Whether an authorized replication delete (`ObjectOptions::replication_request`)
|
||||
/// addressed to an explicit version may bypass GOVERNANCE retention on the
|
||||
/// local replica, exactly as an `x-amz-bypass-governance-retention` caller
|
||||
/// with the bypass permission would.
|
||||
///
|
||||
/// The source is authoritative for a replicated version purge (issue #6850):
|
||||
/// the same WORM deletion gate already ran there, and GOVERNANCE retention
|
||||
/// with an authorized bypass is the only lock state it can purge through.
|
||||
/// Requiring the bypass header again here makes the purge permanently
|
||||
/// undeliverable — replication senders never carry it — and the sites diverge
|
||||
/// forever. COMPLIANCE retention and legal hold stay blocking: the source
|
||||
/// gate can never purge through them, so a replication purge that meets one
|
||||
/// here is divergence or forgery and fails closed.
|
||||
///
|
||||
/// The trust judgment is the same one the write-path exemption uses:
|
||||
/// `replication_request` is only set once the receiving handler has
|
||||
/// authorized the caller for the replication action
|
||||
/// (`ReplicateDeleteAction`), never straight from request headers.
|
||||
pub fn replication_delete_may_bypass_governance(opts: &ObjectOptions) -> bool {
|
||||
opts.replication_request && opts.version_id.is_some()
|
||||
}
|
||||
|
||||
/// Check if an object is locked based on its metadata.
|
||||
@@ -380,13 +312,6 @@ fn persisted_lock_value<'a>(obj_info: &'a ObjectInfo, key: &str) -> Option<&'a S
|
||||
obj_info.user_defined.get(key).filter(|value| !value.is_empty())
|
||||
}
|
||||
|
||||
/// Whether the version carries explicit retention keys. Without them the bucket
|
||||
/// default retention governs the version (`active_retention`).
|
||||
fn has_persisted_retention(obj_info: &ObjectInfo) -> bool {
|
||||
persisted_lock_value(obj_info, metadata_keys::OBJECT_LOCK_MODE).is_some()
|
||||
|| persisted_lock_value(obj_info, metadata_keys::OBJECT_LOCK_RETAIN_UNTIL_DATE).is_some()
|
||||
}
|
||||
|
||||
/// Whether the version's persisted legal hold is ON. Any other non-empty
|
||||
/// value than ON/OFF is malformed metadata and fails closed.
|
||||
fn legal_hold_locks(obj_info: &ObjectInfo) -> Result<bool> {
|
||||
@@ -646,8 +571,7 @@ mod tests {
|
||||
}
|
||||
|
||||
/// A replication write passes the WORM gate only when it carries the
|
||||
/// source timestamp and a valid lock state for every category that
|
||||
/// currently locks the version.
|
||||
/// source timestamp of every category that currently locks the version.
|
||||
#[test]
|
||||
fn replication_write_passes_worm_gate_only_with_every_locking_category_timestamp() {
|
||||
let hold = [(metadata_keys::OBJECT_LOCK_LEGAL_HOLD, "ON")];
|
||||
@@ -664,19 +588,15 @@ mod tests {
|
||||
replication_write_may_pass_worm_gate(state, &lock_object_info(lock_metadata(entries)), opts)
|
||||
.expect("well-formed lock metadata must be judged")
|
||||
};
|
||||
let with_source_state = |opts: ObjectOptions| ObjectOptions {
|
||||
user_defined: lock_metadata(&[&[(metadata_keys::OBJECT_LOCK_LEGAL_HOLD, "OFF")], &retention]),
|
||||
..opts
|
||||
};
|
||||
|
||||
assert!(passes(&absent, &[&hold, &retention], &with_source_state(replication_opts(true, true))));
|
||||
assert!(!passes(&absent, &[&hold, &retention], &with_source_state(replication_opts(true, false))));
|
||||
assert!(!passes(&absent, &[&hold, &retention], &with_source_state(replication_opts(false, true))));
|
||||
assert!(passes(&absent, &[&hold, &retention], &replication_opts(true, true)));
|
||||
assert!(!passes(&absent, &[&hold, &retention], &replication_opts(true, false)));
|
||||
assert!(!passes(&absent, &[&hold, &retention], &replication_opts(false, true)));
|
||||
|
||||
assert!(passes(&absent, &[&hold], &with_source_state(replication_opts(true, false))));
|
||||
assert!(!passes(&absent, &[&hold], &with_source_state(replication_opts(false, true))));
|
||||
assert!(passes(&absent, &[&retention], &with_source_state(replication_opts(false, true))));
|
||||
assert!(!passes(&absent, &[&retention], &with_source_state(replication_opts(true, false))));
|
||||
assert!(passes(&absent, &[&hold], &replication_opts(true, false)));
|
||||
assert!(!passes(&absent, &[&hold], &replication_opts(false, true)));
|
||||
assert!(passes(&absent, &[&retention], &replication_opts(false, true)));
|
||||
assert!(!passes(&absent, &[&retention], &replication_opts(true, false)));
|
||||
|
||||
// Expired retention and a released hold no longer lock anything.
|
||||
assert!(passes(
|
||||
@@ -688,15 +608,17 @@ mod tests {
|
||||
// Never for a non-replication write, whatever it carries.
|
||||
let local = ObjectOptions {
|
||||
replication_request: false,
|
||||
..with_source_state(replication_opts(true, true))
|
||||
..replication_opts(true, true)
|
||||
};
|
||||
assert!(!passes(&absent, &[&hold], &local));
|
||||
}
|
||||
|
||||
/// The bucket default retention locks a version that carries no explicit
|
||||
/// retention keys (`check_object_lock_for_deletion_with_default_retention`
|
||||
/// judges it from the modification time), so the replication gate demands
|
||||
/// both the retention source timestamp and a compatible retention outcome.
|
||||
/// judges it from the modification time), so the replication bypass must
|
||||
/// demand the retention source timestamp for it too — a tagging-only
|
||||
/// replication write must not overwrite the default-protected version
|
||||
/// unjudged.
|
||||
#[test]
|
||||
fn replication_write_under_bucket_default_retention_requires_retention_timestamp() {
|
||||
for mode in [RetentionMode::Compliance, RetentionMode::Governance] {
|
||||
@@ -718,54 +640,16 @@ mod tests {
|
||||
!replication_write_may_pass_worm_gate(&state, &no_keys, &tagging_only).expect("judged"),
|
||||
"{mode}: a tagging-only replication write must not pass the default retention lock"
|
||||
);
|
||||
|
||||
let source_preserving = |opts: ObjectOptions| ObjectOptions {
|
||||
user_defined: lock_metadata(&[&[
|
||||
(metadata_keys::OBJECT_LOCK_MODE, mode.as_str()),
|
||||
(metadata_keys::OBJECT_LOCK_RETAIN_UNTIL_DATE, "2099-01-01T00:00:00Z"),
|
||||
(metadata_keys::OBJECT_LOCK_LEGAL_HOLD, "OFF"),
|
||||
]]),
|
||||
..opts
|
||||
};
|
||||
assert!(
|
||||
replication_write_may_pass_worm_gate(&state, &no_keys, &source_preserving(replication_opts(false, true)))
|
||||
.expect("judged"),
|
||||
"{mode}: preserving/extending retention passes LWW"
|
||||
);
|
||||
assert!(
|
||||
!replication_write_may_pass_worm_gate(&state, &no_keys, &replication_opts(false, true)).expect("judged"),
|
||||
"{mode}: clearing default retention without bypass must stay blocked"
|
||||
replication_write_may_pass_worm_gate(&state, &no_keys, &replication_opts(false, true)).expect("judged"),
|
||||
"{mode}: the retention source timestamp lets LWW judge the default retention"
|
||||
);
|
||||
|
||||
// With authorized bypass, only GOVERNANCE default retention may be cleared.
|
||||
let clear_with_bypass = ObjectOptions {
|
||||
object_lock_retention: Some(crate::storage_api_contracts::object::ObjectLockRetentionOptions {
|
||||
mode: None,
|
||||
retain_until: None,
|
||||
bypass_governance: true,
|
||||
}),
|
||||
..replication_opts(false, true)
|
||||
};
|
||||
assert_eq!(
|
||||
replication_write_may_pass_worm_gate(&state, &no_keys, &clear_with_bypass).expect("judged"),
|
||||
mode == RetentionMode::Governance,
|
||||
"{mode}: COMPLIANCE default retention can never be cleared even with bypass"
|
||||
);
|
||||
|
||||
// Default retention plus a legal hold: both categories need a timestamp and valid values.
|
||||
// Default retention plus a legal hold: both categories need a timestamp.
|
||||
let held = lock_object_info(lock_metadata(&[&[(metadata_keys::OBJECT_LOCK_LEGAL_HOLD, "ON")]]));
|
||||
assert!(
|
||||
!replication_write_may_pass_worm_gate(&state, &held, &source_preserving(replication_opts(false, true)))
|
||||
.expect("judged")
|
||||
);
|
||||
assert!(
|
||||
!replication_write_may_pass_worm_gate(&state, &held, &source_preserving(replication_opts(true, false)))
|
||||
.expect("judged")
|
||||
);
|
||||
assert!(
|
||||
replication_write_may_pass_worm_gate(&state, &held, &source_preserving(replication_opts(true, true)))
|
||||
.expect("judged")
|
||||
);
|
||||
assert!(!replication_write_may_pass_worm_gate(&state, &held, &replication_opts(false, true)).expect("judged"));
|
||||
assert!(!replication_write_may_pass_worm_gate(&state, &held, &replication_opts(true, false)).expect("judged"));
|
||||
assert!(replication_write_may_pass_worm_gate(&state, &held, &replication_opts(true, true)).expect("judged"));
|
||||
|
||||
// A version whose default retention has already expired (old
|
||||
// mod_time) is not locked by the default any more.
|
||||
@@ -788,141 +672,6 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn replication_write_never_weakens_active_compliance_retention() {
|
||||
let absent = ObjectLockConfigState::ConfirmedAbsent;
|
||||
let retention = |mode: &'static str, until: &'static str| {
|
||||
lock_metadata(&[&[
|
||||
(metadata_keys::OBJECT_LOCK_MODE, mode),
|
||||
(metadata_keys::OBJECT_LOCK_RETAIN_UNTIL_DATE, until),
|
||||
]])
|
||||
};
|
||||
let mut stored = retention("COMPLIANCE", "2099-01-01T00:00:00Z");
|
||||
rustfs_utils::http::insert_str(&mut stored, SUFFIX_OBJECTLOCK_RETENTION_TIMESTAMP, "2026-01-01T00:00:00Z".to_string());
|
||||
let stored = lock_object_info(stored);
|
||||
let newest = ObjectOptions {
|
||||
replication_retention_timestamp: Some(make_datetime(2098, 1, 1)),
|
||||
object_lock_retention: Some(crate::storage_api_contracts::object::ObjectLockRetentionOptions {
|
||||
mode: None,
|
||||
retain_until: None,
|
||||
bypass_governance: true,
|
||||
}),
|
||||
..replication_opts(true, true)
|
||||
};
|
||||
let passes = |opts: &ObjectOptions| replication_write_may_pass_worm_gate(&absent, &stored, opts).expect("judged");
|
||||
let inbound = |user_defined| ObjectOptions {
|
||||
user_defined,
|
||||
..newest.clone()
|
||||
};
|
||||
|
||||
assert!(!passes(&newest), "cleared COMPLIANCE must be rejected");
|
||||
assert!(!passes(&inbound(retention("", ""))), "empty-cleared COMPLIANCE must be rejected");
|
||||
assert!(
|
||||
!passes(&inbound(retention("GOVERNANCE", "2100-01-01T00:00:00Z"))),
|
||||
"downgrading COMPLIANCE to GOVERNANCE must be rejected"
|
||||
);
|
||||
assert!(
|
||||
!passes(&inbound(retention("COMPLIANCE", "2098-12-31T00:00:00Z"))),
|
||||
"shortening COMPLIANCE must be rejected"
|
||||
);
|
||||
assert!(
|
||||
passes(&inbound(retention("COMPLIANCE", "2099-01-01T00:00:00Z"))),
|
||||
"preserving COMPLIANCE should pass"
|
||||
);
|
||||
assert!(
|
||||
passes(&inbound(retention("COMPLIANCE", "2100-01-01T00:00:00Z"))),
|
||||
"extending COMPLIANCE should pass"
|
||||
);
|
||||
|
||||
// `eval_metadata` overlays `user_defined` at commit, so it is what counts.
|
||||
let overlaid = ObjectOptions {
|
||||
eval_metadata: Some(retention("COMPLIANCE", "2027-01-01T00:00:00Z")),
|
||||
..inbound(retention("COMPLIANCE", "2100-01-01T00:00:00Z"))
|
||||
};
|
||||
assert!(!passes(&overlaid), "shortening via eval_metadata must be rejected");
|
||||
|
||||
// A stale write loses LWW: the stored COMPLIANCE retention is kept.
|
||||
assert!(passes(&replication_opts(true, true)), "stale write losing LWW should pass");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn replication_write_requires_explicit_legal_hold_status_to_update_held_version() {
|
||||
let absent = ObjectLockConfigState::ConfirmedAbsent;
|
||||
let mut stored = lock_metadata(&[&[(metadata_keys::OBJECT_LOCK_LEGAL_HOLD, "ON")]]);
|
||||
rustfs_utils::http::insert_str(&mut stored, SUFFIX_OBJECTLOCK_LEGALHOLD_TIMESTAMP, "2026-01-01T00:00:00Z".to_string());
|
||||
let stored = lock_object_info(stored);
|
||||
let newest = ObjectOptions {
|
||||
replication_legalhold_timestamp: Some(make_datetime(2098, 1, 1)),
|
||||
..replication_opts(true, false)
|
||||
};
|
||||
let passes = |opts: &ObjectOptions| replication_write_may_pass_worm_gate(&absent, &stored, opts).expect("judged");
|
||||
let with_hold = |status: &str| ObjectOptions {
|
||||
user_defined: lock_metadata(&[&[(metadata_keys::OBJECT_LOCK_LEGAL_HOLD, status)]]),
|
||||
..newest.clone()
|
||||
};
|
||||
|
||||
assert!(!passes(&newest), "absent legal hold header must not strip active hold");
|
||||
assert!(!passes(&with_hold("")), "empty legal hold header must not strip active hold");
|
||||
assert!(!passes(&with_hold("INVALID")), "invalid legal hold header must not strip active hold");
|
||||
assert!(passes(&with_hold("ON")), "explicit ON should pass");
|
||||
assert!(passes(&with_hold("OFF")), "explicit OFF should pass");
|
||||
assert!(passes(&replication_opts(true, false)), "stale write losing LWW should pass");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn replication_write_requires_bypass_to_weaken_active_governance_retention() {
|
||||
let absent = ObjectLockConfigState::ConfirmedAbsent;
|
||||
let retention = |mode: &'static str, until: &'static str| {
|
||||
lock_metadata(&[&[
|
||||
(metadata_keys::OBJECT_LOCK_MODE, mode),
|
||||
(metadata_keys::OBJECT_LOCK_RETAIN_UNTIL_DATE, until),
|
||||
]])
|
||||
};
|
||||
let mut stored = retention("GOVERNANCE", "2099-01-01T00:00:00Z");
|
||||
rustfs_utils::http::insert_str(&mut stored, SUFFIX_OBJECTLOCK_RETENTION_TIMESTAMP, "2026-01-01T00:00:00Z".to_string());
|
||||
let stored = lock_object_info(stored);
|
||||
let newest = ObjectOptions {
|
||||
replication_retention_timestamp: Some(make_datetime(2098, 1, 1)),
|
||||
..replication_opts(false, true)
|
||||
};
|
||||
let passes = |opts: &ObjectOptions| replication_write_may_pass_worm_gate(&absent, &stored, opts).expect("judged");
|
||||
|
||||
// Without bypass: clearing or shortening GOVERNANCE must be rejected.
|
||||
assert!(!passes(&newest), "clearing GOVERNANCE without bypass must be rejected");
|
||||
assert!(
|
||||
!passes(&ObjectOptions {
|
||||
user_defined: retention("GOVERNANCE", "2098-12-31T00:00:00Z"),
|
||||
..newest.clone()
|
||||
}),
|
||||
"shortening GOVERNANCE without bypass must be rejected"
|
||||
);
|
||||
// Preserving/extending GOVERNANCE does not require bypass.
|
||||
assert!(
|
||||
passes(&ObjectOptions {
|
||||
user_defined: retention("GOVERNANCE", "2099-01-01T00:00:00Z"),
|
||||
..newest.clone()
|
||||
}),
|
||||
"preserving GOVERNANCE should pass without bypass"
|
||||
);
|
||||
assert!(
|
||||
passes(&ObjectOptions {
|
||||
user_defined: retention("GOVERNANCE", "2100-01-01T00:00:00Z"),
|
||||
..newest.clone()
|
||||
}),
|
||||
"extending GOVERNANCE should pass without bypass"
|
||||
);
|
||||
// With authorized bypass, clearing/shortening GOVERNANCE is allowed.
|
||||
let with_bypass = ObjectOptions {
|
||||
object_lock_retention: Some(crate::storage_api_contracts::object::ObjectLockRetentionOptions {
|
||||
mode: None,
|
||||
retain_until: None,
|
||||
bypass_governance: true,
|
||||
}),
|
||||
..newest
|
||||
};
|
||||
assert!(passes(&with_bypass), "clearing GOVERNANCE with authorized bypass should pass");
|
||||
}
|
||||
|
||||
/// The replication bypass never judges from a non-authoritative bucket
|
||||
/// state or malformed persisted lock metadata; both are errors, not a pass.
|
||||
#[test]
|
||||
@@ -948,6 +697,32 @@ mod tests {
|
||||
assert!(err.to_string().contains("modification time"));
|
||||
}
|
||||
|
||||
/// The replicated-purge GOVERNANCE bypass (#6850) applies only to an
|
||||
/// authorized replication delete addressed to an explicit version: a
|
||||
/// local delete never gets it, and a replicated delete without a version
|
||||
/// id creates a delete marker rather than purging anything.
|
||||
#[test]
|
||||
fn replication_delete_bypasses_governance_only_for_authorized_version_purges() {
|
||||
let version_purge = ObjectOptions {
|
||||
replication_request: true,
|
||||
version_id: Some("6b6ffbc0-b0d3-4a86-8f6c-fe19163b8dcd".to_string()),
|
||||
..Default::default()
|
||||
};
|
||||
assert!(replication_delete_may_bypass_governance(&version_purge));
|
||||
|
||||
let local_version_delete = ObjectOptions {
|
||||
replication_request: false,
|
||||
..version_purge.clone()
|
||||
};
|
||||
assert!(!replication_delete_may_bypass_governance(&local_version_delete));
|
||||
|
||||
let replicated_marker_creation = ObjectOptions {
|
||||
version_id: None,
|
||||
..version_purge
|
||||
};
|
||||
assert!(!replication_delete_may_bypass_governance(&replicated_marker_creation));
|
||||
}
|
||||
|
||||
/// A local PutObjectRetention / PutObjectLegalHold "clear" persists the
|
||||
/// lock keys as empty strings (the MinIO on-disk shape, see
|
||||
/// `parse_object_lock_retention`); that is "no lock", not corruption, and
|
||||
@@ -1083,33 +858,12 @@ mod tests {
|
||||
assert!(!is_retention_active(RetentionMode::Governance, Some(past_date)));
|
||||
}
|
||||
|
||||
/// Judge the explicit retention keys alone, on a bucket without default retention.
|
||||
fn check_explicit_keys_modification(
|
||||
user_defined: &std::collections::HashMap<String, String>,
|
||||
new_mode: Option<RetentionMode>,
|
||||
new_retain_until: Option<OffsetDateTime>,
|
||||
bypass_governance: bool,
|
||||
) -> Option<ObjectLockBlockReason> {
|
||||
let obj_info = ObjectInfo {
|
||||
user_defined: Arc::new(user_defined.clone()),
|
||||
..Default::default()
|
||||
};
|
||||
check_retention_for_modification(
|
||||
&ObjectLockConfigState::ConfirmedAbsent,
|
||||
&obj_info,
|
||||
new_mode,
|
||||
new_retain_until,
|
||||
bypass_governance,
|
||||
)
|
||||
.expect("explicit retention metadata should be judged")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_check_retention_for_modification_no_existing_retention() {
|
||||
// No existing retention - modification should be allowed
|
||||
let user_defined = std::collections::HashMap::new();
|
||||
let new_retain = Some(OffsetDateTime::now_utc() + time::Duration::days(30));
|
||||
assert!(check_explicit_keys_modification(&user_defined, None, new_retain, false).is_none());
|
||||
assert!(check_retention_for_modification(&user_defined, None, new_retain, false).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1127,7 +881,7 @@ mod tests {
|
||||
|
||||
// Extending by another 30 days should be allowed
|
||||
let new_retain = Some(existing_retain + time::Duration::days(30));
|
||||
assert!(check_explicit_keys_modification(&user_defined, Some(RetentionMode::Compliance), new_retain, false).is_none());
|
||||
assert!(check_retention_for_modification(&user_defined, Some(RetentionMode::Compliance), new_retain, false).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1145,7 +899,7 @@ mod tests {
|
||||
|
||||
// Shortening to 30 days should be blocked
|
||||
let new_retain = Some(OffsetDateTime::now_utc() + time::Duration::days(30));
|
||||
let result = check_explicit_keys_modification(&user_defined, Some(RetentionMode::Compliance), new_retain, false);
|
||||
let result = check_retention_for_modification(&user_defined, Some(RetentionMode::Compliance), new_retain, false);
|
||||
assert!(result.is_some());
|
||||
assert!(matches!(result, Some(ObjectLockBlockReason::Retention { .. })));
|
||||
}
|
||||
@@ -1164,7 +918,7 @@ mod tests {
|
||||
);
|
||||
|
||||
// Clearing (None) should be blocked
|
||||
let result = check_explicit_keys_modification(&user_defined, None, None, false);
|
||||
let result = check_retention_for_modification(&user_defined, None, None, false);
|
||||
assert!(result.is_some());
|
||||
}
|
||||
|
||||
@@ -1183,7 +937,7 @@ mod tests {
|
||||
|
||||
// Shortening from 30 days to 15 days without bypass should be blocked
|
||||
let new_retain = Some(OffsetDateTime::now_utc() + time::Duration::days(15));
|
||||
let result = check_explicit_keys_modification(&user_defined, Some(RetentionMode::Governance), new_retain, false);
|
||||
let result = check_retention_for_modification(&user_defined, Some(RetentionMode::Governance), new_retain, false);
|
||||
assert!(result.is_some());
|
||||
}
|
||||
|
||||
@@ -1203,7 +957,7 @@ mod tests {
|
||||
|
||||
// Extending from 30 days to 60 days without bypass should be allowed
|
||||
let new_retain = Some(OffsetDateTime::now_utc() + time::Duration::days(60));
|
||||
assert!(check_explicit_keys_modification(&user_defined, Some(RetentionMode::Governance), new_retain, false).is_none());
|
||||
assert!(check_retention_for_modification(&user_defined, Some(RetentionMode::Governance), new_retain, false).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1221,7 +975,7 @@ mod tests {
|
||||
|
||||
// Shortening from 30 days to 15 days with bypass should be allowed
|
||||
let new_retain = Some(OffsetDateTime::now_utc() + time::Duration::days(15));
|
||||
assert!(check_explicit_keys_modification(&user_defined, Some(RetentionMode::Governance), new_retain, true).is_none());
|
||||
assert!(check_retention_for_modification(&user_defined, Some(RetentionMode::Governance), new_retain, true).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1237,7 +991,7 @@ mod tests {
|
||||
);
|
||||
|
||||
let result =
|
||||
check_explicit_keys_modification(&user_defined, Some(RetentionMode::Compliance), Some(existing_retain), false);
|
||||
check_retention_for_modification(&user_defined, Some(RetentionMode::Compliance), Some(existing_retain), false);
|
||||
assert!(result.is_some());
|
||||
}
|
||||
|
||||
@@ -1254,7 +1008,7 @@ mod tests {
|
||||
);
|
||||
|
||||
assert!(
|
||||
check_explicit_keys_modification(&user_defined, Some(RetentionMode::Compliance), Some(existing_retain), true)
|
||||
check_retention_for_modification(&user_defined, Some(RetentionMode::Compliance), Some(existing_retain), true)
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
@@ -1272,129 +1026,10 @@ mod tests {
|
||||
);
|
||||
|
||||
let result =
|
||||
check_explicit_keys_modification(&user_defined, Some(RetentionMode::Governance), Some(existing_retain), true);
|
||||
check_retention_for_modification(&user_defined, Some(RetentionMode::Governance), Some(existing_retain), true);
|
||||
assert!(result.is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn modification_judges_bucket_default_compliance_retention_for_keyless_version() {
|
||||
let state = configured_object_lock_state_for_tests(RetentionMode::Compliance, 30);
|
||||
let mod_time = OffsetDateTime::now_utc();
|
||||
let default_until = mod_time + time::Duration::days(30);
|
||||
let obj_info = ObjectInfo {
|
||||
mod_time: Some(mod_time),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
for (new_mode, new_retain_until) in [
|
||||
(Some(RetentionMode::Governance), Some(default_until + time::Duration::days(30))),
|
||||
(Some(RetentionMode::Compliance), Some(mod_time + time::Duration::days(1))),
|
||||
(Some(RetentionMode::Compliance), None),
|
||||
(None, None),
|
||||
] {
|
||||
let result = check_retention_for_modification(&state, &obj_info, new_mode, new_retain_until, true);
|
||||
assert!(
|
||||
matches!(
|
||||
result,
|
||||
Ok(Some(ObjectLockBlockReason::Retention {
|
||||
mode: RetentionMode::Compliance,
|
||||
..
|
||||
}))
|
||||
),
|
||||
"{new_mode:?}/{new_retain_until:?} must stay blocked by the bucket default retention: {result:?}"
|
||||
);
|
||||
}
|
||||
|
||||
assert!(matches!(
|
||||
check_retention_for_modification(
|
||||
&state,
|
||||
&obj_info,
|
||||
Some(RetentionMode::Compliance),
|
||||
Some(default_until + time::Duration::days(30)),
|
||||
false
|
||||
),
|
||||
Ok(None)
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn modification_judges_bucket_default_retention_for_cleared_retention_keys() {
|
||||
let state = configured_object_lock_state_for_tests(RetentionMode::Compliance, 30);
|
||||
let mut user_defined = std::collections::HashMap::new();
|
||||
user_defined.insert(metadata_keys::OBJECT_LOCK_MODE.to_string(), String::new());
|
||||
user_defined.insert(metadata_keys::OBJECT_LOCK_RETAIN_UNTIL_DATE.to_string(), String::new());
|
||||
let obj_info = ObjectInfo {
|
||||
user_defined: Arc::new(user_defined),
|
||||
mod_time: Some(OffsetDateTime::now_utc()),
|
||||
..Default::default()
|
||||
};
|
||||
let new_retain = Some(OffsetDateTime::now_utc() + time::Duration::days(60));
|
||||
|
||||
let result = check_retention_for_modification(&state, &obj_info, Some(RetentionMode::Governance), new_retain, true);
|
||||
|
||||
assert!(matches!(result, Ok(Some(ObjectLockBlockReason::Retention { .. }))));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn modification_of_bucket_default_governance_retention_requires_bypass() {
|
||||
let state = configured_object_lock_state_for_tests(RetentionMode::Governance, 30);
|
||||
let obj_info = ObjectInfo {
|
||||
mod_time: Some(OffsetDateTime::now_utc()),
|
||||
..Default::default()
|
||||
};
|
||||
let new_retain = Some(OffsetDateTime::now_utc() + time::Duration::days(1));
|
||||
|
||||
assert!(matches!(
|
||||
check_retention_for_modification(&state, &obj_info, Some(RetentionMode::Governance), new_retain, false),
|
||||
Ok(Some(ObjectLockBlockReason::Retention { .. }))
|
||||
));
|
||||
assert!(matches!(
|
||||
check_retention_for_modification(&state, &obj_info, Some(RetentionMode::Governance), new_retain, true),
|
||||
Ok(None)
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn modification_allows_keyless_version_past_bucket_default_retention() {
|
||||
let state = configured_object_lock_state_for_tests(RetentionMode::Compliance, 30);
|
||||
let obj_info = ObjectInfo {
|
||||
mod_time: Some(OffsetDateTime::now_utc() - time::Duration::days(31)),
|
||||
..Default::default()
|
||||
};
|
||||
let new_retain = Some(OffsetDateTime::now_utc() + time::Duration::days(1));
|
||||
|
||||
assert!(matches!(
|
||||
check_retention_for_modification(&state, &obj_info, Some(RetentionMode::Governance), new_retain, false),
|
||||
Ok(None)
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn modification_can_repair_incomplete_persisted_retention_metadata() {
|
||||
let state = configured_object_lock_state_for_tests(RetentionMode::Compliance, 30);
|
||||
let mut user_defined = std::collections::HashMap::new();
|
||||
user_defined.insert(metadata_keys::OBJECT_LOCK_MODE.to_string(), RetentionMode::COMPLIANCE.to_string());
|
||||
let obj_info = ObjectInfo {
|
||||
user_defined: Arc::new(user_defined),
|
||||
mod_time: Some(OffsetDateTime::now_utc()),
|
||||
..Default::default()
|
||||
};
|
||||
let new_retain = Some(OffsetDateTime::now_utc() + time::Duration::days(1));
|
||||
|
||||
assert!(matches!(
|
||||
check_retention_for_modification(&state, &obj_info, Some(RetentionMode::Compliance), new_retain, false),
|
||||
Ok(None)
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn modification_with_fabricated_bucket_metadata_fails_closed() {
|
||||
let err = check_retention_for_modification(&ObjectLockConfigState::Fabricated, &ObjectInfo::default(), None, None, false)
|
||||
.expect_err("non-authoritative Object Lock metadata must block retention modification");
|
||||
|
||||
assert!(err.to_string().contains("not authoritative"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_object_locked_by_metadata_delete_marker() {
|
||||
// Delete markers are never locked
|
||||
|
||||
@@ -19,7 +19,7 @@ use super::{
|
||||
use crate::bucket::metadata_sys::{
|
||||
BucketMetadataSys, update, update_if_incarnation, update_quota_with_sys_if_incarnation_and_revision,
|
||||
};
|
||||
use crate::data_usage::{get_bucket_usage_for_statistics, get_bucket_usage_memory, reload_unknown_bucket_usage};
|
||||
use crate::data_usage::{get_bucket_usage_memory, reload_unknown_bucket_usage};
|
||||
use crate::error::StorageError;
|
||||
use rustfs_config::QUOTA_CONFIG_FILE;
|
||||
use rustfs_scanner_metrics::metrics::Metric;
|
||||
@@ -96,7 +96,7 @@ impl QuotaChecker {
|
||||
// reported as absent instead of failing the write (rustfs/backlog#2904).
|
||||
// The snapshot protocol still admits from this value and fails closed.
|
||||
let current_usage = if uses_durable_reservations {
|
||||
Self::report_usage(bucket, get_bucket_usage_memory(bucket).await)
|
||||
self.report_only_usage(bucket).await
|
||||
} else {
|
||||
Some(self.get_real_time_usage(bucket).await?)
|
||||
};
|
||||
@@ -235,12 +235,8 @@ impl QuotaChecker {
|
||||
Ok(updated_at)
|
||||
}
|
||||
|
||||
/// Return the configured limit and best-effort usage for read-only statistics.
|
||||
/// Single-process reports reflect known deletes before quota reconciliation;
|
||||
/// distributed reports read the persisted scanner baseline.
|
||||
///
|
||||
/// # Errors
|
||||
/// Returns an error for a missing bucket or unreadable quota configuration.
|
||||
/// Return quota configuration with optional scanner usage, independently
|
||||
/// of the usage requirements enforced by write admission.
|
||||
pub async fn get_quota_stats(&self, bucket: &str) -> Result<(BucketQuota, Option<u64>), QuotaError> {
|
||||
// If bucket doesn't exist, return ConfigNotFound error
|
||||
if !self.bucket_exists(bucket).await {
|
||||
@@ -250,12 +246,16 @@ impl QuotaChecker {
|
||||
}
|
||||
|
||||
let quota = self.get_quota_config(bucket).await?;
|
||||
let current_usage = Self::report_usage(bucket, get_bucket_usage_for_statistics(bucket).await);
|
||||
let current_usage = self.report_only_usage(bucket).await;
|
||||
|
||||
Ok((quota, current_usage))
|
||||
}
|
||||
|
||||
fn report_usage(bucket: &str, usage: Option<u64>) -> Option<u64> {
|
||||
/// Best-effort usage for statistics and durable admission reports.
|
||||
/// Missing scanner coverage is unknown, not an error or a zero-sized bucket.
|
||||
async fn report_only_usage(&self, bucket: &str) -> Option<u64> {
|
||||
// The plain lookup: a report must not wait for an early snapshot reload.
|
||||
let usage = get_bucket_usage_memory(bucket).await;
|
||||
if usage.is_none() {
|
||||
metrics::counter!(METRIC_QUOTA_USAGE_REPORT_UNAVAILABLE_TOTAL).increment(1);
|
||||
debug!(
|
||||
|
||||
@@ -353,41 +353,6 @@ async fn quota_statistics_remain_available_without_a_complete_scanner_snapshot()
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
#[serial]
|
||||
async fn quota_statistics_exclude_local_deletes_while_snapshot_admission_retains_them() {
|
||||
let (_dirs, store, _) = isolated_durable_quota_store().await;
|
||||
let bucket = format!("quota-delete-report-{}", Uuid::new_v4().simple());
|
||||
create_bucket_with_quota_json(&store, &bucket, legacy_quota_json(100)).await;
|
||||
// Keep the snapshot-protocol control from initiating a background migration.
|
||||
let metadata_sys = BucketMetadataSys::new(store.clone());
|
||||
let (metadata, _) = metadata_sys.get_config(&bucket).await.expect("load quota metadata");
|
||||
metadata_sys.set(bucket.clone(), metadata).await;
|
||||
let checker = QuotaChecker::new(Arc::new(RwLock::new(metadata_sys)));
|
||||
install_reporting_snapshot(store.clone(), &bucket, "complete", 60).await;
|
||||
crate::data_usage::record_bucket_object_write_memory(&bucket, None, 40).await;
|
||||
|
||||
for (deleted, expected) in [(60, 40), (40, 0)] {
|
||||
crate::data_usage::record_bucket_object_delete_memory(&bucket, deleted, true).await;
|
||||
let (quota, usage) = checker.get_quota_stats(&bucket).await.expect("read quota statistics");
|
||||
assert_eq!(quota.quota, Some(100));
|
||||
assert_eq!(usage, Some(expected), "read-only quota GETs must report the surviving bytes");
|
||||
|
||||
let check = checker
|
||||
.check_quota(&bucket, QuotaOperation::PutObject, 1)
|
||||
.await
|
||||
.expect("check snapshot quota");
|
||||
assert_eq!(check.current_usage, Some(100));
|
||||
assert!(!check.allowed, "reading statistics must not release held bytes for writes");
|
||||
}
|
||||
|
||||
crate::data_usage::prepare_bucket_usage_for_namespace_change(&bucket, None)
|
||||
.await
|
||||
.expect("fixture cache cleanup");
|
||||
crate::data_usage::invalidate_data_usage_snapshot_cache().await;
|
||||
stop_reporting_fixture(&store).await;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn quota_statistics_preserve_configuration_errors() {
|
||||
let (_dirs, store, _) = isolated_durable_quota_store().await;
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
// limitations under the License.
|
||||
|
||||
pub(crate) use crate::services::event_notification::EventArgs;
|
||||
#[cfg(test)]
|
||||
pub(crate) use crate::services::event_notification::test_recorder;
|
||||
|
||||
use super::runtime_boundary;
|
||||
|
||||
|
||||
@@ -89,11 +89,7 @@ impl ReplicationLifecycleBridge {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) async fn schedule_delete(
|
||||
bucket: String,
|
||||
delete_object: DeletedObject,
|
||||
notification_bucket_incarnation: Option<uuid::Uuid>,
|
||||
) {
|
||||
pub(crate) async fn schedule_delete(bucket: String, delete_object: DeletedObject) {
|
||||
#[cfg(test)]
|
||||
{
|
||||
SCHEDULED_DELETE_OBJECTS
|
||||
@@ -102,7 +98,6 @@ impl ReplicationLifecycleBridge {
|
||||
.push(delete_object.clone());
|
||||
}
|
||||
super::replication_pool::schedule_replication_delete(DeletedObjectReplicationInfo {
|
||||
notification_bucket_incarnation,
|
||||
delete_object: deleted_object_for_replication(delete_object),
|
||||
bucket,
|
||||
event_type: REPLICATE_INCOMING_DELETE.to_string(),
|
||||
|
||||
@@ -22,10 +22,6 @@ use rustfs_utils::path::path_join_buf;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
use super::replication_error_boundary::{Error, Result};
|
||||
#[cfg(test)]
|
||||
pub(crate) use crate::bucket::metadata_sys::{
|
||||
bucket_metadata_sys_of, init_bucket_metadata_sys, set_bucket_metadata_in, test_support,
|
||||
};
|
||||
|
||||
pub(crate) type ReplicationInstanceContext = InstanceContext;
|
||||
|
||||
|
||||
@@ -110,16 +110,13 @@ impl ReplicationObjectBridge {
|
||||
check_replicate_delete_with_snapshot(object, source, opts, source_error, snapshot)
|
||||
}
|
||||
|
||||
/// Admits replication with the bucket identity verified by the originating mutation.
|
||||
/// An absent identity suppresses external notifications; workers never infer one by name.
|
||||
pub async fn schedule_object<S: ReplicationStorage>(
|
||||
object: ObjectInfo,
|
||||
storage: Arc<S>,
|
||||
decision: ReplicateDecision,
|
||||
op_type: ReplicationType,
|
||||
notification_bucket_incarnation: Option<uuid::Uuid>,
|
||||
) {
|
||||
schedule_replication(object, storage, decision, op_type, notification_bucket_incarnation).await;
|
||||
schedule_replication(object, storage, decision, op_type).await;
|
||||
}
|
||||
|
||||
pub async fn schedule_delete(delete_object: DeletedObjectReplicationInfo) {
|
||||
@@ -151,16 +148,8 @@ impl ReplicationObjectBridge {
|
||||
}
|
||||
}
|
||||
|
||||
/// Schedules a committed delete with its originating bucket identity for notifications.
|
||||
/// An absent identity leaves external notifications unbound.
|
||||
pub async fn schedule_storage_delete(
|
||||
delete_object: DeletedObject,
|
||||
bucket: String,
|
||||
event_type: String,
|
||||
notification_bucket_incarnation: Option<uuid::Uuid>,
|
||||
) {
|
||||
pub async fn schedule_storage_delete(delete_object: DeletedObject, bucket: String, event_type: String) {
|
||||
Self::schedule_delete(DeletedObjectReplicationInfo {
|
||||
notification_bucket_incarnation,
|
||||
delete_object: deleted_object_for_replication(delete_object),
|
||||
bucket,
|
||||
event_type,
|
||||
@@ -169,18 +158,10 @@ impl ReplicationObjectBridge {
|
||||
.await;
|
||||
}
|
||||
|
||||
/// Schedules committed deletes from one bucket instance, retaining that notification identity.
|
||||
/// An absent identity leaves external notifications unbound.
|
||||
pub async fn schedule_storage_deletes(
|
||||
delete_objects: Vec<DeletedObject>,
|
||||
bucket: String,
|
||||
event_type: String,
|
||||
notification_bucket_incarnation: Option<uuid::Uuid>,
|
||||
) {
|
||||
pub async fn schedule_storage_deletes(delete_objects: Vec<DeletedObject>, bucket: String, event_type: String) {
|
||||
let delete_objects = delete_objects
|
||||
.into_iter()
|
||||
.map(|delete_object| DeletedObjectReplicationInfo {
|
||||
notification_bucket_incarnation,
|
||||
delete_object: deleted_object_for_replication(delete_object),
|
||||
bucket: bucket.clone(),
|
||||
event_type: event_type.clone(),
|
||||
|
||||
@@ -1016,9 +1016,7 @@ async fn replay_mrf_metadata_entry<S: ReplicationStorage>(
|
||||
/// admitted targets, carrying over the entry's retry count.
|
||||
fn admitted_mrf_replicate_object(oi: ObjectInfo, entry: &MrfReplicateEntry, op_type: ReplicationType) -> ReplicateObjectInfo {
|
||||
let dsc = replicate_decision_for_admitted_targets(&entry.target_arns);
|
||||
// The journal does not bind this task to a bucket instance. Keep external
|
||||
// notifications unbound instead of attaching an old task to a reused name.
|
||||
let mut roi = replicate_object_info_from_object_info(oi, dsc, op_type, None);
|
||||
let mut roi = replicate_object_info_from_object_info(oi, dsc, op_type);
|
||||
roi.retry_count = entry.retry_count.max(0) as u32;
|
||||
roi
|
||||
}
|
||||
@@ -3173,13 +3171,12 @@ pub(crate) async fn schedule_replication<S: ReplicationStorage>(
|
||||
o: Arc<S>,
|
||||
dsc: ReplicateDecision,
|
||||
op_type: ReplicationType,
|
||||
notification_bucket_incarnation: Option<uuid::Uuid>,
|
||||
) {
|
||||
let (synchronous, asynchronous) = dsc.partition_by_sync();
|
||||
let mut async_oi = oi;
|
||||
|
||||
if synchronous.replicate_any() {
|
||||
let ri = replicate_object_info_from_object_info(async_oi.clone(), synchronous, op_type, notification_bucket_incarnation);
|
||||
let ri = replicate_object_info_from_object_info(async_oi.clone(), synchronous, op_type);
|
||||
let state = replicate_object(ri, o.clone()).await;
|
||||
async_oi.replication_status_internal = state.replication_status_internal;
|
||||
async_oi.version_purge_status_internal = state.version_purge_status_internal;
|
||||
@@ -3188,7 +3185,7 @@ pub(crate) async fn schedule_replication<S: ReplicationStorage>(
|
||||
if asynchronous.replicate_any()
|
||||
&& let Some(pool) = runtime_sources::replication_pool()
|
||||
{
|
||||
let ri = replicate_object_info_from_object_info(async_oi, asynchronous, op_type, notification_bucket_incarnation);
|
||||
let ri = replicate_object_info_from_object_info(async_oi, asynchronous, op_type);
|
||||
let _ = pool.queue_replica_task(ri).await;
|
||||
}
|
||||
}
|
||||
@@ -3197,7 +3194,6 @@ fn replicate_object_info_from_object_info(
|
||||
oi: ObjectInfo,
|
||||
dsc: ReplicateDecision,
|
||||
op_type: ReplicationType,
|
||||
notification_bucket_incarnation: Option<uuid::Uuid>,
|
||||
) -> ReplicateObjectInfo {
|
||||
let tgt_statuses = replication_statuses_map(&oi.replication_status_internal.clone().unwrap_or_default());
|
||||
let purge_statuses = version_purge_statuses_map(&oi.version_purge_status_internal.clone().unwrap_or_default());
|
||||
@@ -3213,7 +3209,6 @@ fn replicate_object_info_from_object_info(
|
||||
let checksum = if ssec { oi.checksum.clone() } else { None };
|
||||
|
||||
ReplicateObjectInfo {
|
||||
notification_bucket_incarnation,
|
||||
name: oi.name,
|
||||
size: oi.size,
|
||||
actual_size: asz,
|
||||
@@ -3355,7 +3350,7 @@ pub async fn queue_replication_metadata(bucket: &str, oi: ObjectInfo, retry_coun
|
||||
return ReplicationQueueAdmission::Skipped;
|
||||
}
|
||||
|
||||
let mut roi = replicate_object_info_from_object_info(oi, dsc, ReplicationType::Metadata, None);
|
||||
let mut roi = replicate_object_info_from_object_info(oi, dsc, ReplicationType::Metadata);
|
||||
roi.retry_count = retry_count;
|
||||
if let Some(pool) = runtime_sources::replication_pool() {
|
||||
pool.queue_replica_task(roi).await
|
||||
@@ -5210,117 +5205,6 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn replication_admission_keeps_original_incarnation_and_mrf_replay_does_not_guess() {
|
||||
let incarnation = Uuid::new_v4();
|
||||
let target = "arn:rustfs:replication:target-a";
|
||||
for op_type in [ReplicationType::Object, ReplicationType::Metadata] {
|
||||
let object = ObjectInfo {
|
||||
bucket: "source".to_string(),
|
||||
name: "object".to_string(),
|
||||
version_id: Some(Uuid::new_v4()),
|
||||
..Default::default()
|
||||
};
|
||||
let admitted = replicate_object_info_from_object_info(
|
||||
object.clone(),
|
||||
test_replicate_decision(&[target]),
|
||||
op_type,
|
||||
Some(incarnation),
|
||||
);
|
||||
assert_eq!(admitted.notification_bucket_incarnation, Some(incarnation));
|
||||
let encoded = encode_mrf_file(&[admitted.to_mrf_entry()]).expect("encode queued replication");
|
||||
let entries = decode_mrf_file(&encoded).expect("decode queued replication");
|
||||
let replayed = admitted_mrf_replicate_object(object, &entries[0], op_type);
|
||||
assert_eq!(
|
||||
replayed.notification_bucket_incarnation, None,
|
||||
"MRF replay must not infer a bucket instance from a reused name"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
|
||||
#[serial_test::serial]
|
||||
async fn queued_delete_notifications_keep_origin_across_bucket_recreation() {
|
||||
use super::super::replication_event_sink::test_recorder;
|
||||
use super::super::replication_metadata_boundary::{
|
||||
bucket_metadata_sys_of, init_bucket_metadata_sys, set_bucket_metadata_in,
|
||||
test_support::isolated_store_over_temp_disks,
|
||||
};
|
||||
use super::super::replication_storage_boundary::{BucketOperations as _, DeleteBucketOptions, MakeBucketOptions};
|
||||
|
||||
let (_dirs, store) = isolated_store_over_temp_disks().await;
|
||||
init_bucket_metadata_sys(store.clone(), Vec::new()).await;
|
||||
runtime_sources::set_test_object_layer(store.clone()).await;
|
||||
test_recorder::install();
|
||||
let bucket = "queued-delete-notification-origin";
|
||||
store
|
||||
.make_bucket(bucket, &MakeBucketOptions::default())
|
||||
.await
|
||||
.expect("create original bucket");
|
||||
let original = store.bucket_incarnation_id(bucket).await.expect("original incarnation");
|
||||
let queued = DeletedObjectReplicationInfo {
|
||||
notification_bucket_incarnation: Some(original),
|
||||
bucket: bucket.to_string(),
|
||||
target_arn: "arn:rustfs:replication:target-a".to_string(),
|
||||
delete_object: ReplicationDeletedObject {
|
||||
object_name: "original-object".to_string(),
|
||||
version_id: Some(Uuid::new_v4()),
|
||||
replication_state: Some(ReplicationState {
|
||||
replicate_decision_str: "malformed-decision".to_string(),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
let encoded = encode_mrf_file(&[queued.to_mrf_entry()]).expect("persist old delete task");
|
||||
let entries = decode_mrf_file(&encoded).expect("recover old delete task");
|
||||
let mut replayed = reconstructed_heal_delete_info(
|
||||
&entries[0],
|
||||
&ObjectInfo::default(),
|
||||
&replicate_decision_for_admitted_targets(&entries[0].target_arns),
|
||||
);
|
||||
replayed
|
||||
.delete_object
|
||||
.replication_state
|
||||
.as_mut()
|
||||
.expect("reconstructed replication state")
|
||||
.replicate_decision_str = "malformed-decision".to_string();
|
||||
|
||||
store
|
||||
.delete_bucket(bucket, &DeleteBucketOptions::default())
|
||||
.await
|
||||
.expect("delete original bucket");
|
||||
store
|
||||
.make_bucket(bucket, &MakeBucketOptions::default())
|
||||
.await
|
||||
.expect("create replacement bucket");
|
||||
let replacement = store.bucket_incarnation_id(bucket).await.expect("replacement incarnation");
|
||||
assert_ne!(original, replacement);
|
||||
let sys = bucket_metadata_sys_of(&store.ctx).expect("metadata owner");
|
||||
let mut metadata = (*sys.read().await.get(bucket).await.expect("replacement metadata")).clone();
|
||||
metadata.notification_config_xml = br#"<NotificationConfiguration><QueueConfiguration><Id>replacement</Id><Queue>arn:rustfs:sqs:us-east-1:replacement:webhook</Queue><Event>s3:Replication:*</Event></QueueConfiguration></NotificationConfiguration>"#.to_vec();
|
||||
set_bucket_metadata_in(&store.ctx, metadata)
|
||||
.await
|
||||
.expect("install replacement notification configuration");
|
||||
|
||||
assert!(!replicate_delete_with_outcome(queued, store.clone()).await);
|
||||
assert!(!replicate_delete_with_outcome(replayed, store).await);
|
||||
let events = test_recorder::recorded_for_bucket(bucket);
|
||||
assert_eq!(events.len(), 2, "both worker failures must emit an observable local event");
|
||||
assert!(
|
||||
events
|
||||
.iter()
|
||||
.all(|event| event.object == "original-object" && event.event_name == "s3:Replication:OperationNotTracked")
|
||||
);
|
||||
assert_eq!(events[0].bucket_incarnation_id, Some(original));
|
||||
assert_eq!(
|
||||
events[1].bucket_incarnation_id, None,
|
||||
"a replay without provenance must not acquire the replacement bucket's identity"
|
||||
);
|
||||
assert!(events.iter().all(|event| event.bucket_incarnation_id != Some(replacement)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn replicate_object_info_from_object_info_preserves_ssec_checksum() {
|
||||
let checksum = bytes::Bytes::from_static(b"ssec-checksum");
|
||||
@@ -5335,7 +5219,7 @@ mod tests {
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let ri = replicate_object_info_from_object_info(oi, ReplicateDecision::default(), ReplicationType::Object, None);
|
||||
let ri = replicate_object_info_from_object_info(oi, ReplicateDecision::default(), ReplicationType::Object);
|
||||
|
||||
assert!(ri.ssec);
|
||||
assert_eq!(ri.checksum, Some(checksum));
|
||||
@@ -5351,12 +5235,8 @@ mod tests {
|
||||
user_tags: Arc::new("owner=a3".to_string()),
|
||||
..Default::default()
|
||||
};
|
||||
let live = replicate_object_info_from_object_info(
|
||||
object.clone(),
|
||||
test_replicate_decision(&[target]),
|
||||
ReplicationType::Metadata,
|
||||
None,
|
||||
);
|
||||
let live =
|
||||
replicate_object_info_from_object_info(object.clone(), test_replicate_decision(&[target]), ReplicationType::Metadata);
|
||||
let persisted = live.to_mrf_entry();
|
||||
let encoded = encode_mrf_file(std::slice::from_ref(&persisted)).expect("metadata MRF entry should encode");
|
||||
let decoded = decode_mrf_file(&encoded).expect("metadata MRF entry should decode");
|
||||
|
||||
@@ -2274,7 +2274,6 @@ pub async fn get_heal_replicate_object_info(oi: &ObjectInfo, rcfg: &ReplicationC
|
||||
let replication_generation = oi.replication_generation_snapshot();
|
||||
|
||||
Ok(ReplicateObjectInfo {
|
||||
notification_bucket_incarnation: None,
|
||||
name: oi.name.clone(),
|
||||
size: oi.size,
|
||||
actual_size,
|
||||
@@ -2449,7 +2448,6 @@ pub(crate) async fn replicate_delete_with_outcome<S: ReplicationStorage>(
|
||||
"Failed to parse replicate decision"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: dobj.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: ObjectInfo {
|
||||
@@ -2531,7 +2529,6 @@ pub(crate) async fn replicate_delete_with_outcome<S: ReplicationStorage>(
|
||||
"Failed to verify source delete-marker state before replication"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: dobj.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: ObjectInfo {
|
||||
@@ -2566,7 +2563,6 @@ pub(crate) async fn replicate_delete_with_outcome<S: ReplicationStorage>(
|
||||
"Skipping replication delete"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: dobj.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: ObjectInfo {
|
||||
@@ -2597,7 +2593,6 @@ pub(crate) async fn replicate_delete_with_outcome<S: ReplicationStorage>(
|
||||
"Skipping replication delete"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: dobj.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: ObjectInfo {
|
||||
@@ -2697,7 +2692,6 @@ pub(crate) async fn replicate_delete_with_outcome<S: ReplicationStorage>(
|
||||
"Replication resync task failed"
|
||||
);
|
||||
send_event(EventArgs {
|
||||
bucket_incarnation_id: dobj.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: ObjectInfo {
|
||||
@@ -2806,7 +2800,6 @@ pub(crate) async fn replicate_delete_with_outcome<S: ReplicationStorage>(
|
||||
{
|
||||
Ok(object) => {
|
||||
send_event(EventArgs {
|
||||
bucket_incarnation_id: dobj.notification_bucket_incarnation,
|
||||
event_name,
|
||||
bucket_name: bucket.clone(),
|
||||
object,
|
||||
@@ -2832,7 +2825,6 @@ pub(crate) async fn replicate_delete_with_outcome<S: ReplicationStorage>(
|
||||
);
|
||||
}
|
||||
send_event(EventArgs {
|
||||
bucket_incarnation_id: dobj.notification_bucket_incarnation,
|
||||
event_name,
|
||||
bucket_name: bucket.clone(),
|
||||
object: ObjectInfo {
|
||||
@@ -3164,7 +3156,6 @@ async fn purge_stale_delete_marker_targets(bucket: &str, dobj: &DeletedObjectRep
|
||||
}
|
||||
|
||||
async fn replicate_force_delete_to_targets<S: ReplicationStorage>(dobj: &DeletedObjectReplicationInfo, storage: Arc<S>) -> bool {
|
||||
let incarnation_id = dobj.notification_bucket_incarnation;
|
||||
let bucket = &dobj.bucket;
|
||||
let object_name = &dobj.delete_object.object_name;
|
||||
let admitted_target_arns = dobj.admitted_target_arns();
|
||||
@@ -3185,7 +3176,6 @@ async fn replicate_force_delete_to_targets<S: ReplicationStorage>(dobj: &Deleted
|
||||
"Skipping replication force-delete because replication config is missing"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: incarnation_id,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: ObjectInfo {
|
||||
@@ -3209,7 +3199,6 @@ async fn replicate_force_delete_to_targets<S: ReplicationStorage>(dobj: &Deleted
|
||||
"Skipping replication force-delete because replication config lookup failed"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: incarnation_id,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: ObjectInfo {
|
||||
@@ -3244,7 +3233,6 @@ async fn replicate_force_delete_to_targets<S: ReplicationStorage>(dobj: &Deleted
|
||||
"Skipping replication force-delete"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: incarnation_id,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: ObjectInfo {
|
||||
@@ -3273,7 +3261,6 @@ async fn replicate_force_delete_to_targets<S: ReplicationStorage>(dobj: &Deleted
|
||||
"Skipping replication force-delete"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: incarnation_id,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: ObjectInfo {
|
||||
@@ -3321,7 +3308,6 @@ async fn replicate_force_delete_to_targets<S: ReplicationStorage>(dobj: &Deleted
|
||||
"Skipping replication force-delete because target client is unavailable"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: incarnation_id,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: ObjectInfo {
|
||||
@@ -3352,7 +3338,6 @@ async fn replicate_force_delete_to_targets<S: ReplicationStorage>(dobj: &Deleted
|
||||
"Skipping replication force-delete"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: incarnation_id,
|
||||
event_name: EventName::ObjectReplicationFailed.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: ObjectInfo {
|
||||
@@ -3389,7 +3374,6 @@ async fn replicate_force_delete_to_targets<S: ReplicationStorage>(dobj: &Deleted
|
||||
"Replication target operation failed"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: incarnation_id,
|
||||
event_name: EventName::ObjectReplicationFailed.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: ObjectInfo {
|
||||
@@ -4253,7 +4237,6 @@ pub(crate) async fn replicate_object_with_outcome<S: ReplicationStorage>(
|
||||
"Skipping replication object"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: roi.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: roi.to_object_info(),
|
||||
@@ -4277,7 +4260,6 @@ pub(crate) async fn replicate_object_with_outcome<S: ReplicationStorage>(
|
||||
"Skipping replication object"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: roi.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: roi.to_object_info(),
|
||||
@@ -4344,7 +4326,6 @@ pub(crate) async fn replicate_object_with_outcome<S: ReplicationStorage>(
|
||||
"Replication resync task failed"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: roi.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: roi.to_object_info(),
|
||||
@@ -4489,7 +4470,6 @@ pub(crate) async fn replicate_object_with_outcome<S: ReplicationStorage>(
|
||||
|
||||
if publication.emit_event {
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: roi.notification_bucket_incarnation,
|
||||
event_name,
|
||||
bucket_name: bucket.clone(),
|
||||
object: object_info,
|
||||
@@ -4632,7 +4612,6 @@ impl ReplicateObjectInfoExt for ReplicateObjectInfo {
|
||||
"Skipping replication object target"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: self.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: self.to_object_info(),
|
||||
@@ -4648,7 +4627,6 @@ impl ReplicateObjectInfoExt for ReplicateObjectInfo {
|
||||
let Some(ssec_audit_required) = resolve_ssec_passthrough_gate(self.ssec, &tgt_client, &bucket, &object, &mut rinfo)
|
||||
else {
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: self.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: self.to_object_info(),
|
||||
@@ -4692,7 +4670,6 @@ impl ReplicateObjectInfoExt for ReplicateObjectInfo {
|
||||
);
|
||||
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: self.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: self.to_object_info(),
|
||||
@@ -4724,7 +4701,6 @@ impl ReplicateObjectInfoExt for ReplicateObjectInfo {
|
||||
"Skipping replication object target"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: self.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: object_info,
|
||||
@@ -4750,7 +4726,6 @@ impl ReplicateObjectInfoExt for ReplicateObjectInfo {
|
||||
"Skipping replication object target"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: self.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: object_info,
|
||||
@@ -4882,7 +4857,6 @@ impl ReplicateObjectInfoExt for ReplicateObjectInfo {
|
||||
"Replication target operation failed"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: self.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: object_info,
|
||||
@@ -4911,7 +4885,6 @@ impl ReplicateObjectInfoExt for ReplicateObjectInfo {
|
||||
"Replication target operation failed"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: self.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: object_info,
|
||||
@@ -5009,7 +4982,6 @@ impl ReplicateObjectInfoExt for ReplicateObjectInfo {
|
||||
let Some(ssec_audit_required) = resolve_ssec_passthrough_gate(self.ssec, &tgt_client, &bucket, &object, &mut rinfo)
|
||||
else {
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: self.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.clone(),
|
||||
object: self.to_object_info(),
|
||||
@@ -5043,7 +5015,7 @@ impl ReplicateObjectInfoExt for ReplicateObjectInfo {
|
||||
let size = match object_info.get_actual_size() {
|
||||
Ok(size) => size,
|
||||
Err(e) => {
|
||||
note_replicate_all_size_unavailable(&bucket, &tgt_client, object_info, &e, self.notification_bucket_incarnation);
|
||||
note_replicate_all_size_unavailable(&bucket, &tgt_client, object_info, &e);
|
||||
return rinfo;
|
||||
}
|
||||
};
|
||||
@@ -5052,7 +5024,7 @@ impl ReplicateObjectInfoExt for ReplicateObjectInfo {
|
||||
let transfer_size = if self.ssec { object_info.size } else { size };
|
||||
|
||||
if tgt_client.bucket.is_empty() {
|
||||
note_replicate_all_target_bucket_empty(&bucket, &tgt_client, object_info, self.notification_bucket_incarnation);
|
||||
note_replicate_all_target_bucket_empty(&bucket, &tgt_client, object_info);
|
||||
return rinfo;
|
||||
}
|
||||
|
||||
@@ -5098,15 +5070,7 @@ impl ReplicateObjectInfoExt for ReplicateObjectInfo {
|
||||
let (put_opts, is_multipart) = match replication_put_object_options_for_target(&tgt_client, &object_info) {
|
||||
Ok((put_opts, is_mp)) => (put_opts, is_mp),
|
||||
Err(e) => {
|
||||
fail_replicate_all_put_options(
|
||||
&mut rinfo,
|
||||
&tgt_client,
|
||||
&bucket,
|
||||
object_info,
|
||||
&e,
|
||||
start_time,
|
||||
self.notification_bucket_incarnation,
|
||||
);
|
||||
fail_replicate_all_put_options(&mut rinfo, &tgt_client, &bucket, object_info, &e, start_time);
|
||||
return rinfo;
|
||||
}
|
||||
};
|
||||
@@ -5210,7 +5174,6 @@ fn note_replicate_all_target_offline(roi: &ReplicateObjectInfo, bucket: &str, tg
|
||||
"Skipped replication because target is offline"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: roi.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.to_string(),
|
||||
object: roi.to_object_info(),
|
||||
@@ -5249,7 +5212,6 @@ fn note_replicate_all_reader_unavailable(roi: &ReplicateObjectInfo, bucket: &str
|
||||
"Skipped replication because object reader is unavailable"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: roi.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.to_string(),
|
||||
object: roi.to_object_info(),
|
||||
@@ -5261,13 +5223,7 @@ fn note_replicate_all_reader_unavailable(roi: &ReplicateObjectInfo, bucket: &str
|
||||
|
||||
/// Log and notify that replication was skipped because the actual object size
|
||||
/// is unavailable.
|
||||
fn note_replicate_all_size_unavailable(
|
||||
bucket: &str,
|
||||
tgt_client: &TargetClient,
|
||||
object_info: ObjectInfo,
|
||||
e: &std::io::Error,
|
||||
incarnation_id: Option<uuid::Uuid>,
|
||||
) {
|
||||
fn note_replicate_all_size_unavailable(bucket: &str, tgt_client: &TargetClient, object_info: ObjectInfo, e: &std::io::Error) {
|
||||
debug!(
|
||||
event = EVENT_RESYNC_RUNTIME_SKIPPED,
|
||||
component = LOG_COMPONENT_ECSTORE,
|
||||
@@ -5280,7 +5236,6 @@ fn note_replicate_all_size_unavailable(
|
||||
"Skipped replication because actual object size is unavailable"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: incarnation_id,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.to_string(),
|
||||
object: object_info,
|
||||
@@ -5291,12 +5246,7 @@ fn note_replicate_all_size_unavailable(
|
||||
|
||||
/// Log and notify that replication was skipped because the target bucket is
|
||||
/// empty.
|
||||
fn note_replicate_all_target_bucket_empty(
|
||||
bucket: &str,
|
||||
tgt_client: &TargetClient,
|
||||
object_info: ObjectInfo,
|
||||
incarnation_id: Option<uuid::Uuid>,
|
||||
) {
|
||||
fn note_replicate_all_target_bucket_empty(bucket: &str, tgt_client: &TargetClient, object_info: ObjectInfo) {
|
||||
debug!(
|
||||
event = EVENT_RESYNC_RUNTIME_SKIPPED,
|
||||
component = LOG_COMPONENT_ECSTORE,
|
||||
@@ -5308,7 +5258,6 @@ fn note_replicate_all_target_bucket_empty(
|
||||
"Skipped replication because target bucket is empty"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: incarnation_id,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.to_string(),
|
||||
object: object_info,
|
||||
@@ -5422,7 +5371,6 @@ async fn resolve_replicate_all_action(
|
||||
"Skipping replication because newer target version exists"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: roi.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.to_string(),
|
||||
object: object_info.clone(),
|
||||
@@ -5546,7 +5494,6 @@ async fn resolve_replicate_all_action(
|
||||
"Failed replication head-object fallback"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: roi.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.to_string(),
|
||||
object: object_info,
|
||||
@@ -5579,7 +5526,6 @@ async fn resolve_replicate_all_action(
|
||||
);
|
||||
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: roi.notification_bucket_incarnation,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.to_string(),
|
||||
object: object_info,
|
||||
@@ -5608,7 +5554,6 @@ fn fail_replicate_all_put_options(
|
||||
object_info: ObjectInfo,
|
||||
e: &Error,
|
||||
start_time: OffsetDateTime,
|
||||
incarnation_id: Option<uuid::Uuid>,
|
||||
) {
|
||||
rinfo.replication_status = ReplicationStatusType::Failed;
|
||||
rinfo.error = Some(e.to_string());
|
||||
@@ -5624,7 +5569,6 @@ fn fail_replicate_all_put_options(
|
||||
"Replication target operation failed"
|
||||
);
|
||||
send_local_event(EventArgs {
|
||||
bucket_incarnation_id: incarnation_id,
|
||||
event_name: EventName::ObjectReplicationNotTracked.to_string(),
|
||||
bucket_name: bucket.to_string(),
|
||||
object: object_info,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user