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

Unexpected error WARN_SORTING_ON_TRUNCATED_LENGTH or assertion failure in diagnostics area #2

    XMLWordPrintable

Details

    Description

      Note: Fix for MDEV-35275 is already in the tree.

      --source include/have_innodb.inc
       
      CREATE TABLE t (f varchar(1024)) ENGINE=InnoDB;
      INSERT INTO t VALUES (REPEAT('A',1000)),(REPEAT('B',1000));
      INSERT INTO t (f) SELECT f FROM t ORDER BY f;
       
      # Cleanup
      DROP TABLE t;
      

      Now a warning upon INSERT .. SELECT would probably be expected, but instead it produces an error WARN_SORTING_ON_TRUNCATED_LENGTH on a non-debug build:

      main bf9662f6fa56cc3c14f4cb8281beb523c941d1e1

      CREATE TABLE t (f varchar(1024)) ENGINE=InnoDB;
      INSERT INTO t VALUES (REPEAT('A',1000)),(REPEAT('B',1000));
      INSERT INTO t (f) SELECT f FROM t ORDER BY f;
      bug.w2                                   [ fail ]
              Test ended at 2024-10-31 22:05:46
       
      CURRENT_TEST: bug.w2
      mysqltest: At line 5: query 'INSERT INTO t (f) SELECT f FROM t ORDER BY f' failed: WARN_SORTING_ON_TRUNCATED_LENGTH (4202): 2 values were longer than max_sort_length. Sorting used only the first 1024 bytes
      

      and a debug build fails on the assertion

      mariadbd: /data/bld/1x.main/sql/sql_error.cc:470: void Diagnostics_area::set_error_status(uint, const char*, const char*, const Sql_user_condition_identity&, const Sql_condition*): Assertion `! is_set() || m_can_overwrite_status' failed.
      241031 22:08:08 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007fd9b2653e32 in __GI___assert_fail (assertion=0x562f5e9dcf60 "! is_set() || m_can_overwrite_status", file=0x562f5e9dc8a0 "/data/bld/1x.main/sql/sql_error.cc", line=470, function=0x562f5e9dcfc0 "void Diagnostics_area::set_error_status(uint, const char*, const char*, const Sql_user_condition_identity&, const Sql_condition*)") at ./assert/assert.c:101
      #10 0x0000562f5c6124a3 in Diagnostics_area::set_error_status (this=0x62c0001e63f0, sql_errno=4202, message=0x7fd9a2ed7130 "2 values were longer than max_sort_length. Sorting used only the first 1024 bytes", sqlstate=0x562f5eacdbc0 "HY000", ucid=..., error_condition=0x0) at /data/bld/1x.main/sql/sql_error.cc:470
      #11 0x0000562f5c59b283 in THD::raise_condition (this=0x62c0001e0218, cond=0x7fd9a2ed6da0) at /data/bld/1x.main/sql/sql_class.cc:1164
      #12 0x0000562f5c332d6e in THD::raise_condition (this=0x62c0001e0218, sql_errno=4202, sqlstate=0x562f5e9dd480 "", level=Sql_state_errno_level::WARN_LEVEL_WARN, msg=0x7fd9a2ed7130 "2 values were longer than max_sort_length. Sorting used only the first 1024 bytes") at /data/bld/1x.main/sql/sql_class.h:5250
      #13 0x0000562f5c613ebe in push_warning (thd=0x62c0001e0218, level=Sql_state_errno_level::WARN_LEVEL_WARN, code=4202, msg=0x7fd9a2ed7130 "2 values were longer than max_sort_length. Sorting used only the first 1024 bytes") at /data/bld/1x.main/sql/sql_error.cc:755
      #14 0x0000562f5c614284 in push_warning_printf (thd=0x62c0001e0218, level=Sql_state_errno_level::WARN_LEVEL_WARN, code=4202, format=0x562f5ef74760 "%llu values were longer than max_sort_length. Sorting used only the first %lu bytes") at /data/bld/1x.main/sql/sql_error.cc:790
      #15 0x0000562f5c651360 in THD::push_final_warnings (this=0x62c0001e0218) at /data/bld/1x.main/sql/sql_class.h:6072
      #16 0x0000562f5c816a2e in mysql_select (thd=0x62c0001e0218, tables=0x6290000fb280, fields=..., conds=0x0, og_num=1, order=0x6290000fc390, group=0x0, having=0x0, proc_param=0x0, select_options=37385559870208, result=0x6290000fc4c0, unit=0x62c0001e4728, select_lex=0x6290000fabf8) at /data/bld/1x.main/sql/sql_select.cc:5369
      #17 0x0000562f5c7e4e97 in handle_select (thd=0x62c0001e0218, lex=0x62c0001e4648, result=0x6290000fc4c0, setup_tables_done_option=35184372088832) at /data/bld/1x.main/sql/sql_select.cc:643
      #18 0x0000562f5c6fc581 in mysql_execute_command (thd=0x62c0001e0218, is_called_from_prepared_stmt=false) at /data/bld/1x.main/sql/sql_parse.cc:4651
      #19 0x0000562f5c71241c in mysql_parse (thd=0x62c0001e0218, rawbuf=0x6290000fa238 "INSERT INTO t (f) SELECT f FROM t ORDER BY f", length=44, parser_state=0x7fd9a2ed89d0) at /data/bld/1x.main/sql/sql_parse.cc:7889
      #20 0x0000562f5c6e93c8 in dispatch_command (command=COM_QUERY, thd=0x62c0001e0218, packet=0x629000280219 "INSERT INTO t (f) SELECT f FROM t ORDER BY f", packet_length=44, blocking=true) at /data/bld/1x.main/sql/sql_parse.cc:1892
      #21 0x0000562f5c6e60d0 in do_command (thd=0x62c0001e0218, blocking=true) at /data/bld/1x.main/sql/sql_parse.cc:1405
      #22 0x0000562f5cbd6d1e in do_handle_one_connection (connect=0x608000004cb8, put_in_cache=true) at /data/bld/1x.main/sql/sql_connect.cc:1448
      #23 0x0000562f5cbd66da in handle_one_connection (arg=0x608000004c38) at /data/bld/1x.main/sql/sql_connect.cc:1350
      #24 0x0000562f5d86f578 in pfs_spawn_thread (arg=0x617000008218) at /data/bld/1x.main/storage/perfschema/pfs.cc:2198
      #25 0x00007fd9b26a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #26 0x00007fd9b272861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Attachments

        Issue Links

          Activity

            People

              oleg.smirnov Oleg Smirnov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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