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

Namespaces

 helpers
 

Classes

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
 
class  TableLockMgrImpl
 

Typedefs

using LockedTableDescriptors = std::vector< std::unique_ptr< lockmgr::AbstractLockContainer< const TableDescriptor * >>>
 
using MutexTypeBase = mapd_shared_mutex
 
using WriteLockBase = mapd_unique_lock< MutexTypeBase >
 
using ReadLockBase = mapd_shared_lock< MutexTypeBase >
 
using MutexType = MutexTracker
 
using WriteLock = TrackedRefLock< WriteLockBase >
 
using ReadLock = TrackedRefLock< ReadLockBase >
 

Functions

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 268 of file LockMgr.h.

Definition at line 83 of file LockMgrImpl.h.

Definition at line 31 of file LockMgrImpl.h.

Definition at line 86 of file LockMgrImpl.h.

Definition at line 34 of file LockMgrImpl.h.

Definition at line 85 of file LockMgrImpl.h.

Definition at line 33 of file LockMgrImpl.h.

Function Documentation

template<typename T >
std::ostream& lockmgr::operator<< ( std::ostream &  os,
const TableLockMgrImpl< T > &  lock_mgr 
)

Definition at line 181 of file LockMgrImpl.h.

181  {
182  for (const auto& table_key : lock_mgr.getLockedTables()) {
183  for (const auto& k : table_key) {
184  os << k << " ";
185  }
186  os << "\n";
187  }
188  return os;
189 }
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 95 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().

98  {
99  auto td_postlock = cat.getMetadataForTable(table_name, populate_fragmenter);
100  if (td_prelock != td_postlock) {
101  if (td_postlock == nullptr) {
102  throw std::runtime_error("Table/View ID " + table_name + " for catalog " +
103  cat.getCurrentDB().dbName + " does not exist");
104  } else {
105  // This should be very unusual case where a table has moved
106  // read DROP, CREATE kind of pattern
107  // but kept same name
108  // it is not safe to proceed here as the locking was based on the old
109  // chunk attributes of the table, which could belong to a different table now
110  throw std::runtime_error("Table/View ID " + table_name + " for catalog " +
111  cat.getCurrentDB().dbName +
112  " changed whilst attempting to acquire table lock");
113  }
114  }
115 }
const DBMetadata & getCurrentDB() const
Definition: Catalog.h:228
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: