← Back to team overview

maria-developers team mailing list archive

Re: 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

 

Hi, Nikita!

On Dec 04, Nikita Malyavin wrote:
> On Tue, 3 Dec 2019 at 23:59, Sergei Golubchik <serg@xxxxxxxxxxx> wrote:
> 
> > > > two rows are the same, if their "positions" are equal, not if
> > > > their column values are equal. Also positions are much shorter
> > > > to compare.
> > > >
> > > > after ha_index_read_map or ha_index_next you do
> > > >
> > > >   handler->position(record_buffer)
> > > >
> > > > and then you have a "position" stored in handler->ref, and it
> > > > has the length of handler->ref_length bytes. For MyISAM it's
> > > > usually the file offset, for InnoDB - PK value.
> > > >
> > > > For UPDATE you can, I suppose, call this->position(old_data) to
> > > > get the position.
> > >
> old_data could have been even not fetched, and in some cases handler
> is not cloned, so it can't work in general.

In what cases? We're talking about UPDATE here, there's `this` handler
that has already read old_data, so `this->position()` is well defined.

`handler` handler by this time is cloned, and after
`handler->ha_index_read_map()` you can read the position just fine.

So both positions exist, can be read and compared. What's not general
here, that it doesn't work for INSERT? It doesn't have to, this is
special logic for UPDATE only.

> BTW I also wonder, would this memcpy work with KEYREAD?

I presume - no, unread columns could contain some garbage.

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


Follow ups

References