Commit 2b546d8c authored by unknown's avatar unknown

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
parent 96ceaeb5
...@@ -282,8 +282,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table) ...@@ -282,8 +282,7 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
share->crashed= TRUE; share->crashed= TRUE;
/* /*
After we read, we set the file to dirty. When we close, we will do the If the meta file will not open we assume it is crashed and
opposite. If the meta file will not open we assume it is crashed and
mark it as such. mark it as such.
*/ */
if (read_meta_file(share->meta_file, &share->rows_recorded)) if (read_meta_file(share->meta_file, &share->rows_recorded))
...@@ -524,6 +523,7 @@ ha_tina::ha_tina(TABLE_SHARE *table_arg) ...@@ -524,6 +523,7 @@ ha_tina::ha_tina(TABLE_SHARE *table_arg)
/* Set our original buffers from pre-allocated memory */ /* Set our original buffers from pre-allocated memory */
buffer.set((char*)byte_buffer, IO_SIZE, system_charset_info); buffer.set((char*)byte_buffer, IO_SIZE, system_charset_info);
chain= chain_buffer; chain= chain_buffer;
file_buff= new Transparent_file();
} }
...@@ -857,8 +857,6 @@ int ha_tina::open(const char *name, int mode, uint open_options) ...@@ -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) if ((data_file= my_open(share->data_file_name, O_RDONLY, MYF(0))) == -1)
DBUG_RETURN(0); DBUG_RETURN(0);
file_buff= new Transparent_file(data_file);
/* /*
Init locking. Pass handler object to the locking routines, Init locking. Pass handler object to the locking routines,
so that they could save/update local_saved_data_file_length value so that they could save/update local_saved_data_file_length value
...@@ -1268,6 +1266,12 @@ int ha_tina::rnd_end() ...@@ -1268,6 +1266,12 @@ int ha_tina::rnd_end()
if (((data_file= my_open(share->data_file_name, O_RDONLY, MYF(0))) == -1) if (((data_file= my_open(share->data_file_name, O_RDONLY, MYF(0))) == -1)
|| my_sync(data_file, MYF(MY_WME))) || my_sync(data_file, MYF(MY_WME)))
DBUG_RETURN(-1); 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); DBUG_RETURN(0);
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <my_dir.h> #include <my_dir.h>
#define DEFAULT_CHAIN_LENGTH 512 #define DEFAULT_CHAIN_LENGTH 512
#define DEFAULT_FILE_WINDOW_SIZE 4096
/* /*
Version for file format. Version for file format.
1 - Initial Version. That is, the version when the metafile was introduced. 1 - Initial Version. That is, the version when the metafile was introduced.
...@@ -68,13 +67,8 @@ class Transparent_file ...@@ -68,13 +67,8 @@ class Transparent_file
public: public:
Transparent_file(File filedes_arg) : lower_bound(0), Transparent_file() : lower_bound(0), buff_size(IO_SIZE)
buff_size(DEFAULT_FILE_WINDOW_SIZE) { buff= (byte *) my_malloc(buff_size*sizeof(byte), MYF(MY_WME)); }
{
buff= (byte *) my_malloc(buff_size*sizeof(byte), MYF(MY_WME));
/* read the beginning of the file */
init_buff(filedes_arg);
}
~Transparent_file() ~Transparent_file()
{ my_free(buff, MYF(MY_ALLOW_ZERO_PTR)); } { my_free(buff, MYF(MY_ALLOW_ZERO_PTR)); }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment