Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-20595

Assertion `0 < sel && sel <= 2.0' failed in table_cond_selectivity


    • Type: Bug
    • Status: Stalled (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.1, 10.2, 10.3, 10.4
    • Fix Version/s: 10.1, 10.2, 10.3, 10.4
    • Component/s: Optimizer
    • Labels:


      I see 10.1 crashing after MDEV-20576 is pused to 10.1

      Here is the stack trace

      #5  0x00007ffff5284412 in __GI___assert_fail (assertion=0x555557773960 "0 < sel && sel <= 2.0", 
          file=0x555557772de0 "/home/varunraiko/MariaDB/10.1-dev/sql/sql_select.cc", line=7764, 
          function=0x55555777be40 <table_cond_selectivity(JOIN*, unsigned int, st_join_table*, unsigned long long)::__PRETTY_FUNCTION__> "double table_cond_selectivity(JOIN*, uint, JOIN_TAB*, table_map)") at assert.c:101
      #6  0x00005555560069bc in table_cond_selectivity (join=<optimized out>, idx=<optimized out>, s=<optimized out>, rem_tables=0)
          at /home/varunraiko/MariaDB/10.1-dev/sql/sql_select.cc:7764
      #7  0x000055555602bc3a in best_extension_by_limited_search (join=0x62b000010230, remaining_tables=2, idx=<optimized out>, 
          record_count=<optimized out>, read_time=<optimized out>, search_depth=<optimized out>, prune_level=<optimized out>, 
          use_cond_selectivity=<optimized out>) at /home/varunraiko/MariaDB/10.1-dev/sql/sql_select.cc:8022
      #8  0x000055555602d7c1 in greedy_search (use_cond_selectivity=2, prune_level=1, search_depth=62, remaining_tables=2, 
          join=0x62b000010230) at /home/varunraiko/MariaDB/10.1-dev/sql/sql_select.cc:7169
      #9  choose_plan (join=0x62b000010230, join_tables=<optimized out>) at /home/varunraiko/MariaDB/10.1-dev/sql/sql_select.cc:6745
      #10 0x0000555556090973 in make_join_statistics (join=<optimized out>, tables_list=..., keyuse_array=<optimized out>)
          at /home/varunraiko/MariaDB/10.1-dev/sql/sql_select.cc:4249
      #11 0x00005555560ab39c in JOIN::optimize_inner (this=0x62b000010230) at /home/varunraiko/MariaDB/10.1-dev/sql/sql_select.cc:1405
      #12 0x00005555560b61e4 in JOIN::optimize (this=0x62b000010230) at /home/varunraiko/MariaDB/10.1-dev/sql/sql_select.cc:1059

      This crash is reproducible with the below mtr test :

      --source include/have_sequence.inc
      create table t1 (id int, a int, PRIMARY KEY(id), key(a));
      insert into t1 select seq,seq from seq_1_to_100;
      create table t2 (id int, a int, b int, PRIMARY KEY(id), key(a), key(b));
      insert into t2 select seq,seq,seq from seq_1_to_100;
      set optimizer_use_condition_selectivity=2;
      EXPLAIN  SELECT * FROM t1 A, t1 B WHERE A.a = B.a and A.id = 65;


          Issue Links



              • Assignee:
                igor Igor Babaev
                varun Varun Gupta
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: