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

Wide write locks are not shared #490

Closed
jtnelson opened this issue Sep 21, 2022 · 0 comments
Closed

Wide write locks are not shared #490

jtnelson opened this issue Sep 21, 2022 · 0 comments

Comments

@jtnelson
Copy link
Member

The Engine should acquire sharable locks on a record to allow concurrent writes to different keys. But the writes that are acquired are not actually "shared".

In EngineAtomicOperationTest.java

@Test
    public void testConcurrentWritesToDifferentKeysInSameRecord()
            throws InterruptedException {
        int numThread = 50;
        long record = 1;
        AtomicInteger failed = new AtomicInteger(0);
        CountUpLatch latch = new CountUpLatch();
        for (int i = 0; i < numThread; ++i) {
            Thread thread = new Thread(() -> {
                AtomicOperation atomic = getStore(destination);
                atomic.add(Long.toString(Time.now()), TestData.getTObject(),
                        record);
                if(!atomic.commit()) {
                    failed.incrementAndGet();
                }
                latch.countUp();
            });
            thread.start();
        }
        latch.await(numThread);
        Assert.assertEquals(0, failed.get());
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant