Skip to main content

Testing new Domino 12 transaction methods

 Domino V12 EAP contains new methods to manage code transactions. The underlying C API has been there for quite some time, but I've never really looked at it. Now it's finally official and you will be able to leverage these new features in your apps.

The EAP program is currently only shipped as a Docker container, which makes the testing a bit hard - you don't have Domino Designer or easy access to the JVM. The only ways to test the APIs that I could think of were:

  • Try to import the code using DXL on the server - should work for LotusScript
  • Try server-side XPages compilation, e.g. using Jesse's NSF ODP Tooling
  • Build a jar file locally using V12 Notes.jar and reuse that
The last option seemed to be the easiest one and before I had a chance to try it, Ulrich Krause has used that in his test with Java server addin - https://www.eknori.de/2020-11-01/testing-new-database-methods-in-domino-v12-early-access-without-domino-designer-v12/

I wanted to have something more interactive, so I just use the jar from XPages app. 

Testing

So far I've executed just a few scenarios. My primary goal was to find out how close to standard ACID transactions we can get.

Test 1 - simple positive run

Nothing fancy about this. The steps are:
  • start a transaction
  • create and save a document
  • commit the transaction
I use db.search to verify number of documents in the database.


Test 2 - rollback

This is getting a bit more interesting. A rollback - something new for Domino devs.

The code is the same, I just call rollback instead of a commit.


Everything works fine, the document is not permanently stored in the database.

Test 3 - concurrent access

Transactions for a single thread/single-user operations are easy, the real problems start to appear oce things start to happen in parallel. 

I've now added a 5s sleep before the rollback, so I can run this in 2 different browser windows.



All looks good at first sight. The problem is that I definitely did not need 5 seconds to click the button in my second window, so it can only mean that the second execution got blocked for some time, until the first one was closed (with a rollback). This could be easily verified by running one of the previous tests in parallel to the Test 3 - and yes. While alone it was instant, now it finished after the Test 3 execution.

Test 4 - view access

When you have some more complex logic in your app, you may need to do some additional lookups during your transaction. I knew that this is going to be a bit tricky and I was wondering how HCL is handling this as the view index has its own life.

To test this, I've added a check to count all views in a view. First, right after the start of the transaction and then after the save. 


Now the result is not so good - I got an exception. After further testing, it seems that once you save a document in a transaction, you can no longer access any view (not just views that contain the document). 

More to follow

I have not tried DQL or any other operations yet, but I guess I'll do it soon.

Conclusion

Access to the transation APIs is definitely a step forward, but HCL will need to document the limitations. So far it seems to me that once you save a document in a transaction, you basically block all other transactions from being executed and you lose access to views in that database. It completely makes sense as the primary goal of a transactional system is to keep itself in a consistent state, but it will cause a huge performance penalty if not used carefully. It will be also interesting to see how a mix of transactional and non-transactional code behaves. 

Code for the test is on github

The XPage itself is basic - just following for each case:
<xp:panel id="t3">
<xp:button value="Test 3" id="button3">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:var tc = new net.pristo.domino.transtest.TestRunner();
viewScope.tr3 = tc.Test03(database);}]]></xp:this.action>
</xp:eventHandler></xp:button>
<br/>
<xp:inputTextarea id="inputTextarea3" readonly="true"
value="#{viewScope.tr3}">
</xp:inputTextarea>
</xp:panel>



Comments

Popular posts from this blog

Microsoft Word black box in numbering issue

This is awkward post, primarily to save the solution for future me. I have seen many people mentioning this problem over years and as I've struggled with it several times, I needed to find final and permanent solution. All editions of Microsoft Word from time to time suffer from bug in numbering. Instead of a number, black box is displayed. Sometimes it happens right after document is opened, sometimes during editing. Probably some internal structure of document gets corrupted, so based on level of corruption, different fixes could help. Many of them are listed at  https://answers.microsoft.com/en-us/office/forum/office_2010-word/ms-word-header-styles-are-showing-black-boxes/c427b21c-dcda-46ce-a506-b9a16c9f2f3f I took different approach. Since docx is just standard zip package with xml files, I decided to try if I can fix it manually. And it worked. When I extracted the docx, there was file called numbering.xml in word folder. When I examined that file, I found strange se

Quick Tip - SSJS Error line numbers

 Recently, I had to work on an app with a pretty huge server-side JavaScript codebase. Several developers with different levels of XPages knowledge worked on that project in the past, to the code is quite hard to follow. My suggestion to rewrite all the code to Java was not accepted, so we have to deal with SSJS for now. One of the most annoying things, when you work with SSJS, is that in many cases you don't know where an error is happening. If you keep things simple and allow redirection to an error page (default or custom), you get a lot of information, and usually, you don't want to scare users with that or you may even want to do something useful in a catch block to recover from the problem. If the problem is thrown directly in the XPages JS engine, it's usually an InterpretException, which contains the context information, but if you have to deal with standard Java exceptions, you don't have it. Imagine a simple scenario with a function in a ssjs lib. When you run

HCL Domino SSO with Microsoft Teams

 Microsoft Teams is probably one of the most used tools this year, it was already quite popular before the pandemic started to spread across the world this spring, but now most of the businesses I work with use it. After using it just like a chat/conferencing tool, many start to explore further capabilities of the platform. When working with Domino data in apps that are web-enabled, it can be quite easy - just add a web tab anywhere you want. The problem is, that you need to deal with user authentication.