Skip to content

fileservice: remove IOEntry.allocator - #16107

Merged
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
reusee:fsalloc
May 16, 2024
Merged

mergify[bot] merged 2 commits into
matrixorigin:mainfrom
reusee:fsalloc

Conversation

@reusee

@reusee reusee commented May 14, 2024

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #15508

What this PR does / why we need it:

clean up cache codes.

@reusee
reusee requested a review from zhangxu19830126 May 14, 2024 08:50
@matrix-meow matrix-meow added the size/S Denotes a PR that changes [10,99] lines label May 14, 2024
@matrix-meow

Copy link
Copy Markdown
Contributor

@reusee Thanks for your contributions!

Pull Request Review:

Title:

The title of the pull request is clear and concise, indicating the specific action being taken - the removal of IOEntry.allocator.

Body:

The body of the pull request provides relevant information about the type of PR, the issue it fixes, and the reason for the changes. It mentions that the PR is an improvement and is aimed at cleaning up cache codes related to IOEntry.allocator.

Changes:

  1. In disk_cache.go:

    • The change involves modifying the ReadFromOSFile function call to include DefaultCacheDataAllocator as an argument.
  2. In file_service.go:

    • The IOEntry struct no longer contains the allocator field.
  3. In io_entry.go:

    • The setCachedData function now accepts a CacheDataAllocator argument.
    • The ReadFromOSFile function now accepts a CacheDataAllocator argument.
  4. In local_etl_fs.go:

    • The setCachedData function call now includes DefaultCacheDataAllocator as an argument.
  5. In local_fs.go:

    • The allocator field in LocalFS is no longer set for each entry in the vector.
    • The read function now accepts an allocator argument and sets it accordingly.
    • The setCachedData function call in the read function now includes the allocator argument.
  6. In memory_fs.go:

    • The allocator field in MemoryFS is no longer set for each entry in the vector.
    • The Read function now sets the allocator for each entry based on m.memCache.
    • The setCachedData function call in the Read function now includes the allocator argument.
  7. In s3_fs.go:

    • The allocator field in S3FS is no longer set for each entry in the vector.
    • The Read function now sets the allocator for each entry based on s.allocator.
    • The read function now accepts an allocator argument and sets it accordingly.
    • The setCachedData function call in the read function now includes the allocator argument.

Suggestions for Improvement:

  1. Consistency in Allocator Usage:

    • It seems that the allocator field has been removed from various structs, and now the allocator is passed as an argument to functions. Ensure consistency in how allocators are handled across all files to maintain clarity and avoid confusion.
  2. Error Handling:

    • Ensure that error handling is robust in functions where changes have been made. Verify that errors are appropriately handled and not ignored, especially in functions like setCachedData and ReadFromOSFile.
  3. Code Optimization:

    • Consider refactoring code to reduce redundancy and improve readability. Look for opportunities to simplify code where possible without sacrificing clarity.
  4. Documentation:

    • Ensure that the code changes are well-documented, especially regarding the usage of allocators and any related functionality. Clear documentation can help developers understand the purpose and usage of the modified code.
  5. Security Considerations:

    • Review the changes for any potential security implications, especially when handling file operations and caching. Ensure that sensitive data is handled securely and that there are no vulnerabilities introduced by the modifications.

By addressing these suggestions, the codebase can be improved in terms of consistency, error handling, optimization, documentation, and security.

@mergify
mergify Bot merged commit 25b0b08 into matrixorigin:main May 16, 2024
reusee added a commit to reusee/matrixone that referenced this pull request May 17, 2024
reusee added a commit to reusee/matrixone that referenced this pull request Jun 6, 2024
fengttt pushed a commit to fengttt/matrixone that referenced this pull request May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants