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
3d7915f0
Commit
3d7915f0
authored
Mar 21, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.1 into 10.2
parents
82aeb6b5
4629db0d
Changes
24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
1538 additions
and
1620 deletions
+1538
-1620
include/my_valgrind.h
include/my_valgrind.h
+2
-0
mysql-test/r/having.result
mysql-test/r/having.result
+14
-0
mysql-test/suite/engines/iuds/r/update_time.result
mysql-test/suite/engines/iuds/r/update_time.result
+1
-1
mysql-test/suite/engines/iuds/t/update_time.test
mysql-test/suite/engines/iuds/t/update_time.test
+1
-0
mysql-test/suite/galera/disabled.def
mysql-test/suite/galera/disabled.def
+1
-0
mysql-test/suite/galera/t/galera_var_reject_queries.test
mysql-test/suite/galera/t/galera_var_reject_queries.test
+1
-1
mysql-test/suite/innodb/r/default_row_format_compatibility.result
...st/suite/innodb/r/default_row_format_compatibility.result
+3
-0
mysql-test/suite/innodb/t/default_row_format_compatibility.test
...test/suite/innodb/t/default_row_format_compatibility.test
+7
-0
mysql-test/suite/plugins/r/disks.result
mysql-test/suite/plugins/r/disks.result
+14
-0
mysql-test/suite/plugins/t/disks.test
mysql-test/suite/plugins/t/disks.test
+11
-0
mysql-test/t/having.test
mysql-test/t/having.test
+18
-0
plugin/information_schema_disks/CMakeLists.txt
plugin/information_schema_disks/CMakeLists.txt
+5
-0
plugin/information_schema_disks/README.txt
plugin/information_schema_disks/README.txt
+101
-0
plugin/information_schema_disks/information_schema_disks.cc
plugin/information_schema_disks/information_schema_disks.cc
+154
-0
storage/innobase/fil/fil0fil.cc
storage/innobase/fil/fil0fil.cc
+1
-493
storage/innobase/include/fil0fil.h
storage/innobase/include/fil0fil.h
+0
-84
storage/innobase/mem/mem0mem.cc
storage/innobase/mem/mem0mem.cc
+5
-0
storage/innobase/os/os0file.cc
storage/innobase/os/os0file.cc
+49
-79
storage/innobase/row/row0import.cc
storage/innobase/row/row0import.cc
+540
-173
storage/xtradb/fil/fil0fil.cc
storage/xtradb/fil/fil0fil.cc
+5
-482
storage/xtradb/include/fil0fil.h
storage/xtradb/include/fil0fil.h
+0
-101
storage/xtradb/mem/mem0mem.cc
storage/xtradb/mem/mem0mem.cc
+5
-0
storage/xtradb/os/os0file.cc
storage/xtradb/os/os0file.cc
+29
-17
storage/xtradb/row/row0import.cc
storage/xtradb/row/row0import.cc
+571
-189
No files found.
include/my_valgrind.h
View file @
3d7915f0
...
...
@@ -35,6 +35,8 @@
# define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
#elif defined(__SANITIZE_ADDRESS__)
# include <sanitizer/asan_interface.h>
/* How to do manual poisoning:
https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
# define MEM_UNDEFINED(a,len) ASAN_UNPOISON_MEMORY_REGION(a,len)
# define MEM_NOACCESS(a,len) ASAN_POISON_MEMORY_REGION(a,len)
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
...
...
mysql-test/r/having.result
View file @
3d7915f0
...
...
@@ -721,6 +721,20 @@ SELECT * FROM t1 JOIN t2 ON c1 = c2 HAVING c2 > 'a' ORDER BY c2 LIMIT 1;
c1 c2
x x
DROP TABLE t1,t2;
#
# MDEV-6736: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with SQ
# in WHERE and HAVING, ORDER BY, materialization+semijoin
#
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (3),(8);
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (2),(1);
SELECT a FROM t1
WHERE 9 IN ( SELECT MIN( a ) FROM t1 )
HAVING a <> ( SELECT COUNT(*) FROM t2 )
ORDER BY a;
a
DROP TABLE t1,t2;
End of 10.0 tests
#
# MDEV-10716: Assertion `real_type() != FIELD_ITEM' failed in
...
...
mysql-test/suite/engines/iuds/r/update_time.result
View file @
3d7915f0
...
...
@@ -1215,7 +1215,7 @@ c1 c2
838:59:59 838:59:59
UPDATE IGNORE t1 SET t1.c2='99999.99999' WHERE c1 BETWEEN 080000 AND 100000;
Warnings:
Warning 1265 Data truncated for column 'c2' at row
1
Warning 1265 Data truncated for column 'c2' at row
N
SELECT * FROM t1;
c1 c2
-12:12:12 12:12:12
...
...
mysql-test/suite/engines/iuds/t/update_time.test
View file @
3d7915f0
...
...
@@ -172,6 +172,7 @@ SELECT * FROM t1;
# Update using range
# EXPLAIN SELECT * FROM t1 WHERE c1 BETWEEN 080000 AND 100000;
--
replace_regex
/
(
Data
truncated
for
column
'c2'
at
row
)
[
1
-
9
][
0
-
9
]
*/
\
1
N
/
UPDATE
IGNORE
t1
SET
t1
.
c2
=
'99999.99999'
WHERE
c1
BETWEEN
080000
AND
100000
;
--
sorted_result
SELECT
*
FROM
t1
;
...
...
mysql-test/suite/galera/disabled.def
View file @
3d7915f0
...
...
@@ -56,3 +56,4 @@ galera_ist_progress: MDEV-15236 galera_ist_progress fails when trying to read tr
galera_gtid : MDEV-13549 Galera test failures 10.1
galera_gtid_slave : MDEV-13549 Galera test failures 10.1
galera_unicode_identifiers : MDEV-13549 Galera test failures 10.1
galera.galera_gcs_fc_limit : MDEV-13549 Galera test failures 10.1
mysql-test/suite/galera/t/galera_var_reject_queries.test
View file @
3d7915f0
...
...
@@ -23,7 +23,7 @@ SELECT * FROM t1;
SET
GLOBAL
wsrep_reject_queries
=
ALL_KILL
;
--
connection
node_1a
--
error
ER_CONNECTION_KILLED
,
2013
--
error
ER_CONNECTION_KILLED
,
2013
,
2006
SELECT
*
FROM
t1
;
--
connect
node_1b
,
127.0
.
0.1
,
root
,
,
test
,
$NODE_MYPORT_1
...
...
mysql-test/suite/innodb/r/default_row_format_compatibility.result
View file @
3d7915f0
...
...
@@ -41,6 +41,9 @@ SHOW TABLE STATUS LIKE 'tab';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
tab InnoDB # Compact # # # # # # NULL # NULL NULL latin1_swedish_ci NULL
ALTER TABLE tab DISCARD TABLESPACE;
call mtr.add_suppression("InnoDB: Tried to read .* bytes at offset 0");
ALTER TABLE tab IMPORT TABLESPACE;
ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`tab` : I/O error
ALTER TABLE tab IMPORT TABLESPACE;
SELECT * FROM tab;
a
...
...
mysql-test/suite/innodb/t/default_row_format_compatibility.test
View file @
3d7915f0
...
...
@@ -81,7 +81,14 @@ SHOW TABLE STATUS LIKE 'tab';
ALTER
TABLE
tab
DISCARD
TABLESPACE
;
# Move the *ibd,*.cfg file into orginal location
--
copy_file
$MYSQLD_DATADIR
/
tab
.
cfg
$MYSQLD_DATADIR
/
test
/
tab
.
ibd
--
move_file
$MYSQLD_DATADIR
/
tab
.
cfg
$MYSQLD_DATADIR
/
test
/
tab
.
cfg
call
mtr
.
add_suppression
(
"InnoDB: Tried to read .* bytes at offset 0"
);
--
error
ER_INTERNAL_ERROR
ALTER
TABLE
tab
IMPORT
TABLESPACE
;
--
remove_file
$MYSQLD_DATADIR
/
test
/
tab
.
ibd
--
move_file
$MYSQLD_DATADIR
/
tab
.
ibd
$MYSQLD_DATADIR
/
test
/
tab
.
ibd
# Check import is successful (because same row_format)
...
...
mysql-test/suite/plugins/r/disks.result
0 → 100644
View file @
3d7915f0
install plugin DISKS soname 'disks';
show create table information_schema.disks;
Table Create Table
DISKS CREATE TEMPORARY TABLE `DISKS` (
`Disk` varchar(4096) NOT NULL DEFAULT '',
`Path` varchar(4096) NOT NULL DEFAULT '',
`Total` int(32) NOT NULL DEFAULT 0,
`Used` int(32) NOT NULL DEFAULT 0,
`Available` int(32) NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8
select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
sum(Total) > sum(Available) sum(Total)>sum(Used)
1 1
uninstall plugin DISKS;
mysql-test/suite/plugins/t/disks.test
0 → 100644
View file @
3d7915f0
--
source
include
/
not_windows
.
inc
if
(
!
$DISKS_SO
)
{
skip
No
DISKS
plugin
;
}
install
plugin
DISKS
soname
'disks'
;
show
create
table
information_schema
.
disks
;
select
sum
(
Total
)
>
sum
(
Available
),
sum
(
Total
)
>
sum
(
Used
)
from
information_schema
.
disks
;
uninstall
plugin
DISKS
;
mysql-test/t/having.test
View file @
3d7915f0
...
...
@@ -759,6 +759,24 @@ SELECT * FROM t1 JOIN t2 ON c1 = c2 HAVING c2 > 'a' ORDER BY c2 LIMIT 1;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# MDEV-6736: Valgrind warnings 'Invalid read' in subselect_engine::calc_const_tables with SQ
--
echo
# in WHERE and HAVING, ORDER BY, materialization+semijoin
--
echo
#
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
3
),(
8
);
CREATE
TABLE
t2
(
b
INT
)
ENGINE
=
MyISAM
;
INSERT
INTO
t2
VALUES
(
2
),(
1
);
SELECT
a
FROM
t1
WHERE
9
IN
(
SELECT
MIN
(
a
)
FROM
t1
)
HAVING
a
<>
(
SELECT
COUNT
(
*
)
FROM
t2
)
ORDER
BY
a
;
DROP
TABLE
t1
,
t2
;
--
echo
End
of
10.0
tests
--
echo
#
...
...
plugin/information_schema_disks/CMakeLists.txt
0 → 100644
View file @
3d7915f0
IF
(
NOT WIN32
)
INCLUDE_DIRECTORIES
(
${
CMAKE_SOURCE_DIR
}
/sql
)
MYSQL_ADD_PLUGIN
(
DISKS information_schema_disks.cc MODULE_ONLY RECOMPILE_FOR_EMBEDDED
)
ENDIF
()
plugin/information_schema_disks/README.txt
0 → 100644
View file @
3d7915f0
Information Schema Disks
------------------------
This is a proof-of-concept information schema plugin that allows the
disk space situation to be monitored. When installed, it can be used
as follows:
> select * from information_schema.disks;
+-----------+-----------------------+-----------+----------+-----------+
| Disk | Path | Total | Used | Available |
+-----------+-----------------------+-----------+----------+-----------+
| /dev/sda3 | / | 47929956 | 30666304 | 14805864 |
| /dev/sda1 | /boot/efi | 191551 | 3461 | 188090 |
| /dev/sda4 | /home | 174679768 | 80335392 | 85448120 |
| /dev/sdb1 | /mnt/hdd | 961301832 | 83764 | 912363644 |
| /dev/sdb1 | /home/wikman/Music | 961301832 | 83764 | 912363644 |
| /dev/sdb1 | /home/wikman/Videos | 961301832 | 83764 | 912363644 |
| /dev/sdb1 | /home/wikman/hdd | 961301832 | 83764 | 912363644 |
| /dev/sdb1 | /home/wikman/Pictures | 961301832 | 83764 | 912363644 |
| /dev/sda3 | /var/lib/docker/aufs | 47929956 | 30666304 | 14805864 |
+-----------+-----------------------+-----------+----------+-----------+
9 rows in set (0.00 sec)
- 'Disk' is the name of the disk itself.
- 'Path' is the mount point of the disk.
- 'Total' is the total space in KiB.
- 'Used' is the used amount of space in KiB, and
- 'Available' is the amount of space in KiB available to non-root users.
Note that as the amount of space available to root may be more that what
is available to non-root users, 'available' + 'used' may be less than 'total'.
All paths to which a particular disk has been mounted are reported. The
rationale is that someone might want to take different action e.g. depending
on which disk is relevant for a particular path. This leads to the same disk
being reported multiple times. An alternative to this would be to have two
tables; disks and mounts.
> select * from information_schema.disks;
+-----------+-----------+----------+-----------+
| Disk | Total | Used | Available |
+-----------+-----------+----------+-----------+
| /dev/sda3 | 47929956 | 30666304 | 14805864 |
| /dev/sda1 | 191551 | 3461 | 188090 |
| /dev/sda4 | 174679768 | 80335392 | 85448120 |
| /dev/sdb1 | 961301832 | 83764 | 912363644 |
+-----------+-----------+----------+-----------+
> select * from information_schema.mounts;
+-----------------------+-----------+
| Path | Disk |
+-----------------------+-----------+
| / | /dev/sda3 |
| /boot/efi | /dev/sda1 |
| /home | /dev/sda4 |
| /mnt/hdd | /dev/sdb1 |
| /home/wikman/Music | /dev/sdb1 |
...
Building
--------
- Ensure that the directory information_schema_disks is in the top-level
directory of the server.
- Add
ADD_SUBDIRECTORY(information_schema_disks)
to the top-level CMakeLists.txt
> Invoke make
$ make
Installation
------------
- Copy information_schema_disks/libinformation_schema_disks.so to the plugin
directory of the server:
$ cd information_schema_disks
$ sudo cp libinformation_schema_disks.so plugin-directory-of-server
- Using mysql, install the plugin:
MariaDB [(none)]> install plugin disks soname 'libinformation_schema_disks.so';
Usage
-----
The plugin appears as the table 'disks' in 'information_schema'.
MariaDB [(none)]> select * from information_schema.disks;
+-----------+-----------------------+-----------+----------+-----------+
| Disk | Path | Total | Used | Available |
+-----------+-----------------------+-----------+----------+-----------+
| /dev/sda3 | / | 47929956 | 30666308 | 14805860 |
| /dev/sda1 | /boot/efi | 191551 | 3461 | 188090 |
| /dev/sda4 | /home | 174679768 | 80348148 | 85435364 |
| /dev/sdb1 | /mnt/hdd | 961301832 | 83764 | 912363644 |
| /dev/sdb1 | /home/wikman/Music | 961301832 | 83764 | 912363644 |
| /dev/sdb1 | /home/wikman/Videos | 961301832 | 83764 | 912363644 |
...
plugin/information_schema_disks/information_schema_disks.cc
0 → 100644
View file @
3d7915f0
/*
Copyright (c) 2017, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
#include <sys/statvfs.h>
#include <sys/types.h>
#include <mntent.h>
#include <sql_class.h>
#include <table.h>
#include <innodb_priv.h>
namespace
{
struct
st_mysql_information_schema
disks_table_info
=
{
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
};
ST_FIELD_INFO
disks_table_fields
[]
=
{
{
"Disk"
,
PATH_MAX
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
},
{
"Path"
,
PATH_MAX
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
},
{
"Total"
,
32
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
},
// Total amount available
{
"Used"
,
32
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
},
// Amount of space used
{
"Available"
,
32
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
},
// Amount available to users other than root.
{
0
,
0
,
MYSQL_TYPE_NULL
,
0
,
0
,
0
,
0
}
};
int
disks_table_add_row
(
THD
*
pThd
,
TABLE
*
pTable
,
const
char
*
zDisk
,
const
char
*
zPath
,
const
struct
statvfs
&
info
)
{
// From: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/statvfs.h.html
//
// f_frsize Fundamental file system block size.
// f_blocks Total number of blocks on file system in units of f_frsize.
// f_bfree Total number of free blocks.
// f_bavail Number of free blocks available to non-privileged process.
size_t
total
=
(
info
.
f_frsize
*
info
.
f_blocks
)
/
1024
;
size_t
used
=
(
info
.
f_frsize
*
(
info
.
f_blocks
-
info
.
f_bfree
))
/
1024
;
size_t
avail
=
(
info
.
f_frsize
*
info
.
f_bavail
)
/
1024
;
pTable
->
field
[
0
]
->
store
(
zDisk
,
strlen
(
zDisk
),
system_charset_info
);
pTable
->
field
[
1
]
->
store
(
zPath
,
strlen
(
zPath
),
system_charset_info
);
pTable
->
field
[
2
]
->
store
(
total
);
pTable
->
field
[
3
]
->
store
(
used
);
pTable
->
field
[
4
]
->
store
(
avail
);
// 0 means success.
return
(
schema_table_store_record
(
pThd
,
pTable
)
!=
0
)
?
1
:
0
;
}
int
disks_table_add_row
(
THD
*
pThd
,
TABLE
*
pTable
,
const
char
*
zDisk
,
const
char
*
zPath
)
{
int
rv
=
0
;
struct
statvfs
info
;
if
(
statvfs
(
zPath
,
&
info
)
==
0
)
// We ignore failures.
{
rv
=
disks_table_add_row
(
pThd
,
pTable
,
zDisk
,
zPath
,
info
);
}
return
rv
;
}
int
disks_fill_table
(
THD
*
pThd
,
TABLE_LIST
*
pTables
,
Item
*
pCond
)
{
int
rv
=
1
;
TABLE
*
pTable
=
pTables
->
table
;
FILE
*
pFile
=
setmntent
(
"/etc/mtab"
,
"r"
);
if
(
pFile
)
{
const
size_t
BUFFER_SIZE
=
4096
;
// 4K should be sufficient.
char
*
pBuffer
=
new
(
std
::
nothrow
)
char
[
BUFFER_SIZE
];
if
(
pBuffer
)
{
rv
=
0
;
struct
mntent
ent
;
struct
mntent
*
pEnt
;
while
((
rv
==
0
)
&&
(
pEnt
=
getmntent_r
(
pFile
,
&
ent
,
pBuffer
,
BUFFER_SIZE
)))
{
// We only report the ones that refer to physical disks.
if
(
pEnt
->
mnt_fsname
[
0
]
==
'/'
)
{
rv
=
disks_table_add_row
(
pThd
,
pTable
,
pEnt
->
mnt_fsname
,
pEnt
->
mnt_dir
);
}
}
delete
[]
pBuffer
;
}
else
{
rv
=
1
;
}
endmntent
(
pFile
);
}
return
rv
;
}
int
disks_table_init
(
void
*
ptr
)
{
ST_SCHEMA_TABLE
*
pSchema_table
=
(
ST_SCHEMA_TABLE
*
)
ptr
;
pSchema_table
->
fields_info
=
disks_table_fields
;
pSchema_table
->
fill_table
=
disks_fill_table
;
return
0
;
}
}
extern
"C"
{
mysql_declare_plugin
(
disks_library
)
{
MYSQL_INFORMATION_SCHEMA_PLUGIN
,
&
disks_table_info
,
/* type-specific descriptor */
"DISKS"
,
/* table name */
"MariaDB"
,
/* author */
"Disk space information"
,
/* description */
PLUGIN_LICENSE_GPL
,
/* license type */
disks_table_init
,
/* init function */
NULL
,
0x0100
,
/* version = 1.0 */
NULL
,
/* no status variables */
NULL
,
/* no system variables */
NULL
,
/* no reserved information */
0
/* no flags */
}
mysql_declare_plugin_end
;
}
storage/innobase/fil/fil0fil.cc
View file @
3d7915f0
This diff is collapsed.
Click to expand it.
storage/innobase/include/fil0fil.h
View file @
3d7915f0
...
...
@@ -1391,90 +1391,6 @@ fil_delete_file(
/*============*/
const
char
*
path
);
/*!< in: filepath of the ibd tablespace */
/** Callback functor. */
struct
PageCallback
{
/** Default constructor */
PageCallback
()
:
m_page_size
(
0
,
0
,
false
),
m_filepath
()
UNIV_NOTHROW
{}
virtual
~
PageCallback
()
UNIV_NOTHROW
{}
/** Called for page 0 in the tablespace file at the start.
@param file_size size of the file in bytes
@param block contents of the first page in the tablespace file
@retval DB_SUCCESS or error code. */
virtual
dberr_t
init
(
os_offset_t
file_size
,
const
buf_block_t
*
block
)
UNIV_NOTHROW
=
0
;
/** Called for every page in the tablespace. If the page was not
updated then its state must be set to BUF_PAGE_NOT_USED. For
compressed tables the page descriptor memory will be at offset:
block->frame + UNIV_PAGE_SIZE;
@param offset physical offset within the file
@param block block read from file, note it is not from the buffer pool
@retval DB_SUCCESS or error code. */
virtual
dberr_t
operator
()(
os_offset_t
offset
,
buf_block_t
*
block
)
UNIV_NOTHROW
=
0
;
/** Set the name of the physical file and the file handle that is used
to open it for the file that is being iterated over.
@param filename the name of the tablespace file
@param file OS file handle */
void
set_file
(
const
char
*
filename
,
pfs_os_file_t
file
)
UNIV_NOTHROW
{
m_file
=
file
;
m_filepath
=
filename
;
}
/**
@return the space id of the tablespace */
virtual
ulint
get_space_id
()
const
UNIV_NOTHROW
=
0
;
/**
@retval the space flags of the tablespace being iterated over */
virtual
ulint
get_space_flags
()
const
UNIV_NOTHROW
=
0
;
/** The compressed page size
@return the compressed page size */
const
page_size_t
&
get_page_size
()
const
{
return
(
m_page_size
);
}
/** The tablespace page size. */
page_size_t
m_page_size
;
/** File handle to the tablespace */
pfs_os_file_t
m_file
;
/** Physical file path. */
const
char
*
m_filepath
;
protected:
// Disable copying
PageCallback
(
const
PageCallback
&
);
PageCallback
&
operator
=
(
const
PageCallback
&
);
};
/********************************************************************//**
Iterate over all the pages in the tablespace.
@param table the table definiton in the server
@param n_io_buffers number of blocks to read and write together
@param callback functor that will do the page updates
@return DB_SUCCESS or error code */
dberr_t
fil_tablespace_iterate
(
/*===================*/
dict_table_t
*
table
,
ulint
n_io_buffers
,
PageCallback
&
callback
)
MY_ATTRIBUTE
((
warn_unused_result
));
/********************************************************************//**
Looks for a pre-existing fil_space_t with the given tablespace ID
and, if found, returns the name and filepath in newly allocated buffers that the caller must free.
...
...
storage/innobase/mem/mem0mem.cc
View file @
3d7915f0
...
...
@@ -348,6 +348,11 @@ mem_heap_create_block_func(
heap
->
total_size
+=
len
;
}
/* Poison all available memory. Individual chunks will be unpoisoned on
every mem_heap_alloc() call. */
compile_time_assert
(
MEM_BLOCK_HEADER_SIZE
>=
sizeof
*
block
);
UNIV_MEM_FREE
(
block
+
1
,
len
-
sizeof
*
block
);
ut_ad
((
ulint
)
MEM_BLOCK_HEADER_SIZE
<
len
);
return
(
block
);
...
...
storage/innobase/os/os0file.cc
View file @
3d7915f0
...
...
@@ -701,28 +701,50 @@ static
bool
os_aio_validate
();
/** Handle errors for file operations.
@param[in] name name of a file or NULL
@param[in] operation operation
@param[in] should_abort whether to abort on an unknown error
@param[in] on_error_silent whether to suppress reports of non-fatal errors
@return true if we should retry the operation */
static
MY_ATTRIBUTE
((
warn_unused_result
))
bool
os_file_handle_error_cond_exit
(
const
char
*
name
,
const
char
*
operation
,
bool
should_abort
,
bool
on_error_silent
);
/** Does error handling when a file operation fails.
@param[in] name
File nam
e or NULL
@param[in] operation
Name of operation e.g., "read", "write"
@param[in] name
name of a fil
e or NULL
@param[in] operation
operation name that failed
@return true if we should retry the operation */
static
bool
os_file_handle_error
(
const
char
*
name
,
const
char
*
operation
);
const
char
*
operation
)
{
/* Exit in case of unknown error */
return
(
os_file_handle_error_cond_exit
(
name
,
operation
,
true
,
false
));
}
/**
Does error handling when a file operation fails.
@param[in] name File name or NULL
@param[in] operation Name of operation e.g., "read", "write"
@param[in] silent if true then don't print any message to the log.
/** Does error handling when a file operation fails.
@param[in] name name of a file or NULL
@param[in] operation operation name that failed
@param[in] on_error_silent if true then don't print any message to the log.
@return true if we should retry the operation */
static
bool
os_file_handle_error_no_exit
(
const
char
*
name
,
const
char
*
operation
,
bool
silent
);
bool
on_error_silent
)
{
/* Don't exit in case of unknown error */
return
(
os_file_handle_error_cond_exit
(
name
,
operation
,
false
,
on_error_silent
));
}
/** Does simulated AIO. This function should be called by an i/o-handler
thread.
...
...
@@ -5077,52 +5099,31 @@ os_file_read_page(
ut_ad
(
type
.
validate
());
ut_ad
(
n
>
0
);
for
(;;)
{
ssize_t
n_bytes
;
n_bytes
=
os_file_pread
(
type
,
file
,
buf
,
n
,
offset
,
&
err
);
if
(
o
!=
NULL
)
{
*
o
=
n_bytes
;
}
if
(
err
!=
DB_SUCCESS
&&
!
exit_on_err
)
{
return
(
err
);
}
else
if
((
ulint
)
n_bytes
==
n
)
{
return
(
DB_SUCCESS
);
}
ib
::
error
()
<<
"Tried to read "
<<
n
<<
" bytes at offset "
<<
offset
<<
", but was only able to read "
<<
n_bytes
;
if
(
exit_on_err
)
{
ssize_t
n_bytes
=
os_file_pread
(
type
,
file
,
buf
,
n
,
offset
,
&
err
);
if
(
!
os_file_handle_error
(
NULL
,
"read"
))
{
/* Hard error */
break
;
}
if
(
o
)
{
*
o
=
n_bytes
;
}
}
else
if
(
!
os_file_handle_error_no_exit
(
NULL
,
"read"
,
false
))
{
if
(
ulint
(
n_bytes
)
==
n
||
(
err
!=
DB_SUCCESS
&&
!
exit_on_err
))
{
return
err
;
}
/* Hard error */
break
;
}
ib
::
error
()
<<
"Tried to read "
<<
n
<<
" bytes at offset "
<<
offset
<<
", but was only able to read "
<<
n_bytes
;
if
(
n_bytes
>
0
&&
(
ulint
)
n_bytes
<
n
)
{
n
-=
(
ulint
)
n_bytes
;
offset
+=
(
ulint
)
n_bytes
;
buf
=
reinterpret_cast
<
uchar
*>
(
buf
)
+
(
ulint
)
n_bytes
;
}
if
(
!
os_file_handle_error_cond_exit
(
NULL
,
"read"
,
exit_on_err
,
false
))
{
ib
::
fatal
()
<<
"Cannot read from file. OS error number "
<<
errno
<<
"."
;
}
i
b
::
fatal
()
<<
"Cannot read from file. OS error number "
<<
errno
<<
"."
;
i
f
(
err
==
DB_SUCCESS
)
{
err
=
DB_IO_ERROR
;
}
return
(
err
)
;
return
err
;
}
/** Retrieves the last error number if an error occurs in a file io function.
...
...
@@ -5228,37 +5229,6 @@ os_file_handle_error_cond_exit(
return
(
false
);
}
/** Does error handling when a file operation fails.
@param[in] name name of a file or NULL
@param[in] operation operation name that failed
@return true if we should retry the operation */
static
bool
os_file_handle_error
(
const
char
*
name
,
const
char
*
operation
)
{
/* Exit in case of unknown error */
return
(
os_file_handle_error_cond_exit
(
name
,
operation
,
true
,
false
));
}
/** Does error handling when a file operation fails.
@param[in] name name of a file or NULL
@param[in] operation operation name that failed
@param[in] on_error_silent if true then don't print any message to the log.
@return true if we should retry the operation */
static
bool
os_file_handle_error_no_exit
(
const
char
*
name
,
const
char
*
operation
,
bool
on_error_silent
)
{
/* Don't exit in case of unknown error */
return
(
os_file_handle_error_cond_exit
(
name
,
operation
,
false
,
on_error_silent
));
}
#ifndef _WIN32
/** Tries to disable OS caching on an opened file descriptor.
@param[in] fd file descriptor to alter
...
...
storage/innobase/row/row0import.cc
View file @
3d7915f0
This diff is collapsed.
Click to expand it.
storage/xtradb/fil/fil0fil.cc
View file @
3d7915f0
This diff is collapsed.
Click to expand it.
storage/xtradb/include/fil0fil.h
View file @
3d7915f0
...
...
@@ -1309,107 +1309,6 @@ fil_delete_file(
/*============*/
const
char
*
path
);
/*!< in: filepath of the ibd tablespace */
/** Callback functor. */
struct
PageCallback
{
/**
Default constructor */
PageCallback
()
:
m_zip_size
(),
m_page_size
(),
m_filepath
()
UNIV_NOTHROW
{}
virtual
~
PageCallback
()
UNIV_NOTHROW
{}
/**
Called for page 0 in the tablespace file at the start.
@param file_size - size of the file in bytes
@param block - contents of the first page in the tablespace file
@retval DB_SUCCESS or error code.*/
virtual
dberr_t
init
(
os_offset_t
file_size
,
const
buf_block_t
*
block
)
UNIV_NOTHROW
=
0
;
/**
Called for every page in the tablespace. If the page was not
updated then its state must be set to BUF_PAGE_NOT_USED. For
compressed tables the page descriptor memory will be at offset:
block->frame + UNIV_PAGE_SIZE;
@param offset - physical offset within the file
@param block - block read from file, note it is not from the buffer pool
@retval DB_SUCCESS or error code. */
virtual
dberr_t
operator
()(
os_offset_t
offset
,
buf_block_t
*
block
)
UNIV_NOTHROW
=
0
;
/**
Set the name of the physical file and the file handle that is used
to open it for the file that is being iterated over.
@param filename - then physical name of the tablespace file.
@param file - OS file handle */
void
set_file
(
const
char
*
filename
,
pfs_os_file_t
file
)
UNIV_NOTHROW
{
m_file
=
file
;
m_filepath
=
filename
;
}
/**
@return the space id of the tablespace */
virtual
ulint
get_space_id
()
const
UNIV_NOTHROW
=
0
;
/** The compressed page size
@return the compressed page size */
ulint
get_zip_size
()
const
{
return
(
m_zip_size
);
}
/**
Set the tablespace compressed table size.
@return DB_SUCCESS if it is valie or DB_CORRUPTION if not */
dberr_t
set_zip_size
(
const
buf_frame_t
*
page
)
UNIV_NOTHROW
;
/** The compressed page size
@return the compressed page size */
ulint
get_page_size
()
const
{
return
(
m_page_size
);
}
/** Compressed table page size */
ulint
m_zip_size
;
/** The tablespace page size. */
ulint
m_page_size
;
/** File handle to the tablespace */
pfs_os_file_t
m_file
;
/** Physical file path. */
const
char
*
m_filepath
;
protected:
// Disable copying
PageCallback
(
const
PageCallback
&
);
PageCallback
&
operator
=
(
const
PageCallback
&
);
};
/********************************************************************//**
Iterate over all the pages in the tablespace.
@param table - the table definiton in the server
@param n_io_buffers - number of blocks to read and write together
@param callback - functor that will do the page updates
@return DB_SUCCESS or error code */
UNIV_INTERN
dberr_t
fil_tablespace_iterate
(
/*===================*/
dict_table_t
*
table
,
ulint
n_io_buffers
,
PageCallback
&
callback
)
MY_ATTRIBUTE
((
nonnull
,
warn_unused_result
));
/*******************************************************************//**
Checks if a single-table tablespace for a given table name exists in the
tablespace memory cache.
...
...
storage/xtradb/mem/mem0mem.cc
View file @
3d7915f0
...
...
@@ -406,6 +406,11 @@ mem_heap_create_block_func(
heap
->
total_size
+=
len
;
}
/* Poison all available memory. Individual chunks will be unpoisoned on
every mem_heap_alloc() call. */
compile_time_assert
(
MEM_BLOCK_HEADER_SIZE
>=
sizeof
*
block
);
UNIV_MEM_FREE
(
block
+
1
,
len
-
sizeof
*
block
);
ut_ad
((
ulint
)
MEM_BLOCK_HEADER_SIZE
<
len
);
return
(
block
);
...
...
storage/xtradb/os/os0file.cc
View file @
3d7915f0
...
...
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 201
7
, MariaDB Corporation.
Copyright (c) 2013, 201
8
, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
...
...
@@ -3169,15 +3169,21 @@ os_file_read_func(
overlapped
.
hEvent
=
win_get_syncio_event
();
ret
=
ReadFile
(
file
,
buf
,
n
,
NULL
,
&
overlapped
);
if
(
ret
)
{
ret
=
GetOverlappedResult
(
file
,
&
overlapped
,
(
DWORD
*
)
&
len
,
FALSE
);
}
else
if
(
GetLastError
()
==
ERROR_IO_PENDING
)
{
ret
=
GetOverlappedResult
(
file
,
&
overlapped
,
(
DWORD
*
)
&
len
,
TRUE
);
ret
=
GetOverlappedResult
(
file
,
&
overlapped
,
&
len
,
FALSE
);
}
else
if
(
GetLastError
()
==
ERROR_IO_PENDING
)
{
ret
=
GetOverlappedResult
(
file
,
&
overlapped
,
&
len
,
TRUE
);
}
MONITOR_ATOMIC_DEC_LOW
(
MONITOR_OS_PENDING_READS
,
monitor
);
if
(
ret
&&
len
==
n
)
{
if
(
!
ret
)
{
}
else
if
(
len
==
n
)
{
return
(
TRUE
);
}
else
{
ib_logf
(
IB_LOG_LEVEL_ERROR
,
"Tried to read "
ULINTPF
" bytes at offset "
UINT64PF
". Was only able to read %lu."
,
n
,
offset
,
ret
);
return
FALSE
;
}
#else
/* __WIN__ */
ibool
retry
;
...
...
@@ -3204,6 +3210,7 @@ os_file_read_func(
"Tried to read "
ULINTPF
" bytes at offset "
UINT64PF
". Was only able to read %ld."
,
n
,
offset
,
(
lint
)
ret
);
return
FALSE
;
}
#endif
/* __WIN__ */
retry
=
os_file_handle_error
(
NULL
,
"read"
,
__FILE__
,
__LINE__
);
...
...
@@ -3272,15 +3279,21 @@ os_file_read_no_error_handling_func(
overlapped
.
hEvent
=
win_get_syncio_event
();
ret
=
ReadFile
(
file
,
buf
,
n
,
NULL
,
&
overlapped
);
if
(
ret
)
{
ret
=
GetOverlappedResult
(
file
,
&
overlapped
,
(
DWORD
*
)
&
len
,
FALSE
);
}
else
if
(
GetLastError
()
==
ERROR_IO_PENDING
)
{
ret
=
GetOverlappedResult
(
file
,
&
overlapped
,
(
DWORD
*
)
&
len
,
TRUE
);
ret
=
GetOverlappedResult
(
file
,
&
overlapped
,
&
len
,
FALSE
);
}
else
if
(
GetLastError
()
==
ERROR_IO_PENDING
)
{
ret
=
GetOverlappedResult
(
file
,
&
overlapped
,
&
len
,
TRUE
);
}
MONITOR_ATOMIC_DEC_LOW
(
MONITOR_OS_PENDING_READS
,
monitor
);
if
(
ret
&&
len
==
n
)
{
if
(
!
ret
)
{
}
else
if
(
len
==
n
)
{
return
(
TRUE
);
}
else
{
ib_logf
(
IB_LOG_LEVEL_ERROR
,
"Tried to read "
ULINTPF
" bytes at offset "
UINT64PF
". Was only able to read %lu."
,
n
,
offset
,
len
);
return
FALSE
;
}
#else
/* __WIN__ */
ibool
retry
;
...
...
@@ -3303,6 +3316,7 @@ os_file_read_no_error_handling_func(
"Tried to read "
ULINTPF
" bytes at offset "
UINT64PF
". Was only able to read %ld."
,
n
,
offset
,
(
lint
)
ret
);
return
FALSE
;
}
#endif
/* __WIN__ */
retry
=
os_file_handle_error_no_exit
(
NULL
,
"read"
,
FALSE
,
__FILE__
,
__LINE__
);
...
...
@@ -3383,10 +3397,9 @@ os_file_write_func(
overlapped
.
hEvent
=
win_get_syncio_event
();
ret
=
WriteFile
(
file
,
buf
,
n
,
NULL
,
&
overlapped
);
if
(
ret
)
{
ret
=
GetOverlappedResult
(
file
,
&
overlapped
,
(
DWORD
*
)
&
len
,
FALSE
);
}
else
if
(
GetLastError
()
==
ERROR_IO_PENDING
)
{
ret
=
GetOverlappedResult
(
file
,
&
overlapped
,
(
DWORD
*
)
&
len
,
TRUE
);
ret
=
GetOverlappedResult
(
file
,
&
overlapped
,
&
len
,
FALSE
);
}
else
if
(
GetLastError
()
==
ERROR_IO_PENDING
)
{
ret
=
GetOverlappedResult
(
file
,
&
overlapped
,
&
len
,
TRUE
);
}
MONITOR_ATOMIC_DEC_LOW
(
MONITOR_OS_PENDING_WRITES
,
monitor
);
...
...
@@ -6588,8 +6601,7 @@ os_file_trim(
DWORD
tmp
;
if
(
ret
)
{
ret
=
GetOverlappedResult
(
slot
->
file
,
&
overlapped
,
&
tmp
,
FALSE
);
}
else
if
(
GetLastError
()
==
ERROR_IO_PENDING
)
{
}
else
if
(
GetLastError
()
==
ERROR_IO_PENDING
)
{
ret
=
GetOverlappedResult
(
slot
->
file
,
&
overlapped
,
&
tmp
,
TRUE
);
}
if
(
!
ret
)
{
...
...
storage/xtradb/row/row0import.cc
View file @
3d7915f0
This diff is collapsed.
Click to expand it.
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