diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-04-11 12:19:55 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-04-11 12:19:55 +0200 |
commit | 38c918ff27e5a90c1a17f3989a78c7fca564c47a (patch) | |
tree | 926616f78b59fc0fa3d5e6e643f787f4a9fdcb2f /src | |
parent | 7fe5d70497352ea453289fc582089ac1c352204a (diff) | |
download | gnunet-38c918ff27e5a90c1a17f3989a78c7fca564c47a.tar.gz gnunet-38c918ff27e5a90c1a17f3989a78c7fca564c47a.zip |
support async commit
Diffstat (limited to 'src')
-rw-r--r-- | src/namestore/gnunet-zoneimport.c | 11 | ||||
-rw-r--r-- | src/namestore/namestore.conf.in | 4 | ||||
-rw-r--r-- | src/namestore/plugin_namestore_postgres.c | 19 |
3 files changed, 31 insertions, 3 deletions
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c index 493569bca..9041431d1 100644 --- a/src/namestore/gnunet-zoneimport.c +++ b/src/namestore/gnunet-zoneimport.c | |||
@@ -1254,13 +1254,18 @@ run (void *cls, | |||
1254 | "libgnunet_plugin_namestore_%s", | 1254 | "libgnunet_plugin_namestore_%s", |
1255 | database); | 1255 | database); |
1256 | ns = GNUNET_PLUGIN_load (db_lib_name, | 1256 | ns = GNUNET_PLUGIN_load (db_lib_name, |
1257 | (void *) cfg); | 1257 | (void *) cfg); |
1258 | GNUNET_free (database); | 1258 | GNUNET_free (database); |
1259 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, | ||
1260 | NULL); | ||
1261 | if (NULL == ns) | ||
1262 | { | ||
1263 | GNUNET_SCHEDULER_shutdown (); | ||
1264 | return; | ||
1265 | } | ||
1259 | id = GNUNET_IDENTITY_connect (cfg, | 1266 | id = GNUNET_IDENTITY_connect (cfg, |
1260 | &identity_cb, | 1267 | &identity_cb, |
1261 | NULL); | 1268 | NULL); |
1262 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, | ||
1263 | NULL); | ||
1264 | } | 1269 | } |
1265 | 1270 | ||
1266 | 1271 | ||
diff --git a/src/namestore/namestore.conf.in b/src/namestore/namestore.conf.in index 0ebd2586b..f19ac5643 100644 --- a/src/namestore/namestore.conf.in +++ b/src/namestore/namestore.conf.in | |||
@@ -19,8 +19,12 @@ FILENAME = $GNUNET_DATA_HOME/namestore/flat.db | |||
19 | 19 | ||
20 | 20 | ||
21 | [namestore-postgres] | 21 | [namestore-postgres] |
22 | # How to connect to the database | ||
22 | CONFIG = postgres:///gnunet | 23 | CONFIG = postgres:///gnunet |
24 | # Use temporary tables | ||
23 | TEMPORARY_TABLE = NO | 25 | TEMPORARY_TABLE = NO |
26 | # Use asynchronous commit (SET synchronous_commit TO OFF). | ||
27 | ASYNC_COMMIT = NO | ||
24 | 28 | ||
25 | [uri] | 29 | [uri] |
26 | gns = gnunet-namestore | 30 | gns = gnunet-namestore |
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c index 872bf75cb..4828cb190 100644 --- a/src/namestore/plugin_namestore_postgres.c +++ b/src/namestore/plugin_namestore_postgres.c | |||
@@ -93,6 +93,25 @@ database_setup (struct Plugin *plugin) | |||
93 | if (GNUNET_YES == | 93 | if (GNUNET_YES == |
94 | GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg, | 94 | GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg, |
95 | "namestore-postgres", | 95 | "namestore-postgres", |
96 | "ASYNC_COMMIT")) | ||
97 | { | ||
98 | struct GNUNET_PQ_ExecuteStatement es[] = { | ||
99 | GNUNET_PQ_make_try_execute ("SET synchronous_commit TO off"), | ||
100 | GNUNET_PQ_EXECUTE_STATEMENT_END | ||
101 | }; | ||
102 | |||
103 | if (GNUNET_OK != | ||
104 | GNUNET_PQ_exec_statements (plugin->dbh, | ||
105 | es)) | ||
106 | { | ||
107 | PQfinish (plugin->dbh); | ||
108 | plugin->dbh = NULL; | ||
109 | return GNUNET_SYSERR; | ||
110 | } | ||
111 | } | ||
112 | if (GNUNET_YES == | ||
113 | GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg, | ||
114 | "namestore-postgres", | ||
96 | "TEMPORARY_TABLE")) | 115 | "TEMPORARY_TABLE")) |
97 | { | 116 | { |
98 | cr = &es_temporary; | 117 | cr = &es_temporary; |