summaryrefslogtreecommitdiff
path: root/storage/csv
diff options
context:
space:
mode:
authorunknown <petr@mysql.com>2006-05-20 02:41:30 +0400
committerunknown <petr@mysql.com>2006-05-20 02:41:30 +0400
commit2b546d8ccc44558caeea20b1714b9bae100c4506 (patch)
tree97b5cf338bd7266a77f726c6f360c4e9fc587a65 /storage/csv
parent96ceaeb5442b864227a2590fd8857d94484e50ec (diff)
downloadmariadb-git-2b546d8ccc44558caeea20b1714b9bae100c4506.tar.gz
WL#3244 "CSV engine: convert mmap to read/write calls"
post-review fixes storage/csv/ha_tina.cc: post-review fixes storage/csv/ha_tina.h: post-review fixes
Diffstat (limited to 'storage/csv')
-rw-r--r--storage/csv/ha_tina.cc12
-rw-r--r--storage/csv/ha_tina.h10
2 files changed, 10 insertions, 12 deletions
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index 409364f59c6..eaabea2454d 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -282,8 +282,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
share->crashed= TRUE;
/*
- After we read, we set the file to dirty. When we close, we will do the
- opposite. If the meta file will not open we assume it is crashed and
+ If the meta file will not open we assume it is crashed and
mark it as such.
*/
if (read_meta_file(share->meta_file, &share->rows_recorded))
@@ -524,6 +523,7 @@ ha_tina::ha_tina(TABLE_SHARE *table_arg)
/* Set our original buffers from pre-allocated memory */
buffer.set((char*)byte_buffer, IO_SIZE, system_charset_info);
chain= chain_buffer;
+ file_buff= new Transparent_file();
}
@@ -857,8 +857,6 @@ int ha_tina::open(const char *name, int mode, uint open_options)
if ((data_file= my_open(share->data_file_name, O_RDONLY, MYF(0))) == -1)
DBUG_RETURN(0);
- file_buff= new Transparent_file(data_file);
-
/*
Init locking. Pass handler object to the locking routines,
so that they could save/update local_saved_data_file_length value
@@ -1268,6 +1266,12 @@ int ha_tina::rnd_end()
if (((data_file= my_open(share->data_file_name, O_RDONLY, MYF(0))) == -1)
|| my_sync(data_file, MYF(MY_WME)))
DBUG_RETURN(-1);
+ /*
+ The datafile is consistent at this point and the write filedes is
+ closed, so nothing worrying will happen to it in case of a crash.
+ Here we record this fact to the meta-file.
+ */
+ (void)write_meta_file(share->meta_file, share->rows_recorded, FALSE);
}
DBUG_RETURN(0);
diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h
index eb30f150bbe..df5e4143a5c 100644
--- a/storage/csv/ha_tina.h
+++ b/storage/csv/ha_tina.h
@@ -19,7 +19,6 @@
#include <my_dir.h>
#define DEFAULT_CHAIN_LENGTH 512
-#define DEFAULT_FILE_WINDOW_SIZE 4096
/*
Version for file format.
1 - Initial Version. That is, the version when the metafile was introduced.
@@ -68,13 +67,8 @@ class Transparent_file
public:
- Transparent_file(File filedes_arg) : lower_bound(0),
- buff_size(DEFAULT_FILE_WINDOW_SIZE)
- {
- buff= (byte *) my_malloc(buff_size*sizeof(byte), MYF(MY_WME));
- /* read the beginning of the file */
- init_buff(filedes_arg);
- }
+ Transparent_file() : lower_bound(0), buff_size(IO_SIZE)
+ { buff= (byte *) my_malloc(buff_size*sizeof(byte), MYF(MY_WME)); }
~Transparent_file()
{ my_free(buff, MYF(MY_ALLOW_ZERO_PTR)); }