Written by

Question omer · Jan 13

Intersystems Data Models and ACID

Hello! 
So my question is quite simple, Do the different data models of Intersystems all support the ACID properties?
I assume that for the SQL data model implementation it does, But does it also work for global (i.e the hierarchical  data model)?
I searched the docs and the different articles, It seems for example that here its implied that the different data models of
Intersystems  DO indeed support the ACID properties and allow for safe insertion, deletion etc... in concurrent operations to the server that is.

Would love to get a clarification, Thx!

Product version: Caché 2018.1

Comments

Enrico Parisi · Jan 13

does it also work for global (i.e the hierarchical  data model)?

Simple answer: yes, it sure does.

Your code implementation need to use transactions (TSTART, TCOMMIT, TROLLBACK) commands to implement ACID.

Don't forget that, in the end, using Objects and/or SQL, the code executed use globals.

Using Objects and/or SQL the framework implement transaction for you, using globals you need to implement/code it.

0
omer  Jan 13 to Enrico Parisi

And in case i just directly access globals?
for example a simple code such as:

s ^myTracker("onSomething") = ^myTracker("onSomething") + 1

would that line above be handled by intersystems safely or not?

0
Ashok Kumar T  Jan 13 to omer

Hello @omer 

The above same is ACID complaint when using transactions. It will be reverted  to old value under transaction rollback. However, The counter values are incremented by  $Increment and $Sequence are will not changed even rollback.

LEARNING>w^myTracker("onSomething")
1
LEARNING>ts
 
TL1:LEARNING>s^myTracker("onSomething")=12
 
TL1:LEARNING>w^myTracker("onSomething")
12
TL1:LEARNING>trollback
 
LEARNING>w^myTracker("onSomething")
1
LEARNING>

$Increment and $sequence

LEARNING>write^myTracker("onSomething")
1
LEARNING>tstart
 
TL1:LEARNING>do$Increment(^myTracker("onSomething"))
 
TL1:LEARNING>write^myTracker("onSomething")
2
TL1:LEARNING>trollback
 
LEARNING>write^myTracker("onSomething")
2
LEARNING>
0
Enrico Parisi  Jan 13 to Ashok Kumar T

Hi @Ashok Kumar T , you also need to use lock to properly implement ACID, something like:

LEARNING>lock +^myTracker("onSomething")
LEARNING>w^myTracker("onSomething")
1
LEARNING>ts
 
TL1:LEARNING>s^myTracker("onSomething")=12
TL1:LEARNING>w^myTracker("onSomething")
12
TL1:LEARNING>trollback
LEARNING>w^myTracker("onSomething")
1
LEARNING>lock -^myTracker("onSomething")
LEARNING>
0
Ashok Kumar T  Jan 13 to Enrico Parisi

Hi @Enrico Parisi

Yes. Lock is crucial to achieve the ACID complaint and avoid the concurrency control issues. 

0
Enrico Parisi  Jan 13 to Enrico Parisi

Sorry, I forgot to mention that to implement properly ACID you need transactions AND locking mechanism using LOCK command.

0
omer  Jan 14 to Enrico Parisi

Thank you for your comments! 
It really clarified what i needed. 
 

0