Summary:
Original commit: 77a723d3e4d / D42993
We observe the query id as 0 in some cases, mostly this is due to these reasons -
1. We sample before updating the metadata
2. The RPC is sent by the master (we don't have metadata passing through master yet)
3. The RPC is handed off to another thread and we didn't inherit the wait state in the other thread
This diff attempts to solve 3 in the read - write paths by adopting the wait state pointer
when we are changing threads.
Summary of changes -
- Store the current thread local wait state pointer in the YBTransaction::Impl object, we use this to update the wait state pointer when changing threads in the transaction layer
- Pass ASH metadata with UpdateTransaction and AbortTransaction RPCs
- Add YBClient_LookingUpTablet wait states when we wait for tablet information in meta_cache.cc
Jira: DB-16198
**Upgrade/Downgrade safety:**
The field added is optional, if the field is not present, then ASH will not have some metadata, which is fine during upgrades/rollbacks
Test Plan:
New unit test added
./yb_build.sh --cxx-test wait_states-itest --gtest_filter WaitStateITest/AshTestVerifyOccurrence.VerifyWaitStateEntered/kYBClient_WaitingOnMaster
Manual testing
Ran the yb-sample-apps workload
```
java -jar yb-sample-apps.jar --workload SqlInserts --nodes 127.0.0.1:5433
java -jar yb-sample-apps.jar --workload SqlSecondaryIndex --nodes 127.0.0.1:5433
java -jar yb-sample-apps.jar --workload SqlSnapshotTxns --nodes 127.0.0.1:5433
```
No "0 query id" samples with wait states other than OnCpu_Active and OnCpu_Passive were observed
Reviewers: amitanand, hsunder, mlillibridge
Reviewed By: amitanand
Subscribers: yql, hbhanawat
Differential Revision: https://phorge.dev.yugabyte.com/D43594