diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-04-15 19:46:04 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-04-15 19:46:04 +0000 |
commit | 736491e0b07d0e73ff6cdbe84fcb012eda006d89 (patch) | |
tree | 70e386c05e634febe0e782089e3b9b0ac0e36d28 /src/datastore | |
parent | 841778ecf2382a978115f23a22ee1a885c917f93 (diff) | |
download | gnunet-736491e0b07d0e73ff6cdbe84fcb012eda006d89.tar.gz gnunet-736491e0b07d0e73ff6cdbe84fcb012eda006d89.zip |
debugging
Diffstat (limited to 'src/datastore')
-rw-r--r-- | src/datastore/gnunet-service-datastore.c | 14 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_mysql.c | 52 | ||||
-rw-r--r-- | src/datastore/test_datastore_api_data_mysql.conf | 1 | ||||
-rw-r--r-- | src/datastore/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, | |||
1345 | { | 1345 | { |
1346 | struct RemoveContext *rc = cls; | 1346 | struct RemoveContext *rc = cls; |
1347 | 1347 | ||
1348 | fprintf (stderr, | ||
1349 | "remove called with key %p\n", | ||
1350 | key); | ||
1348 | if (key == NULL) | 1351 | if (key == NULL) |
1349 | { | 1352 | { |
1350 | #if DEBUG_DATASTORE | 1353 | #if DEBUG_DATASTORE |
@@ -1389,8 +1392,8 @@ remove_callback (void *cls, | |||
1389 | */ | 1392 | */ |
1390 | static void | 1393 | static void |
1391 | handle_remove (void *cls, | 1394 | handle_remove (void *cls, |
1392 | struct GNUNET_SERVER_Client *client, | 1395 | struct GNUNET_SERVER_Client *client, |
1393 | const struct GNUNET_MessageHeader *message) | 1396 | const struct GNUNET_MessageHeader *message) |
1394 | { | 1397 | { |
1395 | const struct DataMessage *dm = check_data (message); | 1398 | const struct DataMessage *dm = check_data (message); |
1396 | GNUNET_HashCode vhash; | 1399 | GNUNET_HashCode vhash; |
@@ -1419,6 +1422,13 @@ handle_remove (void *cls, | |||
1419 | GNUNET_CRYPTO_hash (&dm[1], | 1422 | GNUNET_CRYPTO_hash (&dm[1], |
1420 | ntohl(dm->size), | 1423 | ntohl(dm->size), |
1421 | &vhash); | 1424 | &vhash); |
1425 | fprintf (stderr, | ||
1426 | "remove does get for key %s\n", | ||
1427 | GNUNET_h2s (&dm->key)); | ||
1428 | fprintf (stderr, | ||
1429 | "remove does get for %u vhash %s\n", | ||
1430 | ntohl (dm->type), | ||
1431 | GNUNET_h2s (&vhash)); | ||
1422 | plugin->api->get (plugin->api->cls, | 1432 | plugin->api->get (plugin->api->cls, |
1423 | &dm->key, | 1433 | &dm->key, |
1424 | &vhash, | 1434 | &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, | |||
844 | NULL, | 844 | NULL, |
845 | MYSQL_TYPE_LONGLONG, &uid, GNUNET_YES, | 845 | MYSQL_TYPE_LONGLONG, &uid, GNUNET_YES, |
846 | -1); | 846 | -1); |
847 | if (ret > 0) | 847 | if (ret >= 0) |
848 | return GNUNET_OK; | 848 | return GNUNET_OK; |
849 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 849 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
850 | "Deleting value %llu from gn090 table failed\n", | 850 | "Deleting value %llu from gn090 table failed\n", |
@@ -864,8 +864,9 @@ do_delete_entry (struct Plugin *plugin, | |||
864 | static int | 864 | static int |
865 | return_ok (void *cls, | 865 | return_ok (void *cls, |
866 | unsigned int num_values, | 866 | unsigned int num_values, |
867 | MYSQL_BIND * values) | 867 | MYSQL_BIND *values) |
868 | { | 868 | { |
869 | fprintf (stderr, "Here: %u\n", num_values); | ||
869 | return GNUNET_OK; | 870 | return GNUNET_OK; |
870 | } | 871 | } |
871 | 872 | ||
@@ -947,6 +948,16 @@ mysql_plugin_put (void *cls, | |||
947 | hashSize2 = sizeof (GNUNET_HashCode); | 948 | hashSize2 = sizeof (GNUNET_HashCode); |
948 | lsize = size; | 949 | lsize = size; |
949 | GNUNET_CRYPTO_hash (data, size, &vhash); | 950 | GNUNET_CRYPTO_hash (data, size, &vhash); |
951 | { | ||
952 | fprintf (stderr, | ||
953 | "inserting content with key `%s'\n", | ||
954 | GNUNET_h2s (key)); | ||
955 | fprintf (stderr, | ||
956 | "inserting %u-byte content with vhash `%s'\n", | ||
957 | (unsigned int) size, | ||
958 | GNUNET_h2s (&vhash)); | ||
959 | } | ||
960 | |||
950 | if (GNUNET_OK != | 961 | if (GNUNET_OK != |
951 | prepared_statement_run (plugin, | 962 | prepared_statement_run (plugin, |
952 | plugin->insert_entry, | 963 | plugin->insert_entry, |
@@ -1117,6 +1128,19 @@ mysql_next_request_cont (void *next_cls, | |||
1117 | exp); | 1128 | exp); |
1118 | #endif | 1129 | #endif |
1119 | expiration.abs_value = exp; | 1130 | expiration.abs_value = exp; |
1131 | |||
1132 | { | ||
1133 | GNUNET_HashCode vh; | ||
1134 | |||
1135 | GNUNET_CRYPTO_hash (value, size, &vh); | ||
1136 | fprintf (stderr, | ||
1137 | "found content under with key `%s'\n", | ||
1138 | GNUNET_h2s (&key)); | ||
1139 | fprintf (stderr, | ||
1140 | "found %u-byte content with vhash `%s'\n", | ||
1141 | (unsigned int) size, | ||
1142 | GNUNET_h2s (&vh)); | ||
1143 | } | ||
1120 | ret = nrc->dviter (nrc->dviter_cls, | 1144 | ret = nrc->dviter (nrc->dviter_cls, |
1121 | (nrc->one_shot == GNUNET_YES) ? NULL : nrc, | 1145 | (nrc->one_shot == GNUNET_YES) ? NULL : nrc, |
1122 | &key, | 1146 | &key, |
@@ -1255,6 +1279,12 @@ get_statement_prepare (void *cls, | |||
1255 | { | 1279 | { |
1256 | if (gc->have_vhash) | 1280 | if (gc->have_vhash) |
1257 | { | 1281 | { |
1282 | fprintf (stderr, | ||
1283 | "Select by key `%s'\n", | ||
1284 | GNUNET_h2s (&gc->key)); | ||
1285 | fprintf (stderr, | ||
1286 | "Select by vhash `%s'\n", | ||
1287 | GNUNET_h2s (&gc->vhash)); | ||
1258 | ret = | 1288 | ret = |
1259 | prepared_statement_run_select (plugin, | 1289 | prepared_statement_run_select (plugin, |
1260 | plugin->select_entry_by_hash_and_vhash, | 1290 | plugin->select_entry_by_hash_and_vhash, |
@@ -1313,11 +1343,13 @@ mysql_plugin_get (void *cls, | |||
1313 | struct NextRequestClosure *nrc; | 1343 | struct NextRequestClosure *nrc; |
1314 | long long total; | 1344 | long long total; |
1315 | unsigned long hashSize; | 1345 | unsigned long hashSize; |
1346 | unsigned long hashSize2; | ||
1316 | 1347 | ||
1317 | GNUNET_assert (key != NULL); | 1348 | GNUNET_assert (key != NULL); |
1318 | if (iter == NULL) | 1349 | if (iter == NULL) |
1319 | return; | 1350 | return; |
1320 | hashSize = sizeof (GNUNET_HashCode); | 1351 | hashSize = sizeof (GNUNET_HashCode); |
1352 | hashSize2 = sizeof (GNUNET_HashCode); | ||
1321 | memset (cbind, 0, sizeof (cbind)); | 1353 | memset (cbind, 0, sizeof (cbind)); |
1322 | total = -1; | 1354 | total = -1; |
1323 | cbind[0].buffer_type = MYSQL_TYPE_LONGLONG; | 1355 | cbind[0].buffer_type = MYSQL_TYPE_LONGLONG; |
@@ -1333,7 +1365,7 @@ mysql_plugin_get (void *cls, | |||
1333 | 1, cbind, | 1365 | 1, cbind, |
1334 | &return_ok, NULL, | 1366 | &return_ok, NULL, |
1335 | MYSQL_TYPE_BLOB, key, hashSize, &hashSize, | 1367 | MYSQL_TYPE_BLOB, key, hashSize, &hashSize, |
1336 | MYSQL_TYPE_BLOB, vhash, hashSize, &hashSize, | 1368 | MYSQL_TYPE_BLOB, vhash, hashSize2, &hashSize2, |
1337 | MYSQL_TYPE_LONG, &itype, GNUNET_YES, | 1369 | MYSQL_TYPE_LONG, &itype, GNUNET_YES, |
1338 | -1); | 1370 | -1); |
1339 | } | 1371 | } |
@@ -1353,13 +1385,19 @@ mysql_plugin_get (void *cls, | |||
1353 | { | 1385 | { |
1354 | if (vhash != NULL) | 1386 | if (vhash != NULL) |
1355 | { | 1387 | { |
1388 | fprintf (stderr, | ||
1389 | "Count by key `%s'\n", | ||
1390 | GNUNET_h2s (key)); | ||
1391 | fprintf (stderr, | ||
1392 | "Count by vhash `%s'\n", | ||
1393 | GNUNET_h2s (vhash)); | ||
1356 | ret = | 1394 | ret = |
1357 | prepared_statement_run_select (plugin, | 1395 | prepared_statement_run_select (plugin, |
1358 | plugin->count_entry_by_hash_and_vhash, | 1396 | plugin->count_entry_by_hash_and_vhash, |
1359 | 1, cbind, | 1397 | 1, cbind, |
1360 | &return_ok, NULL, | 1398 | &return_ok, NULL, |
1361 | MYSQL_TYPE_BLOB, key, hashSize, &hashSize, | 1399 | MYSQL_TYPE_BLOB, key, hashSize, &hashSize, |
1362 | MYSQL_TYPE_BLOB, vhash, hashSize, &hashSize, | 1400 | MYSQL_TYPE_BLOB, vhash, hashSize2, &hashSize2, |
1363 | -1); | 1401 | -1); |
1364 | 1402 | ||
1365 | } | 1403 | } |
@@ -1374,6 +1412,12 @@ mysql_plugin_get (void *cls, | |||
1374 | -1); | 1412 | -1); |
1375 | } | 1413 | } |
1376 | } | 1414 | } |
1415 | fprintf (stderr, | ||
1416 | "Got %u results (ret: %d / `%s')\n", | ||
1417 | (unsigned int) total, | ||
1418 | ret, | ||
1419 | mysql_error (plugin->dbf)); | ||
1420 | |||
1377 | if ((ret != GNUNET_OK) || (0 >= total)) | 1421 | if ((ret != GNUNET_OK) || (0 >= total)) |
1378 | { | 1422 | { |
1379 | iter (iter_cls, | 1423 | 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; | |||
21 | QUOTA = 10000000 | 21 | QUOTA = 10000000 |
22 | BLOOMFILTER = $SERVICEHOME/fs/bloomfilter | 22 | BLOOMFILTER = $SERVICEHOME/fs/bloomfilter |
23 | DATABASE = mysql | 23 | DATABASE = mysql |
24 | DISABLE_SOCKET_FORWARDING = YES | ||
25 | # USERNAME = | 24 | # USERNAME = |
26 | # MAXBUF = | 25 | # MAXBUF = |
27 | # TIMEOUT = | 26 | # 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 | |||
44 | AUTOSTART = NO | 44 | AUTOSTART = NO |
45 | 45 | ||
46 | 46 | ||
47 | [fs] | ||
48 | AUTOSTART = NO | ||