Re: [Firebird-devel] Read consistency patch

2018-07-25 Thread liviuslivius
>I don't know if IB's "Change View" really useful feature. Do you have some 
> expirience\opinon?
> 
> Regards,
> Vlad

Sadly, no. 
We have had too many problems with Interbase stability and the worst ever seen 
paid support (Fortunately, Delphi support works well),
that we have not tried to add another layer to have more problems. Because of 
that, we do not tested this feature enough to say something usefull.
Because of this bad support, we have spend half of the year to migrate to 
Firebird and all problems disappear :)

but from below scenario you can bring the idea

usage case:
1.
  TR1 insert and update data on TableX and is still active

2.   
  Application do
  TR2 start and we get recentCN and remember it as interestingCN
  and we do
  SELECT * FROM TABLEX
  and cache above data in some memory dataset
  TR2 commit

3.
  TR1 commit and some other transactions commited.

4.
  e.g. TR55 start and we get recentCN and remember it 
  and we got only "delta"
  SELECT * FROM TABLEX WHERE CN>interestingCN
  and we merge (which is really simple) this dataset with previously cached 
dataset
  now we remember current CN as interesting
  interestingCN:=recentCN
  TR55 commit


and we repeat point 4 e.g. by every 5 minutes to got only deltas
with only above scenario (without deletes) this is already really usefull thing.

And why i was talking about storing pair of TransactionID which was commited 
with its commit number?
Because record versions store Transaction id not CN and to make above query  
"WHERE CN>interestingCN" possible - engine must know how pair trID and its CN.


To have this scenario fully supported we need to look at problem with deleted 
records info, this require some new feature.
This can be implemented in Firebird in many ways. You know many internals and 
you can do this better than i can imagine.
But below my concept (probably bad or hard to understand, as i am not native 
English speaker)

E.g. i can imagine some idea like this"
Firebird can introduce  

GetRecentCN(NAME, param_INTERESTING_CN) (at start user can call this with NULL 
as param_INTERESTING_CN)
this can work as permanent snapshot transaction until connection end

if user do GetRecentCN(USER_KEY, param_INTERESTING_CN + X) this can progress 
transaction number (permanent snapshot id) and garbage collector and consume 
old record versions as always do
of course another user also can be interesting to "permanent snapshot" and this 
last interesting numbers should be tracked by the engine.

regards,
Karol Bieniaszewski




--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Read consistency patch

2018-07-25 Thread Roman Simakov
ср, 25 июл. 2018 г. в 10:38, liviuslivius :
> but from below scenario you can bring the idea
>
> usage case:
> 1.
>   TR1 insert and update data on TableX and is still active
>
> 2.
>   Application do
>   TR2 start and we get recentCN and remember it as interestingCN
>   and we do
>   SELECT * FROM TABLEX
>   and cache above data in some memory dataset
>   TR2 commit

Note: this SELECT may have greater CN then you have stored and it
means on the next step you may receive records already selected here.
You merge algorithm should take it into account.

> 3.
>   TR1 commit and some other transactions commited.
>
> 4.
>   e.g. TR55 start and we get recentCN and remember it
>   and we got only "delta"
>   SELECT * FROM TABLEX WHERE CN>interestingCN
>   and we merge (which is really simple) this dataset with previously cached 
> dataset
>   now we remember current CN as interesting
>   interestingCN:=recentCN
>   TR55 commit


-- 
Roman Simakov

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Read consistency patch

2018-07-25 Thread liviuslivius


> Note: this SELECT may have greater CN then you have stored and it
> means on the next step you may receive records already selected here.
> You merge algorithm should take it into account.
> 
> Roman Simakov


If transaction is in snapshot isolation mode then problem should not exists
Firebird should provide a way to got last CN from transaction start point
But merge is simple, based on Primary Key ID of the record.

regards,
Karol Bieniaszewski

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Read consistency patch

2018-07-25 Thread Roman Simakov
ср, 25 июл. 2018 г. в 13:08, liviuslivius :
>
>
> > Note: this SELECT may have greater CN then you have stored and it
> > means on the next step you may receive records already selected here.
> > You merge algorithm should take it into account.
> >
> > Roman Simakov
>
>
> If transaction is in snapshot isolation mode then problem should not exists
> Firebird should provide a way to got last CN from transaction start point
> But merge is simple, based on Primary Key ID of the record.

In this case exactly. You wrote about read committed transactions so I
made such notation)

One more note about your idea. Engine will have to read every record
in anycase. But maybe expression index could help.

-- 
Roman Simakov

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


Re: [Firebird-devel] Read consistency patch

2018-07-25 Thread liviuslivius
>>In this case exactly. You wrote about read >>committed transactions so I
>>made such notation)

ok, yes i have wroted i simplified example about read commited but here snapsot 
is vital

>>One more note about your idea. Engine >>will have to read every record
>>in anycase. But maybe expression index >>could help.

Good point! But i have not concept how to solve this. In normal case scenario, 
this will not be a big problem. Usually applications retrive small subset of 
table data. But users can have more idea where to use this feature and there 
this can be a problem.
Regards,Karol Bieniaszewski
null--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdotFirebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel


[Firebird-devel] Firebird 3 embedded om iOS

2018-07-25 Thread Svend Meyland Nicolaisen
Hi

I am sorry if this has been covered somewhere already, but I would like to know 
what it would take run Firebird 3 embedded on iOS. 

Kind regards,
Svend Meyland Nicolaisen

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel