[Fawkes Git] branch/fzwilling/robot-memory: 2 revs updated. (0.5.0-3436-g899cf26)

Frederik Zwilling zwilling at kbsg.rwth-aachen.de
Thu Nov 10 18:19:09 CET 2016


Changes have been pushed for the project "Fawkes Robotics Software Framework".

Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, fzwilling/robot-memory has been updated
        to  899cf264ac4bfcc5125896d26ef30150de1822e9 (commit)
       via  633dee11eaa1fa70cbecb793b4bd7cb9cb73949e (commit)
      from  7814803c8ce13e0666c543396995a231d17c0445 (commit)

http://git.fawkesrobotics.org/fawkes.git/fzwilling/robot-memory

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 633dee11eaa1fa70cbecb793b4bd7cb9cb73949e
Author:     Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
AuthorDate: Wed Nov 9 18:20:05 2016 +0100
Commit:     Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
CommitDate: Wed Nov 9 18:24:10 2016 +0100

    robot-memory: use config of  local database path
    
    This avoids problems with systems where /data/db is not prepared for the
    use by mongodb.

http://git.fawkesrobotics.org/fawkes.git/commit/633dee1
http://trac.fawkesrobotics.org/changeset/633dee1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 899cf264ac4bfcc5125896d26ef30150de1822e9
Author:     Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
AuthorDate: Thu Nov 10 18:09:10 2016 +0100
Commit:     Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
CommitDate: Thu Nov 10 18:19:01 2016 +0100

    robot-memory: fixed initial creation of dbs to be able to move them
    
    DBs have to be created before they can be moved to a primary. To be
    created they have to be not empty. The previous initialization created
    the db in the local mongod but the mongos pointed to an empty  db
    with the same name in another mongod. Thus it produced the error
    'can't find db'. Now the db is created using the mongos and afterwards
    moved to the local mongod.

http://git.fawkesrobotics.org/fawkes.git/commit/899cf26
http://trac.fawkesrobotics.org/changeset/899cf26

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


- *Summary* -----------------------------------------------------------
 src/plugins/robot-memory/robot_memory_setup.cpp |   12 ++++++------
 src/plugins/robot-memory/robot_memory_setup.h   |    2 ++
 2 files changed, 8 insertions(+), 6 deletions(-)


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

- *commit* 633dee11eaa1fa70cbecb793b4bd7cb9cb73949e - - - - - - - - - -
Author:  Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
Date:    Wed Nov 9 18:20:05 2016 +0100
Subject: robot-memory: use config of  local database path

 src/plugins/robot-memory/robot_memory_setup.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/robot-memory/robot_memory_setup.cpp b/src/plugins/robot-memory/robot_memory_setup.cpp
index 9d7f7c3..ee3582d 100644
--- a/src/plugins/robot-memory/robot_memory_setup.cpp
+++ b/src/plugins/robot-memory/robot_memory_setup.cpp
@@ -50,8 +50,11 @@ void RobotMemorySetup::setup_mongods()
   std::string local_db_name = config->get_string("plugins/robot-memory/database");
   std::string local_repl_name = config->get_string("plugins/robot-memory/setup/local/replica-set-name");
   std::string local_port_str = std::to_string(local_port);
+  std::string local_db_path = StringConversions::resolve_path(config->get_string("plugins/robot-memory/setup/local/db-path").c_str());
+  prepare_mongo_db_path(local_db_path);
   const char *local_argv[] = {"mongod", "--port", local_port_str.c_str(),
-      "--replSet", local_repl_name.c_str(), NULL}; //local replica set just to enable the oplog
+			      "--replSet", local_repl_name.c_str(),
+      "--dbpath", local_db_path.c_str(), NULL}; //local replica set just to enable the oplog
   start_mongo_process("mongod-local", local_port, local_argv);
   std::string local_config = "{_id: '" + local_repl_name + "', members:[{_id:1,host:'localhost:" + local_port_str + "'}]}";
   run_mongo_command(local_port, std::string("{replSetInitiate:" + local_config + "}"), "already initialized");

