-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#21904] DocDB: Fetch remote TServer proxy from the local TServer as …
…opposed to fetching from Meta Cache Summary: The `GetLockStatus` is an RPC endpoint in pg_client_service that fetches info about currently held transactional locks in the cluster. This RPC issued by pggate and serviced by the pg_client_service in the local tserver proxy. In the existing implementation, as a part of this RPC, the local tserver fetches a list of "live" tserver UUIDs. This list is populated/refreshed from tserver <-> master heartbeat path. For each of the fetched UUIDs, the tserver then attempts to fetch a handle to the remote tserver from the local meta cache. The meta cache might not have the a remote tserver's connection info unless the tserver in question processed some `GetTabletLocation(s)` responses that fetched the remote tserver's connection info (a replica of the tablet would have been hosted on the remote tserver). This discrepancy produces a crash when the local tserver attempts to fetch the remote tserver's handle from the local meta cache. **Note that this bug only exists in the `pg_locks`/`CancelTransaction` codepaths.** This revision fetches the remote tserver handle from the local tserver instead. We already have all the required info to build a proxy/handle to the remote tserver (this data is fetched as part of master - tserver heartbeats). While updating the set of `live_tservers_` (after every successful master-tserver heartbeat exchange), we also create `RemoteTabletServer` ptrs and initialize the proxy handles if the `RemoteTabletServer` doesn't already exist. All calls `GetRemoteTabletServers` now pick the shared ptrs from `remote_tserver_`. The new approach is probably better since it doesn't add latency in the meta cache path for all `pg_locks`/`CancelTransaction` calls. The diff also reverts changes to meta cache introduced in commit 75ad3df. The quoted commit changed `unique_ptr<RemoteTabletServer>` stored at the meta cache layer to use shared ptrs instead. And these shared ptrs were being used in the `pg_locks`/`CancelTransaction` codepaths. Now that we don't need to fetch `RemoteTabletServer` ptrs from meta_cache, reverting back to unique pts for the meta cache layer. Jira: DB-10802 Test Plan: Run the following test: ``` ./yb_build.sh --cxx-test='TEST_F(PgGetLockStatusTest, TestPgLocksOutputAfterNodeOperations) {' ``` To manually test the issue, run the following ybd commands: ``` # Destroy any existing cluster ./bin/yugabyted destroy --base_dir ~/yb_01 ./bin/yugabyted destroy --base_dir ~/yb_02 ... # Create a new cluster ./bin/yugabyted start --advertise_address=127.0.0.1 --base_dir=~/yb_01 # Add a new node to the cluster ./bin/yugabyted start --advertise_address=127.0.0.2 --join 127.0.0.1 --base_dir=~/yb_02 ./bin/ysqlsh -h 127.0.0.1 -c "SELECT * FROM pg_locks;" ``` Reviewers: mlillibridge, hsunder, rsami, kramanathan Reviewed By: hsunder, kramanathan Subscribers: bkolagani, smishra, ybase, yql Differential Revision: https://phorge.dev.yugabyte.com/D34564
- Loading branch information
1 parent
e6b5f35
commit cfab020
Showing
12 changed files
with
209 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.