fix(server): warn and skip non-numeric filenames in consumer offset directories instead of panicking#3135
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3135 +/- ##
=============================================
- Coverage 74.10% 52.69% -21.41%
Complexity 943 943
=============================================
Files 1159 1157 -2
Lines 102033 90321 -11712
Branches 79083 67389 -11694
=============================================
- Hits 75607 47596 -28011
- Misses 23765 40157 +16392
+ Partials 2661 2568 -93
🚀 New features to boost your workflow:
|
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you need a review, please ensure CI is green and the PR is rebased on the latest master. Don't hesitate to ping the maintainers - either @core on Discord or by mentioning them directly here on the PR. Thank you for your contribution! |
|
can you make it a integration test instead of unit? code in core/server will be replaced when we introduce clustering, thus test will be lost. |
…irectories instead of panicking
4fc2476 to
39db2e4
Compare
Good call, moved the tests from |
Which issue does this PR close?
Closes #3132
Rationale
An operator accidentally placing a file (e.g.
.DS_Store, editor swap file, backup) in the consumer offsets directory crashes the server on startup due to apanic!on non-numeric filenames.What changed?
Both
load_consumer_offsetsandload_consumer_group_offsetsincore/server/src/streaming/partitions/storage.rspanicked when encountering files with non-numeric names during startup offset loading.The fix replaces both
panic!calls withwarn!log messages andcontinue, so the server gracefully skips unexpected files. Added 9 integration tests incore/integration/tests/storage/consumer_offsets.rscovering valid files, non-numeric files (.DS_Store,backup.bak), empty directories, subdirectories, and nonexistent paths for both functions.Local Execution
AI Usage
cargo test,cargo clippy,cargo fmt --check, and CI scripts