debug messages in driver, correct time (even for mysql_dump), change dhtlog testcase...
authorNathan S. Evans <evans@in.tum.de>
Thu, 16 Sep 2010 15:20:40 +0000 (15:20 +0000)
committerNathan S. Evans <evans@in.tum.de>
Thu, 16 Sep 2010 15:20:40 +0000 (15:20 +0000)
src/dht/gnunet-dht-driver.c
src/dht/plugin_dhtlog_mysql.c
src/dht/plugin_dhtlog_mysql_dump.c
src/dht/plugin_dhtlog_mysql_dump_load.c
src/dht/test_dhtlog_data.conf

index cdd5e7c169ec33c93c35a45f7cd466d569a079d3..e343e911f24b903e33cf1fd02cfb19b4f2f70333 100644 (file)
@@ -1305,7 +1305,7 @@ void count_peers_churn_cb (void *cls,
        */
       if ((peer_count->count == 0) && (GNUNET_TIME_absolute_get_remaining(find_peer_context->endtime).value > 0))
         {
-          GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Found peer with no connections, will choose some peers at random to connect to!\n");
+          GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Found peer with no connections, will choose some peer(s) at random to connect to!\n");
           GNUNET_CONTAINER_heap_iterate (find_peer_context->peer_min_heap, &iterate_min_heap_peers, find_peer_context);
           GNUNET_SCHEDULER_add_now(sched, &schedule_churn_find_peer_requests, find_peer_context);
         }
@@ -1368,6 +1368,7 @@ static void churn_complete (void *cls, const char *emsg)
    */
   if (find_peer_context != NULL)
     {
+      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "We have churned on some peers, so we must schedule find peer requests for them!\n");
       for (i = 0; i < num_peers; i ++)
         {
           temp_daemon = GNUNET_TESTING_daemon_get(pg, i);
@@ -1380,6 +1381,7 @@ static void churn_complete (void *cls, const char *emsg)
     }
   else
     {
+      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Only churned off peers, no find peer requests, scheduling more gets...\n");
       if (dhtlog_handle != NULL)
         {
           topo_ctx = GNUNET_malloc(sizeof(struct TopologyIteratorContext));
@@ -1988,12 +1990,17 @@ continue_puts_and_gets (void *cls, const struct GNUNET_SCHEDULER_TaskContext * t
     GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, settle_time), &setup_puts_and_gets, NULL);
 
   if (GNUNET_YES == do_find_peer)
-  {
-    find_peer_context = GNUNET_malloc(sizeof(struct FindPeerContext));
-    find_peer_context->count_peers_cb = &count_peers_cb;
-    find_peer_context->endtime = GNUNET_TIME_relative_to_absolute(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, settle_time));
-    GNUNET_SCHEDULER_add_now(sched, &schedule_find_peer_requests, find_peer_context);
-  }
+    {
+      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Scheduling find peer requests during \"settle\" time.\n");
+      find_peer_context = GNUNET_malloc(sizeof(struct FindPeerContext));
+      find_peer_context->count_peers_cb = &count_peers_cb;
+      find_peer_context->endtime = GNUNET_TIME_relative_to_absolute(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, settle_time));
+      GNUNET_SCHEDULER_add_now(sched, &schedule_find_peer_requests, find_peer_context);
+    }
+  else
+    {
+      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Assuming automatic DHT find peer requests.\n");
+    }
 }
 
 /**
@@ -2432,7 +2439,7 @@ run (void *cls,
   churn_data = NULL;
   /** Check for a churn file to do churny simulation */
   if (GNUNET_OK ==
-      GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "churn_file",
+      GNUNET_CONFIGURATION_get_value_string(cfg, "dht_testing", "churn_file",
                                             &churn_filename))
     {
       GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Reading churn data from %s\n", churn_filename);
index 465a987e0f699902ff2711c98f56a9c799e56b4b..b31a41f4c184f5fd63609d4bb552323296d828b4 100644 (file)
@@ -91,8 +91,8 @@ static unsigned long long current_trial = 0;    /* I like to assign 0, just to r
  */
 static MYSQL *conn;
 
-#define INSERT_QUERIES_STMT "INSERT INTO queries (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid) "\
-                          "VALUES (?, ?, ?, ?, ?, ?, ?)"
+#define INSERT_QUERIES_STMT "INSERT INTO queries (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid, time) "\
+                          "VALUES (?, ?, ?, ?, ?, ?, ?, NOW())"
 static struct StatementHandle *insert_query;
 
 #define INSERT_ROUTES_STMT "INSERT INTO routes (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid, from_node, to_node) "\
index 2582bca41ce34c03cf29034f1f4c3e2b498b424b..8b16c155df6f4d7c63f340c5718931a556538ecc 100644 (file)
@@ -51,8 +51,8 @@ static unsigned long max_varchar_len;
  */
 static const struct GNUNET_CONFIGURATION_Handle *cfg;
 
-#define INSERT_QUERIES_STMT "prepare insert_query from 'INSERT INTO queries (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid) "\
-                          "VALUES (@temp_trial, ?, ?, ?, ?, ?, ?)'"
+#define INSERT_QUERIES_STMT "prepare insert_query from 'INSERT INTO queries (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid, time) "\
+                          "VALUES (@temp_trial, ?, ?, ?, ?, ?, ?, ?)'"
 
 #define INSERT_ROUTES_STMT "prepare insert_route from 'INSERT INTO routes (trialuid, querytype, hops, dhtkeyuid, dhtqueryid, succeeded, nodeuid, from_node, to_node) "\
                           "VALUES (@temp_trial, ?, ?, ?, ?, ?, ?, ?, ?)'"
@@ -678,12 +678,12 @@ add_query (unsigned long long *sqlqueryuid, unsigned long long queryid,
   if (ret < 0)
     return GNUNET_SYSERR;
 
-  ret = fprintf(outfile, "set @qid = %llu, @type = %u, @hops = %u, @succ = %d;\n", queryid, type, hops, succeeded);
+  ret = fprintf(outfile, "set @qid = %llu, @type = %u, @hops = %u, @succ = %d, @time = \"%s\";\n", queryid, type, hops, succeeded, get_sql_time());
 
   if (ret < 0)
     return GNUNET_SYSERR;
 
-  ret = fprintf(outfile, "execute insert_query using @type, @hops, @temp_dhtkey, @qid, @succ, @temp_node;\n");
+  ret = fprintf(outfile, "execute insert_query using @type, @hops, @temp_dhtkey, @qid, @succ, @temp_node, @time;\n");
 
   if (ret >= 0)
     return GNUNET_OK;
index e1c1e65801a6480477526635a172ba662c000e5b..ac4b91301489a93517d79d8754aa1fa216ff130f 100644 (file)
@@ -475,7 +475,7 @@ add_query (unsigned long long *sqlqueryuid, unsigned long long queryid,
   if (ret < 0)
     return GNUNET_SYSERR;
 
-  ret = fprintf(query_outfile, "%s\t%llu\t%u\t%u\t%u\n", GNUNET_h2s_full(&node->hashPubKey), queryid, type, hops, succeeded);
+  ret = fprintf(query_outfile, "%s\t%llu\t%u\t%u\t%u\t%s\n", GNUNET_h2s_full(&node->hashPubKey), queryid, type, hops, succeeded, get_sql_time());
 
   if (ret >= 0)
     return GNUNET_OK;
index 2cb9af38a229cd966c14f0eb657fee16ef337845..22ef427aa8cb1b0abf8a1820ad28e2ed20f7f3c7 100644 (file)
@@ -36,8 +36,8 @@ DEFAULTCONFIG = test_dhtlog_data.conf
 SERVICEHOME = /tmp/test-dhtlog/
 
 [DHTLOG]
-PLUGIN = mysql_dump
-#PLUGIN = dummy
+#PLUGIN = mysql_dump
+PLUGIN = dummy
 #PLUGIN = mysql
 
 [MYSQL]