debugging
authorChristian Grothoff <christian@grothoff.org>
Fri, 15 Apr 2011 19:46:04 +0000 (19:46 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 15 Apr 2011 19:46:04 +0000 (19:46 +0000)
src/datastore/gnunet-service-datastore.c
src/datastore/plugin_datastore_mysql.c
src/datastore/test_datastore_api_data_mysql.conf
src/datastore/test_datastore_api_data_sqlite.conf

index 1a4514a1ac2eb3f2962969895402e6596bd40aad..619d897320b5d1fa54637e74e4770eec73b52099 100644 (file)
@@ -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,
index deef46af037c4f1b3c47bfc58a59337cc46550a0..863c55ad8a44cf01306cd5ecadab6fb88d9a04e7 100644 (file)
@@ -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, 
index cb7a94c41c5880e281ba012b22e8c73269a68d2c..68aff836084d5334d252e5e9fd7cb087a355863f 100644 (file)
@@ -21,7 +21,6 @@ ACCEPT_FROM6 = ::1;
 QUOTA = 10000000
 BLOOMFILTER = $SERVICEHOME/fs/bloomfilter
 DATABASE = mysql
-DISABLE_SOCKET_FORWARDING = YES
 # USERNAME = 
 # MAXBUF =
 # TIMEOUT =
index 83784ffe6c408e1faef5fce58f98271d3fceb109..d7c01fe227df9f6ae2d45cc8e6596b338a39595c 100644 (file)
@@ -44,3 +44,5 @@ WEAKRANDOM = YES
 AUTOSTART = NO
 
 
+[fs]
+AUTOSTART = NO