102 std::string
path()
const;
139 using Pool = std::list<Tablespace *, ut::allocator<Tablespace *>>;
170 template <
typename F>
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:52
Pool of session temporary tablespaces.
Definition: srv0tmp.h:137
void acquire()
Acquire the mutex.
Definition: srv0tmp.h:192
~Tablespace_pool()
Destructor.
Definition: srv0tmp.cc:186
bool m_pool_initialized
True after the pool has been initialized.
Definition: srv0tmp.h:210
void delete_old_pool(bool create_new_db)
Delete old session temporary tablespaces found on startup.
Definition: srv0tmp.cc:297
void iterate_tbsp(F &&f)
Iterate through the list of tablespaces and perform specified operation on the tablespace on every it...
Definition: srv0tmp.h:171
size_t m_init_size
Initial size of pool.
Definition: srv0tmp.h:212
void release()
Release the mutex.
Definition: srv0tmp.h:195
dberr_t initialize(bool create_new_db)
Initialize the pool on startup.
Definition: srv0tmp.cc:249
dberr_t expand(size_t size)
Expand the pool to the requested size.
Definition: srv0tmp.cc:276
Tablespace_pool(size_t init_size)
Tablespace_pool constructor.
Definition: srv0tmp.cc:178
size_t get_size()
Gets current pool size.
Definition: srv0tmp.h:182
Tablespace * get(my_thread_id id, enum tbsp_purpose purpose)
Return a session temporary tablespace.
Definition: srv0tmp.cc:199
Pool * m_free
Vector of tablespaces that are unused.
Definition: srv0tmp.h:214
void free_ts(Tablespace *ts)
Truncate and release the tablespace back to the pool.
Definition: srv0tmp.cc:226
ib_mutex_t m_mutex
Mutex to protect concurrent operations on the pool.
Definition: srv0tmp.h:218
Pool * m_active
Vector of tablespaces that are being used.
Definition: srv0tmp.h:216
Session Temporary tablespace.
Definition: srv0tmp.h:50
const space_id_t m_space_id
space_id of the current tablespace
Definition: srv0tmp.h:113
std::string file_name() const
Definition: srv0tmp.cc:160
bool close() const
Close the .ibt file.
Definition: srv0tmp.cc:128
std::string path() const
Definition: srv0tmp.cc:166
bool m_inited
True only after .ibt file is created.
Definition: srv0tmp.h:120
Tablespace()
Session Temporary tablespace.
Definition: srv0tmp.cc:68
bool truncate()
Truncate the tablespace.
Definition: srv0tmp.cc:137
my_thread_id m_thread_id
Tablespace belongs to this Session id
Definition: srv0tmp.h:123
static space_id_t m_last_used_space_id
Next available space_id for tablespace.
Definition: srv0tmp.h:117
enum tbsp_purpose purpose() const
Definition: srv0tmp.h:99
void reset_thread_id_and_purpose()
Reset the thread id while returning the tablespace to the pool.
Definition: srv0tmp.h:89
uint32_t file_id() const
The id used for name on disk temp_1.ibt, temp_2.ibt, etc.
Definition: srv0tmp.cc:156
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:81
space_id_t space_id() const
Definition: srv0tmp.h:75
~Tablespace()
Definition: srv0tmp.cc:74
enum tbsp_purpose m_purpose
Purpose for this tablespace.
Definition: srv0tmp.h:126
dberr_t create()
Create the .IBT file with pattern "temp_*.ibt".
Definition: srv0tmp.cc:94
bool operator==(const Tablespace &other)
comparator for two tablespace objects
Definition: srv0tmp.h:70
my_thread_id thread_id() const
Definition: srv0tmp.h:96
dberr_t
Definition: db0err.h:39
uint32 my_thread_id
Definition: my_thread_local.h:34
void for_each(const Shards< COUNT > &shards, Function &&f) noexcept
Iterate over the shards.
Definition: ut0counter.h:323
char * srv_temp_dir
Server temp tablespaces directory, can be absolute path.
Definition: srv0tmp.cc:65
dberr_t open_or_create(bool create_new_db)
Create the session temporary tablespaces on startup.
Definition: srv0tmp.cc:364
class Tablespace_pool * tbsp_pool
Pool of temporary tablespace.
Definition: srv0tmp.cc:62
void free_tmp(Tablespace *ts)
Release a tablespace back to the pool.
Definition: srv0tmp.cc:381
void close_files()
Close all files in the pool.
Definition: srv0tmp.cc:388
void delete_pool_manager()
Delete the pool manager.
Definition: srv0tmp.cc:386
tbsp_purpose
Purpose for using tablespace.
Definition: srv0tmp.h:34
@ TBSP_NONE
Tablespace is not being used for any temporary table.
Definition: srv0tmp.h:35
@ TBSP_INTRINSIC
Tablespace is used for intrinsic tables.
Definition: srv0tmp.h:39
@ TBSP_SLAVE
Tablespace is used by the slave node in a replication setup.
Definition: srv0tmp.h:41
@ TBSP_USER
Tablespace is used for user temporary tables.
Definition: srv0tmp.h:37
Tablespace * get_rpl_slave_tblsp()
Definition: srv0tmp.cc:394
Allocate the memory for the object in blocks.
Definition: ut0pool.h:47
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:69
#define mutex_exit(M)
Definition: ut0mutex.h:123
#define mutex_enter(M)
Definition: ut0mutex.h:117