gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated: support async commit


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: support async commit
Date: Wed, 11 Apr 2018 12:20:06 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 38c918ff2 support async commit
38c918ff2 is described below

commit 38c918ff27e5a90c1a17f3989a78c7fca564c47a
Author: Christian Grothoff <address@hidden>
AuthorDate: Wed Apr 11 12:19:55 2018 +0200

    support async commit
---
 src/namestore/gnunet-zoneimport.c         | 11 ++++++++---
 src/namestore/namestore.conf.in           |  4 ++++
 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,
                    "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 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
 
 
 [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 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)
   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;

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]