Add gc running gauge

Summary: title

Reviewers: dgleich

Reviewed By: dgleich

Differential Revision: https://phabricator.memgraph.io/D1228
This commit is contained in:
Marin Tomic 2018-02-22 15:30:47 +01:00
parent c7eaf4711a
commit fc75fadee3

View File

@ -5,6 +5,7 @@
#include "data_structures/concurrent/concurrent_map.hpp"
#include "database/storage.hpp"
#include "mvcc/version_list.hpp"
#include "stats/metrics.hpp"
#include "storage/deferred_deleter.hpp"
#include "storage/edge.hpp"
#include "storage/garbage_collector.hpp"
@ -15,6 +16,12 @@
namespace database {
namespace {
stats::Gauge &gc_running = stats::GetGauge("storage.garbage_collection", 0);
} // namespace
/** Garbage collection capabilities for database::Storage. Extracted into a
* separate class for better code organization, and because the GC requires a
* tx::Engine, while the Storage itself can exist without it. Even though, a
@ -70,8 +77,12 @@ class StorageGc {
{
// This can be run concurrently
utils::Timer x;
gc_running.Set(1);
vertices_.gc_.Run(snapshot, tx_engine_);
edges_.gc_.Run(snapshot, tx_engine_);
gc_running.Set(0);
VLOG(1) << "Garbage collector mvcc phase time: " << x.Elapsed().count();
}
// This has to be run sequentially after gc because gc modifies