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 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 stanhu:sh-format-pg-stats-numeric branch from 3e539dd to 03ed622 Aug 3, 2019
@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 stanhu:sh-format-pg-stats-numeric branch from 809e635 to 2f96bef Aug 3, 2019
stanhu added 2 commits 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 stanhu:sh-format-pg-stats-numeric branch from 688f4ea to 9136559 Aug 4, 2019
Improve documentation for NUMERIC typmod
@stanhu stanhu force-pushed the stanhu:sh-format-pg-stats-numeric branch from 9136559 to e8c1aed Aug 7, 2019
@stanhu

This comment has been minimized.

Copy link
Author

stanhu commented Aug 7, 2019

@petere Would you mind reviewing?

Copy link
Contributor

petere left a comment

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

@stanhu

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

petere commented Sep 9, 2019

a fix has been committed

@petere petere closed this Sep 9, 2019
@stanhu

This comment has been minimized.

Copy link
Author

stanhu commented Oct 2, 2019

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

@petere

This comment has been minimized.

Copy link
Contributor

petere commented Oct 3, 2019

yes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.