Skip to content

refactor: add query_profile and query_details persistent log tables #17702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 16, 2025

Conversation

dqhl76
Copy link
Collaborator

@dqhl76 dqhl76 commented Apr 3, 2025

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

Summary

This PR included:

  1. Added persistent log tables query_profile and query_details
  2. Refactored code to simplify the process of adding new tables to the persistent_system
  3. Implemented schema migration support (by renaming and recreation)

We will have three tables (if enable in config):

select * from persistent_system.query_log;
select * from persistent_system.query_profile;
select * from persistent_system.query_details;

Tests

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

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

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 Apr 3, 2025
@dqhl76 dqhl76 marked this pull request as ready for review April 7, 2025 00:37
@dqhl76 dqhl76 requested review from zhang2014 and Copilot April 7, 2025 00:37
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • tests/logging/check_logs_table.sh: Language not supported
Comments suppressed due to low confidence (3)

src/query/service/src/persistent_log/global_persistent_log.rs:242

  • [nitpick] Consider quoting the table_name with backticks for consistency with the rename_target formatting to prevent potential SQL parsing issues.
let rename = format!("ALTER TABLE persistent_system.{} RENAME TO {}", table_name, rename_target);

src/common/tracing/src/init.rs:386

  • The removal of the cfg.profile.dir.is_empty() check may enable profile logging even when no profile directory is configured; please verify that this change is intentional.
if cfg.profile.on {

src/common/tracing/src/init.rs:393

  • Similarly, the removal of the cfg.query.dir.is_empty() check could enable query logging without a proper directory setting; ensure that this behavior is expected.
if cfg.query.on {

@dqhl76 dqhl76 force-pushed the refine-log-table branch from 35588e7 to 137cff0 Compare April 10, 2025 06:05
@dqhl76 dqhl76 force-pushed the refine-log-table branch from 96f16ad to e253167 Compare April 14, 2025 13:50
clippy
@dqhl76 dqhl76 force-pushed the refine-log-table branch from 1861727 to 6a9c323 Compare April 14, 2025 15:07
@dqhl76 dqhl76 added the ci-benchmark Benchmark: run all test label Apr 15, 2025
Copy link
Contributor

Docker Image for PR

  • tag: pr-17702-592ba19-1744685528

note: this image tag is only available for internal use.

@dqhl76 dqhl76 requested a review from zhang2014 April 15, 2025 03:32
@dqhl76 dqhl76 removed the ci-benchmark Benchmark: run all test label Apr 15, 2025
@zhang2014 zhang2014 merged commit da9c843 into databendlabs:main Apr 16, 2025
218 of 220 checks passed
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.

2 participants