- *commit* 899cf264ac4bfcc5125896d26ef30150de1822e9 - - - - - - - - - -
Author:  Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
Date:    Thu Nov 10 18:09:10 2016 +0100
Subject: robot-memory: fixed initial creation of dbs to be able to move them

 src/plugins/robot-memory/robot_memory_setup.cpp |    7 ++-----
 src/plugins/robot-memory/robot_memory_setup.h   |    2 ++
 2 files changed, 4 insertions(+), 5 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/robot-memory/robot_memory_setup.cpp b/src/plugins/robot-memory/robot_memory_setup.cpp
index ee3582d..01e444f 100644
--- a/src/plugins/robot-memory/robot_memory_setup.cpp
+++ b/src/plugins/robot-memory/robot_memory_setup.cpp
@@ -60,7 +60,6 @@ void RobotMemorySetup::setup_mongods()
   run_mongo_command(local_port, std::string("{replSetInitiate:" + local_config + "}"), "already initialized");
   //wait for initialization
   usleep(1000000);
-  create_database(local_port, local_db_name);
 
   //only start other processes when we want to run the robot memory distributed
   if(!config->get_bool("plugins/robot-memory/setup/distributed"))
@@ -74,7 +73,6 @@ void RobotMemorySetup::setup_mongods()
   const char *config_argv[] = {"mongod", "--configsvr", "--port",
       config_port_str.c_str(), "--dbpath", db_path.c_str(), NULL};
   start_mongo_process("mongod-config", config_port, config_argv);
-  create_database(local_port, local_db_name);
 
   //start own part of replica set
   unsigned int distributed_port = config->get_uint("plugins/robot-memory/setup/replicated/port");
@@ -93,7 +91,6 @@ void RobotMemorySetup::setup_mongods()
   run_mongo_command(distributed_port, std::string("{replSetInitiate:" + repl_config + "}"), "already initialized");
   //wait for replica set initialization and election
   usleep(3000000);
-  create_database(distributed_port, distributed_replset);
 
   //start mongos for accessing
   unsigned int mongos_port = config->get_uint("plugins/robot-memory/setup/mongos/port");
@@ -113,6 +110,8 @@ void RobotMemorySetup::setup_mongods()
       "/localhost:" + distributed_port_str + "'}"), "host already used");
   }
   //define which db is in which shard
+  create_database(mongos_port, local_db_name);
+  create_database(mongos_port, distributed_replset);
   run_mongo_command(mongos_port, std::string("{movePrimary: '" + distributed_replset + "', to: '" + distributed_replset + "'}"), "it is already the primary");
   run_mongo_command(mongos_port, std::string("{movePrimary: '" + local_db_name + "', to: '" + local_repl_name + "'}"), "it is already the primary");
 }
@@ -248,6 +247,4 @@ void RobotMemorySetup::create_database(unsigned int port, std::string name)
   mongo::BSONObj first_doc = mongo::fromjson("{initialized:1}");
   con.insert(name + ".config", first_doc);
   con.reset();
-
-
 }
diff --git a/src/plugins/robot-memory/robot_memory_setup.h b/src/plugins/robot-memory/robot_memory_setup.h
index 300e9a7..5919160 100644
--- a/src/plugins/robot-memory/robot_memory_setup.h
+++ b/src/plugins/robot-memory/robot_memory_setup.h
@@ -28,6 +28,8 @@
 #include <utils/misc/string_commands.h>
 #include <mongo/client/dbclient.h>
 
+typedef std::unique_ptr<mongo::DBClientCursor> QResCursor;
+
 /** @class RobotMemorySetup  robot_memory_setup.h
  *
  * @author Frederik Zwilling




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org


More information about the fawkes-commits mailing list