CernVM-FS
2.12.0
|
#include <garbage_collector.h>
Classes | |
struct | Configuration |
class | ReflogBasedInfoShim |
Public Member Functions | |
GarbageCollector (const Configuration &configuration) | |
void | UseReflogTimestamps () |
bool | Collect () |
uint64_t | preserved_catalog_count () const |
uint64_t | condemned_catalog_count () const |
uint64_t | condemned_objects_count () const |
uint64_t | duplicate_delete_requests () const |
uint64_t | condemned_bytes_count () const |
uint64_t | oldest_trunk_catalog () const |
Protected Types | |
typedef CatalogTraversalT::ObjectFetcherTN | ObjectFetcherTN |
typedef ObjectFetcherTN::HistoryTN | HistoryTN |
typedef ObjectFetcherTN::ReflogTN | ReflogTN |
typedef CatalogTraversalT::CatalogTN | CatalogTN |
typedef CatalogTraversalT::CallbackDataTN | TraversalCallbackDataTN |
typedef CatalogTraversalT::Parameters | TraversalParameters |
typedef std::vector< shash::Any > | HashVector |
Protected Member Functions | |
TraversalParameters | GetTraversalParams (const Configuration &configuration) |
void | PreserveDataObjects (const TraversalCallbackDataTN &data) |
void | SweepDataObjects (const TraversalCallbackDataTN &data) |
bool | AnalyzePreservedCatalogTree () |
bool | CheckPreservedRevisions () |
bool | SweepReflog () |
void | CheckAndSweep (const shash::Any &hash) |
void | Sweep (const shash::Any &hash) |
bool | RemoveCatalogFromReflog (const shash::Any &catalog) |
void | PrintCatalogTreeEntry (const unsigned int tree_level, const CatalogTN *catalog) const |
void | LogDeletion (const shash::Any &hash) const |
Private Attributes | |
const Configuration | configuration_ |
ReflogBasedInfoShim | catalog_info_shim_ |
CatalogTraversalT | traversal_ |
HashFilterT | hash_filter_ |
HashFilterT | hash_map_delete_requests_ |
bool | use_reflog_timestamps_ |
uint64_t | oldest_trunk_catalog_ |
bool | oldest_trunk_catalog_found_ |
uint64_t | preserved_catalogs_ |
uint64_t | unreferenced_trees_ |
uint64_t | condemned_trees_ |
uint64_t | condemned_catalogs_ |
float | last_reported_status_ |
uint64_t | condemned_objects_ |
uint64_t | condemned_bytes_ |
uint64_t | duplicate_delete_requests_ |
This file is part of the CernVM File System.
The GarbageCollector class is figuring out which data objects (represented by their content hashes) can be deleted as outdated garbage. Garbage collection is performed on the granularity of catalog revisions, thus a complete repository revision is either considered to be outdated or active. This way, a mountable repository revision stays completely usable (no nested catalogs or data objects become unavailable). A revision is defined by it's root catalog; the revision numbers of nested catalogs are irrelevant, since they might be referenced by newer (preserved) repository revisions. Thus, garbage objects are those that are not referenced by any of the pre- served root catalogs or their direct subordinate nested catalog try.
We use a two-stage approach:
1st Stage - Initialization The GarbageCollector is reading all the catalogs that are meant to be preserved. It builds up a filter (HashFilterT) containing all content hashes that are not to be deleted
2nd Stage - Sweeping The initialized HashFilterT is presented with all content hashes found in condemned catalogs and decides if they are referenced by the preserved catalog revisions or not.
The GarbageCollector is templated with CatalogTraversalT mainly for testability and with HashFilterT as an instance of the Strategy Pattern to abstract from the actual hash filtering method to be used.
Definition at line 45 of file garbage_collector.h.
|
protected |
Definition at line 50 of file garbage_collector.h.
|
protected |
Definition at line 53 of file garbage_collector.h.
|
protected |
Definition at line 48 of file garbage_collector.h.
|
protected |
Definition at line 47 of file garbage_collector.h.
|
protected |
Definition at line 49 of file garbage_collector.h.
|
protected |
Definition at line 51 of file garbage_collector.h.
|
protected |
Definition at line 52 of file garbage_collector.h.
|
explicit |
|
protected |
|
protected |
|
protected |
bool GarbageCollector< CatalogTraversalT, HashFilterT >::Collect | ( | ) |
Definition at line 222 of file garbage_collector_impl.h.
Referenced by swissknife::CommandGc::Main().
|
inline |
Definition at line 101 of file garbage_collector.h.
|
inline |
Definition at line 97 of file garbage_collector.h.
|
inline |
Definition at line 98 of file garbage_collector.h.
|
inline |
Definition at line 99 of file garbage_collector.h.
|
protected |
Definition at line 67 of file garbage_collector_impl.h.
|
protected |
|
inline |
Definition at line 102 of file garbage_collector.h.
Referenced by swissknife::CommandGc::Main().
|
inline |
Definition at line 96 of file garbage_collector.h.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
void GarbageCollector< CatalogTraversalT, HashFilterT >::UseReflogTimestamps | ( | ) |
Definition at line 59 of file garbage_collector_impl.h.
Referenced by swissknife::CommandGc::Main().
|
private |
Definition at line 146 of file garbage_collector.h.
|
private |
Definition at line 181 of file garbage_collector.h.
Referenced by GarbageCollector< CatalogTraversalT, HashFilterT >::condemned_bytes_count().
|
private |
Number of catalogs garbage collected, count grows as GC progresses
Definition at line 174 of file garbage_collector.h.
Referenced by GarbageCollector< CatalogTraversalT, HashFilterT >::condemned_catalog_count().
|
private |
Definition at line 180 of file garbage_collector.h.
Referenced by GarbageCollector< CatalogTraversalT, HashFilterT >::condemned_objects_count().
|
private |
Number of root catalogs garbage collected, count grows as GC progresses
Definition at line 170 of file garbage_collector.h.
|
private |
Definition at line 145 of file garbage_collector.h.
Referenced by GarbageCollector< CatalogTraversalT, HashFilterT >::GarbageCollector().
|
private |
Definition at line 182 of file garbage_collector.h.
Referenced by GarbageCollector< CatalogTraversalT, HashFilterT >::duplicate_delete_requests().
|
private |
Definition at line 148 of file garbage_collector.h.
|
private |
Definition at line 149 of file garbage_collector.h.
|
private |
Keeps track if the last status report issued, between 0 and 1
Definition at line 178 of file garbage_collector.h.
|
private |
A marker for the garbage collection grace period, the time span that is walked back from the current head catalog. There can be named snapshots older than this snapshot. The oldest_trunk_catalog_ is used as a marker for when to remove auxiliary files (meta info, history, ...).
Definition at line 159 of file garbage_collector.h.
Referenced by GarbageCollector< CatalogTraversalT, HashFilterT >::oldest_trunk_catalog().
|
private |
Definition at line 160 of file garbage_collector.h.
|
private |
Definition at line 161 of file garbage_collector.h.
Referenced by GarbageCollector< CatalogTraversalT, HashFilterT >::preserved_catalog_count().
|
private |
Definition at line 147 of file garbage_collector.h.
|
private |
Number of catalogs in the reflog that are to be deleted (in fact, some of them might not exist anymore).
Definition at line 166 of file garbage_collector.h.
|
private |
Definition at line 152 of file garbage_collector.h.