Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions .github/scripts/quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,35 +95,29 @@ function build_narayana_lra {
# INITIALIZE LRA ENV
export MAVEN_OPTS="-Xmx1024m -XX:MaxMetaspaceSize=512m"

LRA_BRANCH=main

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

LRA_REPO=${LRA_REPO:-jbosstm}
LRA_BRANCH=${LRA_BRANCH:-main}
#rm -rf ~/.m2/repository/
rm -rf lra
git clone https://github.com/${NARAYANA_REPO}/lra.git -b ${LRA_BRANCH}
[ $? = 0 ] || fatal "git clone https://github.com/${NARAYANA_REPO}/lra.git failed"
git clone https://github.com/${LRA_REPO}/lra.git
[ $? = 0 ] || fatal "git clone https://github.com/${LRA_REPO}/lra.git failed"
echo "Checking if need Narayana LRA PR"
if [ -n "$NY_BRANCH" ]; then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep having $NY_BRANCH here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see, that would cause to override the lra branch with the narayana branch. So that makes sense. However the change means that we will test the quickstart with lra main branch by default instead of a fixed version

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically in this case the quickstart clones and builds lra from mmusgrov/lra.git main branch which is outdated: in fact I can see an error that we used to have with lra some months ago. cc @mmusgrov

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NY_BRANCH is the branch being tested for the narayana repo (in my case JBTM-845). I am not testing an LRA branch of the narayana repo so I need the LRA quickstarts to run against main so I introduced a new env variable for that - the problem is that the quickstarts make use of two repos (narayana and lra) and the script was not originally written to cope with that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to fix this we could add
LRA_REPO=${LRA_REPO:-jbosstm}

and then replace 'git clone https://github.com/${NARAYANA_REPO}/lra.git -b ${LRA_BRANCH}'
with
git clone https://github.com/${LRA_REPO}/lra.git -b ${LRA_BRANCH}

@mmusgrov mmusgrov Apr 28, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to fix this we could add LRA_REPO=${LRA_REPO:-jbosstm}

and then replace 'git clone https://github.com/${NARAYANA_REPO}/lra.git -b ${LRA_BRANCH}' with git clone https://github.com/${LRA_REPO}/lra.git -b ${LRA_BRANCH}

I'll give it a go
I deleted my suggestion

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks
NY_LRA_BRANCH or LRA_BRANCH are both fine with me

echo "Building NY PR"
cd lra
git fetch origin +refs/pull/*/head:refs/remotes/jbosstm/pull/*/head
[ $? = 0 ] || fatal "git fetch of pulls failed"
git checkout $NY_BRANCH
[ $? = 0 ] || fatal "git fetch of pull branch failed"
cd ../
fi

if [ $? != 0 ]; then
echo "Checkout failed: $BUILD_URL";
exit -1
fi
echo "Building LRA PR ${LRA_BRANCH}"

@mmusgrov mmusgrov Apr 28, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I removed the check if [ -n "$LRA_BRANCH" ]; because LRA_BRANCH must be set at line 99 (LRA_BRANCH=${LRA_BRANCH:-main}. And we already check for a valid branch (git checkout $LRA_BRANCH on line 110).

I also removed the -b ${LRA_BRANCH} option from the git clone step since we go a git checkout $LRA_BRANCH after cloning.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed another change, I had forgotten to update the GH Action with the new LRA_REPO and LRA_BRANCH var.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also a script/action somewhere that populates new PR descriptions with a definition of what vars are processed - I'll look for that and add these two new vars to it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made similar changes to the perf repo PR: jbosstm/performance#204

cd lra
git fetch origin +refs/pull/*/head:refs/remotes/jbosstm/pull/*/head
[ $? = 0 ] || fatal "git fetch of pulls failed"
git checkout $LRA_BRANCH
[ $? = 0 ] || fatal "Checkout failed: $BUILD_URL";

./build.sh clean install -B -DskipTests
[ $LRA_CURRENT_VERSION ] || export LRA_CURRENT_VERSION=`grep "<version>" pom.xml | head -n 2 | tail -n 1 | sed "s/ *<version>//" | sed "s#</version>##"`
cd ..

if [ $? != 0 ]; then
echo "Narayana LRA build failed: $BUILD_URL";
exit -1
fi

cd ..
}

function download_and_update_as {
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/parser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ jobs:
core.setOutput('jdk_versions', JSON.stringify(jdk_versions));

const possibleEnvVars = [
'WILDFLY_RELEASE_VERSION'
'WILDFLY_RELEASE_VERSION',
'NARAYANA_REPO',
'NARAYANA_BRANCH',
'NY_BRANCH',
'LRA_REPO',
'LRA_BRANCH'
];

const extractedEnvVars = {};
Expand Down Expand Up @@ -152,4 +157,4 @@ jobs:
jdk_version: ${{ matrix.jdk_version }}
pull_request_ref: ${{ needs.parser.outputs.pr_ref }}
pull_request_repo: ${{ needs.parser.outputs.pr_repo }}
environment_variables: ${{ needs.parser.outputs.environment_variables }}
environment_variables: ${{ needs.parser.outputs.environment_variables }}
14 changes: 14 additions & 0 deletions ArjunaJTA/object_store/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ to cater for various application requirements.
3. VolatileStoreExample shows how to use an unsafe (because it does not persist logs in the event of
failures and therefore does not support recovery) in-memory log store implementation.
4. JDBCStoreExample shows how to use a database for persisting transaction logs. This example uses [H2](https://www.h2database.com/).
5. InfinispanSlotStore shows how to use the Infinispan backed slot store. Two examples are provided,
one showing how to configure the store programmatically and the other uses a jbossts properties file.

> **Warning**
> The InfinispanSlotStore store is an experimental feature. It is not recommended for production systems and may contain breaking changes in future releases. The ARJUNA012419 warning message is printed in the logs when the feature is used.

## Usage

Expand All @@ -25,6 +30,8 @@ mvn -e compile exec:java -Dexec.mainClass=org.jboss.narayana.jta.quickstarts.Vol
mvn -e compile exec:java -Dexec.mainClass=org.jboss.narayana.jta.quickstarts.HornetqStoreExample
mvn -e compile exec:java -Dexec.mainClass=org.jboss.narayana.jta.quickstarts.FileStoreExample
mvn -e compile exec:java -Dexec.mainClass=org.jboss.narayana.jta.quickstarts.JDBCStoreExample
mvn -e compile exec:java -Dexec.mainClass=org.jboss.narayana.jta.quickstarts.InfinispanStoreExample
mvn -e compile exec:java -Dexec.mainClass=org.jboss.narayana.jta.quickstarts.InfinispanStoreConfigExample
```

The JDBCStore can be configured programmatically or via a properties file. To use the properties file pass the argument `-DUSE_JBOSSTS_PROPERTIES=true` on the command line.
Expand All @@ -33,6 +40,13 @@ The JDBCStore can be configured programmatically or via a properties file. To us

When running examples one at a time look for the output

```
DummyXAResource commit() called
DummyXAResource commit() called
```

which indicates that bother resources were asked to commit, followed by

```
[INFO] BUILD SUCCESS
```
Expand Down
6 changes: 6 additions & 0 deletions ArjunaJTA/object_store/run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ IF %ERRORLEVEL% NEQ 0 exit -1

mvn -e compile exec:java -Dexec.mainClass=org.jboss.narayana.jta.quickstarts.JDBCStoreExample %NARAYANA_VERSION_PARAM%
IF %ERRORLEVEL% NEQ 0 exit -1

mvn -e compile exec:java -Dexec.mainClass=org.jboss.narayana.jta.quickstarts.InfinispanSlotStoreExample %NARAYANA_VERSION_PARAM%
IF %ERRORLEVEL% NEQ 0 exit -1

mvn -e compile exec:java -Dexec.mainClass=org.jboss.narayana.jta.quickstarts.InfinispanSlotStoreConfigExample %NARAYANA_VERSION_PARAM%
IF %ERRORLEVEL% NEQ 0 exit -1
10 changes: 10 additions & 0 deletions ArjunaJTA/object_store/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,13 @@ mvn -e exec:java -Dexec.mainClass=org.jboss.narayana.jta.quickstarts.JDBCStoreEx
if [ "$?" != "0" ]; then
exit -1
fi

mvn -e exec:java -Dexec.mainClass=org.jboss.narayana.jta.quickstarts.InfinispanSlotStoreConfigExample $NARAYANA_VERSION_PARAM
if [ "$?" != "0" ]; then
exit -1
fi

mvn -e exec:java -Dexec.mainClass=org.jboss.narayana.jta.quickstarts.InfinispanSlotStoreExample $NARAYANA_VERSION_PARAM
if [ "$?" != "0" ]; then
exit -1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.jboss.narayana.jta.quickstarts;

import jakarta.transaction.UserTransaction;

import java.io.IOException;

public class InfinispanSlotStoreConfigExample {

public static void main(String[] args) throws Exception {
setupStore();

UserTransaction utx = com.arjuna.ats.jta.UserTransaction.userTransaction();

utx.begin();
Util.enlistResources();
utx.commit();

System.exit(0); // exit immediately
}

public static void setupStore() throws IOException {
// expose the jbossts properties file containing the config for an infinispan based slot store
String infinispanConfigFile = "infinispan-jbossts-properties.xml";

System.setProperty("com.arjuna.ats.arjuna.common.propertiesFile", infinispanConfigFile);
System.setProperty("nodeName", "node1"); // infinispan-jbossts-properties.xml "reads" the nodeName
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package org.jboss.narayana.jta.quickstarts;

import com.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean;
import com.arjuna.ats.arjuna.coordinator.TransactionReaper;
import com.arjuna.ats.internal.arjuna.objectstore.slot.SlotStoreAdaptor;
import com.arjuna.ats.internal.arjuna.objectstore.slot.SlotStoreEnvironmentBean;
import com.arjuna.ats.internal.arjuna.objectstore.slot.infinispan.InfinispanSlots;
import com.arjuna.ats.internal.arjuna.objectstore.slot.infinispan.InfinispanStoreEnvironmentBean;
import com.arjuna.common.internal.util.propertyservice.BeanPopulator;
import jakarta.transaction.UserTransaction;
import org.infinispan.manager.DefaultCacheManager;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class InfinispanSlotStoreExample {
private final static String CACHE_CONFIG_FILE = "/infinispan-config.xml";
private static final String CACHE_NAME = "sharedCache";

private static List<DefaultCacheManager> cacheManagers; // the cluster of infinispan cache managers

public static void main(String[] args) throws Exception {
setupStore();

UserTransaction utx = com.arjuna.ats.jta.UserTransaction.userTransaction();

utx.begin();
Util.enlistResources();
utx.commit();

shutdownStore();

System.exit(0); // exit immediately
}

public static void setupStore() throws IOException {
// common config for each slot store
SlotStoreEnvironmentBean slotStoreConfig = BeanPopulator.getDefaultInstance(SlotStoreEnvironmentBean.class);
InfinispanStoreEnvironmentBean config = BeanPopulator.getDefaultInstance(InfinispanStoreEnvironmentBean.class);

cacheManagers = new ArrayList<>();

var manager = createCacheManager();
var slots = new InfinispanSlots(); // slot store backed by an infinispan cache

config.setNumberOfSlots(slotStoreConfig.getNumberOfSlots());
config.setBytesPerSlot(slotStoreConfig.getBytesPerSlot());
config.setStoreDir(slotStoreConfig.getStoreDir());
config.setSyncWrites(true);
config.setSyncDeletes(true);
config.setBackingSlots(slots);

config.setNodeAddress(manager.getNodeAddress());
config.setIgnoreReturnValues(true);

config.setCacheName(CACHE_NAME);

config.setBackingSlots(slots);
config.setCache(manager.getCache(CACHE_NAME));

slots.init(config); // can throw IOException

cacheManagers.add(manager);

// tell the recovery manager that we are using the slot store
BeanPopulator.getDefaultInstance(ObjectStoreEnvironmentBean.class).
setObjectStoreType(SlotStoreAdaptor.class.getName());
}

public static void shutdownStore() {
for (DefaultCacheManager manager: cacheManagers) {
manager.shutdownAllCaches();
manager.stop();
}

TransactionReaper.terminate(true);
}

private static DefaultCacheManager createCacheManager() throws IOException {
return new DefaultCacheManager(
InfinispanSlotStoreExample.class.getResourceAsStream(CACHE_CONFIG_FILE));
}
}
24 changes: 24 additions & 0 deletions ArjunaJTA/object_store/src/main/resources/infinispan-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>

<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:16.0 http://www.infinispan.org/schemas/infinispan-config-16.0.xsd"
xmlns="urn:infinispan:config:16.0">

<jgroups>
<stack-file name="udp-stack" path="jgroups.xml" />
</jgroups>

<cache-container default-cache="sharedCache">
<transport stack="udp-stack" node-name="${nodeName}" />
<distributed-cache name="sharedCache">
<!-- file-based store to the cache that implicitly uses write-through mode -->
<persistence>
<file-store>
<data path="infinispan-caches/data"/>
<index path="infinispan-caches/index"/>
</file-store>
</persistence>
</distributed-cache>
</cache-container>
</infinispan>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="CoreEnvironmentBean.nodeIdentifier">1</entry> <!-- must be set -->
<entry key="ObjectStoreEnvironmentBean.objectStoreType">com.arjuna.ats.internal.arjuna.objectstore.slot.SlotStoreAdaptor</entry>
<entry key="ObjectStoreEnvironmentBean.stateStore.objectStoreType">com.arjuna.ats.internal.arjuna.objectstore.slot.SlotStoreAdaptor</entry>
<entry key="ObjectStoreEnvironmentBean.communicationStore.objectStoreType">com.arjuna.ats.internal.arjuna.objectstore.slot.SlotStoreAdaptor</entry>

<entry key="SlotStoreEnvironmentBean.numberOfSlots">256</entry>
<entry key="SlotStoreEnvironmentBean.bytesPerSlot">4096</entry>
<entry key="SlotStoreEnvironmentBean.backingSlotsClassName">com.arjuna.ats.internal.arjuna.objectstore.slot.infinispan.InfinispanSlots</entry>
<entry key="SlotStoreEnvironmentBean.storeDir">infinispan-caches</entry>

<entry key="InfinispanStoreEnvironmentBean.ignoreReturnValues">true</entry>
<entry key="InfinispanStoreEnvironmentBean.nodeAddress">node1</entry>
<entry key="InfinispanStoreEnvironmentBean.groupName"/>
<entry key="InfinispanStoreEnvironmentBean.slotKeyGeneratorClassName"/>

<!-- infinispan cluster config file name relative to the resource directory so begins with a slash char: -->
<entry key="InfinispanStoreEnvironmentBean.infinispanConfigFileName">/infinispan-config.xml</entry>
<!-- the cache name as configured in infinispan-config.xml -->
<entry key="InfinispanStoreEnvironmentBean.cacheName">sharedCache</entry>
</properties>
16 changes: 16 additions & 0 deletions ArjunaJTA/object_store/src/main/resources/jgroups.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups.xsd">
<SHARED_LOOPBACK/>
<SHARED_LOOPBACK_PING/>
<MERGE3 min_interval="1000" max_interval="5000"/>
<FD_ALL3 timeout="3000" interval="1000"/>
<VERIFY_SUSPECT2 timeout="1000"/>
<pbcast.NAKACK2 use_mcast_xmit="false"/>
<UNICAST3/>
<pbcast.STABLE desired_avg_gossip="5000" max_bytes="1M"/>
<pbcast.GMS print_local_addr="false" join_timeout="500"/>
<UFC max_credits="4M" min_threshold="0.4"/>
<MFC max_credits="4M" min_threshold="0.4"/>
<FRAG4/>
</config>
3 changes: 1 addition & 2 deletions ArjunaJTA/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.15.0</version>
<configuration>
<source>17</source>
<target>17</target>
<release>17</release>
</configuration>
</plugin>
<plugin>
Expand Down