Skip to content

Commit

Permalink
TODO: test this
Browse files Browse the repository at this point in the history
- using global constants for the cache, let us try out on galera if it does something useful.
  • Loading branch information
joka921 committed Oct 8, 2020
1 parent 95176da commit e946213
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/engine/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Server {
: _numThreads(numThreads),
_serverSocket(),
_port(port),
_cache(NOF_SUBTREES_TO_CACHE),
_cache(NOF_SUBTREES_TO_CACHE, CACHE_SIZE_IN_GB * (2ull<<30u) * sizeof(Id), MAX_SIZE_SINGLE_CACHE_ELEMENT_IN_GB * (2ull<<30u) * sizeof(Id)),
_index(),
_engine(),
_initialized(false) {}
Expand Down
2 changes: 2 additions & 0 deletions src/global/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ static const size_t STXXL_DISK_SIZE_INDEX_BUILDER = 1000 * 1000;
static const size_t STXXL_DISK_SIZE_INDEX_TEST = 10;

static const size_t NOF_SUBTREES_TO_CACHE = 1000;
static const size_t CACHE_SIZE_IN_GB = 30;
static const size_t MAX_SIZE_SINGLE_CACHE_ELEMENT_IN_GB = 5;
static const size_t MAX_NOF_ROWS_IN_RESULT = 100000;
static const size_t MIN_WORD_PREFIX_SIZE = 4;
static const char PREFIX_CHAR = '*';
Expand Down
7 changes: 7 additions & 0 deletions src/util/CacheAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ class CacheAdapter {
}

void clear() { _v.wlock()->_cache.clear();}
void clearAll() { _v.wlock()->_cache.clearAll();}

auto numCachedElements() const { return _v.wlock()->_cache.numCachedElements();}
auto numPinnedElements() const { return _v.wlock()->_cache.numPinnedElements();}
auto cachedSize() const {return _v.wlock()->_cache.cachedSize();}
auto pinnedSize() const {return _v.wlock()->_cache.pinnedSize();}


auto& getStorage() { return _v;}

Expand Down

0 comments on commit e946213

Please sign in to comment.