Record locking - Invoicenumbers

We fail to explain why double keys could exist, are you sure there is only one servoy server running and no other processes ever acces the data in the table? (assuming you understand that connecting with a servoy developer or test servoy server on same database is an other processes)

Jan Blok:
We fail to explain why double keys could exist, are you sure there is only one servoy server running and no other processes ever acces the data in the table? (assuming you understand that connecting with a servoy developer or test servoy server on same database is an other processes)

Yes there is only 1 servoy server running…
I am gonna look into the databaseManager.getNextSequence(…) trick.
It has happened again…between 2 new records there was a time-lapse of 0,2 seconds.

we sometimes have this issue also, having double invoicenumbers with this mechanism.
(we now have a double-check that checks afterwards, if the invoicenumber is unqiue, if not, we show a warning and stop the method.)

customers do report, that they sometimes see this warning.

I don’t think it’s the record locking problem, but a broadcasting problem.
sometimes ( I can’t reproduce right now) this:

invoicenumber = invoice_to_invoice_yearnumbers.invoicenumber

is returning the previous value, while another client has already updated the value with 1.

if the broadcasting fails, for whatever reason, could this be the case? does Servoy always re-query this:

invoicenumber = invoice_to_invoice_yearnumbers.invoicenumber 

?

I will try if databaseManager.refreshFromDatabase will tackle this…

I also believe it’s broadcastproblem.
I have checked the log (becoz it recently happened again).
There are 2 times that 2063761 is changed into 2063762…but there is a period of 45 minutes in between them.
You would also expect somewhere ‘2063762’ is changed into ‘2063761’’ to explain the last 2 rows…there isn’t

log_id,server_name,table_name,column_name,log_action,pk_data,old_data,new_data,event_time,user_name
5355320,‘assyst’,‘menu’,‘factuurlaatstenummer’,3,‘1.1;’,‘2063763’,‘2063764’,‘2009-03-17 14:02:35.896’,‘1136’
5355263,‘assyst’,‘menu’,‘factuurlaatstenummer’,3,‘1.1;’,‘2063762’,‘2063763’,‘2009-03-17 14:01:10.336’,‘1136’
5355009,‘assyst’,‘menu’,‘factuurlaatstenummer’,3,‘1.1;’,‘2063761’,‘2063762’,‘2009-03-17 13:47:32.963’,‘1120’
5354454,‘assyst’,‘menu’,‘factuurlaatstenummer’,3,‘1.1;’,‘2063761’,‘2063762’,‘2009-03-17 13:02:13.766’,‘1102’

Last Friday I was at Servoy.
They told me that it would be fixed in the next version.
It had something to do that the foundset in Servoy is not updated correctly from the database…in some cases…

He also told me that databaseManager.refreshRecordFromDatabase should do the trick…after acquiring the lock