Skip to content

fileservice: revert changes due to TPCC performance regression - #16204

Merged
sukki37 merged 2 commits into
matrixorigin:mainfrom
reusee:fsrevert
May 17, 2024
Merged

sukki37 merged 2 commits into
matrixorigin:mainfrom
reusee:fsrevert

Conversation

@reusee

@reusee reusee commented May 17, 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 #16202

What this PR does / why we need it:

revert changes due to TPCC performance regression

@matrix-meow matrix-meow added the size/S Denotes a PR that changes [10,99] lines label May 17, 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 that the changes are being reverted due to a performance regression related to TPCC.

Body:

The body of the pull request provides information about the type of PR, the specific issue it fixes, and the reason for the changes. It mentions that the changes are being reverted due to TPCC performance regression, which is helpful for understanding the context of the revert.

Changes:

  1. In disk_cache.go:

    • The change from readFromOSFile function to entry.ReadFromOSFile method is a good improvement for readability and consistency.
    • However, the comment "ignore error" should be revisited. Ignoring errors without proper handling can lead to unexpected behavior or issues. It's recommended to log the error or handle it appropriately.
  2. In file_service.go:

    • The addition of the allocator field in the IOEntry struct seems reasonable for managing cache allocation.
    • The setCachedData method has been modified to be a method of IOEntry, which is a good design change for encapsulation.
    • The defaulting of DefaultCacheDataAllocator if i.allocator is nil seems appropriate, but it's essential to ensure that this default behavior aligns with the intended logic.
  3. In io_entry.go:

    • The change from a generic function to a method in IOEntry for setCachedData is a good object-oriented design improvement.
    • The ReadFromOSFile method now directly operates on IOEntry, which enhances code readability and maintainability.
  4. In local_etl_fs.go and local_fs.go:

    • The change from setCachedData(&entry, DefaultCacheDataAllocator) to entry.setCachedData() is a positive refactor for code clarity and consistency.
    • However, the same concern about error handling applies here as well. Ignoring errors completely may lead to issues down the line.
  5. In memory_fs.go:

    • The modification to use entry.setCachedData() is consistent with the changes made in other files, promoting code uniformity.
    • The assignment of m.memCache to vector.Entries[i].allocator seems appropriate for managing cache allocation.
  6. In s3_fs.go:

    • The changes related to allocator and setCachedData are in line with the improvements made in other files.
    • The handling of DefaultCacheDataAllocator based on conditions is a good practice for flexibility.

Suggestions for Improvement:

  1. Error Handling: Ensure that errors are not ignored without proper handling. Consider logging errors or implementing appropriate error recovery mechanisms to prevent silent failures.

  2. Consistency: Maintain consistency in error handling and coding style across all modified files for better code maintenance and readability.

  3. Documentation: Add or update comments to explain the rationale behind certain decisions or behaviors in the code to aid future developers in understanding the codebase.

  4. Testing: Verify that the reverted changes do not introduce new issues or regressions by running relevant tests and performance benchmarks.

  5. Security Considerations: Review the changes for any potential security implications, especially when handling file operations or cache management.

  6. Optimization: Look for opportunities to optimize code performance or resource utilization while reverting the changes to address the TPCC performance regression.

By addressing these suggestions, the codebase can be improved in terms of readability, maintainability, and robustness, ensuring a more reliable and efficient system overall.

@reusee
reusee requested a review from XuPeng-SH May 17, 2024 01:38
@sukki37
sukki37 merged commit 0dac253 into matrixorigin:main May 17, 2024

@fengttt fengttt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which PR/Change did this one revert? Please link it in the PR comment.

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.

5 participants