101 std::string
path()
const;
138 using Pool = std::list<Tablespace *, ut::allocator<Tablespace *>>;
169 template <
typename F>
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:50
Pool of session temporary tablespaces.
Definition: srv0tmp.h:136
void acquire()
Acquire the mutex.
Definition: srv0tmp.h:191
~Tablespace_pool()
Destructor.
Definition: srv0tmp.cc:185
bool m_pool_initialized
True after the pool has been initialized.
Definition: srv0tmp.h:209
void delete_old_pool(bool create_new_db)
Delete old session temporary tablespaces found on startup.
Definition: srv0tmp.cc:296
void iterate_tbsp(F &&f)
Iterate through the list of tablespaces and perform specified operation on the tablespace on every it...
Definition: srv0tmp.h:170
size_t m_init_size
Initial size of pool.
Definition: srv0tmp.h:211
void release()
Release the mutex.
Definition: srv0tmp.h:194
dberr_t initialize(bool create_new_db)
Initialize the pool on startup.
Definition: srv0tmp.cc:248
dberr_t expand(size_t size)
Expand the pool to the requested size.
Definition: srv0tmp.cc:275
Tablespace_pool(size_t init_size)
Tablespace_pool constructor.
Definition: srv0tmp.cc:177
size_t get_size()
Gets current pool size.
Definition: srv0tmp.h:181
Tablespace * get(my_thread_id id, enum tbsp_purpose purpose)
Return a session temporary tablespace.
Definition: srv0tmp.cc:198
Pool * m_free
Vector of tablespaces that are unused.
Definition: srv0tmp.h:213
void free_ts(Tablespace *ts)
Truncate and release the tablespace back to the pool.
Definition: srv0tmp.cc:225
ib_mutex_t m_mutex
Mutex to protect concurrent operations on the pool.
Definition: srv0tmp.h:217
Pool * m_active
Vector of tablespaces that are being used.
Definition: srv0tmp.h:215
Session Temporary tablespace.
Definition: srv0tmp.h:49
const space_id_t m_space_id
space_id of the current tablespace
Definition: srv0tmp.h:112
std::string file_name() const
Definition: srv0tmp.cc:159
bool close() const
Close the .ibt file.
Definition: srv0tmp.cc:127
std::string path() const
Definition: srv0tmp.cc:165
bool m_inited
True only after .ibt file is created.
Definition: srv0tmp.h:119
Tablespace()
Session Temporary tablespace.
Definition: srv0tmp.cc:67
bool truncate()
Truncate the tablespace.
Definition: srv0tmp.cc:136
my_thread_id m_thread_id
Tablespace belongs to this Session id
Definition: srv0tmp.h:122
static space_id_t m_last_used_space_id
Next available space_id for tablespace.
Definition: srv0tmp.h:116
enum tbsp_purpose purpose() const
Definition: srv0tmp.h:98
void reset_thread_id_and_purpose()
Reset the thread id while returning the tablespace to the pool.
Definition: srv0tmp.h:88
uint32_t file_id() const
The id used for name on disk temp_1.ibt, temp_2.ibt, etc.
Definition: srv0tmp.cc:155
void set_thread_id_and_purpose(my_thread_id thread_id, enum tbsp_purpose purpose)
Set the thread id of the thread and the purpose of using the tablespace.
Definition: srv0tmp.h:80
space_id_t space_id() const
Definition: srv0tmp.h:74
~Tablespace()
Definition: srv0tmp.cc:73
enum tbsp_purpose m_purpose
Purpose for this tablespace.
Definition: srv0tmp.h:125
dberr_t create()
Create the .IBT file with pattern "temp_*.ibt".
Definition: srv0tmp.cc:93
bool operator==(const Tablespace &other)
comparator for two tablespace objects
Definition: srv0tmp.h:69
my_thread_id thread_id() const
Definition: srv0tmp.h:95
dberr_t
Definition: db0err.h:38
uint32 my_thread_id
Definition: my_thread_local.h:33
void for_each(const Shards< COUNT > &shards, Function &&f) noexcept
Iterate over the shards.
Definition: ut0counter.h:322
char * srv_temp_dir
Server temp tablespaces directory, can be absolute path.
Definition: srv0tmp.cc:64
dberr_t open_or_create(bool create_new_db)
Create the session temporary tablespaces on startup.
Definition: srv0tmp.cc:363
class Tablespace_pool * tbsp_pool
Pool of temporary tablespace.
Definition: srv0tmp.cc:61
void free_tmp(Tablespace *ts)
Release a tablespace back to the pool.
Definition: srv0tmp.cc:380
void close_files()
Close all files in the pool.
Definition: srv0tmp.cc:387
void delete_pool_manager()
Delete the pool manager.
Definition: srv0tmp.cc:385
tbsp_purpose
Purpose for using tablespace.
Definition: srv0tmp.h:33
@ TBSP_NONE
Tablespace is not being used for any temporary table.
Definition: srv0tmp.h:34
@ TBSP_INTRINSIC
Tablespace is used for intrinsic tables.
Definition: srv0tmp.h:38
@ TBSP_SLAVE
Tablespace is used by the slave node in a replication setup.
Definition: srv0tmp.h:40
@ TBSP_USER
Tablespace is used for user temporary tables.
Definition: srv0tmp.h:36
Tablespace * get_rpl_slave_tblsp()
Definition: srv0tmp.cc:393
Allocate the memory for the object in blocks.
Definition: ut0pool.h:46
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:68
#define mutex_exit(M)
Definition: ut0mutex.h:122
#define mutex_enter(M)
Definition: ut0mutex.h:116