OmniSciDB
a5dc49c757
|
#include <SysCatalog.h>
Classes | |
struct | UpdateQuery |
Public Member Functions | |
void | init (const std::string &basePath, std::shared_ptr< Data_Namespace::DataMgr > dataMgr, const AuthMetadata &authMetadata, std::shared_ptr< Calcite > calcite, bool is_new_db, bool aggregator, const std::vector< LeafHostInfo > &string_dict_hosts) |
bool | isInitialized () const |
std::shared_ptr< Catalog > | login (std::string &db, std::string &username, const std::string &password, UserMetadata &user_meta, bool check_password=true) |
std::shared_ptr< Catalog > | switchDatabase (std::string &dbname, const std::string &username) |
UserMetadata | createUser (std::string const &name, UserAlterations alts, bool is_temporary) |
void | dropUser (const std::string &name, bool if_exists=false) |
void | dropUserUnchecked (const std::string &name, const UserMetadata &user) |
UserMetadata | alterUser (std::string const &name, UserAlterations alts) |
void | renameUser (std::string const &old_name, std::string const &new_name) |
void | createDatabase (const std::string &dbname, int owner) |
void | renameDatabase (std::string const &old_name, std::string const &new_name) |
void | changeDatabaseOwner (std::string const &dbname, const std::string &new_owner) |
void | dropDatabase (const DBMetadata &db) |
std::optional< UserMetadata > | getUser (std::string const &uname) |
std::optional< UserMetadata > | getUser (int32_t const uid) |
std::optional< DBMetadata > | getDB (std::string const &dbname) |
std::optional< DBMetadata > | getDB (int32_t const dbid) |
bool | getMetadataForUser (const std::string &name, UserMetadata &user) |
bool | getMetadataForUserById (const int32_t idIn, UserMetadata &user) |
bool | checkPasswordForUser (const std::string &passwd, std::string &name, UserMetadata &user) |
bool | getMetadataForDB (const std::string &name, DBMetadata &db) |
bool | getMetadataForDBById (const int32_t idIn, DBMetadata &db) |
Data_Namespace::DataMgr & | getDataMgr () const |
Calcite & | getCalciteMgr () const |
const std::string & | getCatalogBasePath () const |
SqliteConnector * | getSqliteConnector () |
std::list< DBMetadata > | getAllDBMetadata () |
std::list< UserMetadata > | getAllUserMetadata () |
std::list< UserMetadata > | getAllUserMetadata (const int64_t dbId) |
DBSummaryList | getDatabaseListForUser (const UserMetadata &user) |
void | createDBObject (const UserMetadata &user, const std::string &objectName, DBObjectType type, const Catalog_Namespace::Catalog &catalog, int32_t objectId=-1) |
void | renameDBObject (const std::string &objectName, const std::string &newName, DBObjectType type, int32_t objectId, const Catalog_Namespace::Catalog &catalog) |
void | grantDBObjectPrivileges (const std::string &grantee, const DBObject &object, const Catalog_Namespace::Catalog &catalog) |
void | grantDBObjectPrivilegesBatch (const std::vector< std::string > &grantees, const std::vector< DBObject > &objects, const Catalog_Namespace::Catalog &catalog) |
void | revokeDBObjectPrivileges (const std::string &grantee, const DBObject &object, const Catalog_Namespace::Catalog &catalog) |
void | revokeDBObjectPrivilegesBatch (const std::vector< std::string > &grantees, const std::vector< DBObject > &objects, const Catalog_Namespace::Catalog &catalog) |
void | revokeDBObjectPrivilegesFromAll (DBObject object, Catalog *catalog) |
void | revokeDBObjectPrivilegesFromAll_unsafe (DBObject object, Catalog *catalog) |
void | revokeDBObjectPrivilegesFromAllBatch (std::vector< DBObject > &objects, Catalog *catalog) |
void | revokeDBObjectPrivilegesFromAllBatch_unsafe (std::vector< DBObject > &objects, Catalog *catalog) |
void | getDBObjectPrivileges (const std::string &granteeName, DBObject &object, const Catalog_Namespace::Catalog &catalog) const |
bool | verifyDBObjectOwnership (const UserMetadata &user, DBObject object, const Catalog_Namespace::Catalog &catalog) |
void | changeDBObjectOwnership (const UserMetadata &new_owner, const UserMetadata &previous_owner, DBObject object, const Catalog_Namespace::Catalog &catalog, bool revoke_privileges=true) |
void | createRole (const std::string &roleName, const bool user_private_role, const bool is_temporary=false) |
void | dropRole (const std::string &roleName, const bool is_temporary=false) |
void | grantRoleBatch (const std::vector< std::string > &roles, const std::vector< std::string > &grantees) |
void | grantRole (const std::string &role, const std::string &grantee, const bool is_temporary=false) |
void | revokeRoleBatch (const std::vector< std::string > &roles, const std::vector< std::string > &grantees) |
void | revokeRole (const std::string &role, const std::string &grantee, const bool is_temporary=false) |
bool | hasAnyPrivileges (const UserMetadata &user, std::vector< DBObject > &privObjects) |
bool | checkPrivileges (const UserMetadata &user, const std::vector< DBObject > &privObjects) const |
bool | checkPrivileges (const std::string &userName, const std::vector< DBObject > &privObjects) const |
Grantee * | getGrantee (const std::string &name) const |
Role * | getRoleGrantee (const std::string &name) const |
User * | getUserGrantee (const std::string &name) const |
std::vector < ObjectRoleDescriptor * > | getMetadataForObject (int32_t dbId, int32_t dbType, int32_t objectId) const |
std::vector< ObjectRoleDescriptor > | getMetadataForAllObjects () const |
bool | isRoleGrantedToGrantee (const std::string &granteeName, const std::string &roleName, bool only_direct) const |
std::vector< std::string > | getRoles (const std::string &user_name, bool effective=true) |
std::vector< std::string > | getRoles (bool include_user_private_role, bool is_super, const std::string &user_name, bool ignore_deleted_user=false) |
std::vector< std::string > | getRoles (const std::string &userName, const int32_t dbId) |
std::set< std::string > | getCreatedRoles () const |
bool | isAggregator () const |
void | populateRoleDbObjects (const std::vector< DBObject > &objects) |
std::string | name () const |
void | renameObjectsInDescriptorMap (DBObject &object, const Catalog_Namespace::Catalog &cat) |
void | syncUserWithRemoteProvider (const std::string &user_name, std::vector< std::string > idp_roles, UserAlterations alts) |
std::unordered_map < std::string, std::vector < std::string > > | getGranteesOfSharedDashboards (const std::vector< std::string > &dashboard_ids) |
void | check_for_session_encryption (const std::string &pki_cert, std::string &session) |
std::vector< Catalog * > | getCatalogsForAllDbs () |
std::shared_ptr< Catalog > | getDummyCatalog () |
std::shared_ptr< Catalog > | getCatalog (const std::string &dbName) |
std::shared_ptr< Catalog > | getCatalog (const int32_t db_id) |
std::shared_ptr< Catalog > | getCatalog (const DBMetadata &curDB, bool is_new_db) |
void | removeCatalog (const std::string &dbName) |
virtual | ~SysCatalog () |
void | reassignObjectOwners (const std::map< int32_t, std::vector< DBObject >> &old_owner_db_objects, int32_t new_owner_id, const Catalog_Namespace::Catalog &catalog) |
bool | hasExecutedMigration (const std::string &migration_name) const |
void | checkDropRenderGroupColumnsMigration () const |
Static Public Member Functions | |
static SysCatalog & | instance () |
static void | destroy () |
Public Attributes | |
std::unique_ptr < heavyai::DistributedSharedMutex > | dcatalogMutex_ |
std::unique_ptr < heavyai::DistributedSharedMutex > | dsqliteMutex_ |
std::mutex | sqliteMutex_ |
heavyai::shared_mutex | sharedMutex_ |
std::atomic< std::thread::id > | thread_holding_sqlite_lock |
std::atomic< std::thread::id > | thread_holding_write_lock |
std::shared_ptr< Catalog > | dummyCatalog_ |
std::unordered_map < std::string, std::shared_ptr < UserMetadata > > | temporary_users_by_name_ |
std::unordered_map< int32_t, std::shared_ptr< UserMetadata > > | temporary_users_by_id_ |
int32_t | next_temporary_user_id_ {shared::kTempUserIdRange} |
Static Public Attributes | |
static thread_local bool | thread_holds_read_lock = false |
Private Types | |
using | GranteeMap = std::map< std::string, std::unique_ptr< Grantee >> |
using | ObjectRoleDescriptorMap = std::multimap< std::string, std::unique_ptr< ObjectRoleDescriptor >> |
using | UpdateQueries = std::list< UpdateQuery > |
using | dbid_to_cat_map = tbb::concurrent_hash_map< std::string, std::shared_ptr< Catalog >> |
Private Member Functions | |
SysCatalog () | |
void | initDB () |
void | buildMaps (bool is_new_db=false) |
void | buildMapsUnlocked (bool is_new_db=false) |
void | buildRoleMapUnlocked () |
void | buildUserRoleMapUnlocked () |
void | buildObjectDescriptorMapUnlocked () |
void | rebuildObjectMapsUnlocked () |
void | checkAndExecuteMigrations () |
void | importDataFromOldMapdDB () |
void | createRoles () |
void | fixRolesMigration () |
void | addAdminUserRole () |
void | migratePrivileges () |
void | migratePrivileged_old () |
void | updateUserSchema () |
void | updatePasswordsToHashes () |
void | updateBlankPasswordsToRandom () |
void | updateSupportUserDeactivation () |
void | migrateDBAccessPrivileges () |
void | loginImpl (std::string &username, const std::string &password, UserMetadata &user_meta) |
bool | checkPasswordForUserImpl (const std::string &passwd, std::string &name, UserMetadata &user) |
void | checkDuplicateCaseInsensitiveDbNames () const |
void | runUpdateQueriesAndChangeOwnership (const UserMetadata &new_owner, const UserMetadata &previous_owner, DBObject object, const Catalog_Namespace::Catalog &catalog, const UpdateQueries &update_queries, bool revoke_privileges=true) |
void | grantDefaultPrivilegesToRole_unsafe (const std::string &name, bool issuper) |
void | createRole_unsafe (const std::string &roleName, const bool userPrivateRole, const bool is_temporary) |
void | dropRole_unsafe (const std::string &roleName, const bool is_temporary) |
void | grantRoleBatch_unsafe (const std::vector< std::string > &roles, const std::vector< std::string > &grantees) |
void | grantRole_unsafe (const std::string &roleName, const std::string &granteeName, const bool is_temporary) |
void | revokeRoleBatch_unsafe (const std::vector< std::string > &roles, const std::vector< std::string > &grantees) |
void | revokeRole_unsafe (const std::string &roleName, const std::string &granteeName, const bool is_temporary) |
void | updateObjectDescriptorMap (const std::string &roleName, DBObject &object, bool roleType, const Catalog_Namespace::Catalog &cat) |
void | deleteObjectDescriptorMap (const std::string &roleName) |
void | deleteObjectDescriptorMap (const std::string &roleName, DBObject &object, const Catalog_Namespace::Catalog &cat) |
void | grantDBObjectPrivilegesBatch_unsafe (const std::vector< std::string > &grantees, const std::vector< DBObject > &objects, const Catalog_Namespace::Catalog &catalog) |
void | grantDBObjectPrivileges_unsafe (const std::string &granteeName, const DBObject object, const Catalog_Namespace::Catalog &catalog) |
void | revokeDBObjectPrivilegesBatch_unsafe (const std::vector< std::string > &grantees, const std::vector< DBObject > &objects, const Catalog_Namespace::Catalog &catalog) |
void | revokeDBObjectPrivileges_unsafe (const std::string &granteeName, DBObject object, const Catalog_Namespace::Catalog &catalog) |
void | grantAllOnDatabase_unsafe (const std::string &roleName, DBObject &object, const Catalog_Namespace::Catalog &catalog) |
void | revokeAllOnDatabase_unsafe (const std::string &roleName, int32_t dbId, Grantee *grantee) |
bool | isDashboardSystemRole (const std::string &roleName) const |
void | updateUserRoleName (const std::string &roleName, const std::string &newName) |
void | getMetadataWithDefaultDB (std::string &dbname, const std::string &username, Catalog_Namespace::DBMetadata &db_meta, UserMetadata &user_meta) |
bool | allowLocalLogin () const |
template<typename F , typename... Args> | |
void | execInTransaction (F &&f, Args &&...args) |
void | initializeInformationSchemaDb () |
void | recordExecutedMigration (const std::string &migration_name) const |
bool | hasVersionHistoryTable () const |
void | createVersionHistoryTable () const |
auto | yieldTransactionStreamer () |
Private Member Functions inherited from Catalog_Namespace::CommonFileOperations | |
CommonFileOperations (std::string const &base_path) | |
void | removeCatalogByFullPath (std::string const &full_path) |
void | removeCatalogByName (std::string const &name) |
auto | duplicateAndRenameCatalog (std::string const ¤t_name, std::string const &new_name) |
auto | assembleCatalogName (std::string const &name) |
Private Attributes | |
std::string | basePath_ |
GranteeMap | granteeMap_ |
ObjectRoleDescriptorMap | objectDescriptorMap_ |
std::unique_ptr< SqliteConnector > | sqliteConnector_ |
std::shared_ptr < Data_Namespace::DataMgr > | dataMgr_ |
std::unique_ptr< PkiServer > | pki_server_ |
const AuthMetadata * | authMetadata_ |
std::shared_ptr< Calcite > | calciteMgr_ |
std::vector< LeafHostInfo > | string_dict_hosts_ |
bool | aggregator_ |
dbid_to_cat_map | cat_map_ |
bool | is_initialized_ {false} |
Static Private Attributes | |
static std::mutex | instance_mutex_ |
static std::unique_ptr < SysCatalog > | instance_ |
Definition at line 166 of file SysCatalog.h.
|
private |
Definition at line 522 of file SysCatalog.h.
|
private |
Definition at line 397 of file SysCatalog.h.
|
private |
Definition at line 399 of file SysCatalog.h.
|
private |
Definition at line 435 of file SysCatalog.h.
|
virtual |
Definition at line 305 of file SysCatalog.cpp.
References cat_map_, granteeMap_, and objectDescriptorMap_.
|
private |
Definition at line 296 of file SysCatalog.cpp.
References basePath_.
Referenced by instance().
|
private |
Definition at line 657 of file SysCatalog.cpp.
References createRole_unsafe(), shared::kRootUsername, and sqliteConnector_.
Referenced by checkAndExecuteMigrations().
|
private |
For servers configured to use external authentication providers, determine whether users will be allowed to fallback to local login accounts. If no external providers are configured, returns true.
UserMetadata Catalog_Namespace::SysCatalog::alterUser | ( | std::string const & | name, |
UserAlterations | alts | ||
) |
Definition at line 1224 of file SysCatalog.cpp.
References Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::append_with_commas, Catalog_Namespace::UserMetadata::can_login, Catalog_Namespace::UserAlterations::can_login, CHECK, Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::UserAlterations::default_db, Catalog_Namespace::UserMetadata::defaultDbId, Catalog_Namespace::g_log_user_id, getMetadataForDB(), getMetadataForUser(), getUser(), anonymous_namespace{SysCatalog.cpp}::hash_with_bcrypt(), Catalog_Namespace::UserAlterations::is_super, Catalog_Namespace::UserMetadata::is_temporary, Catalog_Namespace::UserMetadata::isSuper, name(), Catalog_Namespace::UserAlterations::passwd, Catalog_Namespace::UserMetadata::passwd_hash, sqliteConnector_, temporary_users_by_name_, to_string(), Catalog_Namespace::UserMetadata::userId, VLOG, and Catalog_Namespace::UserAlterations::wouldChange().
Referenced by syncUserWithRemoteProvider().
|
private |
Definition at line 243 of file SysCatalog.cpp.
|
private |
Definition at line 250 of file SysCatalog.cpp.
References CHECK, shared::kSystemCatalogName, run_benchmark_import::result, to_upper(), Catalog_Namespace::UserMetadata::userName, and VLOG.
|
private |
Definition at line 2809 of file SysCatalog.cpp.
References objectDescriptorMap_, sqliteConnector_, and to_string().
Referenced by rebuildObjectMapsUnlocked().
|
private |
Definition at line 2694 of file SysCatalog.cpp.
References DatabaseDBObjectType, DBObjectKey::fromString(), getGrantee(), granteeMap_, name(), AccessPrivileges::privileges, sqliteConnector_, and to_upper().
Referenced by rebuildObjectMapsUnlocked().
|
private |
Definition at line 2765 of file SysCatalog.cpp.
References getGrantee(), shared::kRootUsername, and sqliteConnector_.
void Catalog_Namespace::SysCatalog::changeDatabaseOwner | ( | std::string const & | dbname, |
const std::string & | new_owner | ||
) |
Definition at line 1399 of file SysCatalog.cpp.
References cat(), DatabaseDBObjectType, getCatalog(), getMetadataForDB(), getMetadataForUser(), getMetadataForUserById(), runUpdateQueriesAndChangeOwnership(), and to_string().
void Catalog_Namespace::SysCatalog::changeDBObjectOwnership | ( | const UserMetadata & | new_owner, |
const UserMetadata & | previous_owner, | ||
DBObject | object, | ||
const Catalog_Namespace::Catalog & | catalog, | ||
bool | revoke_privileges = true |
||
) |
Change ownership of a DBObject
new_owner | - new owner of DBObject |
previous_owner | - previous owner of DBObject |
object | - DBObject to change ownership of |
catalog | - Catalog instance object exists in |
revoke_privileges | - if true, revoke previous_owner's privileges |
Definition at line 2237 of file SysCatalog.cpp.
References runUpdateQueriesAndChangeOwnership().
void Catalog_Namespace::SysCatalog::check_for_session_encryption | ( | const std::string & | pki_cert, |
std::string & | session | ||
) |
Definition at line 979 of file SysCatalog.cpp.
References pki_server_.
|
private |
Definition at line 358 of file SysCatalog.cpp.
References addAdminUserRole(), checkDuplicateCaseInsensitiveDbNames(), createRoles(), fixRolesMigration(), migrateDBAccessPrivileges(), migratePrivileged_old(), migratePrivileges(), updateBlankPasswordsToRandom(), updatePasswordsToHashes(), updateSupportUserDeactivation(), and updateUserSchema().
void Catalog_Namespace::SysCatalog::checkDropRenderGroupColumnsMigration | ( | ) | const |
Definition at line 3197 of file SysCatalog.cpp.
References Catalog_Namespace::Catalog::checkDropRenderGroupColumnsMigration(), logger::FATAL, getCatalogsForAllDbs(), hasExecutedMigration(), logger::INFO, instance(), LOG, and recordExecutedMigration().
Referenced by startHeavyDBServer().
|
private |
Definition at line 900 of file SysCatalog.cpp.
References hasExecutedMigration(), recordExecutedMigration(), and sqliteConnector_.
Referenced by checkAndExecuteMigrations().
bool Catalog_Namespace::SysCatalog::checkPasswordForUser | ( | const std::string & | passwd, |
std::string & | name, | ||
UserMetadata & | user | ||
) |
Definition at line 1641 of file SysCatalog.cpp.
References checkPasswordForUserImpl().
Referenced by loginImpl().
|
private |
Definition at line 1647 of file SysCatalog.cpp.
References CHECK, getMetadataForUser(), LOG, Catalog_Namespace::UserMetadata::passwd_hash, and logger::WARNING.
Referenced by checkPasswordForUser().
bool Catalog_Namespace::SysCatalog::checkPrivileges | ( | const UserMetadata & | user, |
const std::vector< DBObject > & | privObjects | ||
) | const |
Definition at line 2522 of file SysCatalog.cpp.
References getUserGrantee(), instance(), Catalog_Namespace::UserMetadata::isSuper, Catalog_Namespace::UserMetadata::userLoggable(), and Catalog_Namespace::UserMetadata::userName.
Referenced by Catalog_Namespace::SessionInfo::checkDBAccessPrivileges(), checkPrivileges(), getDatabaseListForUser(), and switchDatabase().
bool Catalog_Namespace::SysCatalog::checkPrivileges | ( | const std::string & | userName, |
const std::vector< DBObject > & | privObjects | ||
) | const |
Definition at line 2542 of file SysCatalog.cpp.
References checkPrivileges(), Catalog_Namespace::g_log_user_id, getMetadataForUser(), and instance().
void Catalog_Namespace::SysCatalog::createDatabase | ( | const std::string & | dbname, |
int | owner | ||
) |
Definition at line 1475 of file SysCatalog.cpp.
References basePath_, cat(), CHECK, DatabaseDBObjectType, g_enable_fsi, getCatalog(), Catalog_Namespace::Catalog::getCustomExpressionsSchema(), Catalog_Namespace::Catalog::getForeignServerSchema(), Catalog_Namespace::Catalog::getForeignTableSchema(), getMetadataForDB(), getMetadataForUserById(), grantAllOnDatabase_unsafe(), shared::kCatalogDirectoryName, shared::kRootUserId, shared::kSystemCatalogName, removeCatalog(), sqliteConnector_, to_string(), to_upper(), and Catalog_Namespace::UserMetadata::userName.
Referenced by initDB(), and initializeInformationSchemaDb().
void Catalog_Namespace::SysCatalog::createDBObject | ( | const UserMetadata & | user, |
const std::string & | objectName, | ||
DBObjectType | type, | ||
const Catalog_Namespace::Catalog & | catalog, | ||
int32_t | objectId = -1 |
||
) |
Definition at line 1890 of file SysCatalog.cpp.
References AccessPrivileges::ALL_DASHBOARD, AccessPrivileges::ALL_DATABASE, AccessPrivileges::ALL_SERVER, AccessPrivileges::ALL_TABLE, DashboardDBObjectType, getUserGrantee(), grantDBObjectPrivileges_unsafe(), Grantee::grantPrivileges(), instance(), Catalog_Namespace::UserMetadata::isSuper, ServerDBObjectType, sqliteConnector_, TableDBObjectType, Catalog_Namespace::UserMetadata::userId, Catalog_Namespace::UserMetadata::userLoggable(), and Catalog_Namespace::UserMetadata::userName.
Referenced by CreateForeignServerCommand::execute(), CreateForeignTableCommand::execute(), and EmbeddedDatabase::DBEngineImpl::importArrowTable().
void Catalog_Namespace::SysCatalog::createRole | ( | const std::string & | roleName, |
const bool | user_private_role, | ||
const bool | is_temporary = false |
||
) |
Definition at line 2848 of file SysCatalog.cpp.
References createRole_unsafe(), and execInTransaction().
|
private |
Definition at line 2268 of file SysCatalog.cpp.
References DatabaseDBObjectType, DBObjectKey::dbId, getGrantee(), granteeMap_, Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::insertOrUpdateObjectPrivileges(), shared::kDefaultDbName, DBObjectKey::permissionType, DBObject::setObjectKey(), sqliteConnector_, and to_upper().
Referenced by addAdminUserRole(), createRole(), createUser(), and initDB().
|
private |
Definition at line 445 of file SysCatalog.cpp.
References sqliteConnector_.
Referenced by checkAndExecuteMigrations().
UserMetadata Catalog_Namespace::SysCatalog::createUser | ( | std::string const & | name, |
UserAlterations | alts, | ||
bool | is_temporary | ||
) |
Definition at line 987 of file SysCatalog.cpp.
References Catalog_Namespace::UserAlterations::can_login, CHECK, createRole_unsafe(), Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::UserAlterations::default_db, Catalog_Namespace::g_log_user_id, g_read_only, getGrantee(), getMetadataForDB(), getMetadataForUser(), getUser(), anonymous_namespace{SysCatalog.cpp}::hash_with_bcrypt(), Catalog_Namespace::UserAlterations::is_super, name(), next_temporary_user_id_, Catalog_Namespace::UserAlterations::passwd, sqliteConnector_, temporary_users_by_id_, temporary_users_by_name_, to_string(), Catalog_Namespace::UserMetadata::userLoggable(), and VLOG.
Referenced by syncUserWithRemoteProvider().
|
private |
Definition at line 3182 of file SysCatalog.cpp.
References sqliteConnector_.
Referenced by recordExecutedMigration().
|
private |
Definition at line 2470 of file SysCatalog.cpp.
References objectDescriptorMap_.
Referenced by dropUserUnchecked(), and revokeDBObjectPrivileges_unsafe().
|
private |
Definition at line 2483 of file SysCatalog.cpp.
References Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::Catalog::getCurrentDB(), objectDescriptorMap_, and to_string().
|
inlinestatic |
Definition at line 351 of file SysCatalog.h.
References migrations::MigrationMgr::destroy(), instance_, and instance_mutex_.
Referenced by main(), EmbeddedDatabase::DBEngineImpl::reset(), and DBHandler::shutdown().
void Catalog_Namespace::SysCatalog::dropDatabase | ( | const DBMetadata & | db | ) |
Definition at line 1596 of file SysCatalog.cpp.
References cat(), DashboardDBObjectType, Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::DBMetadata::dbName, getCatalog(), granteeMap_, removeCatalog(), revokeAllOnDatabase_unsafe(), revokeDBObjectPrivilegesFromAll_unsafe(), sqliteConnector_, TableDBObjectType, run_benchmark_import::tables, and to_string().
Referenced by initializeInformationSchemaDb().
void Catalog_Namespace::SysCatalog::dropRole | ( | const std::string & | roleName, |
const bool | is_temporary = false |
||
) |
Definition at line 2855 of file SysCatalog.cpp.
References dropRole_unsafe(), and execInTransaction().
|
private |
Definition at line 2304 of file SysCatalog.cpp.
References granteeMap_, objectDescriptorMap_, sqliteConnector_, and to_upper().
Referenced by dropRole(), and dropUserUnchecked().
void Catalog_Namespace::SysCatalog::dropUser | ( | const std::string & | name, |
bool | if_exists = false |
||
) |
Definition at line 1118 of file SysCatalog.cpp.
References dropUserUnchecked(), Catalog_Namespace::g_log_user_id, getAllDBMetadata(), getMetadataForUser(), shared::kRootUserId, and Catalog_Namespace::UserMetadata::userId.
void Catalog_Namespace::SysCatalog::dropUserUnchecked | ( | const std::string & | name, |
const UserMetadata & | user | ||
) |
Definition at line 1081 of file SysCatalog.cpp.
References CHECK, deleteObjectDescriptorMap(), dropRole_unsafe(), Catalog_Namespace::UserMetadata::is_temporary, sqliteConnector_, temporary_users_by_id_, temporary_users_by_name_, to_string(), and Catalog_Namespace::UserMetadata::userId.
Referenced by dropUser().
|
private |
Definition at line 2835 of file SysCatalog.cpp.
References run_benchmark_import::args, f(), and sqliteConnector_.
Referenced by createRole(), dropRole(), grantDBObjectPrivileges(), grantDBObjectPrivilegesBatch(), grantRole(), grantRoleBatch(), revokeDBObjectPrivileges(), revokeDBObjectPrivilegesBatch(), revokeDBObjectPrivilegesFromAll(), revokeDBObjectPrivilegesFromAllBatch(), revokeRole(), and revokeRoleBatch().
|
private |
Definition at line 472 of file SysCatalog.cpp.
References sqliteConnector_.
Referenced by checkAndExecuteMigrations().
list< DBMetadata > Catalog_Namespace::SysCatalog::getAllDBMetadata | ( | ) |
Definition at line 1729 of file SysCatalog.cpp.
References Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::DBMetadata::dbName, Catalog_Namespace::DBMetadata::dbOwner, and sqliteConnector_.
Referenced by dropUser(), getCatalogsForAllDbs(), and getDatabaseListForUser().
list< UserMetadata > Catalog_Namespace::SysCatalog::getAllUserMetadata | ( | ) |
Definition at line 1789 of file SysCatalog.cpp.
References Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::get_users(), and sqliteConnector_.
Referenced by Catalog_Namespace::anonymous_namespace{Catalog.cpp}::get_user_id_to_user_name_map(), and getDatabaseListForUser().
list< UserMetadata > Catalog_Namespace::SysCatalog::getAllUserMetadata | ( | const int64_t | dbId | ) |
return the users associated with the given DB
Definition at line 1782 of file SysCatalog.cpp.
References Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::get_users(), and sqliteConnector_.
|
inline |
Definition at line 235 of file SysCatalog.h.
References calciteMgr_.
std::shared_ptr< Catalog > Catalog_Namespace::SysCatalog::getCatalog | ( | const std::string & | dbName | ) |
Definition at line 3022 of file SysCatalog.cpp.
References cat_map_, getMetadataForDB(), and to_upper().
Referenced by foreign_storage::anonymous_namespace{LogFileBufferParser.cpp}::add_nonce_values(), Executor::addDeletedColumn(), QueryFragmentDescriptor::buildFragmentPerKernelMap(), foreign_storage::cache_blocks(), changeDatabaseOwner(), anonymous_namespace{DBHandler.cpp}::check_in_memory_system_table_query(), DBHandler::checkInMemorySystemTableQuery(), anonymous_namespace{Calcite.cpp}::checkPermissionForTables(), Executor::computeStringDictionaryGenerations(), anonymous_namespace{ExternalExecutor.cpp}::create_table_schema(), createDatabase(), foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), DictionaryValueConverter< TARGET_TYPE >::DictionaryValueConverter(), dropDatabase(), foreign_storage::ParquetDataWrapper::fetchChunkMetadata(), foreign_storage::ForeignTableSchema::ForeignTableSchema(), anonymous_namespace{SerializeToSql.cpp}::from_to_string(), foreign_storage::anonymous_namespace{InternalMemoryStatsDataWrapper.cpp}::get_column_name(), foreign_storage::get_foreign_table_for_key(), Catalog_Namespace::get_metadata_for_column(), Catalog_Namespace::get_metadata_for_table(), anonymous_namespace{RelAlgExecutor.cpp}::get_physical_inputs_with_spi_col_id(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_table_ddl(), foreign_storage::get_table_name(), anonymous_namespace{RelAlgExecutor.cpp}::get_table_name_from_table_key(), foreign_storage::ParseBufferRequest::getCatalog(), anonymous_namespace{RelAlgDag.cpp}::getCatalogAndTableFromScanNode(), getCatalogsForAllDbs(), foreign_storage::ParquetImportBatchResult::getChunksAndDictionaries(), lockmgr::TableLockMgrImpl< T >::getClusterTableMutex(), foreign_storage::ParquetDataWrapper::getColumnsToInitialize(), RelAlgTranslator::getInIntegerSetExpr(), RowSetMemoryOwner::getOrAddStringDictProxy(), data_conversion::StringViewSource::getSourceData(), InputTableInfoCache::getTableInfo(), RelAlgExecutor::hasDeletedRowInQuery(), foreign_storage::init_chunk_for_column(), foreign_storage::Csv::init_chunk_for_column(), data_conversion::StringViewToStringDictEncoder< IdType >::initialize(), PersistentStorageMgr::isForeignStorage(), Executor::isFragmentFullyDeleted(), foreign_storage::AbstractTextFileDataWrapper::iterativeFileScan(), boost::serialization::load_construct_data(), foreign_storage::ParquetDataWrapper::loadBuffersUsingLazyParquetChunkLoader(), login(), foreign_storage::populate_string_dictionary(), foreign_storage::AbstractTextFileDataWrapper::populateChunkBuffers(), foreign_storage::AbstractTextFileDataWrapper::populateChunkMetadata(), anonymous_namespace{RelAlgExecutor.cpp}::prepare_for_system_table_execution(), anonymous_namespace{RelAlgExecutor.cpp}::prepare_string_dictionaries(), QueryRewriter::rewriteColumnarUpdate(), anonymous_namespace{RelAlgExecutor.cpp}::set_parallelism_hints(), StringValueConverter::StringValueConverter(), switchDatabase(), foreign_storage::AbstractTextFileDataWrapper::updateMetadata(), DBHandler::validateRelAlg(), and ScalarExprToSql::visitColumnVar().
std::shared_ptr< Catalog > Catalog_Namespace::SysCatalog::getCatalog | ( | const int32_t | db_id | ) |
std::shared_ptr< Catalog > Catalog_Namespace::SysCatalog::getCatalog | ( | const DBMetadata & | curDB, |
bool | is_new_db | ||
) |
Definition at line 3047 of file SysCatalog.cpp.
References basePath_, calciteMgr_, cat(), cat_map_, dataMgr_, Catalog_Namespace::DBMetadata::dbName, string_dict_hosts_, and to_upper().
|
inline |
std::vector< Catalog * > Catalog_Namespace::SysCatalog::getCatalogsForAllDbs | ( | ) |
Definition at line 1148 of file SysCatalog.cpp.
References getAllDBMetadata(), and getCatalog().
Referenced by checkDropRenderGroupColumnsMigration(), and ReassignOwnedCommand::execute().
std::set< std::string > Catalog_Namespace::SysCatalog::getCreatedRoles | ( | ) | const |
Definition at line 2683 of file SysCatalog.cpp.
References granteeMap_, and isDashboardSystemRole().
DBSummaryList Catalog_Namespace::SysCatalog::getDatabaseListForUser | ( | const UserMetadata & | user | ) |
Definition at line 1861 of file SysCatalog.cpp.
References AccessPrivileges::ACCESS, checkPrivileges(), DatabaseDBObjectType, Catalog_Namespace::DBSummary::dbName, getAllDBMetadata(), getAllUserMetadata(), DBObject::loadKey(), DBObject::setPrivileges(), Catalog_Namespace::UserMetadata::userId, and Catalog_Namespace::UserMetadata::userName.
Referenced by ShowDatabasesCommand::execute().
|
inline |
Definition at line 234 of file SysCatalog.h.
References dataMgr_.
Referenced by Executor::clearMemory(), Executor::getExecutor(), foreign_storage::InternalMemoryStatsDataWrapper::initializeObjectsForTable(), foreign_storage::InternalStorageStatsDataWrapper::initializeObjectsForTable(), ResultSet::radixSortOnGpu(), and anonymous_namespace{RelAlgExecutor.cpp}::set_parallelism_hints().
|
inline |
Definition at line 215 of file SysCatalog.h.
References getMetadataForDB().
|
inline |
Definition at line 221 of file SysCatalog.h.
References getMetadataForDBById().
void Catalog_Namespace::SysCatalog::getDBObjectPrivileges | ( | const std::string & | granteeName, |
DBObject & | object, | ||
const Catalog_Namespace::Catalog & | catalog | ||
) | const |
Definition at line 2246 of file SysCatalog.cpp.
References getGrantee(), getMetadataForUser(), instance(), and Catalog_Namespace::UserMetadata::isSuper.
|
inline |
Definition at line 369 of file SysCatalog.h.
References dummyCatalog_.
Referenced by Catalog_Namespace::Catalog::getObjForLock().
Grantee * Catalog_Namespace::SysCatalog::getGrantee | ( | const std::string & | name | ) | const |
Definition at line 2553 of file SysCatalog.cpp.
References granteeMap_, and to_upper().
Referenced by buildRoleMapUnlocked(), buildUserRoleMapUnlocked(), createRole_unsafe(), createUser(), getDBObjectPrivileges(), getRoleGrantee(), getRoles(), getUserGrantee(), grantDBObjectPrivileges_unsafe(), grantRole_unsafe(), renameDBObject(), renameUser(), revokeDBObjectPrivileges_unsafe(), and revokeRole_unsafe().
std::unordered_map< std::string, std::vector< std::string > > Catalog_Namespace::SysCatalog::getGranteesOfSharedDashboards | ( | const std::vector< std::string > & | dashboard_ids | ) |
Definition at line 2991 of file SysCatalog.cpp.
References DashboardDBObjectType, sqliteConnector_, and to_string().
Referenced by Catalog_Namespace::Catalog::createDashboardSystemRoles().
std::vector< ObjectRoleDescriptor > Catalog_Namespace::SysCatalog::getMetadataForAllObjects | ( | ) | const |
Definition at line 2584 of file SysCatalog.cpp.
References isDashboardSystemRole(), and objectDescriptorMap_.
bool Catalog_Namespace::SysCatalog::getMetadataForDB | ( | const std::string & | name, |
DBMetadata & | db | ||
) |
Definition at line 1830 of file SysCatalog.cpp.
References Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::DBMetadata::dbName, Catalog_Namespace::DBMetadata::dbOwner, sqliteConnector_, and to_upper().
Referenced by alterUser(), changeDatabaseOwner(), createDatabase(), createUser(), getCatalog(), getDB(), getMetadataWithDefaultDB(), initializeInformationSchemaDb(), migrateDBAccessPrivileges(), renameDatabase(), and Catalog_Namespace::UserAlterations::wouldChange().
bool Catalog_Namespace::SysCatalog::getMetadataForDBById | ( | const int32_t | idIn, |
DBMetadata & | db | ||
) |
Definition at line 1846 of file SysCatalog.cpp.
References Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::DBMetadata::dbName, Catalog_Namespace::DBMetadata::dbOwner, sqliteConnector_, and to_string().
Referenced by getDB(), and getMetadataWithDefaultDB().
std::vector< ObjectRoleDescriptor * > Catalog_Namespace::SysCatalog::getMetadataForObject | ( | int32_t | dbId, |
int32_t | dbType, | ||
int32_t | objectId | ||
) | const |
Definition at line 2571 of file SysCatalog.cpp.
References objectDescriptorMap_, and to_string().
Referenced by renameDBObject().
bool Catalog_Namespace::SysCatalog::getMetadataForUser | ( | const std::string & | name, |
UserMetadata & | user | ||
) |
Definition at line 1690 of file SysCatalog.cpp.
References Catalog_Namespace::parseUserMetadataFromSQLite(), sqliteConnector_, and temporary_users_by_name_.
Referenced by alterUser(), changeDatabaseOwner(), checkPasswordForUserImpl(), checkPrivileges(), createUser(), dropUser(), getDBObjectPrivileges(), getMetadataWithDefaultDB(), getRoles(), getUser(), grantDBObjectPrivileges_unsafe(), grantRoleBatch_unsafe(), login(), renameUser(), revokeDBObjectPrivileges_unsafe(), and revokeRoleBatch_unsafe().
bool Catalog_Namespace::SysCatalog::getMetadataForUserById | ( | const int32_t | idIn, |
UserMetadata & | user | ||
) |
Definition at line 1710 of file SysCatalog.cpp.
References Catalog_Namespace::parseUserMetadataFromSQLite(), sqliteConnector_, temporary_users_by_id_, and to_string().
Referenced by changeDatabaseOwner(), createDatabase(), getUser(), populateRoleDbObjects(), and reassignObjectOwners().
|
private |
Definition at line 1794 of file SysCatalog.cpp.
References Catalog_Namespace::DBMetadata::dbName, Catalog_Namespace::UserMetadata::defaultDbId, Catalog_Namespace::g_log_user_id, getMetadataForDB(), getMetadataForDBById(), getMetadataForUser(), shared::kDefaultDbName, to_string(), Catalog_Namespace::UserMetadata::userId, and Catalog_Namespace::UserMetadata::userName.
Referenced by login(), and switchDatabase().
Role * Catalog_Namespace::SysCatalog::getRoleGrantee | ( | const std::string & | name | ) | const |
Definition at line 2562 of file SysCatalog.cpp.
References getGrantee().
Referenced by Catalog_Namespace::Catalog::createDashboardSystemRoles(), grantRole_unsafe(), isRoleGrantedToGrantee(), revokeRole_unsafe(), and syncUserWithRemoteProvider().
std::vector< std::string > Catalog_Namespace::SysCatalog::getRoles | ( | const std::string & | user_name, |
bool | effective = true |
||
) |
Definition at line 2622 of file SysCatalog.cpp.
References getGrantee().
std::vector< std::string > Catalog_Namespace::SysCatalog::getRoles | ( | bool | include_user_private_role, |
bool | is_super, | ||
const std::string & | user_name, | ||
bool | ignore_deleted_user = false |
||
) |
Definition at line 2653 of file SysCatalog.cpp.
References getMetadataForUser(), granteeMap_, isDashboardSystemRole(), and isRoleGrantedToGrantee().
std::vector< std::string > Catalog_Namespace::SysCatalog::getRoles | ( | const std::string & | userName, |
const int32_t | dbId | ||
) |
Definition at line 2632 of file SysCatalog.cpp.
References isDashboardSystemRole(), isRoleGrantedToGrantee(), sqliteConnector_, and to_string().
|
inline |
Definition at line 237 of file SysCatalog.h.
References sqliteConnector_.
|
inline |
Definition at line 203 of file SysCatalog.h.
References getMetadataForUser().
Referenced by alterUser(), createUser(), and syncUserWithRemoteProvider().
|
inline |
Definition at line 209 of file SysCatalog.h.
References getMetadataForUserById().
User * Catalog_Namespace::SysCatalog::getUserGrantee | ( | const std::string & | name | ) | const |
Definition at line 2566 of file SysCatalog.cpp.
References getGrantee().
Referenced by checkPrivileges(), createDBObject(), Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::get_users(), hasAnyPrivileges(), isRoleGrantedToGrantee(), populateRoleDbObjects(), syncUserWithRemoteProvider(), and verifyDBObjectOwnership().
|
private |
Definition at line 2011 of file SysCatalog.cpp.
References AccessPrivileges::ACCESS, AccessPrivileges::ALL_DASHBOARD, AccessPrivileges::ALL_SERVER, AccessPrivileges::ALL_TABLE, AccessPrivileges::ALL_VIEW, DashboardDBObjectType, DatabaseDBObjectType, g_enable_fsi, grantDBObjectPrivileges_unsafe(), ServerDBObjectType, DBObject::setPermissionType(), DBObject::setPrivileges(), TableDBObjectType, AccessPrivileges::VIEW_SQL_EDITOR, and ViewDBObjectType.
Referenced by createDatabase(), and grantDBObjectPrivileges_unsafe().
void Catalog_Namespace::SysCatalog::grantDBObjectPrivileges | ( | const std::string & | grantee, |
const DBObject & | object, | ||
const Catalog_Namespace::Catalog & | catalog | ||
) |
Definition at line 2881 of file SysCatalog.cpp.
References execInTransaction(), and grantDBObjectPrivileges_unsafe().
|
private |
Definition at line 1969 of file SysCatalog.cpp.
References DatabasePrivileges::ALL, CHECK, DatabaseDBObjectType, getGrantee(), getMetadataForUser(), grantAllOnDatabase_unsafe(), Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::insertOrUpdateObjectPrivileges(), instance(), Catalog_Namespace::UserMetadata::is_temporary, Catalog_Namespace::UserMetadata::isSuper, sqliteConnector_, and updateObjectDescriptorMap().
Referenced by createDBObject(), grantAllOnDatabase_unsafe(), grantDBObjectPrivileges(), grantDBObjectPrivilegesBatch_unsafe(), and runUpdateQueriesAndChangeOwnership().
void Catalog_Namespace::SysCatalog::grantDBObjectPrivilegesBatch | ( | const std::vector< std::string > & | grantees, |
const std::vector< DBObject > & | objects, | ||
const Catalog_Namespace::Catalog & | catalog | ||
) |
Definition at line 2888 of file SysCatalog.cpp.
References execInTransaction(), and grantDBObjectPrivilegesBatch_unsafe().
|
private |
Definition at line 1957 of file SysCatalog.cpp.
References grantDBObjectPrivileges_unsafe().
Referenced by grantDBObjectPrivilegesBatch(), and reassignObjectOwners().
|
private |
void Catalog_Namespace::SysCatalog::grantRole | ( | const std::string & | role, |
const std::string & | grantee, | ||
const bool | is_temporary = false |
||
) |
Definition at line 2864 of file SysCatalog.cpp.
References execInTransaction(), and grantRole_unsafe().
Referenced by syncUserWithRemoteProvider().
|
private |
Definition at line 2341 of file SysCatalog.cpp.
References getGrantee(), getRoleGrantee(), and sqliteConnector_.
Referenced by grantRole(), and grantRoleBatch_unsafe().
void Catalog_Namespace::SysCatalog::grantRoleBatch | ( | const std::vector< std::string > & | roles, |
const std::vector< std::string > & | grantees | ||
) |
Definition at line 2859 of file SysCatalog.cpp.
References execInTransaction(), and grantRoleBatch_unsafe().
Referenced by Catalog_Namespace::Catalog::createDashboardSystemRoles().
|
private |
Definition at line 2326 of file SysCatalog.cpp.
References getMetadataForUser(), grantRole_unsafe(), and Catalog_Namespace::UserMetadata::is_temporary.
Referenced by grantRoleBatch().
bool Catalog_Namespace::SysCatalog::hasAnyPrivileges | ( | const UserMetadata & | user, |
std::vector< DBObject > & | privObjects | ||
) |
Definition at line 2501 of file SysCatalog.cpp.
References getUserGrantee(), instance(), Catalog_Namespace::UserMetadata::isSuper, Catalog_Namespace::UserMetadata::userLoggable(), and Catalog_Namespace::UserMetadata::userName.
bool Catalog_Namespace::SysCatalog::hasExecutedMigration | ( | const std::string & | migration_name | ) | const |
Definition at line 3153 of file SysCatalog.cpp.
References hasVersionHistoryTable(), and sqliteConnector_.
Referenced by checkDropRenderGroupColumnsMigration(), checkDuplicateCaseInsensitiveDbNames(), and initializeInformationSchemaDb().
|
private |
Definition at line 3174 of file SysCatalog.cpp.
References sqliteConnector_.
Referenced by hasExecutedMigration(), and recordExecutedMigration().
|
private |
Definition at line 396 of file SysCatalog.cpp.
References basePath_, report::conn, logger::ERROR, logger::INFO, shared::kCatalogDirectoryName, shared::kSystemCatalogName, LOG, and sqliteConnector_.
void Catalog_Namespace::SysCatalog::init | ( | const std::string & | basePath, |
std::shared_ptr< Data_Namespace::DataMgr > | dataMgr, | ||
const AuthMetadata & | authMetadata, | ||
std::shared_ptr< Calcite > | calcite, | ||
bool | is_new_db, | ||
bool | aggregator, | ||
const std::vector< LeafHostInfo > & | string_dict_hosts | ||
) |
Definition at line 191 of file SysCatalog.cpp.
References anonymous_namespace{SysCatalog.cpp}::copy_catalog_if_read_only(), Catalog_Namespace::dsqliteMutex_(), g_multi_instance, shared::kCatalogDirectoryName, shared::kLockfilesDirectoryName, shared::kSystemCatalogName, migrations::MigrationMgr::migrationEnabled(), migrations::MigrationMgr::relaxMigrationLock(), and migrations::MigrationMgr::takeMigrationLock().
|
private |
Definition at line 315 of file SysCatalog.cpp.
References createDatabase(), createRole_unsafe(), g_read_only, anonymous_namespace{SysCatalog.cpp}::hash_with_bcrypt(), shared::kDefaultDbName, shared::kDefaultRootPasswd, shared::kRootUserId, shared::kRootUserIdStr, shared::kRootUsername, and sqliteConnector_.
|
private |
Definition at line 3132 of file SysCatalog.cpp.
References createDatabase(), dropDatabase(), g_enable_system_tables, getMetadataForDB(), hasExecutedMigration(), shared::kInfoSchemaDbName, shared::kInfoSchemaMigrationName, shared::kRootUserId, LOG, recordExecutedMigration(), and logger::WARNING.
|
inlinestatic |
Definition at line 343 of file SysCatalog.h.
References instance_, instance_mutex_, and SysCatalog().
Referenced by foreign_storage::anonymous_namespace{LogFileBufferParser.cpp}::add_nonce_values(), Executor::addDeletedColumn(), QueryFragmentDescriptor::buildFragmentPerKernelMap(), foreign_storage::cache_blocks(), AlterForeignServerCommand::changeForeignServerOwner(), AlterDatabaseCommand::changeOwner(), anonymous_namespace{Calcite.cpp}::check_db_access(), anonymous_namespace{DBHandler.cpp}::check_in_memory_system_table_query(), Catalog_Namespace::SessionInfo::checkDBAccessPrivileges(), checkDropRenderGroupColumnsMigration(), DBHandler::checkInMemorySystemTableQuery(), anonymous_namespace{Calcite.cpp}::checkPermissionForTables(), checkPrivileges(), QueryRunner::QueryRunner::clearCpuMemory(), QueryRunner::QueryRunner::clearGpuMemory(), Executor::clearMemory(), Executor::computeStringDictionaryGenerations(), Parser::create_stmt_for_query(), anonymous_namespace{ExternalExecutor.cpp}::create_table_schema(), Catalog_Namespace::Catalog::createDashboardSystemRoles(), createDBObject(), foreign_storage::ForeignDataWrapperFactory::createForeignTableProxy(), AlterTableAlterColumnCommandRecoveryMgr::createRecoveryManagersForCatalogs(), QueryRunner::QueryRunner::createStatement(), DictionaryValueConverter< TARGET_TYPE >::DictionaryValueConverter(), CreateForeignServerCommand::execute(), DropForeignServerCommand::execute(), CreateForeignTableCommand::execute(), ShowCreateTableCommand::execute(), ShowDatabasesCommand::execute(), ShowUserDetailsCommand::execute(), ShowRolesCommand::execute(), RefreshForeignTablesCommand::execute(), AlterDatabaseCommand::execute(), ReassignOwnedCommand::execute(), foreign_storage::ParquetDataWrapper::fetchChunkMetadata(), foreign_storage::ForeignTableSchema::ForeignTableSchema(), anonymous_namespace{SerializeToSql.cpp}::from_to_string(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_all_dashboards(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_all_role_assignments(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_all_tables(), foreign_storage::anonymous_namespace{InternalMemoryStatsDataWrapper.cpp}::get_column_name(), anonymous_namespace{CpuMgrArenaAllocator.cpp}::get_data_mgr_instance(), foreign_storage::get_db_name(), foreign_storage::get_foreign_table_for_key(), Catalog_Namespace::get_metadata_for_column(), Catalog_Namespace::get_metadata_for_table(), anonymous_namespace{RelAlgExecutor.cpp}::get_physical_inputs_with_spi_col_id(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_table_ddl(), foreign_storage::get_table_name(), anonymous_namespace{RelAlgExecutor.cpp}::get_table_name_from_table_key(), Catalog_Namespace::anonymous_namespace{Catalog.cpp}::get_user_id_to_user_name_map(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::get_user_name(), QueryRunner::QueryRunner::getBufferPoolStats(), QueryRunner::QueryRunner::getCalcitePlan(), foreign_storage::ParseBufferRequest::getCatalog(), anonymous_namespace{RelAlgDag.cpp}::getCatalogAndTableFromScanNode(), foreign_storage::ParquetImportBatchResult::getChunksAndDictionaries(), lockmgr::TableLockMgrImpl< T >::getClusterTableMutex(), foreign_storage::ParquetDataWrapper::getColumnsToInitialize(), getDBObjectPrivileges(), QueryRunner::QueryRunner::getExecutor(), Executor::getExecutor(), RelAlgTranslator::getInIntegerSetExpr(), QueryRunner::QueryRunner::getMemoryInfo(), Catalog_Namespace::Catalog::getObjForLock(), RowSetMemoryOwner::getOrAddStringDictProxy(), Parser::LocalQueryConnector::getOuterFragmentCount(), QueryRunner::QueryRunner::getParsedGlobalQueryHints(), QueryRunner::QueryRunner::getParsedQueryHint(), QueryRunner::QueryRunner::getParsedQueryHints(), QueryRunner::QueryRunner::getQueryInfoForDataRecyclerTest(), QueryRunner::QueryRunner::getRaExecutionSequence(), QueryRunner::QueryRunner::getRelAlgDag(), QueryRunner::QueryRunner::getRelAlgTranslator(), QueryRunner::QueryRunner::getRootNodeFromParsedQuery(), data_conversion::StringViewSource::getSourceData(), InputTableInfoCache::getTableInfo(), grantDBObjectPrivileges_unsafe(), hasAnyPrivileges(), RelAlgExecutor::hasDeletedRowInQuery(), EmbeddedDatabase::DBEngineImpl::importArrowTable(), foreign_storage::init_chunk_for_column(), foreign_storage::Csv::init_chunk_for_column(), data_conversion::StringViewToStringDictEncoder< IdType >::initialize(), foreign_storage::InternalCatalogDataWrapper::initializeObjectsForTable(), foreign_storage::InternalMemoryStatsDataWrapper::initializeObjectsForTable(), foreign_storage::InternalStorageStatsDataWrapper::initializeObjectsForTable(), PersistentStorageMgr::isForeignStorage(), Executor::isFragmentFullyDeleted(), isRoleGrantedToGrantee(), foreign_storage::AbstractTextFileDataWrapper::iterativeFileScan(), boost::serialization::load_construct_data(), foreign_storage::ParquetDataWrapper::loadBuffersUsingLazyParquetChunkLoader(), DBObject::loadKey(), main(), foreign_storage::populate_string_dictionary(), foreign_storage::InternalSystemDataWrapper::populateChunkBuffers(), foreign_storage::AbstractTextFileDataWrapper::populateChunkBuffers(), foreign_storage::InternalSystemDataWrapper::populateChunkMetadata(), foreign_storage::AbstractTextFileDataWrapper::populateChunkMetadata(), anonymous_namespace{RelAlgExecutor.cpp}::prepare_for_system_table_execution(), anonymous_namespace{RelAlgExecutor.cpp}::prepare_string_dictionaries(), DBHandler::processCalciteRequest(), QueryRunner::QueryRunner::QueryRunner(), ResultSet::radixSortOnGpu(), Catalog_Namespace::Catalog::recordOwnershipOfObjectsInObjectPermissions(), AlterDatabaseCommand::rename(), AlterForeignServerCommand::renameForeignServer(), revokeDBObjectPrivileges_unsafe(), QueryRewriter::rewriteColumnarUpdate(), QueryRunner::QueryRunner::runDDLStatement(), QueryRunner::QueryRunner::runSelectQuery(), QueryRunner::QueryRunner::runSQL(), QueryRunner::QueryRunner::runSQLWithAllowingInterrupt(), anonymous_namespace{RelAlgExecutor.cpp}::set_parallelism_hints(), EmbeddedDatabase::DBEngineImpl::setDatabase(), foreign_storage::ForeignTableRefreshScheduler::start(), startHeavyDBServer(), StringValueConverter::StringValueConverter(), foreign_storage::AbstractTextFileDataWrapper::updateMetadata(), DBHandler::validateRelAlg(), verifyDBObjectOwnership(), ScalarExprToSql::visitColumnVar(), and Catalog_Namespace::UserAlterations::wouldChange().
|
inline |
Definition at line 342 of file SysCatalog.h.
References aggregator_.
Referenced by Parser::create_stmt_for_query(), ShowCreateTableCommand::execute(), Parser::LocalQueryConnector::getOuterFragmentCount(), and DBHandler::processCalciteRequest().
|
private |
Definition at line 2618 of file SysCatalog.cpp.
References SYSTEM_ROLE_TAG().
Referenced by getCreatedRoles(), getMetadataForAllObjects(), and getRoles().
bool Catalog_Namespace::SysCatalog::isInitialized | ( | ) | const |
Definition at line 239 of file SysCatalog.cpp.
bool Catalog_Namespace::SysCatalog::isRoleGrantedToGrantee | ( | const std::string & | granteeName, |
const std::string & | roleName, | ||
bool | only_direct | ||
) | const |
Definition at line 2596 of file SysCatalog.cpp.
References CHECK, getRoleGrantee(), getUserGrantee(), Grantee::hasRole(), and instance().
Referenced by getRoles().
std::shared_ptr< Catalog > Catalog_Namespace::SysCatalog::login | ( | std::string & | db, |
std::string & | username, | ||
const std::string & | password, | ||
UserMetadata & | user_meta, | ||
bool | check_password = true |
||
) |
logins (connects) a user against a database.
throws a std::exception in all error cases! (including wrong password)
Definition at line 923 of file SysCatalog.cpp.
References Catalog_Namespace::UserMetadata::can_login, getCatalog(), getMetadataForUser(), getMetadataWithDefaultDB(), and loginImpl().
|
private |
Definition at line 949 of file SysCatalog.cpp.
References checkPasswordForUser().
Referenced by login().
|
private |
Definition at line 805 of file SysCatalog.cpp.
References AccessPrivileges::ACCESS, CHECK, DatabaseDBObjectType, DBObjectKey::dbId, Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::DBMetadata::dbName, Catalog_Namespace::DBMetadata::dbOwner, logger::ERROR, getMetadataForDB(), logger::INFO, Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::insertOrUpdateObjectPrivileges(), shared::kRootUserId, LOG, MAPD_VERSION, DBObjectKey::permissionType, DBObject::setName(), DBObject::setObjectType(), sqliteConnector_, to_string(), DBObject::updatePrivileges(), and AccessPrivileges::VIEW_SQL_EDITOR.
Referenced by checkAndExecuteMigrations().
|
private |
Definition at line 883 of file SysCatalog.cpp.
References sqliteConnector_.
Referenced by checkAndExecuteMigrations().
|
private |
Definition at line 547 of file SysCatalog.cpp.
References AccessPrivileges::ALL_DASHBOARD_MIGRATE, AccessPrivileges::ALL_TABLE_MIGRATE, AccessPrivileges::ALL_VIEW_MIGRATE, DashboardDBObjectType, DatabaseDBObjectType, Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::insertOrUpdateObjectPrivileges(), shared::kRootUserId, AccessPrivileges::NONE, sqliteConnector_, TableDBObjectType, run_benchmark_import::type, and ViewDBObjectType.
Referenced by checkAndExecuteMigrations().
|
inline |
Definition at line 358 of file SysCatalog.h.
References shared::kSystemCatalogName.
Referenced by alterUser(), buildRoleMapUnlocked(), createUser(), and Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::get_users().
void Catalog_Namespace::SysCatalog::populateRoleDbObjects | ( | const std::vector< DBObject > & | objects | ) |
Definition at line 2742 of file SysCatalog.cpp.
References CHECK, getMetadataForUserById(), getUserGrantee(), Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::insertOrUpdateObjectPrivileges(), sqliteConnector_, and Catalog_Namespace::UserMetadata::userName.
Referenced by Catalog_Namespace::Catalog::recordOwnershipOfObjectsInObjectPermissions().
void Catalog_Namespace::SysCatalog::reassignObjectOwners | ( | const std::map< int32_t, std::vector< DBObject >> & | old_owner_db_objects, |
int32_t | new_owner_id, | ||
const Catalog_Namespace::Catalog & | catalog | ||
) |
Reassigns database object ownership from a set of users (old owners) to another user (new owner).
old_owner_db_objects | - map of user ids and database objects whose ownership will be reassigned |
new_owner_id | - id of user who will own reassigned database objects |
catalog | - catalog for database where ownership reassignment occurred |
Definition at line 3077 of file SysCatalog.cpp.
References CHECK, shared::contains(), Catalog_Namespace::Catalog::getDatabaseId(), getMetadataForUserById(), grantDBObjectPrivilegesBatch_unsafe(), granteeMap_, Catalog_Namespace::UserMetadata::isSuper, objectDescriptorMap_, rebuildObjectMapsUnlocked(), revokeDBObjectPrivilegesBatch_unsafe(), sqliteConnector_, to_string(), and Catalog_Namespace::UserMetadata::userName.
|
private |
Definition at line 3189 of file SysCatalog.cpp.
References buildObjectDescriptorMapUnlocked(), buildRoleMapUnlocked(), granteeMap_, and objectDescriptorMap_.
Referenced by reassignObjectOwners(), and runUpdateQueriesAndChangeOwnership().
|
private |
Definition at line 3164 of file SysCatalog.cpp.
References createVersionHistoryTable(), hasVersionHistoryTable(), MAPD_VERSION, sqliteConnector_, and to_string().
Referenced by checkDropRenderGroupColumnsMigration(), checkDuplicateCaseInsensitiveDbNames(), and initializeInformationSchemaDb().
void Catalog_Namespace::SysCatalog::removeCatalog | ( | const std::string & | dbName | ) |
Definition at line 3073 of file SysCatalog.cpp.
References cat_map_, and to_upper().
Referenced by createDatabase(), dropDatabase(), and renameDatabase().
void Catalog_Namespace::SysCatalog::renameDatabase | ( | std::string const & | old_name, |
std::string const & | new_name | ||
) |
Definition at line 1430 of file SysCatalog.cpp.
References DatabaseDBObjectType, Catalog_Namespace::CommonFileOperations::duplicateAndRenameCatalog(), getMetadataForDB(), shared::kSystemCatalogName, removeCatalog(), Catalog_Namespace::CommonFileOperations::removeCatalogByFullPath(), sqliteConnector_, to_string(), to_upper(), and yieldTransactionStreamer().
Referenced by AlterDatabaseCommand::rename().
void Catalog_Namespace::SysCatalog::renameDBObject | ( | const std::string & | objectName, |
const std::string & | newName, | ||
DBObjectType | type, | ||
int32_t | objectId, | ||
const Catalog_Namespace::Catalog & | catalog | ||
) |
Renames an DBObject
objectName | - original DBObject name |
newName | - new name of DBObject |
type | - type of DBObject |
objectId | - original DBObject ID |
catalog | - Catalog instance object exists in |
Definition at line 1934 of file SysCatalog.cpp.
References DBObjectKey::dbId, Catalog_Namespace::DBMetadata::dbId, Catalog_Namespace::Catalog::getCurrentDB(), getGrantee(), getMetadataForObject(), DBObjectKey::objectId, DBObjectKey::permissionType, Grantee::renameDbObject(), renameObjectsInDescriptorMap(), DBObject::setObjectKey(), and run_benchmark_import::type.
void Catalog_Namespace::SysCatalog::renameObjectsInDescriptorMap | ( | DBObject & |