Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert all stats from INT8 -> NUMERIC(20, 0) #401

Closed
wants to merge 3 commits into from

Conversation

stanhu
Copy link

@stanhu stanhu commented Aug 3, 2019

Internally these statistics are stored as unsigned 64-bit values,
but the PostgreSQL INT8 types can only express signed 64-bit values.
Convert all the stats to NUMERIC(20, 0) to avoid losing data.

Closes #360

@stanhu stanhu force-pushed the sh-format-pg-stats-numeric branch from 3e539dd to 03ed622 Compare August 3, 2019 14:17
@stanhu stanhu changed the title Convert all stats from UINT8 -> NUMERIC(20, 0) Convert all stats from INT8 -> NUMERIC(20, 0) Aug 3, 2019
@stanhu stanhu force-pushed the sh-format-pg-stats-numeric branch from 809e635 to 2f96bef Compare August 3, 2019 22:52
Internally these statistics are stored as unsigned 64-bit values,
but the PostgreSQL INT8 types can only express signed 64-bit values.
Convert all the stats to NUMERIC(20, 0) to avoid losing data.

Closes pgbouncer#360
@stanhu stanhu force-pushed the sh-format-pg-stats-numeric branch from 688f4ea to 9136559 Compare August 4, 2019 04:43
Improve documentation for NUMERIC typmod
@stanhu stanhu force-pushed the sh-format-pg-stats-numeric branch from 9136559 to e8c1aed Compare August 7, 2019 07:15
@stanhu
Copy link
Author

stanhu commented Aug 7, 2019

@petere Would you mind reviewing?

Copy link
Member

@petere petere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good at first glance. I'll work on integrating this.

@stanhu
Copy link
Author

stanhu commented Aug 21, 2019

@petere Friendly ping. We got bit by recently by a problem with not having metrics for a subset of our PgBouncer hosts. Can we look into rolling this in soon?

@petere
Copy link
Member

petere commented Aug 23, 2019

I want to go through all the admin and stats commands and check for similar data type mismatch/overflow problems. I think there are a few more. It will need a bit more time.

petere added a commit to petere/pgbouncer that referenced this pull request Sep 9, 2019
Internally, most statistiscs are kept as uint64_t.  Sending those
with a row descriptor that claims they are bigint can lead to problems
if uint64_t values can overflow the signed 64-bit integer range.  Then
a client library that wants to convert the value to its locally
appropriate signed 64-bit integer type would run into errors.

based on patch by @stanhu

fixes pgbouncer#360 pgbouncer#401
@petere
Copy link
Member

petere commented Sep 9, 2019

a fix has been committed

@petere petere closed this Sep 9, 2019
@stanhu
Copy link
Author

stanhu commented Oct 2, 2019

@petere Thanks, could you cut a new release for PgBouncer?

@petere
Copy link
Member

petere commented Oct 3, 2019

yes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants