Bug #250 - set GUC for application name in log shipper daemon
authorChristopher Browne <cbbrowne@ca.afilias.info>
Tue, 15 Nov 2011 17:41:39 +0000 (12:41 -0500)
committerChristopher Browne <cbbrowne@ca.afilias.info>
Tue, 22 Nov 2011 20:48:17 +0000 (15:48 -0500)
RELEASE
src/slony_logshipper/slony_logshipper.c

diff --git a/RELEASE b/RELEASE
index d13bb92c5c455f3fc74fb769a3d83755cc1743b2..0f1af5af1f515e68d1d35c79b37022732202fed2 100644 (file)
--- a/RELEASE
+++ b/RELEASE
@@ -1,6 +1,9 @@
 #+OPTIONS: ^:{}
 * Slony-I Release Notes
 
+** 2.2.0
+- Bug #250 :: Log shipper does not report application name - add in setting of GUC
+
 ** 2.1.1
 
 - Bug #246 :: Include path order changes
index 8df9f616740354fac0e8cf0f8610f90adf716bb2..73ade1b610f737ab2f331bcf4de471b327d8890c 100644 (file)
@@ -1225,6 +1225,7 @@ static int
 get_current_at_counter(void)
 {
        SlonDString             ds;
+       SlonDString     query;
        PGresult           *res;
        char               *s;
 
@@ -1252,6 +1253,26 @@ get_current_at_counter(void)
                PQsetNoticeProcessor(dbconn, notice_processor, NULL);
        }
 
+       dstring_init(&query);
+       slon_mkquery(&query,"select 1 from pg_catalog.pg_settings where name= 'application_name'; ");
+       res = PQexec (dbconn, dstring_data(&query));
+       
+       if (PQresultStatus(res) != PGRES_TUPLES_OK)
+                       return -1;
+       dstring_free(&query); 
+
+       if (PQntuples(res) == 0)
+       {
+                       PQclear(res);
+       } else {
+                       PQclear(res);
+                       dstring_init(&query);
+                       slon_mkquery(&query,"SET application_name TO 'slony_logshipper'; ");
+                       res=PQexec(dbconn, dstring_data(&query));
+                       dstring_free(&query); 
+                       PQclear(res);
+       }
+
        dstring_init(&ds);
        slon_mkquery(&ds, "select at_counter from %s.sl_archive_tracking;",
                        namespace);