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!
Comments
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.
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?
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>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>Yes. Lock is crucial to achieve the ACID complaint and avoid the concurrency control issues.
Sorry, I forgot to mention that to implement properly ACID you need transactions AND locking mechanism using LOCK command.
Thank you for your comments!
It really clarified what i needed.
💡 This question is considered a Key Question. More details here.