MySQL 8.4.2
Source Code Documentation
ibt::Tablespace Class Reference

Session Temporary tablespace. More...

#include <srv0tmp.h>

Public Member Functions

 Tablespace ()
 Session Temporary tablespace. More...
 
 ~Tablespace ()
 
dberr_t create ()
 Create the .IBT file with pattern "temp_*.ibt". More...
 
bool close () const
 Close the .ibt file. More...
 
bool truncate ()
 Truncate the tablespace. More...
 
bool operator== (const Tablespace &other)
 comparator for two tablespace objects More...
 
space_id_t space_id () const
 
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. More...
 
void reset_thread_id_and_purpose ()
 Reset the thread id while returning the tablespace to the pool. More...
 
my_thread_id thread_id () const
 
enum tbsp_purpose purpose () const
 
std::string path () const
 

Private Member Functions

uint32_t file_id () const
 The id used for name on disk temp_1.ibt, temp_2.ibt, etc. More...
 
std::string file_name () const
 

Private Attributes

const space_id_t m_space_id
 space_id of the current tablespace More...
 
bool m_inited
 True only after .ibt file is created. More...
 
my_thread_id m_thread_id
 Tablespace belongs to this Session id
More...
 
enum tbsp_purpose m_purpose
 Purpose for this tablespace. More...
 

Static Private Attributes

static space_id_t m_last_used_space_id = dict_sys_t::s_min_temp_space_id
 Next available space_id for tablespace. More...
 

Detailed Description

Session Temporary tablespace.

Constructor & Destructor Documentation

◆ Tablespace()

Tablespace::Tablespace ( )

Session Temporary tablespace.

◆ ~Tablespace()

Tablespace::~Tablespace ( )

Member Function Documentation

◆ close()

bool Tablespace::close ( void  ) const

Close the .ibt file.

Doesn't delete the tablespace

Returns
true on success, false on failure

◆ create()

dberr_t Tablespace::create ( )

Create the .IBT file with pattern "temp_*.ibt".

Returns
DB_SUCCESS on success

◆ file_id()

uint32_t Tablespace::file_id ( ) const
private

The id used for name on disk temp_1.ibt, temp_2.ibt, etc.

Returns
the offset based on s_min_temp_space_id. The minimum offset is 1

◆ file_name()

std::string Tablespace::file_name ( ) const
private
Returns
the file_name only excluding the path

◆ operator==()

bool ibt::Tablespace::operator== ( const Tablespace other)
inline

comparator for two tablespace objects

Returns
true if space_ids are same, else false

◆ path()

std::string Tablespace::path ( ) const
Returns
complete path including filename

◆ purpose()

enum tbsp_purpose ibt::Tablespace::purpose ( ) const
inline
Returns
purpose for which the tablespace is being used

◆ reset_thread_id_and_purpose()

void ibt::Tablespace::reset_thread_id_and_purpose ( )
inline

Reset the thread id while returning the tablespace to the pool.

◆ set_thread_id_and_purpose()

void ibt::Tablespace::set_thread_id_and_purpose ( my_thread_id  thread_id,
enum tbsp_purpose  purpose 
)
inline

Set the thread id of the thread and the purpose of using the tablespace.

Parameters
[in]thread_idthread id of the thread requesting the tablespace
[in]purposepurpose for requesting the tablespace

◆ space_id()

space_id_t ibt::Tablespace::space_id ( ) const
inline
Returns
Return the space_id of the tablespace

◆ thread_id()

my_thread_id ibt::Tablespace::thread_id ( ) const
inline
Returns
thread id of the thread using the tablespace

◆ truncate()

bool Tablespace::truncate ( void  )

Truncate the tablespace.

Returns
true on success, false on failure

Member Data Documentation

◆ m_inited

bool ibt::Tablespace::m_inited
private

True only after .ibt file is created.

◆ m_last_used_space_id

space_id_t Tablespace::m_last_used_space_id = dict_sys_t::s_min_temp_space_id
staticprivate

Next available space_id for tablespace.

Space_ids for Session temporary tablespace.

These are hardcoded space_ids at higher range

The available range is from dict_sys_t::s_min_temp_space_id to dict_sys_t::s_max_temp_space_id. Total 400K space_ids are reserved for session temporary tablespaces.

◆ m_purpose

enum tbsp_purpose ibt::Tablespace::m_purpose
private

Purpose for this tablespace.

◆ m_space_id

const space_id_t ibt::Tablespace::m_space_id
private

space_id of the current tablespace

◆ m_thread_id

my_thread_id ibt::Tablespace::m_thread_id
private

Tablespace belongs to this Session id


The documentation for this class was generated from the following files: