perf(stream): improve file stream range reading and caching mechanism#1001
Merged
j2rong4cn merged 15 commits intoOpenListTeam:mainfrom Aug 11, 2025
Merged
perf(stream): improve file stream range reading and caching mechanism#1001j2rong4cn merged 15 commits intoOpenListTeam:mainfrom
j2rong4cn merged 15 commits intoOpenListTeam:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves the file stream range reading and caching mechanism by refactoring the buffer management system and enhancing the max_buffer_limitMB configuration option usage. The changes focus on streamlining caching operations, improving memory management, and providing better progress tracking for file operations.
- Refactors
CacheFullInTempFiletoCacheFullAndWriterwith enhanced functionality and progress tracking - Introduces a new
Bytesbuffer type for efficient non-reusable byte slice storage - Updates method signatures across drivers to use pointer-based progress tracking and renamed section reader methods
Reviewed Changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/errgroup/errgroup.go | Minor comment updates for clarity |
| pkg/buffer/bytes.go | New buffer implementation for managing multiple byte slices |
| pkg/buffer/bytes_test.go | Comprehensive tests for the new Bytes buffer functionality |
| internal/stream/stream.go | Major refactoring of FileStream with new caching logic and buffer management |
| internal/stream/util.go | Updated utility functions and renamed RecycleSectionReader to FreeSectionReader |
| internal/stream/stream_test.go | Tests for the refactored stream functionality |
| internal/model/obj.go | Updated FileStreamer interface with new method signatures |
| internal/conf/var.go | Set default MaxBufferLimit value |
| internal/bootstrap/config.go | Improved logging format for buffer limit |
| drivers/* | Updated all drivers to use new CacheFullAndWriter method and pointer-based progress tracking |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: j2rong4cn <36783515+j2rong4cn@users.noreply.github.com>
xrgzs
approved these changes
Aug 11, 2025
|
@j2rong4cn 大佬,有部分网盘会获取preHash,如115和阿里,但获取preHash后,再调用CacheFullAndHash返回的hash值是错的,能不能修复下,下面这个测试能重现: 去掉前面的preHash调用,才能获取到正确的hash值 |
This was referenced Nov 4, 2025
Member
Author
|
@bitxeno 发现这么隐蔽的bug,真的帮大忙了,感谢 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
完善配置选项max_buffer_limitMB的使用场景
配置选项 max_buffer_limitMB
自动: -1 (默认):5%的总内存
关闭:0
自定义:大于0 单位为MB
close #787
close #1039