diff options
author | Michael Widenius <monty@askmonty.org> | 2012-04-04 00:33:02 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2012-04-04 00:33:02 +0300 |
commit | 24a67aa81699a914d169fc783893c4fb54aa8388 (patch) | |
tree | d77a62199caa59dd03879cb237c7f390d97cb908 /storage/csv | |
parent | 534c2b1205bb9a85b92354dce7bb3e4deddb8c12 (diff) | |
parent | a3bee835eea847b6d5b68897aee63ab9a1a5d6ba (diff) | |
download | mariadb-git-24a67aa81699a914d169fc783893c4fb54aa8388.tar.gz |
Merge with 5.1
Diffstat (limited to 'storage/csv')
-rw-r--r-- | storage/csv/ha_tina.cc | 28 | ||||
-rw-r--r-- | storage/csv/ha_tina.h | 3 |
2 files changed, 20 insertions, 11 deletions
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index f1b081be8d4..26d6e16b9d4 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -854,6 +854,7 @@ int ha_tina::open(const char *name, int mode, uint open_options) */ thr_lock_data_init(&share->lock, &lock, (void*) this); ref_length= sizeof(my_off_t); + init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0); share->lock.get_status= tina_get_status; share->lock.update_status= tina_update_status; @@ -871,6 +872,7 @@ int ha_tina::close(void) { int rc= 0; DBUG_ENTER("ha_tina::close"); + free_root(&blobroot, MYF(0)); rc= my_close(data_file, MYF(0)); DBUG_RETURN(free_share(share) || rc); } @@ -1086,11 +1088,9 @@ int ha_tina::rnd_init(bool scan) current_position= next_position= 0; stats.records= 0; - records_is_known= 0; + records_is_known= found_end_of_file= 0; chain_ptr= chain; - init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0); - DBUG_RETURN(0); } @@ -1122,10 +1122,16 @@ int ha_tina::rnd_next(uchar *buf) /* don't scan an empty file */ if (!local_saved_data_file_length) + { + found_end_of_file= 1; DBUG_RETURN(HA_ERR_END_OF_FILE); - + } if ((rc= find_current_row(buf))) + { + DBUG_PRINT("warning", ("got error %d while reading file", rc)); + found_end_of_file= (rc == HA_ERR_END_OF_FILE); DBUG_RETURN(rc); + } stats.records++; DBUG_RETURN(0); @@ -1220,8 +1226,7 @@ int ha_tina::rnd_end() my_off_t file_buffer_start= 0; DBUG_ENTER("ha_tina::rnd_end"); - free_root(&blobroot, MYF(0)); - records_is_known= 1; + records_is_known= found_end_of_file; if ((chain_ptr - chain) > 0) { @@ -1394,8 +1399,6 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) /* set current position to the beginning of the file */ current_position= next_position= 0; - init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0); - /* Read the file row-by-row. If everything is ok, repair is not needed. */ while (!(rc= find_current_row(buf))) { @@ -1603,8 +1606,6 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt) /* set current position to the beginning of the file */ current_position= next_position= 0; - init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0); - /* Read the file row-by-row. If everything is ok, repair is not needed. */ while (!(rc= find_current_row(buf))) { @@ -1628,6 +1629,13 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt) } +int ha_tina::reset(void) +{ + free_root(&blobroot, MYF(0)); + return 0; +} + + bool ha_tina::check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes) { diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index 54860ecb3fb..a124ea77f3c 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -84,7 +84,7 @@ class ha_tina: public handler uchar chain_alloced; uint32 chain_size; uint local_data_file_version; /* Saved version of the data file used */ - bool records_is_known; + bool records_is_known, found_end_of_file; MEM_ROOT blobroot; private: @@ -156,6 +156,7 @@ public: bool auto_repair() const { return 1; } void position(const uchar *record); int info(uint); + int reset(); int extra(enum ha_extra_function operation); int delete_all_rows(void); int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); |