summaryrefslogtreecommitdiff
path: root/storage/archive
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-10-19 20:38:59 +0200
committerSergei Golubchik <sergii@pisem.net>2012-10-19 20:38:59 +0200
commite1f681c99b3e5462c033aaafa94ac295e626cde2 (patch)
tree2da5eff1a0d03831c2d85b32a7bc3df6ec37b522 /storage/archive
parent52c84d144d3b07966d9b3bab8694eb012eef69ce (diff)
parent807fef40fffbbb8e92564a52b902b504ba8cfcdc (diff)
downloadmariadb-git-e1f681c99b3e5462c033aaafa94ac295e626cde2.tar.gz
10.0-base -> 10.0-monty
Diffstat (limited to 'storage/archive')
-rw-r--r--storage/archive/azio.c27
-rw-r--r--storage/archive/ha_archive.cc27
2 files changed, 38 insertions, 16 deletions
diff --git a/storage/archive/azio.c b/storage/archive/azio.c
index 8fc85965cf0..92d7ad70344 100644
--- a/storage/archive/azio.c
+++ b/storage/archive/azio.c
@@ -39,6 +39,10 @@ void putLong(File file, uLong x);
uLong getLong(azio_stream *s);
void read_header(azio_stream *s, unsigned char *buffer);
+#ifdef HAVE_PSI_INTERFACE
+extern PSI_file_key arch_key_file_data;
+#endif
+
/* ===========================================================================
Opens a gzip (.gz) file for reading or writing. The mode parameter
is as in fopen ("rb" or "wb"). The file is given either by file descriptor
@@ -115,7 +119,7 @@ int az_open (azio_stream *s, const char *path, int Flags, File fd)
s->stream.avail_out = AZ_BUFSIZE_WRITE;
errno = 0;
- s->file = fd < 0 ? my_open(path, Flags, MYF(0)) : fd;
+ s->file = fd < 0 ? mysql_file_open(arch_key_file_data, path, Flags, MYF(0)) : fd;
DBUG_EXECUTE_IF("simulate_archive_open_failure",
{
if (s->file >= 0)
@@ -248,8 +252,8 @@ int get_byte(s)
if (s->stream.avail_in == 0)
{
errno = 0;
- s->stream.avail_in= (uInt) my_read(s->file, (uchar *)s->inbuf,
- AZ_BUFSIZE_READ, MYF(0));
+ s->stream.avail_in= (uInt) mysql_file_read(s->file, (uchar *)s->inbuf,
+ AZ_BUFSIZE_READ, MYF(0));
if (s->stream.avail_in == 0)
{
s->z_eof = 1;
@@ -290,7 +294,8 @@ void check_header(azio_stream *s)
if (len < 2) {
if (len) s->inbuf[0] = s->stream.next_in[0];
errno = 0;
- len = (uInt)my_read(s->file, (uchar *)s->inbuf + len, AZ_BUFSIZE_READ >> len, MYF(0));
+ len = (uInt)mysql_file_read(s->file, (uchar *)s->inbuf + len,
+ AZ_BUFSIZE_READ >> len, MYF(0));
if (len == (uInt)-1) s->z_err = Z_ERRNO;
s->stream.avail_in += len;
s->stream.next_in = s->inbuf;
@@ -481,7 +486,8 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, size_t len, int *error)
if (s->stream.avail_out > 0)
{
s->stream.avail_out -=
- (uInt)my_read(s->file, (uchar *)next_out, s->stream.avail_out, MYF(0));
+ (uInt)mysql_file_read(s->file, (uchar *)next_out,
+ s->stream.avail_out, MYF(0));
}
len -= s->stream.avail_out;
s->in += len;
@@ -494,7 +500,8 @@ unsigned int ZEXPORT azread ( azio_stream *s, voidp buf, size_t len, int *error)
if (s->stream.avail_in == 0 && !s->z_eof) {
errno = 0;
- s->stream.avail_in = (uInt)my_read(s->file, (uchar *)s->inbuf, AZ_BUFSIZE_READ, MYF(0));
+ s->stream.avail_in = (uInt)mysql_file_read(s->file, (uchar *)s->inbuf,
+ AZ_BUFSIZE_READ, MYF(0));
if (s->stream.avail_in == 0)
{
s->z_eof = 1;
@@ -561,8 +568,8 @@ unsigned int azwrite (azio_stream *s, const voidp buf, unsigned int len)
{
s->stream.next_out = s->outbuf;
- if (my_write(s->file, (uchar *)s->outbuf, AZ_BUFSIZE_WRITE,
- MYF(0)) != AZ_BUFSIZE_WRITE)
+ if (mysql_file_write(s->file, (uchar *)s->outbuf, AZ_BUFSIZE_WRITE,
+ MYF(0)) != AZ_BUFSIZE_WRITE)
{
s->z_err = Z_ERRNO;
break;
@@ -609,7 +616,7 @@ int do_flush (azio_stream *s, int flush)
if (len != 0)
{
s->check_point= my_tell(s->file, MYF(0));
- if ((uInt)my_write(s->file, (uchar *)s->outbuf, len, MYF(0)) != len)
+ if ((uInt)mysql_file_write(s->file, (uchar *)s->outbuf, len, MYF(0)) != len)
{
s->z_err = Z_ERRNO;
return Z_ERRNO;
@@ -796,7 +803,7 @@ void putLong (File file, uLong x)
for (n = 0; n < 4; n++)
{
buffer[0]= (int)(x & 0xff);
- my_write(file, buffer, 1, MYF(0));
+ mysql_file_write(file, buffer, 1, MYF(0));
x >>= 8;
}
}
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 430f0373919..8376ebc9826 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -112,6 +112,10 @@ static HASH archive_open_tables;
#define DATA_BUFFER_SIZE 2 // Size of the data used in the data file
#define ARCHIVE_CHECK_HEADER 254 // The number we use to determine corruption
+#ifdef HAVE_PSI_INTERFACE
+extern "C" PSI_file_key arch_key_file_data;
+#endif
+
/* Static declarations for handerton */
static handler *archive_create_handler(handlerton *hton,
TABLE_SHARE *table,
@@ -157,6 +161,14 @@ static PSI_mutex_info all_archive_mutexes[]=
{ &az_key_mutex_ARCHIVE_SHARE_mutex, "ARCHIVE_SHARE::mutex", 0}
};
+PSI_file_key arch_key_file_metadata, arch_key_file_data, arch_key_file_frm;
+static PSI_file_info all_archive_files[]=
+{
+ { &arch_key_file_metadata, "metadata", 0},
+ { &arch_key_file_data, "data", 0},
+ { &arch_key_file_frm, "FRM", 0}
+};
+
static void init_archive_psi_keys(void)
{
const char* category= "archive";
@@ -167,6 +179,9 @@ static void init_archive_psi_keys(void)
count= array_elements(all_archive_mutexes);
PSI_server->register_mutex(category, all_archive_mutexes, count);
+
+ count= array_elements(all_archive_files);
+ PSI_server->register_file(category, all_archive_files, count);
}
#endif /* HAVE_PSI_INTERFACE */
@@ -260,7 +275,7 @@ int archive_discover(handlerton *hton, THD* thd, const char *db,
build_table_filename(az_file, sizeof(az_file) - 1, db, name, ARZ, 0);
- if (!(my_stat(az_file, &file_stat, MYF(0))))
+ if (!(mysql_file_stat(arch_key_file_data, az_file, &file_stat, MYF(0))))
goto err;
if (!(azopen(&frm_stream, az_file, O_RDONLY|O_BINARY)))
@@ -723,7 +738,7 @@ int ha_archive::create(const char *name, TABLE *table_arg,
There is a chance that the file was "discovered". In this case
just use whatever file is there.
*/
- if (!(my_stat(name_buff, &file_stat, MYF(0))))
+ if (!(mysql_file_stat(arch_key_file_data, name_buff, &file_stat, MYF(0))))
{
my_errno= 0;
if (!(azopen(&create_stream, name_buff, O_CREAT|O_RDWR|O_BINARY)))
@@ -740,19 +755,19 @@ int ha_archive::create(const char *name, TABLE *table_arg,
/*
Here is where we open up the frm and pass it to archive to store
*/
- if ((frm_file= my_open(name_buff, O_RDONLY, MYF(0))) > 0)
+ if ((frm_file= mysql_file_open(arch_key_file_frm, name_buff, O_RDONLY, MYF(0))) >= 0)
{
if (!mysql_file_fstat(frm_file, &file_stat, MYF(MY_WME)))
{
frm_ptr= (uchar *)my_malloc(sizeof(uchar) * (size_t)file_stat.st_size, MYF(0));
if (frm_ptr)
{
- my_read(frm_file, frm_ptr, (size_t)file_stat.st_size, MYF(0));
+ mysql_file_read(frm_file, frm_ptr, (size_t)file_stat.st_size, MYF(0));
azwrite_frm(&create_stream, (char *)frm_ptr, (size_t)file_stat.st_size);
my_free(frm_ptr);
}
}
- my_close(frm_file, MYF(0));
+ mysql_file_close(frm_file, MYF(0));
}
if (create_info->comment.str)
@@ -1610,7 +1625,7 @@ int ha_archive::info(uint flag)
{
MY_STAT file_stat; // Stat information for the data file
- (void) my_stat(share->data_file_name, &file_stat, MYF(MY_WME));
+ (void) mysql_file_stat(arch_key_file_data, share->data_file_name, &file_stat, MYF(MY_WME));
if (flag & HA_STATUS_TIME)
stats.update_time= (ulong) file_stat.st_mtime;