diff options
-rw-r--r-- | mysql-test/r/csv.result | 13 | ||||
-rw-r--r-- | mysql-test/r/partition_innodb.result | 14 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/r/join_nested.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/r/partition_pruning.result | 38 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/r/partition_range.result | 4 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/r/select.result | 6 | ||||
-rw-r--r-- | mysql-test/suite/pbxt/r/select_found.result | 20 | ||||
-rw-r--r-- | mysql-test/t/csv.test | 15 | ||||
-rw-r--r-- | sql/sql_select.cc | 23 | ||||
-rw-r--r-- | storage/csv/ha_tina.cc | 28 | ||||
-rw-r--r-- | storage/csv/ha_tina.h | 3 |
11 files changed, 101 insertions, 65 deletions
diff --git a/mysql-test/r/csv.result b/mysql-test/r/csv.result index 4c3529fb227..76a8bc06f6d 100644 --- a/mysql-test/r/csv.result +++ b/mysql-test/r/csv.result @@ -5415,4 +5415,17 @@ foo DROP TABLE t1; +CREATE TABLE t1 ( b TEXT NOT NULL ) ENGINE=MYISAM; +INSERT INTO t1 VALUES ('x'),('y'); +CREATE TABLE t2 ( a VARCHAR(1) NOT NULL ) ENGINE=CSV; +INSERT INTO t2 VALUES ('r'),('t'); +SELECT * FROM t2 ORDER BY a; +a +r +t +SELECT * FROM t1 LEFT JOIN t2 ON ( b = a ); +b a +x NULL +y NULL +drop table t1,t2; End of 5.1 tests diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index 5fcb0e796b1..1afffd3a037 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -48,13 +48,13 @@ insert INTO t1 VALUES (110); ERROR HY000: Table has no partition for value 110 EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 90; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 90; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 90; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 89; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 3 Using where @@ -63,16 +63,16 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p90 ALL NULL NULL NULL NULL 3 Using where EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 89; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a = 100; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a >= 100; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables EXPLAIN PARTITIONS SELECT * FROM t1 WHERE a > 100; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables DROP TABLE t1; # # Bug#50104: Partitioned table with just 1 partion works with fk diff --git a/mysql-test/suite/pbxt/r/join_nested.result b/mysql-test/suite/pbxt/r/join_nested.result index 5495ba2a55d..99a260e0e6a 100644 --- a/mysql-test/suite/pbxt/r/join_nested.result +++ b/mysql-test/suite/pbxt/r/join_nested.result @@ -1316,8 +1316,8 @@ c11 c21 5 NULL EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON c11=c21; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 ALL NULL NULL NULL NULL 0 SELECT * FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON c21=c31) ON c11=c21; c11 c21 c31 4 NULL NULL diff --git a/mysql-test/suite/pbxt/r/partition_pruning.result b/mysql-test/suite/pbxt/r/partition_pruning.result index 7f96e6d06d9..64f2283fa3a 100644 --- a/mysql-test/suite/pbxt/r/partition_pruning.result +++ b/mysql-test/suite/pbxt/r/partition_pruning.result @@ -48,10 +48,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t3 p1 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t3 where a=20; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t3 where a=30; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables create table t4 (a int not null, b int not null) partition by LIST (a+b) ( partition p0 values in (12), partition p1 values in (14) @@ -118,13 +118,13 @@ partition p9 values in (9) insert into t6 values (1),(3),(5); explain partitions select * from t6 where a < 1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t6 where a <= 1; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t6 p1 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t6 where a > 9; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t6 where a >= 9; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t6 p9 ALL NULL NULL NULL NULL 0 Using where @@ -148,7 +148,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t6 where a > 3 and a < 5; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables drop table t6; create table t6 (a int unsigned not null) partition by LIST(a) ( partition p1 values in (1), @@ -160,13 +160,13 @@ partition p9 values in (9) insert into t6 values (1),(3),(5); explain partitions select * from t6 where a < 1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t6 where a <= 1; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t6 p1 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t6 where a > 9; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t6 where a >= 9; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t6 p9 ALL NULL NULL NULL NULL 0 Using where @@ -190,7 +190,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t6 p3,p5,p7 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t6 where a > 3 and a < 5; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t6 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables create table t7 (a int not null) partition by RANGE(a) ( partition p10 values less than (10), partition p30 values less than (30), @@ -216,13 +216,13 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where explain partitions select * from t7 where a = 90; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t7 where a > 90; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t7 where a >= 90; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t7 where a > 11 and a < 29; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t7 p30 ALL NULL NULL NULL NULL 2 Using where @@ -252,13 +252,13 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t7 p10,p30,p50,p70,p90 ALL NULL NULL NULL NULL 3 Using where explain partitions select * from t7 where a = 90; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t7 where a > 90; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t7 where a >= 90; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t7 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t7 where a > 11 and a < 29; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t7 p30 ALL NULL NULL NULL NULL 2 Using where @@ -301,7 +301,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p1,p2 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a1 < 3 and a1 > 3; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables drop table t1; create table t3 (a int, b int) partition by list(a) subpartition by hash(b) subpartitions 4 ( @@ -829,7 +829,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p4 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a = 18446744073709551614; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables drop table t1; create table t1 (a int) partition by range(a) ( @@ -859,10 +859,10 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p2 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a > 0xFE AND a <= 0xFF; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t2 where a > 0xFE AND a <= 0xFF; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t1 where a >= 0xFE AND a <= 0xFF; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p2 ALL NULL NULL NULL NULL 2 Using where @@ -898,7 +898,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra explain partitions select * from t1 where a > 0xFFFFFFFFFFFFFFEC and a < 0xFFFFFFFFFFFFFFEE; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables explain partitions select * from t1 where a>=0 and a <= 0xFFFFFFFFFFFFFFFF; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p1,p2,p3,p4 ALL NULL NULL NULL NULL 8 Using where diff --git a/mysql-test/suite/pbxt/r/partition_range.result b/mysql-test/suite/pbxt/r/partition_range.result index a8c4e36cbc2..013bc87d779 100644 --- a/mysql-test/suite/pbxt/r/partition_range.result +++ b/mysql-test/suite/pbxt/r/partition_range.result @@ -33,7 +33,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pnull,p0 ALL NULL NULL NULL NULL 2 Using where explain partitions select * from t1 where a > 1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables drop table t1; create table t1 (a int unsigned, b int unsigned) partition by range (a) @@ -75,7 +75,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1 ALL NULL NULL NULL NULL 4 Using where explain partitions select * from t1 where a > 1; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 0 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables drop table t1; CREATE TABLE t1 ( a int not null, diff --git a/mysql-test/suite/pbxt/r/select.result b/mysql-test/suite/pbxt/r/select.result index c06dd06ea3e..7ba4e3e5ed8 100644 --- a/mysql-test/suite/pbxt/r/select.result +++ b/mysql-test/suite/pbxt/r/select.result @@ -2333,10 +2333,10 @@ insert into t4 values (1,1); explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found -1 SIMPLE t4 const id4 NULL NULL NULL 1 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE t2 ALL NULL NULL NULL NULL 1 Using where +1 SIMPLE t2 ALL NULL NULL NULL NULL 1 +1 SIMPLE t3 ALL NULL NULL NULL NULL 0 +1 SIMPLE t4 ref id4 id4 4 test.t3.id3 1 Using where select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; id1 id2 id3 id4 id44 diff --git a/mysql-test/suite/pbxt/r/select_found.result b/mysql-test/suite/pbxt/r/select_found.result index 7896f8a9f4e..f707f703098 100644 --- a/mysql-test/suite/pbxt/r/select_found.result +++ b/mysql-test/suite/pbxt/r/select_found.result @@ -83,20 +83,20 @@ UNIQUE KEY e_n (email,name) ); EXPLAIN SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 system PRIMARY,kid NULL NULL NULL 0 const row not found -1 SIMPLE t2 index NULL e_n 104 NULL 10 +1 SIMPLE t2 ALL NULL NULL NULL NULL 200 Using temporary +1 SIMPLE t1 ref kid kid 2 test.t2.id 1 Using where; Not exists; Distinct SELECT SQL_CALC_FOUND_ROWS DISTINCT email FROM t2 LEFT JOIN t1 ON kid = t2.id WHERE t1.id IS NULL LIMIT 10; email email1 +email2 +email3 +email4 +email5 +email6 +email7 +email8 +email9 email10 -email100 -email101 -email102 -email103 -email104 -email105 -email106 -email107 SELECT FOUND_ROWS(); FOUND_ROWS() 200 diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index fd08f7c5a40..974b6a65c39 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -1820,5 +1820,20 @@ INSERT INTO t1 VALUES(-1); SELECT * FROM t1; DROP TABLE t1; +# +# Bug#970528 +# Server crashes in my_strnncollsp_simple on LEFT JOIN with CSV table, +# TEXT field +# + +CREATE TABLE t1 ( b TEXT NOT NULL ) ENGINE=MYISAM; +INSERT INTO t1 VALUES ('x'),('y'); + +CREATE TABLE t2 ( a VARCHAR(1) NOT NULL ) ENGINE=CSV; +INSERT INTO t2 VALUES ('r'),('t'); + +SELECT * FROM t2 ORDER BY a; +SELECT * FROM t1 LEFT JOIN t2 ON ( b = a ); +drop table t1,t2; --echo End of 5.1 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 5963a1c318a..790b7419d09 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2691,6 +2691,11 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds, table_vector[i]=s->table=table=tables->table; table->pos_in_table_list= tables; error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); +#ifdef WITH_PARTITION_STORAGE_ENGINE + const bool no_partitions_used= table->no_partitions_used; +#else + const bool no_partitions_used= FALSE; +#endif DBUG_EXECUTE_IF("bug11747970_raise_error", { @@ -2724,11 +2729,9 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds, if (*s->on_expr_ref) { /* s is the only inner table of an outer join */ -#ifdef WITH_PARTITION_STORAGE_ENGINE - if ((!table->file->stats.records || table->no_partitions_used) && !embedding) -#else - if (!table->file->stats.records && !embedding) -#endif + if (((!table->file->stats.records && + (table->file->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT)) || + no_partitions_used) && !embedding) { // Empty table s->dependent= 0; // Ignore LEFT JOIN depend. no_rows_const_tables |= table->map; @@ -2756,15 +2759,11 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds, while (embedding); continue; } -#ifdef WITH_PARTITION_STORAGE_ENGINE - const bool no_partitions_used= table->no_partitions_used; -#else - const bool no_partitions_used= FALSE; -#endif - if ((table->s->system || table->file->stats.records <= 1 || + if ((table->s->system || + (table->file->stats.records <= 1 && + (table->file->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT)) || no_partitions_used) && !s->dependent && - (table->file->ha_table_flags() & HA_STATS_RECORDS_IS_EXACT) && !table->fulltext_searched && !join->no_const_tables) { set_position(join,const_count++,s,(KEYUSE*) 0); diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 3a6b2b1578c..d2af7d9e713 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); |