Commit 2b546d8c authored by unknown's avatar unknown
Browse files

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
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -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);
+2 −8
Original line number Diff line number Diff line
@@ -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)); }