OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lockmgr Namespace Reference

Namespaces

 helpers
 

Classes

class  TableLockMgrImpl
 
class  TableSchemaLockMgr
 Locks protecting a physical table object returned from the catalog. Table Metadata Locks prevent incompatible concurrent operations on table objects. For example, before dropping or altering a table, a metadata write lock must be acquired. This prevents concurrent read + drop, concurrent drops, etc. More...
 
class  InsertDataLockMgr
 Prevents simultaneous inserts into the same table. To allow concurrent Insert/Select queries, Insert queries only obtain a write lock on table data when checkpointing (flushing chunks to disk). Inserts/Data load will take an exclusive (write) lock to ensure only one insert proceeds on each table at a time. More...
 
class  TableDataLockMgr
 Locks protecting table data. Read queries take a read lock, while write queries (update, delete) obtain a write lock. Note that insert queries do not currently take a write lock (to allow concurrent inserts). Instead, insert queries obtain a write lock on the table metadata to allow existing read queries to finish (and block new ones) before flushing the inserted data to disk. More...
 
class  TableSchemaLockContainer
 
class  TableSchemaLockContainer< ReadLock >
 
class  TableSchemaLockContainer< WriteLock >
 
class  TableDataLockContainer
 
class  TableDataLockContainer< WriteLock >
 
class  TableDataLockContainer< ReadLock >
 
class  TableInsertLockContainer
 
class  TableInsertLockContainer< WriteLock >
 
class  TableInsertLockContainer< ReadLock >
 
class  MutexTracker
 
class  TrackedRefLock
 
class  AbstractLockContainer
 
class  LockContainerImpl
 

Typedefs

using LockedTableDescriptors = std::vector< std::unique_ptr< lockmgr::AbstractLockContainer< const TableDescriptor * >>>
 
using MutexTypeBase = heavyai::shared_mutex
 
using WriteLockBase = heavyai::unique_lock< MutexTracker >
 
using ReadLockBase = heavyai::shared_lock< MutexTracker >
 
using WriteLock = TrackedRefLock< WriteLockBase >
 
using ReadLock = TrackedRefLock< ReadLockBase >
 

Functions

template<class T >
T & instance ()
 
void validate_table_descriptor_after_lock (const TableDescriptor *td_prelock, const Catalog_Namespace::Catalog &cat, const std::string &table_name, const bool populate_fragmenter)
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const TableLockMgrImpl< T > &lock_mgr)
 

Typedef Documentation

using lockmgr::LockedTableDescriptors = typedef std::vector<std::unique_ptr<lockmgr::AbstractLockContainer<const TableDescriptor*>>>

Definition at line 272 of file LockMgr.h.

Definition at line 36 of file LockMgrImpl.h.

Definition at line 89 of file LockMgrImpl.h.

Definition at line 60 of file LockMgrImpl.h.

Definition at line 88 of file LockMgrImpl.h.

Definition at line 59 of file LockMgrImpl.h.

Function Documentation

template<class T >
T& lockmgr::instance ( )

Definition at line 101 of file LockMgr.cpp.

References heavydb.dtypes::T.

