aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/namestore/gnunet-zoneimport.c11
-rw-r--r--src/namestore/namestore.conf.in4
-rw-r--r--src/namestore/plugin_namestore_postgres.c19
3 files changed, 31 insertions, 3 deletions
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c
index 493569bcaa..9041431d1d 100644
--- a/src/namestore/gnunet-zoneimport.c
+++ b/src/namestore/gnunet-zoneimport.c
@@ -1254,13 +1254,18 @@ run (void *cls,
"libgnunet_plugin_namestore_%s",
database);
ns = GNUNET_PLUGIN_load (db_lib_name,
- (void *) cfg);
+ (void *) cfg);
GNUNET_free (database);
+ GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
+ NULL);
+ if (NULL == ns)
+ {
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
id = GNUNET_IDENTITY_connect (cfg,
&identity_cb,
NULL);
- GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
- NULL);
}
diff --git a/src/namestore/namestore.conf.in b/src/namestore/namestore.conf.in
index 0ebd2586bb..f19ac56439 100644
--- a/src/namestore/namestore.conf.in
+++ b/src/namestore/namestore.conf.in
@@ -19,8 +19,12 @@ FILENAME = $GNUNET_DATA_HOME/namestore/flat.db
[namestore-postgres]
+# How to connect to the database
CONFIG = postgres:///gnunet
+# Use temporary tables
TEMPORARY_TABLE = NO
+# Use asynchronous commit (SET synchronous_commit TO OFF).
+ASYNC_COMMIT = NO
[uri]
gns = gnunet-namestore
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index 872bf75cb6..4828cb190d 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -93,6 +93,25 @@ database_setup (struct Plugin *plugin)
if (GNUNET_YES ==
GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg,
"namestore-postgres",
+ "ASYNC_COMMIT"))
+ {
+ struct GNUNET_PQ_ExecuteStatement es[] = {
+ GNUNET_PQ_make_try_execute ("SET synchronous_commit TO off"),
+ GNUNET_PQ_EXECUTE_STATEMENT_END
+ };
+
+ if (GNUNET_OK !=
+ GNUNET_PQ_exec_statements (plugin->dbh,
+ es))
+ {
+ PQfinish (plugin->dbh);
+ plugin->dbh = NULL;
+ return GNUNET_SYSERR;
+ }
+ }
+ if (GNUNET_YES ==
+ GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg,
+ "namestore-postgres",
"TEMPORARY_TABLE"))
{
cr = &es_temporary;