Changes have been pushed for the repository "fawkesrobotics/fawkes".

Clone:  https://github.com/fawkesrobotics/fawkes.git
Gitweb: https://github.com/fawkesrobotics/fawkes

The branch, thofmann/mongodb-tmp-directory has been updated
  discards  4257f5ef1334d1cb03ec0b998522f84185edebe8 (commit)
        to  7ee8a553647f9d03f0b1451f6e0787c02e5a0505 (commit)
       via  34be968ed4676de3a594c39a481edc291ab72e51 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (4257f5ef1334d1cb03ec0b998522f84185edebe8)
            \
             N -- N -- N (7ee8a553647f9d03f0b1451f6e0787c02e5a0505)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

https://github.com/fawkesrobotics/fawkes/tree/thofmann/mongodb-tmp-directory

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- *Log* ---------------------------------------------------------------
commit 34be968ed4676de3a594c39a481edc291ab72e51
Author:     Till Hofmann <[email protected]>
AuthorDate: Sat Nov 28 16:48:54 2020 +0100
Commit:     Till Hofmann <[email protected]>
CommitDate: Sat Nov 28 17:17:15 2020 +0100

    mongodb: add config option to store data and log in a tmp directory
    
    Using a tmp directory ensures that we always start with an empty
    database, as we switch the database directory with every restart.

https://github.com/fawkesrobotics/fawkes/commit/34be968ed

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 7ee8a553647f9d03f0b1451f6e0787c02e5a0505
Author:     Till Hofmann <[email protected]>
AuthorDate: Sat Nov 28 17:17:26 2020 +0100
Commit:     Till Hofmann <[email protected]>
CommitDate: Sat Nov 28 17:17:26 2020 +0100

    mongodb: add port to data storage path
    
    Always add the port to the path. This makes it easier to distinguish
    running concurrently database instances.

https://github.com/fawkesrobotics/fawkes/commit/7ee8a5536

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------
 src/plugins/mongodb/mongodb_instance_config.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)


- *Diffs* -------------------------------------------------------------

- *commit* 34be968ed4676de3a594c39a481edc291ab72e51 - - - - - - - - - -
Author:  Till Hofmann <[email protected]>
Date:    Sat Nov 28 16:48:54 2020 +0100
Subject: mongodb: add config option to store data and log in a tmp directory

 src/plugins/mongodb/mongodb_instance_config.cpp | 24 ++++++++++++++++++------
 src/plugins/mongodb/mongodb_instance_config.h   |  1 +
 2 files changed, 19 insertions(+), 6 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/mongodb/mongodb_instance_config.cpp 
b/src/plugins/mongodb/mongodb_instance_config.cpp
index 247c13e8f..af3a9086e 100644
--- a/src/plugins/mongodb/mongodb_instance_config.cpp
+++ b/src/plugins/mongodb/mongodb_instance_config.cpp
@@ -29,6 +29,7 @@
 #include <utils/time/wait.h>
 
 #include <boost/filesystem.hpp>
+#include <boost/filesystem/operations.hpp>
 #include <bsoncxx/builder/basic/document.hpp>
 #include <bsoncxx/json.hpp>
 #include <chrono>
@@ -81,12 +82,23 @@ MongoDBInstanceConfig::MongoDBInstanceConfig(Configuration 
*config,
                        loop_interval_ = config->get_float(prefix + 
"loop-interval");
                } catch (Exception &e) {
                } // ignored, use default
