[Maria-developers] BUG#939009: Making sj-materialized fields non-nullable doesn't remove the crash
Hello Igor, I've made a patch that makes temporary table's fields non-nullable. It still has one part missing, but I have discovered that it will not remove the crash. I was able to construct an example with inner join and a non-nullable key field for which best_access_path() will still access rec_per_key[...]. <testcase> create table t21 (a int NOT NULL, b int, key(a)); # note the NOT NULL key column... # we can make the key unique: create table t21a (a int NOT NULL, b int, unique key(a)); insert into t21 select a,a from test.one_k; explain select * from t21a where a=b and (b=10 or b is null); </testcase> When I debug the above EXPLAIN, I get this execution in best_access_path(): if (found_part == PREV_BITS(uint,keyinfo->key_parts) && !ref_or_null_part) //(branch not taken) if ((found_part & 1) && (!(table->file->index_flags(key, 0, 0) & HA_ONLY_WHOLE_INDEX) || found_part == PREV_BITS(uint,keyinfo->key_parts))) { //(branch taken) if (table->quick_keys.is_set(key) && !found_ref && //(C1) table->quick_key_parts[key] == max_key_part && //(C2) table->quick_n_ranges[key] == 1+test(ref_or_null_part)) //(C3) { //(branch not taken) tmp= records= (double) table->quick_rows[key]; } else { //(we end up here, where the crash is) /* Check if we have statistic about the distribution */ if ((records= keyinfo->rec_per_key[max_key_part-1])) Conclusion: marking temporary table's field as NOT NULL will not cause best_access_path to avoid accessing the " rec_per_key[max_key_part-1] " part. BR Sergei -- Sergei Petrunia, Software Developer Monty Program AB, http://askmonty.org Blog: http://s.petrunia.net/blog
participants (1)
-
Sergei Petrunia