CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
catalog::CatalogDatabase Class Reference

#include <catalog_sql.h>

Inheritance diagram for catalog::CatalogDatabase:
Collaboration diagram for catalog::CatalogDatabase:

Public Member Functions

bool CreateEmptyDatabase ()
bool InsertInitialValues (const std::string &root_path, const bool volatile_content, const std::string &voms_authz, const DirectoryEntry &root_entry=DirectoryEntry(kDirentNegative))
bool CheckSchemaCompatibility ()
bool LiveSchemaUpgradeIfNecessary ()
bool CompactDatabase () const
double GetRowIdWasteRatio () const
bool SetVOMSAuthz (const std::string &)
- Public Member Functions inherited from sqlite::Database< DerivedT >
bool IsEqualSchema (const float value, const float compare) const
bool BeginTransaction () const
bool CommitTransaction () const
template<typename T >
GetProperty (const std::string &key) const
template<typename T >
GetPropertyDefault (const std::string &key, const T default_value) const
template<typename T >
bool SetProperty (const std::string &key, const T value)
bool HasProperty (const std::string &key) const
sqlite3 * sqlite_db () const
const std::string & filename () const
float schema_version () const
unsigned schema_revision () const
bool read_write () const
unsigned GetModifiedRowCount () const
double GetFreePageRatio () const
void GetMemStatistics (MemStatistics *stats) const
bool Vacuum () const
void PrintSqlError (const std::string &error_msg)
std::string GetLastErrorMsg () const
void TakeFileOwnership ()
void DropFileOwnership ()
bool OwnsFile () const
void EnforceSchema (float version, unsigned revision)

Static Public Attributes

static const float kLatestSchema = 2.5
static const float kLatestSupportedSchema = 2.5
static const unsigned kLatestSchemaRevision = 6
- Static Public Attributes inherited from sqlite::Database< DerivedT >
static const float kSchemaEpsilon = 0.0005

Protected Member Functions

 CatalogDatabase (const std::string &filename, const OpenMode open_mode)
- Protected Member Functions inherited from sqlite::Database< DerivedT >
 Database (const std::string &filename, const OpenMode open_mode)
bool Initialize ()
bool CreatePropertiesTable ()
bool PrepareCommonQueries ()
bool OpenDatabase (const int sqlite_open_flags)
bool Configure ()
bool FileReadAhead ()
void ReadSchemaRevision ()
bool StoreSchemaRevision ()
void set_schema_version (const float ver)
void set_schema_revision (const unsigned rev)


class sqlite::Database< CatalogDatabase >

Additional Inherited Members

- Public Types inherited from sqlite::Database< DerivedT >
enum  OpenMode { kOpenReadOnly, kOpenReadWrite }
- Static Public Member Functions inherited from sqlite::Database< DerivedT >
static DerivedT * Create (const std::string &filename)
static DerivedT * Open (const std::string &filename, const OpenMode open_mode)

Detailed Description

Definition at line 41 of file catalog_sql.h.

Constructor & Destructor Documentation

catalog::CatalogDatabase::CatalogDatabase ( const std::string &  filename,
const OpenMode  open_mode 

Definition at line 65 of file catalog_sql.h.

Member Function Documentation

bool catalog::CatalogDatabase::CheckSchemaCompatibility ( )

Definition at line 82 of file

bool catalog::CatalogDatabase::CompactDatabase ( ) const

Cleanup unused database space

This copies the entire catalog content into a temporary SQLite table, sweeps the original data from the 'catalog' table and reinserts everything from the temporary table afterwards. That way the implicit rowid field of 'catalog' is defragmented.

Since the 'chunks' table has a foreign key relationship to the 'catalog' we need to temporarily switch off the foreign key checks. Otherwise the clearing of the 'catalog' table would fail due to foreign key violations. Note that it is a NOOP to change the foreign key setting during a transaction!

Note: VACUUM used to have a similar behaviour but it was dropped from SQLite at some point. Since we compute client-inodes from the rowIDs, we are probably one of the few use cases where a defragmented rowID is indeed beneficial.


Definition at line 396 of file

Here is the call graph for this function:

bool catalog::CatalogDatabase::CreateEmptyDatabase ( )

Definition at line 216 of file

Here is the call graph for this function:

double catalog::CatalogDatabase::GetRowIdWasteRatio ( ) const

Definition at line 366 of file

Referenced by catalog::WritableCatalog::VacuumDatabaseIfNecessary().

Here is the call graph for this function:

Here is the caller graph for this function:

bool catalog::CatalogDatabase::InsertInitialValues ( const std::string &  root_path,
const bool  volatile_content,
const std::string &  voms_authz,
const DirectoryEntry root_entry = DirectoryEntry(kDirentNegative) 

Definition at line 263 of file

Referenced by catalog::WritableCatalogManager::CreateNestedCatalog(), and swissknife::CommandMigrate::MigrationWorker_20x::CreateNewEmptyCatalog().

Here is the call graph for this function:

Here is the caller graph for this function:

bool catalog::CatalogDatabase::LiveSchemaUpgradeIfNecessary ( )

Definition at line 90 of file

Here is the call graph for this function:

bool catalog::CatalogDatabase::SetVOMSAuthz ( const std::string &  voms_authz)

Definition at line 361 of file

Referenced by catalog::WritableCatalog::SetVOMSAuthz().

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class sqlite::Database< CatalogDatabase >

Definition at line 64 of file catalog_sql.h.

Member Data Documentation

const float catalog::CatalogDatabase::kLatestSchema = 2.5

NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE Always remember to update the legacy catalog migration classes to produce a compatible catalog structure when updating the schema revisions here!

Repository rollbacks to an outdated catalog schema is not supported. Have a look into CVM-252 if that becomes necessary at some point.

If the statistics counters get modified, the swissknife migration 'stats' tools needs to be modified, too. NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE

Definition at line 43 of file catalog_sql.h.

const unsigned catalog::CatalogDatabase::kLatestSchemaRevision = 6

The documentation for this class was generated from the following files: