-
Notifications
You must be signed in to change notification settings - Fork 759
Fix regression in exception handling for non-existent key with enhanced compression predicate and metadata improvements #915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix regression in exception handling for non-existent key with enhanced compression predicate and metadata improvements #915
Conversation
The issue was that CompressionLayer was attempting to compress error responses, which could cause Content-Length header mismatches. By excluding 4xx and 5xx responses from compression, we ensure error responses (like NoSuchKey) are sent correctly without body truncation. Co-authored-by: houseme <[email protected]>
|
@copilot Continue to process improvement and improvement plans |
…ensive tests - Enhanced ShouldCompress predicate with size-based exclusion (< 256 bytes) - Added detailed documentation explaining the compression logic - Added debug logging for better observability - Created comprehensive test suite with 4 test cases: - test_get_deleted_object_returns_nosuchkey - test_head_deleted_object_returns_nosuchkey - test_get_nonexistent_object_returns_nosuchkey - test_multiple_gets_deleted_object - Added extensive inline documentation and comments - Created docs/fix-nosuchkey-regression.md with full analysis Co-authored-by: houseme <[email protected]>
Added comprehensive guide covering: - Best practices for HTTP response compression - Common pitfalls and solutions - Performance considerations and trade-offs - Testing guidelines and examples - Monitoring and alerting recommendations - Migration guide for existing services Co-authored-by: houseme <[email protected]>
* fix getobject content length resp * fix delete object --------- Co-authored-by: houseme <[email protected]>
…ession-downloading-key
|
@copilot Read all the code in pr for in-depth analysis, and analyze the role of modifications in |
已完成对PR代码的深度分析。 修改分析:
协同效果:
优化建议:
|
Created detailed documentation analyzing: - HTTP compression layer fix (primary issue) - Content-length calculation fix from PR #917 - Delete object metadata fixes from PR #917 - How all components work together - Complete scenario walkthrough - Performance impact analysis - Testing strategy and deployment checklist This ties together all the changes in the PR branch including the merged improvements from PR #917. Co-authored-by: houseme <[email protected]>
* fix getobject content length resp * Fix regression in exception handling for non-existent key with enhanced compression predicate and metadata improvements (#915) * Initial plan * Fix GetObject regression by excluding error responses from compression The issue was that CompressionLayer was attempting to compress error responses, which could cause Content-Length header mismatches. By excluding 4xx and 5xx responses from compression, we ensure error responses (like NoSuchKey) are sent correctly without body truncation. Co-authored-by: houseme <[email protected]> * Enhance NoSuchKey fix with improved compression predicate and comprehensive tests - Enhanced ShouldCompress predicate with size-based exclusion (< 256 bytes) - Added detailed documentation explaining the compression logic - Added debug logging for better observability - Created comprehensive test suite with 4 test cases: - test_get_deleted_object_returns_nosuchkey - test_head_deleted_object_returns_nosuchkey - test_get_nonexistent_object_returns_nosuchkey - test_multiple_gets_deleted_object - Added extensive inline documentation and comments - Created docs/fix-nosuchkey-regression.md with full analysis Co-authored-by: houseme <[email protected]> * Add compression best practices documentation Added comprehensive guide covering: - Best practices for HTTP response compression - Common pitfalls and solutions - Performance considerations and trade-offs - Testing guidelines and examples - Monitoring and alerting recommendations - Migration guide for existing services Co-authored-by: houseme <[email protected]> * fix * fmt * fmt * Fix/objectdelete (#917) * fix getobject content length resp * fix delete object --------- Co-authored-by: houseme <[email protected]> * Add comprehensive analysis of NoSuchKey fix and related improvements Created detailed documentation analyzing: - HTTP compression layer fix (primary issue) - Content-length calculation fix from PR #917 - Delete object metadata fixes from PR #917 - How all components work together - Complete scenario walkthrough - Performance impact analysis - Testing strategy and deployment checklist This ties together all the changes in the PR branch including the merged improvements from PR #917. Co-authored-by: houseme <[email protected]> * replace `once_cell` to `std` * fmt --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: houseme <[email protected]> Co-authored-by: houseme <[email protected]> Co-authored-by: weisd <[email protected]> * fmt --------- Co-authored-by: weisd <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: houseme <[email protected]> Co-authored-by: weisd <[email protected]>
Type of Change
Related Issues
Fixes #901
Summary of Changes
Fixes a regression in RustFS 1.0.69 where attempting to download a non-existent or deleted object returns a networking error "http response body truncated, expected 119 bytes, received 0 bytes" instead of the correct
NoSuchKeyS3 error.Root Cause: The
CompressionLayerwas being applied to all responses, including error responses. When the s3s library generates a NoSuchKey error response (~119 bytes XML), the compression layer interferes with the response body, causing a Content-Length header mismatch where the header indicates 119 bytes but 0 bytes are actually transmitted.Solution: This PR implements a comprehensive multi-layered fix that addresses the root cause and related issues:
1. HTTP Compression Layer Fix (Primary Issue)
Implemented an intelligent compression predicate (
ShouldCompress) that excludes:2. Content-Length Calculation Fix (from merged PR #917)
get_actual_size()consistently for accurate Content-Length headers3. Delete Object Metadata Fix (from merged PR #917)
update_version = falseinstead offi.mark_deleted)into_fileinfo()to ensure only valid version IDs are usedCode Changes
Enhanced Compression Predicate (
rustfs/src/server/http.rs)Predicatetrait with multi-criteria filteringContent-Length Calculation (
rustfs/src/storage/ecfs.rs)get_actual_size()for accurate content-length calculationMetadata Management (
crates/filemeta/src/filemeta.rs)Comprehensive Test Suite (
crates/e2e_test/src/reliant/get_deleted_object_test.rs)test_get_deleted_object_returns_nosuchkey- Verifies deleted objects return NoSuchKeytest_head_deleted_object_returns_nosuchkey- Tests HeadObject on deleted objectstest_get_nonexistent_object_returns_nosuchkey- Tests objects that never existedtest_multiple_gets_deleted_object- Ensures stability across multiple requestsComprehensive Documentation
docs/fix-nosuchkey-regression.md- Complete root cause analysis, solution details, testing guide, and deployment considerationsdocs/compression-best-practices.md- Best practices guide for HTTP response compression, common pitfalls, performance considerations, testing guidelines, and migration guidedocs/nosuchkey-fix-comprehensive-analysis.md- Complete analysis of all changes, how they work together, performance impact, testing strategy, and deployment checklistChecklist
make pre-commit(cargo check, cargo fmt, cargo clippy)Impact
Performance Impact
Backward Compatibility
Additional Notes
Complete Solution Analysis
This PR provides a comprehensive fix that addresses multiple related issues through a three-layered approach:
Layer 1 - HTTP Response Handling: Intelligent compression predicate prevents error response corruption by excluding 4xx/5xx responses and small payloads from compression.
Layer 2 - Storage Layer: Accurate content-length calculation using
get_actual_size()ensures Content-Length headers match actual response body sizes for all object types (compressed, encrypted, multipart).Layer 3 - Metadata Layer: Proper version management and UUID filtering ensures correct object state after deletion operations, which is critical for subsequent GetObject operations to correctly determine that an object doesn't exist.
How the Layers Work Together
When a deleted object is requested:
Testing Results
cargo check)cargo clippy --bin rustfs -- -D warnings)cargo fmt)Deployment Strategy
Monitoring Metrics
rate(http_compression_skipped_total[5m]) / rate(http_responses_total[5m])histogram_quantile(0.95, rate(http_error_response_size_bytes[5m]))rate(s3_errors_total{code="NoSuchKey"}[5m])Documentation
The PR includes three comprehensive documentation files:
docs/fix-nosuchkey-regression.md): Root cause, solution details, testing guide, deployment considerationsdocs/compression-best-practices.md): Guidelines for HTTP compression, common pitfalls, performance considerations, monitoring recommendationsdocs/nosuchkey-fix-comprehensive-analysis.md): Complete analysis of all changes, how they work together, scenario walkthroughs, performance impact, and deployment checklistThank you for your contribution! Please ensure your PR follows the community standards (CODE_OF_CONDUCT.md) and sign the CLA if this is your first contribution.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.