Locking strategy

Moderators: Phil Winkler, Graham Smith, Pete Tabord

Locking strategy

Postby KjetilUrne » Tue Nov 08, 2016 9:19 pm

I obviously need to read up on locking strategy...

What's the most liberal set of properties you can give an application? What's the most restrictive one? Where to find the best answers for such questions?
KjetilUrne
 
Posts: 602
Joined: Mon Oct 08, 2007 8:21 am
Location: Norway
Has thanked: 4 times
Been thanked: 1 time
 

Re: Locking strategy

Postby Pete Tabord » Wed Nov 09, 2016 10:28 am

Least restrictive of all is Strategy = None - the other settings don't matter in this case. This means no optional locks are set at all, but essential system locks (for example when adding a record, which requires a lock to prevent another record being added at the same time) are still applied. Under this strategy, it is possible for one procedure to overwrite another changes and so on.

The least restrictive strategy that provides reasonable data security is

Strategy = Full
Record Entry Locking = None (two people can access and change a record at the same time, but the second set of changes will be rejected with a message)
Report and Procedure Locking = Lock Records Lock None - records will only be locked while the specific record is being modified.
Place shared locks when 'list only' = unticked.

The disadvantage with the above is that the contents of records may change between the time they are selected by a query and the time they are actually listed, modified etc.

There isn't really a 'most restrictive' - it depends on the app. But I'll run through possible variations of the above settings to show why you might move away from the norm.

The other Strategy setting is 'basic'. This assumes you are on a basic network which offers us no facilities other than placing an exclusive lock on a specific location. It thus simulates within Ffenics such facilities as shared locks. Why would you use this? You wouldn't as far as I know because all the networks we are likely to use are 'full featured' - that includes Linux servers. Exception - a Windows peer-to-peer or 'Home' network. See separate posting for that. This setting will be much slower performing than 'full'.

Record entry locking - two alternatives, 'shared' and 'exclusive'. Shared means that if two people are on the same record neither can save changes. I can't think of any obvious situation where this would be useful, but no doubt there are some. Exclusive means if one user has a record open, no-one else can access it. Useful in financial applications and the like where you want to know if someone else in the company is looking at the same details.

Procedure locking - also two alternatives, 'lock records lock record' and 'lock files'. The second is very restrictive but also very fast and provides maximum data security. The first specifically prevents the scenario mentioned above where a record can be changed between being selected by a procedure and it being modified. But - only if the procedure is going to modify the record. If it isn't, then to get the same protection in a procedure that only produces a listing, you have to tick the 'place shared locks when list only' box.

In DFW and early editions of Ffenics, there was a problem in that the settings actually being set differed from those shown in preferences. Hence there are some comments on locking strategies from the past that were based on wrong assumptions.

I presented a paper to one of Adrian's workshops after the situation was corrected which covers the above and also the use of the locking statements in (d)EQL.
Peter J. Tabord
Head of Development
Database Software Ltd.
ptabord@ffenics.com
Pete Tabord
 
Posts: 1881
Joined: Fri Sep 07, 2007 12:48 pm
Location: Caernarfon, Gwynedd, UK
Has thanked: 0 time
Been thanked: 3 times
 

Re: Locking strategy

Postby Gil Fleming » Wed Nov 09, 2016 11:10 am

Pete, I wanted to 'like' this post but the facility has still not been reinstated. What are you all doing over there? #-o
Gil Fleming
Director
Fleming Technical Limited

You can't think about what you don't know - Mike Fidler
If you can't fight, wear a big hat - John S Fleming
The best way to have a good idea is to have lots of ideas - Linus Pauling
Gil Fleming
 
Posts: 546
Joined: Tue May 15, 2012 10:26 am
Location: Liverpool, UK
Has thanked: 1 time
Been thanked: 2 times
 

Re: Locking strategy

Postby Graham Smith » Wed Nov 09, 2016 2:31 pm

