Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
61847b9d
Commit
61847b9d
authored
Jun 30, 2017
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tablespace: Add iterator, const_iterator, begin(), end()
parent
5ad46457
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
23 deletions
+23
-23
storage/innobase/fsp/fsp0space.cc
storage/innobase/fsp/fsp0space.cc
+8
-20
storage/innobase/include/fsp0space.h
storage/innobase/include/fsp0space.h
+15
-3
No files found.
storage/innobase/fsp/fsp0space.cc
View file @
61847b9d
...
@@ -39,11 +39,8 @@ bool
...
@@ -39,11 +39,8 @@ bool
Tablespace
::
intersection
(
Tablespace
::
intersection
(
const
Tablespace
*
other_space
)
const
Tablespace
*
other_space
)
{
{
files_t
::
const_iterator
end
=
other_space
->
m_files
.
end
();
for
(
files_t
::
const_iterator
it
(
other_space
->
begin
()),
end
(
other_space
->
end
());
it
!=
end
;
++
it
)
{
for
(
files_t
::
const_iterator
it
=
other_space
->
m_files
.
begin
();
it
!=
end
;
++
it
)
{
if
(
find
(
it
->
m_filename
))
{
if
(
find
(
it
->
m_filename
))
{
...
@@ -58,9 +55,7 @@ Tablespace::intersection(
...
@@ -58,9 +55,7 @@ Tablespace::intersection(
void
void
Tablespace
::
shutdown
()
Tablespace
::
shutdown
()
{
{
files_t
::
iterator
end
=
m_files
.
end
();
for
(
iterator
it
=
begin
();
it
!=
end
();
++
it
)
{
for
(
files_t
::
iterator
it
=
m_files
.
begin
();
it
!=
end
;
++
it
)
{
it
->
shutdown
();
it
->
shutdown
();
}
}
...
@@ -95,10 +90,7 @@ Tablespace::open_or_create(bool is_temp)
...
@@ -95,10 +90,7 @@ Tablespace::open_or_create(bool is_temp)
ut_ad
(
!
m_files
.
empty
());
ut_ad
(
!
m_files
.
empty
());
files_t
::
iterator
begin
=
m_files
.
begin
();
for
(
iterator
it
=
begin
();
it
!=
end
();
++
it
)
{
files_t
::
iterator
end
=
m_files
.
end
();
for
(
files_t
::
iterator
it
=
begin
;
it
!=
end
;
++
it
)
{
if
(
it
->
m_exists
)
{
if
(
it
->
m_exists
)
{
err
=
it
->
open_or_create
(
err
=
it
->
open_or_create
(
...
@@ -124,7 +116,7 @@ Tablespace::open_or_create(bool is_temp)
...
@@ -124,7 +116,7 @@ Tablespace::open_or_create(bool is_temp)
the proper way. */
the proper way. */
it
->
close
();
it
->
close
();
if
(
it
==
begin
)
{
if
(
it
==
begin
()
)
{
/* First data file. */
/* First data file. */
/* Create the tablespace entry for the multi-file
/* Create the tablespace entry for the multi-file
...
@@ -154,11 +146,9 @@ Tablespace::open_or_create(bool is_temp)
...
@@ -154,11 +146,9 @@ Tablespace::open_or_create(bool is_temp)
/** Find a filename in the list of Datafiles for a tablespace
/** Find a filename in the list of Datafiles for a tablespace
@return true if the filename exists in the data files */
@return true if the filename exists in the data files */
bool
bool
Tablespace
::
find
(
const
char
*
filename
)
Tablespace
::
find
(
const
char
*
filename
)
const
{
{
files_t
::
const_iterator
end
=
m_files
.
end
();
for
(
const_iterator
it
=
begin
();
it
!=
end
();
++
it
)
{
for
(
files_t
::
const_iterator
it
=
m_files
.
begin
();
it
!=
end
;
++
it
)
{
if
(
innobase_strcasecmp
(
filename
,
it
->
m_filename
)
==
0
)
{
if
(
innobase_strcasecmp
(
filename
,
it
->
m_filename
)
==
0
)
{
return
(
true
);
return
(
true
);
...
@@ -172,9 +162,7 @@ Tablespace::find(const char* filename)
...
@@ -172,9 +162,7 @@ Tablespace::find(const char* filename)
void
void
Tablespace
::
delete_files
()
Tablespace
::
delete_files
()
{
{
files_t
::
iterator
end
=
m_files
.
end
();
for
(
iterator
it
=
begin
();
it
!=
end
();
++
it
)
{
for
(
files_t
::
iterator
it
=
m_files
.
begin
();
it
!=
end
;
++
it
)
{
it
->
close
();
it
->
close
();
...
...
storage/innobase/include/fsp0space.h
View file @
61847b9d
...
@@ -44,6 +44,10 @@ class Tablespace {
...
@@ -44,6 +44,10 @@ class Tablespace {
/** Data file information - each Datafile can be accessed globally */
/** Data file information - each Datafile can be accessed globally */
files_t
m_files
;
files_t
m_files
;
/** Data file iterator */
typedef
files_t
::
iterator
iterator
;
/** Data file iterator */
typedef
files_t
::
const_iterator
const_iterator
;
Tablespace
()
Tablespace
()
:
:
...
@@ -68,6 +72,15 @@ class Tablespace {
...
@@ -68,6 +72,15 @@ class Tablespace {
Tablespace
(
const
Tablespace
&
);
Tablespace
(
const
Tablespace
&
);
Tablespace
&
operator
=
(
const
Tablespace
&
);
Tablespace
&
operator
=
(
const
Tablespace
&
);
/** Data file iterator */
const_iterator
begin
()
const
{
return
m_files
.
begin
();
}
/** Data file iterator */
const_iterator
end
()
const
{
return
m_files
.
end
();
}
/** Data file iterator */
iterator
begin
()
{
return
m_files
.
begin
();
}
/** Data file iterator */
iterator
end
()
{
return
m_files
.
end
();
}
void
set_name
(
const
char
*
name
)
{
m_name
=
name
;
}
void
set_name
(
const
char
*
name
)
{
m_name
=
name
;
}
const
char
*
name
()
const
{
return
m_name
;
}
const
char
*
name
()
const
{
return
m_name
;
}
...
@@ -156,8 +169,7 @@ class Tablespace {
...
@@ -156,8 +169,7 @@ class Tablespace {
{
{
ulint
sum
=
0
;
ulint
sum
=
0
;
for
(
files_t
::
const_iterator
it
=
m_files
.
begin
();
for
(
const_iterator
it
=
begin
();
it
!=
end
();
++
it
)
{
it
!=
m_files
.
end
();
++
it
)
{
sum
+=
it
->
m_size
;
sum
+=
it
->
m_size
;
}
}
...
@@ -200,7 +212,7 @@ class Tablespace {
...
@@ -200,7 +212,7 @@ class Tablespace {
/**
/**
@param[in] filename Name to lookup in the data files.
@param[in] filename Name to lookup in the data files.
@return true if the filename exists in the data files */
@return true if the filename exists in the data files */
bool
find
(
const
char
*
filename
);
bool
find
(
const
char
*
filename
)
const
;
/** Note that the data file was found.
/** Note that the data file was found.
@param[in] file data file object */
@param[in] file data file object */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment