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

[JDBC Smart Driver] Incorrect host value being return in Kubernetes environment #9600

Closed
1 task
nchandrappa opened this issue Aug 5, 2021 · 1 comment
Closed
1 task
Assignees
Labels
area/ecosystem Label for all ecosystem related projects

Comments

@nchandrappa
Copy link
Contributor

nchandrappa commented Aug 5, 2021

I'm submitting a ...

  • [ X] bug report
  • feature request

Describe the issue
Incorrect hostname being set in Kubernetes environment when server_broadcast_addresses gflag is set for tservers. When server_broadcast_addresses is set to hostnode ip, yb_servers() functions incorrectly returning broadcast_address as pod ip_address.

YCQL Output of system.peers table -

ycqlsh> select * from system.peers;

 peer        | data_center | host_id                              | preferred_ip | rack  | release_version | rpc_address | schema_version                       | tokens
-------------+-------------+--------------------------------------+--------------+-------+-----------------+-------------+--------------------------------------+--------------------------
 10.142.0.26 | datacenter1 | 08ecd821-12b3-6fbb-b742-c0496617e0b5 |   10.64.4.21 | rack1 |    3.9-SNAPSHOT | 10.142.0.26 | 00000000-0000-0000-0000-000000000000 |  {'6148820866244280320'}
 10.142.0.33 | datacenter1 | 111a14ca-12b0-77ba-734d-8c42a176dffd |   10.64.3.30 | rack1 |    3.9-SNAPSHOT | 10.142.0.33 | 00000000-0000-0000-0000-000000000000 | {'-6149102341220990976'}

YSQL yb_servers() output -

yugabyte=# select * from yb_servers();
    host     | port | num_connections | node_type | cloud  |   region    | zone  |  public_ip
-------------+------+-----------------+-----------+--------+-------------+-------+-------------
 10.142.0.32 | 5433 |               0 | primary   | cloud1 | datacenter1 | rack1 | 10.142.0.32
 10.142.0.26 | 5433 |               0 | primary   | cloud1 | datacenter1 | rack1 | 10.142.0.26
 10.142.0.33 | 5433 |               0 | primary   | cloud1 | datacenter1 | rack1 | 10.142.0.33
(3 rows)

host column should be set to pod ip_address. Refer to preferred_ip column in system.peers table.

To Reproduce
setup a YugabyteDB 2.7.2.0-b216 using Helm Chart and run SELECT * FROM yb_servers();

Expected behaviour
host value should be set to pod ip_address.

@nchandrappa nchandrappa added the area/ecosystem Label for all ecosystem related projects label Aug 5, 2021
kneeraj added a commit that referenced this issue Aug 13, 2021
…etes environment

Summary:
The value of the 'host' column in the result of //yb_servers// function in Kubernetes environment is incorrect when server_broadcast address is also set for tservers. The value in 'host' should be exactly same as what the 'preferred_ip' shows while querying "system.peers" ycql table. This value is correct when server broadcast address is not passed in the startup argument. But when that is passed then this starts showing the value of what was passed for server broadcast address instead.

Additionally, this change also addresses some code review comments which on git commit: 6df6555 as pointed by @d-uspenskiy

- Use iterator on the returned server list instead of using 'at' to avoid throwing exception
- Refactor the code to move the pgalloc function call out from PgSession to pggate layer to avoid tight coupling of pg layer and the ybase layer.
- Proper return value checks at a couple of places.
- This also includes a change from @d-uspenskiy to make compiler warn about return value not being handled from function returning 'Status'

Test Plan: Tested with the unit test TestLoadBalance, manual testing and demo sample apps in jdbc-yugabtedb repository.

Reviewers: dmitry

Reviewed By: dmitry

Subscribers: dmitry, mihnea, zyu, yql

Differential Revision: https://phabricator.dev.yugabyte.com/D12494
@kneeraj
Copy link
Contributor

kneeraj commented Sep 3, 2021

Fixed in revision: c09d3c8 of the yugabytedb core repository.

@kneeraj kneeraj closed this as completed Sep 3, 2021
@kneeraj kneeraj added this to Done in YSQL Smart Driver Dec 21, 2021
@kneeraj kneeraj moved this from Done to To do in YSQL Smart Driver Dec 21, 2021
@kneeraj kneeraj moved this from To do to Done in YSQL Smart Driver Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ecosystem Label for all ecosystem related projects
Projects
Development

No branches or pull requests

2 participants