CernVM-FS
2.12.0
|
#include <catalog_sql.h>
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 > | |
T | GetProperty (const std::string &key) const |
template<typename T > | |
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 = 7 |
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) |
Friends | |
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) |
Definition at line 41 of file catalog_sql.h.
|
inlineprotected |
Definition at line 65 of file catalog_sql.h.
bool catalog::CatalogDatabase::CheckSchemaCompatibility | ( | ) |
Definition at line 86 of file catalog_sql.cc.
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.
See: http://www.sqlite.org/lang_vacuum.html
Definition at line 416 of file catalog_sql.cc.
bool catalog::CatalogDatabase::CreateEmptyDatabase | ( | ) |
double catalog::CatalogDatabase::GetRowIdWasteRatio | ( | ) | const |
Definition at line 386 of file catalog_sql.cc.
Referenced by catalog::WritableCatalog::VacuumDatabaseIfNecessary().
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 283 of file catalog_sql.cc.
Referenced by catalog::WritableCatalogManager::CreateNestedCatalog(), and swissknife::CommandMigrate::MigrationWorker_20x::CreateNewEmptyCatalog().
bool catalog::CatalogDatabase::LiveSchemaUpgradeIfNecessary | ( | ) |
bool catalog::CatalogDatabase::SetVOMSAuthz | ( | const std::string & | voms_authz | ) |
Definition at line 381 of file catalog_sql.cc.
Referenced by catalog::WritableCatalog::SetVOMSAuthz().
|
friend |
Definition at line 64 of file catalog_sql.h.
|
static |
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.
|
static |
Definition at line 46 of file catalog_sql.h.
Referenced by swissknife::CommandMigrate::MigrationWorker_20x::RunMigration().
|
static |