An undo_truncate::Tablespace object is used to easily convert between undo_space_id and undo_space_num and to create the automatic file_name and space name.
More...
#include <trx0undo_trunc.h>
An undo_truncate::Tablespace object is used to easily convert between undo_space_id and undo_space_num and to create the automatic file_name and space name.
In addition, it is used in undo_truncate::Tablespaces to track the trx_rseg_t objects in an Rsegs vector. So we do not allocate the Rsegs vector for each object, only when requested by the constructor.
◆ Tablespace() [1/2]
| undo_truncate::Tablespace::Tablespace |
( |
space_id_t |
id | ) |
|
|
inlineexplicit |
◆ Tablespace() [2/2]
| undo_truncate::Tablespace::Tablespace |
( |
Tablespace & |
other | ) |
|
|
inline |
Copy Constructor.
- Parameters
-
| [in] | other | undo tablespace to copy |
◆ ~Tablespace()
| undo_truncate::Tablespace::~Tablespace |
( |
| ) |
|
|
inline |
◆ alter_active()
| void undo_truncate::Tablespace::alter_active |
( |
| ) |
|
Make the undo tablespace active again so that it will be used for new transactions.
If current State is ___ then do: empty: Set active. active_implicit: Ignore. It was not altered inactive. When it is done being truncated it will go back to active. active_explicit: Depends if it is marked for truncation. marked: Set to inactive_implicit. the next state will be active. not yet: Set to active so that it does not get truncated.
◆ file_name()
| char * undo_truncate::Tablespace::file_name |
( |
| ) |
|
|
inline |
Get the undo space filename.
Make it if not yet made. NOTE: This is only called from stack objects so there is no race condition. If it is ever called from a shared object like undo_truncate::spaces, then it must be protected by the caller.
- Returns
- tablespace filename created from the space_id
◆ get_active()
Return the rseg at the requested rseg slot if the undo space is active.
- Parameters
-
| [in] | slot | The slot of the rseg. 1 to 127 |
- Returns
- Rseg pointer of nullptr if the space is not active.
◆ id()
Get the undo tablespace ID.
- Returns
- tablespace ID
◆ is_active()
| bool undo_truncate::Tablespace::is_active |
( |
| ) |
|
|
inline |
Return whether the undo tablespace is active.
- Returns
- true if active
◆ is_active_no_latch()
| bool undo_truncate::Tablespace::is_active_no_latch |
( |
| ) |
|
|
inline |
Return whether the undo tablespace is active.
For optimization purposes, do not take a latch.
- Returns
- true if active
◆ is_empty()
| bool undo_truncate::Tablespace::is_empty |
( |
void |
| ) |
|
|
inline |
Return whether the undo tablespace is empty and ready to be dropped.
- Returns
- true if empty
◆ is_explicit()
| bool undo_truncate::Tablespace::is_explicit |
( |
| ) |
|
|
inline |
Report whether this undo tablespace was explicitly created by an SQL statement.
- Returns
- true if the tablespace was created explicitly.
◆ is_inactive_explicit()
| bool undo_truncate::Tablespace::is_inactive_explicit |
( |
| ) |
|
|
inline |
Return whether the undo tablespace was made inactive by ALTER TABLESPACE.
- Returns
- true if altered inactive
◆ is_inactive_implicit()
| bool undo_truncate::Tablespace::is_inactive_implicit |
( |
| ) |
|
|
inline |
Return whether the undo tablespace is inactive due to implicit selection by the purge thread.
- Returns
- true if marked for truncation by the purge thread
◆ is_new()
| bool undo_truncate::Tablespace::is_new |
( |
| ) |
|
|
inline |
Report whether this undo tablespace was created at startup.
- Return values
-
| true | if created at startup. |
| false | if pre-existed at startup. |
◆ log_file_name()
| char * undo_truncate::Tablespace::log_file_name |
( |
| ) |
|
|
inline |
Get the undo log filename.
Make it if not yet made. NOTE: This is only called from stack objects so there is no race condition. If it is ever called from a shared object like undo_truncate::spaces, then it must be protected by the caller.
- Returns
- tablespace filename created from the space_id
◆ make_log_file_name()
| char * undo_truncate::Tablespace::make_log_file_name |
( |
space_id_t |
space_id, |
|
|
const char * |
location |
|
) |
| |
Build a log file name based on space_id.
- Parameters
-
| [in] | space_id | id of the undo tablespace. |
| [in] | location | directory location of the file. |
- Returns
- DB_SUCCESS or error code
◆ needs_truncation()
| bool undo_truncate::Tablespace::needs_truncation |
( |
| ) |
|
◆ num()
Get the undo tablespace number.
This is the same as m_id if m_id is 0.
- Returns
- undo tablespace number
◆ rsegs()
| Rsegs * undo_truncate::Tablespace::rsegs |
( |
| ) |
|
|
inline |
Get a reference to the List of rollback segments within this undo tablespace.
- Returns
- a reference to the Rsegs vector.
◆ set_active()
| void undo_truncate::Tablespace::set_active |
( |
| ) |
|
|
inline |
Set the undo tablespace active for use by transactions.
◆ set_empty()
| void undo_truncate::Tablespace::set_empty |
( |
| ) |
|
|
inline |
Set the state of the undo tablespace to empty so that it can be dropped.
◆ set_file_name()
| void undo_truncate::Tablespace::set_file_name |
( |
const char * |
file_name | ) |
|
Replace the standard undo file name if it exists with a copy of the file name provided.
This name can come in three forms: absolute path, relative path, and basename. Undo ADD DATAFILE does not accept a relative path. So if that comes in here, it was the scanned name and is relative to the datadir. If this is just a basename, add it to srv_undo_dir.
- Parameters
-
| [in] | file_name | explicit undo file name |
◆ set_inactive_explicit()
| void undo_truncate::Tablespace::set_inactive_explicit |
( |
| ) |
|
|
inline |
Make the undo tablespace inactive so that it will not be used for new transactions.
The purge thread will clear out all the undo logs, truncate it, and then mark it empty.
◆ set_inactive_implicit()
| void undo_truncate::Tablespace::set_inactive_implicit |
( |
space_id_t * |
marked_space_id | ) |
|
|
inline |
Set the state of the rollback segments in this undo tablespace to inactive_implicit if currently active.
If the state is inactive_explicit, leave as is. Then put the space_id into the callers marked_space_id. This is done when marking a space for truncate. It will not be used for new transactions until it becomes active again.
◆ set_new()
| void undo_truncate::Tablespace::set_new |
( |
| ) |
|
|
inline |
Note that this undo tablespace is being created.
◆ set_space_id()
| void undo_truncate::Tablespace::set_space_id |
( |
space_id_t |
space_id | ) |
|
Change the space_id from its current value.
- Parameters
-
| [in] | space_id | The new undo tablespace ID |
◆ set_space_name()
| void undo_truncate::Tablespace::set_space_name |
( |
const char * |
new_space_name | ) |
|
Replace the standard undo space name if it exists with a copy of the undo tablespace name provided.
- Parameters
-
| [in] | new_space_name | non-standard undo space name |
◆ space_name()
| char * undo_truncate::Tablespace::space_name |
( |
| ) |
|
|
inline |
Get the undo tablespace name.
Make it if not yet made. NOTE: This is only called from stack objects so there is no race condition. If it is ever called from a shared object like undo_truncate::spaces, then it must be protected by the caller.
- Returns
- tablespace name created from the space_id
◆ m_file_name
| char* undo_truncate::Tablespace::m_file_name |
|
private |
The tablespace file name, auto-generated when needed from the space number.
◆ m_id
◆ m_log_file_name
| char* undo_truncate::Tablespace::m_log_file_name |
|
private |
The truncation log file name, auto-generated when needed from the space number and the srv_undo_dir.
◆ m_new
| bool undo_truncate::Tablespace::m_new |
|
private |
True if this undo tablespace was implicitly created when this instance started up.
False if it pre-existed.
◆ m_rsegs
| Rsegs* undo_truncate::Tablespace::m_rsegs |
|
private |
List of rollback segments within this tablespace.
This is not always used. Must call init_rsegs to use it.
◆ m_space_name
| char* undo_truncate::Tablespace::m_space_name |
|
private |
The tablespace name, auto-generated when needed from the space number.
◆ truncate_in_progress
| bool undo_truncate::Tablespace::truncate_in_progress |
True if truncation of this undo tablespace is in progress.
The documentation for this struct was generated from the following files: