You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
150991: pgwire: limit concurrent updates to last_login_time r=rafiss a=rafiss
### pgwire: limit concurrent updates to last_login_time
This patch uses singleflight to ensure that each node only has one
request in flight for updating the last_login_time. If there already is
a request in flight, then that user is added to a set of pending users
to update, and their time gets populated in the next singleflight.
This will reduce write traffic to the system.users table.
This includes a minor refactor to separate the login_time updating logic
into a separate component.
As part of this, we also now skip updating the last_login_time if running in
a read-only tenant.
### sql/pgwire: use a single query to update last_login_time
Rather than using a separate query for each user, now we will run one
query to update multiple users at once.
### sql/pgwire: avoid frequent updates to last_login_time
This patch adds a small LRU cache to avoid updating the
estimated_last_login_time overly frequently for a single user. The cache
will cause us to skip the update if the user's login time was last
updated within the past 10 minutes.
This requires us to update the tests to use a different user, since the
existing test drops `testuser` and recreates, which means that the
last_login_time will not be updated for that user as it's still in the
LRU cache.
----
fixes#151051fixes#150560
Release note: None
151041: security: fix memory accounting issue in client certificate cache r=angles-n-daemons a=angles-n-daemons
The client certificate cache is a simple utility cache which keeps track of the nearest certificate expiration times by user. It does this by reading in certificates as they are used, and then updating the gauge associated with the user so that our operators can alert on expiring certificates.
It has been identified that there is a memory accounting issue with this utility class, in that if we see the same certificate multiple times, we report that our cache is growing for each one. In reality however, though we may change the reference in our cache, the old value will be cleaned up, and memory should remain relatively low.
This PR both fixes the accounting bug, and adds a limit so that the client certificate cache can't negatively affect SQL operation.
Epic: none
Fixes: #151040
Release note: Fixes a memory accounting issue with the client certificate cache, where we were accidentally reporting multiple allocations for the same memory.
Co-authored-by: Rafi Shamim <[email protected]>
Co-authored-by: Brian Dillmann <[email protected]>
0 commit comments