Does the Confluence BandanaManager support transaction rollback?

Tino Winkler [Communardo] September 5, 2012
Recently I stumpled upon the following behavior of Confluence using the BandanaManager:
I used the BandanaManager to store several configurations to the Bandana key value store. All the calls to the BandanaManager were wrapped in a transaction, using the TransactionTemplate provided by the SAL-API. Somewhere in the middle of the storing process a RuntimeException was thrown and the storing of the data was interrupted. The following (artificial) example should demonstrate the scenario:
public void storeConfiguration() throws RuntimeException
{
    transactionTemplate.execute(new TransactionCallback()
    {
        public Object doInTransaction()
        {
            bandanaManager.setValue(context, "fooKey", "fooValue");
            throw new RuntimeException("Boom!");
            bandanaManager.setValue(context, "barKey", "barValue");
        }
    });
}

Nothing had been stored for "fooKey" before the code above executed. According to the documentation of the TransactionTemplate, the RuntimeException should have caused all the changes to be rolled back. So when calling

bandanaManager.getValue(context, "fooKey");

I expected that "null" would be returned. Instead I got "fooVale" :(

After some investigations I found out what caused this behavior:

The rollback worked for the underlying database but not for the Bandana cache. So, after empting the Bandana cache (via the Confluence administration) and w/o changing anything else, another call to

bandanaManager.getValue(context, "fooKey");

yielded the previously expected "null".

I checked the code and found out that the method "store" of the ConfluenceCachingBandanaPersister (which is used by the BandanaManager) is updating the cache in a way that causes it to ignore rollbacks. Now I'm wondering if this behavior is on purpose and the BandanaManager can't be used for transactional code or if I found a bug?
ps. I could reproduce this behavior using Confluence 4.0 and Confluence 4.3-RC1.

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
NielsJ
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 21, 2012

After speaking to Dennis I created a Bug in JIRA: https://jira.atlassian.com/browse/CONF-26695

0 votes
NielsJ
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 21, 2012

After speaking to Dennis I created a Bug in JIRA: https://jira.atlassian.com/browse/CONF-26695

0 votes
Micha Kops
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 8, 2012

I'm sorry that I am unable to answer that question - but it is indeed an interesting problem that you've found there - thanks for sharing! :)

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events