Skip to content

Conversation

@yezizp2012
Copy link
Member

@yezizp2012 yezizp2012 commented Jan 9, 2023

I hereby agree to the terms of the Singularity Data, Inc. Contributor License Agreement.

What's changed and what's your intention?

To support superset, implement system table pg_stat_activity and a workaround of pg_cancel_backend/pg_terminate_backend.

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • All checks passed in ./risedev check (or alias, ./risedev c)

Documentation

If your pull request contains user-facing changes, please specify the types of the changes, and create a release note. Otherwise, please feel free to remove this section.

Types of user-facing changes

Please keep the types that apply to your changes, and remove those that do not apply.

  • SQL commands, functions, and operators

Introduced a system catalog pg_stat_activity.
Introduced some functions:

  • pg_cancel_backend: Cancel a backend's current query. You can execute this against another backend that has exactly the same role as the user calling the function. In all other cases, you must be a superuser.
  • pg_terminate_backend: Terminate a backend. You can execute this against another backend that has exactly the same role as the user calling the function. In all other cases, you must be a superuser.
  • pg_backend_pid: Process ID of the server process attached to the current session.

Release note

Support system catalog pg_stat_activity, and some functions like: pg_cancel_backend, pg_terminate_backend and pg_backend_pid.

Refer to a related PR or issue link (optional)

A workaround of #6891

@github-actions github-actions bot added the type/feature Type: New feature. label Jan 9, 2023
@yezizp2012 yezizp2012 changed the title feat(frontend): workaround of pg_stat_activity/pg feat(frontend): support pg_stat_activity and an workaround of pg_cancel_backend/pg_terminate_backend Jan 9, 2023
@yezizp2012 yezizp2012 requested review from fuyufjh and hzxa21 January 9, 2023 12:53
@codecov
Copy link

codecov bot commented Jan 9, 2023

Codecov Report

Merging #7274 (7bf2a15) into main (0988ff3) will decrease coverage by 0.01%.
The diff coverage is 22.72%.

@@            Coverage Diff             @@
##             main    #7274      +/-   ##
==========================================
- Coverage   73.02%   73.01%   -0.02%     
==========================================
  Files        1066     1066              
  Lines      170189   170211      +22     
==========================================
- Hits       124279   124277       -2     
- Misses      45910    45934      +24     
Flag Coverage Δ
rust 73.01% <22.72%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ntend/src/catalog/system_catalog/pg_catalog/mod.rs 0.00% <0.00%> (ø)
src/frontend/src/binder/expr/function.rs 80.09% <17.64%> (-2.50%) ⬇️
src/frontend/src/binder/mod.rs 100.00% <100.00%> (ø)
src/frontend/src/catalog/system_catalog/mod.rs 70.31% <100.00%> (+0.47%) ⬆️
src/storage/src/hummock/sstable/bloom.rs 96.59% <0.00%> (-2.28%) ⬇️
src/meta/src/hummock/mock_hummock_meta_client.rs 64.73% <0.00%> (-0.53%) ⬇️
...rc/storage/hummock_sdk/src/filter_key_extractor.rs 92.32% <0.00%> (-0.26%) ⬇️
src/common/src/cache.rs 97.31% <0.00%> (-0.23%) ⬇️
src/object_store/src/object/mod.rs 51.29% <0.00%> (-0.22%) ⬇️
src/storage/src/hummock/sstable_store.rs 64.72% <0.00%> (-0.19%) ⬇️
... and 3 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Collaborator

@hzxa21 hzxa21 left a comment

Choose a reason for hiding this comment

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

Can we also implement a workaround for pg_backend_pid()?
Usage in superset: https://github.com/apache/superset/blob/5b67e0712d5d3c738abf3281e67755af741c5c01/superset/db_engine_specs/postgres.py#L316

Btw, are the changes in dashboard/proto/gen expected?

Rest LGTM

@yezizp2012
Copy link
Member Author

yezizp2012 commented Jan 9, 2023

Can we also implement a workaround for pg_backend_pid()? Usage in superset: https://github.com/apache/superset/blob/5b67e0712d5d3c738abf3281e67755af741c5c01/superset/db_engine_specs/postgres.py#L316

Sure, added in this PR.

Btw, are the changes in dashboard/proto/gen expected?

Yes, the changes in dashboard/proto/gen are due to some previously merged PRs that forgot to generate. 🥵

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/feature Type: New feature. user-facing-changes Contains changes that are visible to users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants