agent: Add more Rust code examples, update TODO check (#28737)
Release Notes: - N/A
This commit is contained in:
parent
d0f806456c
commit
b1e4e6048a
38 changed files with 142 additions and 2 deletions
3
crates/eval/examples/time_detail_merge_update/base.toml
Normal file
3
crates/eval/examples/time_detail_merge_update/base.toml
Normal file
|
@ -0,0 +1,3 @@
|
|||
url = "https://github.com/tikv/tikv.git"
|
||||
revision = "be74cadcdd6608e5788d0c2a6784c456b4ce84e6"
|
||||
language_extension = "rs"
|
|
@ -0,0 +1,5 @@
|
|||
1. **Function Modification**: The `write_time_detail` function has been refactored into `merge_time_detail` to modify the behavior of merging time details instead of overwriting them. The `merge_time_detail` function now adds new values to the existing ones, preserving the data and allowing for cumulative updates, which ensures more accurate tracking of time metrics.
|
||||
2. **Usage of New Function**: All instances where `write_time_detail` was called have been updated to use `merge_time_detail`, including in the `src/coprocessor/endpoint.rs`, `src/server/service/kv.rs`, `src/storage/txn/tracker.rs`, and test files. The modification ensures consistency across the codebase by merging time details rather than replacing them.
|
||||
3. **Test Coverage**: A new test, `test_select_time_details`, has been added in `tests/integrations/coprocessor/test_select.rs` to validate the proper functioning of time detail merging. The test checks that the `process_wall_time_ns` field is not zero, ensuring the correct time metrics are being tracked and merged.
|
||||
4. **Backward Compatibility**: The changes do not affect any external functionality or break compatibility. The merging of time details is backward-compatible, as it preserves existing values and adds new ones, which makes the system more flexible for future extensions.
|
||||
5. **Code Consistency**: The naming convention and function signature have been aligned with existing code practices, making the codebase more consistent and easier to maintain.
|
1
crates/eval/examples/time_detail_merge_update/prompt.md
Normal file
1
crates/eval/examples/time_detail_merge_update/prompt.md
Normal file
|
@ -0,0 +1 @@
|
|||
I want to refactor the existing time detail handling in the codebase. Specifically, I'd like to replace the `write_time_detail` function with a new `merge_time_detail` function, which will add new time details to the existing ones rather than overwriting them. This change should be applied across the codebase wherever `write_time_detail` is used, including in `src/coprocessor/endpoint.rs`, `src/server/service/kv.rs`, `src/storage/txn/tracker.rs`, and any related test cases. Please ensure that all occurrences of the old function are updated to use the new one. Additionally, add a test to validate that the `process_wall_time_ns` is correctly merged and is not zero, which will ensure the merging is functioning as intended. Make sure these changes preserve backward compatibility and do not introduce any regressions in functionality.
|
Loading…
Add table
Add a link
Reference in a new issue