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());
}
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