Patches
Search the entire project
This project's trackers
This project's releases
This project's news
Project
People
Skill
Advanced search
Log In
|
New Account
Home
My Page
Projects
Code Snippets
Project Openings
PgBouncer
Summary
Activity
Tracker
Lists
News
Files
[#1011107] Add the ability to log queries being sent by the client...
View Trackers
|
Patches
|
Download .csv
|
Monitor
Date:
2011-10-16 16:54
Priority:
3
State:
Open
Submitted by:
Sean Chittenden (
seanc
)
Assigned to:
Marko Kreen (mkz)
Category:
Group:
Resolution:
None
Summary:
Add the ability to log queries being sent by the client...
Detailed description
In rare circumstances I've had failing Pg installs (due to bad hardware) crash before logging messages are fired off. The following makes it easier to diagnose problems. This isn't ideal, but hopefully it's workable. -sc
Index: src/client.c
===================================================================
RCS file: /cvsroot/pgbouncer/pgbouncer/src/client.c,v
retrieving revision 1.31
diff -u -r1.31 client.c
--- src/client.c 19 Jul 2010 07:30:15 -0000 1.31
+++ src/client.c 16 Oct 2011 16:53:06 -0000
@@ -295,6 +295,9 @@
/* one-packet queries */
case 'Q': /* Query */
+ if (pkt->type == 'Q') {
+ slog_noise(client, "Client sent query (%d): %.*s", mbuf_size(&pkt->data), mbuf_size(&pkt->data), mbuf_get_string(&pkt->data));
+ }
case 'F': /* FunctionCall */
/* copy end markers */
Followup
Message
Date: 2012-05-29 21:59
Sender:
Marko Kreen
Well, it fails if query does not fit buffer.
Also there are many places that cannot allow to be run with noise log level.
And it does not log extended queries.
Yes, it can be useful in specific circumstances, even common ones, but it does not look like it can be improved to have generic logging solution in pgbouncer.
Date: 2012-05-29 21:19
Sender:
Sean Chittenden
What would you like to see in addition to this?
This patch has saved me a few times now, notably when the database has some internal block corruption, the query is never logged by PostgreSQL in those cases, so having pgbouncer log things is invaluable when trying to find the problematic set of ctids.
Date: 2012-05-29 21:11
Sender:
Marko Kreen
Seems I have not commented here yet. Sorry.
Basically, I don't agree that it's robust enough functionality to be in main product.
But I leave the patch open, so if anyone requires this get get the patch here. As a quick hack to get SQL log from pgbouncer, it's fine.
Attached Files:
Attachments:
pgbouncer-src-client.c.patch
Changes:
Field
Old Value
Date
By
assigned_to
none
2012-05-29 21:59
mkz
File Added
693: pgbouncer-src-client.c.patch
2011-10-16 16:54
seanc