[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r20839 - gnunet/src/datastore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r20839 - gnunet/src/datastore |
Date: |
Sun, 1 Apr 2012 20:20:44 +0200 |
Author: grothoff
Date: 2012-04-01 20:20:44 +0200 (Sun, 01 Apr 2012)
New Revision: 20839
Modified:
gnunet/src/datastore/plugin_datastore_mysql.c
gnunet/src/datastore/plugin_datastore_postgres.c
gnunet/src/datastore/plugin_datastore_sqlite.c
Log:
-removing legacy #ifdefs
Modified: gnunet/src/datastore/plugin_datastore_mysql.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_mysql.c 2012-04-01 18:10:16 UTC
(rev 20838)
+++ gnunet/src/datastore/plugin_datastore_mysql.c 2012-04-01 18:20:44 UTC
(rev 20839)
@@ -121,7 +121,6 @@
#include "gnunet_util_lib.h"
#include "gnunet_mysql_lib.h"
-#define DEBUG_MYSQL GNUNET_EXTRA_LOGGING
#define MAX_DATUM_SIZE 65536
@@ -227,10 +226,8 @@
{
int ret;
-#if DEBUG_MYSQL
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting value %llu from gn090
table\n",
uid);
-#endif
ret = GNUNET_MYSQL_statement_run_prepared (plugin->mc,
plugin->delete_entry_by_uid, NULL,
MYSQL_TYPE_LONGLONG, &uid,
GNUNET_YES, -1);
@@ -323,11 +320,9 @@
MYSQL_TYPE_BLOB, &vhash, hashSize2, &hashSize2,
MYSQL_TYPE_BLOB, data, lsize, &lsize, -1))
return GNUNET_SYSERR;
-#if DEBUG_MYSQL
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Inserted value `%s' with size %u into gn090 table\n",
GNUNET_h2s (key), (unsigned int) size);
-#endif
if (size > 0)
plugin->env->duc (plugin->env->cls, size);
return GNUNET_OK;
@@ -366,11 +361,9 @@
unsigned long long lexpire = expire.abs_value;
int ret;
-#if DEBUG_MYSQL
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Updating value %llu adding %d to priority and maxing exp at
%llu\n",
vkey, delta, lexpire);
-#endif
ret =
GNUNET_MYSQL_statement_run_prepared (plugin->mc, plugin->update_entry,
NULL,
MYSQL_TYPE_LONG, &delta, GNUNET_NO,
@@ -456,11 +449,9 @@
proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
-#if DEBUG_MYSQL
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Found %u-byte value under key `%s' with prio %u, anon %u,
expire %llu selecting from gn090 table\n",
(unsigned int) size, GNUNET_h2s (&key), priority, anonymity,
exp);
-#endif
GNUNET_assert (size < MAX_DATUM_SIZE);
expiration.abs_value = exp;
ret =
@@ -567,12 +558,9 @@
}
offset = offset % total;
off = (unsigned long long) offset;
-#if DEBUG_MYSQL
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Obtaining %llu/%lld result for GET `%s'\n", off, total,
GNUNET_h2s (key));
-#endif
-
if (type != GNUNET_BLOCK_TYPE_ANY)
{
if (NULL != vhash)
Modified: gnunet/src/datastore/plugin_datastore_postgres.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_postgres.c 2012-04-01 18:10:16 UTC
(rev 20838)
+++ gnunet/src/datastore/plugin_datastore_postgres.c 2012-04-01 18:20:44 UTC
(rev 20839)
@@ -29,7 +29,6 @@
#include "gnunet_postgres_lib.h"
#include <postgresql/libpq-fe.h>
-#define DEBUG_POSTGRES GNUNET_EXTRA_LOGGING
/**
* After how many ms "busy" should a DB operation fail for good?
@@ -312,10 +311,8 @@
return GNUNET_SYSERR;
PQclear (ret);
plugin->env->duc (plugin->env->cls, size + GNUNET_DATASTORE_ENTRY_OVERHEAD);
-#if DEBUG_POSTGRES
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres",
"Stored %u bytes in database\n", (unsigned int) size);
-#endif
return GNUNET_OK;
}
@@ -349,10 +346,8 @@
GNUNET_POSTGRES_check_result_ (plugin->dbh, res, PGRES_TUPLES_OK,
"PQexecPrepared", "select",
filename, line))
{
-#if DEBUG_POSTGRES
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres",
"Ending iteration (postgres error)\n");
-#endif
proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
return;
}
@@ -360,10 +355,8 @@
if (0 == PQntuples (res))
{
/* no result */
-#if DEBUG_POSTGRES
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres",
"Ending iteration (no more results)\n");
-#endif
proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
PQclear (res);
return;
@@ -398,11 +391,9 @@
GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0, 3));
memcpy (&key, PQgetvalue (res, 0, 4), sizeof (GNUNET_HashCode));
size = PQgetlength (res, 0, 5);
-#if DEBUG_POSTGRES
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres",
"Found result of size %u bytes and type %u in database\n",
(unsigned int) size, (unsigned int) type);
-#endif
iret =
proc (proc_cls, &key, size, PQgetvalue (res, 0, 5),
(enum GNUNET_BLOCK_Type) type, priority, anonymity,
expiration_time,
@@ -410,23 +401,17 @@
PQclear (res);
if (iret == GNUNET_NO)
{
-#if DEBUG_POSTGRES
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Processor asked for item %u to be removed.\n", rowid);
-#endif
if (GNUNET_OK == GNUNET_POSTGRES_delete_by_rowid (plugin->dbh, "delrow",
rowid))
{
-#if DEBUG_POSTGRES
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres",
"Deleting %u bytes from database\n",
(unsigned int) size);
-#endif
plugin->env->duc (plugin->env->cls,
-(size + GNUNET_DATASTORE_ENTRY_OVERHEAD));
-#if DEBUG_POSTGRES
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres",
"Deleted %u bytes from database\n", (unsigned int)
size);
-#endif
}
}
}
Modified: gnunet/src/datastore/plugin_datastore_sqlite.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_sqlite.c 2012-04-01 18:10:16 UTC
(rev 20838)
+++ gnunet/src/datastore/plugin_datastore_sqlite.c 2012-04-01 18:20:44 UTC
(rev 20839)
@@ -28,10 +28,6 @@
#include "gnunet_datastore_plugin.h"
#include <sqlite3.h>
-/**
- * Enable or disable logging debug messages.
- */
-#define DEBUG_SQLITE GNUNET_EXTRA_LOGGING
/**
* We allocate items on the stack at times. To prevent a stack
@@ -147,10 +143,8 @@
result =
sqlite3_prepare_v2 (dbh, zSql, strlen (zSql), ppStmt,
(const char **) &dummy);
-#if DEBUG_SQLITE && 0
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite",
"Prepared `%s' / %p: %d\n", zSql, *ppStmt, result);
-#endif
return result;
}
@@ -415,10 +409,8 @@
stmt = sqlite3_next_stmt (plugin->dbh, NULL);
while (stmt != NULL)
{
-#if DEBUG_SQLITE
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite",
"Closing statement %p\n", stmt);
-#endif
result = sqlite3_finalize (stmt);
if (result != SQLITE_OK)
GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "sqlite",
@@ -502,14 +494,12 @@
if (size > MAX_ITEM_SIZE)
return GNUNET_SYSERR;
-#if DEBUG_SQLITE
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite",
"Storing in database block with type %u/key `%s'/priority
%u/expiration in %llu ms (%lld).\n",
type, GNUNET_h2s (key), priority,
(unsigned long long)
GNUNET_TIME_absolute_get_remaining (expiration).rel_value,
(long long) expiration.abs_value);
-#endif
GNUNET_CRYPTO_hash (data, size, &vhash);
stmt = plugin->insertContent;
rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX);
@@ -540,11 +530,9 @@
{
case SQLITE_DONE:
plugin->env->duc (plugin->env->cls, size +
GNUNET_DATASTORE_ENTRY_OVERHEAD);
-#if DEBUG_SQLITE
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite",
"Stored new entry (%u bytes)\n",
size + GNUNET_DATASTORE_ENTRY_OVERHEAD);
-#endif
ret = GNUNET_OK;
break;
case SQLITE_BUSY:
@@ -621,9 +609,7 @@
switch (n)
{
case SQLITE_DONE:
-#if DEBUG_SQLITE
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Block updated\n");
-#endif
return GNUNET_OK;
case SQLITE_BUSY:
LOG_SQLITE (plugin, msg, GNUNET_ERROR_TYPE_WARNING |
GNUNET_ERROR_TYPE_BULK,
@@ -677,11 +663,9 @@
break;
}
expiration.abs_value = sqlite3_column_int64 (stmt, 3);
-#if DEBUG_SQLITE
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite",
"Found reply in database with expiration %llu\n",
(unsigned long long) expiration.abs_value);
-#endif
ret = proc (proc_cls, sqlite3_column_blob (stmt, 4) /* key */ ,
size, sqlite3_column_blob (stmt, 5) /* data */ ,
sqlite3_column_int (stmt, 0) /* type */ ,
@@ -972,10 +956,8 @@
uint32_t repl;
sqlite3_stmt *stmt;
-#if DEBUG_SQLITE
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite",
"Getting random block based on replication order.\n");
-#endif
rc.have_uid = GNUNET_NO;
rc.proc = proc;
rc.proc_cls = proc_cls;
@@ -1061,10 +1043,8 @@
sqlite3_stmt *stmt;
struct GNUNET_TIME_Absolute now;
-#if DEBUG_SQLITE
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite",
"Getting random block based on expiration and priority
order.\n");
-#endif
now = GNUNET_TIME_absolute_get ();
stmt = plugin->selExpi;
if (SQLITE_OK != sqlite3_bind_int64 (stmt, 1, now.abs_value))
@@ -1233,18 +1213,13 @@
struct GNUNET_DATASTORE_PluginFunctions *api = cls;
struct Plugin *plugin = api->cls;
-#if DEBUG_SQLITE
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite",
"sqlite plugin is done\n");
-#endif
-
fn = NULL;
if (plugin->drop_on_shutdown)
fn = GNUNET_strdup (plugin->fn);
-#if DEBUG_SQLITE
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite",
"Shutting down database\n");
-#endif
database_shutdown (plugin);
plugin->env = NULL;
GNUNET_free (api);
@@ -1254,10 +1229,8 @@
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn);
GNUNET_free (fn);
}
-#if DEBUG_SQLITE
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite",
"sqlite plugin is finished\n");
-#endif
return NULL;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r20839 - gnunet/src/datastore,
gnunet <=