Skip to content

Conversation

@drmingdrmer
Copy link
Member

@drmingdrmer drmingdrmer commented Sep 3, 2025

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

refactor(meta): extract utilities from monolithic util.rs

Transform the large util.rs file (561 lines) into 8 focused utility modules
to improve code organization, maintainability, and developer experience.

PROBLEM:

  • Monolithic util.rs with 561 lines and 16 scattered functions
  • Inconsistent import patterns across 39 API files
  • 165+ occurrences of duplicated transaction utilities
  • Poor discoverability and maintainability

SOLUTION:
Applied incremental refactoring with backward compatibility:

EXTRACTED MODULES:

  • txn_condition_util.rs - Transaction condition builders (txn_cond_eq_seq, txn_cond_seq)
  • txn_retry_util.rs - Transaction retry patterns (txn_backoff re-export)
  • serialization_util.rs - Data serialization (serialize_struct, deserialize_struct, etc.)
  • error_util.rs - Error construction (6 functions from util.rs, database_util.rs, schema_api.rs)
  • kv_fetch_util.rs - KV operations (get_u64_value, fetch_id, 4 others)
  • txn_op_builder_util.rs - Transaction builders (txn_put_pb, txn_op_del, 3 others)
  • txn_core_util.rs - Core transactions (send_txn, txn_delete_exact, txn_replace_exact)
  • data_retention_util.rs - Retention logic (is_drop_time_retainable, get_retention_boundary)

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Other

Related Issues


This change is Reviewable

@github-actions github-actions bot added the pr-refactor this PR changes the code base without new features or bugfix label Sep 3, 2025
@drmingdrmer drmingdrmer marked this pull request as ready for review September 3, 2025 13:35
Transform the large util.rs file (561 lines) into 8 focused utility modules
to improve code organization, maintainability, and developer experience.

PROBLEM:
- Monolithic util.rs with 561 lines and 16 scattered functions
- Inconsistent import patterns across 39 API files
- 165+ occurrences of duplicated transaction utilities
- Poor discoverability and maintainability

SOLUTION:
Applied incremental refactoring with backward compatibility:

EXTRACTED MODULES:
- txn_condition_util.rs - Transaction condition builders (txn_cond_eq_seq, txn_cond_seq)
- txn_retry_util.rs - Transaction retry patterns (txn_backoff re-export)
- serialization_util.rs - Data serialization (serialize_struct, deserialize_struct, etc.)
- error_util.rs - Error construction (6 functions from util.rs, database_util.rs, schema_api.rs)
- kv_fetch_util.rs - KV operations (get_u64_value, fetch_id, 4 others)
- txn_op_builder_util.rs - Transaction builders (txn_put_pb, txn_op_del, 3 others)
- txn_core_util.rs - Core transactions (send_txn, txn_delete_exact, txn_replace_exact)
- data_retention_util.rs - Retention logic (is_drop_time_retainable, get_retention_boundary)
@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2025

🤖 Smart Auto-retry Analysis

Workflow: 17493483398

📊 Summary

  • Total Jobs: 83
  • Failed Jobs: 1
  • Retryable: 0
  • Code Issues: 1

NO RETRY NEEDED

All failures appear to be code/test issues requiring manual fixes.

🔍 Job Details

  • linux / test_compat_client_cluster: Not retryable (Code/Test)

🤖 About

Automated analysis using job annotations to distinguish infrastructure issues (auto-retried) from code/test issues (manual fixes needed).

@drmingdrmer drmingdrmer merged commit 296e072 into databendlabs:main Sep 5, 2025
87 of 90 checks passed
@drmingdrmer drmingdrmer deleted the x7 branch September 5, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-refactor this PR changes the code base without new features or bugfix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant