Skip to content

refactor: remove or optmize some logging 3.0 - PART 1 - #23228

Merged
27 commits merged into
matrixorigin:3.0-devfrom
XuPeng-SH:optimize-logging-1
Dec 7, 2025
Merged

27 commits merged into
matrixorigin:3.0-devfrom
XuPeng-SH:optimize-logging-1

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Dec 6, 2025 •

Copy link
Copy Markdown
Contributor

User description

What type of PR is this?

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

Which issue(s) this PR fixes:

issue #23222

What this PR does / why we need it:

remove or optmize some logging 3.0 - PART 1


PR Type

Enhancement, Bug fix


Description

  • Optimize logging by removing verbose logs and standardizing log messages

    • Remove redundant "save profiles start/end" logs in debug.go
    • Remove low-value logs from catalog cache GC and database operations
    • Standardize log message format to use dot-separated keys (e.g., "save.profiles.loop.started")
  • Refactor error handling functions to directly call newError instead of intermediate wrappers

    • Consolidate *f (formatted) error functions to avoid unnecessary function call chains
    • Remove NewDataTruncated function and inline its logic
  • Fix CPU profile generation to handle already-in-use profiling gracefully

    • Add check for -cpu-profile flag to skip duplicate CPU profiling
    • Handle "cpu profiling already in use" error silently
  • Remove unused code and imports

    • Delete writeBlkReadStats method and related block read statistics logging
    • Remove unused imports (fmt, time, objectio, metadata) from stats_log_writer files
    • Remove debug logging from txnTable.getPartitionState
  • Improve error messages and logging consistency across engine operations

    • Update log field names to use hyphens (e.g., "table-id" instead of "tableId")
    • Consolidate error logging with structured zap fields

Diagram Walkthrough

flowchart LR
  A["Logging Optimization"] --> B["Remove Verbose Logs"]
  A --> C["Standardize Log Format"]
  D["Error Handling Refactor"] --> E["Consolidate Error Functions"]
  D --> F["Remove Intermediate Wrappers"]
  G["Code Cleanup"] --> H["Remove Unused Code"]
  G --> I["Remove Unused Imports"]
  J["Bug Fix"] --> K["CPU Profile Handling"]
  K --> L["Skip Duplicate Profiling"]
Loading

File Walkthrough

Relevant files
Enhancement, bug fix
1 files
debug.go
Optimize profile logging and fix CPU profiling                     
+16/-5   
Enhancement
14 files
server.go
Standardize profile save error logging                                     
+19/-4   
error.go
Refactor error functions to reduce call chains                     
+56/-33 
error_no_ctx.go
Add formatted error function for transaction stale             
+8/-2     
show_account.go
Remove low-value logging from account storage                       
+0/-2     
ddl.go
Standardize alter table error logging                                       
+7/-5     
batch_processor.go
Standardize aggregator logging messages                                   
+6/-7     
cron_task.go
Standardize new account storage usage logging                       
+7/-3     
stats_log_writer.go
Remove block read statistics logging code                               
+0/-37   
catalog.go
Remove timing logs from catalog cache GC                                 
+8/-8     
engine.go
Optimize engine logging and remove debug logs                       
+60/-36 
logtail_consumer.go
Standardize logtail consumer logging messages                       
+94/-57 
blocks_iter.go
Use formatted error function for transaction stale             
+5/-6     
mo_table_stats.go
Standardize table stats task logging format                           
+143/-99
txn_table.go
Comment out debug logging for mo_columns partition             
+8/-9     
Formatting
2 files
util.go
Improve function signature formatting                                       
+16/-3   
util.go
Improve function signature formatting                                       
+6/-1     
Tests
1 files
stats_log_writer_test.go
Remove block read statistics test                                               
+0/-42   

This pull request was closed.

This branch was previously deployed

1 inactive deployment
ci — fe0b777a Deployed Dec 7, 2025 by ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactor Code refactor Review effort 2/5 size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants