You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2015/12/15 20:59:45 UTC
marmotta git commit: faster database compaction on startup
Repository: marmotta
Updated Branches:
refs/heads/develop 530ee4bfc -> 79308ab5d
faster database compaction on startup
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/79308ab5
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/79308ab5
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/79308ab5
Branch: refs/heads/develop
Commit: 79308ab5d5b7df12b6846809ade5231dd445d602
Parents: 530ee4b
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Tue Dec 15 21:01:22 2015 +0100
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Tue Dec 15 21:01:22 2015 +0100
----------------------------------------------------------------------
.../backend/persistence/leveldb_persistence.cc | 27 +++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/79308ab5/libraries/ostrich/backend/persistence/leveldb_persistence.cc
----------------------------------------------------------------------
diff --git a/libraries/ostrich/backend/persistence/leveldb_persistence.cc b/libraries/ostrich/backend/persistence/leveldb_persistence.cc
index 7e487f2..9bb1ad2 100644
--- a/libraries/ostrich/backend/persistence/leveldb_persistence.cc
+++ b/libraries/ostrich/backend/persistence/leveldb_persistence.cc
@@ -310,11 +310,32 @@ LevelDBPersistence::LevelDBPersistence(const std::string &path, int64_t cacheSiz
: comparator(new KeyComparator())
, cache(leveldb::NewLRUCache(cacheSize))
, options(buildOptions(comparator.get(), cache.get()))
- , db_spoc(buildDB(path, "spoc", *options)), db_cspo(buildDB(path, "cspo", *options))
- , db_opsc(buildDB(path, "opsc", *options)), db_pcos(buildDB(path, "pcos", *options))
, db_ns_prefix(buildDB(path, "ns_prefix", buildNsOptions()))
, db_ns_url(buildDB(path, "ns_url", buildNsOptions()))
- , db_meta(buildDB(path, "metadata", buildNsOptions())) { }
+ , db_meta(buildDB(path, "metadata", buildNsOptions())) {
+
+ // Open databases in separate threads as LevelDB does a lot of computation on open.
+ std::vector<std::thread> openers;
+ openers.push_back(std::thread([&]() {
+ db_spoc.reset(buildDB(path, "spoc", *options));
+ }));
+ openers.push_back(std::thread([&]() {
+ db_cspo.reset(buildDB(path, "cspo", *options));
+ }));
+ openers.push_back(std::thread([&]() {
+ db_opsc.reset(buildDB(path, "opsc", *options));
+ }));
+ openers.push_back(std::thread([&]() {
+ db_pcos.reset(buildDB(path, "pcos", *options));
+ }));
+
+
+ for (auto& t : openers) {
+ t.join();
+ }
+
+ LOG(INFO) << "LevelDB Database initialised.";
+}
int64_t LevelDBPersistence::AddNamespaces(NamespaceIterator& it) {