diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-08-06 06:47:45 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-08-06 06:47:45 +0000 |
commit | 67e65b83aac53ff0bf5f679b70ac80593f838a54 (patch) | |
tree | ce3851974f0351fdf49ff0fa0e3c469727dcbb2b /src | |
parent | c59802b4a2aa41f3293121742eaacd8df295302c (diff) | |
download | gnunet-67e65b83aac53ff0bf5f679b70ac80593f838a54.tar.gz gnunet-67e65b83aac53ff0bf5f679b70ac80593f838a54.zip |
bugfixes
Diffstat (limited to 'src')
-rw-r--r-- | src/datastore/plugin_datastore_mysql.c | 214 | ||||
-rw-r--r-- | src/datastore/test_datastore_api.c | 16 | ||||
-rw-r--r-- | src/datastore/test_datastore_api_data_mysql.conf | 4 |
3 files changed, 159 insertions, 75 deletions
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index 28b59cb60..703ba8c32 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c | |||
@@ -904,13 +904,26 @@ do_delete_value (struct Plugin *plugin, | |||
904 | { | 904 | { |
905 | int ret; | 905 | int ret; |
906 | 906 | ||
907 | #if DEBUG_MYSQL | ||
908 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
909 | "Deleting value %llu from gn072 table\n", | ||
910 | vkey); | ||
911 | #endif | ||
907 | ret = prepared_statement_run (plugin, | 912 | ret = prepared_statement_run (plugin, |
908 | plugin->delete_value, | 913 | plugin->delete_value, |
909 | NULL, | 914 | NULL, |
910 | MYSQL_TYPE_LONGLONG, | 915 | MYSQL_TYPE_LONGLONG, |
911 | &vkey, GNUNET_YES, -1); | 916 | &vkey, GNUNET_YES, -1); |
912 | if (ret > 0) | 917 | if (ret > 0) |
913 | ret = GNUNET_OK; | 918 | { |
919 | ret = GNUNET_OK; | ||
920 | } | ||
921 | else | ||
922 | { | ||
923 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
924 | "Deleting value %llu from gn072 table failed\n", | ||
925 | vkey); | ||
926 | } | ||
914 | return ret; | 927 | return ret; |
915 | } | 928 | } |
916 | 929 | ||
@@ -928,12 +941,29 @@ do_insert_value (struct Plugin *plugin, | |||
928 | unsigned long long *vkey) | 941 | unsigned long long *vkey) |
929 | { | 942 | { |
930 | unsigned long length = size; | 943 | unsigned long length = size; |
944 | int ret; | ||
931 | 945 | ||
932 | return prepared_statement_run (plugin, | 946 | ret = prepared_statement_run (plugin, |
933 | plugin->insert_value, | 947 | plugin->insert_value, |
934 | vkey, | 948 | vkey, |
935 | MYSQL_TYPE_BLOB, | 949 | MYSQL_TYPE_BLOB, |
936 | value, length, &length, -1); | 950 | value, length, &length, -1); |
951 | if (ret == GNUNET_OK) | ||
952 | { | ||
953 | #if DEBUG_MYSQL | ||
954 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
955 | "Inserted value number %llu with length %u into gn072 table\n", | ||
956 | *vkey, | ||
957 | size); | ||
958 | #endif | ||
959 | } | ||
960 | else | ||
961 | { | ||
962 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
963 | "Failed to insert %u byte value into gn072 table\n", | ||
964 | size); | ||
965 | } | ||
966 | return ret; | ||
937 | } | 967 | } |
938 | 968 | ||
939 | /** | 969 | /** |
@@ -948,13 +978,26 @@ do_delete_entry_by_vkey (struct Plugin *plugin, | |||
948 | { | 978 | { |
949 | int ret; | 979 | int ret; |
950 | 980 | ||
981 | #if DEBUG_MYSQL | ||
982 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
983 | "Deleting value %llu from gn080 table\n", | ||
984 | vkey); | ||
985 | #endif | ||
951 | ret = prepared_statement_run (plugin, | 986 | ret = prepared_statement_run (plugin, |
952 | plugin->delete_entry_by_vkey, | 987 | plugin->delete_entry_by_vkey, |
953 | NULL, | 988 | NULL, |
954 | MYSQL_TYPE_LONGLONG, | 989 | MYSQL_TYPE_LONGLONG, |
955 | &vkey, GNUNET_YES, -1); | 990 | &vkey, GNUNET_YES, -1); |
956 | if (ret > 0) | 991 | if (ret > 0) |
957 | ret = GNUNET_OK; | 992 | { |
993 | ret = GNUNET_OK; | ||
994 | } | ||
995 | else | ||
996 | { | ||
997 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
998 | "Deleting value %llu from gn080 table failed\n", | ||
999 | vkey); | ||
1000 | } | ||
958 | return ret; | 1001 | return ret; |
959 | } | 1002 | } |
960 | 1003 | ||
@@ -1053,13 +1096,13 @@ iterator_helper_prepare (void *cls, | |||
1053 | 1096 | ||
1054 | 1097 | ||
1055 | /** | 1098 | /** |
1056 | * Continuation of "sqlite_next_request". | 1099 | * Continuation of "mysql_next_request". |
1057 | * | 1100 | * |
1058 | * @param next_cls the next context | 1101 | * @param next_cls the next context |
1059 | * @param tc the task context (unused) | 1102 | * @param tc the task context (unused) |
1060 | */ | 1103 | */ |
1061 | static void | 1104 | static void |
1062 | sqlite_next_request_cont (void *next_cls, | 1105 | mysql_next_request_cont (void *next_cls, |
1063 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 1106 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
1064 | { | 1107 | { |
1065 | struct NextRequestClosure *nrc = next_cls; | 1108 | struct NextRequestClosure *nrc = next_cls; |
@@ -1083,7 +1126,8 @@ sqlite_next_request_cont (void *next_cls, | |||
1083 | plugin->next_task = GNUNET_SCHEDULER_NO_TASK; | 1126 | plugin->next_task = GNUNET_SCHEDULER_NO_TASK; |
1084 | plugin->next_task_nc = NULL; | 1127 | plugin->next_task_nc = NULL; |
1085 | 1128 | ||
1086 | AGAIN: | 1129 | AGAIN: |
1130 | GNUNET_assert (nrc->plugin->next_task == GNUNET_SCHEDULER_NO_TASK); | ||
1087 | nrc->now = GNUNET_TIME_absolute_get (); | 1131 | nrc->now = GNUNET_TIME_absolute_get (); |
1088 | hashSize = sizeof (GNUNET_HashCode); | 1132 | hashSize = sizeof (GNUNET_HashCode); |
1089 | memset (nrc->rbind, 0, sizeof (nrc->rbind)); | 1133 | memset (nrc->rbind, 0, sizeof (nrc->rbind)); |
@@ -1111,17 +1155,16 @@ sqlite_next_request_cont (void *next_cls, | |||
1111 | rbind[6].buffer = &vkey; | 1155 | rbind[6].buffer = &vkey; |
1112 | rbind[6].is_unsigned = GNUNET_YES; | 1156 | rbind[6].is_unsigned = GNUNET_YES; |
1113 | 1157 | ||
1114 | ret = nrc->prep (nrc->prep_cls, | 1158 | if ( (GNUNET_YES == nrc->end_it) || |
1115 | nrc); | 1159 | (GNUNET_OK != nrc->prep (nrc->prep_cls, |
1116 | if (ret != GNUNET_OK) | 1160 | nrc))) |
1117 | goto END_SET; | 1161 | goto END_SET; |
1162 | GNUNET_assert (nrc->plugin->next_task == GNUNET_SCHEDULER_NO_TASK); | ||
1118 | if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 1163 | if (size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
1119 | { | 1164 | { |
1120 | GNUNET_break (0); /* far too big */ | 1165 | GNUNET_break (0); /* far too big */ |
1121 | goto END_SET; | 1166 | goto END_SET; |
1122 | } | 1167 | } |
1123 | |||
1124 | |||
1125 | nrc->last_vkey = vkey; | 1168 | nrc->last_vkey = vkey; |
1126 | nrc->last_prio = priority; | 1169 | nrc->last_prio = priority; |
1127 | nrc->last_expire = exp; | 1170 | nrc->last_expire = exp; |
@@ -1144,6 +1187,15 @@ sqlite_next_request_cont (void *next_cls, | |||
1144 | GNUNET_break (0); | 1187 | GNUNET_break (0); |
1145 | goto END_SET; | 1188 | goto END_SET; |
1146 | } | 1189 | } |
1190 | #if DEBUG_MYSQL | ||
1191 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1192 | "Found value %llu with size %u, prio %u, anon %u, expire %llu selecting from gn080 table\n", | ||
1193 | vkey, | ||
1194 | size, | ||
1195 | priority, | ||
1196 | anonymity, | ||
1197 | exp); | ||
1198 | #endif | ||
1147 | /* now do query on gn072 */ | 1199 | /* now do query on gn072 */ |
1148 | length = size; | 1200 | length = size; |
1149 | memset (dbind, 0, sizeof (dbind)); | 1201 | memset (dbind, 0, sizeof (dbind)); |
@@ -1166,14 +1218,30 @@ sqlite_next_request_cont (void *next_cls, | |||
1166 | (dbind[0].buffer_length != size) || (length != size)) | 1218 | (dbind[0].buffer_length != size) || (length != size)) |
1167 | { | 1219 | { |
1168 | GNUNET_break (ret != 0); /* should have one rbind! */ | 1220 | GNUNET_break (ret != 0); /* should have one rbind! */ |
1221 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1222 | "Failed to obtain %llu from gn072\n", | ||
1223 | vkey); | ||
1169 | GNUNET_break (length == size); /* length should match! */ | 1224 | GNUNET_break (length == size); /* length should match! */ |
1170 | GNUNET_break (dbind[0].buffer_length == size); /* length should be internally consistent! */ | 1225 | GNUNET_break (dbind[0].buffer_length == size); /* length should be internally consistent! */ |
1171 | do_delete_value (plugin, vkey); | ||
1172 | if (ret != 0) | 1226 | if (ret != 0) |
1173 | do_delete_entry_by_vkey (plugin, vkey); | 1227 | { |
1174 | plugin->content_size -= size; | 1228 | do_delete_value (plugin, vkey); |
1229 | do_delete_entry_by_vkey (plugin, vkey); | ||
1230 | plugin->content_size -= size; | ||
1231 | } | ||
1175 | goto AGAIN; | 1232 | goto AGAIN; |
1176 | } | 1233 | } |
1234 | #if DEBUG_MYSQL | ||
1235 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1236 | "Calling iterator with value %llu of size %u with type %u, priority %u, anonymity %u and expiration %llu\n", | ||
1237 | vkey, | ||
1238 | size, | ||
1239 | type, | ||
1240 | priority, | ||
1241 | anonymity, | ||
1242 | exp); | ||
1243 | #endif | ||
1244 | GNUNET_assert (nrc->plugin->next_task == GNUNET_SCHEDULER_NO_TASK); | ||
1177 | expiration.value = exp; | 1245 | expiration.value = exp; |
1178 | ret = nrc->dviter (nrc->dviter_cls, | 1246 | ret = nrc->dviter (nrc->dviter_cls, |
1179 | nrc, | 1247 | nrc, |
@@ -1187,8 +1255,8 @@ sqlite_next_request_cont (void *next_cls, | |||
1187 | vkey); | 1255 | vkey); |
1188 | if (ret == GNUNET_SYSERR) | 1256 | if (ret == GNUNET_SYSERR) |
1189 | { | 1257 | { |
1190 | /* is this correct, or should we not call iter again period? */ | 1258 | nrc->end_it = GNUNET_YES; |
1191 | goto END_SET; | 1259 | return; |
1192 | } | 1260 | } |
1193 | if (ret == GNUNET_NO) | 1261 | if (ret == GNUNET_NO) |
1194 | { | 1262 | { |
@@ -1199,10 +1267,13 @@ sqlite_next_request_cont (void *next_cls, | |||
1199 | return; | 1267 | return; |
1200 | END_SET: | 1268 | END_SET: |
1201 | /* call dviter with "end of set" */ | 1269 | /* call dviter with "end of set" */ |
1270 | GNUNET_assert (nrc->plugin->next_task == GNUNET_SCHEDULER_NO_TASK); | ||
1202 | nrc->dviter (nrc->dviter_cls, | 1271 | nrc->dviter (nrc->dviter_cls, |
1203 | NULL, NULL, 0, NULL, 0, 0, 0, | 1272 | NULL, NULL, 0, NULL, 0, 0, 0, |
1204 | GNUNET_TIME_UNIT_ZERO_ABS, 0); | 1273 | GNUNET_TIME_UNIT_ZERO_ABS, 0); |
1274 | GNUNET_assert (nrc->plugin->next_task == GNUNET_SCHEDULER_NO_TASK); | ||
1205 | nrc->prep (nrc->prep_cls, NULL); | 1275 | nrc->prep (nrc->prep_cls, NULL); |
1276 | GNUNET_assert (nrc->plugin->next_task == GNUNET_SCHEDULER_NO_TASK); | ||
1206 | GNUNET_free (nrc); | 1277 | GNUNET_free (nrc); |
1207 | } | 1278 | } |
1208 | 1279 | ||
@@ -1229,7 +1300,7 @@ mysql_plugin_next_request (void *next_cls, | |||
1229 | nrc->end_it = GNUNET_YES; | 1300 | nrc->end_it = GNUNET_YES; |
1230 | nrc->plugin->next_task_nc = nrc; | 1301 | nrc->plugin->next_task_nc = nrc; |
1231 | nrc->plugin->next_task = GNUNET_SCHEDULER_add_now (nrc->plugin->env->sched, | 1302 | nrc->plugin->next_task = GNUNET_SCHEDULER_add_now (nrc->plugin->env->sched, |
1232 | &sqlite_next_request_cont, | 1303 | &mysql_next_request_cont, |
1233 | nrc); | 1304 | nrc); |
1234 | } | 1305 | } |
1235 | 1306 | ||
@@ -1318,6 +1389,11 @@ mysql_plugin_put (void *cls, | |||
1318 | char **msg) | 1389 | char **msg) |
1319 | { | 1390 | { |
1320 | struct Plugin *plugin = cls; | 1391 | struct Plugin *plugin = cls; |
1392 | unsigned int itype = type; | ||
1393 | unsigned int isize = size; | ||
1394 | unsigned int ipriority = priority; | ||
1395 | unsigned int ianonymity = anonymity; | ||
1396 | unsigned long long lexpiration = expiration.value; | ||
1321 | unsigned long hashSize; | 1397 | unsigned long hashSize; |
1322 | unsigned long hashSize2; | 1398 | unsigned long hashSize2; |
1323 | unsigned long long vkey; | 1399 | unsigned long long vkey; |
@@ -1339,19 +1415,19 @@ mysql_plugin_put (void *cls, | |||
1339 | plugin->insert_entry, | 1415 | plugin->insert_entry, |
1340 | NULL, | 1416 | NULL, |
1341 | MYSQL_TYPE_LONG, | 1417 | MYSQL_TYPE_LONG, |
1342 | &size, | 1418 | &isize, |
1343 | GNUNET_YES, | 1419 | GNUNET_YES, |
1344 | MYSQL_TYPE_LONG, | 1420 | MYSQL_TYPE_LONG, |
1345 | &type, | 1421 | &itype, |
1346 | GNUNET_YES, | 1422 | GNUNET_YES, |
1347 | MYSQL_TYPE_LONG, | 1423 | MYSQL_TYPE_LONG, |
1348 | &priority, | 1424 | &ipriority, |
1349 | GNUNET_YES, | 1425 | GNUNET_YES, |
1350 | MYSQL_TYPE_LONG, | 1426 | MYSQL_TYPE_LONG, |
1351 | &anonymity, | 1427 | &ianonymity, |
1352 | GNUNET_YES, | 1428 | GNUNET_YES, |
1353 | MYSQL_TYPE_LONGLONG, | 1429 | MYSQL_TYPE_LONGLONG, |
1354 | &expiration.value, | 1430 | &lexpiration, |
1355 | GNUNET_YES, | 1431 | GNUNET_YES, |
1356 | MYSQL_TYPE_BLOB, | 1432 | MYSQL_TYPE_BLOB, |
1357 | key, | 1433 | key, |
@@ -1367,6 +1443,12 @@ mysql_plugin_put (void *cls, | |||
1367 | do_delete_value (plugin, vkey); | 1443 | do_delete_value (plugin, vkey); |
1368 | return GNUNET_SYSERR; | 1444 | return GNUNET_SYSERR; |
1369 | } | 1445 | } |
1446 | #if DEBUG_MYSQL | ||
1447 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1448 | "Inserted value number %llu with size %u into gn080 table\n", | ||
1449 | vkey, | ||
1450 | isize); | ||
1451 | #endif | ||
1370 | plugin->content_size += size; | 1452 | plugin->content_size += size; |
1371 | return GNUNET_OK; | 1453 | return GNUNET_OK; |
1372 | } | 1454 | } |
@@ -1420,7 +1502,6 @@ get_statement_prepare (void *cls, | |||
1420 | { | 1502 | { |
1421 | struct GetContext *gc = cls; | 1503 | struct GetContext *gc = cls; |
1422 | struct Plugin *plugin; | 1504 | struct Plugin *plugin; |
1423 | MYSQL_BIND *rbind; | ||
1424 | int ret; | 1505 | int ret; |
1425 | 1506 | ||
1426 | if (NULL == nrc) | 1507 | if (NULL == nrc) |
@@ -1431,31 +1512,7 @@ get_statement_prepare (void *cls, | |||
1431 | if (gc->count == gc->total) | 1512 | if (gc->count == gc->total) |
1432 | return GNUNET_NO; | 1513 | return GNUNET_NO; |
1433 | plugin = nrc->plugin; | 1514 | plugin = nrc->plugin; |
1434 | memset (nrc->rbind, 0, sizeof (nrc->rbind)); | ||
1435 | gc->hashSize = sizeof (GNUNET_HashCode); | 1515 | gc->hashSize = sizeof (GNUNET_HashCode); |
1436 | rbind = nrc->rbind; | ||
1437 | rbind[0].buffer_type = MYSQL_TYPE_LONG; | ||
1438 | rbind[0].buffer = &gc->size; | ||
1439 | rbind[0].is_unsigned = GNUNET_YES; | ||
1440 | rbind[1].buffer_type = MYSQL_TYPE_LONG; | ||
1441 | rbind[1].buffer = &nrc->type; | ||
1442 | rbind[1].is_unsigned = GNUNET_YES; | ||
1443 | rbind[2].buffer_type = MYSQL_TYPE_LONG; | ||
1444 | rbind[2].buffer = &nrc->last_prio; | ||
1445 | rbind[2].is_unsigned = GNUNET_YES; | ||
1446 | rbind[3].buffer_type = MYSQL_TYPE_LONG; | ||
1447 | rbind[3].buffer = &gc->anonymity; | ||
1448 | rbind[3].is_unsigned = GNUNET_YES; | ||
1449 | rbind[4].buffer_type = MYSQL_TYPE_LONGLONG; | ||
1450 | rbind[4].buffer = &gc->expiration; | ||
1451 | rbind[4].is_unsigned = GNUNET_YES; | ||
1452 | rbind[5].buffer_type = MYSQL_TYPE_BLOB; | ||
1453 | rbind[5].buffer = &gc->key; | ||
1454 | rbind[5].buffer_length = gc->hashSize; | ||
1455 | rbind[5].length = &gc->hashSize; | ||
1456 | rbind[6].buffer_type = MYSQL_TYPE_LONGLONG; | ||
1457 | rbind[6].buffer = &gc->vkey; | ||
1458 | rbind[6].is_unsigned = GNUNET_YES; | ||
1459 | if (gc->count == 0) | 1516 | if (gc->count == 0) |
1460 | gc->limit_off = gc->off; | 1517 | gc->limit_off = gc->off; |
1461 | else | 1518 | else |
@@ -1542,6 +1599,7 @@ mysql_plugin_get (void *cls, | |||
1542 | PluginIterator iter, void *iter_cls) | 1599 | PluginIterator iter, void *iter_cls) |
1543 | { | 1600 | { |
1544 | struct Plugin *plugin = cls; | 1601 | struct Plugin *plugin = cls; |
1602 | unsigned int itype = type; | ||
1545 | int ret; | 1603 | int ret; |
1546 | MYSQL_BIND cbind[1]; | 1604 | MYSQL_BIND cbind[1]; |
1547 | struct GetContext *gc; | 1605 | struct GetContext *gc; |
@@ -1573,7 +1631,7 @@ mysql_plugin_get (void *cls, | |||
1573 | (plugin, | 1631 | (plugin, |
1574 | plugin->count_entry_by_hash_vhash_and_type, 1, cbind, &return_ok, NULL, | 1632 | plugin->count_entry_by_hash_vhash_and_type, 1, cbind, &return_ok, NULL, |
1575 | MYSQL_TYPE_BLOB, key, hashSize, &hashSize, MYSQL_TYPE_BLOB, | 1633 | MYSQL_TYPE_BLOB, key, hashSize, &hashSize, MYSQL_TYPE_BLOB, |
1576 | vhash, hashSize, &hashSize, MYSQL_TYPE_LONG, &type, GNUNET_YES, | 1634 | vhash, hashSize, &hashSize, MYSQL_TYPE_LONG, &itype, GNUNET_YES, |
1577 | -1); | 1635 | -1); |
1578 | } | 1636 | } |
1579 | else | 1637 | else |
@@ -1583,7 +1641,7 @@ mysql_plugin_get (void *cls, | |||
1583 | (plugin, | 1641 | (plugin, |
1584 | plugin->count_entry_by_hash_and_type, 1, cbind, &return_ok, NULL, | 1642 | plugin->count_entry_by_hash_and_type, 1, cbind, &return_ok, NULL, |
1585 | MYSQL_TYPE_BLOB, key, hashSize, &hashSize, MYSQL_TYPE_LONG, | 1643 | MYSQL_TYPE_BLOB, key, hashSize, &hashSize, MYSQL_TYPE_LONG, |
1586 | &type, GNUNET_YES, -1); | 1644 | &itype, GNUNET_YES, -1); |
1587 | 1645 | ||
1588 | } | 1646 | } |
1589 | } | 1647 | } |
@@ -1673,22 +1731,38 @@ mysql_plugin_update (void *cls, | |||
1673 | { | 1731 | { |
1674 | struct Plugin *plugin = cls; | 1732 | struct Plugin *plugin = cls; |
1675 | unsigned long long vkey = uid; | 1733 | unsigned long long vkey = uid; |
1734 | unsigned long long lexpire = expire.value; | ||
1735 | int ret; | ||
1676 | 1736 | ||
1677 | return prepared_statement_run (plugin, | 1737 | #if DEBUG_MYSQL |
1678 | plugin->update_entry, | 1738 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1679 | NULL, | 1739 | "Updating value %llu adding %d to priority and maxing exp at %llu\n", |
1680 | MYSQL_TYPE_LONG, | 1740 | vkey, |
1681 | &delta, | 1741 | delta, |
1682 | GNUNET_NO, | 1742 | lexpire); |
1683 | MYSQL_TYPE_LONGLONG, | 1743 | #endif |
1684 | &expire.value, | 1744 | ret = prepared_statement_run (plugin, |
1685 | GNUNET_YES, | 1745 | plugin->update_entry, |
1686 | MYSQL_TYPE_LONGLONG, | 1746 | NULL, |
1687 | &expire.value, | 1747 | MYSQL_TYPE_LONG, |
1688 | GNUNET_YES, | 1748 | &delta, |
1689 | MYSQL_TYPE_LONGLONG, | 1749 | GNUNET_NO, |
1690 | &vkey, | 1750 | MYSQL_TYPE_LONGLONG, |
1691 | GNUNET_YES, -1); | 1751 | &lexpire, |
1752 | GNUNET_YES, | ||
1753 | MYSQL_TYPE_LONGLONG, | ||
1754 | &lexpire, | ||
1755 | GNUNET_YES, | ||
1756 | MYSQL_TYPE_LONGLONG, | ||
1757 | &vkey, | ||
1758 | GNUNET_YES, -1); | ||
1759 | if (ret != GNUNET_OK) | ||
1760 | { | ||
1761 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1762 | "Failed to update value %llu\n", | ||
1763 | vkey); | ||
1764 | } | ||
1765 | return ret; | ||
1692 | } | 1766 | } |
1693 | 1767 | ||
1694 | 1768 | ||
@@ -1727,8 +1801,8 @@ mysql_plugin_iter_zero_anonymity (void *cls, | |||
1727 | */ | 1801 | */ |
1728 | static void | 1802 | static void |
1729 | mysql_plugin_iter_ascending_expiration (void *cls, | 1803 | mysql_plugin_iter_ascending_expiration (void *cls, |
1730 | enum GNUNET_BLOCK_Type type, | 1804 | enum GNUNET_BLOCK_Type type, |
1731 | PluginIterator iter, | 1805 | PluginIterator iter, |
1732 | void *iter_cls) | 1806 | void *iter_cls) |
1733 | { | 1807 | { |
1734 | struct Plugin *plugin = cls; | 1808 | struct Plugin *plugin = cls; |
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c index 1a753d2bf..2ae6dbe4a 100644 --- a/src/datastore/test_datastore_api.c +++ b/src/datastore/test_datastore_api.c | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | #define VERBOSE GNUNET_NO | 34 | #define VERBOSE GNUNET_NO |
35 | 35 | ||
36 | #define START_DATASTORE GNUNET_NO | 36 | #define START_DATASTORE GNUNET_YES |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * How long until we give up on transmitting the message? | 39 | * How long until we give up on transmitting the message? |
@@ -299,6 +299,9 @@ check_multiple (void *cls, | |||
299 | { | 299 | { |
300 | if (crc->phase != RP_GET_MULTIPLE_DONE) | 300 | if (crc->phase != RP_GET_MULTIPLE_DONE) |
301 | { | 301 | { |
302 | fprintf (stderr, | ||
303 | "Wrong phase: %d\n", | ||
304 | crc->phase); | ||
302 | GNUNET_break (0); | 305 | GNUNET_break (0); |
303 | crc->phase = RP_ERROR; | 306 | crc->phase = RP_ERROR; |
304 | } | 307 | } |
@@ -352,8 +355,15 @@ check_update (void *cls, | |||
352 | 355 | ||
353 | if (key == NULL) | 356 | if (key == NULL) |
354 | { | 357 | { |
355 | GNUNET_assert (crc->phase == RP_UPDATE_DONE); | 358 | if (crc->phase != RP_UPDATE_DONE) |
356 | crc->phase = RP_DONE; | 359 | { |
360 | GNUNET_break (0); | ||
361 | crc->phase = RP_ERROR; | ||
362 | } | ||
363 | else | ||
364 | { | ||
365 | crc->phase = RP_DONE; | ||
366 | } | ||
357 | GNUNET_SCHEDULER_add_continuation (crc->sched, | 367 | GNUNET_SCHEDULER_add_continuation (crc->sched, |
358 | &run_continuation, | 368 | &run_continuation, |
359 | crc, | 369 | crc, |
diff --git a/src/datastore/test_datastore_api_data_mysql.conf b/src/datastore/test_datastore_api_data_mysql.conf index a72f58a8a..774f7eba2 100644 --- a/src/datastore/test_datastore_api_data_mysql.conf +++ b/src/datastore/test_datastore_api_data_mysql.conf | |||
@@ -31,9 +31,9 @@ DISABLE_SOCKET_FORWARDING = YES | |||
31 | # REJECT_FROM6 = | 31 | # REJECT_FROM6 = |
32 | # PREFIX = | 32 | # PREFIX = |
33 | # DEBUG = YES | 33 | # DEBUG = YES |
34 | PREFIX = xterm -T datastore -e gdb --args | 34 | # PREFIX = xterm -T datastore -e gdb --args |
35 | # PREFIX = valgrind --tool=memcheck --leak-check=yes | 35 | # PREFIX = valgrind --tool=memcheck --leak-check=yes |
36 | BINARY = /home/grothoff/gn9/bin/gnunet-service-datastore | 36 | BINARY = gnunet-service-datastore |
37 | 37 | ||
38 | [statistics] | 38 | [statistics] |
39 | PORT = 22667 | 39 | PORT = 22667 |