← Back to team overview

maria-developers team mailing list archive

Re: 9bf4b92cbc5: MDEV-17554 Auto-create new partition for system versioned tables with history partitioned by INTERVAL/LIMIT

 

Hi, Aleksey!

just one comment below, no comments on all your other replies.

The issue is in review, shall I take another look or it's on you now?

On Sep 01, Aleksey Midenkov wrote:

> > > @@ -836,22 +842,26 @@ void partition_info::vers_set_hist_part(THD *thd)
> > >      {
> > >        if (next == vers_info->now_part)
> > >        {
> > > -        my_error(WARN_VERS_PART_FULL, MYF(ME_WARNING|ME_ERROR_LOG),
> > > -                table->s->db.str, table->s->table_name.str,
> > > -                vers_info->hist_part->partition_name, "LIMIT");
> > > +        if (auto_inc)
> > > +          create_count= 1;
> > > +        else
> > > +          my_error(WARN_VERS_PART_FULL, MYF(ME_WARNING|ME_ERROR_LOG),
> > > +                  table->s->db.str, table->s->table_name.str,
> > > +                  vers_info->hist_part->partition_name, "LIMIT");
> > >        }
> > >        else
> > >          vers_info->hist_part= next;
> > >      }
> > > -    return;
> > > +    // reserve at least one history partition
> > > +    if (auto_inc && create_count == 0 &&
> > > +        vers_info->hist_part->id + 1 == vers_info->now_part->id)
> > > +      create_count= 1;
> >
> > Questionable. What does it solve?
> 
> This is for the LOCK TABLES when the history partition is almost full:
> 
> -- source include/have_partition.inc
> 
> create or replace table t1 (x int)
> with system versioning partition by system_time
> limit 10 auto;
> 
> insert into t1 values (1), (2), (3), (4), (5), (6), (7), (8), (9);
> update t1 set x= x + 10;
> 
> lock tables t1 write;
> update t1 set x= 1 where x = 11;
> update t1 set x= 2 where x = 12;
> update t1 set x= 3 where x = 13;
> unlock tables;
> 
> select count(x) from t1 partition (p0);
> show create table t1;
> drop tables t1;
> 
> Imagine 1000000 instead of 10. Locked commands operate on a small subset of
> records. Nevertheless they are condemned to end in the wrong partition if
> we didn't reserve one at the LOCK TABLES (we cannot add new partitions
> while the table is locked). That of course works only if LOCK TABLES is
> short enough to not fill the whole partition (which is expected to be a
> normal scenario). We will not need this when we auto-add under LOCK TABLES.

I think you could just say that "new partitions aren't added under LOCK
TABLES" and that's all. A documented limitation for now, lifted later.

I don't think there will be a lot of users using LOCK TABLES with system
versioned tables and auto-adding of partitions. Probably the main (if
not the only) use case would be loading the dump created by mysqldump.
And it loads the _whole table_ under LOCK TABLES, so your trick won't
help anyway.

Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx


Follow ups

References