Skip to content
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

Describe VIEW for YDB CLI #9513

Merged
merged 5 commits into from
Oct 10, 2024

Conversation

jepett0
Copy link
Collaborator

@jepett0 jepett0 commented Sep 19, 2024

We want YDB CLI to return view query text on ydb scheme describe view_to_describe command.

There is no generic GRPC service that can return SchemeShard's private protobuf info to YDB CLI. Ideally, we would like to implement informational tables that contain up-to-date information about the objects in the scheme. However, this is a great undertaking and it will delay the first release of views significantly.

We have decided to add a dedicated GRPC service for views and add (for now) only the DescribeView call there. (Eventually, we would also add CreateView, AlterView and DropView calls if users asked.) This approach seems to be the currently adopted one across YDB. See the recently added replication service and object storage service which both have a single RPC in them.

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

@@ -543,6 +545,19 @@ int TCommandDescribe::DescribeReplication(const TDriver& driver) {
return PrintDescription(this, OutputFormat, result, &TCommandDescribe::PrintReplicationResponsePretty);
}

int TCommandDescribe::PrintViewResponsePretty(const NYdb::NView::TDescribeViewResult& result) const {
Cout << "\nQuery text: " << result.GetViewDescription().GetQueryText() << Endl;
Copy link
Collaborator Author

@jepett0 jepett0 Sep 19, 2024

Choose a reason for hiding this comment

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

The output looks like this:

  • basic example, the view exists
...$ ydb scheme describe v
<view> v

Query text:
select * from t
  • the view does not exist
...$ ydb scheme describe vvv
Status: SCHEME_ERROR
Issues: 
<main>: Error: Path not found
  • the view has captured the TablePathPrefix pragma
...$ ydb scheme describe path/to/a/folder/v
<view> v

Query text:
PRAGMA TablePathPrefix = "/Root/dedicated/path/to/a/folder";
select * from `/Root/dedicated/v`
  • describe of a view in json format (note: self value is replaced with ...)
$ ydb scheme describe --format proto-json-base64 v
<view> v
{"self":{...},"query_text":"select * from t"}

Copy link
Member

@CyberROFL CyberROFL left a comment

Choose a reason for hiding this comment

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

lgtm

SetDatabase(ev.get(), *Request_);
ev->Record.MutableDescribePath()->SetPath(GetProtoRequest()->path());

Send(MakeTxProxyID(), ev.release());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If you are wondering, all describe requests sent to tx proxy are going through both:

  • scheme cache (with sync version flag) to retrieve the path's SchemeShard id
  • SchemeShard to retrieve the most up-to-date info about the path

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

@jepett0 jepett0 marked this pull request as ready for review September 23, 2024 21:50
@jepett0 jepett0 requested review from ijon and CyberROFL September 23, 2024 21:50
CyberROFL
CyberROFL previously approved these changes Sep 24, 2024
ijon
ijon previously approved these changes Sep 24, 2024
@jepett0 jepett0 dismissed stale reviews from ijon and CyberROFL via 770d9be October 10, 2024 06:03
Copy link

github-actions bot commented Oct 10, 2024

2024-10-10 06:10:16 UTC Pre-commit check linux-x86_64-relwithdebinfo for 56cafd4 has started.
2024-10-10 06:10:27 UTC Artifacts will be uploaded here
2024-10-10 06:13:40 UTC ya make is running...
🟡 2024-10-10 07:20:48 UTC Some tests failed, follow the links below. Going to retry failed tests...

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
79982 66024 0 1 13851 106

2024-10-10 07:28:28 UTC ya make is running... (failed tests rerun, try 2)
🟢 2024-10-10 07:39:57 UTC Tests successful.

Test history | Ya make output | Test bloat | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
105 (only retried tests) 6 0 0 0 99

🟢 2024-10-10 07:40:04 UTC Build successful.
🟡 2024-10-10 07:40:22 UTC ydbd size 2.8 GiB changed* by +1.2 MiB, which is >= 100.0 KiB vs main: Warning

ydbd size dash main: 0d12e54 merge: 56cafd4 diff diff %
ydbd size 3 012 071 664 Bytes 3 013 323 880 Bytes +1.2 MiB +0.042%
ydbd stripped size 477 602 232 Bytes 477 743 384 Bytes +137.8 KiB +0.030%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Copy link

github-actions bot commented Oct 10, 2024

2024-10-10 06:10:28 UTC Pre-commit check linux-x86_64-release-asan for 56cafd4 has started.
2024-10-10 06:10:39 UTC Artifacts will be uploaded here
2024-10-10 06:13:47 UTC ya make is running...
🟡 2024-10-10 08:01:08 UTC Some tests failed, follow the links below. This fail is not in blocking policy yet

Test history | Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
17141 16880 0 76 79 106

🟢 2024-10-10 08:02:49 UTC Build successful.
🔴 2024-10-10 08:03:20 UTC ydbd size 5.7 GiB changed* by +2.5 MiB, which is >= 2.0 MiB vs main: Alert

ydbd size dash main: 0d12e54 merge: 56cafd4 diff diff %
ydbd size 6 103 926 536 Bytes 6 106 595 832 Bytes +2.5 MiB +0.044%
ydbd stripped size 1 520 996 016 Bytes 1 521 537 840 Bytes +529.1 KiB +0.036%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@jepett0 jepett0 requested review from ijon and CyberROFL October 10, 2024 09:50
@jepett0 jepett0 merged commit 1bfcec4 into ydb-platform:main Oct 10, 2024
10 checks passed
jepett0 added a commit to jepett0/ydb that referenced this pull request Oct 11, 2024
jepett0 added a commit to jepett0/ydb that referenced this pull request Oct 14, 2024
jepett0 added a commit to jepett0/ydb that referenced this pull request Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants