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

INTERVAL partitioning by system time does not work close to the end of timestamp range

    XMLWordPrintable

Details

    Description

      A system-time partition for the last interval in the timestamp range cannot be created – that is, partitioning by system time interval 1 year won't work in the year 2038, by system time interval 10 year won't work starting from the year 2028, etc.
      If a partition is created explicitly, the DDL fails; if the table is auto-partitioned, the DML fails (or, on debug builds, an assertion failure occurs).

      10.4 87a5d16911bb94d383480fdd49e20876ed1400f2

      MariaDB [test]> set timestamp= unix_timestamp('2024-01-21 00:00:00');
      Query OK, 0 rows affected (0.000 sec)
       
      MariaDB [test]> create table t (a int) with system versioning
          -> partition by system_time interval 10 year (
          ->   partition p1 history, partition p2 history, partition pn current
          -> );
      ERROR 1690 (22003): TIMESTAMP value is out of range in 'INTERVAL'
      

      --source include/have_partition.inc
       
      set timestamp= unix_timestamp('2024-01-21 00:00:00');
      create or replace table t (a int) with system versioning
      partition by system_time interval 10 year auto;
      insert into t values (1);
      set timestamp= unix_timestamp('2035-01-21 00:00:00');
      update t set a = 2;
      

      10.11 9a7deb1c36f9ed08a1ce48e7fd635b45c721dcd6 non-debug

      mysqltest: At line 8: query 'update t set a = 2' failed: ER_DATA_OUT_OF_RANGE (1690): TIMESTAMP value is out of range in 'INTERVAL'
      

      10.11 d0c80c211c1fe3370b68be540bb9113028c6746f debug

      mariadbd: /data/bld/10.11-asan/sql/sql_base.cc:994: void close_thread_table(THD*, TABLE**): Assertion `thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED) || thd->mdl_context.is_lock_warrantee(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED)' failed.
      240121 21:43:33 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007fc8dbc53e32 in __GI___assert_fail (assertion=0x5604c766dfa0 "thd->mdl_context.is_lock_owner(MDL_key::TABLE, table->s->db.str, table->s->table_name.str, MDL_SHARED) || thd->mdl_context.is_lock_warrantee(MDL_key::TABLE, table->s->db.str, table->s->table_name.str,"..., file=0x5604c766d140 "/data/bld/10.11-asan/sql/sql_base.cc", line=994, function=0x5604c766df00 "void close_thread_table(THD*, TABLE**)") at ./assert/assert.c:101
      #10 0x00005604c54c4d7d in close_thread_table (thd=0x62c0000b0218, table_ptr=0x62c0000b0310) at /data/bld/10.11-asan/sql/sql_base.cc:994
      #11 0x00005604c54c4591 in close_thread_tables (thd=0x62c0000b0218) at /data/bld/10.11-asan/sql/sql_base.cc:972
      #12 0x00005604c54c374a in close_thread_tables_for_query (thd=0x62c0000b0218) at /data/bld/10.11-asan/sql/sql_base.cc:793
      #13 0x00005604c5693a8d in mysql_execute_command (thd=0x62c0000b0218, is_called_from_prepared_stmt=false) at /data/bld/10.11-asan/sql/sql_parse.cc:6141
      #14 0x00005604c56a0357 in mysql_parse (thd=0x62c0000b0218, rawbuf=0x6290000e6238 "update t set a = 2", length=18, parser_state=0x7fc8d30ef9e0) at /data/bld/10.11-asan/sql/sql_parse.cc:8080
      #15 0x00005604c5675fe9 in dispatch_command (command=COM_QUERY, thd=0x62c0000b0218, packet=0x629000249219 "update t set a = 2", packet_length=18, blocking=true) at /data/bld/10.11-asan/sql/sql_parse.cc:1894
      #16 0x00005604c5672d16 in do_command (thd=0x62c0000b0218, blocking=true) at /data/bld/10.11-asan/sql/sql_parse.cc:1407
      #17 0x00005604c5b2da87 in do_handle_one_connection (connect=0x608000002eb8, put_in_cache=true) at /data/bld/10.11-asan/sql/sql_connect.cc:1415
      #18 0x00005604c5b2d448 in handle_one_connection (arg=0x608000002e38) at /data/bld/10.11-asan/sql/sql_connect.cc:1317
      #19 0x00005604c671bfe6 in pfs_spawn_thread (arg=0x617000005b98) at /data/bld/10.11-asan/storage/perfschema/pfs.cc:2201
      #20 0x00007fc8dbca8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #21 0x00007fc8dbd2861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      After MDEV-32188 (make TIMESTAMP use whole 32-bit unsigned range) the range limit will be in the year 2106, but otherwise the same problem.

      Attachments

        Activity

          People

            midenok Aleksey Midenkov
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.