Fix connection stats handling and add RESET STATS command - #1380
Open
rodneyosodo wants to merge 4 commits into
Open
Fix connection stats handling and add RESET STATS command#1380rodneyosodo wants to merge 4 commits into
rodneyosodo wants to merge 4 commits into
Conversation
Contributor
|
Would you change anything marked as |
levkk
reviewed
Aug 18, 2026
| let from = self.stats.lock(); | ||
| let mut to = other.stats.lock(); | ||
| to.mirror = from.mirror; | ||
| if !Arc::ptr_eq(&to.lookup, &from.lookup) { |
Collaborator
There was a problem hiding this comment.
I would put this assertion higher, before we take the lock, to avoid deadlocks. Basically, we want to make sure that self and other are never the same cluster object.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every
RELOAD(SIGHUP or admin command) zeroed all pool and cluster statistics. Operators currently misuseRELOADto reset counters, @ykonrad asked for a properRESET STATScommand.What's changed
Pool::move_conns_tonow copies the source pool'sstatsinto the destination pool (the one-line fix at the spot @levkk pointed to).Cluster::move_conns_tocarriesmirrorcounts and accumulates lookup-stats into the new cluster's Arc.RESET STATSadmin command: zeros pool stats, cluster mirror counts, and lookup stats across all databases/mirrors. Symmetric with what reload preserves.LookupStats::reset/accumulate,ClusterMetrics::reset,Shard/Databases::reset_stats.Verification
Manual run through pgdog confirms: queries counted → RELOAD preserved → RESET zeroed → counting resumes.