KjetilUrne wrote:What's the most liberal set of properties you can give an application? What's the most restrictive one? Where to find the best answers for such questions?

If I may ask, is there a particular issue you are trying to resolve?
Graham Smith
DataSmith, Delaware
"For every expert there is an equal and opposite expert.", Arthur C. Clarke (1917 - 2008)
"X-Clacks-Overhead: GNU Terry Pratchett"
User avatar
Graham Smith
 
Posts: 2501
Joined: Fri Sep 07, 2007 11:31 am
Location: Delaware, USA
Has thanked: 0 time
Been thanked: 1 time
 

Re: Locking strategy

Postby KjetilUrne » Thu Nov 10, 2016 9:40 pm

Graham Smith wrote:If I may ask, is there a particular issue you are trying to resolve?


Yes - and it is hopefully solved now! :-)

@Pete - Thanks a lot that was really helpful!
KjetilUrne
 
Posts: 602
Joined: Mon Oct 08, 2007 8:21 am
Location: Norway
Has thanked: 4 times
Been thanked: 1 time
 

Re: Locking strategy

Postby Graham Smith » Sat Nov 12, 2016 3:14 pm

KjetilUrne wrote:Yes - and it is hopefully solved now!

Can you elaborate on what problem you were having and what solution fixed it?
Graham Smith
DataSmith, Delaware
"For every expert there is an equal and opposite expert.", Arthur C. Clarke (1917 - 2008)
"X-Clacks-Overhead: GNU Terry Pratchett"
User avatar
Graham Smith
 
Posts: 2501
Joined: Fri Sep 07, 2007 11:31 am
Location: Delaware, USA
Has thanked: 0 time
Been thanked: 1 time
 

Re: Locking strategy

Postby KjetilUrne » Sat Nov 12, 2016 10:41 pm

Well, it was a mix of too little experience and a bit of confusion over the terms and misc possibilities (e.g "Full" in terms of what? Why isn't the other options being greyed out immediately when you choose "None" and most of all: "Shared" sounds pretty sufficient, why isn' it working like i expected). Pete's detailed explanation sorted out the last part.

The problem probably occurred because the data registration process was nested into a procedure. It didn't go well with the Out-of-the-Box settings of Ff (at least I cannot remember to have changed anything). Admittedly I didn't take the time to consider all sides of this. I dived in with the combination Strategy = Full, REL = None, R&PL = LR & LN which appears to be working good and theoretically should be a sound combination for this small application
KjetilUrne
 
Posts: 602
Joined: Mon Oct 08, 2007 8:21 am
Location: Norway
Has thanked: 4 times
Been thanked: 1 time
 

Re: Locking strategy

Postby Graham Smith » Mon Nov 14, 2016 2:23 pm

Regardless of database, I cannot recall seeing many situations in which Full/None/LR&LN did not seem to work. There are exceptions but in those cases it usually turned out that there were design problems that were a bigger problem than the locking settings.

There was one notable exception some time back but that had to do with networking problems where locks were not being released by the server. We tried several alternatives but ultimately had to disable OpLocks on the server which fixed the problem at the expense of slowing things down. Database design did play a role but was unavoidable given the nature of the application.

User behavior can also be an issue. If users tend to camp out in a particular form rather than returning to a menu when they are not actively doing things, then that can create issues. I have never found a way to effectively dealing with that since hitting people over the head with a baseball bat as a periodic reminder is usually frowned on. :roll:
Graham Smith
DataSmith, Delaware
"For every expert there is an equal and opposite expert.", Arthur C. Clarke (1917 - 2008)
"X-Clacks-Overhead: GNU Terry Pratchett"
User avatar
Graham Smith
 
Posts: 2501
Joined: Fri Sep 07, 2007 11:31 am
Location: Delaware, USA
Has thanked: 0 time
Been thanked: 1 time
 
 

Return to Ffenics 1.x

Who is online

Users browsing this forum: No registered users and 9 guests

cron