Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  05 Dec 2018, Konstantin Olchanski, Info, Partial refactoring of ODB code 
    Reply  11 Dec 2018, Stefan Ritt, Info, Partial refactoring of ODB code 
       Reply  26 Dec 2018, Konstantin Olchanski, Info, Partial refactoring of ODB code 
          Reply  27 Dec 2018, Stefan Ritt, Info, Partial refactoring of ODB code 
Message ID: 1414     Entry time: 11 Dec 2018     In reply to: 1413     Reply to this: 1419
Author: Stefan Ritt 
Topic: Info 
Subject: Partial refactoring of ODB code 
All makes sense to me. I agree to proceed with the refactoring.

One additional comment: In the 90's when I developed this code, locking was expensive. On a decent computer you could do a couple of thousand lock operations per second before you hit the 100% 
CPU limit. Therefore I tried to reduce the number of lock operation as much as possible. Like a db_find_key locks the ODB once and then goes through all keys before it unlocks again. If I would lock for 
every key and have an ODB with ten thousands of keys, that would have taken very long in the old days. 

Now the world has changed, we can do almost a million locks a second. So a db_get_record() does not have to obtain a whole directory in one go, but can get each value separately, and if necessary lock 
the ODB on each key access. This would be slower, but only a negligible amount these days. So in the spirit of making midas more robust, we can even go a step beyond simple refactoring and change the 
locking scheme if it becomes more transparent and stable.

Best,
Stefan
ELOG V3.1.4-2e1708b5