Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TX Queue: Backup reserve failed, itemId: <ID> is not found #10867

Closed
jerrinot opened this issue Jul 3, 2017 · 0 comments
Closed

TX Queue: Backup reserve failed, itemId: <ID> is not found #10867

jerrinot opened this issue Jul 3, 2017 · 0 comments

Comments

@jerrinot
Copy link
Contributor

@jerrinot jerrinot commented Jul 3, 2017

Test Case:

@RunWith(HazelcastParallelClassRunner.class)
@Category({QuickTest.class, ParallelTest.class})
public class SimuTest extends HazelcastTestSupport {

    private final TestHazelcastFactory hazelcastFactory = new TestHazelcastFactory();
    private HazelcastInstance targetInstance;

    @Before
    public void setup() {
        hazelcastFactory.newHazelcastInstance();
        targetInstance = hazelcastFactory.newHazelcastInstance();
    }

    @Test(timeout = Long.MAX_VALUE)
    public void foo() throws InterruptedException {
        final int iterationPerThread = 100000;
        for (int i = 0; i < iterationPerThread; i++) {
            timeStep();
            System.out.println("Finished iteration " + i);
            Thread.sleep(5000);
        }
    }

    private void timeStep() throws InterruptedException {
        TransactionContext ctx = targetInstance.newTransactionContext();
        ctx.beginTransaction();
        TransactionalQueue<Integer> queue = ctx.getQueue("myQueue");
        queue.offer(1);
        queue.take();
        ctx.commitTransaction();
    }
}

When running this test I can see this in logs: Backup reserve failed, itemId: <ID> is not found

This is from QueueContainer, txnOfferBackupReserve():

    public void txnOfferBackupReserve(long itemId, String transactionId) {
        QueueItem item = new QueueItem(this, itemId, null);
        Object o = txMap.put(itemId, new TxQueueItem(item).setPollOperation(false).setTransactionId(transactionId));
        if (o != null) {
            logger.severe("txnOfferBackupReserve operation-> Item exists already at txMap for itemId: " + itemId);
        }
    }

tha'ts suspicious. I believe it should use the backupmap (getBackupMap()) for reservation on entries. Also check logic in txnPollBackupReserve()

@jerrinot jerrinot added this to the 3.9 milestone Jul 3, 2017
@mmedenjak mmedenjak self-assigned this Jul 7, 2017
mmedenjak added a commit to mmedenjak/hazelcast that referenced this issue Jul 7, 2017
The transactional queue offer adds an item to the transactional map
but the offer/poll operation expects the item to be in the
(committed) backup map, logs a warning if it is not there and leaves
the uncommitted item as a leak.
This fix checks the transactional map on the backup as well and removes
the reserved item.

Also added some javadoc and removed checked exception on queue
container instantiation.

Fixes : hazelcast#10867
mmedenjak added a commit to mmedenjak/hazelcast that referenced this issue Jul 10, 2017
The transactional queue offer adds an item to the transactional map
but the offer/poll operation expects the item to be in the
(committed) backup map, logs a warning if it is not there and leaves
the uncommitted item as a leak.
This fix checks the transactional map on the backup as well and removes
the reserved item.

Also added some javadoc and removed checked exception on queue
container instantiation.

Fixes : hazelcast#10867

(cherry picked from commit 82f1a5c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants