Simplicty and flexibility!

Locking Strategies for dummies!

Ever wondered why you have so much trouble with inconsistency and being locked out of your DataEase database? If the answer is YES, read one and discover how you can easily remedy it.

Full, Basic, Opportunistic - What does this really mean? We get a lot of questions about which locking to choose in DataEase, and the answers we have give - are giving, have changed over the years. I guess that if this was a simple as it "should be", there wouldn't even be three options in DataEase, and we wouldn't leave this is in your hands.

I have spent quite a lot of times over the years debating and exploring this myself, and the problem is that it is more of a philosophical problem, than a technical one. Pictures this as going into a Chinese restaurant and ordering. You get a many with 500 items, and you are vaguely familiar with 3 of them, so what do you do. Choose what you know, or go for the set menu...

A famous man once said: "Those that don't study history, are bound to repeat it", and history plays a big part in understanding locking.

The first people that adapted to the use of personal computers were accountants, and as you know, they are sticklers for accuracy. You can't adapt a sliding view on date and time when it comes to the tax man, and this is reflected heavily in the approach to solving challenges in accounting software.

Functionality like Sequence from, for instance, is especially made to insure that stored data is in "sequence", and those of you that have been around long enough, know all the problems Sequence from have caused over the years, when being used simply as an Unique ID rather than a strict sequence number. The reason for this, is the same as the reason for the problem with Locking. Read on and you will find out...

So back in the day, when accountants were in charge, computing was also very organized. People didn't just sit around all over the world, browsing, searching, updating and entering data at will. You had punchers, cut off dates and time, down time, batches etc, simple there were order.

This was the time of full locking. No idea could be worse than the idea of someone "fiddling" with the consistency of a batch run, or a bundle update.

But quickly computers become as the name predicted - personal and wide spread. We all got them and a lof of us got DataEase. The problem with or rather the brilliance with DataEase, was that it was simple and a lot of us simpletons took to it like fish to water. Finally a product that we could use without having to apprentice at IBM or having finished an advanced course at MIT.

We got it, we installed it, we pushed the buttons and dragged the menus until we got something that seemed to work, and then used it. When we needed something more, we simply repeated the routine till it again seemed to work, and so it went.

Never did we care about what all these words we came across really meant, or rather what they were supposed to mean. Networked databases was science fiction for most people, until DataEase released 4.0.

Again DataEase hit the nail on the head, and we all got a Novell box, and suddenly we could share data with all our co-workers. In those days, we didn't need to relate to Locking because DataEase did it for us. We simply installed it and chose Novell, and everything was bliss.

With Windows and DataEase for Windows entered choice. The world had become professional, and with professionalisem came responsibility. No longer could the software choose for us, we needed to know what we were doing. But did we?

With 99.9% of the human race not knowing what a locking model is, how to choose the right one? We go for the safe option.

In the UK, where I reside. We eat what most people would call dinner for breakfast - Eggs, bacon, beans, mushroom, sausages, black pudding, hash brown,toast,butter toast - and for those of you not in the know, this is not the menu this is the breakfast. And the local name for this treat, is "A full English".

But now a days, when the main business is not to plow the fields from sunup to sunset, this can be a little rich, so every Cafe will offer you leaner variations. Greg's Coffee shop, will offer you Full, Basic, Value and Greg's English for instance.

So what do you choose? I always goes for the full. It only cost 50p more, and my thinking is that I can always not eat all the stuff that is not good for me. My ego forbid me from buying value, and my taste buds would be offended if I bought basic, and since Greg looks like he is not from around here, I suspect that his choice of breakfast is not mine.

So before we completely lose track of what we are doing here, lets return to locking.

Full, Basic, Opportunistic. I am quite an adventurous person, so I could go for an Opportunistic breakfast...sorry we are about locking now, safest to go for full, don't you think?

See, that is the point. We chose according to our interpretation of the word, rather than from the understanding of what it is or does.

So, now that you have had your full english I think you are ready to delve into understanding locking:

Basic Locking. I will make it simple. Forget about Basic. That is the choice for the people that cannot make up their mind and drive 50mph in the middle lane. You either believe in locking or you don't! If you choose Basic locking after having read this, you have just wasted half an our of your life.

Full locking. Very simplified, full locking means that no data used in a transaction can change in the time it takes the transaction to complete. That sounds just right doesn't it? I don't want anyone to change the sales data for April, when I am running the end of month routine! We can't have anyone entering the plane when we are counting the passengers?

This is where the idea of full locking stem from, and obviously there is a lot of use cases where this is true. The problem is however, is this true for the majority of things your computer system si supposed to do, and are you prepared with living with the challenges/problems?

If you are dead set on "Ordnung muss sein!" take into consideration the following;

Most people that we talk to that have chosen Full contact us because it doesn't "work". They have chosen it because they have problems with inconsistency in their data. They might have started with the "lame" Basica, then moved to full and then shut all the hatches with Lock Files, Lock Everything etc.

But nothing helps, whatever they do they just get more and more problems.

The reason is simple, again it is the interpretation of a word - Inconsistency. Especially for accountants this is a seriously bad word. It kind of challenges the fundamental idea of organisation and order.

Inconsistency in DataEase simply means that what the number of records and deleted records in a table doesn't correspond with what DataEase thinks is stored in that table. But contrary to common belief, what is stored in the table is the "correct" information, and what DataEase think is wrong.

