62 [[nodiscard]]
const std::string &
name()
const {
return m_name; }
81template <
typename TNode = Tablespace_node>
104 virtual void reset() {
117 const TNode &
node(
size_t order)
const {
119 const auto &res =
m_nodes[order];
120 ut_a(res.order() == order);
179 sum +=
node.expected_size_in_pages();
224 const std::string res{node_path};
239 bool find(std::string_view node_name);
260template <
typename TNode>
262 for (
const auto &node : other_space.
m_nodes) {
263 if (
find(node.name())) {
271template <
typename TNode>
273 for (
const auto &node : m_nodes) {
282template <
typename TNode>
284 std::vector<size_t> res;
285 for (
const auto &node : m_nodes) {
287 .
m_path = get_node_full_path(node)};
288 const auto node_info =
291 const auto delete_status =
296 res.push_back(node.order());
303template <
typename TNode>
306 ut_a(m_nodes.size() == 0);
309 ut_d(
const char *dot = strrchr(node_path,
'.'));
327 set_path(
filepath.substr(0, dirlen));
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:49
uint32_t page_no_t
Page number.
Definition: api0api.h:47
static char * make(const std::string &path_in, const std::string &name_in, ib_file_suffix ext, bool trim=false)
Allocate and build a file name from a path, a table or tablespace name and a suffix.
Definition: fil0fil.cc:4573
bool is_absolute_path() const
Definition: fil0fil.h:1186
static void normalize(std::string &path)
Normalize a directory path for the current OS: On Windows, we convert '/' to '\', else we convert '\'...
Definition: fil0fil.h:1244
static bool has_suffix(ib_file_suffix sfx, const std::string &path)
Check if the file has the specified suffix.
Definition: fil0fil.h:1310
Data structure that contains the information about an InnoDB tablespace.
Definition: fsp0space.h:82
Tablespace(const Tablespace &)=delete
fil_type_t space_type() const
Get tablespace type.
Definition: fsp0space.h:126
space_id_t space_id() const
Get the space id of the tablespace.
Definition: fsp0space.h:161
char * m_name
Name of the tablespace.
Definition: fsp0space.h:242
virtual ~Tablespace()
Definition: fsp0space.h:91
const char * name() const
Get tablespace name.
Definition: fsp0space.h:138
const std::string & path() const
Get tablespace path.
Definition: fsp0space.h:150
space_id_t m_space_id
Tablespace ID.
Definition: fsp0space.h:245
std::vector< size_t > delete_files()
Delete all the data files.
Definition: fsp0space.h:283
const TNode & node(size_t order) const
Definition: fsp0space.h:117
Tablespace(space_id_t space_id, fil_type_t space_type)
Definition: fsp0space.h:88
uint32_t m_flags
Tablespace flags.
Definition: fsp0space.h:251
size_t get_nodes_count() const
Returns the number of nodes the tablespace contains.
Definition: fsp0space.h:211
bool is_read_only() const
Determines if the current tablespace should be opened for read-only.
Definition: fsp0space.h:206
std::string get_node_full_path(size_t node_order=0) const
Returns a full path to the node.
Definition: fsp0space.h:216
uint64_t m_autoextend_size
Autoextend size.
Definition: fsp0space.h:254
ut::vector< TNode > m_nodes
Data nodes information used in this tablespace, in the correct order.
Definition: fsp0space.h:85
std::string get_node_full_path(const Tablespace_node &node) const
Returns a full path to the node.
Definition: fsp0space.h:222
void set_path(const std::string &path)
Set tablespace path.
Definition: fsp0space.h:142
std::string m_path
Path where tablespace files will reside, not including a filename.
Definition: fsp0space.h:248
void set_flags(uint32_t fsp_flags)
Set the tablespace flags.
Definition: fsp0space.h:165
void add_datafile(const char *node_path)
Use the ADD DATAFILE path to create a node object and add it to the front of m_nodes.
Definition: fsp0space.h:304
void set_autoextend_size(uint64_t size)
Definition: fsp0space.h:230
Tablespace & operator=(const Tablespace &)=delete
bool find(std::string_view node_name)
Definition: fsp0space.h:272
void set_name(const char *name)
Set tablespace name.
Definition: fsp0space.h:130
page_no_t get_sum_of_expected_sizes_in_pages() const
Definition: fsp0space.h:175
bool intersects(const Tablespace &other_space)
Check if two tablespaces have common data file names.
Definition: fsp0space.h:261
void set_space_id(space_id_t space_id)
Set the space id of the tablespace.
Definition: fsp0space.h:154
const fil_type_t m_space_type
Type of the tablespace.
Definition: fsp0space.h:257
uint32_t flags() const
Get the tablespace flags.
Definition: fsp0space.h:172
uint64_t get_autoextend_size() const
Definition: fsp0space.h:233
ut::unique_ptr< ib::fil::Tablespaces_nodes_interface > tablespaces_nodes
The low-level tablespaces' nodes' storage implementation.
Definition: fil0fil.cc:1388
constexpr size_t FIL_IBD_FILE_INITIAL_SIZE
Initial size of a single-table tablespace in pages.
Definition: fil0fil.h:1493
@ IBD
Definition: fil0fil.h:945
@ NO_EXT
Definition: fil0fil.h:944
fil_type_t
File types.
Definition: fil0types.h:180
Tablespace data file implementation.
bool fsp_is_system_temporary(space_id_t space_id)
Check if tablespace is system temporary.
Definition: fsp0fsp.cc:294
bool fsp_flags_is_valid(uint32_t flags)
Validate the tablespace flags.
Definition: fsp0fsp.ic:317
size_t dirname_length(const char *name)
Get the string length of the directory part of name, including the last FN_LIBCHAR.
Definition: mf_dirname.cc:62
int innobase_strcasecmp(const char *a, const char *b)
Compares NUL-terminated UTF-8 strings case insensitively.
Definition: ha_innodb.cc:2391
static char * mem_strdup(const char *str)
Duplicates a NUL-terminated string.
static const char * filepath
Definition: myisamlog.cc:97
std::string HARNESS_EXPORT reset()
get 'reset attributes' ESC sequence.
Definition: vt100.cc:37
Definition: fsp0sysspace.cc:74
Container::const_iterator find(const Container &c, Value &&value)
Definition: generic.h:40
size_t size(const char *const c)
Definition: base64.h:46
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2724
void free(void *ptr) noexcept
Releases storage which has been dynamically allocated through any of the ut::malloc*(),...
Definition: ut0new.h:559
bool srv_read_only_mode
Set if InnoDB must operate in read-only mode.
Definition: srv0srv.cc:196
Definition: fil0tablespaces_nodes_interface.h:76
const std::string m_path
Path and filename of the node to process.
Definition: fil0tablespaces_nodes_interface.h:78
Stores information about a single tablespace node.
Definition: fsp0space.h:50
const std::string m_name
It can be an absolute path to the node storage.
Definition: fsp0space.h:71
const page_no_t m_expected_size_in_pages
Expected size of the node in pages.
Definition: fsp0space.h:74
const std::string & name() const
Definition: fsp0space.h:62
Tablespace_node(const std::string &name, page_no_t expected_size_in_pages, size_t order)
Definition: fsp0space.h:52
size_t order() const
Definition: fsp0space.h:64
const size_t m_order
Node's position in the list of nodes of the tablespace it resides in.
Definition: fsp0space.h:77
page_no_t expected_size_in_pages() const
Definition: fsp0space.h:58
Version control for database, common definitions, and include files.
constexpr space_id_t SPACE_UNKNOWN
Unknown space id.
Definition: univ.i:452
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:109
#define ut_d(EXPR)
Debug statement.
Definition: ut0dbg.h:111
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:97
Base of InnoDB utilities.
Dynamic memory allocation routines and custom allocators specifically crafted to support memory instr...