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

Valgrind Invalid read in get_partition_id_range or unexpected ER_NO_PARTITION_FOR_GIVEN_VALUE

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.0, 10.1, 10.2
    • 10.2
    • Partitioning
    • None

    Description

      --source include/have_partition.inc
       
      CREATE TABLE t1 (i INT);
       
      ALTER TABLE t1 PARTITION BY RANGE(i) ( PARTITION p1 VALUES LESS THAN (5), PARTITION p2 VALUES LESS THAN (10));
      LOCK TABLE t1 WRITE;
      --error ER_RANGE_NOT_INCREASING_ERROR
      ALTER TABLE t1 ADD PARTITION (PARTITION p3 VALUES LESS THAN (4));
      INSERT INTO t1 VALUES (4);
       
      # Cleanup
      UNLOCK TABLES;
      DROP TABLE t1;
      

      When run with --valgrind on a debug-valgrind build, it causes the warning:

      10.2 859fe1f24d4 -DWITH_VALGRIND=YES -DCMAKE_BUILD_TYPE=Debug

      ==19944== Invalid read of size 8
      ==19944==    at 0xAF319E: get_partition_id_range(partition_info*, unsigned int*, long long*) (sql_partition.cc:3120)
      ==19944==    by 0x10B994E: ha_partition::write_row(unsigned char*) (ha_partition.cc:4170)
      ==19944==    by 0x949B80: handler::ha_write_row(unsigned char*) (handler.cc:6001)
      ==19944==    by 0x69A11B: write_record(THD*, TABLE*, st_copy_info*) (sql_insert.cc:1929)
      ==19944==    by 0x697CA6: mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool) (sql_insert.cc:1057)
      ==19944==    by 0x6BFB1A: mysql_execute_command(THD*) (sql_parse.cc:4418)
      ==19944==    by 0x6CAA3B: mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) (sql_parse.cc:7897)
      ==19944==    by 0x6B89AC: dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) (sql_parse.cc:1806)
      ==19944==    by 0x6B730F: do_command(THD*) (sql_parse.cc:1360)
      ==19944==    by 0x80AC23: do_handle_one_connection(CONNECT*) (sql_connect.cc:1335)
      ==19944==    by 0x80A9B0: handle_one_connection (sql_connect.cc:1241)
      ==19944==    by 0xC4B557: pfs_spawn_thread (pfs.cc:1862)
      ==19944==    by 0x4E3F493: start_thread (pthread_create.c:333)
      ==19944==    by 0x6A9A93E: clone (clone.S:97)
      ==19944==  Address 0xd88be18 is 40 bytes inside a block of size 56 free'd
      ==19944==    at 0x4C2CDDB: free (vg_replace_malloc.c:530)
      ==19944==    by 0x10F4700: my_free (my_malloc.c:217)
      ==19944==    by 0x10E598A: free_root (my_alloc.c:389)
      ==19944==    by 0x6BA6D2: dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) (sql_parse.cc:2399)
      ==19944==    by 0x6B730F: do_command(THD*) (sql_parse.cc:1360)
      ==19944==    by 0x80AC23: do_handle_one_connection(CONNECT*) (sql_connect.cc:1335)
      ==19944==    by 0x80A9B0: handle_one_connection (sql_connect.cc:1241)
      ==19944==    by 0xC4B557: pfs_spawn_thread (pfs.cc:1862)
      ==19944==    by 0x4E3F493: start_thread (pthread_create.c:333)
      ==19944==    by 0x6A9A93E: clone (clone.S:97)
      ==19944==  Block was alloc'd at
      ==19944==    at 0x4C2BBAF: malloc (vg_replace_malloc.c:299)
      ==19944==    by 0x10F4209: my_malloc (my_malloc.c:101)
      ==19944==    by 0x10E537A: alloc_root (my_alloc.c:184)
      ==19944==    by 0x5E5BA8: Query_arena::alloc(unsigned long) (sql_class.h:969)
      ==19944==    by 0x7E9F78: partition_info::check_range_constants(THD*) (partition_info.cc:1019)
      ==19944==    by 0x7EB85F: partition_info::check_partition_info(THD*, handlerton**, handler*, HA_CREATE_INFO*, bool) (partition_info.cc:1601)
      ==19944==    by 0xAF7275: prep_alter_part_table(THD*, TABLE*, Alter_info*, HA_CREATE_INFO*, Alter_table_ctx*, bool*, bool*) (sql_partition.cc:5243)
      ==19944==    by 0x791F40: mysql_alter_table(THD*, char*, char*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool) (sql_table.cc:8977)
      ==19944==    by 0x8107CD: Sql_cmd_alter_table::execute(THD*) (sql_alter.cc:324)
      ==19944==    by 0x6C6112: mysql_execute_command(THD*) (sql_parse.cc:6208)
      ==19944==    by 0x6CAA3B: mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) (sql_parse.cc:7897)
      ==19944==    by 0x6B89AC: dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) (sql_parse.cc:1806)
      ==19944==    by 0x6B730F: do_command(THD*) (sql_parse.cc:1360)
      ==19944==    by 0x80AC23: do_handle_one_connection(CONNECT*) (sql_connect.cc:1335)
      ==19944==    by 0x80A9B0: handle_one_connection (sql_connect.cc:1241)
      ==19944==    by 0xC4B557: pfs_spawn_thread (pfs.cc:1862)
      

      On a debug build without valgrind, it causes the unexpected error:

      10.2 859fe1f24d49 -DCMAKE_BUILD_TYPE=Debug

      mysqltest: At line 9: query 'INSERT INTO t1 VALUES (4)' failed: 1526: Table has no partition for value 4
      

      Reproducible with 10.x. Not reproducible with 5.5.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.