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




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


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 >


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

Definition at line 38 of file LockMgrImpl.h.

Definition at line 141 of file LockMgrImpl.h.

Definition at line 112 of file LockMgrImpl.h.

Definition at line 140 of file LockMgrImpl.h.

Definition at line 111 of file LockMgrImpl.h.

Function Documentation

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

Definition at line 385 of file LockMgrImpl.h.

385  {
386  for (const auto& table_key : lock_mgr.getLockedTables()) {
387  for (const auto& k : table_key) {
388  os << k << " ";
389  }
390  os << "\n";
391  }
392  return os;
393 }
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 

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) {
105  throw std::runtime_error("Table/View ID " + table_name + " for catalog " +
106  cat.getCurrentDB().dbName + " does not exist");
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
113  throw std::runtime_error("Table/View ID " + table_name + " for catalog " +
114  cat.getCurrentDB().dbName +
115  " changed whilst attempting to acquire table lock");
116  }
117  }
118 }
const DBMetadata & getCurrentDB() const
Definition: Catalog.h:248
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: