Workaround for deadlock issue when attempting to create partitions for reference stores
A core bug has been identified, where attempting to create partitions for reference stores results in a deadlock: PIVOT-5759
Here’s a workaround for resolving this issue.
StorePartitionBase.java
can be overridden with the following to fix this issue. You can override the core version by placing this class into the package com.qfs.store.impl
in your simm-starter module.
public IEpoch allocatePartitionContent() {
final FutureValue < IEpoch > future = new FutureValue < > ();
try {
final var allocatePartitoinTask = new RecursiveAction() {
private static final long serialVersionUID = 1 L;
@Override
protected void compute() {
try {
future.setValue(mvStorePartition.allocatePartitionContent());
} catch (Exception e) {
future.setException(e);
throw e;
}
}
};
final var transactionPool = this.mixedWorkloadPool.getTransactionPool();
if (transactionPool == ForkJoinTask.getPool()) {
allocatePartitoinTask.fork();
} else {
transactionPool.submit(allocatePartitoinTask);
}
// Do not call get() on the submitted task. The current thread could steal tasks that
// use the same lock as the one we need to allocate the partition content.
// We use a future to prevent the work stealing.
return future.get();
} catch (ExecutionException | InterruptedException e) {
throw new ActiveViamRuntimeException(
"Could not allocate partition content for partition " + partitionId +
" of store " + store.getMetadata().getName() + ".", e);
}
}