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

[YCQL] Correctly set release_version for system.peers queries #5407

Closed
m-iancu opened this issue Aug 15, 2020 · 1 comment
Closed

[YCQL] Correctly set release_version for system.peers queries #5407

m-iancu opened this issue Aug 15, 2020 · 1 comment
Assignees
Labels
area/ycql Yugabyte CQL (YCQL) good first issue This is a good issue to start contributing!

Comments

@m-iancu
Copy link
Contributor

m-iancu commented Aug 15, 2020

Currently the release_version column exists in the system.peers table and has the right type, but the value is not being set when producing the result for queries. Therefore its value is always returned as null.

Example

Start a cluster locally with:

./bin/yb-ctl create --rf 3

Connect with ycqlsh

./bin/ycqlsh

Check release version in system.local (should be set correctly)

select key, broadcast_address, release_version from system.local ;
 key   | broadcast_address | release_version
-------+-------------------+-----------------
 local |         127.0.0.1 |    3.9-SNAPSHOT

Check release version in system.peers (will be null)

select peer, release_version from system.peers;
 peer      | release_version
-----------+-----------------
 127.0.0.3 |            null
 127.0.0.2 |            null

Relevant code

The YCQL system tables are implemented as virtual tables, and the results for them are constructed in code.
Specifically for system.local the release version is set in yql_local_vtable.cc:LocalVTable::RetrieveData.
On the other hand for system.peers the column is indeed created in yql_peers_vtable.cc:PeersVTable::CreateSchema.
But its value is not set in yql_peers_vtable.cc:PeersVTable::RetrieveData.
Fix should be to set the value accordingly (also the value "3.9-SNAPSHOT" should probably become a const in a shared place like yql_local_vtable for code cleanliness).

Testing

The main test for YCQL system tables is TestSystemTables.java so we should add a test for this there (probably extend an existing test to check this value).
Note: the test can be ran using:

ybd --java-test org.yb.cql.TestSystemTables
@m-iancu m-iancu added good first issue This is a good issue to start contributing! area/ycql Yugabyte CQL (YCQL) labels Aug 15, 2020
@m-iancu m-iancu self-assigned this Aug 15, 2020
@m-iancu m-iancu removed their assignment Aug 15, 2020
@tedyu
Copy link
Contributor

tedyu commented Aug 18, 2020

release-ver.txt

Came up with a patch.

Trying to compose a test next.

tedyu added a commit that referenced this issue Aug 26, 2020
Summary:
Currently the release_version column exists in the system.peers table and has the right type, but the value
is not being set when producing the result for queries. Therefore its value is always returned as null.
For system.peers the column is indeed created in yql_peers_vtable.cc:PeersVTable::CreateSchema.
But its value is not set in yql_peers_vtable.cc:PeersVTable::RetrieveData.

This change sets the value accordingly.

Test Plan: Added assertion in TestSystemTables.java

Reviewers: mihnea

Reviewed By: mihnea

Subscribers: kannan, yql, ybase, bogdan

Differential Revision: https://phabricator.dev.yugabyte.com/D9181
@tedyu tedyu closed this as completed Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ycql Yugabyte CQL (YCQL) good first issue This is a good issue to start contributing!
Projects
None yet
Development

No branches or pull requests

2 participants