diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-05-01 11:53:00 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-05-01 11:53:00 +0200 |
commit | 8f0e0c9dfd1020c5a202cd1927054291c034ca20 (patch) | |
tree | 0e41ffe7a1863c00310e1433609dcd95fa224b64 /src/namestore/gnunet-service-namestore.c | |
parent | 3b16879d89a65d3f3b386be76d15954d5423d532 (diff) | |
download | gnunet-8f0e0c9dfd1020c5a202cd1927054291c034ca20.tar.gz gnunet-8f0e0c9dfd1020c5a202cd1927054291c034ca20.zip |
add perf_ logic for namestore iterations, improve namestore insertion performance by 30
percent
Diffstat (limited to 'src/namestore/gnunet-service-namestore.c')
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index e3936a7cc..0456e5c15 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -1032,7 +1032,8 @@ check_record_store (void *cls, | |||
1032 | GNUNET_break (0); | 1032 | GNUNET_break (0); |
1033 | return GNUNET_SYSERR; | 1033 | return GNUNET_SYSERR; |
1034 | } | 1034 | } |
1035 | if ((0 == name_len) || (name_len > MAX_NAME_LEN)) | 1035 | if ( (0 == name_len) || |
1036 | (name_len > MAX_NAME_LEN) ) | ||
1036 | { | 1037 | { |
1037 | GNUNET_break (0); | 1038 | GNUNET_break (0); |
1038 | return GNUNET_SYSERR; | 1039 | return GNUNET_SYSERR; |
@@ -1066,7 +1067,6 @@ handle_record_store (void *cls, | |||
1066 | const char *rd_ser; | 1067 | const char *rd_ser; |
1067 | unsigned int rd_count; | 1068 | unsigned int rd_count; |
1068 | int res; | 1069 | int res; |
1069 | struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | ||
1070 | struct ZoneMonitor *zm; | 1070 | struct ZoneMonitor *zm; |
1071 | 1071 | ||
1072 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1072 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1093,8 +1093,6 @@ handle_record_store (void *cls, | |||
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | /* Extracting and converting private key */ | 1095 | /* Extracting and converting private key */ |
1096 | GNUNET_CRYPTO_ecdsa_key_get_public (&rp_msg->private_key, | ||
1097 | &pubkey); | ||
1098 | conv_name = GNUNET_GNSRECORD_string_to_lowercase (name_tmp); | 1096 | conv_name = GNUNET_GNSRECORD_string_to_lowercase (name_tmp); |
1099 | if (NULL == conv_name) | 1097 | if (NULL == conv_name) |
1100 | { | 1098 | { |
@@ -1105,11 +1103,9 @@ handle_record_store (void *cls, | |||
1105 | return; | 1103 | return; |
1106 | } | 1104 | } |
1107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1105 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1108 | "Creating %u records for name `%s' in zone `%s'\n", | 1106 | "Creating %u records for name `%s'\n", |
1109 | (unsigned int) rd_count, | 1107 | (unsigned int) rd_count, |
1110 | conv_name, | 1108 | conv_name); |
1111 | GNUNET_GNSRECORD_z2s (&pubkey)); | ||
1112 | |||
1113 | if ( (0 == rd_count) && | 1109 | if ( (0 == rd_count) && |
1114 | (GNUNET_NO == | 1110 | (GNUNET_NO == |
1115 | GSN_database->iterate_records (GSN_database->cls, | 1111 | GSN_database->iterate_records (GSN_database->cls, |
@@ -1150,7 +1146,8 @@ handle_record_store (void *cls, | |||
1150 | { | 1146 | { |
1151 | for (zm = monitor_head; NULL != zm; zm = zm->next) | 1147 | for (zm = monitor_head; NULL != zm; zm = zm->next) |
1152 | { | 1148 | { |
1153 | if ( (0 == memcmp (&rp_msg->private_key, &zm->zone, | 1149 | if ( (0 == memcmp (&rp_msg->private_key, |
1150 | &zm->zone, | ||
1154 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) || | 1151 | sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) || |
1155 | (0 == memcmp (&zm->zone, | 1152 | (0 == memcmp (&zm->zone, |
1156 | &zero, | 1153 | &zero, |
@@ -1363,7 +1360,7 @@ struct ZoneIterationProcResult | |||
1363 | 1360 | ||
1364 | /** | 1361 | /** |
1365 | * Process results for zone iteration from database | 1362 | * Process results for zone iteration from database |
1366 | * | 1363 | * |
1367 | * @param cls struct ZoneIterationProcResult | 1364 | * @param cls struct ZoneIterationProcResult |
1368 | * @param seq sequence number of the record | 1365 | * @param seq sequence number of the record |
1369 | * @param zone_key the zone key | 1366 | * @param zone_key the zone key |
@@ -1446,6 +1443,10 @@ run_zone_iteration_round (struct ZoneIteration *zi, | |||
1446 | memset (&proc, | 1443 | memset (&proc, |
1447 | 0, | 1444 | 0, |
1448 | sizeof (proc)); | 1445 | sizeof (proc)); |
1446 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1447 | "Asked to return up to %llu records at position %llu\n", | ||
1448 | (unsigned long long) limit, | ||
1449 | (unsigned long long) zi->seq); | ||
1449 | proc.zi = zi; | 1450 | proc.zi = zi; |
1450 | proc.limit = limit; | 1451 | proc.limit = limit; |
1451 | start = GNUNET_TIME_absolute_get (); | 1452 | start = GNUNET_TIME_absolute_get (); |