aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-08-26 12:14:19 +0000
committerChristian Grothoff <christian@grothoff.org>2010-08-26 12:14:19 +0000
commitbf99b4a4df68b7fc2de68ee09a0526cf72fe66d0 (patch)
tree78447d0f1853f0a32a5f96b26143f0a3554d4f9d /src/datastore
parente5b17382d5d0ef9b80e95d1780d1ca1c1eb47f29 (diff)
downloadgnunet-bf99b4a4df68b7fc2de68ee09a0526cf72fe66d0.tar.gz
gnunet-bf99b4a4df68b7fc2de68ee09a0526cf72fe66d0.zip
fixes
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/plugin_datastore_postgres.c18
-rw-r--r--src/datastore/test_datastore_api.c2
-rw-r--r--src/datastore/test_datastore_api_data_postgres.conf2
3 files changed, 18 insertions, 4 deletions
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c
index b4540828a..9473bbbed 100644
--- a/src/datastore/plugin_datastore_postgres.c
+++ b/src/datastore/plugin_datastore_postgres.c
@@ -523,11 +523,13 @@ postgres_plugin_put (void *cls,
523 return GNUNET_SYSERR; 523 return GNUNET_SYSERR;
524 PQclear (ret); 524 PQclear (ret);
525 plugin->payload += size; 525 plugin->payload += size;
526#if DEBUG_POSTGRES
526 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 527 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
527 "postgres", 528 "postgres",
528 "Stored %u bytes in database, new payload is %llu\n", 529 "Stored %u bytes in database, new payload is %llu\n",
529 (unsigned int) size, 530 (unsigned int) size,
530 (unsigned long long) plugin->payload); 531 (unsigned long long) plugin->payload);
532#endif
531 return GNUNET_OK; 533 return GNUNET_OK;
532} 534}
533 535
@@ -561,10 +563,12 @@ postgres_next_request_cont (void *next_cls,
561 if ( (GNUNET_YES == nrc->end_it) || 563 if ( (GNUNET_YES == nrc->end_it) ||
562 (nrc->count == nrc->total) ) 564 (nrc->count == nrc->total) )
563 { 565 {
566#if DEBUG_POSTGRES
564 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 567 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
565 "postgres", 568 "postgres",
566 "Ending iteration (%s)\n", 569 "Ending iteration (%s)\n",
567 (GNUNET_YES == nrc->end_it) ? "client requested it" : "completed result set"); 570 (GNUNET_YES == nrc->end_it) ? "client requested it" : "completed result set");
571#endif
568 nrc->iter (nrc->iter_cls, 572 nrc->iter (nrc->iter_cls,
569 NULL, NULL, 0, NULL, 0, 0, 0, 573 NULL, NULL, 0, NULL, 0, 0, 0,
570 GNUNET_TIME_UNIT_ZERO_ABS, 0); 574 GNUNET_TIME_UNIT_ZERO_ABS, 0);
@@ -592,9 +596,11 @@ postgres_next_request_cont (void *next_cls,
592 nrc->pname, 596 nrc->pname,
593 __LINE__)) 597 __LINE__))
594 { 598 {
599#if DEBUG_POSTGRES
595 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 600 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
596 "postgres", 601 "postgres",
597 "Ending iteration (postgres error)\n"); 602 "Ending iteration (postgres error)\n");
603#endif
598 nrc->iter (nrc->iter_cls, 604 nrc->iter (nrc->iter_cls,
599 NULL, NULL, 0, NULL, 0, 0, 0, 605 NULL, NULL, 0, NULL, 0, 0, 0,
600 GNUNET_TIME_UNIT_ZERO_ABS, 0); 606 GNUNET_TIME_UNIT_ZERO_ABS, 0);
@@ -605,9 +611,11 @@ postgres_next_request_cont (void *next_cls,
605 if (0 == PQntuples (res)) 611 if (0 == PQntuples (res))
606 { 612 {
607 /* no result */ 613 /* no result */
614#if DEBUG_POSTGRES
608 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 615 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
609 "postgres", 616 "postgres",
610 "Ending iteration (no more results)\n"); 617 "Ending iteration (no more results)\n");
618#endif
611 nrc->iter (nrc->iter_cls, 619 nrc->iter (nrc->iter_cls,
612 NULL, NULL, 0, NULL, 0, 0, 0, 620 NULL, NULL, 0, NULL, 0, 0, 0,
613 GNUNET_TIME_UNIT_ZERO_ABS, 0); 621 GNUNET_TIME_UNIT_ZERO_ABS, 0);
@@ -659,11 +667,13 @@ postgres_next_request_cont (void *next_cls,
659 nrc->blast_rowid = htonl (rowid); 667 nrc->blast_rowid = htonl (rowid);
660 nrc->count++; 668 nrc->count++;
661 669
670#if DEBUG_POSTGRES
662 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 671 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
663 "postgres", 672 "postgres",
664 "Found result of size %u bytes and type %u in database\n", 673 "Found result of size %u bytes and type %u in database\n",
665 (unsigned int) size, 674 (unsigned int) size,
666 (unsigned int) type); 675 (unsigned int) type);
676#endif
667 iret = nrc->iter (nrc->iter_cls, 677 iret = nrc->iter (nrc->iter_cls,
668 nrc, 678 nrc,
669 &key, 679 &key,
@@ -677,27 +687,33 @@ postgres_next_request_cont (void *next_cls,
677 PQclear (res); 687 PQclear (res);
678 if (iret == GNUNET_SYSERR) 688 if (iret == GNUNET_SYSERR)
679 { 689 {
690#if DEBUG_POSTGRES
680 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 691 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
681 "postgres", 692 "postgres",
682 "Ending iteration (client error)\n"); 693 "Ending iteration (client error)\n");
694#endif
683 return; 695 return;
684 } 696 }
685 if (iret == GNUNET_NO) 697 if (iret == GNUNET_NO)
686 { 698 {
687 if (GNUNET_OK == delete_by_rowid (plugin, rowid)) 699 if (GNUNET_OK == delete_by_rowid (plugin, rowid))
688 { 700 {
701#if DEBUG_POSTGRES
689 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 702 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
690 "postgres", 703 "postgres",
691 "Deleting %u bytes from database, current payload is %llu\n", 704 "Deleting %u bytes from database, current payload is %llu\n",
692 (unsigned int) size, 705 (unsigned int) size,
693 (unsigned long long) plugin->payload); 706 (unsigned long long) plugin->payload);
707#endif
694 GNUNET_assert (plugin->payload >= size); 708 GNUNET_assert (plugin->payload >= size);
695 plugin->payload -= size; 709 plugin->payload -= size;
710#if DEBUG_POSTGRES
696 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 711 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
697 "postgres", 712 "postgres",
698 "Deleted %u bytes from database, new payload is %llu\n", 713 "Deleted %u bytes from database, new payload is %llu\n",
699 (unsigned int) size, 714 (unsigned int) size,
700 (unsigned long long) plugin->payload); 715 (unsigned long long) plugin->payload);
716#endif
701 } 717 }
702 } 718 }
703} 719}
@@ -1048,8 +1064,6 @@ postgres_plugin_get (void *cls,
1048 return; 1064 return;
1049 } 1065 }
1050 nrc->total = GNUNET_ntohll (*(const unsigned long long *) PQgetvalue (ret, 0, 0)); 1066 nrc->total = GNUNET_ntohll (*(const unsigned long long *) PQgetvalue (ret, 0, 0));
1051 fprintf (stderr, "Total number of results: %llu\n",
1052 (unsigned long long) nrc->total);
1053 PQclear (ret); 1067 PQclear (ret);
1054 if (nrc->total == 0) 1068 if (nrc->total == 0)
1055 { 1069 {
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c
index aaa00bdd8..0ea3c4c86 100644
--- a/src/datastore/test_datastore_api.c
+++ b/src/datastore/test_datastore_api.c
@@ -31,7 +31,7 @@
31#include "gnunet_protocols.h" 31#include "gnunet_protocols.h"
32#include "gnunet_datastore_service.h" 32#include "gnunet_datastore_service.h"
33 33
34#define VERBOSE GNUNET_YES 34#define VERBOSE GNUNET_NO
35 35
36#define START_DATASTORE GNUNET_YES 36#define START_DATASTORE GNUNET_YES
37 37
diff --git a/src/datastore/test_datastore_api_data_postgres.conf b/src/datastore/test_datastore_api_data_postgres.conf
index 4d4b94d05..0bc55852e 100644
--- a/src/datastore/test_datastore_api_data_postgres.conf
+++ b/src/datastore/test_datastore_api_data_postgres.conf
@@ -30,7 +30,7 @@ DISABLE_SOCKET_FORWARDING = YES
30# REJECT_FROM = 30# REJECT_FROM =
31# REJECT_FROM6 = 31# REJECT_FROM6 =
32# PREFIX = 32# PREFIX =
33DEBUG = 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
36BINARY = gnunet-service-datastore 36BINARY = gnunet-service-datastore