Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-16 Thread Sergei Golubchik
Hi, Nikita! I agree. In fact, I wrote the same in my review (should be finished in a couple of hours). I can think of one important case where in-TABLE vs in-handler makes a difference - this is partitioning. All partitions share the same TABLE, but every partition has its own handler. And in

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-16 Thread Nikita Malyavin
Yes, Sergei, you are right, it works fine! Additionally, I see now that I implement something very similar to what Sachin does -- i.e., cloning handler. I think that we can share one handler among all similar stuff, when we need to make cascade index searches. But some refactoring is required --

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-16 Thread Sergei Golubchik
Hi, Nikita! On Dec 17, Nikita Malyavin wrote: > It is used in innodb's implementation of handler::position, to copy the key > from the record buffer, which is also used to be record[0] Okay. It seems that position() was always called with record[0] as an argument. But

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-16 Thread Nikita Malyavin
It is used in innodb's implementation of handler::position, to copy the key from the record buffer, which is also used to be record[0] On Tue, 17 Dec 2019 at 01:20, Sergei Golubchik wrote: > Hi, Nikita! > > On Dec 06, Nikita Malyavin wrote: > > Hi Sergei! > > > > I traced out the problem I

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-16 Thread Sergei Golubchik
Hi, Nikita! On Dec 06, Nikita Malyavin wrote: > Hi Sergei! > > I traced out the problem I faced with refs comparison -- It's in > key_copy implementation, which uses field->get_key_image, which in > turn copied data to the buffer passed, but from `field->ptr`. The > latter is important -- it

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-10 Thread Nikita Malyavin
We've also had MDEV-19082 -- change application-time period tables to use HA_EXTRA_REMEMBER_POS. On Fri, 6 Dec 2019 at 18:33, Nikita Malyavin wrote: > Hi Sergei! > > I traced out the problem I faced with refs comparison -- It's in key_copy >

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-06 Thread Nikita Malyavin
Hi Sergei! I traced out the problem I faced with refs comparison -- It's in key_copy implementation, which uses field->get_key_image, which in turn copied data to the buffer passed, but from `field->ptr`. The latter is important -- it means, current key_copy implementation always copies data from

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-04 Thread Sergei Golubchik
Hi, Nikita! On Dec 05, Nikita Malyavin wrote: > Heh, unfortunately comparing refs will not work in conjunction with KEYREAD: > > for innodb ref can be a primary key, if it has it, so index is not > clustered. The index we're evaluating can be different from a primary key. > > In that case some

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-04 Thread Nikita Malyavin
Heh, unfortunately comparing refs will not work in conjunction with KEYREAD: for innodb ref can be a primary key, if it has it, so index is not clustered. The index we're evaluating can be different from a primary key. In that case some values can be left unfetched with KEYREAD. All that is

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-04 Thread Nikita Malyavin
Well, I've pushed that logic. Looks about 2 lines prettier ср, 4 дек. 2019 г., 19:19 Sergei Golubchik : > Hi, Nikita! > > On Dec 04, Nikita Malyavin wrote: > > > > Another case: > > suppose you have to rows in table with periods (a > (a, c), > > (c, d). > > Let us update (c,d) --> (b,d). I call

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-04 Thread Sergei Golubchik
Hi, Nikita! On Dec 04, Nikita Malyavin wrote: > > Another case: > suppose you have to rows in table with periods (a (a, c), > (c, d). > Let us update (c,d) --> (b,d). I call it "move left". > > ha_index_read_map with period_start < d will return (c,d). Again check > is_update, and call

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-04 Thread Nikita Malyavin
On Wed, 4 Dec 2019 at 01:00, Nikita Malyavin wrote: > > > On Tue, 3 Dec 2019 at 23:59, Sergei Golubchik wrote: > >> > > > > But it can be done better. You search for the key with the same >> > > > > value and a period start <= than the period start of new row. >> > > > > And then you have to

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-03 Thread Nikita Malyavin
On Wed, 4 Dec 2019 at 05:04, Sergei Golubchik 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 > > > >

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-03 Thread Sergei Golubchik
Hi, Nikita! On Dec 04, Nikita Malyavin wrote: > On Tue, 3 Dec 2019 at 23:59, Sergei Golubchik 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

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-03 Thread Nikita Malyavin
On Tue, 3 Dec 2019 at 23:59, Sergei Golubchik wrote: > > > > > But it can be done better. You search for the key with the same > > > > > value and a period start <= than the period start of new row. > > > > > And then you have to check two rows for overlaps. If you'll > > > > > search for a key

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-03 Thread Sergei Golubchik
Hi, Nikita! On Dec 03, Nikita Malyavin wrote: > > > > > > > > why "if (handler->inited != NONE)" ? > > > > What happens if it is NONE? > > > > > > > then `this` is used > > > > right, but when handler->inited is NONE? How can that happen? > > When you just insert the record, for example. Neither

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-03 Thread Nikita Malyavin
Hello! On Tue, 3 Dec 2019 at 21:52, Sergei Golubchik wrote: > Hi, Nikita! > > On Nov 26, Nikita Malyavin wrote: > > Hello, Sergei! > > I have updated the code, please see > > > >- bb-10.5-MDEV-16978-without-overlaps > >< >

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-12-03 Thread Sergei Golubchik
Hi, Nikita! On Nov 26, Nikita Malyavin wrote: > Hello, Sergei! > I have updated the code, please see > >- bb-10.5-MDEV-16978-without-overlaps > > > > branch. > > Among the changes I, having noticed that

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-11-26 Thread Nikita Malyavin
One more update: I have replaced `goto err` with `DBUG_RETURN(err())` everywhere in TABLE_SHARE::init_from_binary_frm_image, making err a callback with a closure. Making err a function helps to debug error handling a lot, so I think it's one of the good possible styles to move to. This commit is

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-11-26 Thread Nikita Malyavin
Hello, Sergei! I have updated the code, please see - bb-10.5-MDEV-16978-without-overlaps branch. Among the changes I, having noticed that innodb combination is missing, have added it, and some merging down

Re: [Maria-developers] 6ac19d09c66: MDEV-16978 Application-time periods: WITHOUT OVERLAPS

2019-11-18 Thread Sergei Golubchik
Hi, Nikita! On Nov 15, Nikita Malyavin wrote: > revision-id: 6ac19d09c66 (mariadb-10.4.4-280-g6ac19d09c66) > parent(s): 67ddb6507d5 > author: Nikita Malyavin > committer: Nikita Malyavin > timestamp: 2019-08-20 17:56:07 +1000 > message: > > MDEV-16978 Application-time periods: WITHOUT OVERLAPS