Tue Dec 22 09:10:13 PST 2009
- Previous message: [Slony1-commit] slony1-www/content news.txt
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /home/cvsd/slony1/slony1-engine/src/slon In directory main.slony.info:/tmp/cvs-serv13385/src/slon Modified Files: Tag: REL_1_2_STABLE cleanup_thread.c remote_listen.c Log Message: Fixing a memory leak in cleanup thread. It left an orphaned PG result behind every time it switched to/from LISTENing. Correct some code formatting. Jan Index: remote_listen.c =================================================================== RCS file: /home/cvsd/slony1/slony1-engine/src/slon/remote_listen.c,v retrieving revision 1.31.2.4 retrieving revision 1.31.2.5 diff -C2 -d -r1.31.2.4 -r1.31.2.5 *** remote_listen.c 17 Aug 2009 17:39:57 -0000 1.31.2.4 --- remote_listen.c 22 Dec 2009 17:10:10 -0000 1.31.2.5 *************** *** 279,282 **** --- 279,284 ---- continue; } + PQclear(res); + rc = db_getLocalNodeId(dbconn); if (rc != node->no_id) *************** *** 319,323 **** "remoteListenThread_%d: connected to '%s'\n", node->no_id, conn_conninfo); - } --- 321,324 ---- *************** *** 374,377 **** --- 375,379 ---- continue; } + PQclear(res); } Index: cleanup_thread.c =================================================================== RCS file: /home/cvsd/slony1/slony1-engine/src/slon/cleanup_thread.c,v retrieving revision 1.33.2.7 retrieving revision 1.33.2.8 diff -C2 -d -r1.33.2.7 -r1.33.2.8 *** cleanup_thread.c 9 Dec 2009 20:49:20 -0000 1.33.2.7 --- cleanup_thread.c 22 Dec 2009 17:10:10 -0000 1.33.2.8 *************** *** 46,50 **** "%s.sl_log_2", "%s.sl_seqlog", ! "%s.sl_archive_counter", "pg_catalog.pg_listener", "pg_catalog.pg_statistic", --- 46,50 ---- "%s.sl_log_2", "%s.sl_seqlog", ! "%s.sl_archive_counter", "pg_catalog.pg_listener", "pg_catalog.pg_statistic", *************** *** 254,267 **** slon_mkquery(&query3, "show autovacuum"); res = PQexec(dbconn, dstring_data(&query3)); ! if (PQresultStatus(res) != PGRES_TUPLES_OK) { slon_log(SLON_ERROR, ! "cleanupThread: \"%s\" - %s", ! dstring_data(&query3), PQresultErrorMessage(res)); ! /* ! * slon_retry(); break; ! */ ! } else if (strncmp(PQgetvalue(res, 0, 0), "on", 2) == 0) { --- 254,267 ---- slon_mkquery(&query3, "show autovacuum"); res = PQexec(dbconn, dstring_data(&query3)); ! if (PQresultStatus(res) != PGRES_TUPLES_OK) { slon_log(SLON_ERROR, ! "cleanupThread: \"%s\" - %s", ! dstring_data(&query3), PQresultErrorMessage(res)); ! /* ! * slon_retry(); break; ! */ ! } else if (strncmp(PQgetvalue(res, 0, 0), "on", 2) == 0) { *************** *** 271,275 **** a_vac=1; } ! PQclear(res); dstring_reset(&query3); } --- 271,275 ---- a_vac=1; } ! PQclear(res); dstring_reset(&query3); } *************** *** 299,321 **** for (t = 0; table_list[t] != NULL ; t++) { - sprintf(tstring, table_list[t], rtcfg_namespace); if (a_vac==1) { if (conn->pg_version < 80400) { ! slon_mkquery(&query3,"select (case when pga.enabled ISNULL THEN true ELSE pga.enabled END) " ! "from \"pg_catalog\".pg_namespace PGN, \"pg_catalog\".pg_class PGC LEFT OUTER JOIN " ! "\"pg_catalog\".pg_autovacuum pga ON (PGC.oid = pga.vacrelid) where PGC.relnamespace = PGN.oid " ! "and %s.slon_quote_input('%s')=%s.slon_quote_brute(PGN.nspname) || '.' || %s.slon_quote_brute(PGC.relname);", ! rtcfg_namespace,tstring, rtcfg_namespace, rtcfg_namespace); ! } else { /* PostgreSQL 8.4 */ slon_mkquery (&query3, ! "select coalesce ('autovacuum_enabled=on' = any(reloptions), 't'::boolean) " ! "from \"pg_catalog\".pg_class pgc, \"pg_catalog\".pg_namespace pgn " ! "where pgc.relnamespace = pgn.oid and %s.slon_quote_input('%s')= " ! " %s.slon_quote_brute(PGN.nspname) || '.' || %s.slon_quote_brute(PGC.relname);", ! rtcfg_namespace,tstring, rtcfg_namespace, rtcfg_namespace); } --- 299,332 ---- for (t = 0; table_list[t] != NULL ; t++) { sprintf(tstring, table_list[t], rtcfg_namespace); if (a_vac==1) { if (conn->pg_version < 80400) { ! slon_mkquery(&query3, ! "select (case when pga.enabled ISNULL " ! "THEN true ELSE pga.enabled END) " ! "from \"pg_catalog\".pg_namespace PGN, " ! "\"pg_catalog\".pg_class PGC LEFT OUTER JOIN " ! "\"pg_catalog\".pg_autovacuum pga ON " ! "(PGC.oid = pga.vacrelid) " ! "where PGC.relnamespace = PGN.oid " ! "and %s.slon_quote_input('%s')=" ! "%s.slon_quote_brute(PGN.nspname) || '.' " ! "|| %s.slon_quote_brute(PGC.relname);", ! rtcfg_namespace, tstring, rtcfg_namespace, ! rtcfg_namespace); } else { /* PostgreSQL 8.4 */ slon_mkquery (&query3, ! "select coalesce ('autovacuum_enabled=on' " ! "= any(reloptions), 't'::boolean) " ! "from \"pg_catalog\".pg_class pgc, " ! "\"pg_catalog\".pg_namespace pgn " ! "where pgc.relnamespace = pgn.oid " ! "and %s.slon_quote_input('%s')= " ! " %s.slon_quote_brute(PGN.nspname) || '.' " ! "|| %s.slon_quote_brute(PGC.relname);", ! rtcfg_namespace, tstring, rtcfg_namespace, ! rtcfg_namespace); } *************** *** 324,329 **** { slon_log(SLON_ERROR, ! "cleanupThread: \"%s\" - %s", ! dstring_data(&query3), PQresultErrorMessage(res)); /* * slon_retry(); break; --- 335,341 ---- { slon_log(SLON_ERROR, ! "cleanupThread: \"%s\" - %s", ! dstring_data(&query3), ! PQresultErrorMessage(res)); /* * slon_retry(); break; *************** *** 338,342 **** /* * pg_avac is NOT enabled for this table ! * so this means we need to handel it internaly */ if (vac_enable == vac_frequency) --- 350,354 ---- /* * pg_avac is NOT enabled for this table ! * so this means we need to handle it internaly */ if (vac_enable == vac_frequency) *************** *** 358,369 **** res = PQexec(dbconn, dstring_data(&query3)); if (PQresultStatus(res) != PGRES_COMMAND_OK) /* query error */ ! { ! slon_log(SLON_ERROR, ! "cleanupThread: \"%s\" - %s", ! dstring_data(&query3), PQresultErrorMessage(res)); ! /* ! * slon_retry(); break; ! */ ! } PQclear(res); dstring_reset(&query3); --- 370,381 ---- res = PQexec(dbconn, dstring_data(&query3)); if (PQresultStatus(res) != PGRES_COMMAND_OK) /* query error */ ! { ! slon_log(SLON_ERROR, ! "cleanupThread: \"%s\" - %s", ! dstring_data(&query3), PQresultErrorMessage(res)); ! /* ! * slon_retry(); break; ! */ ! } PQclear(res); dstring_reset(&query3); *************** *** 371,376 **** gettimeofday(&tv_end, NULL); slon_log(SLON_DEBUG2, ! "cleanupThread: %8.3f seconds for vacuuming\n", ! TIMEVAL_DIFF(&tv_start, &tv_end)); /* --- 383,388 ---- gettimeofday(&tv_end, NULL); slon_log(SLON_DEBUG2, ! "cleanupThread: %8.3f seconds for vacuuming\n", ! TIMEVAL_DIFF(&tv_start, &tv_end)); /* *************** *** 378,382 **** */ dstring_free(&query3); - } } --- 390,393 ----
- Previous message: [Slony1-commit] slony1-www/content news.txt
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list