From 736491e0b07d0e73ff6cdbe84fcb012eda006d89 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 15 Apr 2011 19:46:04 +0000 Subject: [PATCH] debugging --- src/datastore/gnunet-service-datastore.c | 14 ++++- src/datastore/plugin_datastore_mysql.c | 52 +++++++++++++++++-- .../test_datastore_api_data_mysql.conf | 1 - .../test_datastore_api_data_sqlite.conf | 2 + 4 files changed, 62 insertions(+), 7 deletions(-) diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c index 1a4514a1a..619d89732 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c @@ -1345,6 +1345,9 @@ remove_callback (void *cls, { struct RemoveContext *rc = cls; + fprintf (stderr, + "remove called with key %p\n", + key); if (key == NULL) { #if DEBUG_DATASTORE @@ -1389,8 +1392,8 @@ remove_callback (void *cls, */ static void handle_remove (void *cls, - struct GNUNET_SERVER_Client *client, - const struct GNUNET_MessageHeader *message) + struct GNUNET_SERVER_Client *client, + const struct GNUNET_MessageHeader *message) { const struct DataMessage *dm = check_data (message); GNUNET_HashCode vhash; @@ -1419,6 +1422,13 @@ handle_remove (void *cls, GNUNET_CRYPTO_hash (&dm[1], ntohl(dm->size), &vhash); + fprintf (stderr, + "remove does get for key %s\n", + GNUNET_h2s (&dm->key)); + fprintf (stderr, + "remove does get for %u vhash %s\n", + ntohl (dm->type), + GNUNET_h2s (&vhash)); plugin->api->get (plugin->api->cls, &dm->key, &vhash, diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index deef46af0..863c55ad8 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c @@ -844,7 +844,7 @@ do_delete_entry (struct Plugin *plugin, NULL, MYSQL_TYPE_LONGLONG, &uid, GNUNET_YES, -1); - if (ret > 0) + if (ret >= 0) return GNUNET_OK; GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Deleting value %llu from gn090 table failed\n", @@ -864,8 +864,9 @@ do_delete_entry (struct Plugin *plugin, static int return_ok (void *cls, unsigned int num_values, - MYSQL_BIND * values) + MYSQL_BIND *values) { + fprintf (stderr, "Here: %u\n", num_values); return GNUNET_OK; } @@ -947,6 +948,16 @@ mysql_plugin_put (void *cls, hashSize2 = sizeof (GNUNET_HashCode); lsize = size; GNUNET_CRYPTO_hash (data, size, &vhash); + { + fprintf (stderr, + "inserting content with key `%s'\n", + GNUNET_h2s (key)); + fprintf (stderr, + "inserting %u-byte content with vhash `%s'\n", + (unsigned int) size, + GNUNET_h2s (&vhash)); + } + if (GNUNET_OK != prepared_statement_run (plugin, plugin->insert_entry, @@ -1117,6 +1128,19 @@ mysql_next_request_cont (void *next_cls, exp); #endif expiration.abs_value = exp; + + { + GNUNET_HashCode vh; + + GNUNET_CRYPTO_hash (value, size, &vh); + fprintf (stderr, + "found content under with key `%s'\n", + GNUNET_h2s (&key)); + fprintf (stderr, + "found %u-byte content with vhash `%s'\n", + (unsigned int) size, + GNUNET_h2s (&vh)); +} ret = nrc->dviter (nrc->dviter_cls, (nrc->one_shot == GNUNET_YES) ? NULL : nrc, &key, @@ -1255,6 +1279,12 @@ get_statement_prepare (void *cls, { if (gc->have_vhash) { + fprintf (stderr, + "Select by key `%s'\n", + GNUNET_h2s (&gc->key)); + fprintf (stderr, + "Select by vhash `%s'\n", + GNUNET_h2s (&gc->vhash)); ret = prepared_statement_run_select (plugin, plugin->select_entry_by_hash_and_vhash, @@ -1313,11 +1343,13 @@ mysql_plugin_get (void *cls, struct NextRequestClosure *nrc; long long total; unsigned long hashSize; + unsigned long hashSize2; GNUNET_assert (key != NULL); if (iter == NULL) return; hashSize = sizeof (GNUNET_HashCode); + hashSize2 = sizeof (GNUNET_HashCode); memset (cbind, 0, sizeof (cbind)); total = -1; cbind[0].buffer_type = MYSQL_TYPE_LONGLONG; @@ -1333,7 +1365,7 @@ mysql_plugin_get (void *cls, 1, cbind, &return_ok, NULL, MYSQL_TYPE_BLOB, key, hashSize, &hashSize, - MYSQL_TYPE_BLOB, vhash, hashSize, &hashSize, + MYSQL_TYPE_BLOB, vhash, hashSize2, &hashSize2, MYSQL_TYPE_LONG, &itype, GNUNET_YES, -1); } @@ -1353,13 +1385,19 @@ mysql_plugin_get (void *cls, { if (vhash != NULL) { + fprintf (stderr, + "Count by key `%s'\n", + GNUNET_h2s (key)); + fprintf (stderr, + "Count by vhash `%s'\n", + GNUNET_h2s (vhash)); ret = prepared_statement_run_select (plugin, plugin->count_entry_by_hash_and_vhash, 1, cbind, &return_ok, NULL, MYSQL_TYPE_BLOB, key, hashSize, &hashSize, - MYSQL_TYPE_BLOB, vhash, hashSize, &hashSize, + MYSQL_TYPE_BLOB, vhash, hashSize2, &hashSize2, -1); } @@ -1374,6 +1412,12 @@ mysql_plugin_get (void *cls, -1); } } + fprintf (stderr, + "Got %u results (ret: %d / `%s')\n", + (unsigned int) total, + ret, + mysql_error (plugin->dbf)); + if ((ret != GNUNET_OK) || (0 >= total)) { iter (iter_cls, diff --git a/src/datastore/test_datastore_api_data_mysql.conf b/src/datastore/test_datastore_api_data_mysql.conf index cb7a94c41..68aff8360 100644 --- a/src/datastore/test_datastore_api_data_mysql.conf +++ b/src/datastore/test_datastore_api_data_mysql.conf @@ -21,7 +21,6 @@ ACCEPT_FROM6 = ::1; QUOTA = 10000000 BLOOMFILTER = $SERVICEHOME/fs/bloomfilter DATABASE = mysql -DISABLE_SOCKET_FORWARDING = YES # USERNAME = # MAXBUF = # TIMEOUT = diff --git a/src/datastore/test_datastore_api_data_sqlite.conf b/src/datastore/test_datastore_api_data_sqlite.conf index 83784ffe6..d7c01fe22 100644 --- a/src/datastore/test_datastore_api_data_sqlite.conf +++ b/src/datastore/test_datastore_api_data_sqlite.conf @@ -44,3 +44,5 @@ WEAKRANDOM = YES AUTOSTART = NO +[fs] +AUTOSTART = NO -- 2.25.1