Referenced by Parser::check_alter_table_privilege(), DBHandler::check_table_load_privileges(), DBHandler::connect(), DBHandler::connect_impl(), DBHandler::create_dashboard(), Catalog_Namespace::Catalog::createOrUpdateDashboardSystemRole(), Catalog_Namespace::Catalog::deleteMetadataForDashboards(), Catalog_Namespace::Catalog::doTruncateTable(), Catalog_Namespace::Catalog::dropTable(), ShowCreateServerCommand::execute(), Parser::CreateTableStmt::execute(), Parser::CreateDataframeStmt::execute(), Parser::CreateTableAsSelectStmt::execute(), Parser::TruncateTableStmt::execute(), Parser::RenameDBStmt::execute(), Parser::RenameUserStmt::execute(), Parser::CopyTableStmt::execute(), Parser::CreateRoleStmt::execute(), Parser::DropRoleStmt::execute(), Parser::GrantPrivilegesStmt::execute(), Parser::RevokePrivilegesStmt::execute(), Parser::ShowPrivilegesStmt::execute(), Parser::GrantRoleStmt::execute(), Parser::RevokeRoleStmt::execute(), Parser::CreateViewStmt::execute(), Parser::CreateDBStmt::execute(), Parser::DropDBStmt::execute(), Parser::CreateUserStmt::execute(), Parser::AlterUserStmt::execute(), Parser::DropUserStmt::execute(), Catalog_Namespace::Catalog::filterTableByTypeAndUser(), DBHandler::get_dashboard(), DBHandler::get_dashboard_grantees(), DBHandler::get_dashboard_impl(), DBHandler::get_databases(), DBHandler::get_db_object_privs(), DBHandler::get_db_objects_for_grantee(), DBHandler::get_memory(), DBHandler::get_roles(), TableFunctionManager::get_singleton_internal(), DBHandler::get_table_details_impl(), Parser::anonymous_namespace{ParserNode.cpp}::get_table_key(), DBHandler::get_tables_impl(), DBHandler::get_users(), DBHandler::get_valid_groups(), DBHandler::getAllRolesForUserImpl(), Catalog_Namespace::Catalog::getCustomExpressionsForUser(), Catalog_Namespace::Catalog::getForeignServersForUser(), lockmgr::helpers::getLockForKeyImpl(), lockmgr::helpers::getLockForTableImpl(), lockmgr::TableLockMgrImpl< T >::getMutexTracker(), lockmgr::TableLockMgrImpl< T >::getReadLockForTable(), Catalog_Namespace::Catalog::getTableNamesForUser(), Catalog_Namespace::Catalog::getTablesMetadataForUser(), lockmgr::TableLockMgrImpl< T >::getWriteLockForTable(), DBHandler::has_object_privilege(), DBHandler::has_role(), DBHandler::hasTableAccessPrivileges(), DBHandler::initialize(), DBHandler::internal_connect(), is_allowed_on_dashboard(), dbhandler::is_info_schema_db(), DBHandler::parse_to_ra(), Catalog_Namespace::Catalog::reassignOwners(), Catalog_Namespace::Catalog::removeTableFromMap(), Catalog_Namespace::Catalog::renameTable(), Catalog_Namespace::Catalog::renameTables(), DBHandler::replace_dashboard(), TableFunctionManager::set_singleton(), DBHandler::shareOrUnshareDashboards(), DBHandler::switch_database(), DBHandler::user_can_access_table(), Parser::anonymous_namespace{ParserNode.cpp}::user_can_access_table(), Catalog_Namespace::anonymous_namespace{Catalog.cpp}::validate_and_get_user_id(), and DBHandler::validateGroups().

101  {
102  static T mgr;
103  return mgr;
104 }
template<typename T >
std::ostream& lockmgr::operator<< ( std::ostream &  os,
const TableLockMgrImpl< T > &  lock_mgr 
)

Definition at line 178 of file LockMgrImpl.h.

178  {
179  for (const auto& table_key : lock_mgr.getLockedTables()) {
180  for (const auto& k : table_key) {
181  os << k << " ";
182  }
183  os << "\n";
184  }
185  return os;
186 }
void lockmgr::validate_table_descriptor_after_lock ( const TableDescriptor td_prelock,
const Catalog_Namespace::Catalog cat,
const std::string &  table_name,
const bool  populate_fragmenter 
)
inline

Definition at line 98 of file LockMgr.h.

References Catalog_Namespace::DBMetadata::dbName, Catalog_Namespace::Catalog::getCurrentDB(), and Catalog_Namespace::Catalog::getMetadataForTable().

Referenced by lockmgr::TableSchemaLockContainer< ReadLock >::acquireTableDescriptor(), and lockmgr::TableSchemaLockContainer< WriteLock >::acquireTableDescriptor().

101  {
102  auto td_postlock = cat.getMetadataForTable(table_name, populate_fragmenter);
103  if (td_prelock != td_postlock) {
104  if (td_postlock == nullptr) {
106  cat.getCurrentDB().dbName);
107  } else {
108  // This should be very unusual case where a table has moved
109  // read DROP, CREATE kind of pattern
110  // but kept same name
111  // it is not safe to proceed here as the locking was based on the old
112  // chunk attributes of the table, which could belong to a different table now
114  table_name,
115  cat.getCurrentDB().dbName,
116  " Changed whilst attempting to acquire table lock");
117  }
118  }
119 }
const DBMetadata & getCurrentDB() const
Definition: Catalog.h:265
const TableDescriptor * getMetadataForTable(const std::string &tableName, const bool populateFragmenter=true) const
Returns a pointer to a const TableDescriptor struct matching the provided tableName.

+ Here is the call graph for this function:

+ Here is the caller graph for this function: