mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
#if 0 out many, many debugging statements left behind. There's no way anyone is using this -- I hope. With about 10 error-level logging statements per query, it is really slow at best.
This commit is contained in:
@@ -297,10 +297,12 @@ postgres_get_resultset(const char *zone, const char *record,
|
|||||||
|
|
||||||
REQUIRE(*rs == NULL);
|
REQUIRE(*rs == NULL);
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d Getting DBI", dlz_thread_num);
|
"%d Getting DBI", dlz_thread_num);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* get db instance / connection */
|
/* get db instance / connection */
|
||||||
#ifdef ISC_PLATFORM_USETHREADS
|
#ifdef ISC_PLATFORM_USETHREADS
|
||||||
@@ -318,10 +320,12 @@ postgres_get_resultset(const char *zone, const char *record,
|
|||||||
|
|
||||||
#endif /* ISC_PLATFORM_USETHREADS */
|
#endif /* ISC_PLATFORM_USETHREADS */
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d Got DBI - checking query", dlz_thread_num);
|
"%d Got DBI - checking query", dlz_thread_num);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* if DBI is null, can't do anything else */
|
/* if DBI is null, can't do anything else */
|
||||||
if (dbi == NULL) {
|
if (dbi == NULL) {
|
||||||
@@ -391,10 +395,12 @@ postgres_get_resultset(const char *zone, const char *record,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d checked query", dlz_thread_num);
|
"%d checked query", dlz_thread_num);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* was a zone string passed? If so, make it safe for use in
|
* was a zone string passed? If so, make it safe for use in
|
||||||
@@ -410,10 +416,12 @@ postgres_get_resultset(const char *zone, const char *record,
|
|||||||
dbi->zone = NULL;
|
dbi->zone = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d did zone", dlz_thread_num);
|
"%d did zone", dlz_thread_num);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* was a record string passed? If so, make it safe for use in
|
* was a record string passed? If so, make it safe for use in
|
||||||
@@ -430,10 +438,12 @@ postgres_get_resultset(const char *zone, const char *record,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d did record", dlz_thread_num);
|
"%d did record", dlz_thread_num);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* was a client string passed? If so, make it safe for use in
|
* was a client string passed? If so, make it safe for use in
|
||||||
@@ -449,10 +459,12 @@ postgres_get_resultset(const char *zone, const char *record,
|
|||||||
dbi->client = NULL;
|
dbi->client = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d did client", dlz_thread_num);
|
"%d did client", dlz_thread_num);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* what type of query are we going to run?
|
* what type of query are we going to run?
|
||||||
@@ -486,10 +498,12 @@ postgres_get_resultset(const char *zone, const char *record,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d built query", dlz_thread_num);
|
"%d built query", dlz_thread_num);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* if the querystring is null, Bummer, outta RAM. UPGRADE TIME!!! */
|
/* if the querystring is null, Bummer, outta RAM. UPGRADE TIME!!! */
|
||||||
if (querystring == NULL) {
|
if (querystring == NULL) {
|
||||||
@@ -497,10 +511,12 @@ postgres_get_resultset(const char *zone, const char *record,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d query is '%s'", dlz_thread_num, querystring);
|
"%d query is '%s'", dlz_thread_num, querystring);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* output the full query string during debug so we can see
|
* output the full query string during debug so we can see
|
||||||
@@ -512,11 +528,13 @@ postgres_get_resultset(const char *zone, const char *record,
|
|||||||
|
|
||||||
/* attempt query up to 3 times. */
|
/* attempt query up to 3 times. */
|
||||||
for (j=0; j < 3; j++) {
|
for (j=0; j < 3; j++) {
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d executing query for %d time",
|
"%d executing query for %d time",
|
||||||
dlz_thread_num, j);
|
dlz_thread_num, j);
|
||||||
|
#endif
|
||||||
/* try to get result set */
|
/* try to get result set */
|
||||||
*rs = PQexec((PGconn *)dbi->dbconn, querystring );
|
*rs = PQexec((PGconn *)dbi->dbconn, querystring );
|
||||||
result = ISC_R_SUCCESS;
|
result = ISC_R_SUCCESS;
|
||||||
@@ -525,11 +543,13 @@ postgres_get_resultset(const char *zone, const char *record,
|
|||||||
* attempts.
|
* attempts.
|
||||||
*/
|
*/
|
||||||
for (i=0; *rs == NULL && i < 3; i++) {
|
for (i=0; *rs == NULL && i < 3; i++) {
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d resetting connection",
|
"%d resetting connection",
|
||||||
dlz_thread_num);
|
dlz_thread_num);
|
||||||
|
#endif
|
||||||
result = ISC_R_FAILURE;
|
result = ISC_R_FAILURE;
|
||||||
PQreset((PGconn *) dbi->dbconn);
|
PQreset((PGconn *) dbi->dbconn);
|
||||||
/* connection ok, break inner loop */
|
/* connection ok, break inner loop */
|
||||||
@@ -538,17 +558,21 @@ postgres_get_resultset(const char *zone, const char *record,
|
|||||||
}
|
}
|
||||||
/* result set ok, break outter loop */
|
/* result set ok, break outter loop */
|
||||||
if (PQresultStatus(*rs) == PGRES_TUPLES_OK) {
|
if (PQresultStatus(*rs) == PGRES_TUPLES_OK) {
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d rs ok", dlz_thread_num);
|
"%d rs ok", dlz_thread_num);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
/* we got a result set object, but it's not right. */
|
/* we got a result set object, but it's not right. */
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d clearing rs", dlz_thread_num);
|
"%d clearing rs", dlz_thread_num);
|
||||||
|
#endif
|
||||||
PQclear(*rs); /* get rid of it */
|
PQclear(*rs); /* get rid of it */
|
||||||
/* in case this was the last attempt */
|
/* in case this was the last attempt */
|
||||||
result = ISC_R_FAILURE;
|
result = ISC_R_FAILURE;
|
||||||
@@ -558,10 +582,12 @@ postgres_get_resultset(const char *zone, const char *record,
|
|||||||
cleanup:
|
cleanup:
|
||||||
/* it's always good to cleanup after yourself */
|
/* it's always good to cleanup after yourself */
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d cleaning up", dlz_thread_num);
|
"%d cleaning up", dlz_thread_num);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* if we couldn't even allocate DBI, just return NULL */
|
/* if we couldn't even allocate DBI, just return NULL */
|
||||||
if (dbi == NULL)
|
if (dbi == NULL)
|
||||||
@@ -581,10 +607,12 @@ postgres_get_resultset(const char *zone, const char *record,
|
|||||||
|
|
||||||
#ifdef ISC_PLATFORM_USETHREADS
|
#ifdef ISC_PLATFORM_USETHREADS
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d unlocking mutex", dlz_thread_num);
|
"%d unlocking mutex", dlz_thread_num);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* release the lock so another thread can use this dbi */
|
/* release the lock so another thread can use this dbi */
|
||||||
isc_mutex_unlock(&dbi->instance_lock);
|
isc_mutex_unlock(&dbi->instance_lock);
|
||||||
@@ -595,10 +623,12 @@ postgres_get_resultset(const char *zone, const char *record,
|
|||||||
if (querystring != NULL)
|
if (querystring != NULL)
|
||||||
isc_mem_free(ns_g_mctx, querystring );
|
isc_mem_free(ns_g_mctx, querystring );
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* temporary logging message */
|
/* temporary logging message */
|
||||||
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
|
||||||
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
DNS_LOGMODULE_DLZ, ISC_LOG_ERROR,
|
||||||
"%d returning", dlz_thread_num);
|
"%d returning", dlz_thread_num);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* return result */
|
/* return result */
|
||||||
return result;
|
return result;
|
||||||
|
Reference in New Issue
Block a user