When you re-organise, DataEase simply delete all the records you thought already was deleted, and then count the ones that are still there, and update it's books i.e. RDRR.

If the data in your table was wrong because a procedure crashed in the middle of execution, DataEase just "rigg" the books to look like it is OK, it hasn't really fixed the problem.

Scared now?

DataEase was never made to be a safe and secure database, it was made to be simple, effective, fast and dynamic. If you wanted redundancy and transaction security, you either have to make it yourself (copy data before a update) or use a SQL server etc.

So won't Full locking protect me from this horrible fate then?

No! It causes it. The more you lock, the more likely you are to get inconsistency and crashes. With full locking you tell DataEase that it should not accept any data to change when you perform a transaction. So you lock all the records as you trundle along your procedure (and don't release them again until it is finished), but when you come to a record that someone else is working on, you have to wait. The fact that they just opened it too look at the funny spelling of a name, and then left on a 3 weeks holiday 2 weeks ago without shutting down their computer, doesn't change anything. It is still their lock, and it will be there till the end of time if they don't come home from holiday and close the record or the cleaning lady/lad stumble in the power lead.

After approximately 3 days you will have thought that your computer has crashed, and you pull your power lead and inconsistency is a fact.

But is it logical that you should stop everyone else to change data in records, just because you are running a statistic and want it to be 100% correct the moment it hits the printer, because they will change the data the moment it is printed, so when you get to the boardroom, it is already obsolete...

And this lead us on to the last option.

Opportunistic locking

This is the least used and least trusted locking option in DataEase, and as these things go - The right choice for 99.9% of you!

Why? Because it is not locking at all. It is a locking option, and it basically the option of not locking.

And that is the brilliance of it, it doesn't lock it simply check if data has changed since read, before it write's it back.

So the guy that read a record, goes on three weeks holiday and try to change the funny name will get told by DataEase that the date - by magic - have changed in the meantime, and he will have to start over. The guy that is running his big weekly update, got through scott free with no inconsistency, but had to accept the fact that his report might be obsolete before it hit the printer, but no more obsolete when it hit the board room.

But i leave the best bit till last. Locking takes a lot of resources, because locking is a database on the side of the database, stored on the server which is read and updated all the time to keep track of the locks.

You all know that running on a server is much slower than running it on your computer as a single user, and most of you also know that running it on your computer with Shared Local Database enabled is much slower than without.

The slowest way of running DataEase is on a server with Full locking, so it will be dramatically faster with Opportunistic locking.

When you then add that you will not get inconsistency, and that all your users will be much happier (it is after all easier for people to understand and accept that someone changed a record when it took them 3 hours to update it, then to try to understand why a big update always crashes...), it should really be a no-brainer.

And before we finish, why the heading - The Chinese Census Problem?

This is the Scenario the "business" use to explain Opportunistic Locking.

" A full Chinese census takes many months to complete, if the Chinese was to use Full Locking, it would mean that no person could be born or die when it was taken...."

So did you get the significanse of the Chinese Wall?

Published: 29/04/16 - 06:30:26 (Ulrik Jacob Hoegh - Krohn)

Related Articles

Problems with viewing help files in LegEasy 6 Windows (6.53)

The help files that accompany LegEasy 6 is the original 6.52 files in .HLP format. Windows Help (WinHlp32.exe) is a Help program that has been included with Microsoft Windows versions starting with the Microsoft Windows 3.1 operating system. However, the...

Windows 2008R2 Server and DataEase LegEasy 6 (6.53)

6.53 has now been out for 3 months, and it has been very few reported problems. No software, old or new will or can be released without some problems being reported. The intentions behind 6.53 was to create a "modern" version of DataEase 6, but without c...

False Virus Detection in 6.53: Resolved!

Soon after the release of 6.53 we started to get reports from our customers that the software wouldn't install properly. After some investigation, we found out that it installed properly but some of the system files was identified as "possible" viruses...

LegEasy Demo aka DOS 6

Dear Legacy user. Please find a little teaser on the upcoming LegEasy release. You will then be able to port your DFD app to DG3 and use it independently of DOS, DosBox etc. You will run your DFD apps in a browser window, and you can run it remotely i...

DataEase 8 Tittle Tattle

We are now gearing up towards the release of DataEase 8 later this year. As you might have suspected, software release is more of a marketing gambit these days, than a technical milestone. DataEase 8 has been released to the closed developer circle for qu...

Solving problems with Help Links in 7.2

As some of you might have experienced, there is a problem with accessing help in 7.2 DataEase 7.2 is published by DataEase International Ltd and not by us, which also apply to all version up to and including 7.2 So both support and maintenance is outside...

LegEasy 6 Windows - New Maintenance Relase #3155

Our users have asked us why they should upgrade to LegEasy 6 Windows? Is it simply because it will run under WIndows 7, or is there any other reason? It is obvious that to be able to run your application under the current version of Windows is important,...

DataEase - Migration and Upgrade Path.

DataEase is currently undergoing a big transition. Since 1995 with the release of DataEase for Windows (5) every version has more or less been an increment of this product. In Version 5 every new version was simply a bug fix. In 6 the news was OML, Webpub...

Locking Strategies for dummies!