Understand SessionClient topology and ownership
mainThe SessionClient manages the lifecycle and pooling of Bigtable sessions. Understanding its hierarchy is critical for resource management:
- Client to SessionClient (1:1): A
bigtable.Clientowns exactly oneSessionClient. All session-eligible operations on that client use the sameSessionClientinstance. - SessionClient to SessionPools (1:N): A single
SessionClientmanages multiple session pools, which are lazily created and keyed by{resource, direction}(e.g., a specific table and whether it is forreadorwrite). - Pool Deduplication: Multiple calls to
OpenTable,OpenAuthorizedView, orOpenMaterializedViewfor the same resource and direction will return handles backed by the same underlying pool pair within a singleSessionClient. - Lazy Creation: Pools and individual sessions are not created at initialization. A pool is only opened when the first operation (like
ReadRoworApply) is issued. Failed opens are not cached, allowing for automatic retries on transient errors.