-               termination_grace_period_  = config->get_uint(prefix + 
"termination-grace-period");
-               clear_data_on_termination_ = config->get_bool(prefix + 
"clear-data-on-termination");
-               port_                      = config->get_uint(prefix + "port");
-               bind_ip_    = config->get_string_or_default(std::string(prefix 
+ "bind_ip").c_str(), "0.0.0.0");
-               data_path_  = config->get_string(prefix + "data-path");
-               log_path_   = config->get_string(prefix + "log/path");
+               termination_grace_period_ = config->get_uint(prefix + 
"termination-grace-period");
+               port_                     = config->get_uint(prefix + "port");
+               bind_ip_ = config->get_string_or_default(std::string(prefix + 
"bind_ip").c_str(), "0.0.0.0");
+               use_tmp_directory_ = config->get_bool_or_default((prefix + 
"use-tmp-directory").c_str(), false);
+               // By default, clear data if we use a tmp directory, otherwise 
don't.
+               clear_data_on_termination_ =
+                 config->get_bool_or_default((prefix + 
"clear-data-on-termination").c_str(),
+                                             use_tmp_directory_);
+               if (use_tmp_directory_) {
+                       const boost::filesystem::path path = 
boost::filesystem::unique_path(
+                         boost::filesystem::temp_directory_path() / 
"mongodb-%%%%-%%%%-%%%%");
+                       data_path_ = path.string();
+                       log_path_  = (path / "mongodb.log").string();
+               } else {
+                       data_path_ = config->get_string(prefix + "data-path");
+                       log_path_  = config->get_string(prefix + "log/path");
+               }
                log_append_ = config->get_bool(prefix + "log/append");
                try {
                        replica_set_ = config->get_string(prefix + 
"replica-set");
diff --git a/src/plugins/mongodb/mongodb_instance_config.h 
b/src/plugins/mongodb/mongodb_instance_config.h
index cd7b0ffc2..6f4931897 100644
--- a/src/plugins/mongodb/mongodb_instance_config.h
+++ b/src/plugins/mongodb/mongodb_instance_config.h
@@ -75,6 +75,7 @@ private:
        unsigned int termination_grace_period_;
        float        loop_interval_;
        bool         clear_data_on_termination_;
+       bool         use_tmp_directory_;
        std::string  bind_ip_;
        unsigned int port_;
        std::string  data_path_;

- *commit* 7ee8a553647f9d03f0b1451f6e0787c02e5a0505 - - - - - - - - - -
Author:  Till Hofmann <[email protected]>
Date:    Sat Nov 28 17:17:26 2020 +0100
Subject: mongodb: add port to data storage path

 src/plugins/mongodb/mongodb_instance_config.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/mongodb/mongodb_instance_config.cpp 
b/src/plugins/mongodb/mongodb_instance_config.cpp
index af3a9086e..cadddcc42 100644
--- a/src/plugins/mongodb/mongodb_instance_config.cpp
+++ b/src/plugins/mongodb/mongodb_instance_config.cpp
@@ -30,6 +30,7 @@
 
 #include <boost/filesystem.hpp>
 #include <boost/filesystem/operations.hpp>
+#include <boost/format.hpp>
 #include <bsoncxx/builder/basic/document.hpp>
 #include <bsoncxx/json.hpp>
 #include <chrono>
@@ -91,8 +92,11 @@ MongoDBInstanceConfig::MongoDBInstanceConfig(Configuration 
*config,
                  config->get_bool_or_default((prefix + 
"clear-data-on-termination").c_str(),
                                              use_tmp_directory_);
                if (use_tmp_directory_) {
-                       const boost::filesystem::path path = 
boost::filesystem::unique_path(
-                         boost::filesystem::temp_directory_path() / 
"mongodb-%%%%-%%%%-%%%%");
+                       // Add the port to the filename, escape all literal "%" 
as "%%".
+                       const std::string filename =
+                         
boost::str(boost::format("mongodb-%1%-%%%%%%%%-%%%%%%%%-%%%%%%%%") % port_);
+                       const boost::filesystem::path path =
+                         
boost::filesystem::unique_path(boost::filesystem::temp_directory_path() / 
filename);
                        data_path_ = path.string();
                        log_path_  = (path / "mongodb.log").string();
                } else {



_______________________________________________
fawkes-commits mailing list
[email protected]
https://lists.kbsg.rwth-aachen.de/listinfo/fawkes-commits

Reply via email to